@asgardeo/react 0.2.2 → 0.2.4

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.
Files changed (63) hide show
  1. package/dist/esm/index.js +186 -49
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +1 -1
  4. package/dist/esm/types/models/auth-context.d.ts +2 -0
  5. package/package.json +5 -3
  6. package/dist/cjs/index.js +0 -45168
  7. package/dist/cjs/index.js.map +0 -1
  8. package/dist/cjs/types/components/SignIn/SignIn.d.ts +0 -31
  9. package/dist/cjs/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
  10. package/dist/cjs/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
  11. package/dist/cjs/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
  12. package/dist/cjs/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
  13. package/dist/cjs/types/components/SignIn/fragments/SmsOtp.d.ts +0 -21
  14. package/dist/cjs/types/components/SignIn/fragments/Totp.d.ts +0 -33
  15. package/dist/cjs/types/components/SignInButton/SignInButton.d.ts +0 -29
  16. package/dist/cjs/types/components/SignOutButton/SignOutButton.d.ts +0 -27
  17. package/dist/cjs/types/components/SignedIn/SignedIn.d.ts +0 -29
  18. package/dist/cjs/types/components/SignedOut/SignedOut.d.ts +0 -29
  19. package/dist/cjs/types/components/public-components.d.ts +0 -22
  20. package/dist/cjs/types/contexts/asgardeo-context.d.ts +0 -21
  21. package/dist/cjs/types/contexts/branding-preference-context.d.ts +0 -21
  22. package/dist/cjs/types/contexts/i18n-context.d.ts +0 -21
  23. package/dist/cjs/types/hooks/use-authentication.d.ts +0 -27
  24. package/dist/cjs/types/hooks/use-config.d.ts +0 -23
  25. package/dist/cjs/types/hooks/use-on.d.ts +0 -20
  26. package/dist/cjs/types/hooks/use-translations.d.ts +0 -33
  27. package/dist/cjs/types/index.d.ts +0 -22
  28. package/dist/cjs/types/models/asgardeo-provider-props.d.ts +0 -24
  29. package/dist/cjs/types/models/auth-context.d.ts +0 -41
  30. package/dist/cjs/types/models/basic-auth-props.d.ts +0 -29
  31. package/dist/cjs/types/models/branding-preference-provider-props.d.ts +0 -22
  32. package/dist/cjs/types/models/email-otp-props.d.ts +0 -26
  33. package/dist/cjs/types/models/i18n.d.ts +0 -34
  34. package/dist/cjs/types/models/jwt-verify-options.d.ts +0 -25
  35. package/dist/cjs/types/models/login-options-box-props.d.ts +0 -24
  36. package/dist/cjs/types/models/public-models.d.ts +0 -19
  37. package/dist/cjs/types/models/sign-in.d.ts +0 -49
  38. package/dist/cjs/types/models/signed-props.d.ts +0 -22
  39. package/dist/cjs/types/models/totp-props.d.ts +0 -26
  40. package/dist/cjs/types/models/use-authentication.d.ts +0 -29
  41. package/dist/cjs/types/models/use-config.d.ts +0 -22
  42. package/dist/cjs/types/models/use-on.d.ts +0 -31
  43. package/dist/cjs/types/models/use-translations.d.ts +0 -22
  44. package/dist/cjs/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
  45. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
  46. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
  47. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
  48. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
  49. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
  50. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
  51. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
  52. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
  53. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
  54. package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
  55. package/dist/cjs/types/oxygen-ui-react-auth-components/index.d.ts +0 -19
  56. package/dist/cjs/types/oxygen-ui-react-auth-components/models/component.d.ts +0 -27
  57. package/dist/cjs/types/providers/AsgardeoProvider.d.ts +0 -34
  58. package/dist/cjs/types/providers/BrandingPreferenceProvider.d.ts +0 -32
  59. package/dist/cjs/types/providers/I18nProvider.d.ts +0 -33
  60. package/dist/cjs/types/theme/generate-theme-sign-in.d.ts +0 -28
  61. package/dist/cjs/types/theme/generate-theme.d.ts +0 -30
  62. package/dist/cjs/types/utils/crypto-utils.d.ts +0 -52
  63. package/dist/cjs/types/utils/session-store.d.ts +0 -25
package/dist/esm/index.js CHANGED
@@ -39979,13 +39979,18 @@ const I18nContext = createContext(undefined);
39979
39979
  const useTranslations = (props) => {
39980
39980
  const { componentLocaleOverride, componentTextOverrides, screen } = props;
39981
39981
  const [isLoading, setIsLoading] = useState(true);
39982
+ const { setIsTextLoading } = useContext(AsgardeoContext);
39982
39983
  const contextValue = useContext(I18nContext);
39983
39984
  const { text, setTranslations } = contextValue;
39984
39985
  useEffect(() => {
39985
39986
  setTranslations({ componentLocaleOverride, componentTextOverrides, screen }).then((response) => {
39986
39987
  setIsLoading(!response);
39988
+ setIsTextLoading(!response);
39987
39989
  });
39988
- }, [componentLocaleOverride, componentTextOverrides, screen, setTranslations]);
39990
+ }, [componentLocaleOverride, componentTextOverrides, screen, setIsTextLoading, setTranslations]);
39991
+ useEffect(() => {
39992
+ setIsTextLoading(isLoading);
39993
+ }, [isLoading, setIsTextLoading]);
39989
39994
  /**
39990
39995
  * `t` is a function that retrieves a specific translation from the fetched translations.
39991
39996
  * It takes a key as an argument, which is a string that represents a path to the desired translation.
@@ -40315,7 +40320,7 @@ n(css$3,{});
40315
40320
  * @param {AlertType} props.alert - Alert type.
40316
40321
  * @return {ReactElement}
40317
40322
  */
40318
- const EmailOtp = ({ alert, brandingProps, authenticator, children, handleAuthenticate }) => {
40323
+ const EmailOtp = ({ alert, brandingProps, authenticator, children, handleAuthenticate, }) => {
40319
40324
  var _a, _b, _c, _d;
40320
40325
  const [inputValue, setInputValue] = useState();
40321
40326
  const [isContinueLoading, setIsContinueLoading] = useState(false);
@@ -40355,6 +40360,37 @@ const EmailOtp = ({ alert, brandingProps, authenticator, children, handleAuthent
40355
40360
  }, children: [t(keys.emailOtp.resend.code), isAuthLoading && isResendLoading && jsxRuntimeExports.jsx(ae, { className: "sign-in-button-progress" })] }))] }));
40356
40361
  };
40357
40362
 
