@asgardeo/react 0.6.26 → 0.6.28
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 +118 -47
- package/dist/cjs/index.js.map +3 -3
- package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +11 -3
- package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +11 -3
- package/dist/index.js +118 -47
- package/dist/index.js.map +3 -3
- package/dist/utils/v2/flowTransformer.d.ts +1 -0
- package/package.json +3 -3
|
@@ -27,9 +27,13 @@ export interface BaseSignInRenderProps {
|
|
|
27
27
|
*/
|
|
28
28
|
values: Record<string, string>;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Field validation errors
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
fieldErrors: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* API error (if any)
|
|
35
|
+
*/
|
|
36
|
+
error?: Error | null;
|
|
33
37
|
/**
|
|
34
38
|
* Touched fields
|
|
35
39
|
*/
|
|
@@ -59,7 +63,7 @@ export interface BaseSignInRenderProps {
|
|
|
59
63
|
*/
|
|
60
64
|
validateForm: () => {
|
|
61
65
|
isValid: boolean;
|
|
62
|
-
|
|
66
|
+
fieldErrors: Record<string, string>;
|
|
63
67
|
};
|
|
64
68
|
/**
|
|
65
69
|
* Flow title
|
|
@@ -97,6 +101,10 @@ export interface BaseSignInProps {
|
|
|
97
101
|
* Custom CSS class name for error messages.
|
|
98
102
|
*/
|
|
99
103
|
errorClassName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Error object to display
|
|
106
|
+
*/
|
|
107
|
+
error?: Error | null;
|
|
100
108
|
/**
|
|
101
109
|
* Flag to determine if the component is ready to be rendered.
|
|
102
110
|
*/
|
|
@@ -27,9 +27,13 @@ export interface BaseSignUpRenderProps {
|
|
|
27
27
|
*/
|
|
28
28
|
values: Record<string, string>;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Field validation errors
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
fieldErrors: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* API error (if any)
|
|
35
|
+
*/
|
|
36
|
+
error?: Error | null;
|
|
33
37
|
/**
|
|
34
38
|
* Touched fields
|
|
35
39
|
*/
|
|
@@ -59,7 +63,7 @@ export interface BaseSignUpRenderProps {
|
|
|
59
63
|
*/
|
|
60
64
|
validateForm: () => {
|
|
61
65
|
isValid: boolean;
|
|
62
|
-
|
|
66
|
+
fieldErrors: Record<string, string>;
|
|
63
67
|
};
|
|
64
68
|
/**
|
|
65
69
|
* Flow title
|
|
@@ -97,6 +101,10 @@ export interface BaseSignUpProps {
|
|
|
97
101
|
* Custom CSS class name for error messages.
|
|
98
102
|
*/
|
|
99
103
|
errorClassName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Error object to display
|
|
106
|
+
*/
|
|
107
|
+
error?: Error | null;
|
|
100
108
|
/**
|
|
101
109
|
* Custom CSS class name for form inputs.
|
|
102
110
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1785,6 +1785,54 @@ var AsgardeoProvider = ({
|
|
|
1785
1785
|
flattenedProfile: generateFlattenedUserProfile2(payload, prev?.schemas)
|
|
1786
1786
|
}));
|
|
1787
1787
|
};
|
|
1788
|
+
const getDecodedIdToken = useCallback7(async () => {
|
|
1789
|
+
return await asgardeo.getDecodedIdToken();
|
|
1790
|
+
}, [asgardeo]);
|
|
1791
|
+
const getAccessToken = useCallback7(async () => {
|
|
1792
|
+
return await asgardeo.getAccessToken();
|
|
1793
|
+
}, [asgardeo]);
|
|
1794
|
+
const request = useCallback7(
|
|
1795
|
+
async (...args) => {
|
|
1796
|
+
return await asgardeo.request(...args);
|
|
1797
|
+
},
|
|
1798
|
+
[asgardeo]
|
|
1799
|
+
);
|
|
1800
|
+
const requestAll = useCallback7(
|
|
1801
|
+
async (...args) => {
|
|
1802
|
+
return await asgardeo.requestAll(...args);
|
|
1803
|
+
},
|
|
1804
|
+
[asgardeo]
|
|
1805
|
+
);
|
|
1806
|
+
const exchangeToken = useCallback7(
|
|
1807
|
+
async (config2, sessionId) => {
|
|
1808
|
+
return await asgardeo.exchangeToken(config2, sessionId);
|
|
1809
|
+
},
|
|
1810
|
+
[asgardeo]
|
|
1811
|
+
);
|
|
1812
|
+
const signOut = useCallback7(
|
|
1813
|
+
async (...args) => {
|
|
1814
|
+
return await asgardeo.signOut(...args);
|
|
1815
|
+
},
|
|
1816
|
+
[asgardeo]
|
|
1817
|
+
);
|
|
1818
|
+
const signUp = useCallback7(
|
|
1819
|
+
async (...args) => {
|
|
1820
|
+
return await asgardeo.signUp(...args);
|
|
1821
|
+
},
|
|
1822
|
+
[asgardeo]
|
|
1823
|
+
);
|
|
1824
|
+
const clearSession = useCallback7(
|
|
1825
|
+
async (...args) => {
|
|
1826
|
+
return await asgardeo.clearSession(...args);
|
|
1827
|
+
},
|
|
1828
|
+
[asgardeo]
|
|
1829
|
+
);
|
|
1830
|
+
const reInitialize = useCallback7(
|
|
1831
|
+
async (config2) => {
|
|
1832
|
+
return await asgardeo.reInitialize(config2);
|
|
1833
|
+
},
|
|
1834
|
+
[asgardeo]
|
|
1835
|
+
);
|
|
1788
1836
|
const value = useMemo6(
|
|
1789
1837
|
() => ({
|
|
1790
1838
|
applicationId,
|
|
@@ -1793,25 +1841,25 @@ var AsgardeoProvider = ({
|
|
|
1793
1841
|
signUpUrl,
|
|
1794
1842
|
afterSignInUrl,
|
|
1795
1843
|
baseUrl,
|
|
1796
|
-
clearSession
|
|
1797
|
-
getAccessToken
|
|
1844
|
+
clearSession,
|
|
1845
|
+
getAccessToken,
|
|
1798
1846
|
isInitialized: isInitializedSync,
|
|
1799
1847
|
isLoading: isLoadingSync,
|
|
1800
1848
|
isSignedIn: isSignedInSync,
|
|
1801
1849
|
organization: currentOrganization,
|
|
1802
1850
|
signIn,
|
|
1803
1851
|
signInSilently,
|
|
1804
|
-
signOut
|
|
1805
|
-
signUp
|
|
1852
|
+
signOut,
|
|
1853
|
+
signUp,
|
|
1806
1854
|
user,
|
|
1807
1855
|
http: {
|
|
1808
|
-
request
|
|
1809
|
-
requestAll
|
|
1856
|
+
request,
|
|
1857
|
+
requestAll
|
|
1810
1858
|
},
|
|
1811
|
-
reInitialize
|
|
1859
|
+
reInitialize,
|
|
1812
1860
|
signInOptions,
|
|
1813
|
-
getDecodedIdToken
|
|
1814
|
-
exchangeToken
|
|
1861
|
+
getDecodedIdToken,
|
|
1862
|
+
exchangeToken,
|
|
1815
1863
|
syncSession,
|
|
1816
1864
|
platform: config?.platform,
|
|
1817
1865
|
switchOrganization
|
|
@@ -1833,7 +1881,16 @@ var AsgardeoProvider = ({
|
|
|
1833
1881
|
asgardeo,
|
|
1834
1882
|
signInOptions,
|
|
1835
1883
|
syncSession,
|
|
1836
|
-
switchOrganization
|
|
1884
|
+
switchOrganization,
|
|
1885
|
+
getDecodedIdToken,
|
|
1886
|
+
getAccessToken,
|
|
1887
|
+
request,
|
|
1888
|
+
requestAll,
|
|
1889
|
+
exchangeToken,
|
|
1890
|
+
signOut,
|
|
1891
|
+
signUp,
|
|
1892
|
+
clearSession,
|
|
1893
|
+
reInitialize
|
|
1837
1894
|
]
|
|
1838
1895
|
);
|
|
1839
1896
|
return /* @__PURE__ */ jsx7(AsgardeoContext_default.Provider, { value, children: /* @__PURE__ */ jsx7(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx7(
|
|
@@ -7216,6 +7273,9 @@ var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") =>
|
|
|
7216
7273
|
if (error && typeof error === "object" && error.failureReason) {
|
|
7217
7274
|
return error.failureReason;
|
|
7218
7275
|
}
|
|
7276
|
+
if (error instanceof Error && error.message) {
|
|
7277
|
+
return error.message;
|
|
7278
|
+
}
|
|
7219
7279
|
return t(defaultErrorKey);
|
|
7220
7280
|
};
|
|
7221
7281
|
var checkForErrorResponse = (response, t, defaultErrorKey = "errors.flow.generic") => {
|
|
@@ -7311,6 +7371,7 @@ var BaseSignInContent2 = ({
|
|
|
7311
7371
|
components = [],
|
|
7312
7372
|
onSubmit,
|
|
7313
7373
|
onError,
|
|
7374
|
+
error: externalError,
|
|
7314
7375
|
className = "",
|
|
7315
7376
|
inputClassName = "",
|
|
7316
7377
|
buttonClassName = "",
|
|
@@ -7329,10 +7390,12 @@ var BaseSignInContent2 = ({
|
|
|
7329
7390
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
7330
7391
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
7331
7392
|
const [isSubmitting, setIsSubmitting] = useState15(false);
|
|
7393
|
+
const [apiError, setApiError] = useState15(null);
|
|
7332
7394
|
const isLoading = externalIsLoading || isSubmitting;
|
|
7333
7395
|
const handleError = useCallback10(
|
|
7334
7396
|
(error) => {
|
|
7335
|
-
const errorMessage = extractErrorMessage(error, t);
|
|
7397
|
+
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
7398
|
+
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
7336
7399
|
clearMessages();
|
|
7337
7400
|
addMessage({
|
|
7338
7401
|
type: "error",
|
|
@@ -7346,7 +7409,7 @@ var BaseSignInContent2 = ({
|
|
|
7346
7409
|
const fields = [];
|
|
7347
7410
|
const processComponents = (comps) => {
|
|
7348
7411
|
comps.forEach((component) => {
|
|
7349
|
-
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT") {
|
|
7412
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT") {
|
|
7350
7413
|
const identifier = component.ref;
|
|
7351
7414
|
fields.push({
|
|
7352
7415
|
name: identifier,
|
|
@@ -7356,6 +7419,9 @@ var BaseSignInContent2 = ({
|
|
|
7356
7419
|
if (component.required && (!value || value.trim() === "")) {
|
|
7357
7420
|
return t("validations.required.field.error");
|
|
7358
7421
|
}
|
|
7422
|
+
if ((component.type === "EMAIL_INPUT" || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
7423
|
+
return t("field.email.invalid");
|
|
7424
|
+
}
|
|
7359
7425
|
return null;
|
|
7360
7426
|
}
|
|
7361
7427
|
});
|
|
@@ -7403,6 +7469,7 @@ var BaseSignInContent2 = ({
|
|
|
7403
7469
|
}
|
|
7404
7470
|
}
|
|
7405
7471
|
setIsSubmitting(true);
|
|
7472
|
+
setApiError(null);
|
|
7406
7473
|
clearMessages();
|
|
7407
7474
|
console.log("Submitting component:", component, "with data:", data);
|
|
7408
7475
|
try {
|
|
@@ -7489,14 +7556,18 @@ var BaseSignInContent2 = ({
|
|
|
7489
7556
|
if (children) {
|
|
7490
7557
|
const renderProps = {
|
|
7491
7558
|
values: formValues,
|
|
7492
|
-
|
|
7559
|
+
fieldErrors: formErrors,
|
|
7560
|
+
error: apiError,
|
|
7493
7561
|
touched: touchedFields,
|
|
7494
7562
|
isValid: isFormValid,
|
|
7495
7563
|
isLoading,
|
|
7496
7564
|
components,
|
|
7497
7565
|
handleInputChange,
|
|
7498
7566
|
handleSubmit,
|
|
7499
|
-
validateForm
|
|
7567
|
+
validateForm: () => {
|
|
7568
|
+
const result = validateForm();
|
|
7569
|
+
return { isValid: result.isValid, fieldErrors: result.errors };
|
|
7570
|
+
},
|
|
7500
7571
|
title: flowTitle || t("signin.heading"),
|
|
7501
7572
|
subtitle: flowSubtitle || t("signin.subheading"),
|
|
7502
7573
|
messages: flowMessages || []
|
|
@@ -7522,6 +7593,7 @@ var BaseSignInContent2 = ({
|
|
|
7522
7593
|
showSubtitle && /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
7523
7594
|
] }),
|
|
7524
7595
|
/* @__PURE__ */ jsxs27(Card_default.Content, { children: [
|
|
7596
|
+
externalError && /* @__PURE__ */ jsx56("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ jsx56(Alert_default, { variant: "error", className: cx20(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ jsx56(Alert_default.Description, { children: externalError.message }) }) }),
|
|
7525
7597
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx56("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx56(
|
|
7526
7598
|
Alert_default,
|
|
7527
7599
|
{
|
|
@@ -7628,7 +7700,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7628
7700
|
window?.history?.replaceState({}, "", url.toString());
|
|
7629
7701
|
};
|
|
7630
7702
|
const handleOAuthError = (error, errorDescription) => {
|
|
7631
|
-
console.warn("[SignIn] OAuth error detected:", error);
|
|
7632
7703
|
clearFlowState();
|
|
7633
7704
|
const errorMessage = errorDescription || `OAuth error: ${error}`;
|
|
7634
7705
|
const err = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
@@ -7714,9 +7785,8 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7714
7785
|
} catch (error) {
|
|
7715
7786
|
const err = error;
|
|
7716
7787
|
clearFlowState();
|
|
7717
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7718
|
-
|
|
7719
|
-
setError(displayError);
|
|
7788
|
+
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
7789
|
+
setError(new Error(errorMessage));
|
|
7720
7790
|
initializationAttemptedRef.current = false;
|
|
7721
7791
|
return;
|
|
7722
7792
|
}
|
|
@@ -7724,10 +7794,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7724
7794
|
const handleSubmit = async (payload) => {
|
|
7725
7795
|
const effectiveFlowId = payload.flowId || currentFlowId;
|
|
7726
7796
|
if (!effectiveFlowId) {
|
|
7727
|
-
console.error("[SignIn] handleSubmit - ERROR: No flowId available", {
|
|
7728
|
-
payloadFlowId: payload.flowId,
|
|
7729
|
-
currentFlowId
|
|
7730
|
-
});
|
|
7731
7797
|
throw new Error("No active flow ID");
|
|
7732
7798
|
}
|
|
7733
7799
|
try {
|
|
@@ -7740,18 +7806,17 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7740
7806
|
if (handleRedirection(response)) {
|
|
7741
7807
|
return;
|
|
7742
7808
|
}
|
|
7743
|
-
const { flowId, components: components2 } = normalizeFlowResponse(response, t, {
|
|
7809
|
+
const { flowId, components: components2, ...rest } = normalizeFlowResponse(response, t, {
|
|
7744
7810
|
resolveTranslations: !children
|
|
7745
7811
|
});
|
|
7746
7812
|
if (response.flowStatus === EmbeddedSignInFlowStatusV2.Error) {
|
|
7747
|
-
console.error("[SignIn] Flow returned Error status, clearing flow state");
|
|
7748
7813
|
clearFlowState();
|
|
7749
7814
|
const failureReason = response?.failureReason;
|
|
7750
7815
|
const errorMessage = failureReason || "Authentication flow failed. Please try again.";
|
|
7751
|
-
const err = new
|
|
7816
|
+
const err = new Error(errorMessage);
|
|
7752
7817
|
setError(err);
|
|
7753
7818
|
cleanupFlowUrlParams();
|
|
7754
|
-
|
|
7819
|
+
throw err;
|
|
7755
7820
|
}
|
|
7756
7821
|
if (response.flowStatus === EmbeddedSignInFlowStatusV2.Complete) {
|
|
7757
7822
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
@@ -7768,8 +7833,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7768
7833
|
});
|
|
7769
7834
|
if (finalRedirectUrl && window?.location) {
|
|
7770
7835
|
window.location.href = finalRedirectUrl;
|
|
7771
|
-
} else {
|
|
7772
|
-
console.warn("[SignIn] Flow completed but no redirect URL available");
|
|
7773
7836
|
}
|
|
7774
7837
|
return;
|
|
7775
7838
|
}
|
|
@@ -7782,16 +7845,14 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7782
7845
|
} catch (error) {
|
|
7783
7846
|
const err = error;
|
|
7784
7847
|
clearFlowState();
|
|
7785
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7786
|
-
|
|
7787
|
-
setError(displayError);
|
|
7848
|
+
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
7849
|
+
setError(new Error(errorMessage));
|
|
7788
7850
|
return;
|
|
7789
7851
|
} finally {
|
|
7790
7852
|
setIsSubmitting(false);
|
|
7791
7853
|
}
|
|
7792
7854
|
};
|
|
7793
7855
|
const handleError = (error) => {
|
|
7794
|
-
console.error("Authentication error:", error);
|
|
7795
7856
|
setError(error);
|
|
7796
7857
|
};
|
|
7797
7858
|
useEffect13(() => {
|
|
@@ -7821,7 +7882,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7821
7882
|
}
|
|
7822
7883
|
};
|
|
7823
7884
|
handleSubmit(submitPayload).catch((error) => {
|
|
7824
|
-
console.error("[SignIn] OAuth callback submission failed:", error);
|
|
7825
7885
|
cleanupOAuthUrlParams(true);
|
|
7826
7886
|
});
|
|
7827
7887
|
}, [isFlowInitialized, currentFlowId, isInitialized, isLoading, isSubmitting, signIn]);
|
|
@@ -7843,6 +7903,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7843
7903
|
isLoading: isLoading || !isInitialized || !isFlowInitialized,
|
|
7844
7904
|
onSubmit: handleSubmit,
|
|
7845
7905
|
onError: handleError,
|
|
7906
|
+
error: flowError,
|
|
7846
7907
|
className,
|
|
7847
7908
|
size,
|
|
7848
7909
|
variant
|
|
@@ -9066,6 +9127,7 @@ var BaseSignUpContent2 = ({
|
|
|
9066
9127
|
onError,
|
|
9067
9128
|
onFlowChange,
|
|
9068
9129
|
onComplete,
|
|
9130
|
+
error: externalError,
|
|
9069
9131
|
className = "",
|
|
9070
9132
|
inputClassName = "",
|
|
9071
9133
|
buttonClassName = "",
|
|
@@ -9085,7 +9147,8 @@ var BaseSignUpContent2 = ({
|
|
|
9085
9147
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9086
9148
|
const handleError = useCallback12(
|
|
9087
9149
|
(error) => {
|
|
9088
|
-
const errorMessage = extractErrorMessage(error, t);
|
|
9150
|
+
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
9151
|
+
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
9089
9152
|
clearMessages();
|
|
9090
9153
|
addMessage({
|
|
9091
9154
|
type: "error",
|
|
@@ -9097,7 +9160,7 @@ var BaseSignUpContent2 = ({
|
|
|
9097
9160
|
const [isLoading, setIsLoading] = useState18(false);
|
|
9098
9161
|
const [isFlowInitialized, setIsFlowInitialized] = useState18(false);
|
|
9099
9162
|
const [currentFlow, setCurrentFlow] = useState18(null);
|
|
9100
|
-
const [
|
|
9163
|
+
const [apiError, setApiError] = useState18(null);
|
|
9101
9164
|
const initializationAttemptedRef = useRef6(false);
|
|
9102
9165
|
const normalizeFlowResponseLocal = useCallback12(
|
|
9103
9166
|
(response) => {
|
|
@@ -9130,7 +9193,7 @@ var BaseSignUpContent2 = ({
|
|
|
9130
9193
|
const fields = [];
|
|
9131
9194
|
const processComponents = (comps) => {
|
|
9132
9195
|
comps.forEach((component) => {
|
|
9133
|
-
if (component.type === EmbeddedFlowComponentType4.TextInput) {
|
|
9196
|
+
if (component.type === EmbeddedFlowComponentType4.TextInput || component.type === EmbeddedFlowComponentType4.PasswordInput || component.type === EmbeddedFlowComponentType4.EmailInput) {
|
|
9134
9197
|
const fieldName = component.ref || component.id;
|
|
9135
9198
|
fields.push({
|
|
9136
9199
|
name: fieldName,
|
|
@@ -9140,12 +9203,9 @@ var BaseSignUpContent2 = ({
|
|
|
9140
9203
|
if (component.required && (!value || value.trim() === "")) {
|
|
9141
9204
|
return t("validations.required.field.error");
|
|
9142
9205
|
}
|
|
9143
|
-
if (component.variant === "EMAIL" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9206
|
+
if ((component.type === EmbeddedFlowComponentType4.EmailInput || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9144
9207
|
return t("field.email.invalid");
|
|
9145
9208
|
}
|
|
9146
|
-
if (component.type === "PASSWORD_INPUT" && value && value.length < 8) {
|
|
9147
|
-
return t("field.password.weak");
|
|
9148
|
-
}
|
|
9149
9209
|
return null;
|
|
9150
9210
|
}
|
|
9151
9211
|
});
|
|
@@ -9165,7 +9225,7 @@ var BaseSignUpContent2 = ({
|
|
|
9165
9225
|
initialValues: {},
|
|
9166
9226
|
fields: formFields,
|
|
9167
9227
|
validateOnBlur: true,
|
|
9168
|
-
validateOnChange:
|
|
9228
|
+
validateOnChange: false,
|
|
9169
9229
|
requiredMessage: t("validations.required.field.error")
|
|
9170
9230
|
});
|
|
9171
9231
|
const {
|
|
@@ -9197,6 +9257,8 @@ var BaseSignUpContent2 = ({
|
|
|
9197
9257
|
);
|
|
9198
9258
|
const handleInputChange = (name, value) => {
|
|
9199
9259
|
setFormValue(name, value);
|
|
9260
|
+
};
|
|
9261
|
+
const handleInputBlur = (name) => {
|
|
9200
9262
|
setFormTouched(name, true);
|
|
9201
9263
|
};
|
|
9202
9264
|
const handleSubmit = async (component, data, skipValidation) => {
|
|
@@ -9211,6 +9273,7 @@ var BaseSignUpContent2 = ({
|
|
|
9211
9273
|
}
|
|
9212
9274
|
}
|
|
9213
9275
|
setIsLoading(true);
|
|
9276
|
+
setApiError(null);
|
|
9214
9277
|
clearMessages();
|
|
9215
9278
|
try {
|
|
9216
9279
|
const filteredInputs = {};
|
|
@@ -9224,7 +9287,7 @@ var BaseSignUpContent2 = ({
|
|
|
9224
9287
|
const payload = {
|
|
9225
9288
|
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9226
9289
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9227
|
-
...component.id && {
|
|
9290
|
+
...component.id && { action: component.id },
|
|
9228
9291
|
inputs: filteredInputs
|
|
9229
9292
|
};
|
|
9230
9293
|
const rawResponse = await onSubmit(payload);
|
|
@@ -9273,7 +9336,7 @@ var BaseSignUpContent2 = ({
|
|
|
9273
9336
|
code,
|
|
9274
9337
|
state
|
|
9275
9338
|
},
|
|
9276
|
-
|
|
9339
|
+
action: ""
|
|
9277
9340
|
};
|
|
9278
9341
|
try {
|
|
9279
9342
|
const continueResponse = await onSubmit(payload);
|
|
@@ -9333,7 +9396,7 @@ var BaseSignUpContent2 = ({
|
|
|
9333
9396
|
code,
|
|
9334
9397
|
state
|
|
9335
9398
|
},
|
|
9336
|
-
|
|
9399
|
+
action: ""
|
|
9337
9400
|
};
|
|
9338
9401
|
try {
|
|
9339
9402
|
const continueResponse = await onSubmit(payload);
|
|
@@ -9400,6 +9463,7 @@ var BaseSignUpContent2 = ({
|
|
|
9400
9463
|
{
|
|
9401
9464
|
buttonClassName: buttonClasses,
|
|
9402
9465
|
inputClassName: inputClasses,
|
|
9466
|
+
onInputBlur: handleInputBlur,
|
|
9403
9467
|
onSubmit: handleSubmit,
|
|
9404
9468
|
size,
|
|
9405
9469
|
variant
|
|
@@ -9415,7 +9479,8 @@ var BaseSignUpContent2 = ({
|
|
|
9415
9479
|
variant,
|
|
9416
9480
|
inputClasses,
|
|
9417
9481
|
buttonClasses,
|
|
9418
|
-
handleSubmit
|
|
9482
|
+
handleSubmit,
|
|
9483
|
+
handleInputBlur
|
|
9419
9484
|
]
|
|
9420
9485
|
);
|
|
9421
9486
|
const getUrlParams = () => {
|
|
@@ -9435,6 +9500,7 @@ var BaseSignUpContent2 = ({
|
|
|
9435
9500
|
initializationAttemptedRef.current = true;
|
|
9436
9501
|
(async () => {
|
|
9437
9502
|
setIsLoading(true);
|
|
9503
|
+
setApiError(null);
|
|
9438
9504
|
clearMessages();
|
|
9439
9505
|
try {
|
|
9440
9506
|
const rawResponse = await onInitialize();
|
|
@@ -9472,14 +9538,18 @@ var BaseSignUpContent2 = ({
|
|
|
9472
9538
|
if (children) {
|
|
9473
9539
|
const renderProps = {
|
|
9474
9540
|
values: formValues,
|
|
9475
|
-
|
|
9541
|
+
fieldErrors: formErrors,
|
|
9542
|
+
error: apiError,
|
|
9476
9543
|
touched: touchedFields,
|
|
9477
9544
|
isValid: isFormValid,
|
|
9478
9545
|
isLoading,
|
|
9479
9546
|
components: currentFlow?.data?.components || [],
|
|
9480
9547
|
handleInputChange,
|
|
9481
9548
|
handleSubmit,
|
|
9482
|
-
validateForm
|
|
9549
|
+
validateForm: () => {
|
|
9550
|
+
const result = validateForm();
|
|
9551
|
+
return { isValid: result.isValid, fieldErrors: result.errors };
|
|
9552
|
+
},
|
|
9483
9553
|
title: flowTitle || t("signup.heading"),
|
|
9484
9554
|
subtitle: flowSubtitle || t("signup.subheading"),
|
|
9485
9555
|
messages: flowMessages || []
|
|
@@ -9509,6 +9579,7 @@ var BaseSignUpContent2 = ({
|
|
|
9509
9579
|
showSubtitle && /* @__PURE__ */ jsx68(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
9510
9580
|
] }),
|
|
9511
9581
|
/* @__PURE__ */ jsxs29(Card_default.Content, { children: [
|
|
9582
|
+
externalError && /* @__PURE__ */ jsx68("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ jsx68(Alert_default, { variant: "error", className: cx22(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ jsx68(Alert_default.Description, { children: externalError.message }) }) }),
|
|
9512
9583
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx68("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx68(
|
|
9513
9584
|
Alert_default,
|
|
9514
9585
|
{
|