@asgardeo/vue 0.2.3 → 0.3.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 +821 -713
- package/dist/cjs/index.js.map +4 -4
- package/dist/composables/v2/useOAuthCallback.d.ts +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +168 -60
- package/dist/index.js.map +4 -4
- package/dist/utils/v2/flowTransformer.d.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { type Ref } from 'vue';
|
|
19
|
+
export interface UseOAuthCallbackOptions {
|
|
20
|
+
/** Current executionId from component state */
|
|
21
|
+
currentExecutionId: Ref<string | null>;
|
|
22
|
+
/** SessionStorage key for executionId (defaults to 'asgardeo_execution_id') */
|
|
23
|
+
executionIdStorageKey?: string;
|
|
24
|
+
/** Whether the component is initialized and ready to process OAuth callback */
|
|
25
|
+
isInitialized: Ref<boolean>;
|
|
26
|
+
/** Whether a submission is currently in progress */
|
|
27
|
+
isSubmitting?: Ref<boolean>;
|
|
28
|
+
/** Callback when OAuth flow completes successfully */
|
|
29
|
+
onComplete?: () => void;
|
|
30
|
+
/** Callback when OAuth flow encounters an error */
|
|
31
|
+
onError?: (error: any) => void;
|
|
32
|
+
/** Callback to handle flow response after submission */
|
|
33
|
+
onFlowChange?: (response: any) => void;
|
|
34
|
+
/** Callback to set loading state at the start of OAuth processing */
|
|
35
|
+
onProcessingStart?: () => void;
|
|
36
|
+
/** Function to submit OAuth code to the server */
|
|
37
|
+
onSubmit: (payload: OAuthCallbackPayload) => Promise<any>;
|
|
38
|
+
/** Mutable flag to track whether OAuth has already been processed */
|
|
39
|
+
processedFlag?: {
|
|
40
|
+
value: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Additional handler for setting state (e.g., setExecutionId) */
|
|
43
|
+
setExecutionId?: (executionId: string) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Mutable flag for token validation tracking.
|
|
46
|
+
* Used in AcceptInvite to coordinate between OAuth callback and token validation.
|
|
47
|
+
*/
|
|
48
|
+
tokenValidationAttemptedFlag?: {
|
|
49
|
+
value: boolean;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface OAuthCallbackPayload {
|
|
53
|
+
/** The execution ID of the active flow step */
|
|
54
|
+
executionId: string;
|
|
55
|
+
/** OAuth callback inputs extracted from the redirect URL */
|
|
56
|
+
inputs: {
|
|
57
|
+
/** The authorization code returned by the OAuth provider */
|
|
58
|
+
code: string;
|
|
59
|
+
/** Optional nonce for OIDC replay protection */
|
|
60
|
+
nonce?: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Processes OAuth callbacks by detecting auth code in URL, resolving executionId, and submitting to server.
|
|
65
|
+
* Used by SignIn, SignUp, and AcceptInvite components.
|
|
66
|
+
*
|
|
67
|
+
* Vue composable equivalent of React's useOAuthCallback hook.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useOAuthCallback({ currentExecutionId, executionIdStorageKey, isInitialized, isSubmitting, onComplete, onError, onFlowChange, onProcessingStart, onSubmit, processedFlag, setExecutionId, tokenValidationAttemptedFlag, }: UseOAuthCallbackOptions): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export { default as useTheme } from './composables/useTheme';
|
|
|
34
34
|
export { default as useUser } from './composables/useUser';
|
|
35
35
|
export { useOAuthCallback } from './composables/useOAuthCallback';
|
|
36
36
|
export type { UseOAuthCallbackOptions, OAuthCallbackPayload } from './composables/useOAuthCallback';
|
|
37
|
+
export { useOAuthCallback as useOAuthCallbackV2 } from './composables/v2/useOAuthCallback';
|
|
38
|
+
export type { UseOAuthCallbackOptions as UseOAuthCallbackOptionsV2, OAuthCallbackPayload as OAuthCallbackPayloadV2, } from './composables/v2/useOAuthCallback';
|
|
37
39
|
export { default as AsgardeoVueClient } from './AsgardeoVueClient';
|
|
38
40
|
export { ASGARDEO_KEY, BRANDING_KEY, FLOW_KEY, FLOW_META_KEY, I18N_KEY, ORGANIZATION_KEY, THEME_KEY, USER_KEY, } from './keys';
|
|
39
41
|
export type { AsgardeoVueConfig } from './models/config';
|
package/dist/index.js
CHANGED
|
@@ -1428,7 +1428,7 @@ var AsgardeoVueClient = class extends AsgardeoBrowserClient {
|
|
|
1428
1428
|
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && arg1.callOnlyOnRedirect === true) {
|
|
1429
1429
|
return void 0;
|
|
1430
1430
|
}
|
|
1431
|
-
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !isEmpty(arg1) && ("
|
|
1431
|
+
if (isV2Platform && typeof arg1 === "object" && arg1 !== null && !isEmpty(arg1) && ("executionId" in arg1 || "applicationId" in arg1)) {
|
|
1432
1432
|
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId");
|
|
1433
1433
|
const authIdFromStorage = sessionStorage.getItem("asgardeo_auth_id");
|
|
1434
1434
|
const authId = authIdFromUrl || authIdFromStorage;
|
|
@@ -1700,7 +1700,7 @@ var AsgardeoProvider = defineComponent8({
|
|
|
1700
1700
|
async function signIn(...args) {
|
|
1701
1701
|
const arg1 = args[0];
|
|
1702
1702
|
const config = buildConfig();
|
|
1703
|
-
const isV2FlowRequest = config.platform === Platform2.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("
|
|
1703
|
+
const isV2FlowRequest = config.platform === Platform2.AsgardeoV2 && typeof arg1 === "object" && arg1 !== null && ("executionId" in arg1 || "applicationId" in arg1);
|
|
1704
1704
|
try {
|
|
1705
1705
|
if (!isV2FlowRequest) {
|
|
1706
1706
|
isUpdatingSession = true;
|
|
@@ -1843,9 +1843,9 @@ var AsgardeoProvider = defineComponent8({
|
|
|
1843
1843
|
if (isV2Platform) {
|
|
1844
1844
|
const urlParams = currentUrl.searchParams;
|
|
1845
1845
|
const code = urlParams.get("code");
|
|
1846
|
-
const
|
|
1847
|
-
const
|
|
1848
|
-
if (code && !
|
|
1846
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
1847
|
+
const storedExecutionId = sessionStorage.getItem("asgardeo_execution_id");
|
|
1848
|
+
if (code && !executionIdFromUrl && !storedExecutionId) {
|
|
1849
1849
|
await signIn();
|
|
1850
1850
|
}
|
|
1851
1851
|
} else {
|
|
@@ -4297,6 +4297,107 @@ function useOAuthCallback({
|
|
|
4297
4297
|
);
|
|
4298
4298
|
}
|
|
4299
4299
|
|
|
4300
|
+
// src/composables/v2/useOAuthCallback.ts
|
|
4301
|
+
import { watch as watch6 } from "vue";
|
|
4302
|
+
function cleanupUrlParams2() {
|
|
4303
|
+
if (typeof window === "undefined") return;
|
|
4304
|
+
const url = new URL(window.location.href);
|
|
4305
|
+
url.searchParams.delete("code");
|
|
4306
|
+
url.searchParams.delete("nonce");
|
|
4307
|
+
url.searchParams.delete("state");
|
|
4308
|
+
url.searchParams.delete("error");
|
|
4309
|
+
url.searchParams.delete("error_description");
|
|
4310
|
+
window.history.replaceState({}, "", url.toString());
|
|
4311
|
+
}
|
|
4312
|
+
function useOAuthCallback2({
|
|
4313
|
+
currentExecutionId,
|
|
4314
|
+
executionIdStorageKey = "asgardeo_execution_id",
|
|
4315
|
+
isInitialized,
|
|
4316
|
+
isSubmitting,
|
|
4317
|
+
onComplete,
|
|
4318
|
+
onError,
|
|
4319
|
+
onFlowChange,
|
|
4320
|
+
onProcessingStart,
|
|
4321
|
+
onSubmit,
|
|
4322
|
+
processedFlag,
|
|
4323
|
+
setExecutionId,
|
|
4324
|
+
tokenValidationAttemptedFlag
|
|
4325
|
+
}) {
|
|
4326
|
+
const internalFlag = { value: false };
|
|
4327
|
+
const oauthCodeProcessedFlag = processedFlag ?? internalFlag;
|
|
4328
|
+
const tokenValidationFlag = tokenValidationAttemptedFlag;
|
|
4329
|
+
watch6(
|
|
4330
|
+
() => [isInitialized.value, currentExecutionId.value, isSubmitting?.value],
|
|
4331
|
+
([initialized, , submitting]) => {
|
|
4332
|
+
if (!initialized || submitting) {
|
|
4333
|
+
return;
|
|
4334
|
+
}
|
|
4335
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
4336
|
+
const code = urlParams.get("code");
|
|
4337
|
+
const nonce = urlParams.get("nonce");
|
|
4338
|
+
const state = urlParams.get("state");
|
|
4339
|
+
const executionIdFromUrl = urlParams.get("executionId");
|
|
4340
|
+
const error = urlParams.get("error");
|
|
4341
|
+
const errorDescription = urlParams.get("error_description");
|
|
4342
|
+
if (error) {
|
|
4343
|
+
oauthCodeProcessedFlag.value = true;
|
|
4344
|
+
if (tokenValidationFlag) {
|
|
4345
|
+
tokenValidationFlag.value = true;
|
|
4346
|
+
}
|
|
4347
|
+
onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
|
|
4348
|
+
cleanupUrlParams2();
|
|
4349
|
+
return;
|
|
4350
|
+
}
|
|
4351
|
+
if (!code || oauthCodeProcessedFlag.value) {
|
|
4352
|
+
return;
|
|
4353
|
+
}
|
|
4354
|
+
if (tokenValidationFlag?.value) {
|
|
4355
|
+
return;
|
|
4356
|
+
}
|
|
4357
|
+
const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
|
|
4358
|
+
const executionIdToUse = currentExecutionId.value || storedExecutionId || executionIdFromUrl || state || null;
|
|
4359
|
+
if (!executionIdToUse) {
|
|
4360
|
+
oauthCodeProcessedFlag.value = true;
|
|
4361
|
+
onError?.(new Error("Invalid flow. Missing executionId."));
|
|
4362
|
+
cleanupUrlParams2();
|
|
4363
|
+
return;
|
|
4364
|
+
}
|
|
4365
|
+
oauthCodeProcessedFlag.value = true;
|
|
4366
|
+
if (tokenValidationFlag) {
|
|
4367
|
+
tokenValidationFlag.value = true;
|
|
4368
|
+
}
|
|
4369
|
+
onProcessingStart?.();
|
|
4370
|
+
if (!currentExecutionId.value && setExecutionId) {
|
|
4371
|
+
setExecutionId(executionIdToUse);
|
|
4372
|
+
}
|
|
4373
|
+
(async () => {
|
|
4374
|
+
try {
|
|
4375
|
+
const payload = {
|
|
4376
|
+
executionId: executionIdToUse,
|
|
4377
|
+
inputs: {
|
|
4378
|
+
code,
|
|
4379
|
+
...nonce && { nonce }
|
|
4380
|
+
}
|
|
4381
|
+
};
|
|
4382
|
+
const response = await onSubmit(payload);
|
|
4383
|
+
onFlowChange?.(response);
|
|
4384
|
+
if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") {
|
|
4385
|
+
onComplete?.();
|
|
4386
|
+
}
|
|
4387
|
+
if (response?.flowStatus === "ERROR" || response?.status === "ERROR") {
|
|
4388
|
+
onError?.(response);
|
|
4389
|
+
}
|
|
4390
|
+
cleanupUrlParams2();
|
|
4391
|
+
} catch (err) {
|
|
4392
|
+
onError?.(err);
|
|
4393
|
+
cleanupUrlParams2();
|
|
4394
|
+
}
|
|
4395
|
+
})();
|
|
4396
|
+
},
|
|
4397
|
+
{ immediate: true }
|
|
4398
|
+
);
|
|
4399
|
+
}
|
|
4400
|
+
|
|
4300
4401
|
// src/components/primitives/Button/Button.ts
|
|
4301
4402
|
import { withVendorCSSClassPrefix } from "@asgardeo/browser";
|
|
4302
4403
|
import { defineComponent as defineComponent9, h as h9 } from "vue";
|
|
@@ -5585,7 +5686,7 @@ import {
|
|
|
5585
5686
|
defineComponent as defineComponent39,
|
|
5586
5687
|
h as h40,
|
|
5587
5688
|
ref as ref14,
|
|
5588
|
-
watch as
|
|
5689
|
+
watch as watch7
|
|
5589
5690
|
} from "vue";
|
|
5590
5691
|
|
|
5591
5692
|
// src/components/presentation/sign-in/v1/options/SignInOptionFactory.ts
|
|
@@ -6412,7 +6513,7 @@ var BaseSignIn = defineComponent39({
|
|
|
6412
6513
|
return currentFlow.value.nextStep.authenticators;
|
|
6413
6514
|
};
|
|
6414
6515
|
let initAttempted = false;
|
|
6415
|
-
|
|
6516
|
+
watch7(
|
|
6416
6517
|
() => props.isLoading,
|
|
6417
6518
|
(loading) => {
|
|
6418
6519
|
if (!loading && !initAttempted && props.onInitialize) {
|
|
@@ -6763,7 +6864,7 @@ import {
|
|
|
6763
6864
|
onMounted as onMounted5,
|
|
6764
6865
|
onUnmounted as onUnmounted2,
|
|
6765
6866
|
ref as ref16,
|
|
6766
|
-
watch as
|
|
6867
|
+
watch as watch9
|
|
6767
6868
|
} from "vue";
|
|
6768
6869
|
|
|
6769
6870
|
// src/components/presentation/sign-in/v2/BaseSignIn.ts
|
|
@@ -6775,7 +6876,7 @@ import {
|
|
|
6775
6876
|
defineComponent as defineComponent41,
|
|
6776
6877
|
h as h43,
|
|
6777
6878
|
ref as ref15,
|
|
6778
|
-
watch as
|
|
6879
|
+
watch as watch8
|
|
6779
6880
|
} from "vue";
|
|
6780
6881
|
|
|
6781
6882
|
// src/components/presentation/sign-in/AuthOptionFactoryCore.ts
|
|
@@ -7256,7 +7357,7 @@ var normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7256
7357
|
return {
|
|
7257
7358
|
additionalData,
|
|
7258
7359
|
components: transformComponents(response, t, resolveTranslations, meta),
|
|
7259
|
-
|
|
7360
|
+
executionId: response.executionId
|
|
7260
7361
|
};
|
|
7261
7362
|
};
|
|
7262
7363
|
|
|
@@ -7314,7 +7415,7 @@ var BaseSignIn2 = defineComponent41({
|
|
|
7314
7415
|
const isLoading = computed6(() => props.isLoading || isSubmitting.value);
|
|
7315
7416
|
const formValues = ref15({});
|
|
7316
7417
|
const touchedFields = ref15({});
|
|
7317
|
-
|
|
7418
|
+
watch8(
|
|
7318
7419
|
() => props.components,
|
|
7319
7420
|
(newComponents) => {
|
|
7320
7421
|
const fields = extractFormFields(newComponents || []);
|
|
@@ -7660,7 +7761,7 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
7660
7761
|
};
|
|
7661
7762
|
|
|
7662
7763
|
// src/components/presentation/sign-in/v2/SignIn.ts
|
|
7663
|
-
var
|
|
7764
|
+
var EXECUTION_ID_STORAGE_KEY = "asgardeo_execution_id";
|
|
7664
7765
|
var AUTH_ID_STORAGE_KEY = "asgardeo_auth_id";
|
|
7665
7766
|
var SignIn2 = defineComponent42({
|
|
7666
7767
|
emits: ["error", "success"],
|
|
@@ -7682,7 +7783,7 @@ var SignIn2 = defineComponent42({
|
|
|
7682
7783
|
const { t } = useI18n_default();
|
|
7683
7784
|
const components = ref16([]);
|
|
7684
7785
|
const additionalData = ref16({});
|
|
7685
|
-
const
|
|
7786
|
+
const currentExecutionId = ref16(null);
|
|
7686
7787
|
const isFlowInitialized = ref16(false);
|
|
7687
7788
|
const flowError = ref16(null);
|
|
7688
7789
|
const isSubmitting = ref16(false);
|
|
@@ -7692,22 +7793,22 @@ var SignIn2 = defineComponent42({
|
|
|
7692
7793
|
challenge: null,
|
|
7693
7794
|
creationOptions: null,
|
|
7694
7795
|
error: null,
|
|
7695
|
-
|
|
7796
|
+
executionId: null,
|
|
7696
7797
|
isActive: false
|
|
7697
7798
|
});
|
|
7698
7799
|
let initializationAttempted = false;
|
|
7699
7800
|
const oauthCodeProcessedFlag = { value: false };
|
|
7700
7801
|
let passkeyProcessed = false;
|
|
7701
|
-
const
|
|
7702
|
-
|
|
7703
|
-
if (
|
|
7704
|
-
sessionStorage.setItem(
|
|
7802
|
+
const persistExecutionId = (executionId) => {
|
|
7803
|
+
currentExecutionId.value = executionId;
|
|
7804
|
+
if (executionId) {
|
|
7805
|
+
sessionStorage.setItem(EXECUTION_ID_STORAGE_KEY, executionId);
|
|
7705
7806
|
} else {
|
|
7706
|
-
sessionStorage.removeItem(
|
|
7807
|
+
sessionStorage.removeItem(EXECUTION_ID_STORAGE_KEY);
|
|
7707
7808
|
}
|
|
7708
7809
|
};
|
|
7709
7810
|
const clearFlowState = () => {
|
|
7710
|
-
|
|
7811
|
+
persistExecutionId(null);
|
|
7711
7812
|
isFlowInitialized.value = false;
|
|
7712
7813
|
sessionStorage.removeItem(AUTH_ID_STORAGE_KEY);
|
|
7713
7814
|
isTimeoutDisabled.value = false;
|
|
@@ -7721,7 +7822,7 @@ var SignIn2 = defineComponent42({
|
|
|
7721
7822
|
code: params.get("code"),
|
|
7722
7823
|
error: params.get("error"),
|
|
7723
7824
|
errorDescription: params.get("error_description"),
|
|
7724
|
-
|
|
7825
|
+
executionId: params.get("executionId"),
|
|
7725
7826
|
nonce: params.get("nonce"),
|
|
7726
7827
|
state: params.get("state")
|
|
7727
7828
|
};
|
|
@@ -7735,7 +7836,7 @@ var SignIn2 = defineComponent42({
|
|
|
7735
7836
|
const cleanupFlowUrlParams = () => {
|
|
7736
7837
|
if (!window?.location?.href) return;
|
|
7737
7838
|
const url = new URL(window.location.href);
|
|
7738
|
-
["
|
|
7839
|
+
["executionId", "authId", "applicationId"].forEach((p) => url.searchParams.delete(p));
|
|
7739
7840
|
window.history.replaceState({}, "", url.toString());
|
|
7740
7841
|
};
|
|
7741
7842
|
const setError = (error) => {
|
|
@@ -7750,9 +7851,9 @@ var SignIn2 = defineComponent42({
|
|
|
7750
7851
|
sessionStorage.setItem(AUTH_ID_STORAGE_KEY, urlParams.authId);
|
|
7751
7852
|
}
|
|
7752
7853
|
const effectiveApplicationId = applicationId || urlParams.applicationId;
|
|
7753
|
-
if (!urlParams.
|
|
7854
|
+
if (!urlParams.executionId && !effectiveApplicationId) {
|
|
7754
7855
|
const err = new AsgardeoRuntimeError8(
|
|
7755
|
-
"Either
|
|
7856
|
+
"Either executionId or applicationId is required for authentication",
|
|
7756
7857
|
"SIGN_IN_ERROR",
|
|
7757
7858
|
"vue"
|
|
7758
7859
|
);
|
|
@@ -7762,8 +7863,8 @@ var SignIn2 = defineComponent42({
|
|
|
7762
7863
|
try {
|
|
7763
7864
|
flowError.value = null;
|
|
7764
7865
|
let response;
|
|
7765
|
-
if (urlParams.
|
|
7766
|
-
response = await signIn({
|
|
7866
|
+
if (urlParams.executionId) {
|
|
7867
|
+
response = await signIn({ executionId: urlParams.executionId });
|
|
7767
7868
|
} else {
|
|
7768
7869
|
response = await signIn({
|
|
7769
7870
|
applicationId: effectiveApplicationId,
|
|
@@ -7773,19 +7874,19 @@ var SignIn2 = defineComponent42({
|
|
|
7773
7874
|
if (response.type === EmbeddedSignInFlowTypeV2.Redirection) {
|
|
7774
7875
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
7775
7876
|
if (redirectURL && window?.location) {
|
|
7776
|
-
if (response.
|
|
7877
|
+
if (response.executionId) persistExecutionId(response.executionId);
|
|
7777
7878
|
if (urlParams.authId) sessionStorage.setItem(AUTH_ID_STORAGE_KEY, urlParams.authId);
|
|
7778
7879
|
initiateOAuthRedirect(redirectURL);
|
|
7779
7880
|
return;
|
|
7780
7881
|
}
|
|
7781
7882
|
}
|
|
7782
7883
|
const {
|
|
7783
|
-
|
|
7884
|
+
executionId: normalizedExecutionId,
|
|
7784
7885
|
components: normalizedComponents,
|
|
7785
7886
|
additionalData: normalizedAdditionalData
|
|
7786
7887
|
} = normalizeFlowResponse(response, t, { resolveTranslations: false }, flowMeta.value);
|
|
7787
|
-
if (
|
|
7788
|
-
|
|
7888
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
7889
|
+
persistExecutionId(normalizedExecutionId);
|
|
7789
7890
|
components.value = normalizedComponents;
|
|
7790
7891
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
7791
7892
|
isFlowInitialized.value = true;
|
|
@@ -7801,8 +7902,8 @@ var SignIn2 = defineComponent42({
|
|
|
7801
7902
|
}
|
|
7802
7903
|
};
|
|
7803
7904
|
const handleSubmit = async (payload) => {
|
|
7804
|
-
const
|
|
7805
|
-
if (!
|
|
7905
|
+
const effectiveExecutionId = payload.executionId || currentExecutionId.value;
|
|
7906
|
+
if (!effectiveExecutionId) {
|
|
7806
7907
|
throw new Error("No active flow ID");
|
|
7807
7908
|
}
|
|
7808
7909
|
const processedInputs = { ...payload.inputs };
|
|
@@ -7847,14 +7948,14 @@ var SignIn2 = defineComponent42({
|
|
|
7847
7948
|
isSubmitting.value = true;
|
|
7848
7949
|
flowError.value = null;
|
|
7849
7950
|
const response = await signIn({
|
|
7850
|
-
|
|
7951
|
+
executionId: effectiveExecutionId,
|
|
7851
7952
|
...payload,
|
|
7852
7953
|
inputs: processedInputs
|
|
7853
7954
|
});
|
|
7854
7955
|
if (response.type === EmbeddedSignInFlowTypeV2.Redirection) {
|
|
7855
7956
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
7856
7957
|
if (redirectURL && window?.location) {
|
|
7857
|
-
if (response.
|
|
7958
|
+
if (response.executionId) persistExecutionId(response.executionId);
|
|
7858
7959
|
const urlParams = getUrlParams2();
|
|
7859
7960
|
if (urlParams.authId) sessionStorage.setItem(AUTH_ID_STORAGE_KEY, urlParams.authId);
|
|
7860
7961
|
initiateOAuthRedirect(redirectURL);
|
|
@@ -7869,14 +7970,14 @@ var SignIn2 = defineComponent42({
|
|
|
7869
7970
|
challenge: passkeyChallenge || null,
|
|
7870
7971
|
creationOptions: passkeyCreationOptions || null,
|
|
7871
7972
|
error: null,
|
|
7872
|
-
|
|
7973
|
+
executionId: response.executionId || effectiveExecutionId,
|
|
7873
7974
|
isActive: true
|
|
7874
7975
|
};
|
|
7875
7976
|
isSubmitting.value = false;
|
|
7876
7977
|
return;
|
|
7877
7978
|
}
|
|
7878
7979
|
const {
|
|
7879
|
-
|
|
7980
|
+
executionId: normalizedExecutionId,
|
|
7880
7981
|
components: normalizedComponents,
|
|
7881
7982
|
additionalData: normalizedAdditionalData
|
|
7882
7983
|
} = normalizeFlowResponse(response, t, { resolveTranslations: false }, flowMeta.value);
|
|
@@ -7892,7 +7993,7 @@ var SignIn2 = defineComponent42({
|
|
|
7892
7993
|
const redirectUrl = response?.redirectUrl || response?.redirect_uri;
|
|
7893
7994
|
const finalRedirectUrl = redirectUrl || afterSignInUrl;
|
|
7894
7995
|
isSubmitting.value = false;
|
|
7895
|
-
|
|
7996
|
+
persistExecutionId(null);
|
|
7896
7997
|
isFlowInitialized.value = false;
|
|
7897
7998
|
sessionStorage.removeItem(AUTH_ID_STORAGE_KEY);
|
|
7898
7999
|
cleanupOAuthUrlParams();
|
|
@@ -7905,8 +8006,8 @@ var SignIn2 = defineComponent42({
|
|
|
7905
8006
|
}
|
|
7906
8007
|
return;
|
|
7907
8008
|
}
|
|
7908
|
-
if (
|
|
7909
|
-
|
|
8009
|
+
if (normalizedExecutionId && normalizedComponents) {
|
|
8010
|
+
persistExecutionId(normalizedExecutionId);
|
|
7910
8011
|
components.value = normalizedComponents;
|
|
7911
8012
|
additionalData.value = normalizedAdditionalData ?? {};
|
|
7912
8013
|
isTimeoutDisabled.value = false;
|
|
@@ -7946,7 +8047,7 @@ var SignIn2 = defineComponent42({
|
|
|
7946
8047
|
setError(new Error(t("errors.signin.timeout") || "Time allowed to complete the step has expired."));
|
|
7947
8048
|
}, remaining * 1e3);
|
|
7948
8049
|
};
|
|
7949
|
-
|
|
8050
|
+
watch9(
|
|
7950
8051
|
() => [additionalData.value?.["stepTimeout"], isFlowInitialized.value],
|
|
7951
8052
|
([timeoutMs]) => {
|
|
7952
8053
|
scheduleTimeout(Number(timeoutMs) || 0);
|
|
@@ -7955,10 +8056,10 @@ var SignIn2 = defineComponent42({
|
|
|
7955
8056
|
onUnmounted2(() => {
|
|
7956
8057
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
7957
8058
|
});
|
|
7958
|
-
|
|
8059
|
+
watch9(
|
|
7959
8060
|
() => passkeyState.value,
|
|
7960
8061
|
async (state) => {
|
|
7961
|
-
if (!state.isActive || !state.challenge && !state.creationOptions || !state.
|
|
8062
|
+
if (!state.isActive || !state.challenge && !state.creationOptions || !state.executionId) return;
|
|
7962
8063
|
if (passkeyProcessed) return;
|
|
7963
8064
|
passkeyProcessed = true;
|
|
7964
8065
|
try {
|
|
@@ -7984,13 +8085,13 @@ var SignIn2 = defineComponent42({
|
|
|
7984
8085
|
} else {
|
|
7985
8086
|
throw new Error("No passkey challenge or creation options available");
|
|
7986
8087
|
}
|
|
7987
|
-
await handleSubmit({
|
|
8088
|
+
await handleSubmit({ executionId: state.executionId, inputs });
|
|
7988
8089
|
passkeyState.value = {
|
|
7989
8090
|
actionId: null,
|
|
7990
8091
|
challenge: null,
|
|
7991
8092
|
creationOptions: null,
|
|
7992
8093
|
error: null,
|
|
7993
|
-
|
|
8094
|
+
executionId: null,
|
|
7994
8095
|
isActive: false
|
|
7995
8096
|
};
|
|
7996
8097
|
} catch (error) {
|
|
@@ -8002,9 +8103,9 @@ var SignIn2 = defineComponent42({
|
|
|
8002
8103
|
},
|
|
8003
8104
|
{ deep: true }
|
|
8004
8105
|
);
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8106
|
+
useOAuthCallback2({
|
|
8107
|
+
currentExecutionId,
|
|
8108
|
+
executionIdStorageKey: EXECUTION_ID_STORAGE_KEY,
|
|
8008
8109
|
isInitialized,
|
|
8009
8110
|
isSubmitting,
|
|
8010
8111
|
onError: (err) => {
|
|
@@ -8013,9 +8114,9 @@ var SignIn2 = defineComponent42({
|
|
|
8013
8114
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
8014
8115
|
}
|
|
8015
8116
|
},
|
|
8016
|
-
onSubmit: (payload) => handleSubmit({
|
|
8117
|
+
onSubmit: (payload) => handleSubmit({ executionId: payload.executionId, inputs: payload.inputs }),
|
|
8017
8118
|
processedFlag: oauthCodeProcessedFlag,
|
|
8018
|
-
|
|
8119
|
+
setExecutionId: persistExecutionId
|
|
8019
8120
|
});
|
|
8020
8121
|
onMounted5(() => {
|
|
8021
8122
|
const urlParams = getUrlParams2();
|
|
@@ -8023,13 +8124,19 @@ var SignIn2 = defineComponent42({
|
|
|
8023
8124
|
sessionStorage.setItem(AUTH_ID_STORAGE_KEY, urlParams.authId);
|
|
8024
8125
|
}
|
|
8025
8126
|
});
|
|
8026
|
-
|
|
8027
|
-
() => [
|
|
8028
|
-
|
|
8127
|
+
watch9(
|
|
8128
|
+
() => [
|
|
8129
|
+
isInitialized.value,
|
|
8130
|
+
sdkLoading.value,
|
|
8131
|
+
isFlowInitialized.value,
|
|
8132
|
+
currentExecutionId.value,
|
|
8133
|
+
isSubmitting.value
|
|
8134
|
+
],
|
|
8135
|
+
([initialized, loading, flowInit, executionId, submitting]) => {
|
|
8029
8136
|
const urlParams = getUrlParams2();
|
|
8030
8137
|
const hasOAuthCode = !!urlParams.code;
|
|
8031
8138
|
const hasOAuthState = !!urlParams.state;
|
|
8032
|
-
if (initialized && !loading && !flowInit && !initializationAttempted && !
|
|
8139
|
+
if (initialized && !loading && !flowInit && !initializationAttempted && !executionId && !hasOAuthCode && !hasOAuthState && !submitting && !oauthCodeProcessedFlag.value) {
|
|
8033
8140
|
initializationAttempted = true;
|
|
8034
8141
|
initializeFlow();
|
|
8035
8142
|
}
|
|
@@ -8154,7 +8261,7 @@ import {
|
|
|
8154
8261
|
defineComponent as defineComponent45,
|
|
8155
8262
|
h as h47,
|
|
8156
8263
|
ref as ref17,
|
|
8157
|
-
watch as
|
|
8264
|
+
watch as watch10
|
|
8158
8265
|
} from "vue";
|
|
8159
8266
|
|
|
8160
8267
|
// src/utils/v2/getAuthComponentHeadings.ts
|
|
@@ -8508,7 +8615,7 @@ var BaseSignUp = defineComponent45({
|
|
|
8508
8615
|
isLoading.value = false;
|
|
8509
8616
|
}
|
|
8510
8617
|
};
|
|
8511
|
-
|
|
8618
|
+
watch10(
|
|
8512
8619
|
() => passkeyState.value,
|
|
8513
8620
|
async (state) => {
|
|
8514
8621
|
if (!state.isActive || !state.creationOptions || !state.flowId) return;
|
|
@@ -8546,7 +8653,7 @@ var BaseSignUp = defineComponent45({
|
|
|
8546
8653
|
},
|
|
8547
8654
|
{ deep: true }
|
|
8548
8655
|
);
|
|
8549
|
-
|
|
8656
|
+
watch10(
|
|
8550
8657
|
() => [props.isInitialized, isFlowInitialized.value],
|
|
8551
8658
|
([initialized, flowInit]) => {
|
|
8552
8659
|
const urlParams = new URL(window.location.href).searchParams;
|
|
@@ -9181,7 +9288,7 @@ import {
|
|
|
9181
9288
|
defineComponent as defineComponent51,
|
|
9182
9289
|
h as h53,
|
|
9183
9290
|
ref as ref21,
|
|
9184
|
-
watch as
|
|
9291
|
+
watch as watch11
|
|
9185
9292
|
} from "vue";
|
|
9186
9293
|
var BaseAcceptInvite = defineComponent51({
|
|
9187
9294
|
name: "BaseAcceptInvite",
|
|
@@ -9358,7 +9465,7 @@ var BaseAcceptInvite = defineComponent51({
|
|
|
9358
9465
|
isLoading.value = false;
|
|
9359
9466
|
}
|
|
9360
9467
|
};
|
|
9361
|
-
|
|
9468
|
+
watch11(
|
|
9362
9469
|
() => [props.flowId, props.inviteToken],
|
|
9363
9470
|
([flowId, inviteToken]) => {
|
|
9364
9471
|
if (tokenValidationAttempted) return;
|
|
@@ -9618,7 +9725,7 @@ import {
|
|
|
9618
9725
|
defineComponent as defineComponent53,
|
|
9619
9726
|
h as h55,
|
|
9620
9727
|
ref as ref22,
|
|
9621
|
-
watch as
|
|
9728
|
+
watch as watch12
|
|
9622
9729
|
} from "vue";
|
|
9623
9730
|
var BaseInviteUser = defineComponent53({
|
|
9624
9731
|
name: "BaseInviteUser",
|
|
@@ -9794,7 +9901,7 @@ var BaseInviteUser = defineComponent53({
|
|
|
9794
9901
|
emailSent.value = false;
|
|
9795
9902
|
initializationAttempted = false;
|
|
9796
9903
|
};
|
|
9797
|
-
|
|
9904
|
+
watch12(
|
|
9798
9905
|
() => [props.isInitialized, isFlowInitialized.value],
|
|
9799
9906
|
([initialized, flowInit]) => {
|
|
9800
9907
|
if (initialized && !flowInit && !initializationAttempted) {
|
|
@@ -11065,6 +11172,7 @@ export {
|
|
|
11065
11172
|
useFlowMeta_default as useFlowMeta,
|
|
11066
11173
|
useI18n_default as useI18n,
|
|
11067
11174
|
useOAuthCallback,
|
|
11175
|
+
useOAuthCallback2 as useOAuthCallbackV2,
|
|
11068
11176
|
useOrganization_default as useOrganization,
|
|
11069
11177
|
useTheme_default as useTheme,
|
|
11070
11178
|
useUser_default as useUser,
|