40363
+ /**
40364
+ * This component renders the IdentifierFirst authentication form.
40365
+ *
40366
+ * @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component.
40367
+ * @param {BrandingProps} props.brandingProps - Branding props.
40368
+ * @param {Function} props.handleAuthenticate - Callback to handle authentication.
40369
+ * @param {Authenticator} props.authenticator - Authenticator.
40370
+ * @param {AlertType} props.alert - Alert type.
40371
+ * @param {ReactElement[]} props.renderLoginOptions - Login options.
40372
+ * @param {boolean} props.showSelfSignUp - Show self sign up.
40373
+ *
40374
+ * @return {ReactElement}
40375
+ */
40376
+ const IdentifierFirst = ({ handleAuthenticate, authenticator, alert, brandingProps, children, showSelfSignUp, renderLoginOptions, }) => {
40377
+ var _a;
40378
+ const { isAuthLoading, username, setUsername } = useContext(AsgardeoContext);
40379
+ const { t, isLoading } = useTranslations({
40380
+ componentLocaleOverride: brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.locale,
40381
+ componentTextOverrides: (_a = brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.preference) === null || _a === void 0 ? void 0 : _a.text,
40382
+ screen: ScreenType.Login,
40383
+ });
40384
+ if (isLoading) {
40385
+ return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "asgardeo-basic-auth-skeleton", children: [jsxRuntimeExports.jsx(Pi, { className: "skeleton-title", variant: "text", width: 100, height: 55 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-submit-button", variant: "rectangular", width: 270, height: 40 })] }));
40386
+ }
40387
+ return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "Paper-basicAuth", children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { title: true, className: "Typography-basicAuthTitle", children: t(keys.login.login.heading) }), alert && (jsxRuntimeExports.jsx(SignIn$1.Alert, Object.assign({ className: "asgardeo-basic-auth-alert" }, alert === null || alert === void 0 ? void 0 : alert.alertType, { children: t(alert.key) }))), jsxRuntimeExports.jsx(SignIn$1.TextField, { fullWidth: true, autoComplete: "off", label: t(keys.login.username), name: "text", value: username, placeholder: t(keys.login.enter.your.username), onChange: (e) => setUsername(e.target.value) }), children, jsxRuntimeExports.jsx(SignIn$1.Button, { color: "primary", variant: "contained", type: "submit", fullWidth: true, disabled: isAuthLoading, onClick: () => {
40388
+ handleAuthenticate(authenticator.authenticatorId, {
40389
+ username,
40390
+ });
40391
+ }, children: t(keys.login.button) }), isAuthLoading && (jsxRuntimeExports.jsx("div", { className: "circular-progress-holder-authn", children: jsxRuntimeExports.jsx(ae, { className: "sign-in-button-progress" }) })), showSelfSignUp && (jsxRuntimeExports.jsxs(je, { container: true, children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { children: t(keys.common.prefix.register) }), jsxRuntimeExports.jsx(SignIn$1.Link, { href: "./register", className: "asgardeo-register-link", children: t(keys.common.register) })] })), renderLoginOptions.length !== 0 && jsxRuntimeExports.jsxs(SignIn$1.Divider, { children: [" ", t(keys.common.or), " "] }), renderLoginOptions] }));
40392
+ };
40393
+
40358
40394
  var img$7 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='iso-8859-1'%3f%3e%3c!-- * Copyright (c) 2024%2c WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License%2c * Version 2.0 (the 'License')%3b you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing%2c * software distributed under the License is distributed on an * 'AS IS' BASIS%2c WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND%2c either express or implied. See the License for the * specific language governing permissions and limitations * under the License.--%3e%3csvg xmlns='http://www.w3.org/2000/svg' id='building-icon' class='icon' width='14' height='14' viewBox='0 0 12.601 14'%3e %3cpath id='ldap-outline' class='path fill primary' d='M7.1%2c14H.4a.4.4%2c0%2c0%2c1-.4-.4V.4A.4.4%2c0%2c0%2c1%2c.4%2c0H6.7a.4.4%2c0%2c0%2c1%2c.4.4V3.2h5.1a.4.4%2c0%2c0%2c1%2c.4.4V14Zm0-.6h4.7a.2.2%2c0%2c0%2c0%2c.2-.2V11.32H7.1Zm-.6%2c0V.8A.2.2%2c0%2c0%2c0%2c6.3.6H.8A.2.2%2c0%2c0%2c0%2c.6.8V13.2a.2.2%2c0%2c0%2c0%2c.2.2H2.191V11.12a.4.4%2c0%2c0%2c1%2c.4-.4h1.95a.4.4%2c0%2c0%2c1%2c.4.4V13.4Zm-2.16%2c0V11.32H2.79V13.4ZM12%2c10.72V4a.2.2%2c0%2c0%2c0-.2-.2H7.1v6.92ZM10.471%2c9.1V8.5h.6v.6Zm-1.2%2c0V8.5h.6v.6Zm-1.2%2c0V8.5h.6v.6Zm-2.989%2c0V8.5h.6v.6Zm-1.2%2c0V8.5h.6v.6Zm-1.2%2c0V8.5h.6v.6Zm-1.2%2c0V8.5h.6v.6Zm8.99-1.2V7.3h.6v.6Zm-1.2%2c0V7.3h.6v.6Zm-1.2%2c0V7.3h.6v.6Zm-2.989%2c0V7.3h.6v.6Zm-1.2%2c0V7.3h.6v.6Zm-1.2%2c0V7.3h.6v.6Zm-1.2%2c0V7.3h.6v.6Zm8.99-1.2V6.1h.6v.6Zm-1.2%2c0V6.1h.6v.6Zm-1.2%2c0V6.1h.6v.6Zm-2.989%2c0V6.1h.6v.6Zm-1.2%2c0V6.1h.6v.6Zm-1.2%2c0V6.1h.6v.6Zm-1.2%2c0V6.1h.6v.6Zm8.99-1.2V4.9h.6v.6Zm-1.2%2c0V4.9h.6v.6Zm-1.2%2c0V4.9h.6v.6Zm-2.989%2c0V4.9h.6v.6Zm-1.2%2c0V4.9h.6v.6Zm-1.2%2c0V4.9h.6v.6Zm-1.2%2c0V4.9h.6v.6Zm3.6-1.2V3.7h.6v.6Zm-1.2%2c0V3.7h.6v.6Zm-1.2%2c0V3.7h.6v.6Zm-1.2%2c0V3.7h.6v.6Zm3.6-1.2V2.5h.6v.6Zm-1.2%2c0V2.5h.6v.6Zm-1.2%2c0V2.5h.6v.6Zm-1.2%2c0V2.5h.6v.6Zm3.6-1.2V1.3h.6v.6Zm-1.2%2c0V1.3h.6v.6Zm-1.2%2c0V1.3h.6v.6Zm-1.2%2c0V1.3h.6v.6Z' fill='%23464646'/%3e%3c/svg%3e";
