@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.
|
@@ -25,7 +25,7 @@ export declare const renderSignInComponents: (components: EmbeddedFlowComponent[
|
|
|
25
25
|
buttonClassName?: string;
|
|
26
26
|
inputClassName?: string;
|
|
27
27
|
onInputBlur?: (name: string) => void;
|
|
28
|
-
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any
|
|
28
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
29
29
|
size?: "small" | "medium" | "large";
|
|
30
30
|
variant?: any;
|
|
31
31
|
}) => ReactElement[];
|
|
@@ -36,7 +36,7 @@ export declare const renderSignUpComponents: (components: EmbeddedFlowComponent[
|
|
|
36
36
|
buttonClassName?: string;
|
|
37
37
|
inputClassName?: string;
|
|
38
38
|
onInputBlur?: (name: string) => void;
|
|
39
|
-
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any
|
|
39
|
+
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
40
40
|
size?: "small" | "medium" | "large";
|
|
41
41
|
variant?: any;
|
|
42
42
|
}) => ReactElement[];
|
package/dist/index.js
CHANGED
|
@@ -6879,7 +6879,9 @@ import React from "react";
|
|
|
6879
6879
|
import {
|
|
6880
6880
|
AsgardeoRuntimeError as AsgardeoRuntimeError7,
|
|
6881
6881
|
FieldType as FieldType7,
|
|
6882
|
-
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType
|
|
6882
|
+
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,
|
|
6883
|
+
EmbeddedFlowActionVariantV2 as EmbeddedFlowActionVariant,
|
|
6884
|
+
EmbeddedFlowEventTypeV2 as EmbeddedFlowEventType
|
|
6883
6885
|
} from "@asgardeo/browser";
|
|
6884
6886
|
|
|
6885
6887
|
// src/components/adapters/SmsOtpButton.tsx
|
|
@@ -6944,9 +6946,12 @@ var getTypographyVariant = (variant) => {
|
|
|
6944
6946
|
};
|
|
6945
6947
|
return variantMap[variant] || "h3";
|
|
6946
6948
|
};
|
|
6947
|
-
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType) => {
|
|
6949
|
+
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType, componentVariant) => {
|
|
6948
6950
|
const providerId = `${provider}_auth`;
|
|
6949
6951
|
const providerMatches = actionId === providerId || eventType === providerId;
|
|
6952
|
+
if (componentVariant?.toUpperCase() === EmbeddedFlowActionVariant.Social) {
|
|
6953
|
+
return buttonText.toLowerCase().includes(provider);
|
|
6954
|
+
}
|
|
6950
6955
|
if (authType === "signup") {
|
|
6951
6956
|
return providerMatches || buttonText.toLowerCase().includes(provider);
|
|
6952
6957
|
}
|
|
@@ -6981,6 +6986,11 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
6981
6986
|
return React.cloneElement(field, { key });
|
|
6982
6987
|
}
|
|
6983
6988
|
case EmbeddedFlowComponentType.Action: {
|
|
6989
|
+
const actionId = component.id;
|
|
6990
|
+
const eventType = component.eventType || "";
|
|
6991
|
+
const buttonText = component.label || "";
|
|
6992
|
+
const componentVariant = component.variant || "";
|
|
6993
|
+
const shouldSkipValidation = eventType.toUpperCase() === EmbeddedFlowEventType.Trigger;
|
|
6984
6994
|
const handleClick = () => {
|
|
6985
6995
|
if (options.onSubmit) {
|
|
6986
6996
|
const formData = {};
|
|
@@ -6989,28 +6999,25 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
6989
6999
|
formData[field] = formValues[field];
|
|
6990
7000
|
}
|
|
6991
7001
|
});
|
|
6992
|
-
options.onSubmit(component, formData);
|
|
7002
|
+
options.onSubmit(component, formData, shouldSkipValidation);
|
|
6993
7003
|
}
|
|
6994
7004
|
};
|
|
6995
|
-
|
|
6996
|
-
const eventType = component.eventType || "";
|
|
6997
|
-
const buttonText = component.label || "";
|
|
6998
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType)) {
|
|
7005
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType, componentVariant)) {
|
|
6999
7006
|
return /* @__PURE__ */ jsx55(GoogleButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7000
7007
|
}
|
|
7001
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType)) {
|
|
7008
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType, componentVariant)) {
|
|
7002
7009
|
return /* @__PURE__ */ jsx55(GitHubButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7003
7010
|
}
|
|
7004
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType)) {
|
|
7011
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType, componentVariant)) {
|
|
7005
7012
|
return /* @__PURE__ */ jsx55(FacebookButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7006
7013
|
}
|
|
7007
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType)) {
|
|
7014
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType, componentVariant)) {
|
|
7008
7015
|
return /* @__PURE__ */ jsx55(MicrosoftButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7009
7016
|
}
|
|
7010
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType)) {
|
|
7017
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType, componentVariant)) {
|
|
7011
7018
|
return /* @__PURE__ */ jsx55(LinkedInButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7012
7019
|
}
|
|
7013
|
-
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType)) {
|
|
7020
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType, componentVariant)) {
|
|
7014
7021
|
return /* @__PURE__ */ jsx55(SignInWithEthereumButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
7015
7022
|
}
|
|
7016
7023
|
if (actionId === "prompt_mobile" || eventType === "prompt_mobile") {
|
|
@@ -7034,6 +7041,9 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7034
7041
|
const variant = getTypographyVariant(component.variant);
|
|
7035
7042
|
return /* @__PURE__ */ jsx55(Typography_default, { variant, children: component.label || "" }, key);
|
|
7036
7043
|
}
|
|
7044
|
+
case EmbeddedFlowComponentType.Divider: {
|
|
7045
|
+
return /* @__PURE__ */ jsx55(Divider_default, { children: component.label || "" }, key);
|
|
7046
|
+
}
|
|
7037
7047
|
case EmbeddedFlowComponentType.Block: {
|
|
7038
7048
|
if (component.components && component.components.length > 0) {
|
|
7039
7049
|
const blockComponents = component.components.map(
|
|
@@ -7052,7 +7062,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7052
7062
|
}
|
|
7053
7063
|
)
|
|
7054
7064
|
).filter(Boolean);
|
|
7055
|
-
return /* @__PURE__ */ jsx55("
|
|
7065
|
+
return /* @__PURE__ */ jsx55("form", { id: component.id, children: blockComponents }, key);
|
|
7056
7066
|
}
|
|
7057
7067
|
return null;
|
|
7058
7068
|
}
|
|
@@ -7348,11 +7358,13 @@ var BaseSignInContent2 = ({
|
|
|
7348
7358
|
const handleInputBlur = (name) => {
|
|
7349
7359
|
setFormTouched(name, true);
|
|
7350
7360
|
};
|
|
7351
|
-
const handleSubmit = async (component, data) => {
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7361
|
+
const handleSubmit = async (component, data, skipValidation) => {
|
|
7362
|
+
if (!skipValidation) {
|
|
7363
|
+
touchAllFields();
|
|
7364
|
+
const validation = validateForm();
|
|
7365
|
+
if (!validation.isValid) {
|
|
7366
|
+
return;
|
|
7367
|
+
}
|
|
7356
7368
|
}
|
|
7357
7369
|
setIsSubmitting(true);
|
|
7358
7370
|
clearMessages();
|
|
@@ -9150,10 +9162,17 @@ var BaseSignUpContent2 = ({
|
|
|
9150
9162
|
setFormValue(name, value);
|
|
9151
9163
|
setFormTouched(name, true);
|
|
9152
9164
|
};
|
|
9153
|
-
const handleSubmit = async (component, data) => {
|
|
9165
|
+
const handleSubmit = async (component, data, skipValidation) => {
|
|
9154
9166
|
if (!currentFlow) {
|
|
9155
9167
|
return;
|
|
9156
9168
|
}
|
|
9169
|
+
if (!skipValidation) {
|
|
9170
|
+
touchAllFields();
|
|
9171
|
+
const validation = validateForm();
|
|
9172
|
+
if (!validation.isValid) {
|
|
9173
|
+
return;
|
|
9174
|
+
}
|
|
9175
|
+
}
|
|
9157
9176
|
setIsLoading(true);
|
|
9158
9177
|
clearMessages();
|
|
9159
9178
|
try {
|