@asgardeo/react 0.6.23 → 0.6.24
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
CHANGED
|
@@ -7029,9 +7029,12 @@ var getTypographyVariant = (variant) => {
|
|
|
7029
7029
|
};
|
|
7030
7030
|
return variantMap[variant] || "h3";
|
|
7031
7031
|
};
|
|
7032
|
-
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType) => {
|
|
7032
|
+
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType, componentVariant) => {
|
|
7033
7033
|
const providerId = `${provider}_auth`;
|
|
7034
7034
|
const providerMatches = actionId === providerId || eventType === providerId;
|
|
7035
|
+
if (componentVariant?.toUpperCase() === import_browser45.EmbeddedFlowActionVariantV2.Social) {
|
|
7036
|
+
return buttonText.toLowerCase().includes(provider);
|
|
7037
|
+
}
|
|
7035
7038
|
if (authType === "signup") {
|
|
7036
7039
|
return providerMatches || buttonText.toLowerCase().includes(provider);
|
|
7037
7040
|
}
|
|
@@ -7066,6 +7069,11 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7066
7069
|
return import_react57.default.cloneElement(field, { key });
|
|
7067
7070
|
}
|
|
7068
7071
|
case import_browser45.EmbeddedFlowComponentTypeV2.Action: {
|
|
7072
|
+
const actionId = component.id;
|
|
7073
|
+
const eventType = component.eventType || "";
|
|
7074
|
+
const buttonText = component.label || "";
|
|
7075
|
+
const componentVariant = component.variant || "";
|
|
7076
|
+
const shouldSkipValidation = eventType.toUpperCase() === import_browser45.EmbeddedFlowEventTypeV2.Trigger;
|
|
7069
7077
|
const handleClick = () => {
|
|
7070
7078
|
if (options.onSubmit) {
|
|
7071
7079
|
const formData = {};
|
|
@@ -7074,28 +7082,25 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7074
7082
|
formData[field] = formValues[field];
|
|
7075
7083
|
}
|
|
7076
7084
|
});
|
|
7077
|
-
options.onSubmit(component, formData);
|
|
7085
|
+
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7078
7086
|
}
|
|
7079
7087
|
};
|
|
7080
|
-
|
|
7081
|
-
const eventType = component.eventType || "";
|
|
7082
|
-
const buttonText = component.label || "";
|
|
7083
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType)) {
|
|
7088
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType, componentVariant)) {
|
|
7084
7089
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GoogleButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7085
7090
|
}
|
|
7086
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType)) {
|
|
7091
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType, componentVariant)) {
|
|
7087
7092
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GitHubButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7088
7093
|
}
|
|
7089
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType)) {
|
|
7094
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType, componentVariant)) {
|
|
7090
7095
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FacebookButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7091
7096
|
}
|
|
7092
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType)) {
|
|
7097
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType, componentVariant)) {
|
|
7093
7098
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(MicrosoftButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7094
7099
|
}
|
|
7095
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType)) {
|
|
7100
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType, componentVariant)) {
|
|
7096
7101
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LinkedInButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7097
7102
|
}
|
|
7098
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType)) {
|
|
7103
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType, componentVariant)) {
|
|
7099
7104
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SignInWithEthereumButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7100
7105
|
}
|
|
7101
7106
|
if (actionId === "prompt_mobile" || eventType === "prompt_mobile") {
|
|
@@ -7119,6 +7124,9 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7119
7124
|
const variant = getTypographyVariant(component.variant);
|
|
7120
7125
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Typography_default, { variant, children: component.label || "" }, key);
|
|
7121
7126
|
}
|
|
7127
|
+
case import_browser45.EmbeddedFlowComponentTypeV2.Divider: {
|
|
7128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Divider_default, { children: component.label || "" }, key);
|
|
7129
|
+
}
|
|
7122
7130
|
case import_browser45.EmbeddedFlowComponentTypeV2.Block: {
|
|
7123
7131
|
if (component.components && component.components.length > 0) {
|
|
7124
7132
|
const blockComponents = component.components.map(
|
|
@@ -7137,7 +7145,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7137
7145
|
}
|
|
7138
7146
|
)
|
|
7139
7147
|
).filter(Boolean);
|
|
7140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("
|
|
7148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("form", { id: component.id, children: blockComponents }, key);
|
|
7141
7149
|
}
|
|
7142
7150
|
return null;
|
|
7143
7151
|
}
|
|
@@ -7433,11 +7441,13 @@ var BaseSignInContent2 = ({
|
|
|
7433
7441
|
const handleInputBlur = (name) => {
|
|
7434
7442
|
setFormTouched(name, true);
|
|
7435
7443
|
};
|
|
7436
|
-
const handleSubmit = async (component, data) => {
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7444
|
+
const handleSubmit = async (component, data, skipValidation) => {
|
|
7445
|
+
if (!skipValidation) {
|
|
7446
|
+
touchAllFields();
|
|
7447
|
+
const validation = validateForm();
|
|
7448
|
+
if (!validation.isValid) {
|
|
7449
|
+
return;
|
|
7450
|
+
}
|
|
7441
7451
|
}
|
|
7442
7452
|
setIsSubmitting(true);
|
|
7443
7453
|
clearMessages();
|
|
@@ -9218,10 +9228,17 @@ var BaseSignUpContent2 = ({
|
|
|
9218
9228
|
setFormValue(name, value);
|
|
9219
9229
|
setFormTouched(name, true);
|
|
9220
9230
|
};
|
|
9221
|
-
const handleSubmit = async (component, data) => {
|
|
9231
|
+
const handleSubmit = async (component, data, skipValidation) => {
|
|
9222
9232
|
if (!currentFlow) {
|
|
9223
9233
|
return;
|
|
9224
9234
|
}
|
|
9235
|
+
if (!skipValidation) {
|
|
9236
|
+
touchAllFields();
|
|
9237
|
+
const validation = validateForm();
|
|
9238
|
+
if (!validation.isValid) {
|
|
9239
|
+
return;
|
|
9240
|
+
}
|
|
9241
|
+
}
|
|
9225
9242
|
setIsLoading(true);
|
|
9226
9243
|
clearMessages();
|
|
9227
9244
|
try {
|