40359
40395
 
40360
40396
  var img$6 = "data:image/svg+xml,%3c!-- * Copyright (c) 2024%2c WSO2 Inc. (http://www.wso2.org). * * WSO2 Inc. licenses this file to you under the Apache License%2c * Version 2.0 (the 'License')%3b you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing%2c * software distributed under the License is distributed on an * 'AS IS' BASIS%2c WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND%2c either express or implied. See the License for the * specific language governing permissions and limitations * under the License.--%3e%3csvg id='email-solid-icon' class='icon' width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 4C0 2.89543 0.895431 2 2 2H14C15.1046 2 16 2.89561 16 4.00013V4.00476V4.00939V4.01402V4.01865V4.02328V4.02791V4.03253V4.03715V4.04177V4.04639V4.05101V4.05563V4.06024V4.06485V4.06947V4.07408V4.07868V4.08329V4.0879V4.0925V4.09711V4.10171V4.10631V4.11091V4.1155V4.1201V4.12469V4.12929V4.13388V4.13847V4.14306V4.14765V4.15224V4.15682V4.16141V4.16599V4.17057V4.17516V4.17974V4.18431V4.18889V4.19347V4.19805V4.20262V4.20719V4.21177V4.21634V4.22091V4.22548V4.23005V4.23462V4.23918V4.24375V4.24832V4.25288V4.25744V4.26201V4.26657V4.27113V4.27569V4.28025V4.28481V4.28937V4.29392V4.29848V4.30304V4.30759V4.31215V4.3167V4.32125V4.32581V4.33036V4.33491V4.33946V4.34401V4.34856V4.35311V4.35766V4.36221V4.36675V4.3713V4.37585V4.38039V4.38494V4.38949V4.39403V4.39858V4.40312V4.40767V4.41221V4.41675V4.4213V4.42584V4.43038V4.43492V4.43947V4.44401V4.44855V4.45309V4.45763V4.46217V4.46672V4.47126V4.4758V4.48034V4.48488V4.48942V4.49396V4.4985V4.50304V4.50758V4.51212V4.51667V4.52121V4.52575V4.53029V4.53483V4.53937V4.54391V4.54845V4.553V4.55754V4.56208V4.56662V4.57116V4.57571V4.58025V4.58479V4.58934V4.59388V4.59843V4.60297V4.60752V4.61206V4.61661V4.62115V4.6257V4.63025V4.63479V4.63934V4.64389V4.64844V4.65299V4.65754V4.66209V4.66664V4.67119V4.67574V4.6803V4.68485V4.6894V4.69396V4.69851V4.70307V4.70763V4.71219V4.71674V4.7213V4.72586V4.73042V4.73498V4.73955V4.74411V4.74867V4.75324V4.7578V4.76237V4.76694V4.77151V4.77608V4.78065V4.78522V4.78979V4.79436V4.79894V4.80351V4.80809V4.81267V4.81724V4.82182V4.8264V4.83099V4.83557V4.84015V4.84474V4.84933V4.85391V4.8585V4.86309V4.86768V4.87228V4.87687V4.88147V4.88606V4.89066V4.89526V4.89986V4.90446V4.90907V4.91367V4.91828V4.92288V4.92749V4.9321V4.93672V4.94133V4.94595V4.95056V4.95518V4.9598V4.96442V4.96904V4.97367V4.9783V4.98292V4.98755V4.99218V4.99682V5.00145V5.00609V5.01073V5.01537V5.02001V5.02465V5.0293V5.03394V5.03859V5.04324V5.0479V5.05255V5.05721V5.06187V5.06653V5.07119V5.07585V5.08052V5.08519V5.08986V5.09453V5.0992V5.10388V5.10856V5.11324V5.11792V5.12261V5.12729V5.13198V5.13667V5.14137V5.14606V5.15076V5.15546V5.16016V5.16487V5.16958V5.17428V5.179V5.18371V5.18843V5.19315V5.19787V5.20259V5.20731V5.21204V5.21677V5.22151V5.22624V5.23098V5.23572V5.24046V5.24521V5.24996V5.25471V5.25946V5.26422V5.26898V5.27374V5.2785V5.28327V5.28804V5.29281V5.29758V5.30236V5.30714V5.31192V5.31671V5.3215V5.32629V5.33108V5.33588V5.34068V5.34548V5.35028V5.35509V5.3599V5.36472V5.36953V5.37435V5.37918V5.384V5.38883V5.39366V5.3985V5.40334V5.40818V5.41302V5.41787V5.42272V5.42757V5.43243V5.43729V5.44215V5.44702V5.45189V5.45676V5.46164V5.46652V5.4714V5.47628V5.48117V5.48606V5.49096V5.49586V5.50076V5.50567V5.51058V5.51549V5.52041V5.52532V5.53025V5.53517V5.5401V5.54504V5.54997V5.55491V5.55986V5.56481V5.56976V5.57471V5.57967V5.58463V5.5896V5.59457V5.59954V5.60452V5.6095V5.61448V5.61947V5.62446V5.62946V5.63446V5.63946V5.64447V5.64948V5.65449V5.65951V5.66453V5.66956V5.67459V5.67962V5.68466V5.6897V5.69475V5.6998V5.70485V5.70991V5.71497V5.72004V5.72511V5.73019V5.73526V5.74035V5.74543V5.75052V5.75562V5.76072V5.76582V5.77093V5.77604V5.78116V5.78628V5.7914V5.79653V5.80167V5.8068V5.81194V5.81709V5.82224V5.8274V5.83256V5.83772V5.84289V5.84806V5.85324V5.85842V5.86361V5.8688V5.87399V5.87919V5.8844V5.88961V5.89482V5.90004V5.90526V5.91049V5.91572V5.92096V5.9262V5.93145V5.9367V5.94195V5.94721V5.95248V5.95775V5.96303V5.96831V5.97359V5.97888V5.98417V5.98947V5.99478V6.00009V6.0054V6.01072V6.01604V6.02137V6.0267V6.03204V6.03739V6.04274V6.04809V6.05345V6.05881V6.06418V6.06956V6.07494V6.08032V6.08571V6.09111V6.09651V6.10191V6.10732V6.11274V6.11816V6.12359V6.12902V6.13445V6.1399V6.14534V6.1508V6.15626V6.16172V6.16719V6.17266V6.17814V6.18363V6.18912V6.19462V6.20012V6.20563V6.21114V6.21666V6.22218V6.22771V6.23325V6.23879V6.24433V6.24989V6.25544V6.26101V6.26658V6.27215V6.27773V6.28332V6.28891V6.29451V6.30011V6.30572V6.31133V6.31696V6.32258V6.32822V6.33385V6.3395V6.34515V6.35081V6.35647V6.36214V6.36781V6.37349V6.37918V6.38487V6.39057V6.39627V6.40198V6.4077V6.41342V6.41915V6.42488V6.43062V6.43637V6.44212V6.44788V6.45365V6.45942V6.4652V6.47098V6.47677V6.48257V6.48837V6.49418V6.5V9C16 9.27614 15.7761 9.5 15.5 9.5C15.2239 9.5 15 9.27614 15 9V6.5V6.49418V6.48837V6.48257V6.47677V6.47098V6.4652V6.45942V6.45365V6.44788V6.44212V6.43637V6.43062V6.42488V6.41915V6.41342V6.4077V6.40198V6.39627V6.39057V6.38487V6.37918V6.37349V6.36781V6.36214V6.35647V6.35081V6.34515V6.3395V6.33385V6.32822V6.32258V6.31696V6.31133V6.30572V6.30011V6.29451V6.28891V6.28332V6.27773V6.27215V6.26658V6.26101V6.25544V6.24989V6.24433V6.23879V6.23325V6.22771V6.22218V6.21666V6.21114V6.20563V6.20012V6.19462V6.18912V6.18363V6.17814V6.17266V6.16719V6.16172V6.15626V6.1508V6.14534V6.1399V6.13445V6.12902V6.12359V6.11816V6.11274V6.10732V6.10191V6.09651V6.09111V6.08571V6.08032V6.07494V6.06956V6.06418V6.05881V6.05345V6.04809V6.04274V6.03739V6.03204V6.0267V6.02137V6.01604V6.01072V6.0054V6.00009V5.99478V5.98947V5.98417V5.97888V5.97359V5.96831V5.96303V5.95775V5.95248V5.94721V5.94195V5.9367V5.93145V5.9262V5.92096V5.91572V5.91049V5.90526V5.90004V5.89482V5.88961V5.8844V5.87919V5.87399V5.8688V5.86361V5.85842V5.85324V5.84806V5.84289V5.83772V5.83256V5.8274V5.82224V5.81709V5.81194V5.8068V5.80167V5.79653V5.7914V5.78628V5.78116V5.77604V5.77093V5.76582V5.76072V5.75562V5.75052V5.74543V5.74035V5.73526V5.73019V5.72511V5.72004V5.71497V5.70991V5.70485V5.6998V5.69475V5.6897V5.68466V5.67962V5.67459V5.66956V5.66453V5.65951V5.65449V5.64948V5.64447V5.63946V5.63446V5.62946V5.62446V5.61947V5.61448V5.6095V5.60452V5.59954V5.59457V5.5896V5.58463V5.57967V5.57471V5.56976V5.56481V5.55986V5.55491V5.54997V5.54504V5.5401V5.53517V5.53025V5.52532V5.52041V5.51549V5.51058V5.50567V5.50076V5.49586V5.49096V5.48606V5.48117V5.47628V5.4714V5.46652V5.46164V5.45676V5.45189V5.44702V5.44215V5.43729V5.43243V5.42757V5.42272V5.41787V5.41302V5.40818V5.40334V5.3985V5.39366V5.38883V5.384V5.37918V5.37435V5.36953V5.36472V5.3599V5.35509V5.35028V5.34548V5.34068V5.33588V5.33108V5.32629V5.3215V5.31671V5.31192V5.30714V5.30236V5.29758V5.29281V5.28804V5.28327V5.2785V5.27374V5.26898V5.26422V5.25946V5.25471V5.24996V5.24521V5.24046V5.23572V5.23098V5.22624V5.22151V5.21677V5.21204V5.20731V5.20259V5.19787V5.19315V5.18843V5.18371V5.179V5.17428V5.16958V5.16487V5.16016V5.15546V5.15076V5.14606V5.14137V5.13667V5.13198V5.12729V5.12261V5.11792V5.11324V5.10856V5.10388V5.0992V5.09453V5.08986V5.08519V5.08052V5.07585V5.07119V5.06653V5.06187V5.05721V5.05255V5.0479V5.04324V5.03859V5.03394V5.0293V5.02465V5.02001V5.01537V5.01073V5.00609V5.00145V4.99682V4.99218V4.98755V4.98292V4.9783V4.97367V4.96904V4.96442V4.9598V4.95518V4.95056V4.94595V4.94133V4.93672V4.9321V4.92749V4.92288V4.91828V4.91367V4.90907V4.90446V4.89986V4.89526V4.89066V4.88606V4.88147V4.87687V4.87228V4.86768V4.86309V4.8585V4.85391V4.84933V4.84474V4.84015V4.83557V4.83099V4.8264V4.82182V4.81724V4.81267V4.80809V4.80351V4.79894V4.79436V4.78979V4.78522V4.78065V4.77608V4.77151V4.76694V4.76237V4.7578V4.75324V4.74867V4.74411V4.73955V4.73498V4.73042V4.72586V4.7213V4.71674V4.71219V4.70763V4.70307V4.69851V4.69396V4.6894V4.68485V4.6803V4.67574V4.67119V4.66664V4.66209V4.65754V4.65299V4.64844V4.64389V4.63934V4.63479V4.63025V4.6257V4.62115V4.61661V4.61206V4.60752V4.60297V4.59843V4.59388V4.58934V4.58479V4.58025V4.57571V4.57116V4.56662V4.56208V4.55754V4.553V4.54845V4.54391V4.53937V4.53483V4.53029V4.52575V4.52121V4.51667V4.51212V4.50758V4.50304V4.4985V4.49396V4.48942V4.48488V4.48034V4.4758V4.47126V4.46672V4.46217V4.45763V4.45309V4.44855V4.44401V4.43947V4.43492V4.43038V4.42584V4.4213V4.41675V4.41221V4.40767V4.40312V4.39858V4.39403V4.38949V4.38494V4.38039V4.37585V4.3713V4.36675V4.36221V4.35766V4.35311V4.34856V4.34401V4.33946V4.33491V4.33036V4.32581V4.32125V4.3167V4.31215V4.30759V4.30304V4.29848V4.29392V4.28937V4.28481V4.28025V4.27569V4.27113V4.26657V4.26201V4.25744V4.25288V4.24832V4.24375V4.23918V4.23462V4.23005V4.22548V4.22091V4.21634V4.21177V4.20719V4.20262V4.19805V4.19347V4.18889V4.18431V4.17974V4.17516V4.17057V4.16599V4.16141V4.15682V4.15224V4.14765V4.14306V4.13847V4.13388V4.12929V4.12469V4.1201V4.1155V4.11445L8.58124 8.69928C8.23354 8.94764 7.76646 8.94764 7.41876 8.69928L1 4.11445V12C1 12.5523 1.44772 13 2 13H4C4.27614 13 4.5 13.2239 4.5 13.5C4.5 13.7761 4.27614 14 4 14H2C0.89543 14 0 13.1046 0 12V4ZM14 3C14.2163 3 14.4165 3.06869 14.5802 3.18544L8 7.88555L1.41982 3.18542C1.58343 3.06868 1.78369 3 2 3H14ZM8.62718 11.3369C8.58208 10.8877 7.91792 10.8877 7.87282 11.3369L7.74264 12.6336L6.53863 12.0964C6.12154 11.9103 5.78945 12.4774 6.16145 12.7405L7.23528 13.5L6.16145 14.2595C5.78945 14.5226 6.12154 15.0897 6.53863 14.9036L7.74264 14.3664L7.87282 15.6631C7.91792 16.1123 8.58208 16.1123 8.62718 15.6631L8.75736 14.3664L9.96137 14.9036C10.3785 15.0897 10.7105 14.5226 10.3385 14.2595L9.26472 13.5L10.3385 12.7405C10.7105 12.4774 10.3785 11.9103 9.96137 12.0964L8.75736 12.6336L8.62718 11.3369ZM14.1272 11.3369C14.0821 10.8877 13.4179 10.8877 13.3728 11.3369L13.2426 12.6336L12.0386 12.0964C11.6215 11.9103 11.2895 12.4774 11.6615 12.7405L12.7353 13.5L11.6615 14.2595C11.2895 14.5226 11.6215 15.0897 12.0386 14.9036L13.2426 14.3664L13.3728 15.6631C13.4179 16.1123 14.0821 16.1123 14.1272 15.6631L14.2574 14.3664L15.4614 14.9036C15.8785 15.0897 16.2105 14.5226 15.8385 14.2595L14.7647 13.5L15.8385 12.7405C16.2105 12.4774 15.8785 11.9103 15.4614 12.0964L14.2574 12.6336L14.1272 11.3369Z' fill='black'/%3e%3c/svg%3e";
