@asgardeo/react 0.6.25 → 0.6.27
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 +100 -44
- package/dist/cjs/index.js.map +2 -2
- 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 +100 -44
- package/dist/index.js.map +2 -2
- package/dist/utils/v2/flowTransformer.d.ts +3 -1
- package/package.json +2 -2
|
@@ -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
|
@@ -6958,9 +6958,6 @@ var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType
|
|
|
6958
6958
|
};
|
|
6959
6959
|
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
6960
6960
|
const key = options.key || component.id;
|
|
6961
|
-
if (authType === "signin") {
|
|
6962
|
-
console.log("Creating sign-in component for:", component);
|
|
6963
|
-
}
|
|
6964
6961
|
switch (component.type) {
|
|
6965
6962
|
case EmbeddedFlowComponentType.TextInput:
|
|
6966
6963
|
case EmbeddedFlowComponentType.PasswordInput:
|
|
@@ -6994,9 +6991,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
6994
6991
|
if (options.onSubmit) {
|
|
6995
6992
|
const formData = {};
|
|
6996
6993
|
Object.keys(formValues).forEach((field) => {
|
|
6997
|
-
|
|
6998
|
-
formData[field] = formValues[field];
|
|
6999
|
-
}
|
|
6994
|
+
formData[field] = formValues[field];
|
|
7000
6995
|
});
|
|
7001
6996
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7002
6997
|
}
|
|
@@ -7164,17 +7159,66 @@ var resolveTranslationsInArray = (items, t, properties) => {
|
|
|
7164
7159
|
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7165
7160
|
|
|
7166
7161
|
// src/utils/v2/flowTransformer.ts
|
|
7162
|
+
var createInputRefMapping = (response) => {
|
|
7163
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7164
|
+
if (response?.data?.inputs && Array.isArray(response.data.inputs)) {
|
|
7165
|
+
response.data.inputs.forEach((input) => {
|
|
7166
|
+
if (input.ref && input.identifier) {
|
|
7167
|
+
mapping.set(input.ref, input.identifier);
|
|
7168
|
+
}
|
|
7169
|
+
});
|
|
7170
|
+
}
|
|
7171
|
+
return mapping;
|
|
7172
|
+
};
|
|
7173
|
+
var createActionRefMapping = (response) => {
|
|
7174
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7175
|
+
if (response?.data?.actions && Array.isArray(response.data.actions)) {
|
|
7176
|
+
response.data.actions.forEach((action) => {
|
|
7177
|
+
if (action.ref && action.nextNode) {
|
|
7178
|
+
mapping.set(action.ref, action.nextNode);
|
|
7179
|
+
}
|
|
7180
|
+
});
|
|
7181
|
+
}
|
|
7182
|
+
return mapping;
|
|
7183
|
+
};
|
|
7184
|
+
var applyInputRefMapping = (components, refMapping, actionMapping) => {
|
|
7185
|
+
return components.map((component) => {
|
|
7186
|
+
const transformedComponent = { ...component };
|
|
7187
|
+
if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {
|
|
7188
|
+
transformedComponent.ref = refMapping.get(transformedComponent.ref);
|
|
7189
|
+
}
|
|
7190
|
+
if (transformedComponent.type === "ACTION" && transformedComponent.id && actionMapping.has(transformedComponent.id)) {
|
|
7191
|
+
transformedComponent.actionRef = actionMapping.get(transformedComponent.id);
|
|
7192
|
+
}
|
|
7193
|
+
if (transformedComponent.components && Array.isArray(transformedComponent.components)) {
|
|
7194
|
+
transformedComponent.components = applyInputRefMapping(
|
|
7195
|
+
transformedComponent.components,
|
|
7196
|
+
refMapping,
|
|
7197
|
+
actionMapping
|
|
7198
|
+
);
|
|
7199
|
+
}
|
|
7200
|
+
return transformedComponent;
|
|
7201
|
+
});
|
|
7202
|
+
};
|
|
7167
7203
|
var transformComponents = (response, t, resolveTranslations = true) => {
|
|
7168
7204
|
if (!response?.data?.meta?.components) {
|
|
7169
7205
|
return [];
|
|
7170
7206
|
}
|
|
7171
|
-
|
|
7207
|
+
let components = response.data.meta.components;
|
|
7208
|
+
const refMapping = createInputRefMapping(response);
|
|
7209
|
+
const actionMapping = createActionRefMapping(response);
|
|
7210
|
+
if (refMapping.size > 0 || actionMapping.size > 0) {
|
|
7211
|
+
components = applyInputRefMapping(components, refMapping, actionMapping);
|
|
7212
|
+
}
|
|
7172
7213
|
return resolveTranslations ? resolveTranslationsInArray_default(components, t) : components;
|
|
7173
7214
|
};
|
|
7174
7215
|
var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") => {
|
|
7175
7216
|
if (error && typeof error === "object" && error.failureReason) {
|
|
7176
7217
|
return error.failureReason;
|
|
7177
7218
|
}
|
|
7219
|
+
if (error instanceof Error && error.message) {
|
|
7220
|
+
return error.message;
|
|
7221
|
+
}
|
|
7178
7222
|
return t(defaultErrorKey);
|
|
7179
7223
|
};
|
|
7180
7224
|
var checkForErrorResponse = (response, t, defaultErrorKey = "errors.flow.generic") => {
|
|
@@ -7270,6 +7314,7 @@ var BaseSignInContent2 = ({
|
|
|
7270
7314
|
components = [],
|
|
7271
7315
|
onSubmit,
|
|
7272
7316
|
onError,
|
|
7317
|
+
error: externalError,
|
|
7273
7318
|
className = "",
|
|
7274
7319
|
inputClassName = "",
|
|
7275
7320
|
buttonClassName = "",
|
|
@@ -7288,10 +7333,12 @@ var BaseSignInContent2 = ({
|
|
|
7288
7333
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
7289
7334
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
7290
7335
|
const [isSubmitting, setIsSubmitting] = useState15(false);
|
|
7336
|
+
const [apiError, setApiError] = useState15(null);
|
|
7291
7337
|
const isLoading = externalIsLoading || isSubmitting;
|
|
7292
7338
|
const handleError = useCallback10(
|
|
7293
7339
|
(error) => {
|
|
7294
|
-
const errorMessage = extractErrorMessage(error, t);
|
|
7340
|
+
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
7341
|
+
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
7295
7342
|
clearMessages();
|
|
7296
7343
|
addMessage({
|
|
7297
7344
|
type: "error",
|
|
@@ -7305,7 +7352,7 @@ var BaseSignInContent2 = ({
|
|
|
7305
7352
|
const fields = [];
|
|
7306
7353
|
const processComponents = (comps) => {
|
|
7307
7354
|
comps.forEach((component) => {
|
|
7308
|
-
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT") {
|
|
7355
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT") {
|
|
7309
7356
|
const identifier = component.ref;
|
|
7310
7357
|
fields.push({
|
|
7311
7358
|
name: identifier,
|
|
@@ -7315,6 +7362,9 @@ var BaseSignInContent2 = ({
|
|
|
7315
7362
|
if (component.required && (!value || value.trim() === "")) {
|
|
7316
7363
|
return t("validations.required.field.error");
|
|
7317
7364
|
}
|
|
7365
|
+
if ((component.type === "EMAIL_INPUT" || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
7366
|
+
return t("field.email.invalid");
|
|
7367
|
+
}
|
|
7318
7368
|
return null;
|
|
7319
7369
|
}
|
|
7320
7370
|
});
|
|
@@ -7362,6 +7412,7 @@ var BaseSignInContent2 = ({
|
|
|
7362
7412
|
}
|
|
7363
7413
|
}
|
|
7364
7414
|
setIsSubmitting(true);
|
|
7415
|
+
setApiError(null);
|
|
7365
7416
|
clearMessages();
|
|
7366
7417
|
console.log("Submitting component:", component, "with data:", data);
|
|
7367
7418
|
try {
|
|
@@ -7448,14 +7499,18 @@ var BaseSignInContent2 = ({
|
|
|
7448
7499
|
if (children) {
|
|
7449
7500
|
const renderProps = {
|
|
7450
7501
|
values: formValues,
|
|
7451
|
-
|
|
7502
|
+
fieldErrors: formErrors,
|
|
7503
|
+
error: apiError,
|
|
7452
7504
|
touched: touchedFields,
|
|
7453
7505
|
isValid: isFormValid,
|
|
7454
7506
|
isLoading,
|
|
7455
7507
|
components,
|
|
7456
7508
|
handleInputChange,
|
|
7457
7509
|
handleSubmit,
|
|
7458
|
-
validateForm
|
|
7510
|
+
validateForm: () => {
|
|
7511
|
+
const result = validateForm();
|
|
7512
|
+
return { isValid: result.isValid, fieldErrors: result.errors };
|
|
7513
|
+
},
|
|
7459
7514
|
title: flowTitle || t("signin.heading"),
|
|
7460
7515
|
subtitle: flowSubtitle || t("signin.subheading"),
|
|
7461
7516
|
messages: flowMessages || []
|
|
@@ -7481,6 +7536,7 @@ var BaseSignInContent2 = ({
|
|
|
7481
7536
|
showSubtitle && /* @__PURE__ */ jsx56(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
7482
7537
|
] }),
|
|
7483
7538
|
/* @__PURE__ */ jsxs27(Card_default.Content, { children: [
|
|
7539
|
+
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 }) }) }),
|
|
7484
7540
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx56("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx56(
|
|
7485
7541
|
Alert_default,
|
|
7486
7542
|
{
|
|
@@ -7587,7 +7643,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7587
7643
|
window?.history?.replaceState({}, "", url.toString());
|
|
7588
7644
|
};
|
|
7589
7645
|
const handleOAuthError = (error, errorDescription) => {
|
|
7590
|
-
console.warn("[SignIn] OAuth error detected:", error);
|
|
7591
7646
|
clearFlowState();
|
|
7592
7647
|
const errorMessage = errorDescription || `OAuth error: ${error}`;
|
|
7593
7648
|
const err = new AsgardeoRuntimeError8(errorMessage, "SIGN_IN_ERROR", "react");
|
|
@@ -7673,9 +7728,8 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7673
7728
|
} catch (error) {
|
|
7674
7729
|
const err = error;
|
|
7675
7730
|
clearFlowState();
|
|
7676
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7677
|
-
|
|
7678
|
-
setError(displayError);
|
|
7731
|
+
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
7732
|
+
setError(new Error(errorMessage));
|
|
7679
7733
|
initializationAttemptedRef.current = false;
|
|
7680
7734
|
return;
|
|
7681
7735
|
}
|
|
@@ -7683,10 +7737,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7683
7737
|
const handleSubmit = async (payload) => {
|
|
7684
7738
|
const effectiveFlowId = payload.flowId || currentFlowId;
|
|
7685
7739
|
if (!effectiveFlowId) {
|
|
7686
|
-
console.error("[SignIn] handleSubmit - ERROR: No flowId available", {
|
|
7687
|
-
payloadFlowId: payload.flowId,
|
|
7688
|
-
currentFlowId
|
|
7689
|
-
});
|
|
7690
7740
|
throw new Error("No active flow ID");
|
|
7691
7741
|
}
|
|
7692
7742
|
try {
|
|
@@ -7699,18 +7749,17 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7699
7749
|
if (handleRedirection(response)) {
|
|
7700
7750
|
return;
|
|
7701
7751
|
}
|
|
7702
|
-
const { flowId, components: components2 } = normalizeFlowResponse(response, t, {
|
|
7752
|
+
const { flowId, components: components2, ...rest } = normalizeFlowResponse(response, t, {
|
|
7703
7753
|
resolveTranslations: !children
|
|
7704
7754
|
});
|
|
7705
7755
|
if (response.flowStatus === EmbeddedSignInFlowStatusV2.Error) {
|
|
7706
|
-
console.error("[SignIn] Flow returned Error status, clearing flow state");
|
|
7707
7756
|
clearFlowState();
|
|
7708
7757
|
const failureReason = response?.failureReason;
|
|
7709
7758
|
const errorMessage = failureReason || "Authentication flow failed. Please try again.";
|
|
7710
|
-
const err = new
|
|
7759
|
+
const err = new Error(errorMessage);
|
|
7711
7760
|
setError(err);
|
|
7712
7761
|
cleanupFlowUrlParams();
|
|
7713
|
-
|
|
7762
|
+
throw err;
|
|
7714
7763
|
}
|
|
7715
7764
|
if (response.flowStatus === EmbeddedSignInFlowStatusV2.Complete) {
|
|
7716
7765
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
@@ -7727,8 +7776,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7727
7776
|
});
|
|
7728
7777
|
if (finalRedirectUrl && window?.location) {
|
|
7729
7778
|
window.location.href = finalRedirectUrl;
|
|
7730
|
-
} else {
|
|
7731
|
-
console.warn("[SignIn] Flow completed but no redirect URL available");
|
|
7732
7779
|
}
|
|
7733
7780
|
return;
|
|
7734
7781
|
}
|
|
@@ -7741,16 +7788,14 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7741
7788
|
} catch (error) {
|
|
7742
7789
|
const err = error;
|
|
7743
7790
|
clearFlowState();
|
|
7744
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
7745
|
-
|
|
7746
|
-
setError(displayError);
|
|
7791
|
+
const errorMessage = err?.failureReason || (err instanceof Error ? err.message : String(err));
|
|
7792
|
+
setError(new Error(errorMessage));
|
|
7747
7793
|
return;
|
|
7748
7794
|
} finally {
|
|
7749
7795
|
setIsSubmitting(false);
|
|
7750
7796
|
}
|
|
7751
7797
|
};
|
|
7752
7798
|
const handleError = (error) => {
|
|
7753
|
-
console.error("Authentication error:", error);
|
|
7754
7799
|
setError(error);
|
|
7755
7800
|
};
|
|
7756
7801
|
useEffect13(() => {
|
|
@@ -7780,7 +7825,6 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7780
7825
|
}
|
|
7781
7826
|
};
|
|
7782
7827
|
handleSubmit(submitPayload).catch((error) => {
|
|
7783
|
-
console.error("[SignIn] OAuth callback submission failed:", error);
|
|
7784
7828
|
cleanupOAuthUrlParams(true);
|
|
7785
7829
|
});
|
|
7786
7830
|
}, [isFlowInitialized, currentFlowId, isInitialized, isLoading, isSubmitting, signIn]);
|
|
@@ -7802,6 +7846,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7802
7846
|
isLoading: isLoading || !isInitialized || !isFlowInitialized,
|
|
7803
7847
|
onSubmit: handleSubmit,
|
|
7804
7848
|
onError: handleError,
|
|
7849
|
+
error: flowError,
|
|
7805
7850
|
className,
|
|
7806
7851
|
size,
|
|
7807
7852
|
variant
|
|
@@ -9025,6 +9070,7 @@ var BaseSignUpContent2 = ({
|
|
|
9025
9070
|
onError,
|
|
9026
9071
|
onFlowChange,
|
|
9027
9072
|
onComplete,
|
|
9073
|
+
error: externalError,
|
|
9028
9074
|
className = "",
|
|
9029
9075
|
inputClassName = "",
|
|
9030
9076
|
buttonClassName = "",
|
|
@@ -9044,7 +9090,8 @@ var BaseSignUpContent2 = ({
|
|
|
9044
9090
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9045
9091
|
const handleError = useCallback12(
|
|
9046
9092
|
(error) => {
|
|
9047
|
-
const errorMessage = extractErrorMessage(error, t);
|
|
9093
|
+
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
9094
|
+
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
9048
9095
|
clearMessages();
|
|
9049
9096
|
addMessage({
|
|
9050
9097
|
type: "error",
|
|
@@ -9056,7 +9103,7 @@ var BaseSignUpContent2 = ({
|
|
|
9056
9103
|
const [isLoading, setIsLoading] = useState18(false);
|
|
9057
9104
|
const [isFlowInitialized, setIsFlowInitialized] = useState18(false);
|
|
9058
9105
|
const [currentFlow, setCurrentFlow] = useState18(null);
|
|
9059
|
-
const [
|
|
9106
|
+
const [apiError, setApiError] = useState18(null);
|
|
9060
9107
|
const initializationAttemptedRef = useRef6(false);
|
|
9061
9108
|
const normalizeFlowResponseLocal = useCallback12(
|
|
9062
9109
|
(response) => {
|
|
@@ -9089,21 +9136,19 @@ var BaseSignUpContent2 = ({
|
|
|
9089
9136
|
const fields = [];
|
|
9090
9137
|
const processComponents = (comps) => {
|
|
9091
9138
|
comps.forEach((component) => {
|
|
9092
|
-
if (component.type === EmbeddedFlowComponentType4.TextInput) {
|
|
9139
|
+
if (component.type === EmbeddedFlowComponentType4.TextInput || component.type === EmbeddedFlowComponentType4.PasswordInput || component.type === EmbeddedFlowComponentType4.EmailInput) {
|
|
9140
|
+
const fieldName = component.ref || component.id;
|
|
9093
9141
|
fields.push({
|
|
9094
|
-
name:
|
|
9142
|
+
name: fieldName,
|
|
9095
9143
|
required: component.required || false,
|
|
9096
9144
|
initialValue: "",
|
|
9097
9145
|
validator: (value) => {
|
|
9098
9146
|
if (component.required && (!value || value.trim() === "")) {
|
|
9099
9147
|
return t("validations.required.field.error");
|
|
9100
9148
|
}
|
|
9101
|
-
if (component.variant === "EMAIL" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9149
|
+
if ((component.type === EmbeddedFlowComponentType4.EmailInput || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
9102
9150
|
return t("field.email.invalid");
|
|
9103
9151
|
}
|
|
9104
|
-
if (component.type === "PASSWORD_INPUT" && value && value.length < 8) {
|
|
9105
|
-
return t("field.password.weak");
|
|
9106
|
-
}
|
|
9107
9152
|
return null;
|
|
9108
9153
|
}
|
|
9109
9154
|
});
|
|
@@ -9123,7 +9168,7 @@ var BaseSignUpContent2 = ({
|
|
|
9123
9168
|
initialValues: {},
|
|
9124
9169
|
fields: formFields,
|
|
9125
9170
|
validateOnBlur: true,
|
|
9126
|
-
validateOnChange:
|
|
9171
|
+
validateOnChange: false,
|
|
9127
9172
|
requiredMessage: t("validations.required.field.error")
|
|
9128
9173
|
});
|
|
9129
9174
|
const {
|
|
@@ -9155,6 +9200,8 @@ var BaseSignUpContent2 = ({
|
|
|
9155
9200
|
);
|
|
9156
9201
|
const handleInputChange = (name, value) => {
|
|
9157
9202
|
setFormValue(name, value);
|
|
9203
|
+
};
|
|
9204
|
+
const handleInputBlur = (name) => {
|
|
9158
9205
|
setFormTouched(name, true);
|
|
9159
9206
|
};
|
|
9160
9207
|
const handleSubmit = async (component, data, skipValidation) => {
|
|
@@ -9169,6 +9216,7 @@ var BaseSignUpContent2 = ({
|
|
|
9169
9216
|
}
|
|
9170
9217
|
}
|
|
9171
9218
|
setIsLoading(true);
|
|
9219
|
+
setApiError(null);
|
|
9172
9220
|
clearMessages();
|
|
9173
9221
|
try {
|
|
9174
9222
|
const filteredInputs = {};
|
|
@@ -9231,7 +9279,7 @@ var BaseSignUpContent2 = ({
|
|
|
9231
9279
|
code,
|
|
9232
9280
|
state
|
|
9233
9281
|
},
|
|
9234
|
-
|
|
9282
|
+
action: ""
|
|
9235
9283
|
};
|
|
9236
9284
|
try {
|
|
9237
9285
|
const continueResponse = await onSubmit(payload);
|
|
@@ -9291,7 +9339,7 @@ var BaseSignUpContent2 = ({
|
|
|
9291
9339
|
code,
|
|
9292
9340
|
state
|
|
9293
9341
|
},
|
|
9294
|
-
|
|
9342
|
+
action: ""
|
|
9295
9343
|
};
|
|
9296
9344
|
try {
|
|
9297
9345
|
const continueResponse = await onSubmit(payload);
|
|
@@ -9358,6 +9406,7 @@ var BaseSignUpContent2 = ({
|
|
|
9358
9406
|
{
|
|
9359
9407
|
buttonClassName: buttonClasses,
|
|
9360
9408
|
inputClassName: inputClasses,
|
|
9409
|
+
onInputBlur: handleInputBlur,
|
|
9361
9410
|
onSubmit: handleSubmit,
|
|
9362
9411
|
size,
|
|
9363
9412
|
variant
|
|
@@ -9373,7 +9422,8 @@ var BaseSignUpContent2 = ({
|
|
|
9373
9422
|
variant,
|
|
9374
9423
|
inputClasses,
|
|
9375
9424
|
buttonClasses,
|
|
9376
|
-
handleSubmit
|
|
9425
|
+
handleSubmit,
|
|
9426
|
+
handleInputBlur
|
|
9377
9427
|
]
|
|
9378
9428
|
);
|
|
9379
9429
|
const getUrlParams = () => {
|
|
@@ -9393,6 +9443,7 @@ var BaseSignUpContent2 = ({
|
|
|
9393
9443
|
initializationAttemptedRef.current = true;
|
|
9394
9444
|
(async () => {
|
|
9395
9445
|
setIsLoading(true);
|
|
9446
|
+
setApiError(null);
|
|
9396
9447
|
clearMessages();
|
|
9397
9448
|
try {
|
|
9398
9449
|
const rawResponse = await onInitialize();
|
|
@@ -9430,14 +9481,18 @@ var BaseSignUpContent2 = ({
|
|
|
9430
9481
|
if (children) {
|
|
9431
9482
|
const renderProps = {
|
|
9432
9483
|
values: formValues,
|
|
9433
|
-
|
|
9484
|
+
fieldErrors: formErrors,
|
|
9485
|
+
error: apiError,
|
|
9434
9486
|
touched: touchedFields,
|
|
9435
9487
|
isValid: isFormValid,
|
|
9436
9488
|
isLoading,
|
|
9437
9489
|
components: currentFlow?.data?.components || [],
|
|
9438
9490
|
handleInputChange,
|
|
9439
9491
|
handleSubmit,
|
|
9440
|
-
validateForm
|
|
9492
|
+
validateForm: () => {
|
|
9493
|
+
const result = validateForm();
|
|
9494
|
+
return { isValid: result.isValid, fieldErrors: result.errors };
|
|
9495
|
+
},
|
|
9441
9496
|
title: flowTitle || t("signup.heading"),
|
|
9442
9497
|
subtitle: flowSubtitle || t("signup.subheading"),
|
|
9443
9498
|
messages: flowMessages || []
|
|
@@ -9467,6 +9522,7 @@ var BaseSignUpContent2 = ({
|
|
|
9467
9522
|
showSubtitle && /* @__PURE__ */ jsx68(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
9468
9523
|
] }),
|
|
9469
9524
|
/* @__PURE__ */ jsxs29(Card_default.Content, { children: [
|
|
9525
|
+
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 }) }) }),
|
|
9470
9526
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ jsx68("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ jsx68(
|
|
9471
9527
|
Alert_default,
|
|
9472
9528
|
{
|