@asgardeo/react 0.21.3 → 0.22.0
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 +121 -89
- package/dist/cjs/index.js.map +2 -2
- package/dist/components/presentation/auth/AcceptInvite/v2/AcceptInvite.d.ts +3 -3
- package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +6 -6
- package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +7 -3
- package/dist/components/presentation/auth/InviteUser/v2/InviteUser.d.ts +1 -1
- package/dist/hooks/v2/useOAuthCallback.d.ts +9 -9
- package/dist/index.js +121 -89
- package/dist/index.js.map +2 -2
- package/dist/utils/v2/flowTransformer.d.ts +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -819,7 +819,7 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
819
819
|
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && arg1.callOnlyOnRedirect === true) {
|
|
820
820
|
return void 0;
|
|
821
821
|
}
|
|
822
|
-
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !isEmpty(arg1) && ("
|
|
822
|
+
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !isEmpty(arg1) && ("executionId" in arg1 || "applicationId" in arg1)) {
|
|
823
823
|
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId");
|
|
824
824
|
const authIdFromStorage = sessionStorage.getItem("asgardeo_auth_id");
|
|
825
825
|
const authId = authIdFromUrl || authIdFromStorage;
|
|
@@ -2134,7 +2134,7 @@ var AsgardeoProvider = ({
|
|
|
2134
2134
|
}
|
|
2135
2135
|
async function signIn(...args) {
|
|
2136
2136
|
const arg1 = args[0];
|
|
2137
|
-
const isV2FlowRequest = config.platform === Platform4.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("
|
|
2137
|
+
const isV2FlowRequest = config.platform === Platform4.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("executionId" in arg1 || "applicationId" in arg1);
|
|
2138
2138
|
try {
|
|
2139
2139
|
if (!isV2FlowRequest) {
|
|
2140
2140
|
setIsUpdatingSession(true);
|
|
@@ -2196,9 +2196,9 @@ var AsgardeoProvider = ({
|
|
|
2196
2196
|
if (isV2Platform) {
|
|
2197
2197
|
const urlParams = currentUrl.searchParams;
|
|
2198
2198
|
const code = urlParams.get("code");
|
|
2199
|
-
const
|
|
2200
|
-
const
|
|
2201
|
-
if (code && !
|
|
2199
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
2200
|
+
const storedExecutionId = sessionStorage.getItem("asgardeo_execution_id");
|
|
2201
|
+
if (code && !executionIdFromUrl && !storedExecutionId) {
|
|
2202
2202
|
await signIn();
|
|
2203
2203
|
}
|
|
2204
2204
|
} else {
|
|
@@ -5241,6 +5241,16 @@ var createField = (config) => {
|
|
|
5241
5241
|
autoComplete: "email"
|
|
5242
5242
|
}
|
|
5243
5243
|
);
|
|
5244
|
+
case FieldType.Tel:
|
|
5245
|
+
return /* @__PURE__ */ jsx35(
|
|
5246
|
+
TextField_default,
|
|
5247
|
+
{
|
|
5248
|
+
...commonProps,
|
|
5249
|
+
type: "tel",
|
|
5250
|
+
onChange: (e) => onChange(e.target.value),
|
|
5251
|
+
autoComplete: "tel"
|
|
5252
|
+
}
|
|
5253
|
+
);
|
|
5244
5254
|
case FieldType.Date:
|
|
5245
5255
|
return /* @__PURE__ */ jsx35(DatePicker_default, { ...commonProps, onChange: (e) => onChange(e.target.value) });
|
|
5246
5256
|
case FieldType.Checkbox: {
|
|
@@ -7827,7 +7837,7 @@ var normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7827
7837
|
return {
|
|
7828
7838
|
additionalData,
|
|
7829
7839
|
components: transformComponents(response, t, resolveTranslations, meta),
|
|
7830
|
-
|
|
7840
|
+
executionId: response.executionId
|
|
7831
7841
|
};
|
|
7832
7842
|
};
|
|
7833
7843
|
|
|
@@ -8791,6 +8801,8 @@ var getFieldType = (variant) => {
|
|
|
8791
8801
|
switch (variant) {
|
|
8792
8802
|
case EmbeddedFlowComponentType.EmailInput:
|
|
8793
8803
|
return FieldType7.Email;
|
|
8804
|
+
case EmbeddedFlowComponentType.PhoneInput:
|
|
8805
|
+
return FieldType7.Tel;
|
|
8794
8806
|
case EmbeddedFlowComponentType.PasswordInput:
|
|
8795
8807
|
return FieldType7.Password;
|
|
8796
8808
|
case EmbeddedFlowComponentType.TextInput:
|
|
@@ -8839,7 +8851,8 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8839
8851
|
switch (component.type) {
|
|
8840
8852
|
case EmbeddedFlowComponentType.TextInput:
|
|
8841
8853
|
case EmbeddedFlowComponentType.PasswordInput:
|
|
8842
|
-
case EmbeddedFlowComponentType.EmailInput:
|
|
8854
|
+
case EmbeddedFlowComponentType.EmailInput:
|
|
8855
|
+
case EmbeddedFlowComponentType.PhoneInput: {
|
|
8843
8856
|
const identifier = component.ref;
|
|
8844
8857
|
const value = formValues[identifier] || "";
|
|
8845
8858
|
const isTouched = touchedFields[identifier] || false;
|
|
@@ -8859,6 +8872,25 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8859
8872
|
});
|
|
8860
8873
|
return cloneElement(field, { key });
|
|
8861
8874
|
}
|
|
8875
|
+
case EmbeddedFlowComponentType.OtpInput: {
|
|
8876
|
+
const identifier = component.ref;
|
|
8877
|
+
const value = formValues[identifier] || "";
|
|
8878
|
+
const isTouched = touchedFields[identifier] || false;
|
|
8879
|
+
const error = isTouched ? formErrors[identifier] : void 0;
|
|
8880
|
+
const field = createField({
|
|
8881
|
+
className: options.inputClassName,
|
|
8882
|
+
error,
|
|
8883
|
+
label: resolve(component.label) || "",
|
|
8884
|
+
name: identifier,
|
|
8885
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
8886
|
+
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
8887
|
+
placeholder: resolve(component.placeholder) || "",
|
|
8888
|
+
required: component.required || false,
|
|
8889
|
+
type: FieldType7.Otp,
|
|
8890
|
+
value
|
|
8891
|
+
});
|
|
8892
|
+
return cloneElement(field, { key });
|
|
8893
|
+
}
|
|
8862
8894
|
case EmbeddedFlowComponentType.Action: {
|
|
8863
8895
|
const actionId = component.id;
|
|
8864
8896
|
const eventType = component.eventType || "";
|
|
@@ -9239,7 +9271,7 @@ var BaseSignInContent2 = ({
|
|
|
9239
9271
|
const fields = [];
|
|
9240
9272
|
const processComponents = (comps) => {
|
|
9241
9273
|
comps.forEach((component) => {
|
|
9242
|
-
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT") {
|
|
9274
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT" || component.type === "PHONE_INPUT" || component.type === "OTP_INPUT") {
|
|
9243
9275
|
const identifier = component.ref;
|
|
9244
9276
|
fields.push({
|
|
9245
9277
|
initialValue: "",
|
|
@@ -9477,8 +9509,8 @@ function cleanupUrlParams() {
|
|
|
9477
9509
|
window.history.replaceState({}, "", url.toString());
|
|
9478
9510
|
}
|
|
9479
9511
|
function useOAuthCallback({
|
|
9480
|
-
|
|
9481
|
-
|
|
9512
|
+
currentExecutionId,
|
|
9513
|
+
executionIdStorageKey = "asgardeo_execution_id",
|
|
9482
9514
|
isInitialized,
|
|
9483
9515
|
isSubmitting = false,
|
|
9484
9516
|
onComplete,
|
|
@@ -9487,7 +9519,7 @@ function useOAuthCallback({
|
|
|
9487
9519
|
onProcessingStart,
|
|
9488
9520
|
onSubmit,
|
|
9489
9521
|
processedRef,
|
|
9490
|
-
|
|
9522
|
+
setExecutionId: setExecExecutionId,
|
|
9491
9523
|
tokenValidationAttemptedRef
|
|
9492
9524
|
}) {
|
|
9493
9525
|
const internalRef = useRef6(false);
|
|
@@ -9500,7 +9532,7 @@ function useOAuthCallback({
|
|
|
9500
9532
|
const code = urlParams.get("code");
|
|
9501
9533
|
const nonce = urlParams.get("nonce");
|
|
9502
9534
|
const state = urlParams.get("state");
|
|
9503
|
-
const
|
|
9535
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
9504
9536
|
const error = urlParams.get("error");
|
|
9505
9537
|
const errorDescription = urlParams.get("error_description");
|
|
9506
9538
|
if (error) {
|
|
@@ -9518,11 +9550,11 @@ function useOAuthCallback({
|
|
|
9518
9550
|
if (tokenValidationAttemptedRef?.current) {
|
|
9519
9551
|
return;
|
|
9520
9552
|
}
|
|
9521
|
-
const
|
|
9522
|
-
const
|
|
9523
|
-
if (!
|
|
9553
|
+
const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
|
|
9554
|
+
const executionIdToUse = currentExecutionId || storedExecutionId || executionIdFromUrl || state || null;
|
|
9555
|
+
if (!executionIdToUse) {
|
|
9524
9556
|
oauthCodeProcessedRef.current = true;
|
|
9525
|
-
onError?.(new Error("Invalid flow. Missing
|
|
9557
|
+
onError?.(new Error("Invalid flow. Missing executionId."));
|
|
9526
9558
|
cleanupUrlParams();
|
|
9527
9559
|
return;
|
|
9528
9560
|
}
|
|
@@ -9531,13 +9563,13 @@ function useOAuthCallback({
|
|
|
9531
9563
|
tokenValidationAttemptedRef.current = true;
|
|
9532
9564
|
}
|
|
9533
9565
|
onProcessingStart?.();
|
|
9534
|
-
if (!
|
|
9535
|
-
|
|
9566
|
+
if (!currentExecutionId && setExecExecutionId) {
|
|
9567
|
+
setExecExecutionId(executionIdToUse);
|
|
9536
9568
|
}
|
|
9537
9569
|
(async () => {
|
|
9538
9570
|
try {
|
|
9539
9571
|
const payload = {
|
|
9540
|
-
|
|
9572
|
+
executionId: executionIdToUse,
|
|
9541
9573
|
inputs: {
|
|
9542
9574
|
code,
|
|
9543
9575
|
...nonce && { nonce }
|
|
@@ -9559,14 +9591,14 @@ function useOAuthCallback({
|
|
|
9559
9591
|
})();
|
|
9560
9592
|
}, [
|
|
9561
9593
|
isInitialized,
|
|
9562
|
-
|
|
9594
|
+
currentExecutionId,
|
|
9563
9595
|
isSubmitting,
|
|
9564
9596
|
onSubmit,
|
|
9565
9597
|
onComplete,
|
|
9566
9598
|
onError,
|
|
9567
9599
|
onFlowChange,
|
|
9568
|
-
|
|
9569
|
-
|
|
9600
|
+
setExecExecutionId,
|
|
9601
|
+
executionIdStorageKey
|
|
9570
9602
|
]);
|
|
9571
9603
|
}
|
|
9572
9604
|
|
|
@@ -9752,7 +9784,7 @@ var SignIn = ({
|
|
|
9752
9784
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
9753
9785
|
const [components, setComponents] = useState20([]);
|
|
9754
9786
|
const [additionalData, setAdditionalData] = useState20({});
|
|
9755
|
-
const [
|
|
9787
|
+
const [currentExecutionId, setCurrentExecutionId] = useState20(null);
|
|
9756
9788
|
const [isFlowInitialized, setIsFlowInitialized] = useState20(false);
|
|
9757
9789
|
const [flowError, setFlowError] = useState20(null);
|
|
9758
9790
|
const [isSubmitting, setIsSubmitting] = useState20(false);
|
|
@@ -9762,22 +9794,22 @@ var SignIn = ({
|
|
|
9762
9794
|
challenge: null,
|
|
9763
9795
|
creationOptions: null,
|
|
9764
9796
|
error: null,
|
|
9765
|
-
|
|
9797
|
+
executionId: null,
|
|
9766
9798
|
isActive: false
|
|
9767
9799
|
});
|
|
9768
9800
|
const initializationAttemptedRef = useRef7(false);
|
|
9769
9801
|
const oauthCodeProcessedRef = useRef7(false);
|
|
9770
9802
|
const passkeyProcessedRef = useRef7(false);
|
|
9771
|
-
const
|
|
9772
|
-
|
|
9773
|
-
if (
|
|
9774
|
-
sessionStorage.setItem("
|
|
9803
|
+
const setExecutionId = (executionId) => {
|
|
9804
|
+
setCurrentExecutionId(executionId);
|
|
9805
|
+
if (executionId) {
|
|
9806
|
+
sessionStorage.setItem("asgardeo_execution_id", executionId);
|
|
9775
9807
|
} else {
|
|
9776
|
-
sessionStorage.removeItem("
|
|
9808
|
+
sessionStorage.removeItem("asgardeo_execution_id");
|
|
9777
9809
|
}
|
|
9778
9810
|
};
|
|
9779
9811
|
const clearFlowState = () => {
|
|
9780
|
-
|
|
9812
|
+
setExecutionId(null);
|
|
9781
9813
|
setIsFlowInitialized(false);
|
|
9782
9814
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
9783
9815
|
setIsTimeoutDisabled(false);
|
|
@@ -9791,7 +9823,7 @@ var SignIn = ({
|
|
|
9791
9823
|
code: urlParams.get("code"),
|
|
9792
9824
|
error: urlParams.get("error"),
|
|
9793
9825
|
errorDescription: urlParams.get("error_description"),
|
|
9794
|
-
|
|
9826
|
+
executionId: urlParams.get("executionId"),
|
|
9795
9827
|
nonce: urlParams.get("nonce"),
|
|
9796
9828
|
state: urlParams.get("state")
|
|
9797
9829
|
};
|
|
@@ -9816,7 +9848,7 @@ var SignIn = ({
|
|
|
9816
9848
|
const cleanupFlowUrlParams = () => {
|
|
9817
9849
|
if (!window?.location?.href) return;
|
|
9818
9850
|
const url = new URL(window.location.href);
|
|
9819
|
-
url.searchParams.delete("
|
|
9851
|
+
url.searchParams.delete("executionId");
|
|
9820
9852
|
url.searchParams.delete("authId");
|
|
9821
9853
|
url.searchParams.delete("applicationId");
|
|
9822
9854
|
window?.history?.replaceState({}, "", url.toString());
|
|
@@ -9837,8 +9869,8 @@ var SignIn = ({
|
|
|
9837
9869
|
if (response.type === EmbeddedSignInFlowTypeV2.Redirection) {
|
|
9838
9870
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
9839
9871
|
if (redirectURL && window?.location) {
|
|
9840
|
-
if (response.
|
|
9841
|
-
|
|
9872
|
+
if (response.executionId) {
|
|
9873
|
+
setExecutionId(response.executionId);
|
|
9842
9874
|
}
|
|
9843
9875
|
const urlParams = getUrlParams2();
|
|
9844
9876
|
handleAuthId(urlParams.authId);
|
|
@@ -9853,9 +9885,9 @@ var SignIn = ({
|
|
|
9853
9885
|
oauthCodeProcessedRef.current = false;
|
|
9854
9886
|
handleAuthId(urlParams.authId);
|
|
9855
9887
|
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
9856
|
-
if (!urlParams.
|
|
9888
|
+
if (!urlParams.executionId && !effectiveApplicationId) {
|
|
9857
9889
|
const error = new AsgardeoRuntimeError8(
|
|
9858
|
-
"Either
|
|
9890
|
+
"Either executionId or applicationId is required for authentication",
|
|
9859
9891
|
"SIGN_IN_ERROR",
|
|
9860
9892
|
"react"
|
|
9861
9893
|
);
|
|
@@ -9865,9 +9897,9 @@ var SignIn = ({
|
|
|
9865
9897
|
try {
|
|
9866
9898
|
setFlowError(null);
|
|
9867
9899
|
let response;
|
|
9868
|
-
if (urlParams.
|
|
9900
|
+
if (urlParams.executionId) {
|
|
9869
9901
|
response = await signIn({
|
|
9870
|
-
|
|
9902
|
+
executionId: urlParams.executionId
|
|
9871
9903
|
});
|
|
9872
9904
|
} else {
|
|
9873
9905
|
response = await signIn({
|
|
@@ -9879,7 +9911,7 @@ var SignIn = ({
|
|
|
9879
9911
|
return;
|
|
9880
9912
|
}
|
|
9881
9913
|
const {
|
|
9882
|
-
|
|
9914
|
+
executionId: normalizedExecutionId,
|
|
9883
9915
|
components: normalizedComponents,
|
|
9884
9916
|
additionalData: normalizedAdditionalData
|
|
9885
9917
|
} = normalizeFlowResponse(
|
|
@@ -9890,8 +9922,8 @@ var SignIn = ({
|
|
|
9890
9922
|
},
|
|
9891
9923
|
meta
|
|
9892
9924
|
);
|
|
9893
|
-
if (
|
|
9894
|
-
|
|
9925
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
9926
|
+
setExecutionId(normalizedExecutionId);
|
|
9895
9927
|
setComponents(normalizedComponents);
|
|
9896
9928
|
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9897
9929
|
setIsFlowInitialized(true);
|
|
@@ -9916,11 +9948,11 @@ var SignIn = ({
|
|
|
9916
9948
|
}, []);
|
|
9917
9949
|
useEffect18(() => {
|
|
9918
9950
|
const currentUrlParams = getUrlParams2();
|
|
9919
|
-
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !
|
|
9951
|
+
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !currentExecutionId && !currentUrlParams.code && !currentUrlParams.state && !isSubmitting && !oauthCodeProcessedRef.current) {
|
|
9920
9952
|
initializationAttemptedRef.current = true;
|
|
9921
9953
|
initializeFlow();
|
|
9922
9954
|
}
|
|
9923
|
-
}, [isInitialized, isLoading, isFlowInitialized,
|
|
9955
|
+
}, [isInitialized, isLoading, isFlowInitialized, currentExecutionId]);
|
|
9924
9956
|
useEffect18(() => {
|
|
9925
9957
|
const timeoutMs = Number(additionalData?.["stepTimeout"]) || 0;
|
|
9926
9958
|
if (timeoutMs <= 0 || !isFlowInitialized) {
|
|
@@ -9943,8 +9975,8 @@ var SignIn = ({
|
|
|
9943
9975
|
return () => clearTimeout(timerId);
|
|
9944
9976
|
}, [additionalData?.["stepTimeout"], isFlowInitialized, t]);
|
|
9945
9977
|
const handleSubmit = async (payload) => {
|
|
9946
|
-
const
|
|
9947
|
-
if (!
|
|
9978
|
+
const effectiveExecutionId = payload.executionId || currentExecutionId;
|
|
9979
|
+
if (!effectiveExecutionId) {
|
|
9948
9980
|
throw new Error("No active flow ID");
|
|
9949
9981
|
}
|
|
9950
9982
|
const processedInputs = { ...payload.inputs };
|
|
@@ -10001,7 +10033,7 @@ var SignIn = ({
|
|
|
10001
10033
|
setIsSubmitting(true);
|
|
10002
10034
|
setFlowError(null);
|
|
10003
10035
|
const response = await signIn({
|
|
10004
|
-
|
|
10036
|
+
executionId: effectiveExecutionId,
|
|
10005
10037
|
...payload,
|
|
10006
10038
|
inputs: processedInputs
|
|
10007
10039
|
});
|
|
@@ -10010,21 +10042,21 @@ var SignIn = ({
|
|
|
10010
10042
|
}
|
|
10011
10043
|
if (response.data?.additionalData?.["passkeyChallenge"] || response.data?.additionalData?.["passkeyCreationOptions"]) {
|
|
10012
10044
|
const { passkeyChallenge, passkeyCreationOptions } = response.data.additionalData;
|
|
10013
|
-
const
|
|
10045
|
+
const effectiveExecutionIdForPasskey = response.executionId || effectiveExecutionId;
|
|
10014
10046
|
passkeyProcessedRef.current = false;
|
|
10015
10047
|
setPasskeyState({
|
|
10016
10048
|
actionId: "submit",
|
|
10017
10049
|
challenge: passkeyChallenge,
|
|
10018
10050
|
creationOptions: passkeyCreationOptions,
|
|
10019
10051
|
error: null,
|
|
10020
|
-
|
|
10052
|
+
executionId: effectiveExecutionIdForPasskey,
|
|
10021
10053
|
isActive: true
|
|
10022
10054
|
});
|
|
10023
10055
|
setIsSubmitting(false);
|
|
10024
10056
|
return;
|
|
10025
10057
|
}
|
|
10026
10058
|
const {
|
|
10027
|
-
|
|
10059
|
+
executionId: normalizedExecutionId,
|
|
10028
10060
|
components: normalizedComponents,
|
|
10029
10061
|
additionalData: normalizedAdditionalData
|
|
10030
10062
|
} = normalizeFlowResponse(
|
|
@@ -10048,9 +10080,9 @@ var SignIn = ({
|
|
|
10048
10080
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
10049
10081
|
const finalRedirectUrl = redirectUrl || afterSignInUrl;
|
|
10050
10082
|
setIsSubmitting(false);
|
|
10051
|
-
|
|
10083
|
+
setExecutionId(null);
|
|
10052
10084
|
setIsFlowInitialized(false);
|
|
10053
|
-
sessionStorage.removeItem("
|
|
10085
|
+
sessionStorage.removeItem("asgardeo_execution_id");
|
|
10054
10086
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
10055
10087
|
cleanupOAuthUrlParams(true);
|
|
10056
10088
|
if (onSuccess) {
|
|
@@ -10064,8 +10096,8 @@ var SignIn = ({
|
|
|
10064
10096
|
}
|
|
10065
10097
|
return;
|
|
10066
10098
|
}
|
|
10067
|
-
if (
|
|
10068
|
-
|
|
10099
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
10100
|
+
setExecutionId(normalizedExecutionId);
|
|
10069
10101
|
setComponents(normalizedComponents);
|
|
10070
10102
|
setAdditionalData(normalizedAdditionalData ?? {});
|
|
10071
10103
|
setIsTimeoutDisabled(false);
|
|
@@ -10089,19 +10121,19 @@ var SignIn = ({
|
|
|
10089
10121
|
setError(error);
|
|
10090
10122
|
};
|
|
10091
10123
|
useOAuthCallback({
|
|
10092
|
-
|
|
10124
|
+
currentExecutionId,
|
|
10093
10125
|
isInitialized: isInitialized && !isLoading,
|
|
10094
10126
|
isSubmitting,
|
|
10095
10127
|
onError: (err) => {
|
|
10096
10128
|
clearFlowState();
|
|
10097
10129
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
10098
10130
|
},
|
|
10099
|
-
onSubmit: async (payload) => handleSubmit({
|
|
10131
|
+
onSubmit: async (payload) => handleSubmit({ executionId: payload.executionId, inputs: payload.inputs }),
|
|
10100
10132
|
processedRef: oauthCodeProcessedRef,
|
|
10101
|
-
|
|
10133
|
+
setExecutionId
|
|
10102
10134
|
});
|
|
10103
10135
|
useEffect18(() => {
|
|
10104
|
-
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.
|
|
10136
|
+
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.executionId) {
|
|
10105
10137
|
return;
|
|
10106
10138
|
}
|
|
10107
10139
|
if (passkeyProcessedRef.current) {
|
|
@@ -10132,7 +10164,7 @@ var SignIn = ({
|
|
|
10132
10164
|
throw new Error("No passkey challenge or creation options available");
|
|
10133
10165
|
}
|
|
10134
10166
|
await handleSubmit({
|
|
10135
|
-
|
|
10167
|
+
executionId: passkeyState.executionId,
|
|
10136
10168
|
inputs
|
|
10137
10169
|
});
|
|
10138
10170
|
};
|
|
@@ -10142,7 +10174,7 @@ var SignIn = ({
|
|
|
10142
10174
|
challenge: null,
|
|
10143
10175
|
creationOptions: null,
|
|
10144
10176
|
error: null,
|
|
10145
|
-
|
|
10177
|
+
executionId: null,
|
|
10146
10178
|
isActive: false
|
|
10147
10179
|
});
|
|
10148
10180
|
}).catch((error) => {
|
|
@@ -10150,7 +10182,7 @@ var SignIn = ({
|
|
|
10150
10182
|
setFlowError(error);
|
|
10151
10183
|
onError?.(error);
|
|
10152
10184
|
});
|
|
10153
|
-
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.
|
|
10185
|
+
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.executionId]);
|
|
10154
10186
|
if (children) {
|
|
10155
10187
|
const renderProps = {
|
|
10156
10188
|
additionalData,
|
|
@@ -11454,7 +11486,7 @@ var BaseSignUpContent2 = ({
|
|
|
11454
11486
|
actionId: null,
|
|
11455
11487
|
creationOptions: null,
|
|
11456
11488
|
error: null,
|
|
11457
|
-
|
|
11489
|
+
executionId: null,
|
|
11458
11490
|
isActive: false
|
|
11459
11491
|
});
|
|
11460
11492
|
const initializationAttemptedRef = useRef9(false);
|
|
@@ -11599,7 +11631,7 @@ var BaseSignUpContent2 = ({
|
|
|
11599
11631
|
const { code, state } = event.data;
|
|
11600
11632
|
if (code && state) {
|
|
11601
11633
|
const payload = {
|
|
11602
|
-
...currentFlow.
|
|
11634
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11603
11635
|
action: "",
|
|
11604
11636
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11605
11637
|
inputs: {
|
|
@@ -11652,7 +11684,7 @@ var BaseSignUpContent2 = ({
|
|
|
11652
11684
|
}
|
|
11653
11685
|
if (code && state) {
|
|
11654
11686
|
const payload = {
|
|
11655
|
-
...currentFlow.
|
|
11687
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11656
11688
|
action: "",
|
|
11657
11689
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11658
11690
|
inputs: {
|
|
@@ -11711,7 +11743,7 @@ var BaseSignUpContent2 = ({
|
|
|
11711
11743
|
});
|
|
11712
11744
|
}
|
|
11713
11745
|
const payload = {
|
|
11714
|
-
...currentFlow.
|
|
11746
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11715
11747
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11716
11748
|
...component.id && { action: component.id },
|
|
11717
11749
|
inputs: filteredInputs
|
|
@@ -11729,13 +11761,13 @@ var BaseSignUpContent2 = ({
|
|
|
11729
11761
|
}
|
|
11730
11762
|
if (response.data?.additionalData?.["passkeyCreationOptions"]) {
|
|
11731
11763
|
const { passkeyCreationOptions } = response.data.additionalData;
|
|
11732
|
-
const
|
|
11764
|
+
const effectiveExecutionIdForPasskey = response.executionId || currentFlow?.executionId;
|
|
11733
11765
|
passkeyProcessedRef.current = false;
|
|
11734
11766
|
setPasskeyState({
|
|
11735
11767
|
actionId: component.id || "submit",
|
|
11736
11768
|
creationOptions: passkeyCreationOptions,
|
|
11737
11769
|
error: null,
|
|
11738
|
-
|
|
11770
|
+
executionId: effectiveExecutionIdForPasskey,
|
|
11739
11771
|
isActive: true
|
|
11740
11772
|
});
|
|
11741
11773
|
setIsLoading(false);
|
|
@@ -11752,7 +11784,7 @@ var BaseSignUpContent2 = ({
|
|
|
11752
11784
|
}
|
|
11753
11785
|
};
|
|
11754
11786
|
useEffect20(() => {
|
|
11755
|
-
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.
|
|
11787
|
+
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {
|
|
11756
11788
|
return;
|
|
11757
11789
|
}
|
|
11758
11790
|
if (passkeyProcessedRef.current) {
|
|
@@ -11769,7 +11801,7 @@ var BaseSignUpContent2 = ({
|
|
|
11769
11801
|
};
|
|
11770
11802
|
const payload = {
|
|
11771
11803
|
actionId: passkeyState.actionId || "submit",
|
|
11772
|
-
|
|
11804
|
+
executionId: passkeyState.executionId,
|
|
11773
11805
|
flowType: currentFlow?.flowType || "REGISTRATION",
|
|
11774
11806
|
inputs
|
|
11775
11807
|
};
|
|
@@ -11784,13 +11816,13 @@ var BaseSignUpContent2 = ({
|
|
|
11784
11816
|
}
|
|
11785
11817
|
};
|
|
11786
11818
|
performPasskeyRegistration().then(() => {
|
|
11787
|
-
setPasskeyState({ actionId: null, creationOptions: null, error: null,
|
|
11819
|
+
setPasskeyState({ actionId: null, creationOptions: null, error: null, executionId: null, isActive: false });
|
|
11788
11820
|
}).catch((error) => {
|
|
11789
11821
|
setPasskeyState((prev) => ({ ...prev, error, isActive: false }));
|
|
11790
11822
|
handleError(error);
|
|
11791
11823
|
onError?.(error);
|
|
11792
11824
|
});
|
|
11793
|
-
}, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.
|
|
11825
|
+
}, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.executionId]);
|
|
11794
11826
|
const containerClasses = cx25(
|
|
11795
11827
|
[
|
|
11796
11828
|
withVendorCSSClassPrefix24("signup"),
|
|
@@ -12245,7 +12277,7 @@ var BaseInviteUser = ({
|
|
|
12245
12277
|
const errors = {};
|
|
12246
12278
|
const validateComponents = (comps) => {
|
|
12247
12279
|
comps.forEach((comp) => {
|
|
12248
|
-
if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
|
|
12280
|
+
if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT" || comp.type === "PHONE_INPUT" || comp.type === "OTP_INPUT") && comp.required && comp.ref) {
|
|
12249
12281
|
const value = formValues[comp.ref];
|
|
12250
12282
|
if (!value || value.trim() === "") {
|
|
12251
12283
|
errors[comp.ref] = `${comp.label || comp.ref} is required`;
|
|
@@ -12287,7 +12319,7 @@ var BaseInviteUser = ({
|
|
|
12287
12319
|
try {
|
|
12288
12320
|
const inputs = data || formValues;
|
|
12289
12321
|
const payload = {
|
|
12290
|
-
|
|
12322
|
+
executionId: currentFlow.executionId,
|
|
12291
12323
|
inputs,
|
|
12292
12324
|
verbose: true
|
|
12293
12325
|
};
|
|
@@ -12418,8 +12450,8 @@ var BaseInviteUser = ({
|
|
|
12418
12450
|
additionalData: currentFlow?.data?.additionalData,
|
|
12419
12451
|
components,
|
|
12420
12452
|
error: apiError,
|
|
12453
|
+
executionId: currentFlow?.executionId,
|
|
12421
12454
|
fieldErrors: formErrors,
|
|
12422
|
-
flowId: currentFlow?.flowId,
|
|
12423
12455
|
handleInputBlur,
|
|
12424
12456
|
handleInputChange,
|
|
12425
12457
|
handleSubmit,
|
|
@@ -12590,7 +12622,7 @@ var BaseAcceptInvite_styles_default = useStyles23;
|
|
|
12590
12622
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
12591
12623
|
import { jsx as jsx88, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
12592
12624
|
var BaseAcceptInvite = ({
|
|
12593
|
-
|
|
12625
|
+
executionId,
|
|
12594
12626
|
inviteToken,
|
|
12595
12627
|
onSubmit,
|
|
12596
12628
|
onComplete,
|
|
@@ -12657,7 +12689,7 @@ var BaseAcceptInvite = ({
|
|
|
12657
12689
|
[t, children]
|
|
12658
12690
|
);
|
|
12659
12691
|
useOAuthCallback({
|
|
12660
|
-
|
|
12692
|
+
currentExecutionId: executionId ?? null,
|
|
12661
12693
|
isInitialized: true,
|
|
12662
12694
|
onComplete: () => {
|
|
12663
12695
|
setIsValidatingToken(false);
|
|
@@ -12704,7 +12736,7 @@ var BaseAcceptInvite = ({
|
|
|
12704
12736
|
const errors = {};
|
|
12705
12737
|
const validateComponents = (comps) => {
|
|
12706
12738
|
comps.forEach((comp) => {
|
|
12707
|
-
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT") && comp.required && comp.ref) {
|
|
12739
|
+
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "PHONE_INPUT" || comp.type === "OTP_INPUT") && comp.required && comp.ref) {
|
|
12708
12740
|
const value = formValues[comp.ref];
|
|
12709
12741
|
if (!value || value.trim() === "") {
|
|
12710
12742
|
errors[comp.ref] = t("validations.required.field.error");
|
|
@@ -12742,7 +12774,7 @@ var BaseAcceptInvite = ({
|
|
|
12742
12774
|
try {
|
|
12743
12775
|
const inputs = data || formValues;
|
|
12744
12776
|
const payload = {
|
|
12745
|
-
|
|
12777
|
+
executionId: currentFlow.executionId,
|
|
12746
12778
|
inputs,
|
|
12747
12779
|
verbose: true
|
|
12748
12780
|
};
|
|
@@ -12797,10 +12829,10 @@ var BaseAcceptInvite = ({
|
|
|
12797
12829
|
if (tokenValidationAttemptedRef.current) {
|
|
12798
12830
|
return;
|
|
12799
12831
|
}
|
|
12800
|
-
if (!
|
|
12832
|
+
if (!executionId || !inviteToken) {
|
|
12801
12833
|
setIsValidatingToken(false);
|
|
12802
12834
|
setIsTokenInvalid(true);
|
|
12803
|
-
handleError(new Error("Invalid invite link. Missing
|
|
12835
|
+
handleError(new Error("Invalid invite link. Missing executionId or inviteToken."));
|
|
12804
12836
|
return;
|
|
12805
12837
|
}
|
|
12806
12838
|
tokenValidationAttemptedRef.current = true;
|
|
@@ -12808,11 +12840,11 @@ var BaseAcceptInvite = ({
|
|
|
12808
12840
|
setIsValidatingToken(true);
|
|
12809
12841
|
setApiError(null);
|
|
12810
12842
|
try {
|
|
12811
|
-
if (
|
|
12812
|
-
sessionStorage.setItem("
|
|
12843
|
+
if (executionId) {
|
|
12844
|
+
sessionStorage.setItem("asgardeo_execution_id", executionId);
|
|
12813
12845
|
}
|
|
12814
12846
|
const payload = {
|
|
12815
|
-
|
|
12847
|
+
executionId,
|
|
12816
12848
|
inputs: {
|
|
12817
12849
|
inviteToken
|
|
12818
12850
|
},
|
|
@@ -12834,7 +12866,7 @@ var BaseAcceptInvite = ({
|
|
|
12834
12866
|
setIsValidatingToken(false);
|
|
12835
12867
|
}
|
|
12836
12868
|
})();
|
|
12837
|
-
}, [
|
|
12869
|
+
}, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
12838
12870
|
const extractHeadings = useCallback18((components2) => {
|
|
12839
12871
|
let title2;
|
|
12840
12872
|
let subtitle2;
|
|
@@ -12861,8 +12893,8 @@ var BaseAcceptInvite = ({
|
|
|
12861
12893
|
const renderProps = {
|
|
12862
12894
|
components,
|
|
12863
12895
|
error: apiError,
|
|
12896
|
+
executionId,
|
|
12864
12897
|
fieldErrors: formErrors,
|
|
12865
|
-
flowId,
|
|
12866
12898
|
goToSignIn: onGoToSignIn,
|
|
12867
12899
|
handleInputBlur,
|
|
12868
12900
|
handleInputChange,
|
|
@@ -12943,13 +12975,13 @@ var getUrlParams = () => {
|
|
|
12943
12975
|
}
|
|
12944
12976
|
const params = new URLSearchParams(window.location.search);
|
|
12945
12977
|
return {
|
|
12946
|
-
|
|
12978
|
+
executionId: params.get("executionId") || void 0,
|
|
12947
12979
|
inviteToken: params.get("inviteToken") || void 0
|
|
12948
12980
|
};
|
|
12949
12981
|
};
|
|
12950
12982
|
var AcceptInvite = ({
|
|
12951
12983
|
baseUrl,
|
|
12952
|
-
|
|
12984
|
+
executionId: executionIdProp,
|
|
12953
12985
|
inviteToken: inviteTokenProp,
|
|
12954
12986
|
onComplete,
|
|
12955
12987
|
onError,
|
|
@@ -12962,8 +12994,8 @@ var AcceptInvite = ({
|
|
|
12962
12994
|
showTitle = true,
|
|
12963
12995
|
showSubtitle = true
|
|
12964
12996
|
}) => {
|
|
12965
|
-
const {
|
|
12966
|
-
const
|
|
12997
|
+
const { executionId: urlExecutionId, inviteToken: urlInviteToken } = useMemo32(() => getUrlParams(), []);
|
|
12998
|
+
const executionId = executionIdProp || urlExecutionId;
|
|
12967
12999
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
12968
13000
|
const apiBaseUrl = useMemo32(() => {
|
|
12969
13001
|
if (baseUrl) {
|
|
@@ -12995,7 +13027,7 @@ var AcceptInvite = ({
|
|
|
12995
13027
|
return /* @__PURE__ */ jsx89(
|
|
12996
13028
|
BaseAcceptInvite_default,
|
|
12997
13029
|
{
|
|
12998
|
-
|
|
13030
|
+
executionId,
|
|
12999
13031
|
inviteToken,
|
|
13000
13032
|
onSubmit: handleSubmit,
|
|
13001
13033
|
onComplete,
|