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

theme.keycloak.v2.admin.resources.assets.AddIdentityProvider-BMB-B0Ym.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"AddIdentityProvider-BMB-B0Ym.js","sources":["../../src/identity-providers/add/AddIdentityProvider.tsx"],"sourcesContent":["import type IdentityProviderRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation\";\nimport {\n  ActionGroup,\n  AlertVariant,\n  Button,\n  PageSection,\n} from \"@patternfly/react-core\";\nimport { useMemo } from \"react\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link, useNavigate } from \"react-router-dom\";\nimport { useAdminClient } from \"../../admin-client\";\nimport { useAlerts } from \"../../components/alert/Alerts\";\nimport { DynamicComponents } from \"../../components/dynamic/DynamicComponents\";\nimport { FormAccess } from \"../../components/form/FormAccess\";\nimport { ViewHeader } from \"../../components/view-header/ViewHeader\";\nimport { useRealm } from \"../../context/realm-context/RealmContext\";\nimport { useServerInfo } from \"../../context/server-info/ServerInfoProvider\";\nimport { toUpperCase } from \"../../util\";\nimport { useParams } from \"../../utils/useParams\";\nimport { toIdentityProvider } from \"../routes/IdentityProvider\";\nimport type { IdentityProviderCreateParams } from \"../routes/IdentityProviderCreate\";\nimport { toIdentityProviders } from \"../routes/IdentityProviders\";\nimport { GeneralSettings } from \"./GeneralSettings\";\n\nexport default function AddIdentityProvider() {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n  const { providerId } = useParams();\n  const form = useForm({ mode: \"onChange\" });\n  const serverInfo = useServerInfo();\n\n  const providerInfo = useMemo(() => {\n    const namespaces = [\n      \"org.keycloak.broker.social.SocialIdentityProvider\",\n      \"org.keycloak.broker.provider.IdentityProvider\",\n    ];\n\n    for (const namespace of namespaces) {\n      const social = serverInfo.componentTypes?.[namespace]?.find(\n        ({ id }) => id === providerId,\n      );\n\n      if (social) {\n        return social;\n      }\n    }\n  }, [serverInfo, providerId]);\n\n  const {\n    handleSubmit,\n    formState: { isValid },\n  } = form;\n\n  const { addAlert, addError } = useAlerts();\n  const navigate = useNavigate();\n  const { realm } = useRealm();\n\n  const onSubmit = async (provider: IdentityProviderRepresentation) => {\n    try {\n      await adminClient.identityProviders.create({\n        ...provider,\n        providerId,\n        alias: providerId,\n      });\n      addAlert(t(\"createIdentityProviderSuccess\"), AlertVariant.success);\n      navigate(\n        toIdentityProvider({\n          realm,\n          providerId,\n          alias: providerId,\n          tab: \"settings\",\n        }),\n      );\n    } catch (error) {\n      addError(\"createError\", error);\n    }\n  };\n\n  return (\n    <>\n      \n      \n        \n          \n            \n            {providerInfo && (\n              \n            )}\n          \n          \n            \n              {t(\"add\")}\n            \n             (\n                \n              )}\n            >\n              {t(\"cancel\")}\n            \n          \n        \n      \n    \n  );\n}\n"],"names":["AddIdentityProvider","adminClient","useAdminClient","t","useTranslation","providerId","useParams","form","useForm","serverInfo","useServerInfo","providerInfo","useMemo","namespaces","namespace","social","id","handleSubmit","isValid","addAlert","addError","useAlerts","navigate","useNavigate","realm","useRealm","onSubmit","provider","AlertVariant","toIdentityProvider","error","jsxs","Fragment","jsx","ViewHeader","toUpperCase","PageSection","FormAccess","FormProvider","GeneralSettings","DynamicComponents","ActionGroup","Button","props","Link","toIdentityProviders"],"mappings":"0wCAyBA,SAAwBA,IAAsB,CACtC,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACR,CAAE,WAAAC,GAAeC,IACjBC,EAAOC,EAAwC,CAAE,KAAM,UAAY,CAAA,EACnEC,EAAaC,IAEbC,EAAeC,EAAQ,IAAM,CACjC,MAAMC,EAAa,CACjB,oDACA,+CAAA,EAGF,UAAWC,KAAaD,EAAY,CAClC,MAAME,EAASN,EAAW,iBAAiBK,CAAS,GAAG,KACrD,CAAC,CAAE,GAAAE,KAASA,IAAOX,CAAA,EAGrB,GAAIU,EACK,OAAAA,CAEX,CAAA,EAC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