@keycloakify/keycloak-account-ui 26.0.6-rc.1 → 260007.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/KcAccountUiLoader.d.ts +2 -4
- package/KcAccountUiLoader.js +34 -41
- package/KcAccountUiLoader.js.map +1 -1
- package/README.md +0 -49
- package/index.js.map +1 -1
- package/{KcAccountUi.js → keycloak-theme/account/KcAccountUi.tsx} +15 -7
- package/keycloak-theme/account/KcContext.ts +8 -0
- package/keycloak-theme/account/KcPage.tsx +11 -0
- package/{src → keycloak-theme/account}/account-security/AccountRow.tsx +8 -4
- package/{src → keycloak-theme/account}/account-security/DeviceActivity.tsx +11 -7
- package/{src → keycloak-theme/account}/account-security/LinkedAccounts.tsx +12 -8
- package/{src → keycloak-theme/account}/account-security/LinkedAccountsToolbar.tsx +4 -0
- package/{src → keycloak-theme/account}/account-security/SigningIn.tsx +12 -8
- package/{src → keycloak-theme/account}/api/constants.ts +4 -0
- package/{src → keycloak-theme/account}/api/methods.ts +9 -5
- package/{src → keycloak-theme/account}/api/parse-links.ts +4 -0
- package/{src → keycloak-theme/account}/api/parse-response.ts +6 -2
- package/{src → keycloak-theme/account}/api/representations.ts +4 -0
- package/{src → keycloak-theme/account}/api/request.ts +7 -3
- package/{src → keycloak-theme/account}/api.ts +11 -7
- package/{src → keycloak-theme/account}/applications/Applications.tsx +12 -8
- package/{src/public → keycloak-theme/account/assets}/content.ts +14 -20
- package/keycloak-theme/account/assets/favicon.svg +63 -0
- package/{src → keycloak-theme/account}/components/datalist/EmptyRow.tsx +4 -0
- package/{src → keycloak-theme/account}/components/page/Page.tsx +4 -0
- package/{src → keycloak-theme/account}/content/ContentComponent.tsx +10 -6
- package/keycloak-theme/account/content/fetchContent.ts +13 -0
- package/{src → keycloak-theme/account}/environment.ts +5 -1
- package/{src → keycloak-theme/account}/groups/Groups.tsx +9 -5
- package/{src → keycloak-theme/account/i18n}/i18n.ts +7 -5
- package/keycloak-theme/account/i18n/index.ts +5 -0
- package/{messages → keycloak-theme/account/i18n}/messages_ar.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_ca.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_cs.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_da.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_de.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_el.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_en.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_es.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_fa.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_fi.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_fr.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_hu.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_it.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_ja.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_ka.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_lt.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_lv.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_nl.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_no.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_pl.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_pt.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_pt_BR.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_ru.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_sk.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_sv.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_th.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_tr.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_uk.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_zh_CN.properties +8 -0
- package/{messages → keycloak-theme/account/i18n}/messages_zh_TW.properties +8 -0
- package/{src → keycloak-theme/account}/i18next.d.ts +4 -0
- package/{src → keycloak-theme/account}/oid4vci/Oid4Vci.tsx +9 -5
- package/{src → keycloak-theme/account}/organizations/Organizations.tsx +9 -5
- package/{src → keycloak-theme/account}/personal-info/PersonalInfo.tsx +13 -10
- package/{src → keycloak-theme/account}/resources/EditTheResource.tsx +8 -4
- package/{src → keycloak-theme/account}/resources/PermissionRequest.tsx +8 -4
- package/{src → keycloak-theme/account}/resources/ResourceToolbar.tsx +4 -0
- package/{src → keycloak-theme/account}/resources/Resources.tsx +6 -2
- package/{src → keycloak-theme/account}/resources/ResourcesTab.tsx +16 -12
- package/{src → keycloak-theme/account}/resources/ShareTheResource.tsx +9 -5
- package/{src → keycloak-theme/account}/resources/SharedWith.tsx +5 -1
- package/{src → keycloak-theme/account}/root/ErrorPage.tsx +4 -0
- package/{src → keycloak-theme/account}/root/Header.tsx +11 -6
- package/{src → keycloak-theme/account}/root/PageNav.tsx +9 -5
- package/{src → keycloak-theme/account}/root/Root.tsx +8 -4
- package/{src → keycloak-theme/account}/routes.tsx +18 -14
- package/{src → keycloak-theme/account}/utils/formatDate.ts +6 -3
- package/{src → keycloak-theme/account}/utils/joinPath.ts +4 -0
- package/{src → keycloak-theme/account}/utils/useAccountAlerts.ts +6 -2
- package/{src → keycloak-theme/account}/utils/usePromise.ts +4 -0
- package/package.json +18 -525
- package/src/KcAccountUiLoader.tsx +391 -370
- package/src/zKcContextLike.ts +31 -74
- package/tsconfig.tsbuildinfo +1 -0
- package/zKcContextLike.js +7 -7
- package/zKcContextLike.js.map +1 -1
- package/KcAccountUi.d.ts +0 -3
- package/KcAccountUi.js.map +0 -1
- package/account-security/AccountRow.d.ts +0 -8
- package/account-security/AccountRow.js +0 -37
- package/account-security/AccountRow.js.map +0 -1
- package/account-security/DeviceActivity.d.ts +0 -2
- package/account-security/DeviceActivity.js +0 -71
- package/account-security/DeviceActivity.js.map +0 -1
- package/account-security/LinkedAccounts.d.ts +0 -2
- package/account-security/LinkedAccounts.js +0 -40
- package/account-security/LinkedAccounts.js.map +0 -1
- package/account-security/LinkedAccountsToolbar.d.ts +0 -12
- package/account-security/LinkedAccountsToolbar.js +0 -24
- package/account-security/LinkedAccountsToolbar.js.map +0 -1
- package/account-security/SigningIn.d.ts +0 -2
- package/account-security/SigningIn.js +0 -65
- package/account-security/SigningIn.js.map +0 -1
- package/api/constants.d.ts +0 -2
- package/api/constants.js +0 -3
- package/api/constants.js.map +0 -1
- package/api/methods.d.ts +0 -31
- package/api/methods.js +0 -80
- package/api/methods.js.map +0 -1
- package/api/parse-links.d.ts +0 -5
- package/api/parse-links.js +0 -23
- package/api/parse-links.js.map +0 -1
- package/api/parse-response.d.ts +0 -5
- package/api/parse-response.js +0 -36
- package/api/parse-response.js.map +0 -1
- package/api/representations.d.ts +0 -202
- package/api/representations.js +0 -3
- package/api/representations.js.map +0 -1
- package/api/request.d.ts +0 -12
- package/api/request.js +0 -33
- package/api/request.js.map +0 -1
- package/api.d.ts +0 -13
- package/api.js +0 -46
- package/api.js.map +0 -1
- package/applications/Applications.d.ts +0 -2
- package/applications/Applications.js +0 -53
- package/applications/Applications.js.map +0 -1
- package/components/datalist/EmptyRow.d.ts +0 -5
- package/components/datalist/EmptyRow.js +0 -20
- package/components/datalist/EmptyRow.js.map +0 -1
- package/components/page/Page.d.ts +0 -7
- package/components/page/Page.js +0 -6
- package/components/page/Page.js.map +0 -1
- package/content/ContentComponent.d.ts +0 -2
- package/content/ContentComponent.js +0 -36
- package/content/ContentComponent.js.map +0 -1
- package/content/fetchContent.d.ts +0 -3
- package/content/fetchContent.js +0 -6
- package/content/fetchContent.js.map +0 -1
- package/environment.d.ts +0 -26
- package/environment.js +0 -3
- package/environment.js.map +0 -1
- package/groups/Groups.d.ts +0 -2
- package/groups/Groups.js +0 -45
- package/groups/Groups.js.map +0 -1
- package/i18n.d.ts +0 -4
- package/i18n.js +0 -32
- package/i18n.js.map +0 -1
- package/oid4vci/Oid4Vci.d.ts +0 -2
- package/oid4vci/Oid4Vci.js +0 -54
- package/oid4vci/Oid4Vci.js.map +0 -1
- package/organizations/Organizations.d.ts +0 -2
- package/organizations/Organizations.js +0 -19
- package/organizations/Organizations.js.map +0 -1
- package/personal-info/PersonalInfo.d.ts +0 -2
- package/personal-info/PersonalInfo.js +0 -69
- package/personal-info/PersonalInfo.js.map +0 -1
- package/public/content.d.ts +0 -37
- package/public/content.js +0 -50
- package/public/content.js.map +0 -1
- package/resources/EditTheResource.d.ts +0 -8
- package/resources/EditTheResource.js +0 -37
- package/resources/EditTheResource.js.map +0 -1
- package/resources/PermissionRequest.d.ts +0 -7
- package/resources/PermissionRequest.js +0 -40
- package/resources/PermissionRequest.js.map +0 -1
- package/resources/ResourceToolbar.d.ts +0 -12
- package/resources/ResourceToolbar.js +0 -24
- package/resources/ResourceToolbar.js.map +0 -1
- package/resources/Resources.d.ts +0 -2
- package/resources/Resources.js +0 -13
- package/resources/Resources.js.map +0 -1
- package/resources/ResourcesTab.d.ts +0 -5
- package/resources/ResourcesTab.js +0 -104
- package/resources/ResourcesTab.js.map +0 -1
- package/resources/ShareTheResource.d.ts +0 -9
- package/resources/ShareTheResource.js +0 -71
- package/resources/ShareTheResource.js.map +0 -1
- package/resources/SharedWith.d.ts +0 -6
- package/resources/SharedWith.js +0 -8
- package/resources/SharedWith.js.map +0 -1
- package/root/ErrorPage.d.ts +0 -5
- package/root/ErrorPage.js +0 -29
- package/root/ErrorPage.js.map +0 -1
- package/root/Header.d.ts +0 -1
- package/root/Header.js +0 -31
- package/root/Header.js.map +0 -1
- package/root/PageNav.d.ts +0 -22
- package/root/PageNav.js +0 -47
- package/root/PageNav.js.map +0 -1
- package/root/Root.d.ts +0 -1
- package/root/Root.js +0 -12
- package/root/Root.js.map +0 -1
- package/routes.d.ts +0 -16
- package/routes.js +0 -75
- package/routes.js.map +0 -1
- package/src/KcAccountUi.tsx +0 -25
- package/src/content/fetchContent.ts +0 -13
- package/src/global.d.ts +0 -9
- package/src/public/logo.svg +0 -1
- package/src/root/header.module.css +0 -3
- package/src/ui-shared/alerts/AlertPanel.tsx +0 -43
- package/src/ui-shared/alerts/Alerts.tsx +0 -82
- package/src/ui-shared/buttons/FormSubmitButton.tsx +0 -47
- package/src/ui-shared/context/ErrorPage.tsx +0 -60
- package/src/ui-shared/context/HelpContext.tsx +0 -30
- package/src/ui-shared/context/KeycloakContext.tsx +0 -97
- package/src/ui-shared/context/environment.ts +0 -50
- package/src/ui-shared/continue-cancel/ContinueCancelModal.tsx +0 -75
- package/src/ui-shared/controls/FormErrorText.tsx +0 -23
- package/src/ui-shared/controls/FormLabel.tsx +0 -40
- package/src/ui-shared/controls/HelpItem.tsx +0 -43
- package/src/ui-shared/controls/KeycloakSpinner.tsx +0 -12
- package/src/ui-shared/controls/NumberControl.tsx +0 -93
- package/src/ui-shared/controls/OrganizationTable.tsx +0 -122
- package/src/ui-shared/controls/PasswordControl.tsx +0 -71
- package/src/ui-shared/controls/PasswordInput.tsx +0 -50
- package/src/ui-shared/controls/SwitchControl.tsx +0 -67
- package/src/ui-shared/controls/TextAreaControl.tsx +0 -60
- package/src/ui-shared/controls/TextControl.tsx +0 -75
- package/src/ui-shared/controls/keycloak-text-area/KeycloakTextArea.tsx +0 -23
- package/src/ui-shared/controls/select-control/SelectControl.tsx +0 -75
- package/src/ui-shared/controls/select-control/SingleSelectControl.tsx +0 -109
- package/src/ui-shared/controls/select-control/TypeaheadSelectControl.tsx +0 -285
- package/src/ui-shared/controls/table/KeycloakDataTable.tsx +0 -597
- package/src/ui-shared/controls/table/ListEmptyState.tsx +0 -86
- package/src/ui-shared/controls/table/PaginatingTableToolbar.tsx +0 -106
- package/src/ui-shared/controls/table/TableToolbar.tsx +0 -92
- package/src/ui-shared/icons/IconMapper.tsx +0 -63
- package/src/ui-shared/index.ts +0 -1
- package/src/ui-shared/main.ts +0 -96
- package/src/ui-shared/masthead/DefaultAvatar.tsx +0 -109
- package/src/ui-shared/masthead/KeycloakDropdown.tsx +0 -48
- package/src/ui-shared/masthead/Masthead.tsx +0 -161
- package/src/ui-shared/scroll-form/FormPanel.tsx +0 -29
- package/src/ui-shared/scroll-form/FormTitle.tsx +0 -28
- package/src/ui-shared/scroll-form/ScrollForm.tsx +0 -98
- package/src/ui-shared/scroll-form/ScrollPanel.tsx +0 -21
- package/src/ui-shared/scroll-form/form-title.module.css +0 -4
- package/src/ui-shared/scroll-form/scroll-form.module.css +0 -8
- package/src/ui-shared/select/KeycloakSelect.tsx +0 -49
- package/src/ui-shared/select/SingleSelect.tsx +0 -89
- package/src/ui-shared/select/TypeaheadSelect.tsx +0 -198
- package/src/ui-shared/user-profile/LocaleSelector.tsx +0 -51
- package/src/ui-shared/user-profile/MultiInputComponent.tsx +0 -146
- package/src/ui-shared/user-profile/OptionsComponent.tsx +0 -63
- package/src/ui-shared/user-profile/SelectComponent.tsx +0 -109
- package/src/ui-shared/user-profile/TextAreaComponent.tsx +0 -23
- package/src/ui-shared/user-profile/TextComponent.tsx +0 -32
- package/src/ui-shared/user-profile/UserProfileFields.tsx +0 -243
- package/src/ui-shared/user-profile/UserProfileGroup.tsx +0 -71
- package/src/ui-shared/user-profile/utils.ts +0 -170
- package/src/ui-shared/utils/ErrorBoundary.tsx +0 -77
- package/src/ui-shared/utils/createNamedContext.ts +0 -11
- package/src/ui-shared/utils/darkMode.ts +0 -19
- package/src/ui-shared/utils/errors.ts +0 -55
- package/src/ui-shared/utils/generateId.ts +0 -1
- package/src/ui-shared/utils/getRuleValue.ts +0 -17
- package/src/ui-shared/utils/isDefined.ts +0 -3
- package/src/ui-shared/utils/useFetch.ts +0 -44
- package/src/ui-shared/utils/useRequiredContext.ts +0 -24
- package/src/ui-shared/utils/useSetTimeout.ts +0 -40
- package/src/ui-shared/utils/useStorageItem.ts +0 -51
- package/src/ui-shared/utils/useStoredState.ts +0 -38
- package/ui-shared/alerts/AlertPanel.d.ts +0 -6
- package/ui-shared/alerts/AlertPanel.js +0 -6
- package/ui-shared/alerts/AlertPanel.js.map +0 -1
- package/ui-shared/alerts/Alerts.d.ts +0 -16
- package/ui-shared/alerts/Alerts.js +0 -37
- package/ui-shared/alerts/Alerts.js.map +0 -1
- package/ui-shared/buttons/FormSubmitButton.d.ts +0 -10
- package/ui-shared/buttons/FormSubmitButton.js +0 -26
- package/ui-shared/buttons/FormSubmitButton.js.map +0 -1
- package/ui-shared/context/ErrorPage.d.ts +0 -5
- package/ui-shared/context/ErrorPage.js +0 -24
- package/ui-shared/context/ErrorPage.js.map +0 -1
- package/ui-shared/context/HelpContext.d.ts +0 -9
- package/ui-shared/context/HelpContext.js +0 -14
- package/ui-shared/context/HelpContext.js.map +0 -1
- package/ui-shared/context/KeycloakContext.d.ts +0 -12
- package/ui-shared/context/KeycloakContext.js +0 -53
- package/ui-shared/context/KeycloakContext.js.map +0 -1
- package/ui-shared/context/environment.d.ts +0 -36
- package/ui-shared/context/environment.js +0 -27
- package/ui-shared/context/environment.js.map +0 -1
- package/ui-shared/continue-cancel/ContinueCancelModal.d.ts +0 -15
- package/ui-shared/continue-cancel/ContinueCancelModal.js +0 -27
- package/ui-shared/continue-cancel/ContinueCancelModal.js.map +0 -1
- package/ui-shared/controls/FormErrorText.d.ts +0 -5
- package/ui-shared/controls/FormErrorText.js +0 -19
- package/ui-shared/controls/FormErrorText.js.map +0 -1
- package/ui-shared/controls/FormLabel.d.ts +0 -13
- package/ui-shared/controls/FormLabel.js +0 -20
- package/ui-shared/controls/FormLabel.js.map +0 -1
- package/ui-shared/controls/HelpItem.d.ts +0 -9
- package/ui-shared/controls/HelpItem.js +0 -9
- package/ui-shared/controls/HelpItem.js.map +0 -1
- package/ui-shared/controls/KeycloakSpinner.d.ts +0 -1
- package/ui-shared/controls/KeycloakSpinner.js +0 -8
- package/ui-shared/controls/KeycloakSpinner.js.map +0 -1
- package/ui-shared/controls/NumberControl.d.ts +0 -13
- package/ui-shared/controls/NumberControl.js +0 -33
- package/ui-shared/controls/NumberControl.js.map +0 -1
- package/ui-shared/controls/OrganizationTable.d.ts +0 -16
- package/ui-shared/controls/OrganizationTable.js +0 -45
- package/ui-shared/controls/OrganizationTable.js.map +0 -1
- package/ui-shared/controls/PasswordControl.d.ts +0 -9
- package/ui-shared/controls/PasswordControl.js +0 -25
- package/ui-shared/controls/PasswordControl.js.map +0 -1
- package/ui-shared/controls/PasswordInput.d.ts +0 -7
- package/ui-shared/controls/PasswordInput.js +0 -25
- package/ui-shared/controls/PasswordInput.js.map +0 -1
- package/ui-shared/controls/SwitchControl.d.ts +0 -11
- package/ui-shared/controls/SwitchControl.js +0 -29
- package/ui-shared/controls/SwitchControl.js.map +0 -1
- package/ui-shared/controls/TextAreaControl.d.ts +0 -8
- package/ui-shared/controls/TextAreaControl.js +0 -12
- package/ui-shared/controls/TextAreaControl.js.map +0 -1
- package/ui-shared/controls/TextControl.d.ts +0 -11
- package/ui-shared/controls/TextControl.js +0 -24
- package/ui-shared/controls/TextControl.js.map +0 -1
- package/ui-shared/controls/keycloak-text-area/KeycloakTextArea.d.ts +0 -4
- package/ui-shared/controls/keycloak-text-area/KeycloakTextArea.js +0 -5
- package/ui-shared/controls/keycloak-text-area/KeycloakTextArea.js.map +0 -1
- package/ui-shared/controls/select-control/SelectControl.d.ts +0 -31
- package/ui-shared/controls/select-control/SelectControl.js +0 -28
- package/ui-shared/controls/select-control/SelectControl.js.map +0 -1
- package/ui-shared/controls/select-control/SingleSelectControl.d.ts +0 -3
- package/ui-shared/controls/select-control/SingleSelectControl.js +0 -43
- package/ui-shared/controls/select-control/SingleSelectControl.js.map +0 -1
- package/ui-shared/controls/select-control/TypeaheadSelectControl.d.ts +0 -3
- package/ui-shared/controls/select-control/TypeaheadSelectControl.js +0 -140
- package/ui-shared/controls/select-control/TypeaheadSelectControl.js.map +0 -1
- package/ui-shared/controls/table/KeycloakDataTable.d.ts +0 -64
- package/ui-shared/controls/table/KeycloakDataTable.js +0 -279
- package/ui-shared/controls/table/KeycloakDataTable.js.map +0 -1
- package/ui-shared/controls/table/ListEmptyState.d.ts +0 -20
- package/ui-shared/controls/table/ListEmptyState.js +0 -11
- package/ui-shared/controls/table/ListEmptyState.js.map +0 -1
- package/ui-shared/controls/table/PaginatingTableToolbar.d.ts +0 -21
- package/ui-shared/controls/table/PaginatingTableToolbar.js +0 -27
- package/ui-shared/controls/table/PaginatingTableToolbar.js.map +0 -1
- package/ui-shared/controls/table/TableToolbar.d.ts +0 -12
- package/ui-shared/controls/table/TableToolbar.js +0 -30
- package/ui-shared/controls/table/TableToolbar.js.map +0 -1
- package/ui-shared/icons/IconMapper.d.ts +0 -5
- package/ui-shared/icons/IconMapper.js +0 -40
- package/ui-shared/icons/IconMapper.js.map +0 -1
- package/ui-shared/index.d.ts +0 -1
- package/ui-shared/index.js +0 -2
- package/ui-shared/index.js.map +0 -1
- package/ui-shared/main.d.ts +0 -45
- package/ui-shared/main.js +0 -41
- package/ui-shared/main.js.map +0 -1
- package/ui-shared/masthead/DefaultAvatar.d.ts +0 -7
- package/ui-shared/masthead/DefaultAvatar.js +0 -26
- package/ui-shared/masthead/DefaultAvatar.js.map +0 -1
- package/ui-shared/masthead/KeycloakDropdown.d.ts +0 -10
- package/ui-shared/masthead/KeycloakDropdown.js +0 -23
- package/ui-shared/masthead/KeycloakDropdown.js.map +0 -1
- package/ui-shared/masthead/Masthead.d.ts +0 -19
- package/ui-shared/masthead/Masthead.js +0 -55
- package/ui-shared/masthead/Masthead.js.map +0 -1
- package/ui-shared/scroll-form/FormPanel.d.ts +0 -8
- package/ui-shared/scroll-form/FormPanel.js +0 -9
- package/ui-shared/scroll-form/FormPanel.js.map +0 -1
- package/ui-shared/scroll-form/FormTitle.d.ts +0 -8
- package/ui-shared/scroll-form/FormTitle.js +0 -19
- package/ui-shared/scroll-form/FormTitle.js.map +0 -1
- package/ui-shared/scroll-form/ScrollForm.d.ts +0 -15
- package/ui-shared/scroll-form/ScrollForm.js +0 -38
- package/ui-shared/scroll-form/ScrollForm.js.map +0 -1
- package/ui-shared/scroll-form/ScrollPanel.d.ts +0 -7
- package/ui-shared/scroll-form/ScrollPanel.js +0 -18
- package/ui-shared/scroll-form/ScrollPanel.js.map +0 -1
- package/ui-shared/scroll-form/form-title.module.css +0 -4
- package/ui-shared/scroll-form/scroll-form.module.css +0 -8
- package/ui-shared/select/KeycloakSelect.d.ts +0 -30
- package/ui-shared/select/KeycloakSelect.js +0 -31
- package/ui-shared/select/KeycloakSelect.js.map +0 -1
- package/ui-shared/select/SingleSelect.d.ts +0 -4
- package/ui-shared/select/SingleSelect.js +0 -49
- package/ui-shared/select/SingleSelect.js.map +0 -1
- package/ui-shared/select/TypeaheadSelect.d.ts +0 -2
- package/ui-shared/select/TypeaheadSelect.js +0 -96
- package/ui-shared/select/TypeaheadSelect.js.map +0 -1
- package/ui-shared/user-profile/LocaleSelector.d.ts +0 -7
- package/ui-shared/user-profile/LocaleSelector.js +0 -28
- package/ui-shared/user-profile/LocaleSelector.js.map +0 -1
- package/ui-shared/user-profile/MultiInputComponent.d.ts +0 -15
- package/ui-shared/user-profile/MultiInputComponent.js +0 -61
- package/ui-shared/user-profile/MultiInputComponent.js.map +0 -1
- package/ui-shared/user-profile/OptionsComponent.d.ts +0 -2
- package/ui-shared/user-profile/OptionsComponent.js +0 -29
- package/ui-shared/user-profile/OptionsComponent.js.map +0 -1
- package/ui-shared/user-profile/SelectComponent.d.ts +0 -2
- package/ui-shared/user-profile/SelectComponent.js +0 -56
- package/ui-shared/user-profile/SelectComponent.js.map +0 -1
- package/ui-shared/user-profile/TextAreaComponent.d.ts +0 -2
- package/ui-shared/user-profile/TextAreaComponent.js +0 -11
- package/ui-shared/user-profile/TextAreaComponent.js.map +0 -1
- package/ui-shared/user-profile/TextComponent.d.ts +0 -2
- package/ui-shared/user-profile/TextComponent.js +0 -14
- package/ui-shared/user-profile/TextComponent.js.map +0 -1
- package/ui-shared/user-profile/UserProfileFields.d.ts +0 -37
- package/ui-shared/user-profile/UserProfileFields.js +0 -94
- package/ui-shared/user-profile/UserProfileFields.js.map +0 -1
- package/ui-shared/user-profile/UserProfileGroup.d.ts +0 -12
- package/ui-shared/user-profile/UserProfileGroup.js +0 -15
- package/ui-shared/user-profile/UserProfileGroup.js.map +0 -1
- package/ui-shared/user-profile/utils.d.ts +0 -32
- package/ui-shared/user-profile/utils.js +0 -84
- package/ui-shared/user-profile/utils.js.map +0 -1
- package/ui-shared/utils/ErrorBoundary.d.ts +0 -26
- package/ui-shared/utils/ErrorBoundary.js +0 -29
- package/ui-shared/utils/ErrorBoundary.js.map +0 -1
- package/ui-shared/utils/createNamedContext.d.ts +0 -3
- package/ui-shared/utils/createNamedContext.js +0 -7
- package/ui-shared/utils/createNamedContext.js.map +0 -1
- package/ui-shared/utils/darkMode.d.ts +0 -1
- package/ui-shared/utils/darkMode.js +0 -16
- package/ui-shared/utils/darkMode.js.map +0 -1
- package/ui-shared/utils/errors.d.ts +0 -4
- package/ui-shared/utils/errors.js +0 -42
- package/ui-shared/utils/errors.js.map +0 -1
- package/ui-shared/utils/generateId.d.ts +0 -1
- package/ui-shared/utils/generateId.js +0 -2
- package/ui-shared/utils/generateId.js.map +0 -1
- package/ui-shared/utils/getRuleValue.d.ts +0 -2
- package/ui-shared/utils/getRuleValue.js +0 -12
- package/ui-shared/utils/getRuleValue.js.map +0 -1
- package/ui-shared/utils/isDefined.d.ts +0 -1
- package/ui-shared/utils/isDefined.js +0 -4
- package/ui-shared/utils/isDefined.js.map +0 -1
- package/ui-shared/utils/useFetch.d.ts +0 -17
- package/ui-shared/utils/useFetch.js +0 -38
- package/ui-shared/utils/useFetch.js.map +0 -1
- package/ui-shared/utils/useRequiredContext.d.ts +0 -9
- package/ui-shared/utils/useRequiredContext.js +0 -17
- package/ui-shared/utils/useRequiredContext.js.map +0 -1
- package/ui-shared/utils/useSetTimeout.d.ts +0 -1
- package/ui-shared/utils/useSetTimeout.js +0 -32
- package/ui-shared/utils/useSetTimeout.js.map +0 -1
- package/ui-shared/utils/useStorageItem.d.ts +0 -10
- package/ui-shared/utils/useStorageItem.js +0 -40
- package/ui-shared/utils/useStorageItem.js.map +0 -1
- package/ui-shared/utils/useStoredState.d.ts +0 -13
- package/ui-shared/utils/useStoredState.js +0 -21
- package/ui-shared/utils/useStoredState.js.map +0 -1
- package/utils/formatDate.d.ts +0 -4
- package/utils/formatDate.js +0 -12
- package/utils/formatDate.js.map +0 -1
- package/utils/joinPath.d.ts +0 -1
- package/utils/joinPath.js +0 -18
- package/utils/joinPath.js.map +0 -1
- package/utils/useAccountAlerts.d.ts +0 -4
- package/utils/useAccountAlerts.js +0 -19
- package/utils/useAccountAlerts.js.map +0 -1
- package/utils/usePromise.d.ts +0 -41
- package/utils/usePromise.js +0 -59
- package/utils/usePromise.js.map +0 -1
- /package/{public → keycloak-theme/account/assets}/logo.svg +0 -0
- /package/{root → keycloak-theme/account/root}/header.module.css +0 -0
|
@@ -1,443 +1,464 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
-
import { Suspense, useMemo, type LazyExoticComponent } from "react";
|
|
4
|
-
import { assert, is } from "tsafe/assert";
|
|
5
|
-
import type { Environment } from "@keycloakify/keycloak-account-ui/environment";
|
|
6
|
-
import type { MenuItem } from "@keycloakify/keycloak-account-ui/root/PageNav";
|
|
7
|
-
import { joinPath } from "@keycloakify/keycloak-account-ui/utils/joinPath";
|
|
8
|
-
import defaultContent from "@keycloakify/keycloak-account-ui/public/content";
|
|
9
|
-
import defaultLogoSvgUrl from "@keycloakify/keycloak-account-ui/public/logo.svg";
|
|
3
|
+
import { Suspense, useMemo, type LazyExoticComponent, type ReactElement } from "react";
|
|
4
|
+
import { assert, is, type Equals } from "tsafe/assert";
|
|
10
5
|
import { getI18n } from "react-i18next";
|
|
11
6
|
//import { logValidationResult } from "./zKcContextLike";
|
|
12
7
|
|
|
8
|
+
import type { AccountEnvironment as Environment_target } from "@keycloak/keycloak-account-ui";
|
|
9
|
+
|
|
10
|
+
type Environment = {
|
|
11
|
+
serverBaseUrl: string;
|
|
12
|
+
realm: string;
|
|
13
|
+
clientId: string;
|
|
14
|
+
resourceUrl: string;
|
|
15
|
+
logo: string;
|
|
16
|
+
logoUrl: string;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
locale: string;
|
|
19
|
+
referrerName?: string;
|
|
20
|
+
referrerUrl?: string;
|
|
21
|
+
features: {
|
|
22
|
+
isRegistrationEmailAsUsername: boolean;
|
|
23
|
+
isEditUserNameAllowed: boolean;
|
|
24
|
+
isLinkedAccountsEnabled: boolean;
|
|
25
|
+
isMyResourcesEnabled: boolean;
|
|
26
|
+
deleteAccountAllowed: boolean;
|
|
27
|
+
updateEmailFeatureEnabled: boolean;
|
|
28
|
+
updateEmailActionEnabled: boolean;
|
|
29
|
+
isViewGroupsEnabled: boolean;
|
|
30
|
+
isViewOrganizationsEnabled: boolean;
|
|
31
|
+
isOid4VciEnabled: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
assert<Equals<Environment, Environment_target>>;
|
|
36
|
+
|
|
13
37
|
export type KcContextLike =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
| KcContextLike.Keycloak25AndUp
|
|
39
|
+
| KcContextLike.Keycloak20To24
|
|
40
|
+
| KcContextLike.Keycloak19;
|
|
17
41
|
|
|
18
42
|
export namespace KcContextLike {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
export type Common = {
|
|
44
|
+
realm: {
|
|
45
|
+
name: string;
|
|
46
|
+
registrationEmailAsUsername: boolean;
|
|
47
|
+
editUsernameAllowed: boolean;
|
|
48
|
+
isInternationalizationEnabled: boolean;
|
|
49
|
+
identityFederationEnabled: boolean;
|
|
50
|
+
userManagedAccessAllowed: boolean;
|
|
51
|
+
};
|
|
52
|
+
resourceUrl: string;
|
|
53
|
+
baseUrl: {
|
|
54
|
+
rawSchemeSpecificPart: string;
|
|
55
|
+
scheme: string;
|
|
56
|
+
};
|
|
57
|
+
locale: string;
|
|
58
|
+
isAuthorizationEnabled: boolean;
|
|
59
|
+
deleteAccountAllowed: boolean;
|
|
60
|
+
updateEmailFeatureEnabled: boolean;
|
|
61
|
+
updateEmailActionEnabled: boolean;
|
|
62
|
+
isViewOrganizationsEnabled?: boolean;
|
|
32
63
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
updateEmailActionEnabled: boolean;
|
|
38
|
-
isViewOrganizationsEnabled?: boolean;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type I18nApi = {
|
|
42
|
-
msgJSON: string;
|
|
43
|
-
supportedLocales?: Record<string, string>;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type Keycloak25AndUp = Common & {
|
|
47
|
-
serverBaseUrl: string;
|
|
48
|
-
authUrl: string;
|
|
49
|
-
clientId: string;
|
|
50
|
-
authServerUrl: string;
|
|
51
|
-
isOid4VciEnabled: boolean;
|
|
52
|
-
isViewGroupsEnabled: boolean;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type Keycloak20To24 = Common &
|
|
56
|
-
I18nApi & {
|
|
57
|
-
authUrl: {
|
|
58
|
-
rawSchemeSpecificPart: string;
|
|
59
|
-
scheme: string;
|
|
60
|
-
};
|
|
61
|
-
isViewGroupsEnabled: boolean;
|
|
64
|
+
|
|
65
|
+
export type I18nApi = {
|
|
66
|
+
msgJSON: string;
|
|
67
|
+
supportedLocales?: Record<string, string>;
|
|
62
68
|
};
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
export type Keycloak25AndUp = Common & {
|
|
71
|
+
serverBaseUrl: string;
|
|
72
|
+
authUrl: string;
|
|
73
|
+
clientId: string;
|
|
74
|
+
authServerUrl: string;
|
|
75
|
+
isOid4VciEnabled: boolean;
|
|
76
|
+
isViewGroupsEnabled: boolean;
|
|
70
77
|
};
|
|
78
|
+
|
|
79
|
+
export type Keycloak20To24 = Common &
|
|
80
|
+
I18nApi & {
|
|
81
|
+
authUrl: {
|
|
82
|
+
rawSchemeSpecificPart: string;
|
|
83
|
+
scheme: string;
|
|
84
|
+
};
|
|
85
|
+
isViewGroupsEnabled: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type Keycloak19 = Common &
|
|
89
|
+
I18nApi & {
|
|
90
|
+
authUrl: {
|
|
91
|
+
rawSchemeSpecificPart: string;
|
|
92
|
+
scheme: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
71
95
|
}
|
|
72
96
|
|
|
73
|
-
function getIsKeycloak25AndUp(
|
|
74
|
-
|
|
75
|
-
): kcContext is KcContextLike.Keycloak25AndUp {
|
|
76
|
-
return "serverBaseUrl" in kcContext;
|
|
97
|
+
function getIsKeycloak25AndUp(kcContext: KcContextLike): kcContext is KcContextLike.Keycloak25AndUp {
|
|
98
|
+
return "serverBaseUrl" in kcContext;
|
|
77
99
|
}
|
|
78
100
|
|
|
79
101
|
type LazyExoticComponentLike = {
|
|
80
|
-
|
|
102
|
+
_result: unknown;
|
|
81
103
|
};
|
|
82
104
|
|
|
83
105
|
export type KcAccountUiLoaderProps = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
logoUrl?: string;
|
|
88
|
-
loadingFallback?: JSX.Element;
|
|
106
|
+
kcContext: KcContextLike;
|
|
107
|
+
KcAccountUi: LazyExoticComponentLike;
|
|
108
|
+
loadingFallback?: ReactElement<any, any>;
|
|
89
109
|
};
|
|
90
110
|
|
|
91
111
|
export function KcAccountUiLoader(props: KcAccountUiLoaderProps) {
|
|
92
|
-
|
|
112
|
+
const { KcAccountUi, loadingFallback, ...paramsOfInit } = props;
|
|
93
113
|
|
|
94
|
-
|
|
114
|
+
assert(is<LazyExoticComponent<() => ReactElement<any, any> | null>>(KcAccountUi));
|
|
95
115
|
|
|
96
|
-
|
|
116
|
+
useMemo(() => init(paramsOfInit), []);
|
|
97
117
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
118
|
+
return (
|
|
119
|
+
<Suspense fallback={loadingFallback}>
|
|
120
|
+
{(() => {
|
|
121
|
+
const node = <KcAccountUi />;
|
|
102
122
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
if (node === null) {
|
|
124
|
+
return loadingFallback;
|
|
125
|
+
}
|
|
106
126
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
return node;
|
|
128
|
+
})()}
|
|
129
|
+
</Suspense>
|
|
130
|
+
);
|
|
111
131
|
}
|
|
112
132
|
|
|
113
133
|
let previousRunParamsFingerprint: string | undefined = undefined;
|
|
114
134
|
|
|
115
|
-
function init(
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
exit_condition: {
|
|
119
|
-
const paramsFingerprint = JSON.stringify(params);
|
|
135
|
+
function init(params: { kcContext: KcContextLike }) {
|
|
136
|
+
exit_condition: {
|
|
137
|
+
const paramsFingerprint = JSON.stringify(params);
|
|
120
138
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (paramsFingerprint !== previousRunParamsFingerprint) {
|
|
127
|
-
window.location.reload();
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const { content = defaultContent, kcContext } = params;
|
|
135
|
-
|
|
136
|
-
//logValidationResult(kcContext);
|
|
137
|
-
|
|
138
|
-
const logoUrl = params.logoUrl ?? defaultLogoSvgUrl;
|
|
139
|
-
|
|
140
|
-
const resourceUrl = kcContext.resourceUrl;
|
|
141
|
-
|
|
142
|
-
const serverBaseUrl = (() => {
|
|
143
|
-
if ("serverBaseUrl" in kcContext) {
|
|
144
|
-
return kcContext.serverBaseUrl;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const { authUrl } = kcContext;
|
|
148
|
-
|
|
149
|
-
if (typeof authUrl === "string") {
|
|
150
|
-
return authUrl;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return `${authUrl.scheme}:${authUrl.rawSchemeSpecificPart.replace(/\$/, "")}`;
|
|
154
|
-
})();
|
|
155
|
-
|
|
156
|
-
const authUrl = (() => {
|
|
157
|
-
const { authUrl } = kcContext;
|
|
158
|
-
|
|
159
|
-
if (typeof authUrl === "string") {
|
|
160
|
-
return authUrl;
|
|
161
|
-
}
|
|
139
|
+
if (previousRunParamsFingerprint === undefined) {
|
|
140
|
+
previousRunParamsFingerprint = paramsFingerprint;
|
|
141
|
+
break exit_condition;
|
|
142
|
+
}
|
|
162
143
|
|
|
163
|
-
|
|
164
|
-
|
|
144
|
+
if (paramsFingerprint !== previousRunParamsFingerprint) {
|
|
145
|
+
window.location.reload();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
165
148
|
|
|
166
|
-
|
|
167
|
-
if ("clientId" in kcContext) {
|
|
168
|
-
return kcContext.clientId;
|
|
149
|
+
return;
|
|
169
150
|
}
|
|
170
151
|
|
|
171
|
-
|
|
172
|
-
})();
|
|
152
|
+
const { kcContext } = params;
|
|
173
153
|
|
|
174
|
-
|
|
175
|
-
if ("authServerUrl" in kcContext) {
|
|
176
|
-
return kcContext.authServerUrl;
|
|
177
|
-
}
|
|
154
|
+
//logValidationResult(kcContext);
|
|
178
155
|
|
|
179
|
-
|
|
180
|
-
})();
|
|
181
|
-
|
|
182
|
-
const referrerUrl = readQueryParamOrRestoreFromSessionStorage({
|
|
183
|
-
name: "referrer_uri",
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const environment = {
|
|
187
|
-
serverBaseUrl,
|
|
188
|
-
authUrl,
|
|
189
|
-
authServerUrl,
|
|
190
|
-
realm: kcContext.realm.name,
|
|
191
|
-
clientId,
|
|
192
|
-
resourceUrl,
|
|
193
|
-
logo: logoUrl,
|
|
194
|
-
logoUrl:
|
|
195
|
-
referrerUrl === undefined ? "/" : referrerUrl.replace("_hash_", "#"),
|
|
196
|
-
baseUrl: `${kcContext.baseUrl.scheme}:${kcContext.baseUrl.rawSchemeSpecificPart}`,
|
|
197
|
-
locale: kcContext.locale,
|
|
198
|
-
referrerName:
|
|
199
|
-
readQueryParamOrRestoreFromSessionStorage({ name: "referrer" }) ?? "",
|
|
200
|
-
referrerUrl: referrerUrl ?? "",
|
|
201
|
-
features: {
|
|
202
|
-
isRegistrationEmailAsUsername:
|
|
203
|
-
kcContext.realm.registrationEmailAsUsername,
|
|
204
|
-
isEditUserNameAllowed: kcContext.realm.editUsernameAllowed,
|
|
205
|
-
isInternationalizationEnabled:
|
|
206
|
-
kcContext.realm.isInternationalizationEnabled,
|
|
207
|
-
isLinkedAccountsEnabled: kcContext.realm.identityFederationEnabled,
|
|
208
|
-
isMyResourcesEnabled:
|
|
209
|
-
kcContext.realm.userManagedAccessAllowed &&
|
|
210
|
-
kcContext.isAuthorizationEnabled,
|
|
211
|
-
deleteAccountAllowed: kcContext.deleteAccountAllowed,
|
|
212
|
-
updateEmailFeatureEnabled: kcContext.updateEmailFeatureEnabled,
|
|
213
|
-
updateEmailActionEnabled: kcContext.updateEmailActionEnabled,
|
|
214
|
-
isViewGroupsEnabled:
|
|
215
|
-
"isViewGroupsEnabled" in kcContext
|
|
216
|
-
? kcContext.isViewGroupsEnabled
|
|
217
|
-
: false,
|
|
218
|
-
isOid4VciEnabled: getIsKeycloak25AndUp(kcContext)
|
|
219
|
-
? kcContext.isOid4VciEnabled
|
|
220
|
-
: false,
|
|
221
|
-
isViewOrganizationsEnabled: kcContext.isViewOrganizationsEnabled ?? false,
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
{
|
|
226
|
-
assert<typeof environment extends Environment ? true : false>();
|
|
227
|
-
|
|
228
|
-
const script = document.createElement("script");
|
|
229
|
-
script.id = "environment";
|
|
230
|
-
script.type = "application/json";
|
|
231
|
-
script.textContent = JSON.stringify(environment, null, 1);
|
|
232
|
-
|
|
233
|
-
document.body.appendChild(script);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
{
|
|
237
|
-
const realFetch = window.fetch;
|
|
238
|
-
|
|
239
|
-
const buildJsonResponse = (json: unknown): Response => {
|
|
240
|
-
const response = {
|
|
241
|
-
headers: new Headers({ "Content-Type": "application/json" }),
|
|
242
|
-
ok: true,
|
|
243
|
-
json: () => Promise.resolve(json),
|
|
244
|
-
text: () => Promise.resolve(JSON.stringify(json)),
|
|
245
|
-
status: 200,
|
|
246
|
-
} as Response;
|
|
247
|
-
|
|
248
|
-
/*
|
|
249
|
-
return new Proxy(response, {
|
|
250
|
-
get(target, prop, receiver) {
|
|
251
|
-
console.log(`GET ${String(prop)}`);
|
|
252
|
-
return Reflect.get(target, prop, receiver);
|
|
253
|
-
},
|
|
254
|
-
});
|
|
255
|
-
*/
|
|
256
|
-
return response;
|
|
257
|
-
};
|
|
156
|
+
const resourceUrl = kcContext.resourceUrl;
|
|
258
157
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
window.fetch = async function fetch(...args) {
|
|
263
|
-
const [url, fetchOptions] = args;
|
|
264
|
-
|
|
265
|
-
polyfill_i18n_api: {
|
|
266
|
-
if (getIsKeycloak25AndUp(kcContext)) {
|
|
267
|
-
break polyfill_i18n_api;
|
|
158
|
+
const serverBaseUrl = (() => {
|
|
159
|
+
if ("serverBaseUrl" in kcContext) {
|
|
160
|
+
return kcContext.serverBaseUrl;
|
|
268
161
|
}
|
|
269
|
-
//assert(is<KcContextLike.Keycloak20To24>(kcContext));
|
|
270
162
|
|
|
271
|
-
const
|
|
272
|
-
kcContext.supportedLocales === undefined
|
|
273
|
-
? ["en"]
|
|
274
|
-
: Object.keys(kcContext.supportedLocales);
|
|
163
|
+
const { authUrl } = kcContext;
|
|
275
164
|
|
|
276
|
-
if (
|
|
277
|
-
|
|
165
|
+
if (typeof authUrl === "string") {
|
|
166
|
+
return authUrl;
|
|
278
167
|
}
|
|
279
168
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const data = Object.entries(
|
|
286
|
-
JSON.parse(kcContext.msgJSON) as Record<string, string>,
|
|
287
|
-
).map(([key, value]) => {
|
|
288
|
-
try {
|
|
289
|
-
value = decodeURIComponent(escape(value));
|
|
290
|
-
} catch {
|
|
291
|
-
// ignore
|
|
292
|
-
}
|
|
169
|
+
return `${authUrl.scheme}:${authUrl.rawSchemeSpecificPart.replace(/\$/, "")}`;
|
|
170
|
+
})();
|
|
293
171
|
|
|
294
|
-
|
|
295
|
-
|
|
172
|
+
const authUrl = (() => {
|
|
173
|
+
const { authUrl } = kcContext;
|
|
296
174
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
break track_language_change;
|
|
300
|
-
}
|
|
301
|
-
isLanguageChangeEventListened = true;
|
|
302
|
-
|
|
303
|
-
getI18n().on("languageChanged", (lang) => {
|
|
304
|
-
if (lang !== kcContext.locale) {
|
|
305
|
-
window.location.reload();
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return buildJsonResponse(data);
|
|
175
|
+
if (typeof authUrl === "string") {
|
|
176
|
+
return authUrl;
|
|
311
177
|
}
|
|
312
178
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const urlStr = `${url}`;
|
|
316
|
-
|
|
317
|
-
return urlStr.startsWith("/")
|
|
318
|
-
? `${window.location.origin}${urlStr}`
|
|
319
|
-
: urlStr;
|
|
320
|
-
})(),
|
|
321
|
-
);
|
|
179
|
+
return `${authUrl.scheme}:${authUrl.rawSchemeSpecificPart}`;
|
|
180
|
+
})();
|
|
322
181
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if ((fetchOptions?.method?.toLocaleLowerCase() ?? "get") !== "get") {
|
|
329
|
-
break add_locale_attribute;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
333
|
-
break add_locale_attribute;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
if (urlObj.searchParams.get("userProfileMetadata") !== "true") {
|
|
337
|
-
break add_locale_attribute;
|
|
338
|
-
}
|
|
182
|
+
const clientId = (() => {
|
|
183
|
+
if ("clientId" in kcContext) {
|
|
184
|
+
return kcContext.clientId;
|
|
185
|
+
}
|
|
339
186
|
|
|
340
|
-
|
|
187
|
+
return "account-console";
|
|
188
|
+
})();
|
|
341
189
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
const data = await response.json();
|
|
347
|
-
|
|
348
|
-
data.attributes ??= {};
|
|
349
|
-
|
|
350
|
-
data.attributes.locale = [kcContext.locale];
|
|
351
|
-
|
|
352
|
-
data.userProfileMetadata ??= {};
|
|
353
|
-
data.userProfileMetadata.attributes ??= [];
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
!data.userProfileMetadata.attributes.find(
|
|
357
|
-
(attribute: any) => attribute.name === "locale",
|
|
358
|
-
)
|
|
359
|
-
) {
|
|
360
|
-
wasLocaleAttributeManuallyAdded = true;
|
|
361
|
-
data.userProfileMetadata.attributes.unshift({
|
|
362
|
-
name: "locale",
|
|
363
|
-
displayName: "locale",
|
|
364
|
-
required: false,
|
|
365
|
-
readOnly: false,
|
|
366
|
-
validators: {},
|
|
367
|
-
multivalued: false,
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
return buildJsonResponse(data);
|
|
190
|
+
const authServerUrl = (() => {
|
|
191
|
+
if ("authServerUrl" in kcContext) {
|
|
192
|
+
return kcContext.authServerUrl;
|
|
371
193
|
}
|
|
372
194
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
195
|
+
return authUrl;
|
|
196
|
+
})();
|
|
197
|
+
|
|
198
|
+
const referrerUrl = readQueryParamOrRestoreFromSessionStorage({
|
|
199
|
+
name: "referrer_uri"
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const environment = {
|
|
203
|
+
serverBaseUrl,
|
|
204
|
+
authUrl,
|
|
205
|
+
authServerUrl,
|
|
206
|
+
realm: kcContext.realm.name,
|
|
207
|
+
clientId,
|
|
208
|
+
resourceUrl,
|
|
209
|
+
logo: "",
|
|
210
|
+
logoUrl: referrerUrl === undefined ? "/" : referrerUrl.replace("_hash_", "#"),
|
|
211
|
+
baseUrl: `${kcContext.baseUrl.scheme}:${kcContext.baseUrl.rawSchemeSpecificPart}`,
|
|
212
|
+
locale: kcContext.locale,
|
|
213
|
+
referrerName: readQueryParamOrRestoreFromSessionStorage({ name: "referrer" }) ?? "",
|
|
214
|
+
referrerUrl: referrerUrl ?? "",
|
|
215
|
+
features: {
|
|
216
|
+
isRegistrationEmailAsUsername: kcContext.realm.registrationEmailAsUsername,
|
|
217
|
+
isEditUserNameAllowed: kcContext.realm.editUsernameAllowed,
|
|
218
|
+
isInternationalizationEnabled: kcContext.realm.isInternationalizationEnabled,
|
|
219
|
+
isLinkedAccountsEnabled: kcContext.realm.identityFederationEnabled,
|
|
220
|
+
isMyResourcesEnabled:
|
|
221
|
+
kcContext.realm.userManagedAccessAllowed && kcContext.isAuthorizationEnabled,
|
|
222
|
+
deleteAccountAllowed: kcContext.deleteAccountAllowed,
|
|
223
|
+
updateEmailFeatureEnabled: kcContext.updateEmailFeatureEnabled,
|
|
224
|
+
updateEmailActionEnabled: kcContext.updateEmailActionEnabled,
|
|
225
|
+
isViewGroupsEnabled:
|
|
226
|
+
"isViewGroupsEnabled" in kcContext ? kcContext.isViewGroupsEnabled : false,
|
|
227
|
+
isOid4VciEnabled: getIsKeycloak25AndUp(kcContext) ? kcContext.isOid4VciEnabled : false,
|
|
228
|
+
isViewOrganizationsEnabled: kcContext.isViewOrganizationsEnabled ?? false
|
|
229
|
+
}
|
|
230
|
+
};
|
|
381
231
|
|
|
382
|
-
|
|
383
|
-
break remove_locale_attribute_from_req;
|
|
384
|
-
}
|
|
232
|
+
assert<typeof environment extends Environment ? true : false>;
|
|
385
233
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
234
|
+
{
|
|
235
|
+
const undefinedKeys = Object.entries(environment)
|
|
236
|
+
.filter(([key]) => key !== "features")
|
|
237
|
+
.filter(([, value]) => value === undefined)
|
|
238
|
+
.map(([key]) => key);
|
|
389
239
|
|
|
390
|
-
|
|
240
|
+
if (undefinedKeys.length > 0) {
|
|
241
|
+
console.error("Need KcContext polyfill for ", undefinedKeys.join(", "));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
391
244
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
245
|
+
{
|
|
246
|
+
const undefinedKeys = Object.entries(environment.features)
|
|
247
|
+
.filter(([, value]) => value === undefined)
|
|
248
|
+
.map(([key]) => key);
|
|
397
249
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
250
|
+
if (undefinedKeys.length > 0) {
|
|
251
|
+
console.error("Need KcContext polyfill for features", undefinedKeys.join(", "));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
401
254
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
255
|
+
{
|
|
256
|
+
const script = document.createElement("script");
|
|
257
|
+
script.id = "environment";
|
|
258
|
+
script.type = "application/json";
|
|
259
|
+
script.textContent = JSON.stringify(environment, null, 1);
|
|
406
260
|
|
|
407
|
-
|
|
261
|
+
document.body.appendChild(script);
|
|
262
|
+
}
|
|
408
263
|
|
|
409
|
-
|
|
264
|
+
{
|
|
265
|
+
const realFetch = window.fetch;
|
|
266
|
+
|
|
267
|
+
const buildJsonResponse = (json: unknown): Response => {
|
|
268
|
+
const response = {
|
|
269
|
+
headers: new Headers({ "Content-Type": "application/json" }),
|
|
270
|
+
ok: true,
|
|
271
|
+
json: () => Promise.resolve(json),
|
|
272
|
+
text: () => Promise.resolve(JSON.stringify(json)),
|
|
273
|
+
status: 200
|
|
274
|
+
} as Response;
|
|
275
|
+
|
|
276
|
+
/*
|
|
277
|
+
return new Proxy(response, {
|
|
278
|
+
get(target, prop, receiver) {
|
|
279
|
+
console.log(`GET ${String(prop)}`);
|
|
280
|
+
return Reflect.get(target, prop, receiver);
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
*/
|
|
410
284
|
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
285
|
+
return response;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
let isLanguageChangeEventListened = false;
|
|
289
|
+
let wasLocaleAttributeManuallyAdded = false;
|
|
290
|
+
|
|
291
|
+
window.fetch = async function fetch(...args) {
|
|
292
|
+
const [url, fetchOptions] = args;
|
|
293
|
+
|
|
294
|
+
polyfill_i18n_api: {
|
|
295
|
+
if (getIsKeycloak25AndUp(kcContext)) {
|
|
296
|
+
break polyfill_i18n_api;
|
|
297
|
+
}
|
|
298
|
+
//assert(is<KcContextLike.Keycloak20To24>(kcContext));
|
|
299
|
+
|
|
300
|
+
const langs =
|
|
301
|
+
kcContext.supportedLocales === undefined
|
|
302
|
+
? ["en"]
|
|
303
|
+
: Object.keys(kcContext.supportedLocales);
|
|
304
|
+
|
|
305
|
+
if (`${url}`.endsWith("/supportedLocales")) {
|
|
306
|
+
return buildJsonResponse(langs);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
for (const lang of langs) {
|
|
310
|
+
if (!`${url}`.endsWith(`/${lang}`)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const data = Object.entries(
|
|
315
|
+
JSON.parse(kcContext.msgJSON) as Record<string, string>
|
|
316
|
+
).map(([key, value]) => {
|
|
317
|
+
try {
|
|
318
|
+
value = decodeURIComponent(escape(value));
|
|
319
|
+
} catch {
|
|
320
|
+
// ignore
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return { key, value };
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
track_language_change: {
|
|
327
|
+
if (isLanguageChangeEventListened) {
|
|
328
|
+
break track_language_change;
|
|
329
|
+
}
|
|
330
|
+
isLanguageChangeEventListened = true;
|
|
331
|
+
|
|
332
|
+
getI18n().on("languageChanged", lang => {
|
|
333
|
+
if (lang !== kcContext.locale) {
|
|
334
|
+
window.location.reload();
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return buildJsonResponse(data);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const urlObj = new URL(
|
|
343
|
+
(() => {
|
|
344
|
+
const urlStr = `${url}`;
|
|
345
|
+
|
|
346
|
+
return urlStr.startsWith("/") ? `${window.location.origin}${urlStr}` : urlStr;
|
|
347
|
+
})()
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
add_locale_attribute: {
|
|
351
|
+
if (!environment.features.isInternationalizationEnabled) {
|
|
352
|
+
break add_locale_attribute;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if ((fetchOptions?.method?.toLocaleLowerCase() ?? "get") !== "get") {
|
|
356
|
+
break add_locale_attribute;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
360
|
+
break add_locale_attribute;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (urlObj.searchParams.get("userProfileMetadata") !== "true") {
|
|
364
|
+
break add_locale_attribute;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const response = await realFetch(...args);
|
|
368
|
+
|
|
369
|
+
if (!response.ok) {
|
|
370
|
+
return response;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const data = await response.json();
|
|
374
|
+
|
|
375
|
+
data.attributes ??= {};
|
|
376
|
+
|
|
377
|
+
data.attributes.locale = [kcContext.locale];
|
|
378
|
+
|
|
379
|
+
data.userProfileMetadata ??= {};
|
|
380
|
+
data.userProfileMetadata.attributes ??= [];
|
|
381
|
+
|
|
382
|
+
if (
|
|
383
|
+
!data.userProfileMetadata.attributes.find(
|
|
384
|
+
(attribute: any) => attribute.name === "locale"
|
|
385
|
+
)
|
|
386
|
+
) {
|
|
387
|
+
wasLocaleAttributeManuallyAdded = true;
|
|
388
|
+
data.userProfileMetadata.attributes.unshift({
|
|
389
|
+
name: "locale",
|
|
390
|
+
displayName: "locale",
|
|
391
|
+
required: false,
|
|
392
|
+
readOnly: false,
|
|
393
|
+
validators: {},
|
|
394
|
+
multivalued: false
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return buildJsonResponse(data);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
remove_locale_attribute_from_req: {
|
|
401
|
+
if (!wasLocaleAttributeManuallyAdded) {
|
|
402
|
+
break remove_locale_attribute_from_req;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if ((fetchOptions?.method?.toLocaleLowerCase() ?? "get") !== "post") {
|
|
406
|
+
break remove_locale_attribute_from_req;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (!urlObj.pathname.replace(/\/$/, "").endsWith("/account")) {
|
|
410
|
+
break remove_locale_attribute_from_req;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (fetchOptions?.body === undefined) {
|
|
414
|
+
break remove_locale_attribute_from_req;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
let reqPayload: any;
|
|
418
|
+
|
|
419
|
+
try {
|
|
420
|
+
reqPayload = JSON.parse(fetchOptions.body as string);
|
|
421
|
+
} catch {
|
|
422
|
+
break remove_locale_attribute_from_req;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (reqPayload.userProfileMetadata === undefined) {
|
|
426
|
+
break remove_locale_attribute_from_req;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
reqPayload.userProfileMetadata.attributes =
|
|
430
|
+
reqPayload.userProfileMetadata.attributes.filter(
|
|
431
|
+
(attr: any) => attr.name !== "locale"
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
fetchOptions.body = JSON.stringify(reqPayload);
|
|
435
|
+
|
|
436
|
+
args[1] = fetchOptions;
|
|
414
437
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
438
|
+
return realFetch(...args);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
418
441
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
442
|
+
return realFetch(...args);
|
|
443
|
+
};
|
|
444
|
+
}
|
|
422
445
|
}
|
|
423
446
|
|
|
424
|
-
function readQueryParamOrRestoreFromSessionStorage(params: {
|
|
425
|
-
|
|
426
|
-
}): string | undefined {
|
|
427
|
-
const { name } = params;
|
|
447
|
+
function readQueryParamOrRestoreFromSessionStorage(params: { name: string }): string | undefined {
|
|
448
|
+
const { name } = params;
|
|
428
449
|
|
|
429
|
-
|
|
450
|
+
const url = new URL(window.location.href);
|
|
430
451
|
|
|
431
|
-
|
|
452
|
+
const value = url.searchParams.get(name);
|
|
432
453
|
|
|
433
|
-
|
|
454
|
+
const PREFIX = "keycloakify:";
|
|
434
455
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
456
|
+
if (value !== null) {
|
|
457
|
+
sessionStorage.setItem(`${PREFIX}${name}`, value);
|
|
458
|
+
url.searchParams.delete(name);
|
|
459
|
+
window.history.replaceState({}, "", url.toString());
|
|
460
|
+
return value;
|
|
461
|
+
}
|
|
441
462
|
|
|
442
|
-
|
|
463
|
+
return sessionStorage.getItem(`${PREFIX}${name}`) ?? undefined;
|
|
443
464
|
}
|