@@ -40373,12 +40409,12 @@ var img = "data:image/svg+xml,%3c!-- * Copyright (c) 2024%2c WSO2 Inc. (http://w
40373
40409
 
40374
40410
  const images = {
40375
40411
  'Email OTP': img$6,
40376
- facebook: img$4,
40377
40412
  Github: img$3,
40378
40413
  Google: img$2,
40379
40414
  Microsoft: img$1,
40380
40415
  'SMS OTP': img$5,
40381
40416
  TOTP: img,
40417
+ facebook: img$4,
40382
40418
  };
40383
40419
  /**
40384
40420
  * This component renders the login options box.
@@ -44375,7 +44411,7 @@ class SPACryptoUtils {
44375
44411
  keys: [jwk],
44376
44412
  }), jwtVerifyOptions)
44377
44413
  .then(() => Promise.resolve(true))
44378
- .catch(error => {
44414
+ .catch((error) => {
44379
44415
  var _a;
44380
44416
  return Promise.reject(new AsgardeoUIException('REACT_UI-CRYPTO-UTILS-VJ-IV01', (_a = error === null || error === void 0 ? void 0 : error.reason) !== null && _a !== void 0 ? _a : JSON.stringify(error), `${error === null || error === void 0 ? void 0 : error.code} ${error === null || error === void 0 ? void 0 : error.claim}`));
44381
44417
  });
@@ -44385,37 +44421,6 @@ class SPACryptoUtils {
44385
44421
  var css$1 = "/**\n * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n.Box-asgardeoSignIn {\n min-width: 350px;\n min-height: 75vh;\n}\n.Box-asgardeoSignIn .email-otp-resend-button {\n margin-top: 0;\n}\n.Box-asgardeoSignIn .multiple-otions-title {\n margin: 16px 0 34px;\n}\n.Box-asgardeoSignIn .asgardeo-multiple-options-paper {\n padding-bottom: 64px;\n}\n.Box-asgardeoSignIn .asgardeo-multiple-options-paper .asgardeo-sign-in-alert {\n margin-bottom: 24px;\n}\n\n.Box-circularProgressHolder {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 75vh;\n}\n.Box-circularProgressHolder .circular-progress {\n color: rgb(214, 211, 211) !important;\n}\n\n.asgardeo-sign-in-footer,\n.asgardeo-sign-in-logo {\n opacity: 0.5;\n animation: fade-in 0.7s ease-in-out forwards;\n}\n\n@keyframes fade-in {\n to {\n opacity: 1;\n }\n}\n.circular-progress-holder-authn {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-grow: 1;\n}\n.circular-progress-holder-authn .sign-in-button-progress {\n color: var(--oxygen-palette-primary-main);\n margin: 0 auto !important;\n max-height: 25px;\n max-width: 25px;\n margin-left: 12px;\n}";
44386
44422
  n(css$1,{});
44387
44423
 
44388
- /**
44389
- * This component renders the IdentifierFirst authentication form.
44390
- *
44391
- * @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component.
44392
- * @param {BrandingProps} props.brandingProps - Branding props.
44393
- * @param {Function} props.handleAuthenticate - Callback to handle authentication.
44394
- * @param {Authenticator} props.authenticator - Authenticator.
44395
- * @param {AlertType} props.alert - Alert type.
44396
- * @param {ReactElement[]} props.renderLoginOptions - Login options.
44397
- * @param {boolean} props.showSelfSignUp - Show self sign up.
44398
- *
44399
- * @return {ReactElement}
44400
- */
44401
- const IdentifierFirst = ({ handleAuthenticate, authenticator, alert, brandingProps, children, showSelfSignUp, renderLoginOptions, }) => {
44402
- var _a;
44403
- const { isAuthLoading, username, setUsername } = useContext(AsgardeoContext);
44404
- const { t, isLoading } = useTranslations({
44405
- componentLocaleOverride: brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.locale,
44406
- componentTextOverrides: (_a = brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.preference) === null || _a === void 0 ? void 0 : _a.text,
44407
- screen: ScreenType.Login,
44408
- });
44409
- if (isLoading) {
44410
- return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "asgardeo-basic-auth-skeleton", children: [jsxRuntimeExports.jsx(Pi, { className: "skeleton-title", variant: "text", width: 100, height: 55 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-text-field-label", variant: "text", width: 70 }), jsxRuntimeExports.jsx(Pi, { variant: "rectangular", width: 300, height: 40 }), jsxRuntimeExports.jsx(Pi, { className: "skeleton-submit-button", variant: "rectangular", width: 270, height: 40 })] }));
44411
- }
44412
- return (jsxRuntimeExports.jsxs(SignIn$1.Paper, { className: "Paper-basicAuth", children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { title: true, className: "Typography-basicAuthTitle", children: t(keys.login.login.heading) }), alert && (jsxRuntimeExports.jsx(SignIn$1.Alert, Object.assign({ className: "asgardeo-basic-auth-alert" }, alert === null || alert === void 0 ? void 0 : alert.alertType, { children: t(alert.key) }))), jsxRuntimeExports.jsx(SignIn$1.TextField, { fullWidth: true, autoComplete: "off", label: t(keys.login.username), name: "text", value: username, placeholder: t(keys.login.enter.your.username), onChange: (e) => setUsername(e.target.value) }), children, jsxRuntimeExports.jsx(SignIn$1.Button, { color: "primary", variant: "contained", type: "submit", fullWidth: true, disabled: isAuthLoading, onClick: () => {
44413
- handleAuthenticate(authenticator.authenticatorId, {
44414
- username,
44415
- });
44416
- }, children: t(keys.login.button) }), isAuthLoading && (jsxRuntimeExports.jsx("div", { className: "circular-progress-holder-authn", children: jsxRuntimeExports.jsx(ae, { className: "sign-in-button-progress" }) })), showSelfSignUp && (jsxRuntimeExports.jsxs(je, { container: true, children: [jsxRuntimeExports.jsx(SignIn$1.Typography, { children: t(keys.common.prefix.register) }), jsxRuntimeExports.jsx(SignIn$1.Link, { href: "./register", className: "asgardeo-register-link", children: t(keys.common.register) })] })), renderLoginOptions.length !== 0 && jsxRuntimeExports.jsxs(SignIn$1.Divider, { children: [" ", t(keys.common.or), " "] }), renderLoginOptions] }));
44417
- };
44418
-
44419
44424
  /**
44420
44425
  * This component provides the sign-in functionality.
44421
44426
  *
@@ -44428,13 +44433,13 @@ const IdentifierFirst = ({ handleAuthenticate, authenticator, alert, brandingPro
44428
44433
  const SignIn = (props) => {
44429
44434
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
44430
44435
  const { basicAuthChildren, brandingProps, emailOtpChildren, identifierFirstChildren, showFooter = true, showLogo = true, showSignUp, smsOtpChildren, totpChildren, } = props;
44431
- const [isComponentLoading, setIsComponentLoading] = useState(true);
44432
44436
  const [alert, setAlert] = useState();
44433
44437
  const [showSelfSignUp, setShowSelfSignUp] = useState(showSignUp);
44434
44438
  const [componentBranding, setComponentBranding] = useState();
44435
44439
  const { isAuthenticated } = useAuthentication();
44436
44440
  const { config } = useConfig();
44437
44441
  const authContext = useContext(AsgardeoContext);
44442
+ const { setAuthResponse, setIsComponentLoading } = authContext;
44438
44443
  const brandingPreference = useContext(BrandingPreferenceContext);
44439
44444
  const { isLoading, t } = useTranslations({
44440
44445
  componentLocaleOverride: brandingProps === null || brandingProps === void 0 ? void 0 : brandingProps.locale,
@@ -44452,15 +44457,16 @@ const SignIn = (props) => {
44452
44457
  */
44453
44458
  authorize()
44454
44459
  .then((response) => {
44455
- authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(response);
44456
- setIsComponentLoading(false);
44460
+ setAuthResponse(response);
44457
44461
  })
44458
44462
  .catch((error) => {
44459
44463
  setAlert({ alertType: { error: true }, key: keys.common.error });
44460
- setIsComponentLoading(false);
44461
44464
  throw new AsgardeoUIException('REACT_UI-SIGN_IN-SI-SE01', 'Authorization failed', error.stack);
44465
+ })
44466
+ .finally(() => {
44467
+ setIsComponentLoading(false);
44462
44468
  });
44463
- }, []);
44469
+ }, [setAuthResponse, setIsComponentLoading]);
44464
44470
  /**
44465
44471
  * Handles the generalized authentication process.
44466
44472
  * @param {string} authenticatorId - Authenticator ID.
@@ -44472,7 +44478,7 @@ const SignIn = (props) => {
44472
44478
  if ((authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === undefined) {
44473
44479
  throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-IV02', 'Auth response is undefined.');
44474
44480
  }
44475
- authContext.setIsAuthLoading(true);
44481
+ authContext === null || authContext === void 0 ? void 0 : authContext.setIsAuthLoading(true);
44476
44482
  const resp = yield authenticate({
44477
44483
  flowId: authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.flowId,
44478
44484
  selectedAuthenticator: {
@@ -44481,7 +44487,7 @@ const SignIn = (props) => {
44481
44487
  },
44482
44488
  }).catch((authnError) => {
44483
44489
  setAlert({ alertType: { error: true }, key: keys.common.error });
44484
- authContext.setIsAuthLoading(false);
44490
+ authContext === null || authContext === void 0 ? void 0 : authContext.setIsAuthLoading(false);
44485
44491
  throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-SE03', 'Authentication failed.', authnError.stack);
44486
44492
  });
44487
44493
  if (!authParams) {
@@ -44523,7 +44529,7 @@ const SignIn = (props) => {
44523
44529
  const authInstance = AuthClient.getInstance();
44524
44530
  const state = (yield authInstance.getDataLayer().getTemporaryDataParameter('state')).toString();
44525
44531
  yield authInstance.requestAccessToken(resp.authData.code, resp.authData.session_state, state);
44526
- authContext.setAuthentication();
44532
+ authContext === null || authContext === void 0 ? void 0 : authContext.setAuthentication();
44527
44533
  }
44528
44534
  else if (resp.flowStatus === FlowStatus.FailIncomplete) {
44529
44535
  authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(Object.assign(Object.assign({}, resp), { nextStep: authContext === null || authContext === void 0 ? void 0 : authContext.authResponse.nextStep }));
@@ -44533,13 +44539,13 @@ const SignIn = (props) => {
44533
44539
  authContext === null || authContext === void 0 ? void 0 : authContext.setAuthResponse(resp);
44534
44540
  setShowSelfSignUp(false);
44535
44541
  }
44536
- authContext.setIsAuthLoading(false);
44542
+ authContext === null || authContext === void 0 ? void 0 : authContext.setIsAuthLoading(false);
44537
44543
  });
44538
44544
  const renderLoginOptions = (authenticators) => {
44539
44545
  const LoginOptions = [];
44540
44546
  authenticators.forEach((authenticator) => {
44541
44547
  const displayName = authenticator.idp === 'LOCAL' ? authenticator.authenticator : authenticator.idp;
44542
- LoginOptions.push(jsxRuntimeExports.jsx(LoginOptionsBox, { isAuthLoading: authContext.isAuthLoading, socialName: authenticator.authenticator, displayName: `${t(keys.common.multiple.options.prefix)} ${displayName}`, handleOnClick: () => handleAuthenticate(authenticator.authenticatorId) }, authenticator.authenticatorId));
44548
+ LoginOptions.push(jsxRuntimeExports.jsx(LoginOptionsBox, { isAuthLoading: authContext === null || authContext === void 0 ? void 0 : authContext.isAuthLoading, socialName: authenticator.authenticator, displayName: `${t(keys.common.multiple.options.prefix)} ${displayName}`, handleOnClick: () => handleAuthenticate(authenticator.authenticatorId) }, authenticator.authenticatorId));
44543
44549
  });
44544
44550
  return LoginOptions;
44545
44551
  };
@@ -44586,7 +44592,7 @@ const SignIn = (props) => {
44586
44592
  /**
44587
44593
  * Renders the circular progress component while the component or text is loading.
44588
44594
  */
44589
- if (isComponentLoading || isLoading || authContext.isBrandingLoading) {
44595
+ if ((authContext === null || authContext === void 0 ? void 0 : authContext.isComponentLoading) || isLoading || (authContext === null || authContext === void 0 ? void 0 : authContext.isBrandingLoading)) {
44590
44596
  return (jsxRuntimeExports.jsx("div", { className: "Box-circularProgressHolder", children: jsxRuntimeExports.jsx(ae, { className: "circular-progress" }) }));
44591
44597
  }
44592
44598
  const imgUrl = (_f = (_e = (_d = (_c = (_b = brandingPreference === null || brandingPreference === void 0 ? void 0 : brandingPreference.preference) === null || _b === void 0 ? void 0 : _b.theme) === null || _c === void 0 ? void 0 : _c.LIGHT) === null || _d === void 0 ? void 0 : _d.images) === null || _e === void 0 ? void 0 : _e.logo) === null || _f === void 0 ? void 0 : _f.imgURL;
@@ -44595,7 +44601,7 @@ const SignIn = (props) => {
44595
44601
  if (showFooter && copyrightText.includes('{{currentYear}}')) {
44596
44602
  copyrightText = copyrightText.replace('{{currentYear}}', new Date().getFullYear().toString());
44597
44603
  }
44598
- return (jsxRuntimeExports.jsx(eo, { theme: generateThemeSignIn(componentBranding === null || componentBranding === void 0 ? void 0 : componentBranding.preference.theme), children: jsxRuntimeExports.jsxs(SignIn$1, { className: "Box-asgardeoSignIn", children: [showLogo && !(isLoading || isComponentLoading) && (jsxRuntimeExports.jsx(SignIn$1.Image, { className: "asgardeo-sign-in-logo", src: imgUrl })), ((_g = authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === null || _g === void 0 ? void 0 : _g.flowStatus) !== FlowStatus.SuccessCompleted && !isAuthenticated && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [renderSignIn(), showFooter && !(isLoading || isComponentLoading) && (jsxRuntimeExports.jsx(SignIn$1.Footer, { className: "asgardeo-sign-in-footer", copyrights: { children: copyrightText }, items: [
44604
+ return (jsxRuntimeExports.jsx(eo, { theme: generateThemeSignIn(componentBranding === null || componentBranding === void 0 ? void 0 : componentBranding.preference.theme), children: jsxRuntimeExports.jsxs(SignIn$1, { className: "Box-asgardeoSignIn", children: [showLogo && !(isLoading || (authContext === null || authContext === void 0 ? void 0 : authContext.isComponentLoading)) && (jsxRuntimeExports.jsx(SignIn$1.Image, { className: "asgardeo-sign-in-logo", src: imgUrl })), ((_g = authContext === null || authContext === void 0 ? void 0 : authContext.authResponse) === null || _g === void 0 ? void 0 : _g.flowStatus) !== FlowStatus.SuccessCompleted && !isAuthenticated && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [renderSignIn(), showFooter && !(isLoading || (authContext === null || authContext === void 0 ? void 0 : authContext.isComponentLoading)) && (jsxRuntimeExports.jsx(SignIn$1.Footer, { className: "asgardeo-sign-in-footer", copyrights: { children: copyrightText }, items: [
44599
44605
  {
44600
44606
  children: (jsxRuntimeExports.jsx(SignIn$1.Link, { href: componentBranding.preference.urls.privacyPolicyURL, children: t(keys.common.privacy.policy) })),
44601
44607
  },
@@ -45014,6 +45020,7 @@ const AsgardeoProvider = (props) => {
45014
45020
  const [isBrandingLoading, setIsBrandingLoading] = useState(true);
45015
45021
  const [isTextLoading, setIsTextLoading] = useState(true);
45016
45022
  const [isAuthLoading, setIsAuthLoading] = useState(false);
45023
+ const [isComponentLoading, setIsComponentLoading] = useState(true);
45017
45024
  const [authResponse, setAuthResponse] = useState();
45018
45025
  const [username, setUsername] = useState('');
45019
45026
  const onSignInRef = useRef();
@@ -45071,13 +45078,15 @@ const AsgardeoProvider = (props) => {
45071
45078
  isAuthLoading,
45072
45079
  isAuthenticated,
45073
45080
  isBrandingLoading,
45074
- isGlobalLoading: isBrandingLoading || isTextLoading || isAuthLoading,
45081
+ isComponentLoading,
45082
+ isGlobalLoading: isAuthLoading || isBrandingLoading || isComponentLoading || isTextLoading,
45075
45083
  isTextLoading,
45076
45084
  onSignOutRef,
45077
45085
  setAuthResponse,
45078
45086
  setAuthentication,
45079
45087
  setIsAuthLoading,
45080
45088
  setIsBrandingLoading,
45089
+ setIsComponentLoading,
45081
45090
  setIsTextLoading,
45082
45091
  setOnSignIn,
45083
45092
  setOnSignOut,
@@ -45091,9 +45100,11 @@ const AsgardeoProvider = (props) => {
45091
45100
  isAuthLoading,
45092
45101
  isAuthenticated,
45093
45102
  isBrandingLoading,
45103
+ isComponentLoading,
45094
45104
  isTextLoading,
45095
45105
  setAuthResponse,
45096
45106
  setAuthentication,
45107
+ setIsComponentLoading,
45097
45108
  setOnSignIn,
45098
45109
  setOnSignOut,
45099
45110
  setUsername,
@@ -45134,8 +45145,134 @@ const useOn = (props) => {
45134
45145
  default:
45135
45146
  throw new AsgardeoUIException('REACT-USE_ON-UO-IV-01', 'Invalid event type provided.');
45136
45147
  }
45137
- }, []);
45148
+ }, [callback, contextValue, event]);
45138
45149
  };
45139
45150
 
45140
45151
  export { AsgardeoProvider, Hooks, SignIn, SignInButton, SignOutButton, SignedIn, SignedOut, useAuthentication, useOn };
45141
45152
  //# sourceMappingURL=index.js.map
45153
+ re || new SessionStore();
45154
+ const spaUtils = new SPACryptoUtils();
45155
+ const authClient = AuthClient.getInstance(config, storeInstance, spaUtils);
45156
+ /**
45157
+ * Sets the authentication status and access token.
45158
+ */
45159
+ const setAuthentication = React$1.useCallback(() => {
45160
+ authClient.isAuthenticated().then((isAuth) => {
45161
+ setIsAuthenticated(isAuth);
45162
+ if (isAuth) {
45163
+ authClient.getAccessToken().then((accessTokenFromClient) => {
45164
+ if (accessTokenFromClient) {
45165
+ setAccessToken(accessTokenFromClient);
45166
+ getProfileInformation().then((response) => {
45167
+ setUser(response);
45168
+ });
45169
+ if (onSignInRef.current) {
45170
+ onSignInRef.current();
45171
+ }
45172
+ }
45173
+ });
45174
+ }
45175
+ });
45176
+ }, [authClient]);
45177
+ React$1.useEffect(() => {
45178
+ setAuthentication();
45179
+ /**
45180
+ * This script is added so that the popup window can send the code and state to the parent window
45181
+ */
45182
+ const url = new URL(window.location.href);
45183
+ if (url.searchParams.has('code') && url.searchParams.has('state')) {
45184
+ const code = url.searchParams.get('code');
45185
+ const state = url.searchParams.get('state');
45186
+ /**
45187
+ * Send the 'code' and 'state' to the parent window and close the current window (popup)
45188
+ */
45189
+ window.opener.postMessage({ code, state }, config.signInRedirectURL);
45190
+ window.close();
45191
+ }
45192
+ }, [config.signInRedirectURL, setAuthentication]);
45193
+ const value = React$1.useMemo(() => ({
45194
+ accessToken,
45195
+ authResponse,
45196
+ config,
45197
+ isAuthLoading,
45198
+ isAuthenticated,
45199
+ isBrandingLoading,
45200
+ isComponentLoading,
45201
+ isGlobalLoading: isAuthLoading || isBrandingLoading || isComponentLoading || isTextLoading,
45202
+ isTextLoading,
45203
+ onSignOutRef,
45204
+ setAuthResponse,
45205
+ setAuthentication,
45206
+ setIsAuthLoading,
45207
+ setIsBrandingLoading,
45208
+ setIsComponentLoading,
45209
+ setIsTextLoading,
45210
+ setOnSignIn,
45211
+ setOnSignOut,
45212
+ setUsername,
45213
+ user,
45214
+ username,
45215
+ }), [
45216
+ accessToken,
45217
+ authResponse,
45218
+ config,
45219
+ isAuthLoading,
45220
+ isAuthenticated,
45221
+ isBrandingLoading,
45222
+ isComponentLoading,
45223
+ isTextLoading,
45224
+ setAuthResponse,
45225
+ setAuthentication,
45226
+ setIsComponentLoading,
45227
+ setOnSignIn,
45228
+ setOnSignOut,
45229
+ setUsername,
45230
+ user,
45231
+ username,
45232
+ ]);
45233
+ return (jsxRuntimeExports.jsx(AsgardeoContext.Provider, { value: value, children: jsxRuntimeExports.jsx(BrandingPreferenceProvider, { branding: branding, children: jsxRuntimeExports.jsx(I18nProvider, { providerLocaleOverride: branding === null || branding === void 0 ? void 0 : branding.locale, providerTextOverrides: (_a = branding === null || branding === void 0 ? void 0 : branding.preference) === null || _a === void 0 ? void 0 : _a.text, children: children }) }) }));
45234
+ };
45235
+
45236
+ /**
45237
+ * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
45238
+ *
45239
+ * WSO2 LLC. licenses this file to you under the Apache License,
45240
+ * Version 2.0 (the "License"); you may not use this file except
45241
+ * in compliance with the License.
45242
+ * You may obtain a copy of the License at
45243
+ *
45244
+ * http://www.apache.org/licenses/LICENSE-2.0
45245
+ *
45246
+ * Unless required by applicable law or agreed to in writing,
45247
+ * software distributed under the License is distributed on an
45248
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
45249
+ * KIND, either express or implied. See the License for the
45250
+ * specific language governing permissions and limitations
45251
+ * under the License.
45252
+ */
45253
+ const useOn = (props) => {
45254
+ const { callback, event } = props;
45255
+ const contextValue = React$1.useContext(AsgardeoContext);
45256
+ React$1.useEffect(() => {
45257
+ switch (event) {
45258
+ case exports.Hooks.SignIn:
45259
+ contextValue.setOnSignIn(callback);
45260
+ break;
45261
+ case exports.Hooks.SignOut:
45262
+ contextValue.setOnSignOut(callback);
45263
+ break;
45264
+ default:
45265
+ throw new AsgardeoUIException('REACT-USE_ON-UO-IV-01', 'Invalid event type provided.');
45266
+ }
45267
+ }, [callback, contextValue, event]);
45268
+ };
45269
+
45270
+ exports.AsgardeoProvider = AsgardeoProvider;
45271
+ exports.SignIn = SignIn;
45272
+ exports.SignInButton = SignInButton;
45273
+ exports.SignOutButton = SignOutButton;
45274
+ exports.SignedIn = SignedIn;
45275
+ exports.SignedOut = SignedOut;
45276
+ exports.useAuthentication = useAuthentication;
45277
+ exports.useOn = useOn;
45278
+ //# sourceMappingURL=index.js.map