@asgardeo/react 0.6.16 → 0.6.18
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/dist/cjs/index.js +1760 -1316
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/adapters/CheckboxInput.d.ts +2 -2
- package/dist/components/adapters/DateInput.d.ts +2 -2
- package/dist/components/adapters/DividerComponent.d.ts +2 -2
- package/dist/components/adapters/EmailInput.d.ts +2 -2
- package/dist/components/adapters/FormContainer.d.ts +2 -2
- package/dist/components/adapters/ImageComponent.d.ts +2 -2
- package/dist/components/adapters/NumberInput.d.ts +2 -2
- package/dist/components/adapters/PasswordInput.d.ts +2 -2
- package/dist/components/adapters/SelectInput.d.ts +2 -2
- package/dist/components/adapters/SocialButton.d.ts +2 -2
- package/dist/components/adapters/SubmitButton.d.ts +2 -2
- package/dist/components/adapters/TelephoneInput.d.ts +2 -2
- package/dist/components/adapters/TextInput.d.ts +2 -2
- package/dist/components/adapters/Typography.d.ts +2 -2
- package/dist/components/presentation/{SignIn/component-driven/SignInOptionFactory.d.ts → auth/AuthOptionFactory.d.ts} +14 -2
- package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.d.ts +2 -2
- package/dist/components/presentation/{SignIn → auth/SignIn}/SignIn.d.ts +3 -3
- package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/BaseSignIn.d.ts +1 -1
- package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/BaseSignIn.d.ts +3 -3
- package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/SignIn.d.ts +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +27 -0
- package/dist/components/presentation/{SignUp → auth/SignUp}/SignUp.d.ts +6 -13
- package/dist/components/presentation/{SignUp → auth/SignUp/v1}/BaseSignUp.d.ts +3 -53
- package/dist/components/presentation/auth/SignUp/v1/SignUp.d.ts +38 -0
- package/dist/components/presentation/{SignUp → auth/SignUp/v1}/SignUpOptionFactory.d.ts +3 -52
- package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +171 -0
- package/dist/components/presentation/auth/SignUp/v2/SignUp.d.ts +38 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.js +1463 -1011
- package/dist/index.js.map +4 -4
- package/dist/models/adapters.d.ts +68 -0
- package/dist/utils/v2/flowTransformer.d.ts +111 -0
- package/dist/utils/v2/getAuthComponentHeadings.d.ts +69 -0
- package/dist/utils/v2/resolveTranslation.d.ts +27 -0
- package/dist/utils/v2/resolveTranslationsInArray.d.ts +27 -0
- package/dist/{components/presentation/SignIn/component-driven/transformer.d.ts → utils/v2/resolveTranslationsInObject.d.ts} +8 -11
- package/package.json +6 -6
- package/dist/components/presentation/SignUp/transformer.d.ts +0 -104
- /package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.styles.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/EmailOtp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/IdentifierFirst.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/MultiOptionButton.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SignInOptionFactory.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SmsOtp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SocialButton.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/Totp.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/UsernamePassword.d.ts +0 -0
- /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/types.d.ts +0 -0
- /package/dist/components/presentation/{SignUp → auth/SignUp}/BaseSignUp.styles.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -795,7 +795,7 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
795
795
|
if (config.platform === Platform.AsgardeoV2) {
|
|
796
796
|
return executeEmbeddedSignUpFlowV2({
|
|
797
797
|
baseUrl,
|
|
798
|
-
payload: firstArg
|
|
798
|
+
payload: typeof firstArg === "object" && "flowType" in firstArg ? { ...firstArg, verbose: true } : firstArg
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
801
|
if (typeof firstArg === "object" && "flowType" in firstArg) {
|
|
@@ -2720,45 +2720,47 @@ var BaseSignInButton_default = BaseSignInButton;
|
|
|
2720
2720
|
import { AsgardeoRuntimeError as AsgardeoRuntimeError4, navigate as navigate2 } from "@asgardeo/browser";
|
|
2721
2721
|
import { forwardRef as forwardRef3, useState as useState9 } from "react";
|
|
2722
2722
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2723
|
-
var SignInButton = forwardRef3(
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2723
|
+
var SignInButton = forwardRef3(
|
|
2724
|
+
({ children, onClick, preferences, signInOptions: overriddenSignInOptions = {}, ...rest }, ref) => {
|
|
2725
|
+
const { signIn, signInUrl, signInOptions } = useAsgardeo_default();
|
|
2726
|
+
const { t } = useTranslation_default(preferences?.i18n);
|
|
2727
|
+
const [isLoading, setIsLoading] = useState9(false);
|
|
2728
|
+
const handleSignIn = async (e) => {
|
|
2729
|
+
try {
|
|
2730
|
+
setIsLoading(true);
|
|
2731
|
+
if (signInUrl) {
|
|
2732
|
+
navigate2(signInUrl);
|
|
2733
|
+
} else {
|
|
2734
|
+
await signIn(overriddenSignInOptions ?? signInOptions);
|
|
2735
|
+
}
|
|
2736
|
+
if (onClick) {
|
|
2737
|
+
onClick(e);
|
|
2738
|
+
}
|
|
2739
|
+
} catch (error) {
|
|
2740
|
+
throw new AsgardeoRuntimeError4(
|
|
2741
|
+
`Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,
|
|
2742
|
+
"SignInButton-handleSignIn-RuntimeError-001",
|
|
2743
|
+
"react",
|
|
2744
|
+
"Something went wrong while trying to sign in. Please try again later."
|
|
2745
|
+
);
|
|
2746
|
+
} finally {
|
|
2747
|
+
setIsLoading(false);
|
|
2734
2748
|
}
|
|
2735
|
-
|
|
2736
|
-
|
|
2749
|
+
};
|
|
2750
|
+
return /* @__PURE__ */ jsx11(
|
|
2751
|
+
BaseSignInButton_default,
|
|
2752
|
+
{
|
|
2753
|
+
ref,
|
|
2754
|
+
onClick: handleSignIn,
|
|
2755
|
+
isLoading,
|
|
2756
|
+
signIn: handleSignIn,
|
|
2757
|
+
preferences,
|
|
2758
|
+
...rest,
|
|
2759
|
+
children: children ?? t("elements.buttons.signin.text")
|
|
2737
2760
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
"SignInButton-handleSignIn-RuntimeError-001",
|
|
2742
|
-
"react",
|
|
2743
|
-
"Something went wrong while trying to sign in. Please try again later."
|
|
2744
|
-
);
|
|
2745
|
-
} finally {
|
|
2746
|
-
setIsLoading(false);
|
|
2747
|
-
}
|
|
2748
|
-
};
|
|
2749
|
-
return /* @__PURE__ */ jsx11(
|
|
2750
|
-
BaseSignInButton_default,
|
|
2751
|
-
{
|
|
2752
|
-
ref,
|
|
2753
|
-
onClick: handleSignIn,
|
|
2754
|
-
isLoading,
|
|
2755
|
-
signIn: handleSignIn,
|
|
2756
|
-
preferences,
|
|
2757
|
-
...rest,
|
|
2758
|
-
children: children ?? t("elements.buttons.signIn")
|
|
2759
|
-
}
|
|
2760
|
-
);
|
|
2761
|
-
});
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
);
|
|
2762
2764
|
SignInButton.displayName = "SignInButton";
|
|
2763
2765
|
var SignInButton_default = SignInButton;
|
|
2764
2766
|
|
|
@@ -2827,7 +2829,7 @@ var SignOutButton = forwardRef5(({ children, onClick, preferences, ...rest }, re
|
|
|
2827
2829
|
signOut: handleSignOut,
|
|
2828
2830
|
preferences,
|
|
2829
2831
|
...rest,
|
|
2830
|
-
children: children ?? t("elements.buttons.
|
|
2832
|
+
children: children ?? t("elements.buttons.signout.text")
|
|
2831
2833
|
}
|
|
2832
2834
|
);
|
|
2833
2835
|
});
|
|
@@ -2906,7 +2908,7 @@ var SignUpButton = forwardRef7(({ children, onClick, preferences, ...rest }, ref
|
|
|
2906
2908
|
signUp: handleSignUp,
|
|
2907
2909
|
preferences,
|
|
2908
2910
|
...rest,
|
|
2909
|
-
children: children ?? t("elements.buttons.
|
|
2911
|
+
children: children ?? t("elements.buttons.signup.text")
|
|
2910
2912
|
}
|
|
2911
2913
|
);
|
|
2912
2914
|
});
|
|
@@ -2955,12 +2957,10 @@ var Loading = ({ children, fallback = null }) => {
|
|
|
2955
2957
|
Loading.displayName = "Loading";
|
|
2956
2958
|
var Loading_default = Loading;
|
|
2957
2959
|
|
|
2958
|
-
// src/components/presentation/SignIn/BaseSignIn.tsx
|
|
2959
|
-
import {
|
|
2960
|
-
Platform as Platform3
|
|
2961
|
-
} from "@asgardeo/browser";
|
|
2960
|
+
// src/components/presentation/auth/SignIn/BaseSignIn.tsx
|
|
2961
|
+
import { Platform as Platform3 } from "@asgardeo/browser";
|
|
2962
2962
|
|
|
2963
|
-
// src/components/presentation/SignIn/
|
|
2963
|
+
// src/components/presentation/auth/SignIn/v1/BaseSignIn.tsx
|
|
2964
2964
|
import {
|
|
2965
2965
|
EmbeddedSignInFlowStepType,
|
|
2966
2966
|
EmbeddedSignInFlowStatus,
|
|
@@ -2973,13 +2973,13 @@ import {
|
|
|
2973
2973
|
import { cx as cx19 } from "@emotion/css";
|
|
2974
2974
|
import { useEffect as useEffect12, useState as useState14, useCallback as useCallback9, useRef as useRef3 } from "react";
|
|
2975
2975
|
|
|
2976
|
-
// src/components/presentation/SignIn/
|
|
2976
|
+
// src/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.tsx
|
|
2977
2977
|
import {
|
|
2978
2978
|
EmbeddedSignInFlowAuthenticatorKnownIdPType as EmbeddedSignInFlowAuthenticatorKnownIdPType2,
|
|
2979
2979
|
ApplicationNativeAuthenticationConstants as ApplicationNativeAuthenticationConstants2
|
|
2980
2980
|
} from "@asgardeo/browser";
|
|
2981
2981
|
|
|
2982
|
-
// src/components/presentation/SignIn/
|
|
2982
|
+
// src/components/presentation/auth/SignIn/v1/options/UsernamePassword.tsx
|
|
2983
2983
|
import { EmbeddedSignInFlowAuthenticatorParamType, FieldType as FieldType2 } from "@asgardeo/browser";
|
|
2984
2984
|
import { useEffect as useEffect7 } from "react";
|
|
2985
2985
|
|
|
@@ -4503,7 +4503,7 @@ var FieldFactory = (props) => {
|
|
|
4503
4503
|
return createField(props);
|
|
4504
4504
|
};
|
|
4505
4505
|
|
|
4506
|
-
// src/components/presentation/SignIn/
|
|
4506
|
+
// src/components/presentation/auth/SignIn/v1/options/UsernamePassword.tsx
|
|
4507
4507
|
import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4508
4508
|
var UsernamePassword = ({
|
|
4509
4509
|
authenticator,
|
|
@@ -4521,8 +4521,8 @@ var UsernamePassword = ({
|
|
|
4521
4521
|
const { setTitle, setSubtitle } = useFlow_default();
|
|
4522
4522
|
const formFields = authenticator.metadata?.params?.sort((a, b) => a.order - b.order)?.filter((param) => param.param !== "totp") || [];
|
|
4523
4523
|
useEffect7(() => {
|
|
4524
|
-
setTitle(t("username.password.
|
|
4525
|
-
setSubtitle(t("username.password.
|
|
4524
|
+
setTitle(t("username.password.heading"));
|
|
4525
|
+
setSubtitle(t("username.password.subheading"));
|
|
4526
4526
|
}, [setTitle, setSubtitle, t]);
|
|
4527
4527
|
return /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
4528
4528
|
formFields.map((param) => /* @__PURE__ */ jsx31("div", { children: createField({
|
|
@@ -4535,7 +4535,7 @@ var UsernamePassword = ({
|
|
|
4535
4535
|
disabled: isLoading,
|
|
4536
4536
|
className: inputClassName,
|
|
4537
4537
|
touched: touchedFields[param.param] || false,
|
|
4538
|
-
placeholder: t(`elements.fields.placeholder`, {
|
|
4538
|
+
placeholder: t(`elements.fields.generic.placeholder`, {
|
|
4539
4539
|
field: (param.displayName || param.param).toLowerCase()
|
|
4540
4540
|
})
|
|
4541
4541
|
}) }, param.param)),
|
|
@@ -4550,14 +4550,14 @@ var UsernamePassword = ({
|
|
|
4550
4550
|
loading: isLoading,
|
|
4551
4551
|
className: buttonClassName,
|
|
4552
4552
|
style: { marginBottom: `calc(${theme.vars.spacing.unit} * 2)` },
|
|
4553
|
-
children: t("username.password.submit.
|
|
4553
|
+
children: t("username.password.buttons.submit.text")
|
|
4554
4554
|
}
|
|
4555
4555
|
)
|
|
4556
4556
|
] });
|
|
4557
4557
|
};
|
|
4558
4558
|
var UsernamePassword_default = UsernamePassword;
|
|
4559
4559
|
|
|
4560
|
-
// src/components/presentation/SignIn/
|
|
4560
|
+
// src/components/presentation/auth/SignIn/v1/options/IdentifierFirst.tsx
|
|
4561
4561
|
import { EmbeddedSignInFlowAuthenticatorParamType as EmbeddedSignInFlowAuthenticatorParamType2, FieldType as FieldType3 } from "@asgardeo/browser";
|
|
4562
4562
|
import { useEffect as useEffect8 } from "react";
|
|
4563
4563
|
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -4577,8 +4577,8 @@ var IdentifierFirst = ({
|
|
|
4577
4577
|
const { setTitle, setSubtitle } = useFlow_default();
|
|
4578
4578
|
const formFields = authenticator.metadata?.params?.sort((a, b) => a.order - b.order) || [];
|
|
4579
4579
|
useEffect8(() => {
|
|
4580
|
-
setTitle(t("identifier.first.
|
|
4581
|
-
setSubtitle(t("identifier.first.
|
|
4580
|
+
setTitle(t("identifier.first.heading"));
|
|
4581
|
+
setSubtitle(t("identifier.first.subheading"));
|
|
4582
4582
|
}, [setTitle, setSubtitle, t]);
|
|
4583
4583
|
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
4584
4584
|
formFields.map((param) => /* @__PURE__ */ jsx32("div", { children: createField({
|
|
@@ -4591,7 +4591,7 @@ var IdentifierFirst = ({
|
|
|
4591
4591
|
disabled: isLoading,
|
|
4592
4592
|
className: inputClassName,
|
|
4593
4593
|
touched: touchedFields[param.param] || false,
|
|
4594
|
-
placeholder: t(`elements.fields.placeholder`, {
|
|
4594
|
+
placeholder: t(`elements.fields.generic.placeholder`, {
|
|
4595
4595
|
field: (param.displayName || param.param).toLowerCase()
|
|
4596
4596
|
})
|
|
4597
4597
|
}) }, param.param)),
|
|
@@ -4606,7 +4606,7 @@ var IdentifierFirst = ({
|
|
|
4606
4606
|
loading: isLoading,
|
|
4607
4607
|
className: buttonClassName,
|
|
4608
4608
|
style: { marginBottom: `calc(${theme.vars.spacing.unit} * 2)` },
|
|
4609
|
-
children: t("identifier.first.submit.
|
|
4609
|
+
children: t("identifier.first.buttons.submit.text")
|
|
4610
4610
|
}
|
|
4611
4611
|
)
|
|
4612
4612
|
] });
|
|
@@ -4665,7 +4665,7 @@ var GoogleButton = ({
|
|
|
4665
4665
|
}
|
|
4666
4666
|
)
|
|
4667
4667
|
] }) }),
|
|
4668
|
-
children: children ?? t("elements.buttons.google")
|
|
4668
|
+
children: children ?? t("elements.buttons.google.text")
|
|
4669
4669
|
}
|
|
4670
4670
|
);
|
|
4671
4671
|
};
|
|
@@ -4696,7 +4696,7 @@ var GitHubButton = ({
|
|
|
4696
4696
|
fill: "#ffffff"
|
|
4697
4697
|
}
|
|
4698
4698
|
) }) }),
|
|
4699
|
-
children: children ?? t("elements.buttons.github")
|
|
4699
|
+
children: children ?? t("elements.buttons.github.text")
|
|
4700
4700
|
}
|
|
4701
4701
|
);
|
|
4702
4702
|
};
|
|
@@ -4727,7 +4727,7 @@ var MicrosoftButton = ({
|
|
|
4727
4727
|
/* @__PURE__ */ jsx35("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
4728
4728
|
/* @__PURE__ */ jsx35("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
4729
4729
|
] }),
|
|
4730
|
-
children: children ?? t("elements.buttons.microsoft")
|
|
4730
|
+
children: children ?? t("elements.buttons.microsoft.text")
|
|
4731
4731
|
}
|
|
4732
4732
|
);
|
|
4733
4733
|
};
|
|
@@ -4767,7 +4767,7 @@ var FacebookButton = ({
|
|
|
4767
4767
|
}
|
|
4768
4768
|
)
|
|
4769
4769
|
] }),
|
|
4770
|
-
children: children ?? t("elements.buttons.facebook")
|
|
4770
|
+
children: children ?? t("elements.buttons.facebook.text")
|
|
4771
4771
|
}
|
|
4772
4772
|
);
|
|
4773
4773
|
};
|
|
@@ -4798,7 +4798,7 @@ var LinkedInButton = ({
|
|
|
4798
4798
|
d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"
|
|
4799
4799
|
}
|
|
4800
4800
|
) }),
|
|
4801
|
-
children: children ?? t("elements.buttons.linkedin")
|
|
4801
|
+
children: children ?? t("elements.buttons.linkedin.text")
|
|
4802
4802
|
}
|
|
4803
4803
|
);
|
|
4804
4804
|
};
|
|
@@ -4829,13 +4829,13 @@ var SignInWithEthereumButton = ({
|
|
|
4829
4829
|
d: "M11.944 17.97L4.58 13.62 11.943 24l7.37-10.38-7.372 4.35h.003zM12.056 0L4.69 12.223l7.365 4.354 7.365-4.35L12.056 0z"
|
|
4830
4830
|
}
|
|
4831
4831
|
) }),
|
|
4832
|
-
children: children ?? t("elements.buttons.ethereum")
|
|
4832
|
+
children: children ?? t("elements.buttons.ethereum.text")
|
|
4833
4833
|
}
|
|
4834
4834
|
);
|
|
4835
4835
|
};
|
|
4836
4836
|
var SignInWithEthereumButton_default = SignInWithEthereumButton;
|
|
4837
4837
|
|
|
4838
|
-
// src/components/presentation/SignIn/
|
|
4838
|
+
// src/components/presentation/auth/SignIn/v1/options/EmailOtp.tsx
|
|
4839
4839
|
import { EmbeddedSignInFlowAuthenticatorParamType as EmbeddedSignInFlowAuthenticatorParamType3, FieldType as FieldType4 } from "@asgardeo/browser";
|
|
4840
4840
|
import { useEffect as useEffect9 } from "react";
|
|
4841
4841
|
import { Fragment as Fragment9, jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -4855,8 +4855,8 @@ var EmailOtp = ({
|
|
|
4855
4855
|
const { setTitle, setSubtitle } = useFlow_default();
|
|
4856
4856
|
const formFields = authenticator.metadata?.params?.sort((a, b) => a.order - b.order) || [];
|
|
4857
4857
|
useEffect9(() => {
|
|
4858
|
-
setTitle(t("email.otp.
|
|
4859
|
-
setSubtitle(t("email.otp.
|
|
4858
|
+
setTitle(t("email.otp.heading"));
|
|
4859
|
+
setSubtitle(t("email.otp.subheading"));
|
|
4860
4860
|
}, [setTitle, setSubtitle, t]);
|
|
4861
4861
|
const hasOtpField = formFields.some(
|
|
4862
4862
|
(param) => param.param.toLowerCase().includes("otp") || param.param.toLowerCase().includes("code")
|
|
@@ -4896,14 +4896,14 @@ var EmailOtp = ({
|
|
|
4896
4896
|
loading: isLoading,
|
|
4897
4897
|
className: buttonClassName,
|
|
4898
4898
|
style: { marginBottom: `calc(${theme.vars.spacing.unit} * 2)` },
|
|
4899
|
-
children: t("email.otp.submit.
|
|
4899
|
+
children: t("email.otp.buttons.submit.text")
|
|
4900
4900
|
}
|
|
4901
4901
|
)
|
|
4902
4902
|
] });
|
|
4903
4903
|
};
|
|
4904
4904
|
var EmailOtp_default = EmailOtp;
|
|
4905
4905
|
|
|
4906
|
-
// src/components/presentation/SignIn/
|
|
4906
|
+
// src/components/presentation/auth/SignIn/v1/options/Totp.tsx
|
|
4907
4907
|
import { EmbeddedSignInFlowAuthenticatorParamType as EmbeddedSignInFlowAuthenticatorParamType4, FieldType as FieldType5 } from "@asgardeo/browser";
|
|
4908
4908
|
import { useEffect as useEffect10 } from "react";
|
|
4909
4909
|
import { Fragment as Fragment10, jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -4923,8 +4923,8 @@ var Totp = ({
|
|
|
4923
4923
|
const { setTitle, setSubtitle } = useFlow_default();
|
|
4924
4924
|
const formFields = authenticator.metadata?.params?.sort((a, b) => a.order - b.order) || [];
|
|
4925
4925
|
useEffect10(() => {
|
|
4926
|
-
setTitle(t("totp.
|
|
4927
|
-
setSubtitle(t("totp.
|
|
4926
|
+
setTitle(t("totp.heading"));
|
|
4927
|
+
setSubtitle(t("totp.subheading"));
|
|
4928
4928
|
}, [setTitle, setSubtitle, t]);
|
|
4929
4929
|
const hasTotpField = formFields.some(
|
|
4930
4930
|
(param) => param.param.toLowerCase().includes("totp") || param.param.toLowerCase().includes("token")
|
|
@@ -4964,14 +4964,14 @@ var Totp = ({
|
|
|
4964
4964
|
loading: isLoading,
|
|
4965
4965
|
className: buttonClassName,
|
|
4966
4966
|
style: { marginBottom: `calc(${theme.vars.spacing.unit} * 2)` },
|
|
4967
|
-
children: t("totp.submit.
|
|
4967
|
+
children: t("totp.buttons.submit.text")
|
|
4968
4968
|
}
|
|
4969
4969
|
)
|
|
4970
4970
|
] });
|
|
4971
4971
|
};
|
|
4972
4972
|
var Totp_default = Totp;
|
|
4973
4973
|
|
|
4974
|
-
// src/components/presentation/SignIn/
|
|
4974
|
+
// src/components/presentation/auth/SignIn/v1/options/SmsOtp.tsx
|
|
4975
4975
|
import { EmbeddedSignInFlowAuthenticatorParamType as EmbeddedSignInFlowAuthenticatorParamType5, FieldType as FieldType6 } from "@asgardeo/browser";
|
|
4976
4976
|
import { useEffect as useEffect11 } from "react";
|
|
4977
4977
|
import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -4991,8 +4991,8 @@ var SmsOtp = ({
|
|
|
4991
4991
|
const { setTitle, setSubtitle } = useFlow_default();
|
|
4992
4992
|
const formFields = authenticator.metadata?.params?.sort((a, b) => a.order - b.order) || [];
|
|
4993
4993
|
useEffect11(() => {
|
|
4994
|
-
setTitle(t("sms.otp.
|
|
4995
|
-
setSubtitle(t("sms.otp.
|
|
4994
|
+
setTitle(t("sms.otp.heading"));
|
|
4995
|
+
setSubtitle(t("sms.otp.subheading"));
|
|
4996
4996
|
}, [setTitle, setSubtitle, t]);
|
|
4997
4997
|
const hasOtpField = formFields.some(
|
|
4998
4998
|
(param) => param.param.toLowerCase().includes("otp") || param.param.toLowerCase().includes("code")
|
|
@@ -5032,14 +5032,14 @@ var SmsOtp = ({
|
|
|
5032
5032
|
loading: isLoading,
|
|
5033
5033
|
className: buttonClassName,
|
|
5034
5034
|
style: { marginBottom: `calc(${theme.vars.spacing.unit} * 2)` },
|
|
5035
|
-
children: t("sms.otp.submit.
|
|
5035
|
+
children: t("sms.otp.buttons.submit.text")
|
|
5036
5036
|
}
|
|
5037
5037
|
)
|
|
5038
5038
|
] });
|
|
5039
5039
|
};
|
|
5040
5040
|
var SmsOtp_default = SmsOtp;
|
|
5041
5041
|
|
|
5042
|
-
// src/components/presentation/SignIn/
|
|
5042
|
+
// src/components/presentation/auth/SignIn/v1/options/SocialButton.tsx
|
|
5043
5043
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5044
5044
|
var SocialLogin = ({
|
|
5045
5045
|
isLoading,
|
|
@@ -5064,13 +5064,13 @@ var SocialLogin = ({
|
|
|
5064
5064
|
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
5065
5065
|
}
|
|
5066
5066
|
) }),
|
|
5067
|
-
children: t("elements.buttons.social", { connection: children })
|
|
5067
|
+
children: t("elements.buttons.social.text", { connection: children })
|
|
5068
5068
|
}
|
|
5069
5069
|
);
|
|
5070
5070
|
};
|
|
5071
5071
|
var SocialButton_default = SocialLogin;
|
|
5072
5072
|
|
|
5073
|
-
// src/components/presentation/SignIn/
|
|
5073
|
+
// src/components/presentation/auth/SignIn/v1/options/MultiOptionButton.tsx
|
|
5074
5074
|
import { ApplicationNativeAuthenticationConstants, EmbeddedSignInFlowAuthenticatorKnownIdPType } from "@asgardeo/browser";
|
|
5075
5075
|
import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5076
5076
|
var MultiOptionButton = ({
|
|
@@ -5088,7 +5088,7 @@ var MultiOptionButton = ({
|
|
|
5088
5088
|
}
|
|
5089
5089
|
switch (authenticatorName) {
|
|
5090
5090
|
default:
|
|
5091
|
-
return t("elements.buttons.multi.option", { connection: authenticatorName });
|
|
5091
|
+
return t("elements.buttons.multi.option.text", { connection: authenticatorName });
|
|
5092
5092
|
}
|
|
5093
5093
|
};
|
|
5094
5094
|
const getIcon = () => {
|
|
@@ -5167,7 +5167,7 @@ var MultiOptionButton = ({
|
|
|
5167
5167
|
};
|
|
5168
5168
|
var MultiOptionButton_default = MultiOptionButton;
|
|
5169
5169
|
|
|
5170
|
-
// src/components/presentation/SignIn/
|
|
5170
|
+
// src/components/presentation/auth/SignIn/v1/options/SignInOptionFactory.tsx
|
|
5171
5171
|
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
5172
5172
|
var createSignInOption = ({
|
|
5173
5173
|
authenticator,
|
|
@@ -6014,7 +6014,7 @@ var Logo = ({ className, src, alt, title, size = "medium" }) => {
|
|
|
6014
6014
|
};
|
|
6015
6015
|
var Logo_default = Logo;
|
|
6016
6016
|
|
|
6017
|
-
// src/components/presentation/SignIn/BaseSignIn.styles.ts
|
|
6017
|
+
// src/components/presentation/auth/SignIn/BaseSignIn.styles.ts
|
|
6018
6018
|
import { css as css16 } from "@emotion/css";
|
|
6019
6019
|
import { useMemo as useMemo23 } from "react";
|
|
6020
6020
|
var useStyles16 = (theme, colorScheme) => {
|
|
@@ -6156,7 +6156,7 @@ var useStyles16 = (theme, colorScheme) => {
|
|
|
6156
6156
|
};
|
|
6157
6157
|
var BaseSignIn_styles_default = useStyles16;
|
|
6158
6158
|
|
|
6159
|
-
// src/components/presentation/SignIn/
|
|
6159
|
+
// src/components/presentation/auth/SignIn/v1/BaseSignIn.tsx
|
|
6160
6160
|
import { jsx as jsx53, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6161
6161
|
var isPasskeyAuthenticator = (authenticator) => authenticator.authenticatorId === ApplicationNativeAuthenticationConstants3.SupportedAuthenticators.Passkey && authenticator.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.InternalPrompt && authenticator.metadata?.additionalData?.challengeData;
|
|
6162
6162
|
var BaseSignIn = ({ showLogo = true, ...rest }) => {
|
|
@@ -6204,7 +6204,7 @@ var BaseSignInContent = ({
|
|
|
6204
6204
|
initialValue: "",
|
|
6205
6205
|
validator: (value) => {
|
|
6206
6206
|
if (currentAuthenticator.requiredParams.includes(param.param) && (!value || value.trim() === "")) {
|
|
6207
|
-
return t("field.
|
|
6207
|
+
return t("validations.required.field.error");
|
|
6208
6208
|
}
|
|
6209
6209
|
return null;
|
|
6210
6210
|
}
|
|
@@ -6214,7 +6214,7 @@ var BaseSignInContent = ({
|
|
|
6214
6214
|
fields: formFields,
|
|
6215
6215
|
validateOnBlur: true,
|
|
6216
6216
|
validateOnChange: false,
|
|
6217
|
-
requiredMessage: t("field.
|
|
6217
|
+
requiredMessage: t("validations.required.field.error")
|
|
6218
6218
|
});
|
|
6219
6219
|
const {
|
|
6220
6220
|
values: formValues,
|
|
@@ -6380,7 +6380,7 @@ var BaseSignInContent = ({
|
|
|
6380
6380
|
return;
|
|
6381
6381
|
}
|
|
6382
6382
|
if (response?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete) {
|
|
6383
|
-
setError(t("errors.
|
|
6383
|
+
setError(t("errors.signin.flow.completion.failure"));
|
|
6384
6384
|
return;
|
|
6385
6385
|
}
|
|
6386
6386
|
if (handleRedirectionIfNeeded(response)) {
|
|
@@ -6408,7 +6408,7 @@ var BaseSignInContent = ({
|
|
|
6408
6408
|
}
|
|
6409
6409
|
}
|
|
6410
6410
|
} catch (err) {
|
|
6411
|
-
const errorMessage = err instanceof AsgardeoAPIError2 ? err.message : t("errors.
|
|
6411
|
+
const errorMessage = err instanceof AsgardeoAPIError2 ? err.message : t("errors.signin.flow.failure");
|
|
6412
6412
|
setError(errorMessage);
|
|
6413
6413
|
onError?.(err);
|
|
6414
6414
|
} finally {
|
|
@@ -6452,7 +6452,7 @@ var BaseSignInContent = ({
|
|
|
6452
6452
|
return;
|
|
6453
6453
|
}
|
|
6454
6454
|
if (response?.flowStatus === EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === EmbeddedSignInFlowStatus.FailIncomplete) {
|
|
6455
|
-
setError(t("errors.
|
|
6455
|
+
setError(t("errors.signin.flow.passkeys.completion.failure"));
|
|
6456
6456
|
return;
|
|
6457
6457
|
}
|
|
6458
6458
|
if (response && "flowId" in response && "nextStep" in response) {
|
|
@@ -6482,7 +6482,7 @@ var BaseSignInContent = ({
|
|
|
6482
6482
|
}
|
|
6483
6483
|
} catch (passkeyError) {
|
|
6484
6484
|
console.error("Passkey authentication error:", passkeyError);
|
|
6485
|
-
let errorMessage = passkeyError instanceof Error ? passkeyError.message : t("errors.
|
|
6485
|
+
let errorMessage = passkeyError instanceof Error ? passkeyError.message : t("errors.signin.flow.passkeys.failure");
|
|
6486
6486
|
if (passkeyError instanceof Error && passkeyError.message.includes("security")) {
|
|
6487
6487
|
errorMessage += " This may be due to browser security settings, an insecure connection, or device restrictions.";
|
|
6488
6488
|
}
|
|
@@ -6703,7 +6703,7 @@ var BaseSignInContent = ({
|
|
|
6703
6703
|
);
|
|
6704
6704
|
}
|
|
6705
6705
|
} catch (err) {
|
|
6706
|
-
const errorMessage = err instanceof AsgardeoAPIError2 ? err.message : t("errors.
|
|
6706
|
+
const errorMessage = err instanceof AsgardeoAPIError2 ? err.message : t("errors.signin.initialization");
|
|
6707
6707
|
setError(errorMessage);
|
|
6708
6708
|
onError?.(err);
|
|
6709
6709
|
} finally {
|
|
@@ -6714,7 +6714,7 @@ var BaseSignInContent = ({
|
|
|
6714
6714
|
if (!isInitialized && isLoading) {
|
|
6715
6715
|
return /* @__PURE__ */ jsx53(Card_default, { className: cx19(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx53(Card_default.Content, { children: /* @__PURE__ */ jsxs26("div", { className: styles.loadingContainer, children: [
|
|
6716
6716
|
/* @__PURE__ */ jsx53(Spinner_default, { size: "medium" }),
|
|
6717
|
-
/* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.loadingText, children: t("messages.loading") })
|
|
6717
|
+
/* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.loadingText, children: t("messages.loading.placeholder") })
|
|
6718
6718
|
] }) }) });
|
|
6719
6719
|
}
|
|
6720
6720
|
if (hasMultipleOptions() && !currentAuthenticator) {
|
|
@@ -6726,8 +6726,8 @@ var BaseSignInContent = ({
|
|
|
6726
6726
|
const optionAuthenticators = availableAuthenticators.filter((auth) => !userPromptAuthenticators.includes(auth)).filter((authenticator) => !HIDDEN_AUTHENTICATORS.includes(authenticator.authenticatorId));
|
|
6727
6727
|
return /* @__PURE__ */ jsxs26(Card_default, { className: cx19(containerClasses, styles.card), variant, children: [
|
|
6728
6728
|
(showTitle || showSubtitle) && /* @__PURE__ */ jsxs26(Card_default.Header, { className: styles.header, children: [
|
|
6729
|
-
showTitle && /* @__PURE__ */ jsx53(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signin.
|
|
6730
|
-
showSubtitle && /* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signin.
|
|
6729
|
+
showTitle && /* @__PURE__ */ jsx53(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signin.heading") }),
|
|
6730
|
+
showSubtitle && /* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signin.subheading") })
|
|
6731
6731
|
] }),
|
|
6732
6732
|
/* @__PURE__ */ jsxs26(Card_default.Content, { children: [
|
|
6733
6733
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx53("div", { className: styles.flowMessagesContainer, children: flowMessages.map((flowMessage, index) => /* @__PURE__ */ jsx53(
|
|
@@ -6798,7 +6798,7 @@ var BaseSignInContent = ({
|
|
|
6798
6798
|
}
|
|
6799
6799
|
if (!currentAuthenticator) {
|
|
6800
6800
|
return /* @__PURE__ */ jsx53(Card_default, { className: cx19(containerClasses, styles.noAuthenticatorCard), variant, children: /* @__PURE__ */ jsx53(Card_default.Content, { children: error && /* @__PURE__ */ jsxs26(Alert_default, { variant: "error", className: styles.errorAlert, children: [
|
|
6801
|
-
/* @__PURE__ */ jsx53(Alert_default.Title, { children: t("errors.
|
|
6801
|
+
/* @__PURE__ */ jsx53(Alert_default.Title, { children: t("errors.heading") || "Error" }),
|
|
6802
6802
|
/* @__PURE__ */ jsx53(Alert_default.Description, { children: error })
|
|
6803
6803
|
] }) }) });
|
|
6804
6804
|
}
|
|
@@ -6814,8 +6814,8 @@ var BaseSignInContent = ({
|
|
|
6814
6814
|
}
|
|
6815
6815
|
return /* @__PURE__ */ jsxs26(Card_default, { className: cx19(containerClasses, styles.card), variant, children: [
|
|
6816
6816
|
/* @__PURE__ */ jsxs26(Card_default.Header, { className: styles.header, children: [
|
|
6817
|
-
/* @__PURE__ */ jsx53(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signin.
|
|
6818
|
-
/* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signin.
|
|
6817
|
+
/* @__PURE__ */ jsx53(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signin.heading") }),
|
|
6818
|
+
/* @__PURE__ */ jsx53(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signin.subheading") }),
|
|
6819
6819
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx53("div", { className: styles.flowMessagesContainer, children: flowMessages.map((flowMessage, index) => /* @__PURE__ */ jsx53(
|
|
6820
6820
|
Alert_default,
|
|
6821
6821
|
{
|
|
@@ -6832,7 +6832,7 @@ var BaseSignInContent = ({
|
|
|
6832
6832
|
] }),
|
|
6833
6833
|
/* @__PURE__ */ jsxs26(Card_default.Content, { children: [
|
|
6834
6834
|
error && /* @__PURE__ */ jsxs26(Alert_default, { variant: "error", className: cx19(styles.errorContainer, errorClasses), children: [
|
|
6835
|
-
/* @__PURE__ */ jsx53(Alert_default.Title, { children: t("errors.
|
|
6835
|
+
/* @__PURE__ */ jsx53(Alert_default.Title, { children: t("errors.heading") }),
|
|
6836
6836
|
/* @__PURE__ */ jsx53(Alert_default.Description, { children: error })
|
|
6837
6837
|
] }),
|
|
6838
6838
|
/* @__PURE__ */ jsx53(
|
|
@@ -6867,19 +6867,29 @@ var BaseSignInContent = ({
|
|
|
6867
6867
|
};
|
|
6868
6868
|
var BaseSignIn_default = BaseSignIn;
|
|
6869
6869
|
|
|
6870
|
-
// src/components/presentation/SignIn/
|
|
6870
|
+
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
6871
6871
|
import { useState as useState15, useCallback as useCallback10 } from "react";
|
|
6872
6872
|
import { cx as cx20 } from "@emotion/css";
|
|
6873
|
-
import {
|
|
6873
|
+
import {
|
|
6874
|
+
withVendorCSSClassPrefix as withVendorCSSClassPrefix20
|
|
6875
|
+
} from "@asgardeo/browser";
|
|
6874
6876
|
|
|
6875
|
-
// src/components/presentation/
|
|
6877
|
+
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
6876
6878
|
import React from "react";
|
|
6877
|
-
import {
|
|
6878
|
-
|
|
6879
|
+
import {
|
|
6880
|
+
AsgardeoRuntimeError as AsgardeoRuntimeError7,
|
|
6881
|
+
FieldType as FieldType7,
|
|
6882
|
+
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType
|
|
6883
|
+
} from "@asgardeo/browser";
|
|
6879
6884
|
|
|
6880
6885
|
// src/components/adapters/SmsOtpButton.tsx
|
|
6881
6886
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
6882
|
-
var SmsOtpButton = ({
|
|
6887
|
+
var SmsOtpButton = ({
|
|
6888
|
+
isLoading,
|
|
6889
|
+
preferences,
|
|
6890
|
+
children,
|
|
6891
|
+
...rest
|
|
6892
|
+
}) => {
|
|
6883
6893
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
6884
6894
|
return /* @__PURE__ */ jsx54(
|
|
6885
6895
|
Button_default,
|
|
@@ -6897,51 +6907,71 @@ var SmsOtpButton = ({ isLoading, preferences, children, ...rest }) => {
|
|
|
6897
6907
|
d: "M20 15.5c-1.25 0-2.45-.2-3.57-.57a1.02 1.02 0 0 0-1.02.24l-2.2 2.2a15.074 15.074 0 0 1-6.59-6.59l2.2-2.2c.27-.27.35-.67.24-1.02A11.36 11.36 0 0 1 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M12 3v10l3-3h6V3z"
|
|
6898
6908
|
}
|
|
6899
6909
|
) }),
|
|
6900
|
-
children: children ?? t("elements.buttons.smsotp")
|
|
6910
|
+
children: children ?? t("elements.buttons.smsotp.text")
|
|
6901
6911
|
}
|
|
6902
6912
|
);
|
|
6903
6913
|
};
|
|
6904
6914
|
var SmsOtpButton_default = SmsOtpButton;
|
|
6905
6915
|
|
|
6906
|
-
// src/components/presentation/
|
|
6916
|
+
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
6907
6917
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
6908
6918
|
var getFieldType = (variant) => {
|
|
6909
6919
|
switch (variant) {
|
|
6910
|
-
case
|
|
6920
|
+
case EmbeddedFlowComponentType.EmailInput:
|
|
6911
6921
|
return FieldType7.Email;
|
|
6912
|
-
case
|
|
6922
|
+
case EmbeddedFlowComponentType.PasswordInput:
|
|
6913
6923
|
return FieldType7.Password;
|
|
6914
|
-
case
|
|
6924
|
+
case EmbeddedFlowComponentType.TextInput:
|
|
6915
6925
|
default:
|
|
6916
6926
|
return FieldType7.Text;
|
|
6917
6927
|
}
|
|
6918
6928
|
};
|
|
6919
6929
|
var getTypographyVariant = (variant) => {
|
|
6920
6930
|
const variantMap = {
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6931
|
+
HEADING_1: "h1",
|
|
6932
|
+
HEADING_2: "h2",
|
|
6933
|
+
HEADING_3: "h3",
|
|
6934
|
+
HEADING_4: "h4",
|
|
6935
|
+
HEADING_5: "h5",
|
|
6936
|
+
HEADING_6: "h6",
|
|
6937
|
+
SUBTITLE_1: "subtitle1",
|
|
6938
|
+
SUBTITLE_2: "subtitle2",
|
|
6939
|
+
BODY_1: "body1",
|
|
6940
|
+
BODY_2: "body2",
|
|
6941
|
+
CAPTION: "caption",
|
|
6942
|
+
OVERLINE: "overline",
|
|
6943
|
+
BUTTON_TEXT: "button"
|
|
6927
6944
|
};
|
|
6928
6945
|
return variantMap[variant] || "h3";
|
|
6929
6946
|
};
|
|
6930
|
-
var
|
|
6947
|
+
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType) => {
|
|
6948
|
+
const providerId = `${provider}_auth`;
|
|
6949
|
+
const providerMatches = actionId === providerId || eventType === providerId;
|
|
6950
|
+
if (authType === "signup") {
|
|
6951
|
+
return providerMatches || buttonText.toLowerCase().includes(provider);
|
|
6952
|
+
}
|
|
6953
|
+
return providerMatches;
|
|
6954
|
+
};
|
|
6955
|
+
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
6931
6956
|
const key = options.key || component.id;
|
|
6957
|
+
if (authType === "signin") {
|
|
6958
|
+
console.log("Creating sign-in component for:", component);
|
|
6959
|
+
}
|
|
6932
6960
|
switch (component.type) {
|
|
6933
|
-
case EmbeddedFlowComponentType.
|
|
6934
|
-
|
|
6961
|
+
case EmbeddedFlowComponentType.TextInput:
|
|
6962
|
+
case EmbeddedFlowComponentType.PasswordInput:
|
|
6963
|
+
case EmbeddedFlowComponentType.EmailInput: {
|
|
6964
|
+
const identifier = component.ref;
|
|
6935
6965
|
const value = formValues[identifier] || "";
|
|
6936
6966
|
const isTouched = touchedFields[identifier] || false;
|
|
6937
6967
|
const error = isTouched ? formErrors[identifier] : void 0;
|
|
6938
|
-
const fieldType = getFieldType(component.
|
|
6968
|
+
const fieldType = getFieldType(component.type);
|
|
6939
6969
|
const field = createField({
|
|
6940
6970
|
type: fieldType,
|
|
6941
6971
|
name: identifier,
|
|
6942
|
-
label: component.
|
|
6943
|
-
placeholder: component.
|
|
6944
|
-
required: component.
|
|
6972
|
+
label: component.label || "",
|
|
6973
|
+
placeholder: component.placeholder || "",
|
|
6974
|
+
required: component.required || false,
|
|
6945
6975
|
value,
|
|
6946
6976
|
error,
|
|
6947
6977
|
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
@@ -6950,7 +6980,7 @@ var createSignInComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
6950
6980
|
});
|
|
6951
6981
|
return React.cloneElement(field, { key });
|
|
6952
6982
|
}
|
|
6953
|
-
case EmbeddedFlowComponentType.
|
|
6983
|
+
case EmbeddedFlowComponentType.Action: {
|
|
6954
6984
|
const handleClick = () => {
|
|
6955
6985
|
if (options.onSubmit) {
|
|
6956
6986
|
const formData = {};
|
|
@@ -6962,17 +6992,28 @@ var createSignInComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
6962
6992
|
options.onSubmit(component, formData);
|
|
6963
6993
|
}
|
|
6964
6994
|
};
|
|
6965
|
-
const actionId = component.
|
|
6966
|
-
|
|
6995
|
+
const actionId = component.id;
|
|
6996
|
+
const eventType = component.eventType || "";
|
|
6997
|
+
const buttonText = component.label || "";
|
|
6998
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType)) {
|
|
6967
6999
|
return /* @__PURE__ */ jsx55(GoogleButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
6968
7000
|
}
|
|
6969
|
-
if (actionId
|
|
7001
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType)) {
|
|
6970
7002
|
return /* @__PURE__ */ jsx55(GitHubButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
6971
7003
|
}
|
|
6972
|
-
if (actionId
|
|
7004
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType)) {
|
|
6973
7005
|
return /* @__PURE__ */ jsx55(FacebookButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
6974
7006
|
}
|
|
6975
|
-
if (actionId
|
|
7007
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType)) {
|
|
7008
|
+
return /* @__PURE__ */ jsx55(MicrosoftButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7009
|
+
}
|
|
7010
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType)) {
|
|
7011
|
+
return /* @__PURE__ */ jsx55(LinkedInButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7012
|
+
}
|
|
7013
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType)) {
|
|
7014
|
+
return /* @__PURE__ */ jsx55(SignInWithEthereumButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7015
|
+
}
|
|
7016
|
+
if (actionId === "prompt_mobile" || eventType === "prompt_mobile") {
|
|
6976
7017
|
return /* @__PURE__ */ jsx55(SmsOtpButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
6977
7018
|
}
|
|
6978
7019
|
return /* @__PURE__ */ jsx55(
|
|
@@ -6984,19 +7025,19 @@ var createSignInComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
6984
7025
|
className: options.buttonClassName,
|
|
6985
7026
|
variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline",
|
|
6986
7027
|
color: component.variant?.toLowerCase() === "primary" ? "primary" : "secondary",
|
|
6987
|
-
children:
|
|
7028
|
+
children: buttonText || "Submit"
|
|
6988
7029
|
},
|
|
6989
7030
|
key
|
|
6990
7031
|
);
|
|
6991
7032
|
}
|
|
6992
|
-
case EmbeddedFlowComponentType.
|
|
6993
|
-
const variant = getTypographyVariant(component.variant
|
|
6994
|
-
return /* @__PURE__ */ jsx55(Typography_default, { variant, children: component.
|
|
7033
|
+
case EmbeddedFlowComponentType.Text: {
|
|
7034
|
+
const variant = getTypographyVariant(component.variant);
|
|
7035
|
+
return /* @__PURE__ */ jsx55(Typography_default, { variant, children: component.label || "" }, key);
|
|
6995
7036
|
}
|
|
6996
|
-
case EmbeddedFlowComponentType.
|
|
7037
|
+
case EmbeddedFlowComponentType.Block: {
|
|
6997
7038
|
if (component.components && component.components.length > 0) {
|
|
6998
|
-
const
|
|
6999
|
-
(childComponent, index) =>
|
|
7039
|
+
const blockComponents = component.components.map(
|
|
7040
|
+
(childComponent, index) => createAuthComponentFromFlow(
|
|
7000
7041
|
childComponent,
|
|
7001
7042
|
formValues,
|
|
7002
7043
|
touchedFields,
|
|
@@ -7004,30 +7045,44 @@ var createSignInComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7004
7045
|
isLoading,
|
|
7005
7046
|
isFormValid,
|
|
7006
7047
|
onInputChange,
|
|
7048
|
+
authType,
|
|
7007
7049
|
{
|
|
7008
7050
|
...options,
|
|
7009
7051
|
key: childComponent.id || `${component.id}_${index}`
|
|
7010
7052
|
}
|
|
7011
7053
|
)
|
|
7012
7054
|
).filter(Boolean);
|
|
7013
|
-
return /* @__PURE__ */ jsx55("
|
|
7055
|
+
return /* @__PURE__ */ jsx55("div", { children: blockComponents }, key);
|
|
7014
7056
|
}
|
|
7015
7057
|
return null;
|
|
7016
7058
|
}
|
|
7017
|
-
case EmbeddedFlowComponentType.Divider: {
|
|
7018
|
-
return /* @__PURE__ */ jsx55(Divider_default, {}, key);
|
|
7019
|
-
}
|
|
7020
7059
|
default:
|
|
7021
7060
|
throw new AsgardeoRuntimeError7(
|
|
7022
7061
|
`Unsupported component type: ${component.type}`,
|
|
7023
|
-
"SignIn-UnsupportedComponentType-001
|
|
7062
|
+
`${authType === "signin" ? "SignIn" : "SignUp"}-UnsupportedComponentType-001`,
|
|
7024
7063
|
"react",
|
|
7025
|
-
|
|
7064
|
+
`Something went wrong while rendering the ${authType} component. Please try again later.`
|
|
7026
7065
|
);
|
|
7027
7066
|
}
|
|
7028
7067
|
};
|
|
7029
7068
|
var renderSignInComponents = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => components.map(
|
|
7030
|
-
(component, index) =>
|
|
7069
|
+
(component, index) => createAuthComponentFromFlow(
|
|
7070
|
+
component,
|
|
7071
|
+
formValues,
|
|
7072
|
+
touchedFields,
|
|
7073
|
+
formErrors,
|
|
7074
|
+
isLoading,
|
|
7075
|
+
isFormValid,
|
|
7076
|
+
onInputChange,
|
|
7077
|
+
"signin",
|
|
7078
|
+
{
|
|
7079
|
+
...options,
|
|
7080
|
+
key: component.id || index
|
|
7081
|
+
}
|
|
7082
|
+
)
|
|
7083
|
+
).filter(Boolean);
|
|
7084
|
+
var renderSignUpComponents = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => components.map(
|
|
7085
|
+
(component, index) => createAuthComponentFromFlow(
|
|
7031
7086
|
component,
|
|
7032
7087
|
formValues,
|
|
7033
7088
|
touchedFields,
|
|
@@ -7035,6 +7090,7 @@ var renderSignInComponents = (components, formValues, touchedFields, formErrors,
|
|
|
7035
7090
|
isLoading,
|
|
7036
7091
|
isFormValid,
|
|
7037
7092
|
onInputChange,
|
|
7093
|
+
"signup",
|
|
7038
7094
|
{
|
|
7039
7095
|
...options,
|
|
7040
7096
|
key: component.id || index
|
|
@@ -7042,169 +7098,160 @@ var renderSignInComponents = (components, formValues, touchedFields, formErrors,
|
|
|
7042
7098
|
)
|
|
7043
7099
|
).filter(Boolean);
|
|
7044
7100
|
|
|
7045
|
-
// src/
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
var generateId = (prefix) => {
|
|
7050
|
-
const suffix = Math.random().toString(36).substring(2, 6);
|
|
7051
|
-
return `${prefix}_${suffix}`;
|
|
7052
|
-
};
|
|
7053
|
-
var getInputVariant = (type, name) => {
|
|
7054
|
-
switch (type.toLowerCase()) {
|
|
7055
|
-
case "email":
|
|
7056
|
-
return "EMAIL";
|
|
7057
|
-
case "password":
|
|
7058
|
-
return "PASSWORD";
|
|
7059
|
-
default:
|
|
7060
|
-
return "TEXT";
|
|
7101
|
+
// src/utils/v2/resolveTranslation.ts
|
|
7102
|
+
var isTranslationString = (text) => {
|
|
7103
|
+
if (!text || typeof text !== "string") {
|
|
7104
|
+
return false;
|
|
7061
7105
|
}
|
|
7106
|
+
const trimmed = text.trim();
|
|
7107
|
+
return trimmed.startsWith("{{") && trimmed.endsWith("}}");
|
|
7062
7108
|
};
|
|
7063
|
-
var
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7109
|
+
var extractTranslationKey = (text) => {
|
|
7110
|
+
if (!isTranslationString(text)) {
|
|
7111
|
+
return null;
|
|
7112
|
+
}
|
|
7113
|
+
const content = text.trim().slice(2, -2).trim();
|
|
7114
|
+
const tFunctionMatch = content.match(/^t\((.+)\)$/);
|
|
7115
|
+
if (!tFunctionMatch) {
|
|
7116
|
+
return null;
|
|
7068
7117
|
}
|
|
7069
|
-
|
|
7118
|
+
let key = tFunctionMatch[1].trim();
|
|
7119
|
+
if (key.startsWith('"') && key.endsWith('"') || key.startsWith("'") && key.endsWith("'")) {
|
|
7120
|
+
key = key.slice(1, -1);
|
|
7121
|
+
}
|
|
7122
|
+
const transformedKey = key.replace(/:/g, ".");
|
|
7123
|
+
return transformedKey;
|
|
7070
7124
|
};
|
|
7071
|
-
var
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7125
|
+
var resolveTranslation = (text, t) => {
|
|
7126
|
+
if (!text) {
|
|
7127
|
+
return "";
|
|
7128
|
+
}
|
|
7129
|
+
const translationKey = extractTranslationKey(text);
|
|
7130
|
+
if (translationKey) {
|
|
7131
|
+
return t(translationKey);
|
|
7076
7132
|
}
|
|
7077
|
-
return
|
|
7133
|
+
return text;
|
|
7078
7134
|
};
|
|
7079
|
-
var
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7135
|
+
var resolveTranslation_default = resolveTranslation;
|
|
7136
|
+
|
|
7137
|
+
// src/utils/v2/resolveTranslationsInObject.ts
|
|
7138
|
+
var resolveTranslationsInObject = (obj, t, properties = ["label", "placeholder", "text", "title", "subtitle"]) => {
|
|
7139
|
+
const resolved = { ...obj };
|
|
7140
|
+
for (const prop of properties) {
|
|
7141
|
+
if (resolved[prop] && typeof resolved[prop] === "string") {
|
|
7142
|
+
resolved[prop] = resolveTranslation_default(resolved[prop], t);
|
|
7143
|
+
}
|
|
7083
7144
|
}
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7145
|
+
return resolved;
|
|
7146
|
+
};
|
|
7147
|
+
var resolveTranslationsInObject_default = resolveTranslationsInObject;
|
|
7148
|
+
|
|
7149
|
+
// src/utils/v2/resolveTranslationsInArray.ts
|
|
7150
|
+
var resolveTranslationsInArray = (items, t, properties) => {
|
|
7151
|
+
return items.map((item) => {
|
|
7152
|
+
const resolved = resolveTranslationsInObject_default(item, t, properties);
|
|
7153
|
+
if (resolved["components"] && Array.isArray(resolved["components"])) {
|
|
7154
|
+
resolved["components"] = resolveTranslationsInArray(resolved["components"], t, properties);
|
|
7155
|
+
}
|
|
7156
|
+
return resolved;
|
|
7157
|
+
});
|
|
7158
|
+
};
|
|
7159
|
+
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7160
|
+
|
|
7161
|
+
// src/utils/v2/flowTransformer.ts
|
|
7162
|
+
var transformComponents = (response, t) => {
|
|
7163
|
+
if (!response?.data?.meta?.components) {
|
|
7164
|
+
return [];
|
|
7102
7165
|
}
|
|
7103
|
-
const
|
|
7104
|
-
|
|
7105
|
-
const placeholder = getInputPlaceholder(input.name, fieldType, t);
|
|
7106
|
-
return {
|
|
7107
|
-
id: generateId("input"),
|
|
7108
|
-
type: EmbeddedFlowComponentType2.Input,
|
|
7109
|
-
variant,
|
|
7110
|
-
config: {
|
|
7111
|
-
type: fieldType,
|
|
7112
|
-
label,
|
|
7113
|
-
placeholder,
|
|
7114
|
-
required: input.required,
|
|
7115
|
-
identifier: input.name,
|
|
7116
|
-
hint: ""
|
|
7117
|
-
},
|
|
7118
|
-
components: []
|
|
7119
|
-
};
|
|
7166
|
+
const components = response.data.meta.components;
|
|
7167
|
+
return resolveTranslationsInArray_default(components, t);
|
|
7120
7168
|
};
|
|
7121
|
-
var
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
let text = t(i18nKey);
|
|
7125
|
-
if (!text || text === i18nKey) {
|
|
7126
|
-
text = action.id.replace(/_/g, " ");
|
|
7127
|
-
text = text.charAt(0).toUpperCase() + text.slice(1);
|
|
7169
|
+
var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") => {
|
|
7170
|
+
if (error && typeof error === "object" && error.failureReason) {
|
|
7171
|
+
return error.failureReason;
|
|
7128
7172
|
}
|
|
7129
|
-
return
|
|
7130
|
-
id: generateId("action"),
|
|
7131
|
-
type: EmbeddedFlowComponentType2.Button,
|
|
7132
|
-
variant: "SECONDARY",
|
|
7133
|
-
config: {
|
|
7134
|
-
type: "button",
|
|
7135
|
-
text,
|
|
7136
|
-
actionId: action.id,
|
|
7137
|
-
actionType: action.type
|
|
7138
|
-
},
|
|
7139
|
-
components: []
|
|
7140
|
-
};
|
|
7173
|
+
return t(defaultErrorKey);
|
|
7141
7174
|
};
|
|
7142
|
-
var
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
const submitButton = inputComponents.length > 0 ? {
|
|
7146
|
-
id: generateId("button"),
|
|
7147
|
-
type: EmbeddedFlowComponentType2.Button,
|
|
7148
|
-
variant: "PRIMARY",
|
|
7149
|
-
config: {
|
|
7150
|
-
type: "submit",
|
|
7151
|
-
text: t("elements.buttons.signUp")
|
|
7152
|
-
},
|
|
7153
|
-
components: []
|
|
7154
|
-
} : null;
|
|
7155
|
-
const formComponents = [];
|
|
7156
|
-
if (inputComponents.length > 0) {
|
|
7157
|
-
formComponents.push(...inputComponents);
|
|
7158
|
-
if (submitButton) formComponents.push(submitButton);
|
|
7159
|
-
}
|
|
7160
|
-
const result = [];
|
|
7161
|
-
if (formComponents.length > 0) {
|
|
7162
|
-
result.push({
|
|
7163
|
-
id: generateId("form"),
|
|
7164
|
-
type: EmbeddedFlowComponentType2.Form,
|
|
7165
|
-
config: {},
|
|
7166
|
-
components: formComponents
|
|
7167
|
-
});
|
|
7175
|
+
var checkForErrorResponse = (response, t, defaultErrorKey = "errors.flow.generic") => {
|
|
7176
|
+
if (response?.flowStatus === "ERROR") {
|
|
7177
|
+
return extractErrorMessage(response, t, defaultErrorKey);
|
|
7168
7178
|
}
|
|
7169
|
-
|
|
7170
|
-
|
|
7179
|
+
return null;
|
|
7180
|
+
};
|
|
7181
|
+
var normalizeFlowResponse = (response, t, options = {}) => {
|
|
7182
|
+
const { throwOnError = true, defaultErrorKey = "errors.flow.generic" } = options;
|
|
7183
|
+
const errorMessage = checkForErrorResponse(response, t, defaultErrorKey);
|
|
7184
|
+
if (errorMessage && throwOnError) {
|
|
7185
|
+
throw response;
|
|
7171
7186
|
}
|
|
7172
|
-
return
|
|
7187
|
+
return {
|
|
7188
|
+
flowId: response.flowId,
|
|
7189
|
+
components: transformComponents(response, t)
|
|
7190
|
+
};
|
|
7173
7191
|
};
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
errorMessage = errorResponse.failureReason;
|
|
7188
|
-
} else if (errorResponse.description) {
|
|
7189
|
-
errorMessage = errorResponse.description;
|
|
7190
|
-
} else if (errorResponse.message) {
|
|
7191
|
-
errorMessage = errorResponse.message;
|
|
7192
|
-
} else {
|
|
7193
|
-
errorMessage = error.message;
|
|
7192
|
+
|
|
7193
|
+
// src/utils/v2/getAuthComponentHeadings.ts
|
|
7194
|
+
var getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTitle, defaultSubtitle) => {
|
|
7195
|
+
let heading = null;
|
|
7196
|
+
let subheading = null;
|
|
7197
|
+
const findHeadings = (comps) => {
|
|
7198
|
+
for (const component of comps) {
|
|
7199
|
+
if (component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
7200
|
+
if (!heading) {
|
|
7201
|
+
heading = component;
|
|
7202
|
+
} else if (!subheading) {
|
|
7203
|
+
subheading = component;
|
|
7204
|
+
break;
|
|
7194
7205
|
}
|
|
7195
|
-
} catch {
|
|
7196
|
-
errorMessage = error.message;
|
|
7197
7206
|
}
|
|
7198
|
-
|
|
7199
|
-
|
|
7207
|
+
if (component.components && component.components.length > 0) {
|
|
7208
|
+
findHeadings(component.components);
|
|
7209
|
+
if (heading && subheading) break;
|
|
7210
|
+
}
|
|
7200
7211
|
}
|
|
7201
|
-
}
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7212
|
+
};
|
|
7213
|
+
const filterComponents = (comps) => {
|
|
7214
|
+
let foundHeadings = 0;
|
|
7215
|
+
const maxHeadings = 2;
|
|
7216
|
+
const filter = (components2) => {
|
|
7217
|
+
return components2.reduce((acc, component) => {
|
|
7218
|
+
if (foundHeadings < maxHeadings && component.type === "TEXT" && component.variant && component.variant.startsWith("HEADING_")) {
|
|
7219
|
+
foundHeadings++;
|
|
7220
|
+
return acc;
|
|
7221
|
+
}
|
|
7222
|
+
if (component.components && component.components.length > 0) {
|
|
7223
|
+
const filteredNestedComponents = filter(component.components);
|
|
7224
|
+
if (filteredNestedComponents.length > 0) {
|
|
7225
|
+
acc.push({
|
|
7226
|
+
...component,
|
|
7227
|
+
components: filteredNestedComponents
|
|
7228
|
+
});
|
|
7229
|
+
}
|
|
7230
|
+
} else {
|
|
7231
|
+
acc.push(component);
|
|
7232
|
+
}
|
|
7233
|
+
return acc;
|
|
7234
|
+
}, []);
|
|
7235
|
+
};
|
|
7236
|
+
return filter(comps);
|
|
7237
|
+
};
|
|
7238
|
+
const getComponentText = (component) => {
|
|
7239
|
+
if (!component) return "";
|
|
7240
|
+
return component.label || "";
|
|
7241
|
+
};
|
|
7242
|
+
findHeadings(components);
|
|
7243
|
+
const headingText = getComponentText(heading);
|
|
7244
|
+
const subheadingText = getComponentText(subheading);
|
|
7245
|
+
return {
|
|
7246
|
+
title: flowTitle || headingText || defaultTitle || "",
|
|
7247
|
+
subtitle: flowSubtitle || subheadingText || defaultSubtitle || "",
|
|
7248
|
+
componentsWithoutHeadings: filterComponents(components),
|
|
7249
|
+
headingComponents: { heading, subheading }
|
|
7250
|
+
};
|
|
7205
7251
|
};
|
|
7252
|
+
var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
7206
7253
|
|
|
7207
|
-
// src/components/presentation/SignIn/
|
|
7254
|
+
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
7208
7255
|
import { jsx as jsx56, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7209
7256
|
var BaseSignIn2 = ({ showLogo = true, ...rest }) => {
|
|
7210
7257
|
const { theme } = useTheme_default();
|
|
@@ -7253,15 +7300,15 @@ var BaseSignInContent2 = ({
|
|
|
7253
7300
|
const fields = [];
|
|
7254
7301
|
const processComponents = (comps) => {
|
|
7255
7302
|
comps.forEach((component) => {
|
|
7256
|
-
if (component.type === "
|
|
7257
|
-
const identifier = component.
|
|
7303
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT") {
|
|
7304
|
+
const identifier = component.ref;
|
|
7258
7305
|
fields.push({
|
|
7259
7306
|
name: identifier,
|
|
7260
|
-
required: component.
|
|
7307
|
+
required: component.required || false,
|
|
7261
7308
|
initialValue: "",
|
|
7262
7309
|
validator: (value) => {
|
|
7263
|
-
if (component.
|
|
7264
|
-
return t("field.
|
|
7310
|
+
if (component.required && (!value || value.trim() === "")) {
|
|
7311
|
+
return t("validations.required.field.error");
|
|
7265
7312
|
}
|
|
7266
7313
|
return null;
|
|
7267
7314
|
}
|
|
@@ -7283,7 +7330,7 @@ var BaseSignInContent2 = ({
|
|
|
7283
7330
|
fields: formFields,
|
|
7284
7331
|
validateOnBlur: true,
|
|
7285
7332
|
validateOnChange: false,
|
|
7286
|
-
requiredMessage: t("field.
|
|
7333
|
+
requiredMessage: t("validations.required.field.error")
|
|
7287
7334
|
});
|
|
7288
7335
|
const {
|
|
7289
7336
|
values: formValues,
|
|
@@ -7309,6 +7356,7 @@ var BaseSignInContent2 = ({
|
|
|
7309
7356
|
}
|
|
7310
7357
|
setIsSubmitting(true);
|
|
7311
7358
|
clearMessages();
|
|
7359
|
+
console.log("Submitting component:", component, "with data:", data);
|
|
7312
7360
|
try {
|
|
7313
7361
|
const filteredInputs = {};
|
|
7314
7362
|
if (data) {
|
|
@@ -7319,17 +7367,11 @@ var BaseSignInContent2 = ({
|
|
|
7319
7367
|
});
|
|
7320
7368
|
}
|
|
7321
7369
|
let payload = {};
|
|
7322
|
-
|
|
7323
|
-
payload
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
} else {
|
|
7328
|
-
payload = {
|
|
7329
|
-
...payload,
|
|
7330
|
-
inputs: filteredInputs
|
|
7331
|
-
};
|
|
7332
|
-
}
|
|
7370
|
+
payload = {
|
|
7371
|
+
...payload,
|
|
7372
|
+
...component.id && { action: component.id },
|
|
7373
|
+
inputs: filteredInputs
|
|
7374
|
+
};
|
|
7333
7375
|
await onSubmit?.(payload, component);
|
|
7334
7376
|
} catch (err) {
|
|
7335
7377
|
handleError(err);
|
|
@@ -7407,8 +7449,8 @@ var BaseSignInContent2 = ({
|
|
|
7407
7449
|
handleInputChange,
|
|
7408
7450
|
handleSubmit,
|
|
7409
7451
|
validateForm,
|
|
7410
|
-
title: flowTitle || t("signin.
|
|
7411
|
-
subtitle: flowSubtitle || t("signin.
|
|
7452
|
+
title: flowTitle || t("signin.heading"),
|
|
7453
|
+
subtitle: flowSubtitle || t("signin.subheading"),
|
|
7412
7454
|
messages: flowMessages || []
|
|
7413
7455
|
};
|
|
7414
7456
|
return /* @__PURE__ */ jsx56("div", { className: containerClasses, children: children(renderProps) });
|
|
@@ -7417,12 +7459,19 @@ var BaseSignInContent2 = ({
|
|
|
7417
7459
|
return /* @__PURE__ */ jsx56(Card_default, { className: cx20(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx56(Card_default.Content, { children: /* @__PURE__ */ jsx56("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ jsx56(Spinner_default, {}) }) }) });
|
|
7418
7460
|
}
|
|
7419
7461
|
if (!components || components.length === 0) {
|
|
7420
|
-
return /* @__PURE__ */ jsx56(Card_default, { className: cx20(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx56(Card_default.Content, { children: /* @__PURE__ */ jsx56(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", children: t("errors.
|
|
7421
|
-
}
|
|
7462
|
+
return /* @__PURE__ */ jsx56(Card_default, { className: cx20(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx56(Card_default.Content, { children: /* @__PURE__ */ jsx56(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", children: t("errors.signin.components.not.available") }) }) }) });
|
|
7463
|
+
}
|
|
7464
|
+
const { title, subtitle, componentsWithoutHeadings } = getAuthComponentHeadings_default(
|
|
7465
|
+
components,
|
|
7466
|
+
flowTitle,
|
|
7467
|
+
flowSubtitle,
|
|
7468
|
+
t("signin.heading"),
|
|
7469
|
+
t("signin.subheading")
|
|
7470
|
+
);
|
|
7422
7471
|
return /* @__PURE__ */ jsxs27(Card_default, { className: cx20(containerClasses, styles.card), variant, children: [
|
|
7423
7472
|
(showTitle || showSubtitle) && /* @__PURE__ */ jsxs27(Card_default.Header, { className: styles.header, children: [
|
|
7424
|
-
showTitle && /* @__PURE__ */ jsx56(Card_default.Title, { level: 2, className: styles.title, children:
|
|
7425
|
-
showSubtitle && /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", className: styles.subtitle, children:
|
|
7473
|
+
showTitle && /* @__PURE__ */ jsx56(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
7474
|
+
showSubtitle && /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
7426
7475
|
] }),
|
|
7427
7476
|
/* @__PURE__ */ jsxs27(Card_default.Content, { children: [
|
|
7428
7477
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx56("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx56(
|
|
@@ -7434,13 +7483,13 @@ var BaseSignInContent2 = ({
|
|
|
7434
7483
|
},
|
|
7435
7484
|
index
|
|
7436
7485
|
)) }),
|
|
7437
|
-
/* @__PURE__ */ jsx56("div", { className: styles.contentContainer, children:
|
|
7486
|
+
/* @__PURE__ */ jsx56("div", { className: styles.contentContainer, children: componentsWithoutHeadings && renderComponents(componentsWithoutHeadings) })
|
|
7438
7487
|
] })
|
|
7439
7488
|
] });
|
|
7440
7489
|
};
|
|
7441
7490
|
var BaseSignIn_default2 = BaseSignIn2;
|
|
7442
7491
|
|
|
7443
|
-
// src/components/presentation/SignIn/BaseSignIn.tsx
|
|
7492
|
+
// src/components/presentation/auth/SignIn/BaseSignIn.tsx
|
|
7444
7493
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
7445
7494
|
var BaseSignIn3 = (props) => {
|
|
7446
7495
|
const { platform } = useAsgardeo_default();
|
|
@@ -7451,12 +7500,12 @@ var BaseSignIn3 = (props) => {
|
|
|
7451
7500
|
};
|
|
7452
7501
|
var BaseSignIn_default3 = BaseSignIn3;
|
|
7453
7502
|
|
|
7454
|
-
// src/components/presentation/SignIn/SignIn.tsx
|
|
7503
|
+
// src/components/presentation/auth/SignIn/SignIn.tsx
|
|
7455
7504
|
import {
|
|
7456
7505
|
Platform as Platform4
|
|
7457
7506
|
} from "@asgardeo/browser";
|
|
7458
7507
|
|
|
7459
|
-
// src/components/presentation/SignIn/
|
|
7508
|
+
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
7460
7509
|
import { useState as useState16, useEffect as useEffect13, useRef as useRef4 } from "react";
|
|
7461
7510
|
import {
|
|
7462
7511
|
AsgardeoRuntimeError as AsgardeoRuntimeError8,
|
|
@@ -7464,123 +7513,6 @@ import {
|
|
|
7464
7513
|
EmbeddedSignInFlowStatusV2,
|
|
7465
7514
|
EmbeddedSignInFlowTypeV2
|
|
7466
7515
|
} from "@asgardeo/browser";
|
|
7467
|
-
|
|
7468
|
-
// src/components/presentation/SignIn/component-driven/transformer.ts
|
|
7469
|
-
import { EmbeddedFlowComponentType as EmbeddedFlowComponentType3 } from "@asgardeo/browser";
|
|
7470
|
-
var generateId2 = (prefix) => {
|
|
7471
|
-
const suffix = Math.random().toString(36).substring(2, 6);
|
|
7472
|
-
return `${prefix}_${suffix}`;
|
|
7473
|
-
};
|
|
7474
|
-
var getInputVariant2 = (type, name) => {
|
|
7475
|
-
switch (type.toLowerCase()) {
|
|
7476
|
-
case "email":
|
|
7477
|
-
return "EMAIL";
|
|
7478
|
-
case "password":
|
|
7479
|
-
return "PASSWORD";
|
|
7480
|
-
default:
|
|
7481
|
-
return "TEXT";
|
|
7482
|
-
}
|
|
7483
|
-
};
|
|
7484
|
-
var getInputLabel2 = (name, type, t) => {
|
|
7485
|
-
const i18nKey = `elements.fields.${name}`;
|
|
7486
|
-
const label = t(i18nKey);
|
|
7487
|
-
if (label === i18nKey || !label) {
|
|
7488
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
7489
|
-
}
|
|
7490
|
-
return label;
|
|
7491
|
-
};
|
|
7492
|
-
var getInputPlaceholder2 = (name, type, t) => {
|
|
7493
|
-
const label = getInputLabel2(name, type, t);
|
|
7494
|
-
const placeholder = t("elements.fields.placeholder", { field: label });
|
|
7495
|
-
if (!placeholder || placeholder === "elements.fields.placeholder") {
|
|
7496
|
-
return `Enter your ${label}`;
|
|
7497
|
-
}
|
|
7498
|
-
return placeholder;
|
|
7499
|
-
};
|
|
7500
|
-
var convertSimpleInputToComponent2 = (input, t) => {
|
|
7501
|
-
let fieldType = input.type;
|
|
7502
|
-
if (input.name.toLowerCase().includes("password") && input.type.toLowerCase() === "string") {
|
|
7503
|
-
fieldType = "password";
|
|
7504
|
-
}
|
|
7505
|
-
const variant = getInputVariant2(fieldType, input.name);
|
|
7506
|
-
const label = getInputLabel2(input.name, fieldType, t);
|
|
7507
|
-
const placeholder = getInputPlaceholder2(input.name, fieldType, t);
|
|
7508
|
-
return {
|
|
7509
|
-
id: generateId2("input"),
|
|
7510
|
-
type: EmbeddedFlowComponentType3.Input,
|
|
7511
|
-
variant,
|
|
7512
|
-
config: {
|
|
7513
|
-
type: fieldType,
|
|
7514
|
-
label,
|
|
7515
|
-
placeholder,
|
|
7516
|
-
required: input.required,
|
|
7517
|
-
identifier: input.name,
|
|
7518
|
-
hint: ""
|
|
7519
|
-
},
|
|
7520
|
-
components: []
|
|
7521
|
-
};
|
|
7522
|
-
};
|
|
7523
|
-
var convertActionToComponent2 = (action, t) => {
|
|
7524
|
-
const normalizedId = action.id.replace(/_auth$/, "");
|
|
7525
|
-
const i18nKey = `elements.buttons.${normalizedId}`;
|
|
7526
|
-
let text = t(i18nKey);
|
|
7527
|
-
if (!text || text === i18nKey) {
|
|
7528
|
-
text = action.id.replace(/_/g, " ");
|
|
7529
|
-
text = text.charAt(0).toUpperCase() + text.slice(1);
|
|
7530
|
-
}
|
|
7531
|
-
return {
|
|
7532
|
-
id: generateId2("action"),
|
|
7533
|
-
type: EmbeddedFlowComponentType3.Button,
|
|
7534
|
-
variant: "SECONDARY",
|
|
7535
|
-
config: {
|
|
7536
|
-
type: "button",
|
|
7537
|
-
text,
|
|
7538
|
-
actionId: action.id,
|
|
7539
|
-
actionType: action.type
|
|
7540
|
-
},
|
|
7541
|
-
components: []
|
|
7542
|
-
};
|
|
7543
|
-
};
|
|
7544
|
-
var transformSimpleToComponentDriven2 = (response, t) => {
|
|
7545
|
-
const inputComponents = response?.data?.inputs?.map((input) => convertSimpleInputToComponent2(input, t)) || [];
|
|
7546
|
-
const actionComponents = response?.data?.actions?.map((action) => convertActionToComponent2(action, t)) || [];
|
|
7547
|
-
const submitButton = inputComponents.length > 0 ? {
|
|
7548
|
-
id: generateId2("button"),
|
|
7549
|
-
type: EmbeddedFlowComponentType3.Button,
|
|
7550
|
-
variant: "PRIMARY",
|
|
7551
|
-
config: {
|
|
7552
|
-
type: "submit",
|
|
7553
|
-
text: t("elements.buttons.signIn")
|
|
7554
|
-
},
|
|
7555
|
-
components: []
|
|
7556
|
-
} : null;
|
|
7557
|
-
const formComponents = [];
|
|
7558
|
-
if (inputComponents.length > 0) {
|
|
7559
|
-
formComponents.push(...inputComponents);
|
|
7560
|
-
if (submitButton) formComponents.push(submitButton);
|
|
7561
|
-
}
|
|
7562
|
-
const result = [];
|
|
7563
|
-
if (formComponents.length > 0) {
|
|
7564
|
-
result.push({
|
|
7565
|
-
id: generateId2("form"),
|
|
7566
|
-
type: EmbeddedFlowComponentType3.Form,
|
|
7567
|
-
config: {},
|
|
7568
|
-
components: formComponents
|
|
7569
|
-
});
|
|
7570
|
-
}
|
|
7571
|
-
if (actionComponents.length > 0) {
|
|
7572
|
-
result.push(...actionComponents);
|
|
7573
|
-
}
|
|
7574
|
-
return result;
|
|
7575
|
-
};
|
|
7576
|
-
var normalizeFlowResponse = (response, t) => {
|
|
7577
|
-
return {
|
|
7578
|
-
flowId: response.flowId,
|
|
7579
|
-
components: transformSimpleToComponentDriven2(response, t)
|
|
7580
|
-
};
|
|
7581
|
-
};
|
|
7582
|
-
|
|
7583
|
-
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7584
7516
|
import { Fragment as Fragment12, jsx as jsx58 } from "react/jsx-runtime";
|
|
7585
7517
|
var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
|
|
7586
7518
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
@@ -7651,11 +7583,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7651
7583
|
console.warn("[SignIn] OAuth error detected:", error);
|
|
7652
7584
|
clearFlowState();
|
|
7653
7585
|
const errorMessage = errorDescription || `OAuth error: ${error}`;
|
|
7654
|
-
const err = new AsgardeoRuntimeError8(
|
|
7655
|
-
errorMessage,
|
|
7656
|
-
"SIGN_IN_ERROR",
|
|
7657
|
-
"react"
|
|
7658
|
-
);
|
|
7586
|
+
const err = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
7659
7587
|
setError(err);
|
|
7660
7588
|
cleanupOAuthUrlParams(true);
|
|
7661
7589
|
};
|
|
@@ -7737,11 +7665,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7737
7665
|
const err = error;
|
|
7738
7666
|
clearFlowState();
|
|
7739
7667
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7740
|
-
const displayError = new AsgardeoRuntimeError8(
|
|
7741
|
-
errorMessage,
|
|
7742
|
-
"SIGN_IN_ERROR",
|
|
7743
|
-
"react"
|
|
7744
|
-
);
|
|
7668
|
+
const displayError = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
7745
7669
|
setError(displayError);
|
|
7746
7670
|
initializationAttemptedRef.current = false;
|
|
7747
7671
|
return;
|
|
@@ -7772,11 +7696,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7772
7696
|
clearFlowState();
|
|
7773
7697
|
const failureReason = response?.failureReason;
|
|
7774
7698
|
const errorMessage = failureReason || "Authentication flow failed. Please try again.";
|
|
7775
|
-
const err = new AsgardeoRuntimeError8(
|
|
7776
|
-
errorMessage,
|
|
7777
|
-
"SIGN_IN_ERROR",
|
|
7778
|
-
"react"
|
|
7779
|
-
);
|
|
7699
|
+
const err = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
7780
7700
|
setError(err);
|
|
7781
7701
|
cleanupFlowUrlParams();
|
|
7782
7702
|
return;
|
|
@@ -7811,11 +7731,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7811
7731
|
const err = error;
|
|
7812
7732
|
clearFlowState();
|
|
7813
7733
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7814
|
-
const displayError = new AsgardeoRuntimeError8(
|
|
7815
|
-
errorMessage,
|
|
7816
|
-
"SIGN_IN_ERROR",
|
|
7817
|
-
"react"
|
|
7818
|
-
);
|
|
7734
|
+
const displayError = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
7819
7735
|
setError(displayError);
|
|
7820
7736
|
return;
|
|
7821
7737
|
} finally {
|
|
@@ -7837,12 +7753,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7837
7753
|
if (!urlParams.code || oauthCodeProcessedRef.current || isSubmitting) {
|
|
7838
7754
|
return;
|
|
7839
7755
|
}
|
|
7840
|
-
const flowIdToUse = resolveFlowId(
|
|
7841
|
-
currentFlowId,
|
|
7842
|
-
urlParams.state,
|
|
7843
|
-
urlParams.flowId,
|
|
7844
|
-
storedFlowId
|
|
7845
|
-
);
|
|
7756
|
+
const flowIdToUse = resolveFlowId(currentFlowId, urlParams.state, urlParams.flowId, storedFlowId);
|
|
7846
7757
|
if (!flowIdToUse || !signIn) {
|
|
7847
7758
|
return;
|
|
7848
7759
|
}
|
|
@@ -7888,7 +7799,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7888
7799
|
};
|
|
7889
7800
|
var SignIn_default = SignIn;
|
|
7890
7801
|
|
|
7891
|
-
// src/components/presentation/SignIn/SignIn.tsx
|
|
7802
|
+
// src/components/presentation/auth/SignIn/SignIn.tsx
|
|
7892
7803
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
7893
7804
|
var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
7894
7805
|
const { signIn, afterSignInUrl, isInitialized, isLoading, platform } = useAsgardeo_default();
|
|
@@ -7923,7 +7834,7 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7923
7834
|
);
|
|
7924
7835
|
}
|
|
7925
7836
|
return /* @__PURE__ */ jsx59(
|
|
7926
|
-
|
|
7837
|
+
BaseSignIn_default3,
|
|
7927
7838
|
{
|
|
7928
7839
|
isLoading: isLoading || !isInitialized,
|
|
7929
7840
|
afterSignInUrl,
|
|
@@ -7941,19 +7852,21 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7941
7852
|
};
|
|
7942
7853
|
var SignIn_default2 = SignIn2;
|
|
7943
7854
|
|
|
7944
|
-
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
7855
|
+
// src/components/presentation/auth/SignUp/BaseSignUp.tsx
|
|
7856
|
+
import { Platform as Platform5 } from "@asgardeo/browser";
|
|
7857
|
+
|
|
7858
|
+
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
7945
7859
|
import {
|
|
7946
7860
|
EmbeddedFlowStatus,
|
|
7947
|
-
EmbeddedFlowComponentType as
|
|
7861
|
+
EmbeddedFlowComponentType as EmbeddedFlowComponentType3,
|
|
7948
7862
|
EmbeddedFlowResponseType,
|
|
7949
|
-
withVendorCSSClassPrefix as withVendorCSSClassPrefix21
|
|
7950
|
-
Platform as Platform5
|
|
7863
|
+
withVendorCSSClassPrefix as withVendorCSSClassPrefix21
|
|
7951
7864
|
} from "@asgardeo/browser";
|
|
7952
7865
|
import { cx as cx21 } from "@emotion/css";
|
|
7953
7866
|
import { useEffect as useEffect14, useState as useState17, useCallback as useCallback11, useRef as useRef5 } from "react";
|
|
7954
7867
|
|
|
7955
|
-
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
7956
|
-
import { EmbeddedFlowComponentType as
|
|
7868
|
+
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
7869
|
+
import { EmbeddedFlowComponentType as EmbeddedFlowComponentType2 } from "@asgardeo/browser";
|
|
7957
7870
|
|
|
7958
7871
|
// src/components/adapters/CheckboxInput.tsx
|
|
7959
7872
|
import { FieldType as FieldType8 } from "@asgardeo/browser";
|
|
@@ -8404,13 +8317,13 @@ var TypographyComponent = ({ component }) => {
|
|
|
8404
8317
|
};
|
|
8405
8318
|
var Typography_default2 = TypographyComponent;
|
|
8406
8319
|
|
|
8407
|
-
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
8320
|
+
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
8408
8321
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
8409
8322
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
8410
8323
|
switch (component.type) {
|
|
8411
|
-
case
|
|
8324
|
+
case EmbeddedFlowComponentType2.Typography:
|
|
8412
8325
|
return /* @__PURE__ */ jsx66(Typography_default2, { component, onSubmit, ...rest });
|
|
8413
|
-
case
|
|
8326
|
+
case EmbeddedFlowComponentType2.Input:
|
|
8414
8327
|
const inputVariant = component.variant?.toUpperCase();
|
|
8415
8328
|
const inputType = component.config["type"]?.toLowerCase();
|
|
8416
8329
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
@@ -8432,7 +8345,7 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
8432
8345
|
return /* @__PURE__ */ jsx66(CheckboxInput_default, { component, onSubmit, ...rest });
|
|
8433
8346
|
}
|
|
8434
8347
|
return /* @__PURE__ */ jsx66(TextInput_default, { component, onSubmit, ...rest });
|
|
8435
|
-
case
|
|
8348
|
+
case EmbeddedFlowComponentType2.Button: {
|
|
8436
8349
|
const buttonVariant = component.variant?.toUpperCase();
|
|
8437
8350
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
8438
8351
|
if (buttonVariant === "SOCIAL") {
|
|
@@ -8457,13 +8370,13 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
8457
8370
|
}
|
|
8458
8371
|
return /* @__PURE__ */ jsx66(SubmitButton_default, { component, onSubmit, ...rest });
|
|
8459
8372
|
}
|
|
8460
|
-
case
|
|
8373
|
+
case EmbeddedFlowComponentType2.Form:
|
|
8461
8374
|
return /* @__PURE__ */ jsx66(FormContainer_default, { component, onSubmit, ...rest });
|
|
8462
|
-
case
|
|
8375
|
+
case EmbeddedFlowComponentType2.Select:
|
|
8463
8376
|
return /* @__PURE__ */ jsx66(SelectInput_default, { component, onSubmit, ...rest });
|
|
8464
|
-
case
|
|
8377
|
+
case EmbeddedFlowComponentType2.Divider:
|
|
8465
8378
|
return /* @__PURE__ */ jsx66(DividerComponent_default, { component, onSubmit, ...rest });
|
|
8466
|
-
case
|
|
8379
|
+
case EmbeddedFlowComponentType2.Image:
|
|
8467
8380
|
return /* @__PURE__ */ jsx66(ImageComponent_default, { component, onSubmit, ...rest });
|
|
8468
8381
|
default:
|
|
8469
8382
|
return /* @__PURE__ */ jsx66("div", {});
|
|
@@ -8479,7 +8392,7 @@ var createSignUpOptionFromComponent = (component, formValues, touchedFields, for
|
|
|
8479
8392
|
touchedFields,
|
|
8480
8393
|
...options
|
|
8481
8394
|
});
|
|
8482
|
-
var
|
|
8395
|
+
var renderSignUpComponents2 = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => components.map(
|
|
8483
8396
|
(component, index) => createSignUpOptionFromComponent(
|
|
8484
8397
|
component,
|
|
8485
8398
|
formValues,
|
|
@@ -8496,7 +8409,7 @@ var renderSignUpComponents = (components, formValues, touchedFields, formErrors,
|
|
|
8496
8409
|
)
|
|
8497
8410
|
).filter(Boolean);
|
|
8498
8411
|
|
|
8499
|
-
// src/components/presentation/SignUp/BaseSignUp.styles.ts
|
|
8412
|
+
// src/components/presentation/auth/SignUp/BaseSignUp.styles.ts
|
|
8500
8413
|
import { css as css17 } from "@emotion/css";
|
|
8501
8414
|
import { useMemo as useMemo24 } from "react";
|
|
8502
8415
|
var useStyles17 = (theme, colorScheme) => {
|
|
@@ -8634,7 +8547,7 @@ var useStyles17 = (theme, colorScheme) => {
|
|
|
8634
8547
|
};
|
|
8635
8548
|
var BaseSignUp_styles_default = useStyles17;
|
|
8636
8549
|
|
|
8637
|
-
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
8550
|
+
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
8638
8551
|
import { jsx as jsx67, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8639
8552
|
var BaseSignUp = ({ showLogo = true, ...rest }) => {
|
|
8640
8553
|
const { theme, colorScheme } = useTheme_default();
|
|
@@ -8670,7 +8583,29 @@ var BaseSignUpContent = ({
|
|
|
8670
8583
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
8671
8584
|
const handleError = useCallback11(
|
|
8672
8585
|
(error) => {
|
|
8673
|
-
|
|
8586
|
+
let errorMessage = t("errors.signup.flow.failure");
|
|
8587
|
+
if (error && typeof error === "object") {
|
|
8588
|
+
if (error.code && (error.message || error.description)) {
|
|
8589
|
+
errorMessage = error.description || error.message;
|
|
8590
|
+
} else if (error instanceof Error && error.name === "AsgardeoAPIError") {
|
|
8591
|
+
try {
|
|
8592
|
+
const errorResponse = JSON.parse(error.message);
|
|
8593
|
+
if (errorResponse.description) {
|
|
8594
|
+
errorMessage = errorResponse.description;
|
|
8595
|
+
} else if (errorResponse.message) {
|
|
8596
|
+
errorMessage = errorResponse.message;
|
|
8597
|
+
} else {
|
|
8598
|
+
errorMessage = error.message;
|
|
8599
|
+
}
|
|
8600
|
+
} catch {
|
|
8601
|
+
errorMessage = error.message;
|
|
8602
|
+
}
|
|
8603
|
+
} else if (error.message) {
|
|
8604
|
+
errorMessage = error.message;
|
|
8605
|
+
}
|
|
8606
|
+
} else if (typeof error === "string") {
|
|
8607
|
+
errorMessage = error;
|
|
8608
|
+
}
|
|
8674
8609
|
clearMessages();
|
|
8675
8610
|
addMessage({
|
|
8676
8611
|
type: "error",
|
|
@@ -8684,31 +8619,12 @@ var BaseSignUpContent = ({
|
|
|
8684
8619
|
const [currentFlow, setCurrentFlow] = useState17(null);
|
|
8685
8620
|
const [formData, setFormData] = useState17({});
|
|
8686
8621
|
const initializationAttemptedRef = useRef5(false);
|
|
8687
|
-
const normalizeFlowResponse2 = useCallback11(
|
|
8688
|
-
(response) => {
|
|
8689
|
-
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
8690
|
-
return response;
|
|
8691
|
-
}
|
|
8692
|
-
if (response?.data && (response.data.inputs || response.data.actions)) {
|
|
8693
|
-
const transformedComponents = transformSimpleToComponentDriven(response, t);
|
|
8694
|
-
return {
|
|
8695
|
-
...response,
|
|
8696
|
-
data: {
|
|
8697
|
-
...response.data,
|
|
8698
|
-
components: transformedComponents
|
|
8699
|
-
}
|
|
8700
|
-
};
|
|
8701
|
-
}
|
|
8702
|
-
return response;
|
|
8703
|
-
},
|
|
8704
|
-
[t]
|
|
8705
|
-
);
|
|
8706
8622
|
const extractFormFields = useCallback11(
|
|
8707
8623
|
(components) => {
|
|
8708
8624
|
const fields = [];
|
|
8709
8625
|
const processComponents = (comps) => {
|
|
8710
8626
|
comps.forEach((component) => {
|
|
8711
|
-
if (component.type ===
|
|
8627
|
+
if (component.type === EmbeddedFlowComponentType3.Input) {
|
|
8712
8628
|
const config = component.config || {};
|
|
8713
8629
|
fields.push({
|
|
8714
8630
|
name: config.name || component.id,
|
|
@@ -8716,7 +8632,7 @@ var BaseSignUpContent = ({
|
|
|
8716
8632
|
initialValue: config.defaultValue || "",
|
|
8717
8633
|
validator: (value) => {
|
|
8718
8634
|
if (config.required && (!value || value.trim() === "")) {
|
|
8719
|
-
return t("field.
|
|
8635
|
+
return t("validations.required.field.error");
|
|
8720
8636
|
}
|
|
8721
8637
|
if (config.type === "email" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
8722
8638
|
return t("field.email.invalid");
|
|
@@ -8744,7 +8660,7 @@ var BaseSignUpContent = ({
|
|
|
8744
8660
|
fields: formFields,
|
|
8745
8661
|
validateOnBlur: true,
|
|
8746
8662
|
validateOnChange: true,
|
|
8747
|
-
requiredMessage: t("field.
|
|
8663
|
+
requiredMessage: t("validations.required.field.error")
|
|
8748
8664
|
});
|
|
8749
8665
|
const {
|
|
8750
8666
|
values: formValues,
|
|
@@ -8792,15 +8708,14 @@ var BaseSignUpContent = ({
|
|
|
8792
8708
|
}
|
|
8793
8709
|
});
|
|
8794
8710
|
}
|
|
8795
|
-
const actionId =
|
|
8711
|
+
const actionId = component.id;
|
|
8796
8712
|
const payload = {
|
|
8797
8713
|
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
8798
8714
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
8799
8715
|
inputs: filteredInputs,
|
|
8800
8716
|
...actionId && { actionId }
|
|
8801
8717
|
};
|
|
8802
|
-
const
|
|
8803
|
-
const response = normalizeFlowResponse2(rawResponse);
|
|
8718
|
+
const response = await onSubmit(payload);
|
|
8804
8719
|
onFlowChange?.(response);
|
|
8805
8720
|
if (response.flowStatus === EmbeddedFlowStatus.Complete) {
|
|
8806
8721
|
onComplete?.(response);
|
|
@@ -8961,7 +8876,7 @@ var BaseSignUpContent = ({
|
|
|
8961
8876
|
const errorClasses = cx21([withVendorCSSClassPrefix21("signup__error")], errorClassName);
|
|
8962
8877
|
const messageClasses = cx21([withVendorCSSClassPrefix21("signup__messages")], messageClassName);
|
|
8963
8878
|
const renderComponents = useCallback11(
|
|
8964
|
-
(components) =>
|
|
8879
|
+
(components) => renderSignUpComponents2(
|
|
8965
8880
|
components,
|
|
8966
8881
|
formValues,
|
|
8967
8882
|
touchedFields,
|
|
@@ -8990,29 +8905,14 @@ var BaseSignUpContent = ({
|
|
|
8990
8905
|
handleSubmit
|
|
8991
8906
|
]
|
|
8992
8907
|
);
|
|
8993
|
-
const getUrlParams = () => {
|
|
8994
|
-
const urlParams = new URL(window?.location?.href ?? "").searchParams;
|
|
8995
|
-
return {
|
|
8996
|
-
code: urlParams.get("code"),
|
|
8997
|
-
state: urlParams.get("state"),
|
|
8998
|
-
error: urlParams.get("error")
|
|
8999
|
-
};
|
|
9000
|
-
};
|
|
9001
8908
|
useEffect14(() => {
|
|
9002
|
-
if (platform === Platform5.AsgardeoV2) {
|
|
9003
|
-
const urlParams = getUrlParams();
|
|
9004
|
-
if (urlParams.code || urlParams.state) {
|
|
9005
|
-
return;
|
|
9006
|
-
}
|
|
9007
|
-
}
|
|
9008
8909
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
9009
8910
|
initializationAttemptedRef.current = true;
|
|
9010
8911
|
(async () => {
|
|
9011
8912
|
setIsLoading(true);
|
|
9012
8913
|
clearMessages();
|
|
9013
8914
|
try {
|
|
9014
|
-
const
|
|
9015
|
-
const response = normalizeFlowResponse2(rawResponse);
|
|
8915
|
+
const response = await onInitialize();
|
|
9016
8916
|
setCurrentFlow(response);
|
|
9017
8917
|
setIsFlowInitialized(true);
|
|
9018
8918
|
onFlowChange?.(response);
|
|
@@ -9039,7 +8939,6 @@ var BaseSignUpContent = ({
|
|
|
9039
8939
|
onError,
|
|
9040
8940
|
onFlowChange,
|
|
9041
8941
|
setupFormFields,
|
|
9042
|
-
normalizeFlowResponse2,
|
|
9043
8942
|
afterSignUpUrl,
|
|
9044
8943
|
t
|
|
9045
8944
|
]);
|
|
@@ -9054,8 +8953,8 @@ var BaseSignUpContent = ({
|
|
|
9054
8953
|
handleInputChange,
|
|
9055
8954
|
handleSubmit,
|
|
9056
8955
|
validateForm,
|
|
9057
|
-
title: flowTitle || t("signup.
|
|
9058
|
-
subtitle: flowSubtitle || t("signup.
|
|
8956
|
+
title: flowTitle || t("signup.heading"),
|
|
8957
|
+
subtitle: flowSubtitle || t("signup.subheading"),
|
|
9059
8958
|
messages: flowMessages || []
|
|
9060
8959
|
};
|
|
9061
8960
|
return /* @__PURE__ */ jsx67("div", { className: containerClasses, children: children(renderProps) });
|
|
@@ -9065,14 +8964,14 @@ var BaseSignUpContent = ({
|
|
|
9065
8964
|
}
|
|
9066
8965
|
if (!currentFlow) {
|
|
9067
8966
|
return /* @__PURE__ */ jsx67(Card_default, { className: cx21(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx67(Card_default.Content, { children: /* @__PURE__ */ jsxs28(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
9068
|
-
/* @__PURE__ */ jsx67(Alert_default.Title, { children: t("errors.
|
|
9069
|
-
/* @__PURE__ */ jsx67(Alert_default.Description, { children: t("errors.
|
|
8967
|
+
/* @__PURE__ */ jsx67(Alert_default.Title, { children: t("errors.heading") }),
|
|
8968
|
+
/* @__PURE__ */ jsx67(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
9070
8969
|
] }) }) });
|
|
9071
8970
|
}
|
|
9072
8971
|
return /* @__PURE__ */ jsxs28(Card_default, { className: cx21(containerClasses, styles.card), variant, children: [
|
|
9073
8972
|
(showTitle || showSubtitle) && /* @__PURE__ */ jsxs28(Card_default.Header, { className: styles.header, children: [
|
|
9074
|
-
showTitle && /* @__PURE__ */ jsx67(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.
|
|
9075
|
-
showSubtitle && /* @__PURE__ */ jsx67(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.
|
|
8973
|
+
showTitle && /* @__PURE__ */ jsx67(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.heading") }),
|
|
8974
|
+
showSubtitle && /* @__PURE__ */ jsx67(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.subheading") })
|
|
9076
8975
|
] }),
|
|
9077
8976
|
/* @__PURE__ */ jsxs28(Card_default.Content, { children: [
|
|
9078
8977
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx67("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx67(
|
|
@@ -9084,52 +8983,535 @@ var BaseSignUpContent = ({
|
|
|
9084
8983
|
},
|
|
9085
8984
|
message.id || index
|
|
9086
8985
|
)) }),
|
|
9087
|
-
/* @__PURE__ */ jsx67("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ jsx67(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx67(Typography_default, { variant: "body1", children: t("errors.
|
|
8986
|
+
/* @__PURE__ */ jsx67("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ jsx67(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx67(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
9088
8987
|
] })
|
|
9089
8988
|
] });
|
|
9090
8989
|
};
|
|
9091
8990
|
var BaseSignUp_default = BaseSignUp;
|
|
9092
8991
|
|
|
9093
|
-
// src/components/presentation/SignUp/
|
|
8992
|
+
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
9094
8993
|
import {
|
|
8994
|
+
EmbeddedFlowStatus as EmbeddedFlowStatus2,
|
|
9095
8995
|
EmbeddedFlowResponseType as EmbeddedFlowResponseType2,
|
|
9096
|
-
|
|
9097
|
-
|
|
8996
|
+
withVendorCSSClassPrefix as withVendorCSSClassPrefix22,
|
|
8997
|
+
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType4
|
|
9098
8998
|
} from "@asgardeo/browser";
|
|
9099
|
-
import {
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
8999
|
+
import { cx as cx22 } from "@emotion/css";
|
|
9000
|
+
import { useEffect as useEffect15, useState as useState18, useCallback as useCallback12, useRef as useRef6 } from "react";
|
|
9001
|
+
import { jsx as jsx68, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
9002
|
+
var BaseSignUp2 = ({ showLogo = true, ...rest }) => {
|
|
9003
|
+
const { theme, colorScheme } = useTheme_default();
|
|
9004
|
+
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9005
|
+
return /* @__PURE__ */ jsxs29("div", { children: [
|
|
9006
|
+
showLogo && /* @__PURE__ */ jsx68("div", { className: styles.logoContainer, children: /* @__PURE__ */ jsx68(Logo_default, { size: "large" }) }),
|
|
9007
|
+
/* @__PURE__ */ jsx68(FlowProvider_default, { children: /* @__PURE__ */ jsx68(BaseSignUpContent2, { showLogo, ...rest }) })
|
|
9008
|
+
] });
|
|
9009
|
+
};
|
|
9010
|
+
var BaseSignUpContent2 = ({
|
|
9103
9011
|
afterSignUpUrl,
|
|
9012
|
+
onInitialize,
|
|
9013
|
+
onSubmit,
|
|
9104
9014
|
onError,
|
|
9015
|
+
onFlowChange,
|
|
9105
9016
|
onComplete,
|
|
9106
|
-
|
|
9017
|
+
className = "",
|
|
9018
|
+
inputClassName = "",
|
|
9019
|
+
buttonClassName = "",
|
|
9020
|
+
errorClassName = "",
|
|
9021
|
+
messageClassName = "",
|
|
9022
|
+
size = "medium",
|
|
9023
|
+
variant = "outlined",
|
|
9024
|
+
isInitialized,
|
|
9107
9025
|
children,
|
|
9108
|
-
|
|
9026
|
+
showTitle = true,
|
|
9027
|
+
showSubtitle = true
|
|
9109
9028
|
}) => {
|
|
9110
|
-
const {
|
|
9111
|
-
const
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9029
|
+
const { theme, colorScheme } = useTheme_default();
|
|
9030
|
+
const { t } = useTranslation_default();
|
|
9031
|
+
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
9032
|
+
const { platform } = useAsgardeo_default();
|
|
9033
|
+
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9034
|
+
const handleError = useCallback12(
|
|
9035
|
+
(error) => {
|
|
9036
|
+
const errorMessage = extractErrorMessage(error, t);
|
|
9037
|
+
clearMessages();
|
|
9038
|
+
addMessage({
|
|
9039
|
+
type: "error",
|
|
9040
|
+
message: errorMessage
|
|
9041
|
+
});
|
|
9042
|
+
},
|
|
9043
|
+
[t, addMessage, clearMessages]
|
|
9044
|
+
);
|
|
9045
|
+
const [isLoading, setIsLoading] = useState18(false);
|
|
9046
|
+
const [isFlowInitialized, setIsFlowInitialized] = useState18(false);
|
|
9047
|
+
const [currentFlow, setCurrentFlow] = useState18(null);
|
|
9048
|
+
const [formData, setFormData] = useState18({});
|
|
9049
|
+
const initializationAttemptedRef = useRef6(false);
|
|
9050
|
+
const normalizeFlowResponseLocal = useCallback12(
|
|
9051
|
+
(response) => {
|
|
9052
|
+
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
9053
|
+
return response;
|
|
9054
|
+
}
|
|
9055
|
+
if (response?.data) {
|
|
9056
|
+
try {
|
|
9057
|
+
const { components } = normalizeFlowResponse(response, t, {
|
|
9058
|
+
defaultErrorKey: "components.signUp.errors.generic"
|
|
9059
|
+
});
|
|
9060
|
+
return {
|
|
9061
|
+
...response,
|
|
9062
|
+
data: {
|
|
9063
|
+
...response.data,
|
|
9064
|
+
components
|
|
9065
|
+
}
|
|
9066
|
+
};
|
|
9067
|
+
} catch (error) {
|
|
9068
|
+
throw error;
|
|
9069
|
+
}
|
|
9070
|
+
}
|
|
9071
|
+
return response;
|
|
9072
|
+
},
|
|
9073
|
+
[t]
|
|
9074
|
+
);
|
|
9075
|
+
const extractFormFields = useCallback12(
|
|
9076
|
+
(components) => {
|
|
9077
|
+
const fields = [];
|
|
9078
|
+
const processComponents = (comps) => {
|
|
9079
|
+
comps.forEach((component) => {
|
|
9080
|
+
if (component.type === EmbeddedFlowComponentType4.TextInput) {
|
|
9081
|
+
fields.push({
|
|
9082
|
+
name: component.id,
|
|
9083
|
+
required: component.required || false,
|
|
9084
|
+
initialValue: "",
|
|
9085
|
+
validator: (value) => {
|
|
9086
|
+
if (component.required && (!value || value.trim() === "")) {
|
|
9087
|
+
return t("validations.required.field.error");
|
|
9088
|
+
}
|
|
9089
|
+
if (component.variant === "EMAIL" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9090
|
+
return t("field.email.invalid");
|
|
9091
|
+
}
|
|
9092
|
+
if (component.type === "PASSWORD_INPUT" && value && value.length < 8) {
|
|
9093
|
+
return t("field.password.weak");
|
|
9094
|
+
}
|
|
9095
|
+
return null;
|
|
9096
|
+
}
|
|
9097
|
+
});
|
|
9098
|
+
}
|
|
9099
|
+
if (component.components && Array.isArray(component.components)) {
|
|
9100
|
+
processComponents(component.components);
|
|
9101
|
+
}
|
|
9102
|
+
});
|
|
9103
|
+
};
|
|
9104
|
+
processComponents(components);
|
|
9105
|
+
return fields;
|
|
9106
|
+
},
|
|
9107
|
+
[t]
|
|
9108
|
+
);
|
|
9109
|
+
const formFields = currentFlow?.data?.components ? extractFormFields(currentFlow.data.components) : [];
|
|
9110
|
+
const form = useForm({
|
|
9111
|
+
initialValues: {},
|
|
9112
|
+
fields: formFields,
|
|
9113
|
+
validateOnBlur: true,
|
|
9114
|
+
validateOnChange: true,
|
|
9115
|
+
requiredMessage: t("validations.required.field.error")
|
|
9116
|
+
});
|
|
9117
|
+
const {
|
|
9118
|
+
values: formValues,
|
|
9119
|
+
touched: touchedFields,
|
|
9120
|
+
errors: formErrors,
|
|
9121
|
+
isValid: isFormValid,
|
|
9122
|
+
setValue: setFormValue,
|
|
9123
|
+
setTouched: setFormTouched,
|
|
9124
|
+
clearErrors: clearFormErrors,
|
|
9125
|
+
validateField: validateFormField,
|
|
9126
|
+
validateForm,
|
|
9127
|
+
touchAllFields,
|
|
9128
|
+
reset: resetForm
|
|
9129
|
+
} = form;
|
|
9130
|
+
const setupFormFields = useCallback12(
|
|
9131
|
+
(flowResponse) => {
|
|
9132
|
+
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
9133
|
+
const initialValues = {};
|
|
9134
|
+
fields.forEach((field) => {
|
|
9135
|
+
initialValues[field.name] = field.initialValue || "";
|
|
9136
|
+
});
|
|
9137
|
+
resetForm();
|
|
9138
|
+
Object.keys(initialValues).forEach((key) => {
|
|
9139
|
+
setFormValue(key, initialValues[key]);
|
|
9140
|
+
});
|
|
9141
|
+
},
|
|
9142
|
+
[extractFormFields, resetForm, setFormValue]
|
|
9143
|
+
);
|
|
9144
|
+
const handleInputChange = (name, value) => {
|
|
9145
|
+
setFormValue(name, value);
|
|
9146
|
+
setFormTouched(name, true);
|
|
9147
|
+
};
|
|
9148
|
+
const handleSubmit = async (component, data) => {
|
|
9149
|
+
if (!currentFlow) {
|
|
9150
|
+
return;
|
|
9151
|
+
}
|
|
9152
|
+
setIsLoading(true);
|
|
9153
|
+
clearMessages();
|
|
9154
|
+
try {
|
|
9155
|
+
const filteredInputs = {};
|
|
9156
|
+
if (data) {
|
|
9157
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
9158
|
+
if (value !== null && value !== void 0 && value !== "") {
|
|
9159
|
+
filteredInputs[key] = value;
|
|
9160
|
+
}
|
|
9161
|
+
});
|
|
9162
|
+
}
|
|
9163
|
+
const payload = {
|
|
9164
|
+
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9165
|
+
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9166
|
+
...component.id && { action: component.id },
|
|
9167
|
+
inputs: filteredInputs
|
|
9168
|
+
};
|
|
9169
|
+
const rawResponse = await onSubmit(payload);
|
|
9170
|
+
const response = normalizeFlowResponseLocal(rawResponse);
|
|
9171
|
+
onFlowChange?.(response);
|
|
9172
|
+
if (response.flowStatus === EmbeddedFlowStatus2.Complete) {
|
|
9173
|
+
onComplete?.(response);
|
|
9174
|
+
return;
|
|
9175
|
+
}
|
|
9176
|
+
if (response.flowStatus === EmbeddedFlowStatus2.Incomplete) {
|
|
9177
|
+
if (handleRedirectionIfNeeded(response, component)) {
|
|
9178
|
+
return;
|
|
9179
|
+
}
|
|
9180
|
+
setCurrentFlow(response);
|
|
9181
|
+
setupFormFields(response);
|
|
9182
|
+
}
|
|
9183
|
+
} catch (err) {
|
|
9184
|
+
handleError(err);
|
|
9185
|
+
onError?.(err);
|
|
9186
|
+
} finally {
|
|
9187
|
+
setIsLoading(false);
|
|
9188
|
+
}
|
|
9189
|
+
};
|
|
9190
|
+
const handleRedirectionIfNeeded = (response, component) => {
|
|
9191
|
+
if (response?.type === EmbeddedFlowResponseType2.Redirection && response?.data?.redirectURL) {
|
|
9192
|
+
const redirectUrl = response.data.redirectURL;
|
|
9193
|
+
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
9194
|
+
if (!popup) {
|
|
9195
|
+
console.error("Failed to open popup window");
|
|
9196
|
+
return false;
|
|
9197
|
+
}
|
|
9198
|
+
const messageHandler = async function messageEventHandler(event) {
|
|
9199
|
+
if (event.source !== popup) {
|
|
9200
|
+
return;
|
|
9201
|
+
}
|
|
9202
|
+
const expectedOrigin = afterSignUpUrl ? new URL(afterSignUpUrl).origin : window.location.origin;
|
|
9203
|
+
if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {
|
|
9204
|
+
return;
|
|
9205
|
+
}
|
|
9206
|
+
const { code, state } = event.data;
|
|
9207
|
+
if (code && state) {
|
|
9208
|
+
const payload = {
|
|
9209
|
+
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9210
|
+
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9211
|
+
inputs: {
|
|
9212
|
+
code,
|
|
9213
|
+
state
|
|
9214
|
+
},
|
|
9215
|
+
actionId: ""
|
|
9216
|
+
};
|
|
9217
|
+
try {
|
|
9218
|
+
const continueResponse = await onSubmit(payload);
|
|
9219
|
+
onFlowChange?.(continueResponse);
|
|
9220
|
+
if (continueResponse.flowStatus === EmbeddedFlowStatus2.Complete) {
|
|
9221
|
+
onComplete?.(continueResponse);
|
|
9222
|
+
} else if (continueResponse.flowStatus === EmbeddedFlowStatus2.Incomplete) {
|
|
9223
|
+
setCurrentFlow(continueResponse);
|
|
9224
|
+
setupFormFields(continueResponse);
|
|
9225
|
+
}
|
|
9226
|
+
popup.close();
|
|
9227
|
+
cleanup();
|
|
9228
|
+
} catch (err) {
|
|
9229
|
+
handleError(err);
|
|
9230
|
+
onError?.(err);
|
|
9231
|
+
popup.close();
|
|
9232
|
+
cleanup();
|
|
9233
|
+
}
|
|
9234
|
+
}
|
|
9235
|
+
};
|
|
9236
|
+
const cleanup = () => {
|
|
9237
|
+
window.removeEventListener("message", messageHandler);
|
|
9238
|
+
if (popupMonitor) {
|
|
9239
|
+
clearInterval(popupMonitor);
|
|
9240
|
+
}
|
|
9241
|
+
};
|
|
9242
|
+
window.addEventListener("message", messageHandler);
|
|
9243
|
+
let hasProcessedCallback = false;
|
|
9244
|
+
const popupMonitor = setInterval(async () => {
|
|
9245
|
+
try {
|
|
9246
|
+
if (popup.closed) {
|
|
9247
|
+
cleanup();
|
|
9248
|
+
return;
|
|
9249
|
+
}
|
|
9250
|
+
if (hasProcessedCallback) {
|
|
9251
|
+
return;
|
|
9252
|
+
}
|
|
9253
|
+
try {
|
|
9254
|
+
const popupUrl = popup.location.href;
|
|
9255
|
+
if (popupUrl && (popupUrl.includes("code=") || popupUrl.includes("error="))) {
|
|
9256
|
+
hasProcessedCallback = true;
|
|
9257
|
+
const url = new URL(popupUrl);
|
|
9258
|
+
const code = url.searchParams.get("code");
|
|
9259
|
+
const state = url.searchParams.get("state");
|
|
9260
|
+
const error = url.searchParams.get("error");
|
|
9261
|
+
if (error) {
|
|
9262
|
+
console.error("OAuth error:", error);
|
|
9263
|
+
popup.close();
|
|
9264
|
+
cleanup();
|
|
9265
|
+
return;
|
|
9266
|
+
}
|
|
9267
|
+
if (code && state) {
|
|
9268
|
+
const payload = {
|
|
9269
|
+
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9270
|
+
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9271
|
+
inputs: {
|
|
9272
|
+
code,
|
|
9273
|
+
state
|
|
9274
|
+
},
|
|
9275
|
+
actionId: ""
|
|
9276
|
+
};
|
|
9277
|
+
try {
|
|
9278
|
+
const continueResponse = await onSubmit(payload);
|
|
9279
|
+
onFlowChange?.(continueResponse);
|
|
9280
|
+
if (continueResponse.flowStatus === EmbeddedFlowStatus2.Complete) {
|
|
9281
|
+
onComplete?.(continueResponse);
|
|
9282
|
+
} else if (continueResponse.flowStatus === EmbeddedFlowStatus2.Incomplete) {
|
|
9283
|
+
setCurrentFlow(continueResponse);
|
|
9284
|
+
setupFormFields(continueResponse);
|
|
9285
|
+
}
|
|
9286
|
+
popup.close();
|
|
9287
|
+
} catch (err) {
|
|
9288
|
+
handleError(err);
|
|
9289
|
+
onError?.(err);
|
|
9290
|
+
popup.close();
|
|
9291
|
+
}
|
|
9292
|
+
}
|
|
9293
|
+
}
|
|
9294
|
+
} catch (e) {
|
|
9295
|
+
}
|
|
9296
|
+
} catch (e) {
|
|
9297
|
+
console.error("Error monitoring popup:", e);
|
|
9298
|
+
}
|
|
9299
|
+
}, 1e3);
|
|
9300
|
+
return true;
|
|
9301
|
+
}
|
|
9302
|
+
return false;
|
|
9303
|
+
};
|
|
9304
|
+
const containerClasses = cx22(
|
|
9305
|
+
[
|
|
9306
|
+
withVendorCSSClassPrefix22("signup"),
|
|
9307
|
+
withVendorCSSClassPrefix22(`signup--${size}`),
|
|
9308
|
+
withVendorCSSClassPrefix22(`signup--${variant}`)
|
|
9309
|
+
],
|
|
9310
|
+
className
|
|
9311
|
+
);
|
|
9312
|
+
const inputClasses = cx22(
|
|
9313
|
+
[
|
|
9314
|
+
withVendorCSSClassPrefix22("signup__input"),
|
|
9315
|
+
size === "small" && withVendorCSSClassPrefix22("signup__input--small"),
|
|
9316
|
+
size === "large" && withVendorCSSClassPrefix22("signup__input--large")
|
|
9317
|
+
],
|
|
9318
|
+
inputClassName
|
|
9319
|
+
);
|
|
9320
|
+
const buttonClasses = cx22(
|
|
9321
|
+
[
|
|
9322
|
+
withVendorCSSClassPrefix22("signup__button"),
|
|
9323
|
+
size === "small" && withVendorCSSClassPrefix22("signup__button--small"),
|
|
9324
|
+
size === "large" && withVendorCSSClassPrefix22("signup__button--large")
|
|
9325
|
+
],
|
|
9326
|
+
buttonClassName
|
|
9327
|
+
);
|
|
9328
|
+
const errorClasses = cx22([withVendorCSSClassPrefix22("signup__error")], errorClassName);
|
|
9329
|
+
const messageClasses = cx22([withVendorCSSClassPrefix22("signup__messages")], messageClassName);
|
|
9330
|
+
const renderComponents = useCallback12(
|
|
9331
|
+
(components) => renderSignUpComponents(
|
|
9332
|
+
components,
|
|
9333
|
+
formValues,
|
|
9334
|
+
touchedFields,
|
|
9335
|
+
formErrors,
|
|
9336
|
+
isLoading,
|
|
9337
|
+
isFormValid,
|
|
9338
|
+
handleInputChange,
|
|
9339
|
+
{
|
|
9340
|
+
buttonClassName: buttonClasses,
|
|
9341
|
+
inputClassName: inputClasses,
|
|
9342
|
+
onSubmit: handleSubmit,
|
|
9343
|
+
size,
|
|
9344
|
+
variant
|
|
9345
|
+
}
|
|
9346
|
+
),
|
|
9347
|
+
[
|
|
9348
|
+
formValues,
|
|
9349
|
+
touchedFields,
|
|
9350
|
+
formErrors,
|
|
9351
|
+
isFormValid,
|
|
9352
|
+
isLoading,
|
|
9353
|
+
size,
|
|
9354
|
+
variant,
|
|
9355
|
+
inputClasses,
|
|
9356
|
+
buttonClasses,
|
|
9357
|
+
handleSubmit
|
|
9358
|
+
]
|
|
9359
|
+
);
|
|
9360
|
+
const getUrlParams = () => {
|
|
9361
|
+
const urlParams = new URL(window?.location?.href ?? "").searchParams;
|
|
9362
|
+
return {
|
|
9363
|
+
code: urlParams.get("code"),
|
|
9364
|
+
state: urlParams.get("state"),
|
|
9365
|
+
error: urlParams.get("error")
|
|
9366
|
+
};
|
|
9131
9367
|
};
|
|
9132
|
-
|
|
9368
|
+
useEffect15(() => {
|
|
9369
|
+
const urlParams = getUrlParams();
|
|
9370
|
+
if (urlParams.code || urlParams.state) {
|
|
9371
|
+
return;
|
|
9372
|
+
}
|
|
9373
|
+
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
9374
|
+
initializationAttemptedRef.current = true;
|
|
9375
|
+
(async () => {
|
|
9376
|
+
setIsLoading(true);
|
|
9377
|
+
clearMessages();
|
|
9378
|
+
try {
|
|
9379
|
+
const rawResponse = await onInitialize();
|
|
9380
|
+
const response = normalizeFlowResponseLocal(rawResponse);
|
|
9381
|
+
setCurrentFlow(response);
|
|
9382
|
+
setIsFlowInitialized(true);
|
|
9383
|
+
onFlowChange?.(response);
|
|
9384
|
+
if (response.flowStatus === EmbeddedFlowStatus2.Complete) {
|
|
9385
|
+
onComplete?.(response);
|
|
9386
|
+
return;
|
|
9387
|
+
}
|
|
9388
|
+
if (response.flowStatus === EmbeddedFlowStatus2.Incomplete) {
|
|
9389
|
+
setupFormFields(response);
|
|
9390
|
+
}
|
|
9391
|
+
} catch (err) {
|
|
9392
|
+
handleError(err);
|
|
9393
|
+
onError?.(err);
|
|
9394
|
+
} finally {
|
|
9395
|
+
setIsLoading(false);
|
|
9396
|
+
}
|
|
9397
|
+
})();
|
|
9398
|
+
}
|
|
9399
|
+
}, [
|
|
9400
|
+
isInitialized,
|
|
9401
|
+
isFlowInitialized,
|
|
9402
|
+
onInitialize,
|
|
9403
|
+
onComplete,
|
|
9404
|
+
onError,
|
|
9405
|
+
onFlowChange,
|
|
9406
|
+
setupFormFields,
|
|
9407
|
+
normalizeFlowResponseLocal,
|
|
9408
|
+
afterSignUpUrl,
|
|
9409
|
+
t
|
|
9410
|
+
]);
|
|
9411
|
+
if (children) {
|
|
9412
|
+
const renderProps = {
|
|
9413
|
+
values: formValues,
|
|
9414
|
+
errors: formErrors,
|
|
9415
|
+
touched: touchedFields,
|
|
9416
|
+
isValid: isFormValid,
|
|
9417
|
+
isLoading,
|
|
9418
|
+
components: currentFlow?.data?.components || [],
|
|
9419
|
+
handleInputChange,
|
|
9420
|
+
handleSubmit,
|
|
9421
|
+
validateForm,
|
|
9422
|
+
title: flowTitle || t("signup.heading"),
|
|
9423
|
+
subtitle: flowSubtitle || t("signup.subheading"),
|
|
9424
|
+
messages: flowMessages || []
|
|
9425
|
+
};
|
|
9426
|
+
return /* @__PURE__ */ jsx68("div", { className: containerClasses, children: children(renderProps) });
|
|
9427
|
+
}
|
|
9428
|
+
if (!isFlowInitialized && isLoading) {
|
|
9429
|
+
return /* @__PURE__ */ jsx68(Card_default, { className: cx22(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx68(Card_default.Content, { children: /* @__PURE__ */ jsx68("div", { className: styles.loadingContainer, children: /* @__PURE__ */ jsx68(Spinner_default, { size: "medium" }) }) }) });
|
|
9430
|
+
}
|
|
9431
|
+
if (!currentFlow) {
|
|
9432
|
+
return /* @__PURE__ */ jsx68(Card_default, { className: cx22(containerClasses, styles.card), variant, children: /* @__PURE__ */ jsx68(Card_default.Content, { children: /* @__PURE__ */ jsxs29(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
9433
|
+
/* @__PURE__ */ jsx68(Alert_default.Title, { children: t("errors.heading") }),
|
|
9434
|
+
/* @__PURE__ */ jsx68(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
9435
|
+
] }) }) });
|
|
9436
|
+
}
|
|
9437
|
+
const componentsToRender = currentFlow.data?.components || [];
|
|
9438
|
+
const { title, subtitle, componentsWithoutHeadings } = getAuthComponentHeadings_default(
|
|
9439
|
+
componentsToRender,
|
|
9440
|
+
flowTitle,
|
|
9441
|
+
flowSubtitle,
|
|
9442
|
+
t("signup.heading"),
|
|
9443
|
+
t("signup.subheading")
|
|
9444
|
+
);
|
|
9445
|
+
return /* @__PURE__ */ jsxs29(Card_default, { className: cx22(containerClasses, styles.card), variant, children: [
|
|
9446
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ jsxs29(Card_default.Header, { className: styles.header, children: [
|
|
9447
|
+
showTitle && /* @__PURE__ */ jsx68(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
9448
|
+
showSubtitle && /* @__PURE__ */ jsx68(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
9449
|
+
] }),
|
|
9450
|
+
/* @__PURE__ */ jsxs29(Card_default.Content, { children: [
|
|
9451
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx68("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx68(
|
|
9452
|
+
Alert_default,
|
|
9453
|
+
{
|
|
9454
|
+
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
9455
|
+
className: cx22(styles.flowMessageItem, messageClasses),
|
|
9456
|
+
children: /* @__PURE__ */ jsx68(Alert_default.Description, { children: message.message })
|
|
9457
|
+
},
|
|
9458
|
+
message.id || index
|
|
9459
|
+
)) }),
|
|
9460
|
+
/* @__PURE__ */ jsx68("div", { className: styles.contentContainer, children: componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : /* @__PURE__ */ jsx68(Alert_default, { variant: "warning", children: /* @__PURE__ */ jsx68(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
9461
|
+
] })
|
|
9462
|
+
] });
|
|
9463
|
+
};
|
|
9464
|
+
var BaseSignUp_default2 = BaseSignUp2;
|
|
9465
|
+
|
|
9466
|
+
// src/components/presentation/auth/SignUp/BaseSignUp.tsx
|
|
9467
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
9468
|
+
var BaseSignUp3 = (props) => {
|
|
9469
|
+
const { platform } = useAsgardeo_default();
|
|
9470
|
+
if (platform === Platform5.AsgardeoV2) {
|
|
9471
|
+
return /* @__PURE__ */ jsx69(BaseSignUp_default2, { ...props });
|
|
9472
|
+
}
|
|
9473
|
+
return /* @__PURE__ */ jsx69(BaseSignUp_default, { ...props });
|
|
9474
|
+
};
|
|
9475
|
+
var BaseSignUp_default3 = BaseSignUp3;
|
|
9476
|
+
|
|
9477
|
+
// src/components/presentation/auth/SignUp/SignUp.tsx
|
|
9478
|
+
import { Platform as Platform6 } from "@asgardeo/browser";
|
|
9479
|
+
|
|
9480
|
+
// src/components/presentation/auth/SignUp/v1/SignUp.tsx
|
|
9481
|
+
import {
|
|
9482
|
+
EmbeddedFlowResponseType as EmbeddedFlowResponseType3,
|
|
9483
|
+
EmbeddedFlowType as EmbeddedFlowType2
|
|
9484
|
+
} from "@asgardeo/browser";
|
|
9485
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
9486
|
+
var SignUp = ({
|
|
9487
|
+
className,
|
|
9488
|
+
size = "medium",
|
|
9489
|
+
afterSignUpUrl,
|
|
9490
|
+
onError,
|
|
9491
|
+
onComplete,
|
|
9492
|
+
shouldRedirectAfterSignUp = true,
|
|
9493
|
+
children,
|
|
9494
|
+
...rest
|
|
9495
|
+
}) => {
|
|
9496
|
+
const { signUp, isInitialized } = useAsgardeo_default();
|
|
9497
|
+
const handleInitialize = async (payload) => {
|
|
9498
|
+
const initialPayload = payload || {
|
|
9499
|
+
flowType: EmbeddedFlowType2.Registration
|
|
9500
|
+
};
|
|
9501
|
+
return await signUp(initialPayload);
|
|
9502
|
+
};
|
|
9503
|
+
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
9504
|
+
const handleComplete = (response) => {
|
|
9505
|
+
onComplete?.(response);
|
|
9506
|
+
if (shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType3.Redirection && afterSignUpUrl) {
|
|
9507
|
+
window.location.href = afterSignUpUrl;
|
|
9508
|
+
}
|
|
9509
|
+
if (shouldRedirectAfterSignUp && response?.type === EmbeddedFlowResponseType3.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
9510
|
+
!response.data.redirectURL.includes("auth")) {
|
|
9511
|
+
window.location.href = response.data.redirectURL;
|
|
9512
|
+
}
|
|
9513
|
+
};
|
|
9514
|
+
return /* @__PURE__ */ jsx70(
|
|
9133
9515
|
BaseSignUp_default,
|
|
9134
9516
|
{
|
|
9135
9517
|
afterSignUpUrl,
|
|
@@ -9142,58 +9524,128 @@ var SignUp = ({
|
|
|
9142
9524
|
isInitialized,
|
|
9143
9525
|
children,
|
|
9144
9526
|
showLogo: true,
|
|
9145
|
-
showTitle:
|
|
9146
|
-
showSubtitle:
|
|
9527
|
+
showTitle: false,
|
|
9528
|
+
showSubtitle: false,
|
|
9147
9529
|
...rest
|
|
9148
9530
|
}
|
|
9149
9531
|
);
|
|
9150
9532
|
};
|
|
9151
9533
|
var SignUp_default = SignUp;
|
|
9152
9534
|
|
|
9535
|
+
// src/components/presentation/auth/SignUp/v2/SignUp.tsx
|
|
9536
|
+
import {
|
|
9537
|
+
EmbeddedFlowResponseType as EmbeddedFlowResponseType4,
|
|
9538
|
+
EmbeddedFlowType as EmbeddedFlowType3
|
|
9539
|
+
} from "@asgardeo/browser";
|
|
9540
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
9541
|
+
var SignUp2 = ({
|
|
9542
|
+
className,
|
|
9543
|
+
size = "medium",
|
|
9544
|
+
afterSignUpUrl,
|
|
9545
|
+
onError,
|
|
9546
|
+
onComplete,
|
|
9547
|
+
shouldRedirectAfterSignUp = true,
|
|
9548
|
+
children,
|
|
9549
|
+
...rest
|
|
9550
|
+
}) => {
|
|
9551
|
+
const { signUp, isInitialized, applicationId } = useAsgardeo_default();
|
|
9552
|
+
const handleInitialize = async (payload) => {
|
|
9553
|
+
const urlParams = new URL(window.location.href).searchParams;
|
|
9554
|
+
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
9555
|
+
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
9556
|
+
const initialPayload = payload || {
|
|
9557
|
+
flowType: EmbeddedFlowType3.Registration,
|
|
9558
|
+
...effectiveApplicationId && { applicationId: effectiveApplicationId }
|
|
9559
|
+
};
|
|
9560
|
+
return await signUp(initialPayload);
|
|
9561
|
+
};
|
|
9562
|
+
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
9563
|
+
const handleComplete = (response) => {
|
|
9564
|
+
onComplete?.(response);
|
|
9565
|
+
if (shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType4.Redirection && afterSignUpUrl) {
|
|
9566
|
+
window.location.href = afterSignUpUrl;
|
|
9567
|
+
}
|
|
9568
|
+
if (shouldRedirectAfterSignUp && response?.type === EmbeddedFlowResponseType4.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
9569
|
+
!response.data.redirectURL.includes("auth")) {
|
|
9570
|
+
window.location.href = response.data.redirectURL;
|
|
9571
|
+
}
|
|
9572
|
+
};
|
|
9573
|
+
return /* @__PURE__ */ jsx71(
|
|
9574
|
+
BaseSignUp_default2,
|
|
9575
|
+
{
|
|
9576
|
+
afterSignUpUrl,
|
|
9577
|
+
onInitialize: handleInitialize,
|
|
9578
|
+
onSubmit: handleOnSubmit,
|
|
9579
|
+
onError,
|
|
9580
|
+
onComplete: handleComplete,
|
|
9581
|
+
className,
|
|
9582
|
+
size,
|
|
9583
|
+
isInitialized,
|
|
9584
|
+
children,
|
|
9585
|
+
showLogo: true,
|
|
9586
|
+
showTitle: true,
|
|
9587
|
+
showSubtitle: true,
|
|
9588
|
+
...rest
|
|
9589
|
+
}
|
|
9590
|
+
);
|
|
9591
|
+
};
|
|
9592
|
+
var SignUp_default2 = SignUp2;
|
|
9593
|
+
|
|
9594
|
+
// src/components/presentation/auth/SignUp/SignUp.tsx
|
|
9595
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
9596
|
+
var SignUp3 = (props) => {
|
|
9597
|
+
const { platform } = useAsgardeo_default();
|
|
9598
|
+
if (platform === Platform6.AsgardeoV2) {
|
|
9599
|
+
return /* @__PURE__ */ jsx72(SignUp_default2, { ...props });
|
|
9600
|
+
}
|
|
9601
|
+
return /* @__PURE__ */ jsx72(SignUp_default, { ...props });
|
|
9602
|
+
};
|
|
9603
|
+
var SignUp_default3 = SignUp3;
|
|
9604
|
+
|
|
9153
9605
|
// src/components/presentation/User/BaseUser.tsx
|
|
9154
|
-
import { Fragment as Fragment13, jsx as
|
|
9606
|
+
import { Fragment as Fragment13, jsx as jsx73 } from "react/jsx-runtime";
|
|
9155
9607
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
9156
9608
|
if (!user) {
|
|
9157
|
-
return /* @__PURE__ */
|
|
9609
|
+
return /* @__PURE__ */ jsx73(Fragment13, { children: fallback });
|
|
9158
9610
|
}
|
|
9159
|
-
return /* @__PURE__ */
|
|
9611
|
+
return /* @__PURE__ */ jsx73(Fragment13, { children: children(user) });
|
|
9160
9612
|
};
|
|
9161
9613
|
BaseUser.displayName = "BaseUser";
|
|
9162
9614
|
var BaseUser_default = BaseUser;
|
|
9163
9615
|
|
|
9164
9616
|
// src/components/presentation/User/User.tsx
|
|
9165
|
-
import { jsx as
|
|
9617
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
9166
9618
|
var User5 = ({ children, fallback = null }) => {
|
|
9167
9619
|
const { user } = useAsgardeo_default();
|
|
9168
|
-
return /* @__PURE__ */
|
|
9620
|
+
return /* @__PURE__ */ jsx74(BaseUser_default, { user, fallback, children });
|
|
9169
9621
|
};
|
|
9170
9622
|
User5.displayName = "User";
|
|
9171
9623
|
var User_default = User5;
|
|
9172
9624
|
|
|
9173
9625
|
// src/components/presentation/Organization/BaseOrganization.tsx
|
|
9174
|
-
import { Fragment as Fragment14, jsx as
|
|
9626
|
+
import { Fragment as Fragment14, jsx as jsx75 } from "react/jsx-runtime";
|
|
9175
9627
|
var BaseOrganization = ({ children, fallback = null, organization }) => {
|
|
9176
9628
|
if (!organization) {
|
|
9177
|
-
return /* @__PURE__ */
|
|
9629
|
+
return /* @__PURE__ */ jsx75(Fragment14, { children: fallback });
|
|
9178
9630
|
}
|
|
9179
|
-
return /* @__PURE__ */
|
|
9631
|
+
return /* @__PURE__ */ jsx75(Fragment14, { children: children(organization) });
|
|
9180
9632
|
};
|
|
9181
9633
|
BaseOrganization.displayName = "BaseOrganization";
|
|
9182
9634
|
var BaseOrganization_default = BaseOrganization;
|
|
9183
9635
|
|
|
9184
9636
|
// src/components/presentation/Organization/Organization.tsx
|
|
9185
|
-
import { jsx as
|
|
9637
|
+
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
9186
9638
|
var Organization5 = ({ children, fallback = null }) => {
|
|
9187
9639
|
const { currentOrganization } = useOrganization_default();
|
|
9188
|
-
return /* @__PURE__ */
|
|
9640
|
+
return /* @__PURE__ */ jsx76(BaseOrganization_default, { organization: currentOrganization, fallback, children });
|
|
9189
9641
|
};
|
|
9190
9642
|
Organization5.displayName = "Organization";
|
|
9191
9643
|
var Organization_default = Organization5;
|
|
9192
9644
|
|
|
9193
9645
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
9194
|
-
import { withVendorCSSClassPrefix as
|
|
9195
|
-
import { cx as
|
|
9196
|
-
import { useState as
|
|
9646
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix27, WellKnownSchemaIds, bem as bem19 } from "@asgardeo/browser";
|
|
9647
|
+
import { cx as cx26 } from "@emotion/css";
|
|
9648
|
+
import { useState as useState20, useCallback as useCallback14 } from "react";
|
|
9197
9649
|
|
|
9198
9650
|
// src/utils/getMappedUserProfileValue.ts
|
|
9199
9651
|
import { get } from "@asgardeo/browser";
|
|
@@ -9219,8 +9671,8 @@ var getMappedUserProfileValue = (key, mappings, user) => {
|
|
|
9219
9671
|
var getMappedUserProfileValue_default = getMappedUserProfileValue;
|
|
9220
9672
|
|
|
9221
9673
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9222
|
-
import { withVendorCSSClassPrefix as
|
|
9223
|
-
import { cx as
|
|
9674
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix23, bem as bem16 } from "@asgardeo/browser";
|
|
9675
|
+
import { cx as cx23 } from "@emotion/css";
|
|
9224
9676
|
import { useMemo as useMemo26 } from "react";
|
|
9225
9677
|
|
|
9226
9678
|
// src/components/primitives/Avatar/Avatar.styles.ts
|
|
@@ -9291,7 +9743,7 @@ var useStyles18 = (theme, colorScheme, size, variant, backgroundColor) => {
|
|
|
9291
9743
|
var Avatar_styles_default = useStyles18;
|
|
9292
9744
|
|
|
9293
9745
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9294
|
-
import { jsx as
|
|
9746
|
+
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
9295
9747
|
var Avatar = ({
|
|
9296
9748
|
alt = "User avatar",
|
|
9297
9749
|
background = "random",
|
|
@@ -9338,33 +9790,33 @@ var Avatar = ({
|
|
|
9338
9790
|
const getInitials = (fullName) => fullName.split(" ").map((part) => part[0]).slice(0, 2).join("").toUpperCase();
|
|
9339
9791
|
const renderContent = () => {
|
|
9340
9792
|
if (imageUrl) {
|
|
9341
|
-
return /* @__PURE__ */
|
|
9793
|
+
return /* @__PURE__ */ jsx77("img", { src: imageUrl, alt, className: cx23(withVendorCSSClassPrefix23(bem16("avatar", "image")), styles.image) });
|
|
9342
9794
|
}
|
|
9343
9795
|
if (name) {
|
|
9344
9796
|
return getInitials(name);
|
|
9345
9797
|
}
|
|
9346
9798
|
if (isLoading) {
|
|
9347
|
-
return /* @__PURE__ */
|
|
9799
|
+
return /* @__PURE__ */ jsx77("div", { className: cx23(withVendorCSSClassPrefix23(bem16("avatar", "skeleton")), styles.skeleton) });
|
|
9348
9800
|
}
|
|
9349
|
-
return /* @__PURE__ */
|
|
9801
|
+
return /* @__PURE__ */ jsx77(
|
|
9350
9802
|
"svg",
|
|
9351
9803
|
{
|
|
9352
9804
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9353
9805
|
viewBox: "0 0 640 640",
|
|
9354
|
-
className:
|
|
9355
|
-
children: /* @__PURE__ */
|
|
9806
|
+
className: cx23(withVendorCSSClassPrefix23(bem16("avatar", "icon")), styles.icon),
|
|
9807
|
+
children: /* @__PURE__ */ jsx77("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
9356
9808
|
}
|
|
9357
9809
|
);
|
|
9358
9810
|
};
|
|
9359
|
-
return /* @__PURE__ */
|
|
9811
|
+
return /* @__PURE__ */ jsx77(
|
|
9360
9812
|
"div",
|
|
9361
9813
|
{
|
|
9362
|
-
className:
|
|
9363
|
-
|
|
9814
|
+
className: cx23(
|
|
9815
|
+
withVendorCSSClassPrefix23(bem16("avatar")),
|
|
9364
9816
|
styles.avatar,
|
|
9365
9817
|
styles.variant,
|
|
9366
|
-
|
|
9367
|
-
isDefaultState &&
|
|
9818
|
+
withVendorCSSClassPrefix23(bem16("avatar", null, variant)),
|
|
9819
|
+
isDefaultState && withVendorCSSClassPrefix23(bem16("avatar", "default")),
|
|
9368
9820
|
className
|
|
9369
9821
|
),
|
|
9370
9822
|
children: renderContent()
|
|
@@ -9374,7 +9826,7 @@ var Avatar = ({
|
|
|
9374
9826
|
var Avatar_default = Avatar;
|
|
9375
9827
|
|
|
9376
9828
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9377
|
-
import { withVendorCSSClassPrefix as
|
|
9829
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix24, bem as bem17 } from "@asgardeo/browser";
|
|
9378
9830
|
import {
|
|
9379
9831
|
useFloating,
|
|
9380
9832
|
useClick,
|
|
@@ -9387,12 +9839,12 @@ import {
|
|
|
9387
9839
|
FloatingPortal,
|
|
9388
9840
|
useId
|
|
9389
9841
|
} from "@floating-ui/react";
|
|
9390
|
-
import { cx as
|
|
9842
|
+
import { cx as cx24 } from "@emotion/css";
|
|
9391
9843
|
import React2 from "react";
|
|
9392
9844
|
|
|
9393
9845
|
// src/components/primitives/Icons/LogOut.tsx
|
|
9394
|
-
import { jsx as
|
|
9395
|
-
var LogOut = (props) => /* @__PURE__ */
|
|
9846
|
+
import { jsx as jsx78, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9847
|
+
var LogOut = (props) => /* @__PURE__ */ jsxs30(
|
|
9396
9848
|
"svg",
|
|
9397
9849
|
{
|
|
9398
9850
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9406,17 +9858,17 @@ var LogOut = (props) => /* @__PURE__ */ jsxs29(
|
|
|
9406
9858
|
strokeLinejoin: "round",
|
|
9407
9859
|
...props,
|
|
9408
9860
|
children: [
|
|
9409
|
-
/* @__PURE__ */
|
|
9410
|
-
/* @__PURE__ */
|
|
9411
|
-
/* @__PURE__ */
|
|
9861
|
+
/* @__PURE__ */ jsx78("path", { d: "m16 17 5-5-5-5" }),
|
|
9862
|
+
/* @__PURE__ */ jsx78("path", { d: "M21 12H9" }),
|
|
9863
|
+
/* @__PURE__ */ jsx78("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" })
|
|
9412
9864
|
]
|
|
9413
9865
|
}
|
|
9414
9866
|
);
|
|
9415
9867
|
var LogOut_default = LogOut;
|
|
9416
9868
|
|
|
9417
9869
|
// src/components/primitives/Icons/Plus.tsx
|
|
9418
|
-
import { jsx as
|
|
9419
|
-
var Plus = (props) => /* @__PURE__ */
|
|
9870
|
+
import { jsx as jsx79, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9871
|
+
var Plus = (props) => /* @__PURE__ */ jsxs31(
|
|
9420
9872
|
"svg",
|
|
9421
9873
|
{
|
|
9422
9874
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9430,16 +9882,16 @@ var Plus = (props) => /* @__PURE__ */ jsxs30(
|
|
|
9430
9882
|
strokeLinejoin: "round",
|
|
9431
9883
|
...props,
|
|
9432
9884
|
children: [
|
|
9433
|
-
/* @__PURE__ */
|
|
9434
|
-
/* @__PURE__ */
|
|
9885
|
+
/* @__PURE__ */ jsx79("path", { d: "M5 12h14" }),
|
|
9886
|
+
/* @__PURE__ */ jsx79("path", { d: "M12 5v14" })
|
|
9435
9887
|
]
|
|
9436
9888
|
}
|
|
9437
9889
|
);
|
|
9438
9890
|
var Plus_default = Plus;
|
|
9439
9891
|
|
|
9440
9892
|
// src/components/primitives/Icons/User.tsx
|
|
9441
|
-
import { jsx as
|
|
9442
|
-
var User7 = (props) => /* @__PURE__ */
|
|
9893
|
+
import { jsx as jsx80, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9894
|
+
var User7 = (props) => /* @__PURE__ */ jsxs32(
|
|
9443
9895
|
"svg",
|
|
9444
9896
|
{
|
|
9445
9897
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9453,16 +9905,16 @@ var User7 = (props) => /* @__PURE__ */ jsxs31(
|
|
|
9453
9905
|
strokeLinejoin: "round",
|
|
9454
9906
|
...props,
|
|
9455
9907
|
children: [
|
|
9456
|
-
/* @__PURE__ */
|
|
9457
|
-
/* @__PURE__ */
|
|
9908
|
+
/* @__PURE__ */ jsx80("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
9909
|
+
/* @__PURE__ */ jsx80("circle", { cx: "12", cy: "7", r: "4" })
|
|
9458
9910
|
]
|
|
9459
9911
|
}
|
|
9460
9912
|
);
|
|
9461
9913
|
var User_default2 = User7;
|
|
9462
9914
|
|
|
9463
9915
|
// src/components/primitives/Icons/X.tsx
|
|
9464
|
-
import { jsx as
|
|
9465
|
-
var X = (props) => /* @__PURE__ */
|
|
9916
|
+
import { jsx as jsx81, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9917
|
+
var X = (props) => /* @__PURE__ */ jsxs33(
|
|
9466
9918
|
"svg",
|
|
9467
9919
|
{
|
|
9468
9920
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9476,8 +9928,8 @@ var X = (props) => /* @__PURE__ */ jsxs32(
|
|
|
9476
9928
|
strokeLinejoin: "round",
|
|
9477
9929
|
...props,
|
|
9478
9930
|
children: [
|
|
9479
|
-
/* @__PURE__ */
|
|
9480
|
-
/* @__PURE__ */
|
|
9931
|
+
/* @__PURE__ */ jsx81("path", { d: "M18 6 6 18" }),
|
|
9932
|
+
/* @__PURE__ */ jsx81("path", { d: "m6 6 12 12" })
|
|
9481
9933
|
]
|
|
9482
9934
|
}
|
|
9483
9935
|
);
|
|
@@ -9549,7 +10001,7 @@ var useStyles19 = (theme, colorScheme) => {
|
|
|
9549
10001
|
var Dialog_styles_default = useStyles19;
|
|
9550
10002
|
|
|
9551
10003
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9552
|
-
import { jsx as
|
|
10004
|
+
import { jsx as jsx82, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9553
10005
|
function useDialog({
|
|
9554
10006
|
initialOpen = false,
|
|
9555
10007
|
open: controlledOpen,
|
|
@@ -9595,7 +10047,7 @@ var useDialogContext = () => {
|
|
|
9595
10047
|
};
|
|
9596
10048
|
function Dialog({ children, ...options }) {
|
|
9597
10049
|
const dialog = useDialog(options);
|
|
9598
|
-
return /* @__PURE__ */
|
|
10050
|
+
return /* @__PURE__ */ jsx82(DialogContext.Provider, { value: dialog, children });
|
|
9599
10051
|
}
|
|
9600
10052
|
var DialogTrigger = React2.forwardRef(
|
|
9601
10053
|
({ children, asChild = false, ...props }, propRef) => {
|
|
@@ -9613,7 +10065,7 @@ var DialogTrigger = React2.forwardRef(
|
|
|
9613
10065
|
})
|
|
9614
10066
|
);
|
|
9615
10067
|
}
|
|
9616
|
-
return /* @__PURE__ */
|
|
10068
|
+
return /* @__PURE__ */ jsx82("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
9617
10069
|
}
|
|
9618
10070
|
);
|
|
9619
10071
|
var DialogContent = React2.forwardRef((props, propRef) => {
|
|
@@ -9622,11 +10074,11 @@ var DialogContent = React2.forwardRef((props, propRef) => {
|
|
|
9622
10074
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
9623
10075
|
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
9624
10076
|
if (!floatingContext.open) return null;
|
|
9625
|
-
return /* @__PURE__ */
|
|
10077
|
+
return /* @__PURE__ */ jsx82(FloatingPortal, { children: /* @__PURE__ */ jsx82(FloatingOverlay, { className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "overlay")), styles.overlay), lockScroll: true, children: /* @__PURE__ */ jsx82(FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ jsx82(
|
|
9626
10078
|
"div",
|
|
9627
10079
|
{
|
|
9628
10080
|
ref,
|
|
9629
|
-
className:
|
|
10081
|
+
className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "content")), styles.content, props.className),
|
|
9630
10082
|
"aria-labelledby": context.labelId,
|
|
9631
10083
|
"aria-describedby": context.descriptionId,
|
|
9632
10084
|
...context.getFloatingProps(props),
|
|
@@ -9644,18 +10096,18 @@ var DialogHeading = React2.forwardRef(
|
|
|
9644
10096
|
context.setLabelId(id);
|
|
9645
10097
|
return () => context.setLabelId(void 0);
|
|
9646
10098
|
}, [id, context.setLabelId]);
|
|
9647
|
-
return /* @__PURE__ */
|
|
9648
|
-
/* @__PURE__ */
|
|
10099
|
+
return /* @__PURE__ */ jsxs34("div", { className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "header")), styles.header), children: [
|
|
10100
|
+
/* @__PURE__ */ jsx82(
|
|
9649
10101
|
"h2",
|
|
9650
10102
|
{
|
|
9651
10103
|
...props,
|
|
9652
10104
|
ref,
|
|
9653
10105
|
id,
|
|
9654
|
-
className:
|
|
10106
|
+
className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "title")), styles.headerTitle),
|
|
9655
10107
|
children
|
|
9656
10108
|
}
|
|
9657
10109
|
),
|
|
9658
|
-
/* @__PURE__ */
|
|
10110
|
+
/* @__PURE__ */ jsx82(
|
|
9659
10111
|
Button_default,
|
|
9660
10112
|
{
|
|
9661
10113
|
color: "tertiary",
|
|
@@ -9664,7 +10116,7 @@ var DialogHeading = React2.forwardRef(
|
|
|
9664
10116
|
shape: "round",
|
|
9665
10117
|
onClick: () => context.setOpen(false),
|
|
9666
10118
|
"aria-label": "Close",
|
|
9667
|
-
children: /* @__PURE__ */
|
|
10119
|
+
children: /* @__PURE__ */ jsx82(X_default, { width: 16, height: 16 })
|
|
9668
10120
|
}
|
|
9669
10121
|
)
|
|
9670
10122
|
] });
|
|
@@ -9680,13 +10132,13 @@ var DialogDescription = React2.forwardRef(
|
|
|
9680
10132
|
context.setDescriptionId(id);
|
|
9681
10133
|
return () => context.setDescriptionId(void 0);
|
|
9682
10134
|
}, [id, context.setDescriptionId]);
|
|
9683
|
-
return /* @__PURE__ */
|
|
10135
|
+
return /* @__PURE__ */ jsx82(
|
|
9684
10136
|
"p",
|
|
9685
10137
|
{
|
|
9686
10138
|
...props,
|
|
9687
10139
|
ref,
|
|
9688
10140
|
id,
|
|
9689
|
-
className:
|
|
10141
|
+
className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "description")), styles.description, props.className),
|
|
9690
10142
|
children
|
|
9691
10143
|
}
|
|
9692
10144
|
);
|
|
@@ -9710,13 +10162,13 @@ var DialogClose = React2.forwardRef(({ children, asChild = false, ...props }, pr
|
|
|
9710
10162
|
onClick: handleClick
|
|
9711
10163
|
});
|
|
9712
10164
|
}
|
|
9713
|
-
return /* @__PURE__ */
|
|
10165
|
+
return /* @__PURE__ */ jsx82(
|
|
9714
10166
|
Button_default,
|
|
9715
10167
|
{
|
|
9716
10168
|
...props,
|
|
9717
10169
|
ref,
|
|
9718
10170
|
onClick: handleClick,
|
|
9719
|
-
className:
|
|
10171
|
+
className: cx24(withVendorCSSClassPrefix24(bem17("dialog", "close")), props.className),
|
|
9720
10172
|
variant: "text",
|
|
9721
10173
|
children
|
|
9722
10174
|
}
|
|
@@ -9735,9 +10187,9 @@ Dialog.Close = DialogClose;
|
|
|
9735
10187
|
var Dialog_default = Dialog;
|
|
9736
10188
|
|
|
9737
10189
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9738
|
-
import { useCallback as
|
|
9739
|
-
import { cx as
|
|
9740
|
-
import { withVendorCSSClassPrefix as
|
|
10190
|
+
import { useCallback as useCallback13, useState as useState19 } from "react";
|
|
10191
|
+
import { cx as cx25 } from "@emotion/css";
|
|
10192
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix25, bem as bem18 } from "@asgardeo/browser";
|
|
9741
10193
|
|
|
9742
10194
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
9743
10195
|
import { css as css20 } from "@emotion/css";
|
|
@@ -9833,7 +10285,7 @@ var useStyles20 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove
|
|
|
9833
10285
|
var MultiInput_styles_default = useStyles20;
|
|
9834
10286
|
|
|
9835
10287
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9836
|
-
import { jsx as
|
|
10288
|
+
import { jsx as jsx83, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9837
10289
|
var MultiInput = ({
|
|
9838
10290
|
label,
|
|
9839
10291
|
error,
|
|
@@ -9856,9 +10308,9 @@ var MultiInput = ({
|
|
|
9856
10308
|
const canAddMore = !maxFields || values.length < maxFields;
|
|
9857
10309
|
const canRemove = values.length > minFields;
|
|
9858
10310
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
9859
|
-
const PlusIcon = ({ className: className2 }) => /* @__PURE__ */
|
|
9860
|
-
const BinIcon = ({ className: className2 }) => /* @__PURE__ */
|
|
9861
|
-
const handleAddValue =
|
|
10311
|
+
const PlusIcon = ({ className: className2 }) => /* @__PURE__ */ jsx83("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: cx25(styles.icon, className2), children: /* @__PURE__ */ jsx83("path", { d: "M12 5v14M5 12h14" }) });
|
|
10312
|
+
const BinIcon = ({ className: className2 }) => /* @__PURE__ */ jsx83("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: cx25(styles.icon, className2), children: /* @__PURE__ */ jsx83("path", { d: "M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6" }) });
|
|
10313
|
+
const handleAddValue = useCallback13(
|
|
9862
10314
|
(newValue) => {
|
|
9863
10315
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
9864
10316
|
onChange([...values, newValue.trim()]);
|
|
@@ -9866,7 +10318,7 @@ var MultiInput = ({
|
|
|
9866
10318
|
},
|
|
9867
10319
|
[values, onChange, maxFields]
|
|
9868
10320
|
);
|
|
9869
|
-
const handleRemoveValue =
|
|
10321
|
+
const handleRemoveValue = useCallback13(
|
|
9870
10322
|
(index) => {
|
|
9871
10323
|
if (values.length > minFields) {
|
|
9872
10324
|
const updatedValues = values.filter((_, i) => i !== index);
|
|
@@ -9875,7 +10327,7 @@ var MultiInput = ({
|
|
|
9875
10327
|
},
|
|
9876
10328
|
[values, onChange, minFields]
|
|
9877
10329
|
);
|
|
9878
|
-
const renderInputField =
|
|
10330
|
+
const renderInputField = useCallback13(
|
|
9879
10331
|
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
9880
10332
|
const handleInputChange = (e) => {
|
|
9881
10333
|
const newValue = e.target ? e.target.value : e;
|
|
@@ -9901,9 +10353,9 @@ var MultiInput = ({
|
|
|
9901
10353
|
};
|
|
9902
10354
|
switch (fieldType) {
|
|
9903
10355
|
case "DATE_TIME":
|
|
9904
|
-
return /* @__PURE__ */
|
|
10356
|
+
return /* @__PURE__ */ jsx83(DatePicker_default, { ...commonProps });
|
|
9905
10357
|
case "BOOLEAN":
|
|
9906
|
-
return /* @__PURE__ */
|
|
10358
|
+
return /* @__PURE__ */ jsx83(
|
|
9907
10359
|
Checkbox_default,
|
|
9908
10360
|
{
|
|
9909
10361
|
...commonProps,
|
|
@@ -9912,55 +10364,55 @@ var MultiInput = ({
|
|
|
9912
10364
|
}
|
|
9913
10365
|
);
|
|
9914
10366
|
default:
|
|
9915
|
-
return /* @__PURE__ */
|
|
10367
|
+
return /* @__PURE__ */ jsx83(TextField_default, { ...commonProps, type });
|
|
9916
10368
|
}
|
|
9917
10369
|
},
|
|
9918
10370
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
9919
10371
|
);
|
|
9920
|
-
const [currentInputValue, setCurrentInputValue] =
|
|
9921
|
-
const handleInputSubmit =
|
|
10372
|
+
const [currentInputValue, setCurrentInputValue] = useState19("");
|
|
10373
|
+
const handleInputSubmit = useCallback13(() => {
|
|
9922
10374
|
if (currentInputValue.trim() !== "") {
|
|
9923
10375
|
handleAddValue(currentInputValue);
|
|
9924
10376
|
setCurrentInputValue("");
|
|
9925
10377
|
}
|
|
9926
10378
|
}, [currentInputValue, handleAddValue]);
|
|
9927
|
-
return /* @__PURE__ */
|
|
10379
|
+
return /* @__PURE__ */ jsxs35(
|
|
9928
10380
|
FormControl_default,
|
|
9929
10381
|
{
|
|
9930
10382
|
error,
|
|
9931
10383
|
helperText,
|
|
9932
|
-
className:
|
|
10384
|
+
className: cx25(withVendorCSSClassPrefix25(bem18("multi-input")), className),
|
|
9933
10385
|
style,
|
|
9934
10386
|
children: [
|
|
9935
|
-
label && /* @__PURE__ */
|
|
9936
|
-
/* @__PURE__ */
|
|
9937
|
-
/* @__PURE__ */
|
|
10387
|
+
label && /* @__PURE__ */ jsx83(InputLabel_default, { required, error: !!error, children: label }),
|
|
10388
|
+
/* @__PURE__ */ jsxs35("div", { className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "container")), styles.container), children: [
|
|
10389
|
+
/* @__PURE__ */ jsx83("div", { className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "input-row")), styles.inputRow), children: /* @__PURE__ */ jsx83("div", { className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "input-wrapper")), styles.inputWrapper), children: renderInputField(
|
|
9938
10390
|
currentInputValue,
|
|
9939
10391
|
setCurrentInputValue,
|
|
9940
|
-
canAddMore ? /* @__PURE__ */
|
|
10392
|
+
canAddMore ? /* @__PURE__ */ jsx83(PlusIcon, { className: styles.plusIcon }) : void 0,
|
|
9941
10393
|
canAddMore ? handleInputSubmit : void 0
|
|
9942
10394
|
) }) }),
|
|
9943
|
-
values.length > 0 && /* @__PURE__ */
|
|
10395
|
+
values.length > 0 && /* @__PURE__ */ jsx83("div", { className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "list-container")), styles.listContainer), children: values.map((value, index) => /* @__PURE__ */ jsxs35(
|
|
9944
10396
|
"div",
|
|
9945
10397
|
{
|
|
9946
|
-
className:
|
|
10398
|
+
className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "list-item")), styles.listItem),
|
|
9947
10399
|
children: [
|
|
9948
|
-
/* @__PURE__ */
|
|
10400
|
+
/* @__PURE__ */ jsx83(
|
|
9949
10401
|
"span",
|
|
9950
10402
|
{
|
|
9951
|
-
className:
|
|
10403
|
+
className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "list-item-text")), styles.listItemText),
|
|
9952
10404
|
children: value
|
|
9953
10405
|
}
|
|
9954
10406
|
),
|
|
9955
|
-
canRemove && /* @__PURE__ */
|
|
10407
|
+
canRemove && /* @__PURE__ */ jsx83(
|
|
9956
10408
|
"button",
|
|
9957
10409
|
{
|
|
9958
10410
|
type: "button",
|
|
9959
10411
|
onClick: () => handleRemoveValue(index),
|
|
9960
10412
|
disabled,
|
|
9961
|
-
className:
|
|
10413
|
+
className: cx25(withVendorCSSClassPrefix25(bem18("multi-input", "remove-button")), styles.removeButton),
|
|
9962
10414
|
title: "Remove value",
|
|
9963
|
-
children: /* @__PURE__ */
|
|
10415
|
+
children: /* @__PURE__ */ jsx83(BinIcon, { className: styles.icon })
|
|
9964
10416
|
}
|
|
9965
10417
|
)
|
|
9966
10418
|
]
|
|
@@ -9977,7 +10429,7 @@ var MultiInput_default = MultiInput;
|
|
|
9977
10429
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
9978
10430
|
import { css as css21 } from "@emotion/css";
|
|
9979
10431
|
import { useMemo as useMemo29 } from "react";
|
|
9980
|
-
import { withVendorCSSClassPrefix as
|
|
10432
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix26 } from "@asgardeo/browser";
|
|
9981
10433
|
var useStyles21 = (theme, colorScheme) => {
|
|
9982
10434
|
const valuePlaceholder = css21`
|
|
9983
10435
|
font-style: italic;
|
|
@@ -10088,7 +10540,7 @@ var useStyles21 = (theme, colorScheme) => {
|
|
|
10088
10540
|
max-width: 350px;
|
|
10089
10541
|
text-align: start;
|
|
10090
10542
|
|
|
10091
|
-
.${
|
|
10543
|
+
.${withVendorCSSClassPrefix26("form-control")} {
|
|
10092
10544
|
margin-bottom: 0;
|
|
10093
10545
|
}
|
|
10094
10546
|
|
|
@@ -10159,7 +10611,7 @@ var getDisplayName = (mergedMappings, user) => {
|
|
|
10159
10611
|
var getDisplayName_default = getDisplayName;
|
|
10160
10612
|
|
|
10161
10613
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
10162
|
-
import { Fragment as Fragment15, jsx as
|
|
10614
|
+
import { Fragment as Fragment15, jsx as jsx84, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10163
10615
|
var fieldsToSkip = [
|
|
10164
10616
|
"roles.default",
|
|
10165
10617
|
"active",
|
|
@@ -10201,10 +10653,10 @@ var BaseUserProfile = ({
|
|
|
10201
10653
|
hideFields = []
|
|
10202
10654
|
}) => {
|
|
10203
10655
|
const { theme, colorScheme } = useTheme_default();
|
|
10204
|
-
const [editedUser, setEditedUser] =
|
|
10205
|
-
const [editingFields, setEditingFields] =
|
|
10656
|
+
const [editedUser, setEditedUser] = useState20(flattenedProfile || profile);
|
|
10657
|
+
const [editingFields, setEditingFields] = useState20({});
|
|
10206
10658
|
const { t } = useTranslation_default();
|
|
10207
|
-
const shouldShowField =
|
|
10659
|
+
const shouldShowField = useCallback14(
|
|
10208
10660
|
(fieldName) => {
|
|
10209
10661
|
if (fieldsToSkip.includes(fieldName)) {
|
|
10210
10662
|
return false;
|
|
@@ -10219,7 +10671,7 @@ var BaseUserProfile = ({
|
|
|
10219
10671
|
},
|
|
10220
10672
|
[showFields, hideFields]
|
|
10221
10673
|
);
|
|
10222
|
-
const PencilIcon = () => /* @__PURE__ */
|
|
10674
|
+
const PencilIcon = () => /* @__PURE__ */ jsx84(
|
|
10223
10675
|
"svg",
|
|
10224
10676
|
{
|
|
10225
10677
|
width: "16",
|
|
@@ -10230,16 +10682,16 @@ var BaseUserProfile = ({
|
|
|
10230
10682
|
strokeWidth: "2",
|
|
10231
10683
|
strokeLinecap: "round",
|
|
10232
10684
|
strokeLinejoin: "round",
|
|
10233
|
-
children: /* @__PURE__ */
|
|
10685
|
+
children: /* @__PURE__ */ jsx84("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
10234
10686
|
}
|
|
10235
10687
|
);
|
|
10236
|
-
const toggleFieldEdit =
|
|
10688
|
+
const toggleFieldEdit = useCallback14((fieldName) => {
|
|
10237
10689
|
setEditingFields((prev) => ({
|
|
10238
10690
|
...prev,
|
|
10239
10691
|
[fieldName]: !prev[fieldName]
|
|
10240
10692
|
}));
|
|
10241
10693
|
}, []);
|
|
10242
|
-
const getFieldPlaceholder =
|
|
10694
|
+
const getFieldPlaceholder = useCallback14((schema) => {
|
|
10243
10695
|
const { type, displayName, description, name } = schema;
|
|
10244
10696
|
const fieldLabel = displayName || description || name || "value";
|
|
10245
10697
|
switch (type) {
|
|
@@ -10255,12 +10707,12 @@ var BaseUserProfile = ({
|
|
|
10255
10707
|
}, []);
|
|
10256
10708
|
const ObjectDisplay = ({ data }) => {
|
|
10257
10709
|
if (!data || typeof data !== "object") return null;
|
|
10258
|
-
return /* @__PURE__ */
|
|
10259
|
-
/* @__PURE__ */
|
|
10710
|
+
return /* @__PURE__ */ jsx84("table", { className: styles.value, children: /* @__PURE__ */ jsx84("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ jsxs36("tr", { children: [
|
|
10711
|
+
/* @__PURE__ */ jsx84("td", { className: styles.objectKey, children: /* @__PURE__ */ jsxs36("strong", { children: [
|
|
10260
10712
|
formatLabel(key),
|
|
10261
10713
|
":"
|
|
10262
10714
|
] }) }),
|
|
10263
|
-
/* @__PURE__ */
|
|
10715
|
+
/* @__PURE__ */ jsx84("td", { className: styles.objectValue, children: typeof value === "object" ? /* @__PURE__ */ jsx84(ObjectDisplay, { data: value }) : String(value) })
|
|
10264
10716
|
] }, key)) }) });
|
|
10265
10717
|
};
|
|
10266
10718
|
function set(obj, path, value) {
|
|
@@ -10278,7 +10730,7 @@ var BaseUserProfile = ({
|
|
|
10278
10730
|
}
|
|
10279
10731
|
}
|
|
10280
10732
|
}
|
|
10281
|
-
const handleFieldSave =
|
|
10733
|
+
const handleFieldSave = useCallback14(
|
|
10282
10734
|
(schema) => {
|
|
10283
10735
|
if (!onUpdate || !schema.name) return;
|
|
10284
10736
|
const fieldName = schema.name;
|
|
@@ -10301,7 +10753,7 @@ var BaseUserProfile = ({
|
|
|
10301
10753
|
},
|
|
10302
10754
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
10303
10755
|
);
|
|
10304
|
-
const handleFieldCancel =
|
|
10756
|
+
const handleFieldCancel = useCallback14(
|
|
10305
10757
|
(fieldName) => {
|
|
10306
10758
|
const currentUser2 = flattenedProfile || profile;
|
|
10307
10759
|
setEditedUser((prev) => ({
|
|
@@ -10312,7 +10764,7 @@ var BaseUserProfile = ({
|
|
|
10312
10764
|
},
|
|
10313
10765
|
[flattenedProfile, profile, toggleFieldEdit]
|
|
10314
10766
|
);
|
|
10315
|
-
const formatLabel =
|
|
10767
|
+
const formatLabel = useCallback14(
|
|
10316
10768
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
10317
10769
|
[]
|
|
10318
10770
|
);
|
|
@@ -10333,9 +10785,9 @@ var BaseUserProfile = ({
|
|
|
10333
10785
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
10334
10786
|
const label = displayName || description || name || "";
|
|
10335
10787
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
10336
|
-
return /* @__PURE__ */
|
|
10337
|
-
/* @__PURE__ */
|
|
10338
|
-
/* @__PURE__ */
|
|
10788
|
+
return /* @__PURE__ */ jsx84(Fragment15, { children: subAttributes.map((subAttr, index) => /* @__PURE__ */ jsxs36("div", { className: styles.field, children: [
|
|
10789
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
10790
|
+
/* @__PURE__ */ jsx84("div", { className: styles.value, children: Array.isArray(subAttr.value) ? subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ") : typeof subAttr.value === "object" ? JSON.stringify(subAttr.value) : String(subAttr.value) })
|
|
10339
10791
|
] }, index)) });
|
|
10340
10792
|
}
|
|
10341
10793
|
if (Array.isArray(value) || multiValued) {
|
|
@@ -10351,9 +10803,9 @@ var BaseUserProfile = ({
|
|
|
10351
10803
|
} else {
|
|
10352
10804
|
fieldValues = [];
|
|
10353
10805
|
}
|
|
10354
|
-
return /* @__PURE__ */
|
|
10355
|
-
/* @__PURE__ */
|
|
10356
|
-
/* @__PURE__ */
|
|
10806
|
+
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
10807
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: label }),
|
|
10808
|
+
/* @__PURE__ */ jsx84("div", { className: styles.value, children: /* @__PURE__ */ jsx84(
|
|
10357
10809
|
MultiInput_default,
|
|
10358
10810
|
{
|
|
10359
10811
|
values: fieldValues,
|
|
@@ -10384,9 +10836,9 @@ var BaseUserProfile = ({
|
|
|
10384
10836
|
} else {
|
|
10385
10837
|
displayValue2 = "-";
|
|
10386
10838
|
}
|
|
10387
|
-
return /* @__PURE__ */
|
|
10388
|
-
/* @__PURE__ */
|
|
10389
|
-
/* @__PURE__ */
|
|
10839
|
+
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
10840
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: label }),
|
|
10841
|
+
/* @__PURE__ */ jsx84("div", { className: cx26(styles.value, !hasValues ? styles.valuePlaceholder : ""), children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ jsx84(
|
|
10390
10842
|
Button_default,
|
|
10391
10843
|
{
|
|
10392
10844
|
onClick: onStartEdit,
|
|
@@ -10401,7 +10853,7 @@ var BaseUserProfile = ({
|
|
|
10401
10853
|
] });
|
|
10402
10854
|
}
|
|
10403
10855
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
10404
|
-
return /* @__PURE__ */
|
|
10856
|
+
return /* @__PURE__ */ jsx84(ObjectDisplay, { data: value });
|
|
10405
10857
|
}
|
|
10406
10858
|
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
10407
10859
|
const fieldValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value || "";
|
|
@@ -10416,16 +10868,16 @@ var BaseUserProfile = ({
|
|
|
10416
10868
|
let field;
|
|
10417
10869
|
switch (type) {
|
|
10418
10870
|
case "STRING":
|
|
10419
|
-
field = /* @__PURE__ */
|
|
10871
|
+
field = /* @__PURE__ */ jsx84(TextField_default, { ...commonProps });
|
|
10420
10872
|
break;
|
|
10421
10873
|
case "DATE_TIME":
|
|
10422
|
-
field = /* @__PURE__ */
|
|
10874
|
+
field = /* @__PURE__ */ jsx84(DatePicker_default, { ...commonProps });
|
|
10423
10875
|
break;
|
|
10424
10876
|
case "BOOLEAN":
|
|
10425
|
-
field = /* @__PURE__ */
|
|
10877
|
+
field = /* @__PURE__ */ jsx84(Checkbox_default, { ...commonProps, checked: !!fieldValue, onChange: (e) => onEditValue(e.target.checked) });
|
|
10426
10878
|
break;
|
|
10427
10879
|
case "COMPLEX":
|
|
10428
|
-
field = /* @__PURE__ */
|
|
10880
|
+
field = /* @__PURE__ */ jsx84(
|
|
10429
10881
|
"textarea",
|
|
10430
10882
|
{
|
|
10431
10883
|
value: fieldValue,
|
|
@@ -10437,11 +10889,11 @@ var BaseUserProfile = ({
|
|
|
10437
10889
|
);
|
|
10438
10890
|
break;
|
|
10439
10891
|
default:
|
|
10440
|
-
field = /* @__PURE__ */
|
|
10892
|
+
field = /* @__PURE__ */ jsx84(TextField_default, { ...commonProps });
|
|
10441
10893
|
}
|
|
10442
|
-
return /* @__PURE__ */
|
|
10443
|
-
/* @__PURE__ */
|
|
10444
|
-
/* @__PURE__ */
|
|
10894
|
+
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
10895
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: label }),
|
|
10896
|
+
/* @__PURE__ */ jsx84("div", { className: styles.value, children: field })
|
|
10445
10897
|
] });
|
|
10446
10898
|
}
|
|
10447
10899
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
@@ -10454,9 +10906,9 @@ var BaseUserProfile = ({
|
|
|
10454
10906
|
} else {
|
|
10455
10907
|
displayValue = "-";
|
|
10456
10908
|
}
|
|
10457
|
-
return /* @__PURE__ */
|
|
10458
|
-
/* @__PURE__ */
|
|
10459
|
-
/* @__PURE__ */
|
|
10909
|
+
return /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
10910
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: label }),
|
|
10911
|
+
/* @__PURE__ */ jsx84("div", { className: cx26(styles.value, !hasValue ? styles.valuePlaceholder : ""), children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ jsx84(
|
|
10460
10912
|
Button_default,
|
|
10461
10913
|
{
|
|
10462
10914
|
onClick: onStartEdit,
|
|
@@ -10484,8 +10936,8 @@ var BaseUserProfile = ({
|
|
|
10484
10936
|
alignItems: "center",
|
|
10485
10937
|
gap: theme.vars.spacing.unit
|
|
10486
10938
|
};
|
|
10487
|
-
return /* @__PURE__ */
|
|
10488
|
-
/* @__PURE__ */
|
|
10939
|
+
return /* @__PURE__ */ jsxs36("div", { className: styles.field, children: [
|
|
10940
|
+
/* @__PURE__ */ jsx84("div", { className: styles.fieldInner, children: renderSchemaField(
|
|
10489
10941
|
schema,
|
|
10490
10942
|
isFieldEditing,
|
|
10491
10943
|
(value) => {
|
|
@@ -10495,12 +10947,12 @@ var BaseUserProfile = ({
|
|
|
10495
10947
|
},
|
|
10496
10948
|
() => toggleFieldEdit(schema.name)
|
|
10497
10949
|
) }),
|
|
10498
|
-
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */
|
|
10499
|
-
isFieldEditing && /* @__PURE__ */
|
|
10500
|
-
/* @__PURE__ */
|
|
10501
|
-
/* @__PURE__ */
|
|
10950
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ jsxs36("div", { className: styles.fieldActions, children: [
|
|
10951
|
+
isFieldEditing && /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
10952
|
+
/* @__PURE__ */ jsx84(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
10953
|
+
/* @__PURE__ */ jsx84(Button_default, { size: "small", color: "secondary", variant: "solid", onClick: () => handleFieldCancel(schema.name), children: "Cancel" })
|
|
10502
10954
|
] }),
|
|
10503
|
-
!isFieldEditing && hasValue && /* @__PURE__ */
|
|
10955
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ jsx84(
|
|
10504
10956
|
Button_default,
|
|
10505
10957
|
{
|
|
10506
10958
|
size: "small",
|
|
@@ -10509,7 +10961,7 @@ var BaseUserProfile = ({
|
|
|
10509
10961
|
onClick: () => toggleFieldEdit(schema.name),
|
|
10510
10962
|
title: "Edit",
|
|
10511
10963
|
className: styles.editButton,
|
|
10512
|
-
children: /* @__PURE__ */
|
|
10964
|
+
children: /* @__PURE__ */ jsx84(PencilIcon, {})
|
|
10513
10965
|
}
|
|
10514
10966
|
)
|
|
10515
10967
|
] })
|
|
@@ -10518,10 +10970,10 @@ var BaseUserProfile = ({
|
|
|
10518
10970
|
if (!profile && !flattenedProfile) {
|
|
10519
10971
|
return fallback;
|
|
10520
10972
|
}
|
|
10521
|
-
const containerClasses =
|
|
10973
|
+
const containerClasses = cx26(
|
|
10522
10974
|
styles.root,
|
|
10523
10975
|
cardLayout ? styles.card : "",
|
|
10524
|
-
|
|
10976
|
+
withVendorCSSClassPrefix27("user-profile"),
|
|
10525
10977
|
className
|
|
10526
10978
|
);
|
|
10527
10979
|
const currentUser = flattenedProfile || profile;
|
|
@@ -10533,17 +10985,17 @@ var BaseUserProfile = ({
|
|
|
10533
10985
|
if (!shouldShowField(key)) return false;
|
|
10534
10986
|
return value !== void 0 && value !== "" && value !== null;
|
|
10535
10987
|
}).sort(([a], [b]) => a.localeCompare(b));
|
|
10536
|
-
return /* @__PURE__ */
|
|
10537
|
-
/* @__PURE__ */
|
|
10538
|
-
/* @__PURE__ */
|
|
10988
|
+
return /* @__PURE__ */ jsx84(Fragment15, { children: profileEntries.map(([key, value]) => /* @__PURE__ */ jsxs36("div", { className: styles.field, children: [
|
|
10989
|
+
/* @__PURE__ */ jsx84("span", { className: styles.label, children: formatLabel(key) }),
|
|
10990
|
+
/* @__PURE__ */ jsx84("div", { className: styles.value, children: typeof value === "object" ? JSON.stringify(value, null, 2) : String(value) })
|
|
10539
10991
|
] }, key)) });
|
|
10540
10992
|
};
|
|
10541
|
-
const profileContent = /* @__PURE__ */
|
|
10542
|
-
error && /* @__PURE__ */
|
|
10543
|
-
/* @__PURE__ */
|
|
10544
|
-
/* @__PURE__ */
|
|
10993
|
+
const profileContent = /* @__PURE__ */ jsxs36(Card_default, { className: containerClasses, children: [
|
|
10994
|
+
error && /* @__PURE__ */ jsxs36(Alert_default, { variant: "error", className: cx26(withVendorCSSClassPrefix27(bem19("user-profile", "alert")), styles.alert), children: [
|
|
10995
|
+
/* @__PURE__ */ jsx84(Alert_default.Title, { children: t("errors.heading") || "Error" }),
|
|
10996
|
+
/* @__PURE__ */ jsx84(Alert_default.Description, { children: error })
|
|
10545
10997
|
] }),
|
|
10546
|
-
/* @__PURE__ */
|
|
10998
|
+
/* @__PURE__ */ jsx84("div", { className: styles.header, children: /* @__PURE__ */ jsx84(
|
|
10547
10999
|
Avatar,
|
|
10548
11000
|
{
|
|
10549
11001
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -10553,7 +11005,7 @@ var BaseUserProfile = ({
|
|
|
10553
11005
|
isLoading
|
|
10554
11006
|
}
|
|
10555
11007
|
) }),
|
|
10556
|
-
/* @__PURE__ */
|
|
11008
|
+
/* @__PURE__ */ jsx84("div", { className: styles.infoContainer, children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
10557
11009
|
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
10558
11010
|
if (!editable) {
|
|
10559
11011
|
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
@@ -10570,13 +11022,13 @@ var BaseUserProfile = ({
|
|
|
10570
11022
|
...schema,
|
|
10571
11023
|
value
|
|
10572
11024
|
};
|
|
10573
|
-
return /* @__PURE__ */
|
|
11025
|
+
return /* @__PURE__ */ jsx84("div", { className: styles.info, children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
10574
11026
|
}) : renderProfileWithoutSchemas() })
|
|
10575
11027
|
] });
|
|
10576
11028
|
if (mode === "popup") {
|
|
10577
|
-
return /* @__PURE__ */
|
|
10578
|
-
/* @__PURE__ */
|
|
10579
|
-
/* @__PURE__ */
|
|
11029
|
+
return /* @__PURE__ */ jsx84(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs36(Dialog_default.Content, { children: [
|
|
11030
|
+
/* @__PURE__ */ jsx84(Dialog_default.Heading, { children: title ?? t("user.profile.heading") }),
|
|
11031
|
+
/* @__PURE__ */ jsx84("div", { className: styles.popup, children: profileContent })
|
|
10580
11032
|
] }) });
|
|
10581
11033
|
}
|
|
10582
11034
|
return profileContent;
|
|
@@ -10584,7 +11036,7 @@ var BaseUserProfile = ({
|
|
|
10584
11036
|
var BaseUserProfile_default = BaseUserProfile;
|
|
10585
11037
|
|
|
10586
11038
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
10587
|
-
import { useState as
|
|
11039
|
+
import { useState as useState21 } from "react";
|
|
10588
11040
|
|
|
10589
11041
|
// src/api/updateMeProfile.ts
|
|
10590
11042
|
import {
|
|
@@ -10617,12 +11069,12 @@ var updateMeProfile_default = updateMeProfile;
|
|
|
10617
11069
|
|
|
10618
11070
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
10619
11071
|
import { AsgardeoError } from "@asgardeo/browser";
|
|
10620
|
-
import { jsx as
|
|
11072
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
10621
11073
|
var UserProfile3 = ({ ...rest }) => {
|
|
10622
11074
|
const { baseUrl, isLoading } = useAsgardeo_default();
|
|
10623
11075
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
10624
11076
|
const { t } = useTranslation_default();
|
|
10625
|
-
const [error, setError] =
|
|
11077
|
+
const [error, setError] = useState21(null);
|
|
10626
11078
|
const handleProfileUpdate = async (payload) => {
|
|
10627
11079
|
setError(null);
|
|
10628
11080
|
try {
|
|
@@ -10636,7 +11088,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10636
11088
|
setError(message);
|
|
10637
11089
|
}
|
|
10638
11090
|
};
|
|
10639
|
-
return /* @__PURE__ */
|
|
11091
|
+
return /* @__PURE__ */ jsx85(
|
|
10640
11092
|
BaseUserProfile_default,
|
|
10641
11093
|
{
|
|
10642
11094
|
profile,
|
|
@@ -10651,7 +11103,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10651
11103
|
var UserProfile_default = UserProfile3;
|
|
10652
11104
|
|
|
10653
11105
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10654
|
-
import { withVendorCSSClassPrefix as
|
|
11106
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix28 } from "@asgardeo/browser";
|
|
10655
11107
|
import {
|
|
10656
11108
|
useFloating as useFloating2,
|
|
10657
11109
|
autoUpdate,
|
|
@@ -10665,8 +11117,8 @@ import {
|
|
|
10665
11117
|
FloatingFocusManager as FloatingFocusManager2,
|
|
10666
11118
|
FloatingPortal as FloatingPortal2
|
|
10667
11119
|
} from "@floating-ui/react";
|
|
10668
|
-
import { cx as
|
|
10669
|
-
import { useState as
|
|
11120
|
+
import { cx as cx27 } from "@emotion/css";
|
|
11121
|
+
import { useState as useState22 } from "react";
|
|
10670
11122
|
|
|
10671
11123
|
// src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts
|
|
10672
11124
|
import { css as css22 } from "@emotion/css";
|
|
@@ -10853,7 +11305,7 @@ var useStyles22 = (theme, colorScheme) => {
|
|
|
10853
11305
|
var BaseUserDropdown_styles_default = useStyles22;
|
|
10854
11306
|
|
|
10855
11307
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10856
|
-
import { jsx as
|
|
11308
|
+
import { jsx as jsx86, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10857
11309
|
var BaseUserDropdown = ({
|
|
10858
11310
|
fallback = null,
|
|
10859
11311
|
className = "",
|
|
@@ -10869,8 +11321,8 @@ var BaseUserDropdown = ({
|
|
|
10869
11321
|
}) => {
|
|
10870
11322
|
const { theme, colorScheme } = useTheme_default();
|
|
10871
11323
|
const styles = BaseUserDropdown_styles_default(theme, colorScheme);
|
|
10872
|
-
const [isOpen, setIsOpen] =
|
|
10873
|
-
const [hoveredItemIndex, setHoveredItemIndex] =
|
|
11324
|
+
const [isOpen, setIsOpen] = useState22(false);
|
|
11325
|
+
const [hoveredItemIndex, setHoveredItemIndex] = useState22(null);
|
|
10874
11326
|
const { refs, floatingStyles, context } = useFloating2({
|
|
10875
11327
|
open: isOpen,
|
|
10876
11328
|
onOpenChange: setIsOpen,
|
|
@@ -10907,14 +11359,14 @@ var BaseUserDropdown = ({
|
|
|
10907
11359
|
defaultMenuItems.push({
|
|
10908
11360
|
label: "Manage Profile",
|
|
10909
11361
|
onClick: onManageProfile,
|
|
10910
|
-
icon: /* @__PURE__ */
|
|
11362
|
+
icon: /* @__PURE__ */ jsx86(User_default2, { width: "16", height: "16" })
|
|
10911
11363
|
});
|
|
10912
11364
|
}
|
|
10913
11365
|
if (onSignOut) {
|
|
10914
11366
|
defaultMenuItems.push({
|
|
10915
11367
|
label: "Sign Out",
|
|
10916
11368
|
onClick: onSignOut,
|
|
10917
|
-
icon: /* @__PURE__ */
|
|
11369
|
+
icon: /* @__PURE__ */ jsx86(LogOut_default, { width: "16", height: "16" })
|
|
10918
11370
|
});
|
|
10919
11371
|
}
|
|
10920
11372
|
const allMenuItems = [...menuItems];
|
|
@@ -10924,18 +11376,18 @@ var BaseUserDropdown = ({
|
|
|
10924
11376
|
}
|
|
10925
11377
|
allMenuItems.push(...defaultMenuItems);
|
|
10926
11378
|
}
|
|
10927
|
-
return /* @__PURE__ */
|
|
10928
|
-
/* @__PURE__ */
|
|
11379
|
+
return /* @__PURE__ */ jsxs37("div", { className: cx27(withVendorCSSClassPrefix28("user-dropdown"), className), children: [
|
|
11380
|
+
/* @__PURE__ */ jsxs37(
|
|
10929
11381
|
Button_default,
|
|
10930
11382
|
{
|
|
10931
11383
|
ref: refs.setReference,
|
|
10932
|
-
className:
|
|
11384
|
+
className: cx27(withVendorCSSClassPrefix28("user-dropdown__trigger"), styles.trigger),
|
|
10933
11385
|
color: "tertiary",
|
|
10934
11386
|
variant: "text",
|
|
10935
11387
|
size: "medium",
|
|
10936
11388
|
...getReferenceProps(),
|
|
10937
11389
|
children: [
|
|
10938
|
-
/* @__PURE__ */
|
|
11390
|
+
/* @__PURE__ */ jsx86(
|
|
10939
11391
|
Avatar,
|
|
10940
11392
|
{
|
|
10941
11393
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10944,22 +11396,22 @@ var BaseUserDropdown = ({
|
|
|
10944
11396
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10945
11397
|
}
|
|
10946
11398
|
),
|
|
10947
|
-
showTriggerLabel && /* @__PURE__ */
|
|
11399
|
+
showTriggerLabel && /* @__PURE__ */ jsx86(
|
|
10948
11400
|
Typography_default,
|
|
10949
11401
|
{
|
|
10950
11402
|
variant: "body2",
|
|
10951
|
-
className:
|
|
11403
|
+
className: cx27(withVendorCSSClassPrefix28("user-dropdown__trigger-label"), styles.userName),
|
|
10952
11404
|
children: getDisplayName_default(mergedMappings, user)
|
|
10953
11405
|
}
|
|
10954
11406
|
)
|
|
10955
11407
|
]
|
|
10956
11408
|
}
|
|
10957
11409
|
),
|
|
10958
|
-
isOpen && /* @__PURE__ */
|
|
11410
|
+
isOpen && /* @__PURE__ */ jsx86(FloatingPortal2, { id: portalId, children: /* @__PURE__ */ jsx86(FloatingFocusManager2, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ jsxs37(
|
|
10959
11411
|
"div",
|
|
10960
11412
|
{
|
|
10961
11413
|
ref: refs.setFloating,
|
|
10962
|
-
className:
|
|
11414
|
+
className: cx27(withVendorCSSClassPrefix28("user-dropdown__content"), styles.dropdownContent),
|
|
10963
11415
|
style: {
|
|
10964
11416
|
...floatingStyles,
|
|
10965
11417
|
// Floating UI doesn't set a z-index by default, so we set a high value to ensure the dropdown appears above other elements.
|
|
@@ -10968,8 +11420,8 @@ var BaseUserDropdown = ({
|
|
|
10968
11420
|
},
|
|
10969
11421
|
...getFloatingProps(),
|
|
10970
11422
|
children: [
|
|
10971
|
-
/* @__PURE__ */
|
|
10972
|
-
/* @__PURE__ */
|
|
11423
|
+
/* @__PURE__ */ jsxs37("div", { className: cx27(withVendorCSSClassPrefix28("user-dropdown__header"), styles.dropdownHeader), children: [
|
|
11424
|
+
/* @__PURE__ */ jsx86(
|
|
10973
11425
|
Avatar,
|
|
10974
11426
|
{
|
|
10975
11427
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10978,22 +11430,22 @@ var BaseUserDropdown = ({
|
|
|
10978
11430
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10979
11431
|
}
|
|
10980
11432
|
),
|
|
10981
|
-
/* @__PURE__ */
|
|
10982
|
-
/* @__PURE__ */
|
|
11433
|
+
/* @__PURE__ */ jsxs37("div", { className: cx27(withVendorCSSClassPrefix28("user-dropdown__header-info"), styles.headerInfo), children: [
|
|
11434
|
+
/* @__PURE__ */ jsx86(
|
|
10983
11435
|
Typography_default,
|
|
10984
11436
|
{
|
|
10985
11437
|
noWrap: true,
|
|
10986
|
-
className:
|
|
11438
|
+
className: withVendorCSSClassPrefix28("user-dropdown__header-name"),
|
|
10987
11439
|
variant: "body1",
|
|
10988
11440
|
fontWeight: "medium",
|
|
10989
11441
|
children: getDisplayName_default(mergedMappings, user)
|
|
10990
11442
|
}
|
|
10991
11443
|
),
|
|
10992
|
-
/* @__PURE__ */
|
|
11444
|
+
/* @__PURE__ */ jsx86(
|
|
10993
11445
|
Typography_default,
|
|
10994
11446
|
{
|
|
10995
11447
|
noWrap: true,
|
|
10996
|
-
className:
|
|
11448
|
+
className: withVendorCSSClassPrefix28("user-dropdown__header-email"),
|
|
10997
11449
|
variant: "caption",
|
|
10998
11450
|
color: "secondary",
|
|
10999
11451
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -11001,31 +11453,31 @@ var BaseUserDropdown = ({
|
|
|
11001
11453
|
)
|
|
11002
11454
|
] })
|
|
11003
11455
|
] }),
|
|
11004
|
-
/* @__PURE__ */
|
|
11456
|
+
/* @__PURE__ */ jsx86("div", { className: cx27(withVendorCSSClassPrefix28("user-dropdown__menu"), styles.dropdownMenu), children: allMenuItems.map((item, index) => /* @__PURE__ */ jsx86("div", { children: item.label === "" ? /* @__PURE__ */ jsx86("div", { className: cx27(withVendorCSSClassPrefix28("user-dropdown__menu-divider"), styles.divider) }) : item.href ? /* @__PURE__ */ jsxs37(
|
|
11005
11457
|
"a",
|
|
11006
11458
|
{
|
|
11007
11459
|
href: item.href,
|
|
11008
11460
|
style: {
|
|
11009
11461
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
11010
11462
|
},
|
|
11011
|
-
className:
|
|
11463
|
+
className: cx27(withVendorCSSClassPrefix28("user-dropdown__menu-item"), styles.menuItemAnchor),
|
|
11012
11464
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
11013
11465
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
11014
11466
|
onFocus: () => setHoveredItemIndex(index),
|
|
11015
11467
|
onBlur: () => setHoveredItemIndex(null),
|
|
11016
11468
|
children: [
|
|
11017
11469
|
item.icon,
|
|
11018
|
-
/* @__PURE__ */
|
|
11470
|
+
/* @__PURE__ */ jsx86("span", { children: item.label })
|
|
11019
11471
|
]
|
|
11020
11472
|
}
|
|
11021
|
-
) : /* @__PURE__ */
|
|
11473
|
+
) : /* @__PURE__ */ jsx86(
|
|
11022
11474
|
Button_default,
|
|
11023
11475
|
{
|
|
11024
11476
|
onClick: () => handleMenuItemClick(item),
|
|
11025
11477
|
style: {
|
|
11026
11478
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
11027
11479
|
},
|
|
11028
|
-
className:
|
|
11480
|
+
className: cx27(withVendorCSSClassPrefix28("user-dropdown__menu-item"), styles.menuItem),
|
|
11029
11481
|
color: "tertiary",
|
|
11030
11482
|
variant: "text",
|
|
11031
11483
|
size: "small",
|
|
@@ -11043,8 +11495,8 @@ var BaseUserDropdown = ({
|
|
|
11043
11495
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
11044
11496
|
|
|
11045
11497
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
11046
|
-
import { useState as
|
|
11047
|
-
import { Fragment as Fragment16, jsx as
|
|
11498
|
+
import { useState as useState23 } from "react";
|
|
11499
|
+
import { Fragment as Fragment16, jsx as jsx87, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11048
11500
|
var UserDropdown = ({
|
|
11049
11501
|
children,
|
|
11050
11502
|
renderTrigger,
|
|
@@ -11053,7 +11505,7 @@ var UserDropdown = ({
|
|
|
11053
11505
|
...rest
|
|
11054
11506
|
}) => {
|
|
11055
11507
|
const { user, isLoading, signOut } = useAsgardeo_default();
|
|
11056
|
-
const [isProfileOpen, setIsProfileOpen] =
|
|
11508
|
+
const [isProfileOpen, setIsProfileOpen] = useState23(false);
|
|
11057
11509
|
const handleManageProfile = () => {
|
|
11058
11510
|
setIsProfileOpen(true);
|
|
11059
11511
|
};
|
|
@@ -11073,14 +11525,14 @@ var UserDropdown = ({
|
|
|
11073
11525
|
closeProfile
|
|
11074
11526
|
};
|
|
11075
11527
|
if (children) {
|
|
11076
|
-
return /* @__PURE__ */
|
|
11528
|
+
return /* @__PURE__ */ jsxs38(Fragment16, { children: [
|
|
11077
11529
|
children(renderProps),
|
|
11078
|
-
/* @__PURE__ */
|
|
11530
|
+
/* @__PURE__ */ jsx87(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
11079
11531
|
] });
|
|
11080
11532
|
}
|
|
11081
11533
|
if (renderTrigger || renderDropdown) {
|
|
11082
|
-
return /* @__PURE__ */
|
|
11083
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */
|
|
11534
|
+
return /* @__PURE__ */ jsxs38(Fragment16, { children: [
|
|
11535
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ jsx87(
|
|
11084
11536
|
BaseUserDropdown_default,
|
|
11085
11537
|
{
|
|
11086
11538
|
user,
|
|
@@ -11090,11 +11542,11 @@ var UserDropdown = ({
|
|
|
11090
11542
|
...rest
|
|
11091
11543
|
}
|
|
11092
11544
|
),
|
|
11093
|
-
/* @__PURE__ */
|
|
11545
|
+
/* @__PURE__ */ jsx87(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
11094
11546
|
] });
|
|
11095
11547
|
}
|
|
11096
|
-
return /* @__PURE__ */
|
|
11097
|
-
/* @__PURE__ */
|
|
11548
|
+
return /* @__PURE__ */ jsxs38(Fragment16, { children: [
|
|
11549
|
+
/* @__PURE__ */ jsx87(
|
|
11098
11550
|
BaseUserDropdown_default,
|
|
11099
11551
|
{
|
|
11100
11552
|
user,
|
|
@@ -11104,7 +11556,7 @@ var UserDropdown = ({
|
|
|
11104
11556
|
...rest
|
|
11105
11557
|
}
|
|
11106
11558
|
),
|
|
11107
|
-
isProfileOpen && /* @__PURE__ */
|
|
11559
|
+
isProfileOpen && /* @__PURE__ */ jsx87(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
11108
11560
|
] });
|
|
11109
11561
|
};
|
|
11110
11562
|
var UserDropdown_default = UserDropdown;
|
|
@@ -11123,13 +11575,13 @@ import {
|
|
|
11123
11575
|
FloatingFocusManager as FloatingFocusManager3,
|
|
11124
11576
|
FloatingPortal as FloatingPortal3
|
|
11125
11577
|
} from "@floating-ui/react";
|
|
11126
|
-
import { cx as
|
|
11127
|
-
import { useState as
|
|
11578
|
+
import { cx as cx28 } from "@emotion/css";
|
|
11579
|
+
import { useState as useState24 } from "react";
|
|
11128
11580
|
|
|
11129
11581
|
// src/components/primitives/Icons/Building.tsx
|
|
11130
|
-
import { jsx as
|
|
11131
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
11132
|
-
/* @__PURE__ */
|
|
11582
|
+
import { jsx as jsx88, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
11583
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsxs39("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
11584
|
+
/* @__PURE__ */ jsx88(
|
|
11133
11585
|
"path",
|
|
11134
11586
|
{
|
|
11135
11587
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -11139,25 +11591,25 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
11139
11591
|
strokeLinejoin: "round"
|
|
11140
11592
|
}
|
|
11141
11593
|
),
|
|
11142
|
-
/* @__PURE__ */
|
|
11143
|
-
/* @__PURE__ */
|
|
11144
|
-
/* @__PURE__ */
|
|
11145
|
-
/* @__PURE__ */
|
|
11146
|
-
/* @__PURE__ */
|
|
11147
|
-
/* @__PURE__ */
|
|
11594
|
+
/* @__PURE__ */ jsx88("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11595
|
+
/* @__PURE__ */ jsx88("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11596
|
+
/* @__PURE__ */ jsx88("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11597
|
+
/* @__PURE__ */ jsx88("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11598
|
+
/* @__PURE__ */ jsx88("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11599
|
+
/* @__PURE__ */ jsx88("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
11148
11600
|
] });
|
|
11149
11601
|
Building.displayName = "Building";
|
|
11150
11602
|
var Building_default = Building;
|
|
11151
11603
|
|
|
11152
11604
|
// src/components/primitives/Icons/Check.tsx
|
|
11153
|
-
import { jsx as
|
|
11154
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
11605
|
+
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
11606
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsx89("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx89("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
11155
11607
|
Check.displayName = "Check";
|
|
11156
11608
|
var Check_default = Check;
|
|
11157
11609
|
|
|
11158
11610
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
11159
|
-
import { jsx as
|
|
11160
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
11611
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
11612
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsx90("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx90("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
11161
11613
|
ChevronDown.displayName = "ChevronDown";
|
|
11162
11614
|
var ChevronDown_default = ChevronDown;
|
|
11163
11615
|
|
|
@@ -11387,7 +11839,7 @@ var useStyles23 = (theme, colorScheme) => {
|
|
|
11387
11839
|
var BaseOrganizationSwitcher_styles_default = useStyles23;
|
|
11388
11840
|
|
|
11389
11841
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
11390
|
-
import { Fragment as Fragment17, jsx as
|
|
11842
|
+
import { Fragment as Fragment17, jsx as jsx91, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11391
11843
|
var BaseOrganizationSwitcher = ({
|
|
11392
11844
|
organizations,
|
|
11393
11845
|
currentOrganization,
|
|
@@ -11410,8 +11862,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11410
11862
|
}) => {
|
|
11411
11863
|
const { theme, colorScheme, direction } = useTheme_default();
|
|
11412
11864
|
const styles = BaseOrganizationSwitcher_styles_default(theme, colorScheme);
|
|
11413
|
-
const [isOpen, setIsOpen] =
|
|
11414
|
-
const [hoveredItemIndex, setHoveredItemIndex] =
|
|
11865
|
+
const [isOpen, setIsOpen] = useState24(false);
|
|
11866
|
+
const [hoveredItemIndex, setHoveredItemIndex] = useState24(null);
|
|
11415
11867
|
const { t } = useTranslation_default();
|
|
11416
11868
|
const isRTL = direction === "rtl";
|
|
11417
11869
|
const { refs, floatingStyles, context } = useFloating3({
|
|
@@ -11441,8 +11893,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11441
11893
|
const switchableOrganizations = organizations.filter(
|
|
11442
11894
|
(org) => org.id !== currentOrganization?.id
|
|
11443
11895
|
);
|
|
11444
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */
|
|
11445
|
-
/* @__PURE__ */
|
|
11896
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
11897
|
+
/* @__PURE__ */ jsx91(
|
|
11446
11898
|
Avatar,
|
|
11447
11899
|
{
|
|
11448
11900
|
variant: "square",
|
|
@@ -11452,35 +11904,35 @@ var BaseOrganizationSwitcher = ({
|
|
|
11452
11904
|
alt: `${organization.name} avatar`
|
|
11453
11905
|
}
|
|
11454
11906
|
),
|
|
11455
|
-
/* @__PURE__ */
|
|
11456
|
-
/* @__PURE__ */
|
|
11457
|
-
/* @__PURE__ */
|
|
11458
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */
|
|
11907
|
+
/* @__PURE__ */ jsxs40("div", { className: cx28(styles.organizationInfo), children: [
|
|
11908
|
+
/* @__PURE__ */ jsx91(Typography_default, { variant: "body2", fontWeight: "medium", className: cx28(styles.organizationName), children: organization.name }),
|
|
11909
|
+
/* @__PURE__ */ jsxs40("div", { className: cx28(styles.organizationMeta), children: [
|
|
11910
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ jsxs40("span", { children: [
|
|
11459
11911
|
organization.memberCount,
|
|
11460
11912
|
" ",
|
|
11461
11913
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
11462
11914
|
] }),
|
|
11463
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */
|
|
11464
|
-
showRole && organization.role && /* @__PURE__ */
|
|
11915
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ jsx91("span", { children: " \u2022 " }),
|
|
11916
|
+
showRole && organization.role && /* @__PURE__ */ jsx91("span", { className: cx28(styles.roleCapitalized), children: organization.role })
|
|
11465
11917
|
] })
|
|
11466
11918
|
] }),
|
|
11467
|
-
isSelected && /* @__PURE__ */
|
|
11919
|
+
isSelected && /* @__PURE__ */ jsx91(Check_default, { width: "16", height: "16", color: theme.vars.colors.text.primary })
|
|
11468
11920
|
] });
|
|
11469
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */
|
|
11470
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */
|
|
11471
|
-
return /* @__PURE__ */
|
|
11472
|
-
/* @__PURE__ */
|
|
11921
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ jsx91("div", { className: cx28(styles.loadingContainer), children: /* @__PURE__ */ jsx91(Typography_default, { variant: "caption", className: cx28(styles.loadingText), children: t("organization.switcher.loading.placeholder.organizations") }) });
|
|
11922
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ jsx91("div", { className: cx28(styles.errorContainer), children: /* @__PURE__ */ jsx91(Typography_default, { variant: "caption", className: cx28(styles.errorText), children: errorMessage }) });
|
|
11923
|
+
return /* @__PURE__ */ jsxs40("div", { className: cx28(styles.root, className), style, children: [
|
|
11924
|
+
/* @__PURE__ */ jsxs40(
|
|
11473
11925
|
Button_default,
|
|
11474
11926
|
{
|
|
11475
11927
|
ref: refs.setReference,
|
|
11476
|
-
className:
|
|
11928
|
+
className: cx28(styles.trigger),
|
|
11477
11929
|
color: "tertiary",
|
|
11478
11930
|
variant: "outline",
|
|
11479
11931
|
size: "medium",
|
|
11480
11932
|
...getReferenceProps(),
|
|
11481
11933
|
children: [
|
|
11482
|
-
currentOrganization ? /* @__PURE__ */
|
|
11483
|
-
/* @__PURE__ */
|
|
11934
|
+
currentOrganization ? /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
11935
|
+
/* @__PURE__ */ jsx91(
|
|
11484
11936
|
Avatar,
|
|
11485
11937
|
{
|
|
11486
11938
|
variant: "square",
|
|
@@ -11490,18 +11942,18 @@ var BaseOrganizationSwitcher = ({
|
|
|
11490
11942
|
alt: `${currentOrganization.name} avatar`
|
|
11491
11943
|
}
|
|
11492
11944
|
),
|
|
11493
|
-
showTriggerLabel && /* @__PURE__ */
|
|
11494
|
-
] }) : /* @__PURE__ */
|
|
11495
|
-
/* @__PURE__ */
|
|
11496
|
-
showTriggerLabel && /* @__PURE__ */
|
|
11945
|
+
showTriggerLabel && /* @__PURE__ */ jsx91(Typography_default, { variant: "body2", className: cx28(styles.triggerLabel), children: currentOrganization.name })
|
|
11946
|
+
] }) : /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
11947
|
+
/* @__PURE__ */ jsx91(Building_default, { width: avatarSize, height: avatarSize }),
|
|
11948
|
+
showTriggerLabel && /* @__PURE__ */ jsx91(Typography_default, { variant: "body2", className: cx28(styles.triggerLabel), children: t("elements.fields.organization.select.label") })
|
|
11497
11949
|
] }),
|
|
11498
|
-
/* @__PURE__ */
|
|
11950
|
+
/* @__PURE__ */ jsx91("span", { style: { transform: isRTL ? "scaleX(-1)" : "none", display: "inline-flex" }, children: /* @__PURE__ */ jsx91(ChevronDown_default, { width: "16", height: "16" }) })
|
|
11499
11951
|
]
|
|
11500
11952
|
}
|
|
11501
11953
|
),
|
|
11502
|
-
isOpen && /* @__PURE__ */
|
|
11503
|
-
currentOrganization && /* @__PURE__ */
|
|
11504
|
-
/* @__PURE__ */
|
|
11954
|
+
isOpen && /* @__PURE__ */ jsx91(FloatingPortal3, { id: portalId, children: /* @__PURE__ */ jsx91(FloatingFocusManager3, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ jsxs40("div", { ref: refs.setFloating, className: cx28(styles.content), style: floatingStyles, ...getFloatingProps(), children: [
|
|
11955
|
+
currentOrganization && /* @__PURE__ */ jsxs40("div", { className: cx28(styles.header), children: [
|
|
11956
|
+
/* @__PURE__ */ jsx91(
|
|
11505
11957
|
Avatar,
|
|
11506
11958
|
{
|
|
11507
11959
|
variant: "square",
|
|
@@ -11511,10 +11963,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11511
11963
|
alt: `${currentOrganization.name} avatar`
|
|
11512
11964
|
}
|
|
11513
11965
|
),
|
|
11514
|
-
/* @__PURE__ */
|
|
11515
|
-
/* @__PURE__ */
|
|
11516
|
-
/* @__PURE__ */
|
|
11517
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */
|
|
11966
|
+
/* @__PURE__ */ jsxs40("div", { className: cx28(styles.headerInfo), children: [
|
|
11967
|
+
/* @__PURE__ */ jsx91(Typography_default, { noWrap: true, className: cx28(styles.headerName), variant: "body1", fontWeight: "medium", children: currentOrganization.name }),
|
|
11968
|
+
/* @__PURE__ */ jsxs40("div", { className: cx28(styles.headerMeta), children: [
|
|
11969
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ jsxs40(
|
|
11518
11970
|
Typography_default,
|
|
11519
11971
|
{
|
|
11520
11972
|
noWrap: true,
|
|
@@ -11524,17 +11976,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
11524
11976
|
currentOrganization.memberCount,
|
|
11525
11977
|
" ",
|
|
11526
11978
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
11527
|
-
showRole && currentOrganization.role && /* @__PURE__ */
|
|
11979
|
+
showRole && currentOrganization.role && /* @__PURE__ */ jsxs40("span", { children: [
|
|
11528
11980
|
" \u2022 ",
|
|
11529
11981
|
currentOrganization.role
|
|
11530
11982
|
] })
|
|
11531
11983
|
]
|
|
11532
11984
|
}
|
|
11533
11985
|
),
|
|
11534
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */
|
|
11986
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ jsx91(Typography_default, { noWrap: true, className: cx28(styles.headerRole), variant: "caption", color: "secondary", children: currentOrganization.role })
|
|
11535
11987
|
] })
|
|
11536
11988
|
] }),
|
|
11537
|
-
onManageProfile && /* @__PURE__ */
|
|
11989
|
+
onManageProfile && /* @__PURE__ */ jsx91(
|
|
11538
11990
|
Button_default,
|
|
11539
11991
|
{
|
|
11540
11992
|
onClick: onManageProfile,
|
|
@@ -11542,8 +11994,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11542
11994
|
variant: "outline",
|
|
11543
11995
|
size: "small",
|
|
11544
11996
|
"aria-label": "Manage Organization Profile",
|
|
11545
|
-
className:
|
|
11546
|
-
endIcon: /* @__PURE__ */
|
|
11997
|
+
className: cx28(styles.manageButton),
|
|
11998
|
+
endIcon: /* @__PURE__ */ jsxs40(
|
|
11547
11999
|
"svg",
|
|
11548
12000
|
{
|
|
11549
12001
|
width: "16",
|
|
@@ -11555,33 +12007,33 @@ var BaseOrganizationSwitcher = ({
|
|
|
11555
12007
|
strokeLinecap: "round",
|
|
11556
12008
|
strokeLinejoin: "round",
|
|
11557
12009
|
children: [
|
|
11558
|
-
/* @__PURE__ */
|
|
11559
|
-
/* @__PURE__ */
|
|
12010
|
+
/* @__PURE__ */ jsx91("circle", { cx: "12", cy: "12", r: "3" }),
|
|
12011
|
+
/* @__PURE__ */ jsx91("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
11560
12012
|
]
|
|
11561
12013
|
}
|
|
11562
12014
|
),
|
|
11563
|
-
children: t("organization.switcher.manage.
|
|
12015
|
+
children: t("organization.switcher.buttons.manage.text")
|
|
11564
12016
|
}
|
|
11565
12017
|
)
|
|
11566
12018
|
] }),
|
|
11567
|
-
organizations.length > 1 && /* @__PURE__ */
|
|
12019
|
+
organizations.length > 1 && /* @__PURE__ */ jsx91(
|
|
11568
12020
|
"div",
|
|
11569
12021
|
{
|
|
11570
|
-
className:
|
|
12022
|
+
className: cx28(styles.header, styles.sectionHeaderContainer),
|
|
11571
12023
|
style: {
|
|
11572
12024
|
borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : "none"
|
|
11573
12025
|
},
|
|
11574
|
-
children: /* @__PURE__ */
|
|
12026
|
+
children: /* @__PURE__ */ jsx91(Typography_default, { variant: "caption", fontWeight: 600, className: cx28(styles.sectionHeader), children: t("organization.switcher.switch.organization") })
|
|
11575
12027
|
}
|
|
11576
12028
|
),
|
|
11577
|
-
/* @__PURE__ */
|
|
12029
|
+
/* @__PURE__ */ jsx91("div", { className: cx28(styles.menu), children: loading ? renderLoading ? renderLoading() : defaultRenderLoading2() : error ? renderError ? renderError(error) : defaultRenderError2(error) : /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
11578
12030
|
switchableOrganizations.map((organization) => {
|
|
11579
12031
|
const isSelected = false;
|
|
11580
|
-
return /* @__PURE__ */
|
|
12032
|
+
return /* @__PURE__ */ jsx91(
|
|
11581
12033
|
Button_default,
|
|
11582
12034
|
{
|
|
11583
12035
|
onClick: () => handleOrganizationSwitch(organization),
|
|
11584
|
-
className:
|
|
12036
|
+
className: cx28(styles.menuItem),
|
|
11585
12037
|
color: "tertiary",
|
|
11586
12038
|
variant: "text",
|
|
11587
12039
|
size: "small",
|
|
@@ -11595,34 +12047,34 @@ var BaseOrganizationSwitcher = ({
|
|
|
11595
12047
|
organization.id
|
|
11596
12048
|
);
|
|
11597
12049
|
}),
|
|
11598
|
-
menuItems.length > 0 && /* @__PURE__ */
|
|
11599
|
-
/* @__PURE__ */
|
|
12050
|
+
menuItems.length > 0 && /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
12051
|
+
/* @__PURE__ */ jsx91("div", { className: cx28(styles.menuDivider) }),
|
|
11600
12052
|
menuItems.map(
|
|
11601
|
-
(item, index) => /* @__PURE__ */
|
|
12053
|
+
(item, index) => /* @__PURE__ */ jsx91("div", { children: item.href ? /* @__PURE__ */ jsxs40(
|
|
11602
12054
|
"a",
|
|
11603
12055
|
{
|
|
11604
12056
|
href: item.href,
|
|
11605
12057
|
style: {
|
|
11606
12058
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? theme.vars.colors.action?.hover : "transparent"
|
|
11607
12059
|
},
|
|
11608
|
-
className:
|
|
12060
|
+
className: cx28(styles.menuItem),
|
|
11609
12061
|
onMouseEnter: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
11610
12062
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
11611
12063
|
onFocus: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
11612
12064
|
onBlur: () => setHoveredItemIndex(null),
|
|
11613
12065
|
children: [
|
|
11614
12066
|
item.icon,
|
|
11615
|
-
/* @__PURE__ */
|
|
12067
|
+
/* @__PURE__ */ jsx91("span", { children: item.label })
|
|
11616
12068
|
]
|
|
11617
12069
|
}
|
|
11618
|
-
) : /* @__PURE__ */
|
|
12070
|
+
) : /* @__PURE__ */ jsx91(
|
|
11619
12071
|
Button_default,
|
|
11620
12072
|
{
|
|
11621
12073
|
onClick: () => handleMenuItemClick(item),
|
|
11622
12074
|
style: {
|
|
11623
12075
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? theme.vars.colors.action?.hover : "transparent"
|
|
11624
12076
|
},
|
|
11625
|
-
className:
|
|
12077
|
+
className: cx28(styles.menuItem),
|
|
11626
12078
|
color: "tertiary",
|
|
11627
12079
|
variant: "text",
|
|
11628
12080
|
size: "small",
|
|
@@ -11641,14 +12093,14 @@ var BaseOrganizationSwitcher = ({
|
|
|
11641
12093
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
11642
12094
|
|
|
11643
12095
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
11644
|
-
import { useState as
|
|
12096
|
+
import { useState as useState31 } from "react";
|
|
11645
12097
|
|
|
11646
12098
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
11647
|
-
import { useState as
|
|
12099
|
+
import { useState as useState26 } from "react";
|
|
11648
12100
|
|
|
11649
12101
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
11650
|
-
import { cx as
|
|
11651
|
-
import { useState as
|
|
12102
|
+
import { cx as cx29 } from "@emotion/css";
|
|
12103
|
+
import { useState as useState25 } from "react";
|
|
11652
12104
|
|
|
11653
12105
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts
|
|
11654
12106
|
import { css as css24 } from "@emotion/css";
|
|
@@ -11789,7 +12241,7 @@ var useStyles24 = (theme, colorScheme) => {
|
|
|
11789
12241
|
var BaseCreateOrganization_styles_default = useStyles24;
|
|
11790
12242
|
|
|
11791
12243
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
11792
|
-
import { jsx as
|
|
12244
|
+
import { jsx as jsx92, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11793
12245
|
var BaseCreateOrganization = ({
|
|
11794
12246
|
cardLayout = true,
|
|
11795
12247
|
className = "",
|
|
@@ -11810,13 +12262,13 @@ var BaseCreateOrganization = ({
|
|
|
11810
12262
|
const { theme, colorScheme } = useTheme_default();
|
|
11811
12263
|
const styles = BaseCreateOrganization_styles_default(theme, colorScheme);
|
|
11812
12264
|
const { t } = useTranslation_default();
|
|
11813
|
-
const [formData, setFormData] =
|
|
12265
|
+
const [formData, setFormData] = useState25({
|
|
11814
12266
|
description: "",
|
|
11815
12267
|
handle: "",
|
|
11816
12268
|
name: "",
|
|
11817
12269
|
...initialValues
|
|
11818
12270
|
});
|
|
11819
|
-
const [formErrors, setFormErrors] =
|
|
12271
|
+
const [formErrors, setFormErrors] = useState25({});
|
|
11820
12272
|
const validateForm = () => {
|
|
11821
12273
|
const errors = {};
|
|
11822
12274
|
if (!formData.name.trim()) {
|
|
@@ -11876,45 +12328,45 @@ var BaseCreateOrganization = ({
|
|
|
11876
12328
|
console.error("Form submission error:", submitError);
|
|
11877
12329
|
}
|
|
11878
12330
|
};
|
|
11879
|
-
const createOrganizationContent = /* @__PURE__ */
|
|
11880
|
-
/* @__PURE__ */
|
|
11881
|
-
error && /* @__PURE__ */
|
|
11882
|
-
/* @__PURE__ */
|
|
11883
|
-
/* @__PURE__ */
|
|
12331
|
+
const createOrganizationContent = /* @__PURE__ */ jsx92("div", { className: cx29(styles.root, cardLayout && styles.card, className), style, children: /* @__PURE__ */ jsxs41("div", { className: cx29(styles.content), children: [
|
|
12332
|
+
/* @__PURE__ */ jsxs41("form", { id: "create-organization-form", className: cx29(styles.form), onSubmit: handleSubmit, children: [
|
|
12333
|
+
error && /* @__PURE__ */ jsxs41(Alert_default, { variant: "error", className: styles.errorAlert, children: [
|
|
12334
|
+
/* @__PURE__ */ jsx92(Alert_default.Title, { children: "Error" }),
|
|
12335
|
+
/* @__PURE__ */ jsx92(Alert_default.Description, { children: error })
|
|
11884
12336
|
] }),
|
|
11885
|
-
/* @__PURE__ */
|
|
12337
|
+
/* @__PURE__ */ jsx92("div", { className: cx29(styles.fieldGroup), children: /* @__PURE__ */ jsx92(
|
|
11886
12338
|
TextField_default,
|
|
11887
12339
|
{
|
|
11888
|
-
label: `${t("organization.
|
|
11889
|
-
placeholder: t("organization.
|
|
12340
|
+
label: `${t("elements.fields.organization.name.label")}`,
|
|
12341
|
+
placeholder: t("elements.fields.organization.name.placeholder"),
|
|
11890
12342
|
value: formData.name,
|
|
11891
12343
|
onChange: (e) => handleNameChange(e.target.value),
|
|
11892
12344
|
disabled: loading,
|
|
11893
12345
|
required: true,
|
|
11894
12346
|
error: formErrors.name,
|
|
11895
|
-
className:
|
|
12347
|
+
className: cx29(styles.input)
|
|
11896
12348
|
}
|
|
11897
12349
|
) }),
|
|
11898
|
-
/* @__PURE__ */
|
|
12350
|
+
/* @__PURE__ */ jsx92("div", { className: cx29(styles.fieldGroup), children: /* @__PURE__ */ jsx92(
|
|
11899
12351
|
TextField_default,
|
|
11900
12352
|
{
|
|
11901
|
-
label: `${t("organization.
|
|
11902
|
-
placeholder: t("organization.
|
|
12353
|
+
label: `${t("elements.fields.organization.handle.label") || "Organization Handle"}`,
|
|
12354
|
+
placeholder: t("elements.fields.organization.handle.placeholder") || "my-organization",
|
|
11903
12355
|
value: formData.handle,
|
|
11904
12356
|
onChange: (e) => handleInputChange("handle", e.target.value),
|
|
11905
12357
|
disabled: loading,
|
|
11906
12358
|
required: true,
|
|
11907
12359
|
error: formErrors.handle,
|
|
11908
12360
|
helperText: "This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.",
|
|
11909
|
-
className:
|
|
12361
|
+
className: cx29(styles.input)
|
|
11910
12362
|
}
|
|
11911
12363
|
) }),
|
|
11912
|
-
/* @__PURE__ */
|
|
11913
|
-
/* @__PURE__ */
|
|
11914
|
-
/* @__PURE__ */
|
|
12364
|
+
/* @__PURE__ */ jsx92("div", { className: cx29(styles.fieldGroup), children: /* @__PURE__ */ jsxs41(FormControl_default, { error: formErrors.description, children: [
|
|
12365
|
+
/* @__PURE__ */ jsx92(InputLabel_default, { required: true, children: t("elements.fields.organization.description.label") }),
|
|
12366
|
+
/* @__PURE__ */ jsx92(
|
|
11915
12367
|
"textarea",
|
|
11916
12368
|
{
|
|
11917
|
-
className:
|
|
12369
|
+
className: cx29(styles.textarea, formErrors.description && styles.textareaError),
|
|
11918
12370
|
placeholder: t("organization.create.description.placeholder"),
|
|
11919
12371
|
value: formData.description,
|
|
11920
12372
|
onChange: (e) => handleInputChange("description", e.target.value),
|
|
@@ -11925,15 +12377,15 @@ var BaseCreateOrganization = ({
|
|
|
11925
12377
|
] }) }),
|
|
11926
12378
|
renderAdditionalFields && renderAdditionalFields()
|
|
11927
12379
|
] }),
|
|
11928
|
-
/* @__PURE__ */
|
|
11929
|
-
onCancel && /* @__PURE__ */
|
|
11930
|
-
/* @__PURE__ */
|
|
12380
|
+
/* @__PURE__ */ jsxs41("div", { className: cx29(styles.actions), children: [
|
|
12381
|
+
onCancel && /* @__PURE__ */ jsx92(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.buttons.cancel.text") }),
|
|
12382
|
+
/* @__PURE__ */ jsx92(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.buttons.create_organization.loading.text") : t("organization.create.buttons.create_organization.text") })
|
|
11931
12383
|
] })
|
|
11932
12384
|
] }) });
|
|
11933
12385
|
if (mode === "popup") {
|
|
11934
|
-
return /* @__PURE__ */
|
|
11935
|
-
/* @__PURE__ */
|
|
11936
|
-
/* @__PURE__ */
|
|
12386
|
+
return /* @__PURE__ */ jsx92(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs41(Dialog_default.Content, { children: [
|
|
12387
|
+
/* @__PURE__ */ jsx92(Dialog_default.Heading, { children: title }),
|
|
12388
|
+
/* @__PURE__ */ jsx92("div", { className: styles.popup, children: createOrganizationContent })
|
|
11937
12389
|
] }) });
|
|
11938
12390
|
}
|
|
11939
12391
|
return createOrganizationContent;
|
|
@@ -11969,7 +12421,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
11969
12421
|
var createOrganization_default = createOrganization;
|
|
11970
12422
|
|
|
11971
12423
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
11972
|
-
import { Fragment as Fragment18, jsx as
|
|
12424
|
+
import { Fragment as Fragment18, jsx as jsx93 } from "react/jsx-runtime";
|
|
11973
12425
|
var CreateOrganization = ({
|
|
11974
12426
|
onCreateOrganization,
|
|
11975
12427
|
fallback = null,
|
|
@@ -11979,13 +12431,13 @@ var CreateOrganization = ({
|
|
|
11979
12431
|
}) => {
|
|
11980
12432
|
const { isSignedIn, baseUrl } = useAsgardeo_default();
|
|
11981
12433
|
const { currentOrganization, revalidateMyOrganizations } = useOrganization_default();
|
|
11982
|
-
const [loading, setLoading] =
|
|
11983
|
-
const [error, setError] =
|
|
12434
|
+
const [loading, setLoading] = useState26(false);
|
|
12435
|
+
const [error, setError] = useState26(null);
|
|
11984
12436
|
if (!isSignedIn && fallback) {
|
|
11985
12437
|
return fallback;
|
|
11986
12438
|
}
|
|
11987
12439
|
if (!isSignedIn) {
|
|
11988
|
-
return /* @__PURE__ */
|
|
12440
|
+
return /* @__PURE__ */ jsx93(Fragment18, {});
|
|
11989
12441
|
}
|
|
11990
12442
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
11991
12443
|
const handleSubmit = async (payload) => {
|
|
@@ -12019,7 +12471,7 @@ var CreateOrganization = ({
|
|
|
12019
12471
|
setLoading(false);
|
|
12020
12472
|
}
|
|
12021
12473
|
};
|
|
12022
|
-
return /* @__PURE__ */
|
|
12474
|
+
return /* @__PURE__ */ jsx93(
|
|
12023
12475
|
BaseCreateOrganization,
|
|
12024
12476
|
{
|
|
12025
12477
|
onSubmit: handleSubmit,
|
|
@@ -12033,17 +12485,17 @@ var CreateOrganization = ({
|
|
|
12033
12485
|
};
|
|
12034
12486
|
|
|
12035
12487
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
12036
|
-
import { useEffect as
|
|
12488
|
+
import { useEffect as useEffect16, useState as useState29 } from "react";
|
|
12037
12489
|
|
|
12038
12490
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
12039
12491
|
import { formatDate } from "@asgardeo/browser";
|
|
12040
|
-
import { cx as
|
|
12041
|
-
import { useState as
|
|
12492
|
+
import { cx as cx31 } from "@emotion/css";
|
|
12493
|
+
import { useState as useState28, useCallback as useCallback16 } from "react";
|
|
12042
12494
|
|
|
12043
12495
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
12044
|
-
import { withVendorCSSClassPrefix as
|
|
12045
|
-
import { cx as
|
|
12046
|
-
import { useState as
|
|
12496
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix29, bem as bem20 } from "@asgardeo/browser";
|
|
12497
|
+
import { cx as cx30 } from "@emotion/css";
|
|
12498
|
+
import { useState as useState27, useCallback as useCallback15 } from "react";
|
|
12047
12499
|
|
|
12048
12500
|
// src/components/primitives/KeyValueInput/KeyValueInput.styles.ts
|
|
12049
12501
|
import { css as css25 } from "@emotion/css";
|
|
@@ -12201,7 +12653,7 @@ var useStyles25 = (theme, colorScheme, disabled, readOnly, hasError) => {
|
|
|
12201
12653
|
var KeyValueInput_styles_default = useStyles25;
|
|
12202
12654
|
|
|
12203
12655
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
12204
|
-
import { jsx as
|
|
12656
|
+
import { jsx as jsx94, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
12205
12657
|
var KeyValueInput = ({
|
|
12206
12658
|
className = "",
|
|
12207
12659
|
disabled = false,
|
|
@@ -12224,10 +12676,10 @@ var KeyValueInput = ({
|
|
|
12224
12676
|
const { theme, colorScheme } = useTheme_default();
|
|
12225
12677
|
const styles = KeyValueInput_styles_default(theme, colorScheme, disabled, readOnly, !!error);
|
|
12226
12678
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
12227
|
-
const [pairs, setPairs] =
|
|
12228
|
-
const [newKey, setNewKey] =
|
|
12229
|
-
const [newValue, setNewValue] =
|
|
12230
|
-
const handleAddPair =
|
|
12679
|
+
const [pairs, setPairs] = useState27(initialPairs);
|
|
12680
|
+
const [newKey, setNewKey] = useState27("");
|
|
12681
|
+
const [newValue, setNewValue] = useState27("");
|
|
12682
|
+
const handleAddPair = useCallback15(() => {
|
|
12231
12683
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
12232
12684
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
12233
12685
|
const newPair = {
|
|
@@ -12245,7 +12697,7 @@ var KeyValueInput = ({
|
|
|
12245
12697
|
onAdd(newPair);
|
|
12246
12698
|
}
|
|
12247
12699
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
12248
|
-
const handleRemovePair =
|
|
12700
|
+
const handleRemovePair = useCallback15(
|
|
12249
12701
|
(index) => {
|
|
12250
12702
|
const pairToRemove = pairs[index];
|
|
12251
12703
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -12259,7 +12711,7 @@ var KeyValueInput = ({
|
|
|
12259
12711
|
},
|
|
12260
12712
|
[pairs, onChange, onRemove]
|
|
12261
12713
|
);
|
|
12262
|
-
const handleUpdatePair =
|
|
12714
|
+
const handleUpdatePair = useCallback15(
|
|
12263
12715
|
(index, field, newVal) => {
|
|
12264
12716
|
const updatedPairs = pairs.map((pair, i) => {
|
|
12265
12717
|
if (i === index) {
|
|
@@ -12276,105 +12728,105 @@ var KeyValueInput = ({
|
|
|
12276
12728
|
);
|
|
12277
12729
|
const canAddMore = !maxPairs || pairs.length < maxPairs;
|
|
12278
12730
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
12279
|
-
return /* @__PURE__ */
|
|
12280
|
-
label && /* @__PURE__ */
|
|
12731
|
+
return /* @__PURE__ */ jsxs42("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input")), styles.container, className), children: [
|
|
12732
|
+
label && /* @__PURE__ */ jsxs42("label", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "label")), styles.label), children: [
|
|
12281
12733
|
label,
|
|
12282
|
-
required && /* @__PURE__ */
|
|
12734
|
+
required && /* @__PURE__ */ jsx94(
|
|
12283
12735
|
"span",
|
|
12284
12736
|
{
|
|
12285
|
-
className:
|
|
12737
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "required")), styles.requiredIndicator),
|
|
12286
12738
|
children: " *"
|
|
12287
12739
|
}
|
|
12288
12740
|
)
|
|
12289
12741
|
] }),
|
|
12290
|
-
/* @__PURE__ */
|
|
12291
|
-
pairs.length === 0 && readOnly ? /* @__PURE__ */
|
|
12742
|
+
/* @__PURE__ */ jsxs42("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pairs-list")), styles.pairsList), children: [
|
|
12743
|
+
pairs.length === 0 && readOnly ? /* @__PURE__ */ jsx94("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "empty-state")), styles.emptyState), children: "No attributes defined" }) : readOnly ? pairs.map((pair, index) => /* @__PURE__ */ jsxs42(
|
|
12292
12744
|
"div",
|
|
12293
12745
|
{
|
|
12294
|
-
className:
|
|
12746
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "readonly-pair")), styles.readOnlyPair),
|
|
12295
12747
|
children: [
|
|
12296
|
-
/* @__PURE__ */
|
|
12748
|
+
/* @__PURE__ */ jsxs42(
|
|
12297
12749
|
"span",
|
|
12298
12750
|
{
|
|
12299
|
-
className:
|
|
12751
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "readonly-key")), styles.readOnlyKey),
|
|
12300
12752
|
children: [
|
|
12301
12753
|
pair.key,
|
|
12302
12754
|
":"
|
|
12303
12755
|
]
|
|
12304
12756
|
}
|
|
12305
12757
|
),
|
|
12306
|
-
/* @__PURE__ */
|
|
12758
|
+
/* @__PURE__ */ jsx94(
|
|
12307
12759
|
"span",
|
|
12308
12760
|
{
|
|
12309
|
-
className:
|
|
12761
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "readonly-value")), styles.readOnlyValue),
|
|
12310
12762
|
children: pair.value
|
|
12311
12763
|
}
|
|
12312
12764
|
)
|
|
12313
12765
|
]
|
|
12314
12766
|
},
|
|
12315
12767
|
`${pair.key}-${index}`
|
|
12316
|
-
)) : pairs.map((pair, index) => /* @__PURE__ */
|
|
12768
|
+
)) : pairs.map((pair, index) => /* @__PURE__ */ jsxs42(
|
|
12317
12769
|
"div",
|
|
12318
12770
|
{
|
|
12319
|
-
className:
|
|
12771
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pair-row")), styles.pairRow),
|
|
12320
12772
|
children: [
|
|
12321
|
-
/* @__PURE__ */
|
|
12773
|
+
/* @__PURE__ */ jsx94(
|
|
12322
12774
|
TextField_default,
|
|
12323
12775
|
{
|
|
12324
12776
|
placeholder: keyPlaceholder,
|
|
12325
12777
|
value: pair.key,
|
|
12326
12778
|
onChange: (e) => handleUpdatePair(index, "key", e.target.value),
|
|
12327
12779
|
disabled: disabled || readOnly,
|
|
12328
|
-
className:
|
|
12780
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pair-input")), styles.pairInput),
|
|
12329
12781
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
12330
12782
|
}
|
|
12331
12783
|
),
|
|
12332
|
-
/* @__PURE__ */
|
|
12784
|
+
/* @__PURE__ */ jsx94(
|
|
12333
12785
|
TextField_default,
|
|
12334
12786
|
{
|
|
12335
12787
|
placeholder: valuePlaceholder,
|
|
12336
12788
|
value: pair.value,
|
|
12337
12789
|
onChange: (e) => handleUpdatePair(index, "value", e.target.value),
|
|
12338
12790
|
disabled: disabled || readOnly,
|
|
12339
|
-
className:
|
|
12791
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pair-input")), styles.pairInput),
|
|
12340
12792
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
12341
12793
|
}
|
|
12342
12794
|
),
|
|
12343
|
-
!readOnly && /* @__PURE__ */
|
|
12795
|
+
!readOnly && /* @__PURE__ */ jsx94(
|
|
12344
12796
|
"button",
|
|
12345
12797
|
{
|
|
12346
12798
|
type: "button",
|
|
12347
12799
|
onClick: () => handleRemovePair(index),
|
|
12348
12800
|
disabled,
|
|
12349
|
-
className:
|
|
12801
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "remove-button")), styles.removeButton),
|
|
12350
12802
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
12351
|
-
children: /* @__PURE__ */
|
|
12803
|
+
children: /* @__PURE__ */ jsx94(X_default, { width: 16, height: 16 })
|
|
12352
12804
|
}
|
|
12353
12805
|
)
|
|
12354
12806
|
]
|
|
12355
12807
|
},
|
|
12356
12808
|
`${pair.key}-${index}`
|
|
12357
12809
|
)),
|
|
12358
|
-
!readOnly && /* @__PURE__ */
|
|
12359
|
-
/* @__PURE__ */
|
|
12810
|
+
!readOnly && /* @__PURE__ */ jsxs42("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "add-row")), styles.addRow), children: [
|
|
12811
|
+
/* @__PURE__ */ jsx94(
|
|
12360
12812
|
TextField_default,
|
|
12361
12813
|
{
|
|
12362
12814
|
placeholder: keyPlaceholder,
|
|
12363
12815
|
value: newKey,
|
|
12364
12816
|
onChange: (e) => setNewKey(e.target.value),
|
|
12365
12817
|
disabled,
|
|
12366
|
-
className:
|
|
12818
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pair-input")), styles.pairInput),
|
|
12367
12819
|
"aria-label": "New key"
|
|
12368
12820
|
}
|
|
12369
12821
|
),
|
|
12370
|
-
/* @__PURE__ */
|
|
12822
|
+
/* @__PURE__ */ jsx94(
|
|
12371
12823
|
TextField_default,
|
|
12372
12824
|
{
|
|
12373
12825
|
placeholder: valuePlaceholder,
|
|
12374
12826
|
value: newValue,
|
|
12375
12827
|
onChange: (e) => setNewValue(e.target.value),
|
|
12376
12828
|
disabled,
|
|
12377
|
-
className:
|
|
12829
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "pair-input")), styles.pairInput),
|
|
12378
12830
|
"aria-label": "New value",
|
|
12379
12831
|
onKeyPress: (e) => {
|
|
12380
12832
|
if (e.key === "Enter" && !isAddDisabled) {
|
|
@@ -12383,21 +12835,21 @@ var KeyValueInput = ({
|
|
|
12383
12835
|
}
|
|
12384
12836
|
}
|
|
12385
12837
|
),
|
|
12386
|
-
/* @__PURE__ */
|
|
12838
|
+
/* @__PURE__ */ jsx94(
|
|
12387
12839
|
"button",
|
|
12388
12840
|
{
|
|
12389
12841
|
type: "button",
|
|
12390
12842
|
onClick: handleAddPair,
|
|
12391
12843
|
disabled: isAddDisabled,
|
|
12392
|
-
className:
|
|
12844
|
+
className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "add-button")), styles.addButton),
|
|
12393
12845
|
"aria-label": "Add new key-value pair",
|
|
12394
|
-
children: /* @__PURE__ */
|
|
12846
|
+
children: /* @__PURE__ */ jsx94(Plus_default, { width: 16, height: 16 })
|
|
12395
12847
|
}
|
|
12396
12848
|
)
|
|
12397
12849
|
] })
|
|
12398
12850
|
] }),
|
|
12399
|
-
(helperText || error) && /* @__PURE__ */
|
|
12400
|
-
maxPairs && /* @__PURE__ */
|
|
12851
|
+
(helperText || error) && /* @__PURE__ */ jsx94("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "helper-text")), styles.helperText), children: error || helperText }),
|
|
12852
|
+
maxPairs && /* @__PURE__ */ jsxs42("div", { className: cx30(withVendorCSSClassPrefix29(bem20("key-value-input", "counter")), styles.counterText), children: [
|
|
12401
12853
|
pairs.length,
|
|
12402
12854
|
" of ",
|
|
12403
12855
|
maxPairs,
|
|
@@ -12564,7 +13016,7 @@ var useStyles26 = (theme, colorScheme) => {
|
|
|
12564
13016
|
var BaseOrganizationProfile_styles_default = useStyles26;
|
|
12565
13017
|
|
|
12566
13018
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
12567
|
-
import { Fragment as Fragment19, jsx as
|
|
13019
|
+
import { Fragment as Fragment19, jsx as jsx95, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12568
13020
|
var BaseOrganizationProfile = ({
|
|
12569
13021
|
fallback = null,
|
|
12570
13022
|
className = "",
|
|
@@ -12613,9 +13065,9 @@ var BaseOrganizationProfile = ({
|
|
|
12613
13065
|
}) => {
|
|
12614
13066
|
const { theme, colorScheme } = useTheme_default();
|
|
12615
13067
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
12616
|
-
const [editedOrganization, setEditedOrganization] =
|
|
12617
|
-
const [editingFields, setEditingFields] =
|
|
12618
|
-
const PencilIcon = () => /* @__PURE__ */
|
|
13068
|
+
const [editedOrganization, setEditedOrganization] = useState28(organization);
|
|
13069
|
+
const [editingFields, setEditingFields] = useState28({});
|
|
13070
|
+
const PencilIcon = () => /* @__PURE__ */ jsx95(
|
|
12619
13071
|
"svg",
|
|
12620
13072
|
{
|
|
12621
13073
|
width: "16",
|
|
@@ -12626,16 +13078,16 @@ var BaseOrganizationProfile = ({
|
|
|
12626
13078
|
strokeWidth: "2",
|
|
12627
13079
|
strokeLinecap: "round",
|
|
12628
13080
|
strokeLinejoin: "round",
|
|
12629
|
-
children: /* @__PURE__ */
|
|
13081
|
+
children: /* @__PURE__ */ jsx95("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
12630
13082
|
}
|
|
12631
13083
|
);
|
|
12632
|
-
const toggleFieldEdit =
|
|
13084
|
+
const toggleFieldEdit = useCallback16((fieldName) => {
|
|
12633
13085
|
setEditingFields((prev) => ({
|
|
12634
13086
|
...prev,
|
|
12635
13087
|
[fieldName]: !prev[fieldName]
|
|
12636
13088
|
}));
|
|
12637
13089
|
}, []);
|
|
12638
|
-
const getFieldPlaceholder =
|
|
13090
|
+
const getFieldPlaceholder = useCallback16((fieldKey) => {
|
|
12639
13091
|
const fieldLabels = {
|
|
12640
13092
|
name: "organization name",
|
|
12641
13093
|
description: "organization description",
|
|
@@ -12646,7 +13098,7 @@ var BaseOrganizationProfile = ({
|
|
|
12646
13098
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
12647
13099
|
return `Enter ${fieldLabel}`;
|
|
12648
13100
|
}, []);
|
|
12649
|
-
const handleFieldSave =
|
|
13101
|
+
const handleFieldSave = useCallback16(
|
|
12650
13102
|
(fieldKey) => {
|
|
12651
13103
|
if (!onUpdate || !fieldKey) return;
|
|
12652
13104
|
const fieldValue = editedOrganization && fieldKey && editedOrganization[fieldKey] !== void 0 ? editedOrganization[fieldKey] : organization && organization[fieldKey] !== void 0 ? organization[fieldKey] : "";
|
|
@@ -12658,7 +13110,7 @@ var BaseOrganizationProfile = ({
|
|
|
12658
13110
|
},
|
|
12659
13111
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
12660
13112
|
);
|
|
12661
|
-
const handleFieldCancel =
|
|
13113
|
+
const handleFieldCancel = useCallback16(
|
|
12662
13114
|
(fieldKey) => {
|
|
12663
13115
|
setEditedOrganization((prev) => ({
|
|
12664
13116
|
...prev,
|
|
@@ -12684,12 +13136,12 @@ var BaseOrganizationProfile = ({
|
|
|
12684
13136
|
value: typeof fieldValue === "object" ? JSON.stringify(fieldValue) : String(fieldValue || ""),
|
|
12685
13137
|
onChange: (e) => onEditValue(e.target ? e.target.value : e),
|
|
12686
13138
|
placeholder: getFieldPlaceholder(key),
|
|
12687
|
-
className:
|
|
13139
|
+
className: cx31(styles.fieldInput)
|
|
12688
13140
|
};
|
|
12689
13141
|
let fieldInput;
|
|
12690
13142
|
if (key === "attributes") {
|
|
12691
13143
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
12692
|
-
fieldInput = /* @__PURE__ */
|
|
13144
|
+
fieldInput = /* @__PURE__ */ jsx95(
|
|
12693
13145
|
KeyValueInput_default,
|
|
12694
13146
|
{
|
|
12695
13147
|
value: attributesValue,
|
|
@@ -12727,26 +13179,26 @@ var BaseOrganizationProfile = ({
|
|
|
12727
13179
|
}
|
|
12728
13180
|
);
|
|
12729
13181
|
} else {
|
|
12730
|
-
fieldInput = /* @__PURE__ */
|
|
13182
|
+
fieldInput = /* @__PURE__ */ jsx95(TextField_default, { ...commonProps });
|
|
12731
13183
|
}
|
|
12732
|
-
return /* @__PURE__ */
|
|
12733
|
-
/* @__PURE__ */
|
|
12734
|
-
/* @__PURE__ */
|
|
13184
|
+
return /* @__PURE__ */ jsxs43(Fragment19, { children: [
|
|
13185
|
+
/* @__PURE__ */ jsx95("span", { className: cx31(styles.label), children: label }),
|
|
13186
|
+
/* @__PURE__ */ jsx95("div", { className: cx31(styles.value), children: fieldInput })
|
|
12735
13187
|
] });
|
|
12736
13188
|
}
|
|
12737
13189
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
12738
13190
|
const isFieldEditable = editable && fieldEditable;
|
|
12739
13191
|
let displayValue;
|
|
12740
13192
|
if (hasValue) {
|
|
12741
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */
|
|
13193
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ jsx95(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
12742
13194
|
} else if (isFieldEditable) {
|
|
12743
13195
|
displayValue = getFieldPlaceholder(key);
|
|
12744
13196
|
} else {
|
|
12745
13197
|
displayValue = "-";
|
|
12746
13198
|
}
|
|
12747
|
-
return /* @__PURE__ */
|
|
12748
|
-
/* @__PURE__ */
|
|
12749
|
-
/* @__PURE__ */
|
|
13199
|
+
return /* @__PURE__ */ jsxs43(Fragment19, { children: [
|
|
13200
|
+
/* @__PURE__ */ jsx95("span", { className: cx31(styles.label), children: label }),
|
|
13201
|
+
/* @__PURE__ */ jsx95("div", { className: cx31(styles.value, !hasValue && styles.valueEmpty), children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ jsx95(
|
|
12750
13202
|
Button_default,
|
|
12751
13203
|
{
|
|
12752
13204
|
onClick: onStartEdit,
|
|
@@ -12754,7 +13206,7 @@ var BaseOrganizationProfile = ({
|
|
|
12754
13206
|
color: "secondary",
|
|
12755
13207
|
size: "small",
|
|
12756
13208
|
title: "Click to edit",
|
|
12757
|
-
className:
|
|
13209
|
+
className: cx31(styles.placeholderButton),
|
|
12758
13210
|
children: displayValue
|
|
12759
13211
|
}
|
|
12760
13212
|
) : displayValue })
|
|
@@ -12769,8 +13221,8 @@ var BaseOrganizationProfile = ({
|
|
|
12769
13221
|
if (!shouldShow) {
|
|
12770
13222
|
return null;
|
|
12771
13223
|
}
|
|
12772
|
-
return /* @__PURE__ */
|
|
12773
|
-
/* @__PURE__ */
|
|
13224
|
+
return /* @__PURE__ */ jsxs43("div", { className: cx31(styles.field), children: [
|
|
13225
|
+
/* @__PURE__ */ jsx95("div", { className: cx31(styles.fieldContent), children: renderField(
|
|
12774
13226
|
field,
|
|
12775
13227
|
isFieldEditing,
|
|
12776
13228
|
(value) => {
|
|
@@ -12780,8 +13232,8 @@ var BaseOrganizationProfile = ({
|
|
|
12780
13232
|
},
|
|
12781
13233
|
() => toggleFieldEdit(field.key)
|
|
12782
13234
|
) }),
|
|
12783
|
-
isFieldEditable && /* @__PURE__ */
|
|
12784
|
-
/* @__PURE__ */
|
|
13235
|
+
isFieldEditable && /* @__PURE__ */ jsx95("div", { className: cx31(styles.fieldActions), children: isFieldEditing ? /* @__PURE__ */ jsxs43(Fragment19, { children: [
|
|
13236
|
+
/* @__PURE__ */ jsx95(
|
|
12785
13237
|
Button_default,
|
|
12786
13238
|
{
|
|
12787
13239
|
onClick: () => handleFieldSave(field.key),
|
|
@@ -12792,7 +13244,7 @@ var BaseOrganizationProfile = ({
|
|
|
12792
13244
|
children: saveButtonText
|
|
12793
13245
|
}
|
|
12794
13246
|
),
|
|
12795
|
-
/* @__PURE__ */
|
|
13247
|
+
/* @__PURE__ */ jsx95(
|
|
12796
13248
|
Button_default,
|
|
12797
13249
|
{
|
|
12798
13250
|
onClick: () => handleFieldCancel(field.key),
|
|
@@ -12803,7 +13255,7 @@ var BaseOrganizationProfile = ({
|
|
|
12803
13255
|
children: cancelButtonText
|
|
12804
13256
|
}
|
|
12805
13257
|
)
|
|
12806
|
-
] }) : hasValue && /* @__PURE__ */
|
|
13258
|
+
] }) : hasValue && /* @__PURE__ */ jsx95(
|
|
12807
13259
|
Button_default,
|
|
12808
13260
|
{
|
|
12809
13261
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -12811,8 +13263,8 @@ var BaseOrganizationProfile = ({
|
|
|
12811
13263
|
color: "secondary",
|
|
12812
13264
|
size: "small",
|
|
12813
13265
|
title: "Edit field",
|
|
12814
|
-
className:
|
|
12815
|
-
children: /* @__PURE__ */
|
|
13266
|
+
className: cx31(styles.editButton),
|
|
13267
|
+
children: /* @__PURE__ */ jsx95(PencilIcon, {})
|
|
12816
13268
|
}
|
|
12817
13269
|
) })
|
|
12818
13270
|
] }, field.key);
|
|
@@ -12820,23 +13272,23 @@ var BaseOrganizationProfile = ({
|
|
|
12820
13272
|
if (!organization) {
|
|
12821
13273
|
return fallback;
|
|
12822
13274
|
}
|
|
12823
|
-
const profileContent = /* @__PURE__ */
|
|
12824
|
-
/* @__PURE__ */
|
|
12825
|
-
/* @__PURE__ */
|
|
12826
|
-
/* @__PURE__ */
|
|
12827
|
-
/* @__PURE__ */
|
|
12828
|
-
organization.orgHandle && /* @__PURE__ */
|
|
13275
|
+
const profileContent = /* @__PURE__ */ jsxs43(Card_default, { className: cx31(styles.root, cardLayout && styles.card, className), children: [
|
|
13276
|
+
/* @__PURE__ */ jsxs43("div", { className: cx31(styles.header), children: [
|
|
13277
|
+
/* @__PURE__ */ jsx95(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
13278
|
+
/* @__PURE__ */ jsxs43("div", { className: cx31(styles.orgInfo), children: [
|
|
13279
|
+
/* @__PURE__ */ jsx95("h2", { className: cx31(styles.name), children: organization.name }),
|
|
13280
|
+
organization.orgHandle && /* @__PURE__ */ jsxs43("p", { className: cx31(styles.handle), children: [
|
|
12829
13281
|
"@",
|
|
12830
13282
|
organization.orgHandle
|
|
12831
13283
|
] })
|
|
12832
13284
|
] })
|
|
12833
13285
|
] }),
|
|
12834
|
-
/* @__PURE__ */
|
|
13286
|
+
/* @__PURE__ */ jsx95("div", { className: cx31(styles.infoContainer), children: fields.map((field, index) => renderOrganizationField(field)) })
|
|
12835
13287
|
] });
|
|
12836
13288
|
if (mode === "popup") {
|
|
12837
|
-
return /* @__PURE__ */
|
|
12838
|
-
/* @__PURE__ */
|
|
12839
|
-
/* @__PURE__ */
|
|
13289
|
+
return /* @__PURE__ */ jsx95(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs43(Dialog_default.Content, { children: [
|
|
13290
|
+
/* @__PURE__ */ jsx95(Dialog_default.Heading, { children: title }),
|
|
13291
|
+
/* @__PURE__ */ jsx95("div", { className: cx31(styles.popup), children: profileContent })
|
|
12840
13292
|
] }) });
|
|
12841
13293
|
}
|
|
12842
13294
|
return profileContent;
|
|
@@ -12905,7 +13357,7 @@ var updateOrganization = async ({
|
|
|
12905
13357
|
var updateOrganization_default = updateOrganization;
|
|
12906
13358
|
|
|
12907
13359
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
12908
|
-
import { jsx as
|
|
13360
|
+
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
12909
13361
|
var OrganizationProfile = ({
|
|
12910
13362
|
organizationId,
|
|
12911
13363
|
mode = "default",
|
|
@@ -12913,15 +13365,15 @@ var OrganizationProfile = ({
|
|
|
12913
13365
|
onOpenChange,
|
|
12914
13366
|
onUpdate,
|
|
12915
13367
|
popupTitle,
|
|
12916
|
-
loadingFallback = /* @__PURE__ */
|
|
12917
|
-
errorFallback = /* @__PURE__ */
|
|
13368
|
+
loadingFallback = /* @__PURE__ */ jsx96("div", { children: "Loading organization..." }),
|
|
13369
|
+
errorFallback = /* @__PURE__ */ jsx96("div", { children: "Failed to load organization data" }),
|
|
12918
13370
|
...rest
|
|
12919
13371
|
}) => {
|
|
12920
13372
|
const { baseUrl } = useAsgardeo_default();
|
|
12921
13373
|
const { t } = useTranslation_default();
|
|
12922
|
-
const [organization, setOrganization] =
|
|
12923
|
-
const [loading, setLoading] =
|
|
12924
|
-
const [error, setError] =
|
|
13374
|
+
const [organization, setOrganization] = useState29(null);
|
|
13375
|
+
const [loading, setLoading] = useState29(true);
|
|
13376
|
+
const [error, setError] = useState29(false);
|
|
12925
13377
|
const fetchOrganization = async () => {
|
|
12926
13378
|
if (!baseUrl || !organizationId) {
|
|
12927
13379
|
setLoading(false);
|
|
@@ -12944,7 +13396,7 @@ var OrganizationProfile = ({
|
|
|
12944
13396
|
setLoading(false);
|
|
12945
13397
|
}
|
|
12946
13398
|
};
|
|
12947
|
-
|
|
13399
|
+
useEffect16(() => {
|
|
12948
13400
|
fetchOrganization();
|
|
12949
13401
|
}, [baseUrl, organizationId]);
|
|
12950
13402
|
const handleOrganizationUpdate = async (payload) => {
|
|
@@ -12965,7 +13417,7 @@ var OrganizationProfile = ({
|
|
|
12965
13417
|
throw err;
|
|
12966
13418
|
}
|
|
12967
13419
|
};
|
|
12968
|
-
return /* @__PURE__ */
|
|
13420
|
+
return /* @__PURE__ */ jsx96(
|
|
12969
13421
|
BaseOrganizationProfile_default,
|
|
12970
13422
|
{
|
|
12971
13423
|
organization,
|
|
@@ -12973,7 +13425,7 @@ var OrganizationProfile = ({
|
|
|
12973
13425
|
mode: mode === "popup" ? "popup" : "inline",
|
|
12974
13426
|
open,
|
|
12975
13427
|
onOpenChange,
|
|
12976
|
-
title: popupTitle || t("organization.profile.
|
|
13428
|
+
title: popupTitle || t("organization.profile.heading"),
|
|
12977
13429
|
...rest
|
|
12978
13430
|
}
|
|
12979
13431
|
);
|
|
@@ -12981,11 +13433,11 @@ var OrganizationProfile = ({
|
|
|
12981
13433
|
var OrganizationProfile_default = OrganizationProfile;
|
|
12982
13434
|
|
|
12983
13435
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
12984
|
-
import { cx as
|
|
12985
|
-
import { useEffect as
|
|
13436
|
+
import { cx as cx33 } from "@emotion/css";
|
|
13437
|
+
import { useEffect as useEffect17, useState as useState30 } from "react";
|
|
12986
13438
|
|
|
12987
13439
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
12988
|
-
import { cx as
|
|
13440
|
+
import { cx as cx32 } from "@emotion/css";
|
|
12989
13441
|
import { useMemo as useMemo36 } from "react";
|
|
12990
13442
|
|
|
12991
13443
|
// src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts
|
|
@@ -13215,24 +13667,24 @@ var useStyles27 = (theme, colorScheme) => {
|
|
|
13215
13667
|
var BaseOrganizationList_styles_default = useStyles27;
|
|
13216
13668
|
|
|
13217
13669
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
13218
|
-
import { jsx as
|
|
13670
|
+
import { jsx as jsx97, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
13219
13671
|
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => {
|
|
13220
|
-
return /* @__PURE__ */
|
|
13221
|
-
/* @__PURE__ */
|
|
13222
|
-
/* @__PURE__ */
|
|
13223
|
-
/* @__PURE__ */
|
|
13224
|
-
/* @__PURE__ */
|
|
13225
|
-
/* @__PURE__ */
|
|
13672
|
+
return /* @__PURE__ */ jsxs44("div", { className: cx32(styles.organizationItem), children: [
|
|
13673
|
+
/* @__PURE__ */ jsxs44("div", { className: cx32(styles.organizationContent), children: [
|
|
13674
|
+
/* @__PURE__ */ jsx97(Avatar_default, { variant: "square", name: organization.name, size: 48, alt: `${organization.name} logo` }),
|
|
13675
|
+
/* @__PURE__ */ jsxs44("div", { className: cx32(styles.organizationInfo), children: [
|
|
13676
|
+
/* @__PURE__ */ jsx97(Typography_default, { variant: "h6", className: cx32(styles.organizationName), children: organization.name }),
|
|
13677
|
+
/* @__PURE__ */ jsxs44(Typography_default, { variant: "body2", color: "textSecondary", className: cx32(styles.organizationHandle), children: [
|
|
13226
13678
|
"@",
|
|
13227
13679
|
organization.orgHandle
|
|
13228
13680
|
] }),
|
|
13229
|
-
showStatus && /* @__PURE__ */
|
|
13681
|
+
showStatus && /* @__PURE__ */ jsxs44(Typography_default, { variant: "body2", color: "textSecondary", className: cx32(styles.organizationStatus), children: [
|
|
13230
13682
|
t("organization.switcher.status.label"),
|
|
13231
13683
|
" ",
|
|
13232
|
-
/* @__PURE__ */
|
|
13684
|
+
/* @__PURE__ */ jsx97(
|
|
13233
13685
|
"span",
|
|
13234
13686
|
{
|
|
13235
|
-
className:
|
|
13687
|
+
className: cx32(
|
|
13236
13688
|
styles.statusText,
|
|
13237
13689
|
organization.status === "ACTIVE" ? styles.statusTextActive : styles.statusTextInactive
|
|
13238
13690
|
),
|
|
@@ -13242,7 +13694,7 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13242
13694
|
] })
|
|
13243
13695
|
] })
|
|
13244
13696
|
] }),
|
|
13245
|
-
organization.canSwitch && /* @__PURE__ */
|
|
13697
|
+
organization.canSwitch && /* @__PURE__ */ jsx97("div", { className: cx32(styles.organizationActions), children: /* @__PURE__ */ jsx97(
|
|
13246
13698
|
Button_default,
|
|
13247
13699
|
{
|
|
13248
13700
|
onClick: (e) => {
|
|
@@ -13251,22 +13703,22 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13251
13703
|
},
|
|
13252
13704
|
type: "button",
|
|
13253
13705
|
size: "small",
|
|
13254
|
-
children: t("organization.switcher.switch.
|
|
13706
|
+
children: t("organization.switcher.buttons.switch.text")
|
|
13255
13707
|
}
|
|
13256
13708
|
) })
|
|
13257
13709
|
] }, organization.id);
|
|
13258
13710
|
};
|
|
13259
|
-
var defaultRenderLoading = (t, styles) => /* @__PURE__ */
|
|
13260
|
-
/* @__PURE__ */
|
|
13261
|
-
/* @__PURE__ */
|
|
13711
|
+
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ jsxs44("div", { className: cx32(styles.loadingContainer), children: [
|
|
13712
|
+
/* @__PURE__ */ jsx97(Spinner_default, { size: "medium" }),
|
|
13713
|
+
/* @__PURE__ */ jsx97(Typography_default, { variant: "body1", color: "textSecondary", className: cx32(styles.loadingText), children: t("organization.switcher.loading.placeholder.organizations") })
|
|
13262
13714
|
] });
|
|
13263
|
-
var defaultRenderError = (error, t, styles) => /* @__PURE__ */
|
|
13264
|
-
/* @__PURE__ */
|
|
13715
|
+
var defaultRenderError = (error, t, styles) => /* @__PURE__ */ jsx97("div", { className: cx32(styles.errorContainer), children: /* @__PURE__ */ jsxs44(Typography_default, { variant: "body1", color: "error", children: [
|
|
13716
|
+
/* @__PURE__ */ jsx97("strong", { children: t("organization.switcher.error.prefix") }),
|
|
13265
13717
|
" ",
|
|
13266
13718
|
error
|
|
13267
13719
|
] }) });
|
|
13268
|
-
var defaultRenderLoadMore = (onLoadMore, isLoading, t, styles) => /* @__PURE__ */
|
|
13269
|
-
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */
|
|
13720
|
+
var defaultRenderLoadMore = (onLoadMore, isLoading, t, styles) => /* @__PURE__ */ jsx97(Button_default, { onClick: onLoadMore, disabled: isLoading, className: cx32(styles.loadMoreButton), type: "button", fullWidth: true, children: isLoading ? t("organization.switcher.loading.more") : t("organization.switcher.buttons.load_more.text") });
|
|
13721
|
+
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ jsx97("div", { className: cx32(styles.emptyContainer), children: /* @__PURE__ */ jsx97(Typography_default, { variant: "body1", color: "textSecondary", className: cx32(styles.emptyText), children: t("organization.switcher.no.organizations") }) });
|
|
13270
13722
|
var BaseOrganizationList = ({
|
|
13271
13723
|
className = "",
|
|
13272
13724
|
allOrganizations,
|
|
@@ -13309,53 +13761,53 @@ var BaseOrganizationList = ({
|
|
|
13309
13761
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, isLoading2) => defaultRenderLoadMore(onLoadMore, isLoading2, t, styles));
|
|
13310
13762
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));
|
|
13311
13763
|
if (isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13312
|
-
const loadingContent = /* @__PURE__ */
|
|
13764
|
+
const loadingContent = /* @__PURE__ */ jsx97("div", { className: cx32(styles.root, className), style, children: renderLoadingWithStyles() });
|
|
13313
13765
|
if (mode === "popup") {
|
|
13314
|
-
return /* @__PURE__ */
|
|
13315
|
-
/* @__PURE__ */
|
|
13316
|
-
/* @__PURE__ */
|
|
13766
|
+
return /* @__PURE__ */ jsx97(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(Dialog_default.Content, { children: [
|
|
13767
|
+
/* @__PURE__ */ jsx97(Dialog_default.Heading, { children: title }),
|
|
13768
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.popupContent), children: loadingContent })
|
|
13317
13769
|
] }) });
|
|
13318
13770
|
}
|
|
13319
13771
|
return loadingContent;
|
|
13320
13772
|
}
|
|
13321
13773
|
if (error && organizationsWithSwitchAccess?.length === 0) {
|
|
13322
|
-
const errorContent = /* @__PURE__ */
|
|
13774
|
+
const errorContent = /* @__PURE__ */ jsx97("div", { className: cx32(styles.root, className), style, children: renderErrorWithStyles(error) });
|
|
13323
13775
|
if (mode === "popup") {
|
|
13324
|
-
return /* @__PURE__ */
|
|
13325
|
-
/* @__PURE__ */
|
|
13326
|
-
/* @__PURE__ */
|
|
13776
|
+
return /* @__PURE__ */ jsx97(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(Dialog_default.Content, { children: [
|
|
13777
|
+
/* @__PURE__ */ jsx97(Dialog_default.Heading, { children: title }),
|
|
13778
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.popupContent), children: errorContent })
|
|
13327
13779
|
] }) });
|
|
13328
13780
|
}
|
|
13329
13781
|
return errorContent;
|
|
13330
13782
|
}
|
|
13331
13783
|
if (!isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13332
|
-
const emptyContent = /* @__PURE__ */
|
|
13784
|
+
const emptyContent = /* @__PURE__ */ jsx97("div", { className: cx32(styles.root, className), style, children: renderEmptyWithStyles() });
|
|
13333
13785
|
if (mode === "popup") {
|
|
13334
|
-
return /* @__PURE__ */
|
|
13335
|
-
/* @__PURE__ */
|
|
13336
|
-
/* @__PURE__ */
|
|
13786
|
+
return /* @__PURE__ */ jsx97(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(Dialog_default.Content, { children: [
|
|
13787
|
+
/* @__PURE__ */ jsx97(Dialog_default.Heading, { children: title }),
|
|
13788
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.popupContent), children: emptyContent })
|
|
13337
13789
|
] }) });
|
|
13338
13790
|
}
|
|
13339
13791
|
return emptyContent;
|
|
13340
13792
|
}
|
|
13341
|
-
const organizationListContent = /* @__PURE__ */
|
|
13342
|
-
/* @__PURE__ */
|
|
13343
|
-
/* @__PURE__ */
|
|
13793
|
+
const organizationListContent = /* @__PURE__ */ jsxs44("div", { className: cx32(styles.root, className), style, children: [
|
|
13794
|
+
/* @__PURE__ */ jsxs44("div", { className: cx32(styles.header), children: [
|
|
13795
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.headerInfo), children: /* @__PURE__ */ jsx97(Typography_default, { variant: "body2", color: "textSecondary", className: cx32(styles.subtitle), children: t("organization.switcher.showing.count", {
|
|
13344
13796
|
showing: organizationsWithSwitchAccess?.length,
|
|
13345
13797
|
total: allOrganizations?.organizations?.length || 0
|
|
13346
13798
|
}) }) }),
|
|
13347
|
-
onRefresh && /* @__PURE__ */
|
|
13799
|
+
onRefresh && /* @__PURE__ */ jsx97(Button_default, { onClick: onRefresh, className: cx32(styles.refreshButton), type: "button", variant: "outline", size: "small", children: t("organization.switcher.buttons.refresh.text") })
|
|
13348
13800
|
] }),
|
|
13349
|
-
/* @__PURE__ */
|
|
13801
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.listContainer), children: organizationsWithSwitchAccess?.map(
|
|
13350
13802
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
13351
13803
|
) }),
|
|
13352
|
-
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */
|
|
13353
|
-
hasMore && fetchMore && /* @__PURE__ */
|
|
13804
|
+
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ jsx97("div", { className: cx32(styles.errorMargin), children: renderErrorWithStyles(error) }),
|
|
13805
|
+
hasMore && fetchMore && /* @__PURE__ */ jsx97("div", { className: cx32(styles.loadMoreMargin), children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
13354
13806
|
] });
|
|
13355
13807
|
if (mode === "popup") {
|
|
13356
|
-
return /* @__PURE__ */
|
|
13357
|
-
/* @__PURE__ */
|
|
13358
|
-
/* @__PURE__ */
|
|
13808
|
+
return /* @__PURE__ */ jsx97(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(Dialog_default.Content, { children: [
|
|
13809
|
+
/* @__PURE__ */ jsx97(Dialog_default.Heading, { children: title }),
|
|
13810
|
+
/* @__PURE__ */ jsx97("div", { className: cx32(styles.popupContent), children: organizationListContent })
|
|
13359
13811
|
] }) });
|
|
13360
13812
|
}
|
|
13361
13813
|
return organizationListContent;
|
|
@@ -13426,7 +13878,7 @@ var useStyles28 = (theme, colorScheme) => {
|
|
|
13426
13878
|
var OrganizationList_styles_default = useStyles28;
|
|
13427
13879
|
|
|
13428
13880
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
13429
|
-
import { jsx as
|
|
13881
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
13430
13882
|
var OrganizationList = ({
|
|
13431
13883
|
autoFetch = true,
|
|
13432
13884
|
filter = "",
|
|
@@ -13440,15 +13892,15 @@ var OrganizationList = ({
|
|
|
13440
13892
|
const { theme, colorScheme } = useTheme_default();
|
|
13441
13893
|
const styles = OrganizationList_styles_default(theme, colorScheme);
|
|
13442
13894
|
const { getAllOrganizations: getAllOrganizations2, error, isLoading, myOrganizations } = useOrganization_default();
|
|
13443
|
-
const [allOrganizations, setAllOrganizations] =
|
|
13895
|
+
const [allOrganizations, setAllOrganizations] = useState30({
|
|
13444
13896
|
organizations: []
|
|
13445
13897
|
});
|
|
13446
|
-
|
|
13898
|
+
useEffect17(() => {
|
|
13447
13899
|
(async () => {
|
|
13448
13900
|
setAllOrganizations(await getAllOrganizations2());
|
|
13449
13901
|
})();
|
|
13450
13902
|
}, []);
|
|
13451
|
-
return /* @__PURE__ */
|
|
13903
|
+
return /* @__PURE__ */ jsx98("div", { className: cx33(styles.root, className), style, children: /* @__PURE__ */ jsx98("div", { className: cx33(styles.container), children: /* @__PURE__ */ jsx98(
|
|
13452
13904
|
BaseOrganizationList_default,
|
|
13453
13905
|
{
|
|
13454
13906
|
allOrganizations,
|
|
@@ -13463,8 +13915,8 @@ var OrganizationList = ({
|
|
|
13463
13915
|
var OrganizationList_default = OrganizationList;
|
|
13464
13916
|
|
|
13465
13917
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
13466
|
-
import { jsx as
|
|
13467
|
-
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
13918
|
+
import { jsx as jsx99, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
13919
|
+
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsxs45(
|
|
13468
13920
|
"svg",
|
|
13469
13921
|
{
|
|
13470
13922
|
width,
|
|
@@ -13477,13 +13929,13 @@ var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @_
|
|
|
13477
13929
|
strokeLinecap: "round",
|
|
13478
13930
|
strokeLinejoin: "round",
|
|
13479
13931
|
children: [
|
|
13480
|
-
/* @__PURE__ */
|
|
13481
|
-
/* @__PURE__ */
|
|
13482
|
-
/* @__PURE__ */
|
|
13483
|
-
/* @__PURE__ */
|
|
13484
|
-
/* @__PURE__ */
|
|
13485
|
-
/* @__PURE__ */
|
|
13486
|
-
/* @__PURE__ */
|
|
13932
|
+
/* @__PURE__ */ jsx99("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
13933
|
+
/* @__PURE__ */ jsx99("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
13934
|
+
/* @__PURE__ */ jsx99("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
13935
|
+
/* @__PURE__ */ jsx99("path", { d: "M10 6h4" }),
|
|
13936
|
+
/* @__PURE__ */ jsx99("path", { d: "M10 10h4" }),
|
|
13937
|
+
/* @__PURE__ */ jsx99("path", { d: "M10 14h4" }),
|
|
13938
|
+
/* @__PURE__ */ jsx99("path", { d: "M10 18h4" })
|
|
13487
13939
|
]
|
|
13488
13940
|
}
|
|
13489
13941
|
);
|
|
@@ -13491,7 +13943,7 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
13491
13943
|
var BuildingAlt_default = BuildingAlt;
|
|
13492
13944
|
|
|
13493
13945
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
13494
|
-
import { Fragment as Fragment20, jsx as
|
|
13946
|
+
import { Fragment as Fragment20, jsx as jsx100, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13495
13947
|
var OrganizationSwitcher = ({
|
|
13496
13948
|
currentOrganization: propCurrentOrganization,
|
|
13497
13949
|
fallback = null,
|
|
@@ -13507,15 +13959,15 @@ var OrganizationSwitcher = ({
|
|
|
13507
13959
|
isLoading,
|
|
13508
13960
|
error
|
|
13509
13961
|
} = useOrganization_default();
|
|
13510
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] =
|
|
13511
|
-
const [isProfileOpen, setIsProfileOpen] =
|
|
13512
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] =
|
|
13962
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = useState31(false);
|
|
13963
|
+
const [isProfileOpen, setIsProfileOpen] = useState31(false);
|
|
13964
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = useState31(false);
|
|
13513
13965
|
const { t } = useTranslation_default();
|
|
13514
13966
|
if (!isSignedIn && fallback) {
|
|
13515
13967
|
return fallback;
|
|
13516
13968
|
}
|
|
13517
13969
|
if (!isSignedIn) {
|
|
13518
|
-
return /* @__PURE__ */
|
|
13970
|
+
return /* @__PURE__ */ jsx100(Fragment20, {});
|
|
13519
13971
|
}
|
|
13520
13972
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
13521
13973
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -13529,19 +13981,19 @@ var OrganizationSwitcher = ({
|
|
|
13529
13981
|
const defaultMenuItems = [];
|
|
13530
13982
|
if (currentOrganization) {
|
|
13531
13983
|
defaultMenuItems.push({
|
|
13532
|
-
icon: /* @__PURE__ */
|
|
13984
|
+
icon: /* @__PURE__ */ jsx100(BuildingAlt_default, {}),
|
|
13533
13985
|
label: t("organization.switcher.manage.organizations"),
|
|
13534
13986
|
onClick: handleManageOrganizations
|
|
13535
13987
|
});
|
|
13536
13988
|
}
|
|
13537
13989
|
defaultMenuItems.push({
|
|
13538
|
-
icon: /* @__PURE__ */
|
|
13990
|
+
icon: /* @__PURE__ */ jsx100("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx100("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
13539
13991
|
label: t("organization.switcher.create.organization"),
|
|
13540
13992
|
onClick: () => setIsCreateOrgOpen(true)
|
|
13541
13993
|
});
|
|
13542
13994
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
13543
|
-
return /* @__PURE__ */
|
|
13544
|
-
/* @__PURE__ */
|
|
13995
|
+
return /* @__PURE__ */ jsxs46(Fragment20, { children: [
|
|
13996
|
+
/* @__PURE__ */ jsx100(
|
|
13545
13997
|
BaseOrganizationSwitcher_default,
|
|
13546
13998
|
{
|
|
13547
13999
|
organizations,
|
|
@@ -13554,7 +14006,7 @@ var OrganizationSwitcher = ({
|
|
|
13554
14006
|
...props
|
|
13555
14007
|
}
|
|
13556
14008
|
),
|
|
13557
|
-
/* @__PURE__ */
|
|
14009
|
+
/* @__PURE__ */ jsx100(
|
|
13558
14010
|
CreateOrganization,
|
|
13559
14011
|
{
|
|
13560
14012
|
mode: "popup",
|
|
@@ -13568,7 +14020,7 @@ var OrganizationSwitcher = ({
|
|
|
13568
14020
|
}
|
|
13569
14021
|
}
|
|
13570
14022
|
),
|
|
13571
|
-
currentOrganization && /* @__PURE__ */
|
|
14023
|
+
currentOrganization && /* @__PURE__ */ jsx100(
|
|
13572
14024
|
OrganizationProfile_default,
|
|
13573
14025
|
{
|
|
13574
14026
|
organizationId: currentOrganization.id,
|
|
@@ -13576,11 +14028,11 @@ var OrganizationSwitcher = ({
|
|
|
13576
14028
|
open: isProfileOpen,
|
|
13577
14029
|
onOpenChange: setIsProfileOpen,
|
|
13578
14030
|
cardLayout: true,
|
|
13579
|
-
loadingFallback: /* @__PURE__ */
|
|
13580
|
-
errorFallback: /* @__PURE__ */
|
|
14031
|
+
loadingFallback: /* @__PURE__ */ jsx100("div", { children: t("organization.profile.loading") }),
|
|
14032
|
+
errorFallback: /* @__PURE__ */ jsx100("div", { children: t("organization.profile.error") })
|
|
13581
14033
|
}
|
|
13582
14034
|
),
|
|
13583
|
-
/* @__PURE__ */
|
|
14035
|
+
/* @__PURE__ */ jsx100(
|
|
13584
14036
|
OrganizationList_default,
|
|
13585
14037
|
{
|
|
13586
14038
|
mode: "popup",
|
|
@@ -13616,7 +14068,7 @@ export {
|
|
|
13616
14068
|
BaseSignIn_default3 as BaseSignIn,
|
|
13617
14069
|
BaseSignInButton_default as BaseSignInButton,
|
|
13618
14070
|
BaseSignOutButton_default as BaseSignOutButton,
|
|
13619
|
-
|
|
14071
|
+
BaseSignUp_default3 as BaseSignUp,
|
|
13620
14072
|
BaseSignUpButton_default as BaseSignUpButton,
|
|
13621
14073
|
BaseUser_default as BaseUser,
|
|
13622
14074
|
BaseUserDropdown_default as BaseUserDropdown,
|
|
@@ -13674,7 +14126,7 @@ export {
|
|
|
13674
14126
|
SignInButton_default as SignInButton,
|
|
13675
14127
|
SignInWithEthereumButton_default as SignInWithEthereumButton,
|
|
13676
14128
|
SignOutButton_default as SignOutButton,
|
|
13677
|
-
|
|
14129
|
+
SignUp_default3 as SignUp,
|
|
13678
14130
|
SignUpButton_default as SignUpButton,
|
|
13679
14131
|
SignedIn_default as SignedIn,
|
|
13680
14132
|
SignedOut_default as SignedOut,
|