All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.DiscoveryEndpointField-D6J04Afm.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"DiscoveryEndpointField-D6J04Afm.js","sources":["../../../../../node_modules/.pnpm/[email protected]/node_modules/p-debounce/index.js","../../src/identity-providers/component/DiscoveryEndpointField.tsx"],"sourcesContent":["const pDebounce = (fn, wait, options = {}) => {\n\tif (!Number.isFinite(wait)) {\n\t\tthrow new TypeError('Expected `wait` to be a finite number');\n\t}\n\n\tlet leadingValue;\n\tlet timeout;\n\tlet resolveList = [];\n\n\treturn function (...arguments_) {\n\t\treturn new Promise(resolve => {\n\t\t\tconst shouldCallNow = options.before && !timeout;\n\n\t\t\tclearTimeout(timeout);\n\n\t\t\ttimeout = setTimeout(() => {\n\t\t\t\ttimeout = null;\n\n\t\t\t\tconst result = options.before ? leadingValue : fn.apply(this, arguments_);\n\n\t\t\t\tfor (resolve of resolveList) {\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\n\t\t\t\tresolveList = [];\n\t\t\t}, wait);\n\n\t\t\tif (shouldCallNow) {\n\t\t\t\tleadingValue = fn.apply(this, arguments_);\n\t\t\t\tresolve(leadingValue);\n\t\t\t} else {\n\t\t\t\tresolveList.push(resolve);\n\t\t\t}\n\t\t});\n\t};\n};\n\npDebounce.promise = function_ => {\n\tlet currentPromise;\n\n\treturn async function (...arguments_) {\n\t\tif (currentPromise) {\n\t\t\treturn currentPromise;\n\t\t}\n\n\t\ttry {\n\t\t\tcurrentPromise = function_.apply(this, arguments_);\n\t\t\treturn await currentPromise;\n\t\t} finally {\n\t\t\tcurrentPromise = undefined;\n\t\t}\n\t};\n};\n\nexport default pDebounce;\n","import { FormGroup, Spinner, Switch } from \"@patternfly/react-core\";\nimport debouncePromise from \"p-debounce\";\nimport { ReactNode, useMemo, useState } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { HelpItem, TextControl } from \"@keycloak/keycloak-ui-shared\";\nimport { useAdminClient } from \"../../admin-client\";\n\ntype DiscoveryEndpointFieldProps = {\n  id: string;\n  fileUpload: ReactNode;\n  children: (readOnly: boolean) => ReactNode;\n};\n\nexport const DiscoveryEndpointField = ({\n  id,\n  fileUpload,\n  children,\n}: DiscoveryEndpointFieldProps) => {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n  const {\n    setValue,\n    clearErrors,\n    formState: { errors },\n  } = useFormContext();\n  const [discovery, setDiscovery] = useState(true);\n  const [discovering, setDiscovering] = useState(false);\n  const [discoveryResult, setDiscoveryResult] =\n    useState>();\n\n  const setupForm = (result: Record) => {\n    Object.keys(result).map((k) => setValue(`config.${k}`, result[k]));\n  };\n\n  const discover = async (fromUrl: string) => {\n    setDiscovering(true);\n    try {\n      const result = await adminClient.identityProviders.importFromUrl({\n        providerId: id,\n        fromUrl,\n      });\n      setupForm(result);\n      setDiscoveryResult(result);\n    } catch (error) {\n      return (error as Error).message;\n    } finally {\n      setDiscovering(false);\n    }\n  };\n\n  const discoverDebounced = useMemo(() => debouncePromise(discover, 1000), []);\n\n  return (\n    <>\n      \n        }\n      >\n         {\n            clearErrors(\"discoveryError\");\n            setDiscovery(checked);\n          }}\n          aria-label={t(\n            id === \"oidc\" ? \"useDiscoveryEndpoint\" : \"useEntityDescriptor\",\n          )}\n        />\n      \n      {discovery && (\n         : undefined}\n          rules={{\n            required: t(\"required\"),\n            validate: (value: string) => discoverDebounced(value),\n          }}\n        />\n      )}\n      {!discovery && fileUpload}\n      {discovery && !errors.discoveryError && children(true)}\n      {!discovery && children(false)}\n    \n  );\n};\n"],"names":["pDebounce","fn","wait","options","leadingValue","timeout","resolveList","arguments_","resolve","shouldCallNow","result","function_","currentPromise","DiscoveryEndpointField","id","fileUpload","children","adminClient","useAdminClient","t","useTranslation","setValue","clearErrors","errors","useFormContext","discovery","setDiscovery","useState","discovering","setDiscovering","discoveryResult","setDiscoveryResult","setupForm","k","discover","fromUrl","error","discoverDebounced","useMemo","debouncePromise","jsxs","Fragment","jsx","FormGroup","HelpItem","Switch","_event","checked","TextControl","Spinner","value"],"mappings":"4MAAA,MAAMA,EAAY,CAACC,EAAIC,EAAMC,EAAU,CAAA,IAAO,CAC7C,GAAI,CAAC,OAAO,SAASD,CAAI,EACxB,MAAM,IAAI,UAAU,uCAAuC,EAG5D,IAAIE,EACAC,EACAC,EAAc,CAAA,EAElB,OAAO,YAAaC,EAAY,CAC/B,OAAO,IAAI,QAAQC,GAAW,CAC7B,MAAMC,EAAgBN,EAAQ,QAAU,CAACE,EAEzC,aAAaA,CAAO,EAEpBA,EAAU,WAAW,IAAM,CAC1BA,EAAU,KAEV,MAAMK,EAASP,EAAQ,OAASC,EAAeH,EAAG,MAAM,KAAMM,CAAU,EAExE,IAAKC,KAAWF,EACfE,EAAQE,CAAM,EAGfJ,EAAc,CAAA,CACd,EAAEJ,CAAI,EAEHO,GACHL,EAAeH,EAAG,MAAM,KAAMM,CAAU,EACxCC,EAAQJ,CAAY,GAEpBE,EAAY,KAAKE,CAAO,CAE5B,CAAG,CACH,CACA,EAEAR,EAAU,QAAUW,GAAa,CAChC,IAAIC,EAEJ,OAAO,kBAAmBL,EAAY,CACrC,GAAIK,EACH,OAAOA,EAGR,GAAI,CACH,OAAAA,EAAiBD,EAAU,MAAM,KAAMJ,CAAU,EAC1C,MAAMK,CAChB,QAAY,CACTA,EAAiB,MACjB,CACH,CACA,ECtCO,MAAMC,EAAyB,CAAC,CACrC,GAAAC,EACA,WAAAC,EACA,SAAAC,CACF,IAAmC,CAC3B,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACR,CACJ,SAAAC,EACA,YAAAC,EACA,UAAW,CAAE,OAAAC,CAAO,GAClBC,EAAe,EACb,CAACC,EAAWC,CAAY,EAAIC,EAAS,EAAI,EACzC,CAACC,EAAaC,CAAc,EAAIF,EAAS,EAAK,EAC9C,CAACG,EA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AC,EAAK,OACjD,MAAO,CACL,SAAU9B,EAAE,UAAU,EACtB,SAAW+B,GAAkBb,EAAkBa,CAAK,CACtD,CAAA,CACF,EAED,CAACzB,GAAaV,EACdU,GAAa,CAACF,EAAO,gBAAkBP,EAAS,EAAI,EACpD,CAACS,GAAaT,EAAS,EAAK,CAC/B,CAAA,CAAA,CAEJ","x_google_ignoreList":[0]}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy