@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/cjs/index.js
CHANGED
|
@@ -950,7 +950,7 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
|
|
|
950
950
|
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && arg1.callOnlyOnRedirect === true) {
|
|
951
951
|
return void 0;
|
|
952
952
|
}
|
|
953
|
-
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !(0, import_browser6.isEmpty)(arg1) && ("
|
|
953
|
+
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !(0, import_browser6.isEmpty)(arg1) && ("executionId" in arg1 || "applicationId" in arg1)) {
|
|
954
954
|
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId");
|
|
955
955
|
const authIdFromStorage = sessionStorage.getItem("asgardeo_auth_id");
|
|
956
956
|
const authId = authIdFromUrl || authIdFromStorage;
|
|
@@ -2250,7 +2250,7 @@ var AsgardeoProvider = ({
|
|
|
2250
2250
|
}
|
|
2251
2251
|
async function signIn(...args) {
|
|
2252
2252
|
const arg1 = args[0];
|
|
2253
|
-
const isV2FlowRequest = config.platform === import_browser16.Platform.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("
|
|
2253
|
+
const isV2FlowRequest = config.platform === import_browser16.Platform.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("executionId" in arg1 || "applicationId" in arg1);
|
|
2254
2254
|
try {
|
|
2255
2255
|
if (!isV2FlowRequest) {
|
|
2256
2256
|
setIsUpdatingSession(true);
|
|
@@ -2312,9 +2312,9 @@ var AsgardeoProvider = ({
|
|
|
2312
2312
|
if (isV2Platform) {
|
|
2313
2313
|
const urlParams = currentUrl.searchParams;
|
|
2314
2314
|
const code = urlParams.get("code");
|
|
2315
|
-
const
|
|
2316
|
-
const
|
|
2317
|
-
if (code && !
|
|
2315
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
2316
|
+
const storedExecutionId = sessionStorage.getItem("asgardeo_execution_id");
|
|
2317
|
+
if (code && !executionIdFromUrl && !storedExecutionId) {
|
|
2318
2318
|
await signIn();
|
|
2319
2319
|
}
|
|
2320
2320
|
} else {
|
|
@@ -5335,6 +5335,16 @@ var createField = (config) => {
|
|
|
5335
5335
|
autoComplete: "email"
|
|
5336
5336
|
}
|
|
5337
5337
|
);
|
|
5338
|
+
case import_browser36.FieldType.Tel:
|
|
5339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5340
|
+
TextField_default,
|
|
5341
|
+
{
|
|
5342
|
+
...commonProps,
|
|
5343
|
+
type: "tel",
|
|
5344
|
+
onChange: (e) => onChange(e.target.value),
|
|
5345
|
+
autoComplete: "tel"
|
|
5346
|
+
}
|
|
5347
|
+
);
|
|
5338
5348
|
case import_browser36.FieldType.Date:
|
|
5339
5349
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DatePicker_default, { ...commonProps, onChange: (e) => onChange(e.target.value) });
|
|
5340
5350
|
case import_browser36.FieldType.Checkbox: {
|
|
@@ -7913,7 +7923,7 @@ var normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7913
7923
|
return {
|
|
7914
7924
|
additionalData,
|
|
7915
7925
|
components: transformComponents(response, t, resolveTranslations, meta),
|
|
7916
|
-
|
|
7926
|
+
executionId: response.executionId
|
|
7917
7927
|
};
|
|
7918
7928
|
};
|
|
7919
7929
|
|
|
@@ -8870,6 +8880,8 @@ var getFieldType = (variant) => {
|
|
|
8870
8880
|
switch (variant) {
|
|
8871
8881
|
case import_browser53.EmbeddedFlowComponentTypeV2.EmailInput:
|
|
8872
8882
|
return import_browser53.FieldType.Email;
|
|
8883
|
+
case import_browser53.EmbeddedFlowComponentTypeV2.PhoneInput:
|
|
8884
|
+
return import_browser53.FieldType.Tel;
|
|
8873
8885
|
case import_browser53.EmbeddedFlowComponentTypeV2.PasswordInput:
|
|
8874
8886
|
return import_browser53.FieldType.Password;
|
|
8875
8887
|
case import_browser53.EmbeddedFlowComponentTypeV2.TextInput:
|
|
@@ -8918,7 +8930,8 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8918
8930
|
switch (component.type) {
|
|
8919
8931
|
case import_browser53.EmbeddedFlowComponentTypeV2.TextInput:
|
|
8920
8932
|
case import_browser53.EmbeddedFlowComponentTypeV2.PasswordInput:
|
|
8921
|
-
case import_browser53.EmbeddedFlowComponentTypeV2.EmailInput:
|
|
8933
|
+
case import_browser53.EmbeddedFlowComponentTypeV2.EmailInput:
|
|
8934
|
+
case import_browser53.EmbeddedFlowComponentTypeV2.PhoneInput: {
|
|
8922
8935
|
const identifier = component.ref;
|
|
8923
8936
|
const value = formValues[identifier] || "";
|
|
8924
8937
|
const isTouched = touchedFields[identifier] || false;
|
|
@@ -8938,6 +8951,25 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8938
8951
|
});
|
|
8939
8952
|
return (0, import_react69.cloneElement)(field, { key });
|
|
8940
8953
|
}
|
|
8954
|
+
case import_browser53.EmbeddedFlowComponentTypeV2.OtpInput: {
|
|
8955
|
+
const identifier = component.ref;
|
|
8956
|
+
const value = formValues[identifier] || "";
|
|
8957
|
+
const isTouched = touchedFields[identifier] || false;
|
|
8958
|
+
const error = isTouched ? formErrors[identifier] : void 0;
|
|
8959
|
+
const field = createField({
|
|
8960
|
+
className: options.inputClassName,
|
|
8961
|
+
error,
|
|
8962
|
+
label: resolve(component.label) || "",
|
|
8963
|
+
name: identifier,
|
|
8964
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
8965
|
+
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
8966
|
+
placeholder: resolve(component.placeholder) || "",
|
|
8967
|
+
required: component.required || false,
|
|
8968
|
+
type: import_browser53.FieldType.Otp,
|
|
8969
|
+
value
|
|
8970
|
+
});
|
|
8971
|
+
return (0, import_react69.cloneElement)(field, { key });
|
|
8972
|
+
}
|
|
8941
8973
|
case import_browser53.EmbeddedFlowComponentTypeV2.Action: {
|
|
8942
8974
|
const actionId = component.id;
|
|
8943
8975
|
const eventType = component.eventType || "";
|
|
@@ -9318,7 +9350,7 @@ var BaseSignInContent2 = ({
|
|
|
9318
9350
|
const fields = [];
|
|
9319
9351
|
const processComponents = (comps) => {
|
|
9320
9352
|
comps.forEach((component) => {
|
|
9321
|
-
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT") {
|
|
9353
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT" || component.type === "PHONE_INPUT" || component.type === "OTP_INPUT") {
|
|
9322
9354
|
const identifier = component.ref;
|
|
9323
9355
|
fields.push({
|
|
9324
9356
|
initialValue: "",
|
|
@@ -9549,8 +9581,8 @@ function cleanupUrlParams() {
|
|
|
9549
9581
|
window.history.replaceState({}, "", url.toString());
|
|
9550
9582
|
}
|
|
9551
9583
|
function useOAuthCallback({
|
|
9552
|
-
|
|
9553
|
-
|
|
9584
|
+
currentExecutionId,
|
|
9585
|
+
executionIdStorageKey = "asgardeo_execution_id",
|
|
9554
9586
|
isInitialized,
|
|
9555
9587
|
isSubmitting = false,
|
|
9556
9588
|
onComplete,
|
|
@@ -9559,7 +9591,7 @@ function useOAuthCallback({
|
|
|
9559
9591
|
onProcessingStart,
|
|
9560
9592
|
onSubmit,
|
|
9561
9593
|
processedRef,
|
|
9562
|
-
|
|
9594
|
+
setExecutionId: setExecExecutionId,
|
|
9563
9595
|
tokenValidationAttemptedRef
|
|
9564
9596
|
}) {
|
|
9565
9597
|
const internalRef = (0, import_react71.useRef)(false);
|
|
@@ -9572,7 +9604,7 @@ function useOAuthCallback({
|
|
|
9572
9604
|
const code = urlParams.get("code");
|
|
9573
9605
|
const nonce = urlParams.get("nonce");
|
|
9574
9606
|
const state = urlParams.get("state");
|
|
9575
|
-
const
|
|
9607
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
9576
9608
|
const error = urlParams.get("error");
|
|
9577
9609
|
const errorDescription = urlParams.get("error_description");
|
|
9578
9610
|
if (error) {
|
|
@@ -9590,11 +9622,11 @@ function useOAuthCallback({
|
|
|
9590
9622
|
if (tokenValidationAttemptedRef?.current) {
|
|
9591
9623
|
return;
|
|
9592
9624
|
}
|
|
9593
|
-
const
|
|
9594
|
-
const
|
|
9595
|
-
if (!
|
|
9625
|
+
const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
|
|
9626
|
+
const executionIdToUse = currentExecutionId || storedExecutionId || executionIdFromUrl || state || null;
|
|
9627
|
+
if (!executionIdToUse) {
|
|
9596
9628
|
oauthCodeProcessedRef.current = true;
|
|
9597
|
-
onError?.(new Error("Invalid flow. Missing
|
|
9629
|
+
onError?.(new Error("Invalid flow. Missing executionId."));
|
|
9598
9630
|
cleanupUrlParams();
|
|
9599
9631
|
return;
|
|
9600
9632
|
}
|
|
@@ -9603,13 +9635,13 @@ function useOAuthCallback({
|
|
|
9603
9635
|
tokenValidationAttemptedRef.current = true;
|
|
9604
9636
|
}
|
|
9605
9637
|
onProcessingStart?.();
|
|
9606
|
-
if (!
|
|
9607
|
-
|
|
9638
|
+
if (!currentExecutionId && setExecExecutionId) {
|
|
9639
|
+
setExecExecutionId(executionIdToUse);
|
|
9608
9640
|
}
|
|
9609
9641
|
(async () => {
|
|
9610
9642
|
try {
|
|
9611
9643
|
const payload = {
|
|
9612
|
-
|
|
9644
|
+
executionId: executionIdToUse,
|
|
9613
9645
|
inputs: {
|
|
9614
9646
|
code,
|
|
9615
9647
|
...nonce && { nonce }
|
|
@@ -9631,14 +9663,14 @@ function useOAuthCallback({
|
|
|
9631
9663
|
})();
|
|
9632
9664
|
}, [
|
|
9633
9665
|
isInitialized,
|
|
9634
|
-
|
|
9666
|
+
currentExecutionId,
|
|
9635
9667
|
isSubmitting,
|
|
9636
9668
|
onSubmit,
|
|
9637
9669
|
onComplete,
|
|
9638
9670
|
onError,
|
|
9639
9671
|
onFlowChange,
|
|
9640
|
-
|
|
9641
|
-
|
|
9672
|
+
setExecExecutionId,
|
|
9673
|
+
executionIdStorageKey
|
|
9642
9674
|
]);
|
|
9643
9675
|
}
|
|
9644
9676
|
|
|
@@ -9824,7 +9856,7 @@ var SignIn = ({
|
|
|
9824
9856
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
9825
9857
|
const [components, setComponents] = (0, import_react72.useState)([]);
|
|
9826
9858
|
const [additionalData, setAdditionalData] = (0, import_react72.useState)({});
|
|
9827
|
-
const [
|
|
9859
|
+
const [currentExecutionId, setCurrentExecutionId] = (0, import_react72.useState)(null);
|
|
9828
9860
|
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react72.useState)(false);
|
|
9829
9861
|
const [flowError, setFlowError] = (0, import_react72.useState)(null);
|
|
9830
9862
|
const [isSubmitting, setIsSubmitting] = (0, import_react72.useState)(false);
|
|
@@ -9834,22 +9866,22 @@ var SignIn = ({
|
|
|
9834
9866
|
challenge: null,
|
|
9835
9867
|
creationOptions: null,
|
|
9836
9868
|
error: null,
|
|
9837
|
-
|
|
9869
|
+
executionId: null,
|
|
9838
9870
|
isActive: false
|
|
9839
9871
|
});
|
|
9840
9872
|
const initializationAttemptedRef = (0, import_react72.useRef)(false);
|
|
9841
9873
|
const oauthCodeProcessedRef = (0, import_react72.useRef)(false);
|
|
9842
9874
|
const passkeyProcessedRef = (0, import_react72.useRef)(false);
|
|
9843
|
-
const
|
|
9844
|
-
|
|
9845
|
-
if (
|
|
9846
|
-
sessionStorage.setItem("
|
|
9875
|
+
const setExecutionId = (executionId) => {
|
|
9876
|
+
setCurrentExecutionId(executionId);
|
|
9877
|
+
if (executionId) {
|
|
9878
|
+
sessionStorage.setItem("asgardeo_execution_id", executionId);
|
|
9847
9879
|
} else {
|
|
9848
|
-
sessionStorage.removeItem("
|
|
9880
|
+
sessionStorage.removeItem("asgardeo_execution_id");
|
|
9849
9881
|
}
|
|
9850
9882
|
};
|
|
9851
9883
|
const clearFlowState = () => {
|
|
9852
|
-
|
|
9884
|
+
setExecutionId(null);
|
|
9853
9885
|
setIsFlowInitialized(false);
|
|
9854
9886
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
9855
9887
|
setIsTimeoutDisabled(false);
|
|
@@ -9863,7 +9895,7 @@ var SignIn = ({
|
|
|
9863
9895
|
code: urlParams.get("code"),
|
|
9864
9896
|
error: urlParams.get("error"),
|
|
9865
9897
|
errorDescription: urlParams.get("error_description"),
|
|
9866
|
-
|
|
9898
|
+
executionId: urlParams.get("executionId"),
|
|
9867
9899
|
nonce: urlParams.get("nonce"),
|
|
9868
9900
|
state: urlParams.get("state")
|
|
9869
9901
|
};
|
|
@@ -9888,7 +9920,7 @@ var SignIn = ({
|
|
|
9888
9920
|
const cleanupFlowUrlParams = () => {
|
|
9889
9921
|
if (!window?.location?.href) return;
|
|
9890
9922
|
const url = new URL(window.location.href);
|
|
9891
|
-
url.searchParams.delete("
|
|
9923
|
+
url.searchParams.delete("executionId");
|
|
9892
9924
|
url.searchParams.delete("authId");
|
|
9893
9925
|
url.searchParams.delete("applicationId");
|
|
9894
9926
|
window?.history?.replaceState({}, "", url.toString());
|
|
@@ -9909,8 +9941,8 @@ var SignIn = ({
|
|
|
9909
9941
|
if (response.type === import_browser58.EmbeddedSignInFlowTypeV2.Redirection) {
|
|
9910
9942
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
9911
9943
|
if (redirectURL && window?.location) {
|
|
9912
|
-
if (response.
|
|
9913
|
-
|
|
9944
|
+
if (response.executionId) {
|
|
9945
|
+
setExecutionId(response.executionId);
|
|
9914
9946
|
}
|
|
9915
9947
|
const urlParams = getUrlParams2();
|
|
9916
9948
|
handleAuthId(urlParams.authId);
|
|
@@ -9925,9 +9957,9 @@ var SignIn = ({
|
|
|
9925
9957
|
oauthCodeProcessedRef.current = false;
|
|
9926
9958
|
handleAuthId(urlParams.authId);
|
|
9927
9959
|
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
9928
|
-
if (!urlParams.
|
|
9960
|
+
if (!urlParams.executionId && !effectiveApplicationId) {
|
|
9929
9961
|
const error = new import_browser58.AsgardeoRuntimeError(
|
|
9930
|
-
"Either
|
|
9962
|
+
"Either executionId or applicationId is required for authentication",
|
|
9931
9963
|
"SIGN_IN_ERROR",
|
|
9932
9964
|
"react"
|
|
9933
9965
|
);
|
|
@@ -9937,9 +9969,9 @@ var SignIn = ({
|
|
|
9937
9969
|
try {
|
|
9938
9970
|
setFlowError(null);
|
|
9939
9971
|
let response;
|
|
9940
|
-
if (urlParams.
|
|
9972
|
+
if (urlParams.executionId) {
|
|
9941
9973
|
response = await signIn({
|
|
9942
|
-
|
|
9974
|
+
executionId: urlParams.executionId
|
|
9943
9975
|
});
|
|
9944
9976
|
} else {
|
|
9945
9977
|
response = await signIn({
|
|
@@ -9951,7 +9983,7 @@ var SignIn = ({
|
|
|
9951
9983
|
return;
|
|
9952
9984
|
}
|
|
9953
9985
|
const {
|
|
9954
|
-
|
|
9986
|
+
executionId: normalizedExecutionId,
|
|
9955
9987
|
components: normalizedComponents,
|
|
9956
9988
|
additionalData: normalizedAdditionalData
|
|
9957
9989
|
} = normalizeFlowResponse(
|
|
@@ -9962,8 +9994,8 @@ var SignIn = ({
|
|
|
9962
9994
|
},
|
|
9963
9995
|
meta
|
|
9964
9996
|
);
|
|
9965
|
-
if (
|
|
9966
|
-
|
|
9997
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
9998
|
+
setExecutionId(normalizedExecutionId);
|
|
9967
9999
|
setComponents(normalizedComponents);
|
|
9968
10000
|
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9969
10001
|
setIsFlowInitialized(true);
|
|
@@ -9988,11 +10020,11 @@ var SignIn = ({
|
|
|
9988
10020
|
}, []);
|
|
9989
10021
|
(0, import_react72.useEffect)(() => {
|
|
9990
10022
|
const currentUrlParams = getUrlParams2();
|
|
9991
|
-
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !
|
|
10023
|
+
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !currentExecutionId && !currentUrlParams.code && !currentUrlParams.state && !isSubmitting && !oauthCodeProcessedRef.current) {
|
|
9992
10024
|
initializationAttemptedRef.current = true;
|
|
9993
10025
|
initializeFlow();
|
|
9994
10026
|
}
|
|
9995
|
-
}, [isInitialized, isLoading, isFlowInitialized,
|
|
10027
|
+
}, [isInitialized, isLoading, isFlowInitialized, currentExecutionId]);
|
|
9996
10028
|
(0, import_react72.useEffect)(() => {
|
|
9997
10029
|
const timeoutMs = Number(additionalData?.["stepTimeout"]) || 0;
|
|
9998
10030
|
if (timeoutMs <= 0 || !isFlowInitialized) {
|
|
@@ -10015,8 +10047,8 @@ var SignIn = ({
|
|
|
10015
10047
|
return () => clearTimeout(timerId);
|
|
10016
10048
|
}, [additionalData?.["stepTimeout"], isFlowInitialized, t]);
|
|
10017
10049
|
const handleSubmit = async (payload) => {
|
|
10018
|
-
const
|
|
10019
|
-
if (!
|
|
10050
|
+
const effectiveExecutionId = payload.executionId || currentExecutionId;
|
|
10051
|
+
if (!effectiveExecutionId) {
|
|
10020
10052
|
throw new Error("No active flow ID");
|
|
10021
10053
|
}
|
|
10022
10054
|
const processedInputs = { ...payload.inputs };
|
|
@@ -10073,7 +10105,7 @@ var SignIn = ({
|
|
|
10073
10105
|
setIsSubmitting(true);
|
|
10074
10106
|
setFlowError(null);
|
|
10075
10107
|
const response = await signIn({
|
|
10076
|
-
|
|
10108
|
+
executionId: effectiveExecutionId,
|
|
10077
10109
|
...payload,
|
|
10078
10110
|
inputs: processedInputs
|
|
10079
10111
|
});
|
|
@@ -10082,21 +10114,21 @@ var SignIn = ({
|
|
|
10082
10114
|
}
|
|
10083
10115
|
if (response.data?.additionalData?.["passkeyChallenge"] || response.data?.additionalData?.["passkeyCreationOptions"]) {
|
|
10084
10116
|
const { passkeyChallenge, passkeyCreationOptions } = response.data.additionalData;
|
|
10085
|
-
const
|
|
10117
|
+
const effectiveExecutionIdForPasskey = response.executionId || effectiveExecutionId;
|
|
10086
10118
|
passkeyProcessedRef.current = false;
|
|
10087
10119
|
setPasskeyState({
|
|
10088
10120
|
actionId: "submit",
|
|
10089
10121
|
challenge: passkeyChallenge,
|
|
10090
10122
|
creationOptions: passkeyCreationOptions,
|
|
10091
10123
|
error: null,
|
|
10092
|
-
|
|
10124
|
+
executionId: effectiveExecutionIdForPasskey,
|
|
10093
10125
|
isActive: true
|
|
10094
10126
|
});
|
|
10095
10127
|
setIsSubmitting(false);
|
|
10096
10128
|
return;
|
|
10097
10129
|
}
|
|
10098
10130
|
const {
|
|
10099
|
-
|
|
10131
|
+
executionId: normalizedExecutionId,
|
|
10100
10132
|
components: normalizedComponents,
|
|
10101
10133
|
additionalData: normalizedAdditionalData
|
|
10102
10134
|
} = normalizeFlowResponse(
|
|
@@ -10120,9 +10152,9 @@ var SignIn = ({
|
|
|
10120
10152
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
10121
10153
|
const finalRedirectUrl = redirectUrl || afterSignInUrl;
|
|
10122
10154
|
setIsSubmitting(false);
|
|
10123
|
-
|
|
10155
|
+
setExecutionId(null);
|
|
10124
10156
|
setIsFlowInitialized(false);
|
|
10125
|
-
sessionStorage.removeItem("
|
|
10157
|
+
sessionStorage.removeItem("asgardeo_execution_id");
|
|
10126
10158
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
10127
10159
|
cleanupOAuthUrlParams(true);
|
|
10128
10160
|
if (onSuccess) {
|
|
@@ -10136,8 +10168,8 @@ var SignIn = ({
|
|
|
10136
10168
|
}
|
|
10137
10169
|
return;
|
|
10138
10170
|
}
|
|
10139
|
-
if (
|
|
10140
|
-
|
|
10171
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
10172
|
+
setExecutionId(normalizedExecutionId);
|
|
10141
10173
|
setComponents(normalizedComponents);
|
|
10142
10174
|
setAdditionalData(normalizedAdditionalData ?? {});
|
|
10143
10175
|
setIsTimeoutDisabled(false);
|
|
@@ -10161,19 +10193,19 @@ var SignIn = ({
|
|
|
10161
10193
|
setError(error);
|
|
10162
10194
|
};
|
|
10163
10195
|
useOAuthCallback({
|
|
10164
|
-
|
|
10196
|
+
currentExecutionId,
|
|
10165
10197
|
isInitialized: isInitialized && !isLoading,
|
|
10166
10198
|
isSubmitting,
|
|
10167
10199
|
onError: (err) => {
|
|
10168
10200
|
clearFlowState();
|
|
10169
10201
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
10170
10202
|
},
|
|
10171
|
-
onSubmit: async (payload) => handleSubmit({
|
|
10203
|
+
onSubmit: async (payload) => handleSubmit({ executionId: payload.executionId, inputs: payload.inputs }),
|
|
10172
10204
|
processedRef: oauthCodeProcessedRef,
|
|
10173
|
-
|
|
10205
|
+
setExecutionId
|
|
10174
10206
|
});
|
|
10175
10207
|
(0, import_react72.useEffect)(() => {
|
|
10176
|
-
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.
|
|
10208
|
+
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.executionId) {
|
|
10177
10209
|
return;
|
|
10178
10210
|
}
|
|
10179
10211
|
if (passkeyProcessedRef.current) {
|
|
@@ -10204,7 +10236,7 @@ var SignIn = ({
|
|
|
10204
10236
|
throw new Error("No passkey challenge or creation options available");
|
|
10205
10237
|
}
|
|
10206
10238
|
await handleSubmit({
|
|
10207
|
-
|
|
10239
|
+
executionId: passkeyState.executionId,
|
|
10208
10240
|
inputs
|
|
10209
10241
|
});
|
|
10210
10242
|
};
|
|
@@ -10214,7 +10246,7 @@ var SignIn = ({
|
|
|
10214
10246
|
challenge: null,
|
|
10215
10247
|
creationOptions: null,
|
|
10216
10248
|
error: null,
|
|
10217
|
-
|
|
10249
|
+
executionId: null,
|
|
10218
10250
|
isActive: false
|
|
10219
10251
|
});
|
|
10220
10252
|
}).catch((error) => {
|
|
@@ -10222,7 +10254,7 @@ var SignIn = ({
|
|
|
10222
10254
|
setFlowError(error);
|
|
10223
10255
|
onError?.(error);
|
|
10224
10256
|
});
|
|
10225
|
-
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.
|
|
10257
|
+
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.executionId]);
|
|
10226
10258
|
if (children) {
|
|
10227
10259
|
const renderProps = {
|
|
10228
10260
|
additionalData,
|
|
@@ -11514,7 +11546,7 @@ var BaseSignUpContent2 = ({
|
|
|
11514
11546
|
actionId: null,
|
|
11515
11547
|
creationOptions: null,
|
|
11516
11548
|
error: null,
|
|
11517
|
-
|
|
11549
|
+
executionId: null,
|
|
11518
11550
|
isActive: false
|
|
11519
11551
|
});
|
|
11520
11552
|
const initializationAttemptedRef = (0, import_react75.useRef)(false);
|
|
@@ -11659,7 +11691,7 @@ var BaseSignUpContent2 = ({
|
|
|
11659
11691
|
const { code, state } = event.data;
|
|
11660
11692
|
if (code && state) {
|
|
11661
11693
|
const payload = {
|
|
11662
|
-
...currentFlow.
|
|
11694
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11663
11695
|
action: "",
|
|
11664
11696
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11665
11697
|
inputs: {
|
|
@@ -11712,7 +11744,7 @@ var BaseSignUpContent2 = ({
|
|
|
11712
11744
|
}
|
|
11713
11745
|
if (code && state) {
|
|
11714
11746
|
const payload = {
|
|
11715
|
-
...currentFlow.
|
|
11747
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11716
11748
|
action: "",
|
|
11717
11749
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11718
11750
|
inputs: {
|
|
@@ -11771,7 +11803,7 @@ var BaseSignUpContent2 = ({
|
|
|
11771
11803
|
});
|
|
11772
11804
|
}
|
|
11773
11805
|
const payload = {
|
|
11774
|
-
...currentFlow.
|
|
11806
|
+
...currentFlow.executionId && { executionId: currentFlow.executionId },
|
|
11775
11807
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
11776
11808
|
...component.id && { action: component.id },
|
|
11777
11809
|
inputs: filteredInputs
|
|
@@ -11789,13 +11821,13 @@ var BaseSignUpContent2 = ({
|
|
|
11789
11821
|
}
|
|
11790
11822
|
if (response.data?.additionalData?.["passkeyCreationOptions"]) {
|
|
11791
11823
|
const { passkeyCreationOptions } = response.data.additionalData;
|
|
11792
|
-
const
|
|
11824
|
+
const effectiveExecutionIdForPasskey = response.executionId || currentFlow?.executionId;
|
|
11793
11825
|
passkeyProcessedRef.current = false;
|
|
11794
11826
|
setPasskeyState({
|
|
11795
11827
|
actionId: component.id || "submit",
|
|
11796
11828
|
creationOptions: passkeyCreationOptions,
|
|
11797
11829
|
error: null,
|
|
11798
|
-
|
|
11830
|
+
executionId: effectiveExecutionIdForPasskey,
|
|
11799
11831
|
isActive: true
|
|
11800
11832
|
});
|
|
11801
11833
|
setIsLoading(false);
|
|
@@ -11812,7 +11844,7 @@ var BaseSignUpContent2 = ({
|
|
|
11812
11844
|
}
|
|
11813
11845
|
};
|
|
11814
11846
|
(0, import_react75.useEffect)(() => {
|
|
11815
|
-
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.
|
|
11847
|
+
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {
|
|
11816
11848
|
return;
|
|
11817
11849
|
}
|
|
11818
11850
|
if (passkeyProcessedRef.current) {
|
|
@@ -11829,7 +11861,7 @@ var BaseSignUpContent2 = ({
|
|
|
11829
11861
|
};
|
|
11830
11862
|
const payload = {
|
|
11831
11863
|
actionId: passkeyState.actionId || "submit",
|
|
11832
|
-
|
|
11864
|
+
executionId: passkeyState.executionId,
|
|
11833
11865
|
flowType: currentFlow?.flowType || "REGISTRATION",
|
|
11834
11866
|
inputs
|
|
11835
11867
|
};
|
|
@@ -11844,13 +11876,13 @@ var BaseSignUpContent2 = ({
|
|
|
11844
11876
|
}
|
|
11845
11877
|
};
|
|
11846
11878
|
performPasskeyRegistration().then(() => {
|
|
11847
|
-
setPasskeyState({ actionId: null, creationOptions: null, error: null,
|
|
11879
|
+
setPasskeyState({ actionId: null, creationOptions: null, error: null, executionId: null, isActive: false });
|
|
11848
11880
|
}).catch((error) => {
|
|
11849
11881
|
setPasskeyState((prev) => ({ ...prev, error, isActive: false }));
|
|
11850
11882
|
handleError(error);
|
|
11851
11883
|
onError?.(error);
|
|
11852
11884
|
});
|
|
11853
|
-
}, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.
|
|
11885
|
+
}, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.executionId]);
|
|
11854
11886
|
const containerClasses = (0, import_css47.cx)(
|
|
11855
11887
|
[
|
|
11856
11888
|
(0, import_browser69.withVendorCSSClassPrefix)("signup"),
|
|
@@ -12299,7 +12331,7 @@ var BaseInviteUser = ({
|
|
|
12299
12331
|
const errors = {};
|
|
12300
12332
|
const validateComponents = (comps) => {
|
|
12301
12333
|
comps.forEach((comp) => {
|
|
12302
|
-
if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT") && comp.required && comp.ref) {
|
|
12334
|
+
if ((comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "SELECT" || comp.type === "PHONE_INPUT" || comp.type === "OTP_INPUT") && comp.required && comp.ref) {
|
|
12303
12335
|
const value = formValues[comp.ref];
|
|
12304
12336
|
if (!value || value.trim() === "") {
|
|
12305
12337
|
errors[comp.ref] = `${comp.label || comp.ref} is required`;
|
|
@@ -12341,7 +12373,7 @@ var BaseInviteUser = ({
|
|
|
12341
12373
|
try {
|
|
12342
12374
|
const inputs = data || formValues;
|
|
12343
12375
|
const payload = {
|
|
12344
|
-
|
|
12376
|
+
executionId: currentFlow.executionId,
|
|
12345
12377
|
inputs,
|
|
12346
12378
|
verbose: true
|
|
12347
12379
|
};
|
|
@@ -12472,8 +12504,8 @@ var BaseInviteUser = ({
|
|
|
12472
12504
|
additionalData: currentFlow?.data?.additionalData,
|
|
12473
12505
|
components,
|
|
12474
12506
|
error: apiError,
|
|
12507
|
+
executionId: currentFlow?.executionId,
|
|
12475
12508
|
fieldErrors: formErrors,
|
|
12476
|
-
flowId: currentFlow?.flowId,
|
|
12477
12509
|
handleInputBlur,
|
|
12478
12510
|
handleInputChange,
|
|
12479
12511
|
handleSubmit,
|
|
@@ -12644,7 +12676,7 @@ var BaseAcceptInvite_styles_default = useStyles23;
|
|
|
12644
12676
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
12645
12677
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12646
12678
|
var BaseAcceptInvite = ({
|
|
12647
|
-
|
|
12679
|
+
executionId,
|
|
12648
12680
|
inviteToken,
|
|
12649
12681
|
onSubmit,
|
|
12650
12682
|
onComplete,
|
|
@@ -12711,7 +12743,7 @@ var BaseAcceptInvite = ({
|
|
|
12711
12743
|
[t, children]
|
|
12712
12744
|
);
|
|
12713
12745
|
useOAuthCallback({
|
|
12714
|
-
|
|
12746
|
+
currentExecutionId: executionId ?? null,
|
|
12715
12747
|
isInitialized: true,
|
|
12716
12748
|
onComplete: () => {
|
|
12717
12749
|
setIsValidatingToken(false);
|
|
@@ -12758,7 +12790,7 @@ var BaseAcceptInvite = ({
|
|
|
12758
12790
|
const errors = {};
|
|
12759
12791
|
const validateComponents = (comps) => {
|
|
12760
12792
|
comps.forEach((comp) => {
|
|
12761
|
-
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT") && comp.required && comp.ref) {
|
|
12793
|
+
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) {
|
|
12762
12794
|
const value = formValues[comp.ref];
|
|
12763
12795
|
if (!value || value.trim() === "") {
|
|
12764
12796
|
errors[comp.ref] = t("validations.required.field.error");
|
|
@@ -12796,7 +12828,7 @@ var BaseAcceptInvite = ({
|
|
|
12796
12828
|
try {
|
|
12797
12829
|
const inputs = data || formValues;
|
|
12798
12830
|
const payload = {
|
|
12799
|
-
|
|
12831
|
+
executionId: currentFlow.executionId,
|
|
12800
12832
|
inputs,
|
|
12801
12833
|
verbose: true
|
|
12802
12834
|
};
|
|
@@ -12851,10 +12883,10 @@ var BaseAcceptInvite = ({
|
|
|
12851
12883
|
if (tokenValidationAttemptedRef.current) {
|
|
12852
12884
|
return;
|
|
12853
12885
|
}
|
|
12854
|
-
if (!
|
|
12886
|
+
if (!executionId || !inviteToken) {
|
|
12855
12887
|
setIsValidatingToken(false);
|
|
12856
12888
|
setIsTokenInvalid(true);
|
|
12857
|
-
handleError(new Error("Invalid invite link. Missing
|
|
12889
|
+
handleError(new Error("Invalid invite link. Missing executionId or inviteToken."));
|
|
12858
12890
|
return;
|
|
12859
12891
|
}
|
|
12860
12892
|
tokenValidationAttemptedRef.current = true;
|
|
@@ -12862,11 +12894,11 @@ var BaseAcceptInvite = ({
|
|
|
12862
12894
|
setIsValidatingToken(true);
|
|
12863
12895
|
setApiError(null);
|
|
12864
12896
|
try {
|
|
12865
|
-
if (
|
|
12866
|
-
sessionStorage.setItem("
|
|
12897
|
+
if (executionId) {
|
|
12898
|
+
sessionStorage.setItem("asgardeo_execution_id", executionId);
|
|
12867
12899
|
}
|
|
12868
12900
|
const payload = {
|
|
12869
|
-
|
|
12901
|
+
executionId,
|
|
12870
12902
|
inputs: {
|
|
12871
12903
|
inviteToken
|
|
12872
12904
|
},
|
|
@@ -12888,7 +12920,7 @@ var BaseAcceptInvite = ({
|
|
|
12888
12920
|
setIsValidatingToken(false);
|
|
12889
12921
|
}
|
|
12890
12922
|
})();
|
|
12891
|
-
}, [
|
|
12923
|
+
}, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
12892
12924
|
const extractHeadings = (0, import_react80.useCallback)((components2) => {
|
|
12893
12925
|
let title2;
|
|
12894
12926
|
let subtitle2;
|
|
@@ -12915,8 +12947,8 @@ var BaseAcceptInvite = ({
|
|
|
12915
12947
|
const renderProps = {
|
|
12916
12948
|
components,
|
|
12917
12949
|
error: apiError,
|
|
12950
|
+
executionId,
|
|
12918
12951
|
fieldErrors: formErrors,
|
|
12919
|
-
flowId,
|
|
12920
12952
|
goToSignIn: onGoToSignIn,
|
|
12921
12953
|
handleInputBlur,
|
|
12922
12954
|
handleInputChange,
|
|
@@ -12997,13 +13029,13 @@ var getUrlParams = () => {
|
|
|
12997
13029
|
}
|
|
12998
13030
|
const params = new URLSearchParams(window.location.search);
|
|
12999
13031
|
return {
|
|
13000
|
-
|
|
13032
|
+
executionId: params.get("executionId") || void 0,
|
|
13001
13033
|
inviteToken: params.get("inviteToken") || void 0
|
|
13002
13034
|
};
|
|
13003
13035
|
};
|
|
13004
13036
|
var AcceptInvite = ({
|
|
13005
13037
|
baseUrl,
|
|
13006
|
-
|
|
13038
|
+
executionId: executionIdProp,
|
|
13007
13039
|
inviteToken: inviteTokenProp,
|
|
13008
13040
|
onComplete,
|
|
13009
13041
|
onError,
|
|
@@ -13016,8 +13048,8 @@ var AcceptInvite = ({
|
|
|
13016
13048
|
showTitle = true,
|
|
13017
13049
|
showSubtitle = true
|
|
13018
13050
|
}) => {
|
|
13019
|
-
const {
|
|
13020
|
-
const
|
|
13051
|
+
const { executionId: urlExecutionId, inviteToken: urlInviteToken } = (0, import_react81.useMemo)(() => getUrlParams(), []);
|
|
13052
|
+
const executionId = executionIdProp || urlExecutionId;
|
|
13021
13053
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
13022
13054
|
const apiBaseUrl = (0, import_react81.useMemo)(() => {
|
|
13023
13055
|
if (baseUrl) {
|
|
@@ -13049,7 +13081,7 @@ var AcceptInvite = ({
|
|
|
13049
13081
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
13050
13082
|
BaseAcceptInvite_default,
|
|
13051
13083
|
{
|
|
13052
|
-
|
|
13084
|
+
executionId,
|
|
13053
13085
|
inviteToken,
|
|
13054
13086
|
onSubmit: handleSubmit,
|
|
13055
13087
|
onComplete,
|