@thunderid/vue 0.2.0 → 0.3.3
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/ThunderIDVueClient.d.ts +2 -3
- package/dist/ThunderIDVueClient.d.ts.map +1 -1
- package/dist/cjs/index.cjs +239 -1872
- package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts +1 -1
- package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts.map +1 -1
- package/dist/components/auth/sign-in/BaseSignIn.d.ts +60 -5
- package/dist/components/auth/sign-in/BaseSignIn.d.ts.map +1 -1
- package/dist/components/auth/sign-in/SignIn.d.ts +33 -5
- package/dist/components/auth/sign-in/SignIn.d.ts.map +1 -1
- package/dist/components/auth/sign-up/BaseSignUp.d.ts +49 -10
- package/dist/components/auth/sign-up/BaseSignUp.d.ts.map +1 -1
- package/dist/components/auth/sign-up/SignUp.d.ts +3 -6
- package/dist/components/auth/sign-up/SignUp.d.ts.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -1807
- package/dist/models/contexts.d.ts +1 -2
- package/dist/models/contexts.d.ts.map +1 -1
- package/dist/providers/ThunderIDProvider.d.ts.map +1 -1
- package/dist/utils/buildThemeConfigFromFlowMeta.d.ts.map +1 -0
- package/dist/utils/{v2/flowTransformer.d.ts → flowTransformer.d.ts} +2 -2
- package/dist/utils/flowTransformer.d.ts.map +1 -0
- package/dist/utils/{v2/getAuthComponentHeadings.d.ts → getAuthComponentHeadings.d.ts} +1 -1
- package/dist/utils/getAuthComponentHeadings.d.ts.map +1 -0
- package/dist/utils/passkey.d.ts.map +1 -0
- package/dist/utils/resolveTranslationsInArray.d.ts.map +1 -0
- package/dist/utils/resolveTranslationsInObject.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/components/auth/sign-in/v1/BaseSignIn.d.ts +0 -27
- package/dist/components/auth/sign-in/v1/BaseSignIn.d.ts.map +0 -1
- package/dist/components/auth/sign-in/v1/SignIn.d.ts +0 -27
- package/dist/components/auth/sign-in/v1/SignIn.d.ts.map +0 -1
- package/dist/components/auth/sign-in/v1/options/SignInOptionFactory.d.ts +0 -47
- package/dist/components/auth/sign-in/v1/options/SignInOptionFactory.d.ts.map +0 -1
- package/dist/components/auth/sign-in/v2/AuthOptionFactory.d.ts +0 -19
- package/dist/components/auth/sign-in/v2/AuthOptionFactory.d.ts.map +0 -1
- package/dist/components/auth/sign-in/v2/BaseSignIn.d.ts +0 -83
- package/dist/components/auth/sign-in/v2/BaseSignIn.d.ts.map +0 -1
- package/dist/components/auth/sign-in/v2/SignIn.d.ts +0 -56
- package/dist/components/auth/sign-in/v2/SignIn.d.ts.map +0 -1
- package/dist/components/auth/sign-up/v1/BaseSignUp.d.ts +0 -49
- package/dist/components/auth/sign-up/v1/BaseSignUp.d.ts.map +0 -1
- package/dist/components/auth/sign-up/v1/SignUp.d.ts +0 -31
- package/dist/components/auth/sign-up/v1/SignUp.d.ts.map +0 -1
- package/dist/components/auth/sign-up/v1/options/SignUpOptionFactory.d.ts +0 -50
- package/dist/components/auth/sign-up/v1/options/SignUpOptionFactory.d.ts.map +0 -1
- package/dist/components/auth/sign-up/v2/BaseSignUp.d.ts +0 -73
- package/dist/components/auth/sign-up/v2/BaseSignUp.d.ts.map +0 -1
- package/dist/components/auth/sign-up/v2/SignUp.d.ts +0 -26
- package/dist/components/auth/sign-up/v2/SignUp.d.ts.map +0 -1
- package/dist/composables/v2/useOAuthCallback.d.ts +0 -70
- package/dist/composables/v2/useOAuthCallback.d.ts.map +0 -1
- package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts.map +0 -1
- package/dist/utils/v2/flowTransformer.d.ts.map +0 -1
- package/dist/utils/v2/getAuthComponentHeadings.d.ts.map +0 -1
- package/dist/utils/v2/passkey.d.ts.map +0 -1
- package/dist/utils/v2/resolveTranslationsInArray.d.ts.map +0 -1
- package/dist/utils/v2/resolveTranslationsInObject.d.ts.map +0 -1
- /package/dist/utils/{v2/buildThemeConfigFromFlowMeta.d.ts → buildThemeConfigFromFlowMeta.d.ts} +0 -0
- /package/dist/utils/{v2/passkey.d.ts → passkey.d.ts} +0 -0
- /package/dist/utils/{v2/resolveTranslationsInArray.d.ts → resolveTranslationsInArray.d.ts} +0 -0
- /package/dist/utils/{v2/resolveTranslationsInObject.d.ts → resolveTranslationsInObject.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, WellKnownSchemaIds, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, deriveOrganizationHandleFromBaseUrl, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, flattenUserSchema, generateFlattenedUserProfile, generateUserProfile, get, getActiveTheme, getAllOrganizations, getDefaultI18nBundles, getFlowMeta, getMeOrganizations, getSchemas, getScim2Me, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeTranslations, resolveFlowTemplateLiterals, transformBrandingPreferenceToTheme, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
2
2
|
import { Fragment, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, watch } from "vue";
|
|
3
3
|
import DOMPurify from "dompurify";
|
|
4
4
|
|
|
@@ -138,7 +138,7 @@ const FlowMetaProvider = defineComponent({
|
|
|
138
138
|
isLoading.value = true;
|
|
139
139
|
error.value = null;
|
|
140
140
|
try {
|
|
141
|
-
meta.value = await
|
|
141
|
+
meta.value = await getFlowMeta({
|
|
142
142
|
baseUrl,
|
|
143
143
|
...applicationId ? {
|
|
144
144
|
id: applicationId,
|
|
@@ -156,7 +156,7 @@ const FlowMetaProvider = defineComponent({
|
|
|
156
156
|
isLoading.value = true;
|
|
157
157
|
error.value = null;
|
|
158
158
|
try {
|
|
159
|
-
const result = await
|
|
159
|
+
const result = await getFlowMeta({
|
|
160
160
|
baseUrl,
|
|
161
161
|
...applicationId ? {
|
|
162
162
|
id: applicationId,
|
|
@@ -348,7 +348,7 @@ const PACKAGE_NAME = "@thunderid/vue";
|
|
|
348
348
|
* Package-level logger for `@thunderid/vue`.
|
|
349
349
|
* Use this when logging is not tied to a specific component.
|
|
350
350
|
*/
|
|
351
|
-
const logger$
|
|
351
|
+
const logger$6 = createPackageLogger(PACKAGE_NAME);
|
|
352
352
|
/**
|
|
353
353
|
* Creates a component-scoped logger prefixed with `@thunderid/vue - <component>`.
|
|
354
354
|
*
|
|
@@ -358,7 +358,7 @@ const createVueLogger = (component) => createPackageComponentLogger(PACKAGE_NAME
|
|
|
358
358
|
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/providers/I18nProvider.ts
|
|
361
|
-
const logger$
|
|
361
|
+
const logger$5 = createVueLogger("I18nProvider");
|
|
362
362
|
const DEFAULT_STORAGE_KEY = "thunderid-i18n-language";
|
|
363
363
|
const DEFAULT_URL_PARAM = "lang";
|
|
364
364
|
const deriveRootDomain = (hostname) => {
|
|
@@ -399,7 +399,7 @@ const createStorageAdapter = (strategy, key, cookieDomain) => {
|
|
|
399
399
|
try {
|
|
400
400
|
window.localStorage.setItem(key, language);
|
|
401
401
|
} catch {
|
|
402
|
-
logger$
|
|
402
|
+
logger$5.warn("Failed to persist language preference to localStorage.");
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
};
|
|
@@ -521,7 +521,7 @@ const I18nProvider = defineComponent({
|
|
|
521
521
|
};
|
|
522
522
|
const setLanguage = (language) => {
|
|
523
523
|
if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
|
|
524
|
-
else logger$
|
|
524
|
+
else logger$5.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
|
|
525
525
|
};
|
|
526
526
|
provide(I18N_KEY, {
|
|
527
527
|
bundles: readonly(mergedBundlesComputed),
|
|
@@ -611,7 +611,7 @@ var OrganizationProvider_default = OrganizationProvider;
|
|
|
611
611
|
|
|
612
612
|
//#endregion
|
|
613
613
|
//#region src/providers/ThemeProvider.ts
|
|
614
|
-
const logger$
|
|
614
|
+
const logger$4 = createVueLogger("ThemeProvider");
|
|
615
615
|
const ThemeProvider = defineComponent({
|
|
616
616
|
name: "ThemeProvider",
|
|
617
617
|
props: {
|
|
@@ -645,7 +645,7 @@ const ThemeProvider = defineComponent({
|
|
|
645
645
|
if (props.mode === "branding") colorScheme.value = brandingActiveTheme;
|
|
646
646
|
else if (props.mode === "system" && !brandingContext?.isLoading.value) colorScheme.value = brandingActiveTheme;
|
|
647
647
|
});
|
|
648
|
-
if (props.inheritFromBranding && !brandingContext) logger$
|
|
648
|
+
if (props.inheritFromBranding && !brandingContext) logger$4.warn("ThemeProvider: inheritFromBranding is enabled but BrandingProvider is not available. Make sure to wrap your app with BrandingProvider or ThunderIDProvider.");
|
|
649
649
|
const finalThemeConfig = computed(() => {
|
|
650
650
|
const themeConfig = props.theme;
|
|
651
651
|
const brandingTheme = props.inheritFromBranding ? brandingContext?.theme.value : null;
|
|
@@ -1046,13 +1046,13 @@ var ThunderIDVueClient = class extends ThunderIDBrowserClient {
|
|
|
1046
1046
|
const configData = await this.getStorageManager().getConfigData();
|
|
1047
1047
|
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId");
|
|
1048
1048
|
const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId");
|
|
1049
|
-
const response = await
|
|
1049
|
+
const response = await executeEmbeddedSignInFlow({
|
|
1050
1050
|
authId: authIdFromUrl || authIdFromStorage || "",
|
|
1051
1051
|
baseUrl: configData?.baseUrl || "",
|
|
1052
1052
|
payload: arg1,
|
|
1053
1053
|
url: arg2?.url
|
|
1054
1054
|
});
|
|
1055
|
-
if (response && typeof response === "object" && response.flowStatus ===
|
|
1055
|
+
if (response && typeof response === "object" && response.flowStatus === EmbeddedSignInFlowStatus$1.Complete && response.assertion) {
|
|
1056
1056
|
const decodedAssertion = await this.decodeJwtToken(response.assertion);
|
|
1057
1057
|
const createdAt = decodedAssertion.iat ? decodedAssertion.iat * 1e3 : Date.now();
|
|
1058
1058
|
const expiresIn = decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;
|
|
@@ -1082,7 +1082,7 @@ var ThunderIDVueClient = class extends ThunderIDBrowserClient {
|
|
|
1082
1082
|
const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId");
|
|
1083
1083
|
const authId = authIdFromUrl || authIdFromStorage || "";
|
|
1084
1084
|
if (authIdFromUrl && !authIdFromStorage) await this.getStorageManager().setHybridDataParameter("authId", authIdFromUrl);
|
|
1085
|
-
const response = await
|
|
1085
|
+
const response = await executeEmbeddedSignUpFlow({
|
|
1086
1086
|
authId,
|
|
1087
1087
|
baseUrl,
|
|
1088
1088
|
payload: typeof firstArg === "object" && "flowType" in firstArg ? {
|
|
@@ -1090,7 +1090,7 @@ var ThunderIDVueClient = class extends ThunderIDBrowserClient {
|
|
|
1090
1090
|
verbose: true
|
|
1091
1091
|
} : firstArg
|
|
1092
1092
|
});
|
|
1093
|
-
if (response && typeof response === "object" && response.flowStatus ===
|
|
1093
|
+
if (response && typeof response === "object" && response.flowStatus === EmbeddedSignUpFlowStatus$1.Complete && response.assertion) {
|
|
1094
1094
|
const decodedAssertion = await this.decodeJwtToken(response.assertion);
|
|
1095
1095
|
const createdAt = decodedAssertion.iat ? decodedAssertion.iat * 1e3 : Date.now();
|
|
1096
1096
|
const expiresIn = decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;
|
|
@@ -1188,10 +1188,6 @@ const ThunderIDProvider = defineComponent({
|
|
|
1188
1188
|
default: void 0,
|
|
1189
1189
|
type: String
|
|
1190
1190
|
},
|
|
1191
|
-
platform: {
|
|
1192
|
-
default: void 0,
|
|
1193
|
-
type: String
|
|
1194
|
-
},
|
|
1195
1191
|
scopes: {
|
|
1196
1192
|
default: void 0,
|
|
1197
1193
|
type: [Array, String]
|
|
@@ -1344,7 +1340,6 @@ const ThunderIDProvider = defineComponent({
|
|
|
1344
1340
|
isSignedIn,
|
|
1345
1341
|
organization: currentOrganization,
|
|
1346
1342
|
organizationHandle: props.organizationHandle,
|
|
1347
|
-
platform: Platform.ThunderID,
|
|
1348
1343
|
reInitialize: async (config) => {
|
|
1349
1344
|
const result = await client.reInitialize(config);
|
|
1350
1345
|
return typeof result === "boolean" ? result : true;
|
|
@@ -4836,7 +4831,7 @@ var useUser_default = useUser;
|
|
|
4836
4831
|
|
|
4837
4832
|
//#endregion
|
|
4838
4833
|
//#region src/composables/useOAuthCallback.ts
|
|
4839
|
-
function cleanupUrlParams
|
|
4834
|
+
function cleanupUrlParams() {
|
|
4840
4835
|
if (typeof window === "undefined") return;
|
|
4841
4836
|
const url = new URL(window.location.href);
|
|
4842
4837
|
url.searchParams.delete("code");
|
|
@@ -4872,7 +4867,7 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
|
|
|
4872
4867
|
oauthCodeProcessedFlag.value = true;
|
|
4873
4868
|
if (tokenValidationFlag) tokenValidationFlag.value = true;
|
|
4874
4869
|
onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
|
|
4875
|
-
cleanupUrlParams
|
|
4870
|
+
cleanupUrlParams();
|
|
4876
4871
|
return;
|
|
4877
4872
|
}
|
|
4878
4873
|
if (!code || oauthCodeProcessedFlag.value) return;
|
|
@@ -4882,7 +4877,7 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
|
|
|
4882
4877
|
if (!flowIdToUse) {
|
|
4883
4878
|
oauthCodeProcessedFlag.value = true;
|
|
4884
4879
|
onError?.(/* @__PURE__ */ new Error("Invalid flow. Missing flowId."));
|
|
4885
|
-
cleanupUrlParams
|
|
4880
|
+
cleanupUrlParams();
|
|
4886
4881
|
return;
|
|
4887
4882
|
}
|
|
4888
4883
|
oauthCodeProcessedFlag.value = true;
|
|
@@ -4901,88 +4896,6 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
|
|
|
4901
4896
|
onFlowChange?.(response);
|
|
4902
4897
|
if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") onComplete?.();
|
|
4903
4898
|
if (response?.flowStatus === "ERROR" || response?.status === "ERROR") onError?.(response);
|
|
4904
|
-
cleanupUrlParams$1();
|
|
4905
|
-
} catch (err) {
|
|
4906
|
-
onError?.(err);
|
|
4907
|
-
cleanupUrlParams$1();
|
|
4908
|
-
}
|
|
4909
|
-
})();
|
|
4910
|
-
}, { immediate: true });
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
//#endregion
|
|
4914
|
-
//#region src/composables/v2/useOAuthCallback.ts
|
|
4915
|
-
/**
|
|
4916
|
-
* Removes OAuth-related query parameters from the current URL without triggering a navigation.
|
|
4917
|
-
* This prevents re-processing the callback on subsequent renders or page interactions.
|
|
4918
|
-
*/
|
|
4919
|
-
function cleanupUrlParams() {
|
|
4920
|
-
if (typeof window === "undefined") return;
|
|
4921
|
-
const url = new URL(window.location.href);
|
|
4922
|
-
url.searchParams.delete("code");
|
|
4923
|
-
url.searchParams.delete("nonce");
|
|
4924
|
-
url.searchParams.delete("state");
|
|
4925
|
-
url.searchParams.delete("error");
|
|
4926
|
-
url.searchParams.delete("error_description");
|
|
4927
|
-
window.history.replaceState({}, "", url.toString());
|
|
4928
|
-
}
|
|
4929
|
-
/**
|
|
4930
|
-
* Processes OAuth callbacks by detecting auth code in URL, resolving executionId, and submitting to server.
|
|
4931
|
-
* Used by SignIn, SignUp, and AcceptInvite components.
|
|
4932
|
-
*
|
|
4933
|
-
* Vue composable equivalent of React's useOAuthCallback hook.
|
|
4934
|
-
*/
|
|
4935
|
-
function useOAuthCallback$1({ currentExecutionId, executionIdStorageKey = "thunderid_execution_id", isInitialized, isSubmitting, onComplete, onError, onFlowChange, onProcessingStart, onSubmit, processedFlag, setExecutionId, tokenValidationAttemptedFlag }) {
|
|
4936
|
-
/** Ensures OAuth code is submitted only once, even across reactive re-evaluations */
|
|
4937
|
-
const oauthCodeProcessedFlag = processedFlag ?? { value: false };
|
|
4938
|
-
/** Tracks whether token validation has been attempted; used to coordinate with AcceptInvite */
|
|
4939
|
-
const tokenValidationFlag = tokenValidationAttemptedFlag;
|
|
4940
|
-
watch(() => [
|
|
4941
|
-
isInitialized.value,
|
|
4942
|
-
currentExecutionId.value,
|
|
4943
|
-
isSubmitting?.value
|
|
4944
|
-
], ([initialized, , submitting]) => {
|
|
4945
|
-
if (!initialized || submitting) return;
|
|
4946
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
4947
|
-
const code = urlParams.get("code");
|
|
4948
|
-
const nonce = urlParams.get("nonce");
|
|
4949
|
-
const state = urlParams.get("state");
|
|
4950
|
-
const executionIdFromUrl = urlParams.get("executionId");
|
|
4951
|
-
const error = urlParams.get("error");
|
|
4952
|
-
const errorDescription = urlParams.get("error_description");
|
|
4953
|
-
if (error) {
|
|
4954
|
-
oauthCodeProcessedFlag.value = true;
|
|
4955
|
-
if (tokenValidationFlag) tokenValidationFlag.value = true;
|
|
4956
|
-
onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
|
|
4957
|
-
cleanupUrlParams();
|
|
4958
|
-
return;
|
|
4959
|
-
}
|
|
4960
|
-
if (!code || oauthCodeProcessedFlag.value) return;
|
|
4961
|
-
if (tokenValidationFlag?.value) return;
|
|
4962
|
-
const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
|
|
4963
|
-
const executionIdToUse = currentExecutionId.value || storedExecutionId || executionIdFromUrl || state || null;
|
|
4964
|
-
if (!executionIdToUse) {
|
|
4965
|
-
oauthCodeProcessedFlag.value = true;
|
|
4966
|
-
onError?.(/* @__PURE__ */ new Error("Invalid flow. Missing executionId."));
|
|
4967
|
-
cleanupUrlParams();
|
|
4968
|
-
return;
|
|
4969
|
-
}
|
|
4970
|
-
oauthCodeProcessedFlag.value = true;
|
|
4971
|
-
if (tokenValidationFlag) tokenValidationFlag.value = true;
|
|
4972
|
-
onProcessingStart?.();
|
|
4973
|
-
if (!currentExecutionId.value && setExecutionId) setExecutionId(executionIdToUse);
|
|
4974
|
-
(async () => {
|
|
4975
|
-
try {
|
|
4976
|
-
const response = await onSubmit({
|
|
4977
|
-
executionId: executionIdToUse,
|
|
4978
|
-
inputs: {
|
|
4979
|
-
code,
|
|
4980
|
-
...nonce && { nonce }
|
|
4981
|
-
}
|
|
4982
|
-
});
|
|
4983
|
-
onFlowChange?.(response);
|
|
4984
|
-
if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") onComplete?.();
|
|
4985
|
-
if (response?.flowStatus === "ERROR" || response?.status === "ERROR") onError?.(response);
|
|
4986
4899
|
cleanupUrlParams();
|
|
4987
4900
|
} catch (err) {
|
|
4988
4901
|
onError?.(err);
|
|
@@ -6241,7 +6154,7 @@ var SignUpButton_default = SignUpButton;
|
|
|
6241
6154
|
|
|
6242
6155
|
//#endregion
|
|
6243
6156
|
//#region src/components/auth/Callback.ts
|
|
6244
|
-
const logger$
|
|
6157
|
+
const logger$3 = createVueLogger("Callback");
|
|
6245
6158
|
/**
|
|
6246
6159
|
* Callback — headless component that handles OAuth callback parameter forwarding.
|
|
6247
6160
|
*
|
|
@@ -6329,7 +6242,7 @@ const Callback = defineComponent({
|
|
|
6329
6242
|
navigate$2(`${returnPath}?${params.toString()}`);
|
|
6330
6243
|
} catch (err) {
|
|
6331
6244
|
const errorMessage = err instanceof Error ? err.message : "OAuth callback processing failed";
|
|
6332
|
-
logger$
|
|
6245
|
+
logger$3.error("OAuth callback error:", err);
|
|
6333
6246
|
props.onError?.(err instanceof Error ? err : new Error(errorMessage));
|
|
6334
6247
|
const params = new URLSearchParams();
|
|
6335
6248
|
params.set("error", "callback_error");
|
|
@@ -6705,843 +6618,110 @@ const FieldFactory = defineComponent({
|
|
|
6705
6618
|
var FieldFactory_default = FieldFactory;
|
|
6706
6619
|
|
|
6707
6620
|
//#endregion
|
|
6708
|
-
//#region src/components/auth/sign-in/
|
|
6709
|
-
|
|
6710
|
-
* Renders form fields for authenticators that require user input (e.g. UsernamePassword, IdentifierFirst).
|
|
6711
|
-
*/
|
|
6712
|
-
const renderFormFields = (props) => {
|
|
6713
|
-
const { authenticator, formValues, touchedFields, isLoading, onInputChange, inputClassName, buttonClassName, t } = props;
|
|
6714
|
-
const fieldNodes = (authenticator.metadata?.params?.sort((a, b) => a.order - b.order)?.filter((param) => param.param !== "totp") || []).map((param) => h("div", { key: param.param }, createField({
|
|
6715
|
-
className: inputClassName,
|
|
6716
|
-
disabled: isLoading,
|
|
6717
|
-
label: param.displayName,
|
|
6718
|
-
name: param.param,
|
|
6719
|
-
onChange: (value) => onInputChange(param.param, value),
|
|
6720
|
-
placeholder: t("elements.fields.generic.placeholder", { field: (param.displayName || param.param).toLowerCase() }),
|
|
6721
|
-
required: authenticator.requiredParams.includes(param.param),
|
|
6722
|
-
touched: touchedFields[param.param] || false,
|
|
6723
|
-
type: param.type === EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential ? FieldType$1.Password : FieldType$1.Text,
|
|
6724
|
-
value: formValues[param.param] || ""
|
|
6725
|
-
})));
|
|
6726
|
-
fieldNodes.push(h(Button_default, {
|
|
6727
|
-
class: buttonClassName,
|
|
6728
|
-
color: "primary",
|
|
6729
|
-
"data-testid": "thunderid-signin-submit",
|
|
6730
|
-
disabled: isLoading,
|
|
6731
|
-
fullWidth: true,
|
|
6732
|
-
loading: isLoading,
|
|
6733
|
-
type: "submit",
|
|
6734
|
-
variant: "solid"
|
|
6735
|
-
}, { default: () => t("username.password.buttons.submit.text") }));
|
|
6736
|
-
return fieldNodes;
|
|
6737
|
-
};
|
|
6621
|
+
//#region src/components/auth/sign-in/AuthOptionFactoryCore.ts
|
|
6622
|
+
const logger$2 = createVueLogger("AuthOptionFactory");
|
|
6738
6623
|
/**
|
|
6739
|
-
*
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
const renderMultiOptionButton = (props) => {
|
|
6743
|
-
const { authenticator, isLoading, onSubmit, buttonClassName, t } = props;
|
|
6744
|
-
let authenticatorName = authenticator.authenticator;
|
|
6745
|
-
if (authenticator.idp !== EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) authenticatorName = authenticator.idp;
|
|
6746
|
-
const displayName = t("elements.buttons.multi.option.text", { connection: authenticatorName });
|
|
6747
|
-
return h(Button_default, {
|
|
6748
|
-
class: buttonClassName,
|
|
6749
|
-
color: "secondary",
|
|
6750
|
-
disabled: isLoading,
|
|
6751
|
-
fullWidth: true,
|
|
6752
|
-
onClick: () => onSubmit(authenticator),
|
|
6753
|
-
startIcon: h("svg", {
|
|
6754
|
-
height: "18",
|
|
6755
|
-
viewBox: "0 0 24 24",
|
|
6756
|
-
width: "18",
|
|
6757
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
6758
|
-
}, [h("path", {
|
|
6759
|
-
d: {
|
|
6760
|
-
[ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SmsOtp]: "M20 15.5c-1.25 0-2.45-.2-3.57-.57a1.02 1.02 0 0 0-1.02.24l-2.2 2.2a15.074 15.074 0 0 1-6.59-6.59l2.2-2.2c.27-.27.35-.67.24-1.02A11.36 11.36 0 0 1 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M12 3v10l3-3h6V3z",
|
|
6761
|
-
[ApplicationNativeAuthenticationConstants.SupportedAuthenticators.EmailOtp]: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4l-8 5l-8-5V6l8 5l8-5z",
|
|
6762
|
-
[ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp]: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12c5.16-1.26 9-6.45 9-12V5z"
|
|
6763
|
-
}[authenticator.authenticatorId] || "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8z",
|
|
6764
|
-
fill: "currentColor"
|
|
6765
|
-
})]),
|
|
6766
|
-
type: "button",
|
|
6767
|
-
variant: "solid"
|
|
6768
|
-
}, { default: () => displayName });
|
|
6769
|
-
};
|
|
6624
|
+
* Inline helper for consent optional attribute key (mirrors ConsentCheckboxList.getConsentOptionalKey).
|
|
6625
|
+
*/
|
|
6626
|
+
const getConsentOptionalKey = (purposeId, attr) => `consent_${purposeId}_${attr}`;
|
|
6770
6627
|
/**
|
|
6771
|
-
*
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",
|
|
6788
|
-
fill: "currentColor"
|
|
6789
|
-
})]),
|
|
6790
|
-
type: "button",
|
|
6791
|
-
variant: "outline"
|
|
6792
|
-
}, { default: () => t("elements.buttons.social.text", { connection: authenticator.idp }) });
|
|
6628
|
+
* Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
|
|
6629
|
+
*
|
|
6630
|
+
* DOMPurify strips unknown URI schemes from attributes (e.g. `src="emoji:🦊"` → `src=""`).
|
|
6631
|
+
* Converting them to inline spans first preserves the emoji content through sanitization.
|
|
6632
|
+
*
|
|
6633
|
+
* Converts:
|
|
6634
|
+
* - `<img src="emoji:X" alt="Y">` → `<span role="img" aria-label="Y">X</span>`
|
|
6635
|
+
* - Any remaining `emoji:X` text occurrences → `X`
|
|
6636
|
+
*/
|
|
6637
|
+
const resolveEmojiUrisInHtml = (html) => {
|
|
6638
|
+
return html.replace(/<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi, (_match, pre, src, post) => {
|
|
6639
|
+
const emoji = extractEmojiFromUri(src);
|
|
6640
|
+
if (!emoji) return _match;
|
|
6641
|
+
const altMatch = /alt="([^"]*)"/i.exec(pre + post);
|
|
6642
|
+
return `<span role="img" aria-label="${altMatch ? altMatch[1] : emoji}">${emoji}</span>`;
|
|
6643
|
+
}).replace(/emoji:([^\s"<>&]+)/g, (_, rest) => isEmojiUri(`emoji:${rest}`) ? rest : `emoji:${rest}`);
|
|
6793
6644
|
};
|
|
6794
6645
|
/**
|
|
6795
|
-
*
|
|
6646
|
+
* Get the appropriate FieldType for an input component.
|
|
6796
6647
|
*/
|
|
6797
|
-
const
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
case
|
|
6802
|
-
|
|
6803
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Google: return h(GoogleButton_default, {
|
|
6804
|
-
class: buttonClassName,
|
|
6805
|
-
isLoading,
|
|
6806
|
-
onClick: () => onSubmit(authenticator)
|
|
6807
|
-
});
|
|
6808
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.GitHub: return h(GitHubButton_default, {
|
|
6809
|
-
class: buttonClassName,
|
|
6810
|
-
isLoading,
|
|
6811
|
-
onClick: () => onSubmit(authenticator)
|
|
6812
|
-
});
|
|
6813
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Microsoft: return h(MicrosoftButton_default, {
|
|
6814
|
-
class: buttonClassName,
|
|
6815
|
-
isLoading,
|
|
6816
|
-
onClick: () => onSubmit(authenticator)
|
|
6817
|
-
});
|
|
6818
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Facebook: return h(FacebookButton_default, {
|
|
6819
|
-
class: buttonClassName,
|
|
6820
|
-
isLoading,
|
|
6821
|
-
onClick: () => onSubmit(authenticator)
|
|
6822
|
-
});
|
|
6823
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.EmailOtp:
|
|
6824
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp:
|
|
6825
|
-
case ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SmsOtp: return hasParams ? h("div", {}, renderFormFields(props)) : renderMultiOptionButton(props);
|
|
6826
|
-
default:
|
|
6827
|
-
if (authenticator.idp !== EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) return renderSocialButton(props);
|
|
6828
|
-
return hasParams ? h("div", {}, renderFormFields(props)) : renderMultiOptionButton(props);
|
|
6648
|
+
const getFieldType = (variant) => {
|
|
6649
|
+
switch (variant) {
|
|
6650
|
+
case EmbeddedFlowComponentType$1.EmailInput: return FieldType$1.Email;
|
|
6651
|
+
case EmbeddedFlowComponentType$1.PasswordInput: return FieldType$1.Password;
|
|
6652
|
+
case EmbeddedFlowComponentType$1.TextInput:
|
|
6653
|
+
default: return FieldType$1.Text;
|
|
6829
6654
|
}
|
|
6830
6655
|
};
|
|
6831
6656
|
/**
|
|
6832
|
-
*
|
|
6833
|
-
*/
|
|
6834
|
-
const
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6657
|
+
* Get typography variant from component variant.
|
|
6658
|
+
*/
|
|
6659
|
+
const getTypographyVariant = (variant) => {
|
|
6660
|
+
return {
|
|
6661
|
+
BODY_1: "body1",
|
|
6662
|
+
BODY_2: "body2",
|
|
6663
|
+
BUTTON_TEXT: "body2",
|
|
6664
|
+
CAPTION: "caption",
|
|
6665
|
+
HEADING_1: "h1",
|
|
6666
|
+
HEADING_2: "h2",
|
|
6667
|
+
HEADING_3: "h3",
|
|
6668
|
+
HEADING_4: "h4",
|
|
6669
|
+
HEADING_5: "h5",
|
|
6670
|
+
HEADING_6: "h6",
|
|
6671
|
+
OVERLINE: "overline",
|
|
6672
|
+
SUBTITLE_1: "subtitle1",
|
|
6673
|
+
SUBTITLE_2: "subtitle2"
|
|
6674
|
+
}[variant] || "h3";
|
|
6675
|
+
};
|
|
6847
6676
|
/**
|
|
6848
|
-
*
|
|
6849
|
-
* OrganizationSSO is not yet supported in app-native authentication.
|
|
6677
|
+
* Check if a button text or action matches a social provider.
|
|
6850
6678
|
*/
|
|
6851
|
-
const
|
|
6852
|
-
const
|
|
6679
|
+
const matchesSocialProvider = (actionId, eventType, buttonText, provider) => {
|
|
6680
|
+
const providerId = `${provider}_auth`;
|
|
6681
|
+
const providerMatches = actionId === providerId || eventType === providerId;
|
|
6682
|
+
if (buttonText.toLowerCase().includes(provider)) return true;
|
|
6683
|
+
return providerMatches;
|
|
6684
|
+
};
|
|
6853
6685
|
/**
|
|
6854
|
-
*
|
|
6855
|
-
*
|
|
6856
|
-
* Handles multi-step authentication flows, form rendering per-authenticator,
|
|
6857
|
-
* redirect popups for OAuth, and passkey/FIDO WebAuthn.
|
|
6686
|
+
* Create an auth component (VNode) from a flow component configuration.
|
|
6858
6687
|
*/
|
|
6859
|
-
const
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
type
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
type: String
|
|
6889
|
-
},
|
|
6890
|
-
onInitialize: {
|
|
6891
|
-
default: void 0,
|
|
6892
|
-
type: Function
|
|
6893
|
-
},
|
|
6894
|
-
onSubmit: {
|
|
6895
|
-
default: void 0,
|
|
6896
|
-
type: Function
|
|
6897
|
-
},
|
|
6898
|
-
showLogo: {
|
|
6899
|
-
default: true,
|
|
6900
|
-
type: Boolean
|
|
6901
|
-
},
|
|
6902
|
-
showSubtitle: {
|
|
6903
|
-
default: true,
|
|
6904
|
-
type: Boolean
|
|
6905
|
-
},
|
|
6906
|
-
showTitle: {
|
|
6907
|
-
default: true,
|
|
6908
|
-
type: Boolean
|
|
6909
|
-
},
|
|
6910
|
-
size: {
|
|
6911
|
-
default: "medium",
|
|
6912
|
-
type: String
|
|
6913
|
-
},
|
|
6914
|
-
variant: {
|
|
6915
|
-
default: "outlined",
|
|
6916
|
-
type: String
|
|
6917
|
-
}
|
|
6918
|
-
},
|
|
6919
|
-
emits: [
|
|
6920
|
-
"error",
|
|
6921
|
-
"flowChange",
|
|
6922
|
-
"success"
|
|
6923
|
-
],
|
|
6924
|
-
setup(props, { emit }) {
|
|
6925
|
-
const { t } = useI18n_default();
|
|
6926
|
-
const { title: flowTitle, subtitle: flowSubtitle, messages: flowMessages } = useFlow_default();
|
|
6927
|
-
const isInitRequestLoading = ref(false);
|
|
6928
|
-
const isInitialized = ref(false);
|
|
6929
|
-
const currentFlow = ref(null);
|
|
6930
|
-
const currentAuthenticator = ref(null);
|
|
6931
|
-
const error = ref(null);
|
|
6932
|
-
const messages = ref([]);
|
|
6933
|
-
const formValues = ref({});
|
|
6934
|
-
const touchedFields = ref({});
|
|
6935
|
-
const isLoading = () => props.isLoading || isInitRequestLoading.value;
|
|
6936
|
-
const setupFormFields = (authenticator) => {
|
|
6937
|
-
const vals = {};
|
|
6938
|
-
authenticator.metadata?.params?.forEach((param) => {
|
|
6939
|
-
vals[param.param] = "";
|
|
6940
|
-
});
|
|
6941
|
-
formValues.value = vals;
|
|
6942
|
-
touchedFields.value = {};
|
|
6943
|
-
};
|
|
6944
|
-
const handleInputChange = (param, value) => {
|
|
6945
|
-
formValues.value = {
|
|
6946
|
-
...formValues.value,
|
|
6947
|
-
[param]: value
|
|
6948
|
-
};
|
|
6949
|
-
touchedFields.value = {
|
|
6950
|
-
...touchedFields.value,
|
|
6951
|
-
[param]: true
|
|
6952
|
-
};
|
|
6953
|
-
};
|
|
6954
|
-
const touchAllFields = () => {
|
|
6955
|
-
const touched = {};
|
|
6956
|
-
Object.keys(formValues.value).forEach((key) => {
|
|
6957
|
-
touched[key] = true;
|
|
6958
|
-
});
|
|
6959
|
-
touchedFields.value = touched;
|
|
6960
|
-
};
|
|
6961
|
-
const validateForm = () => {
|
|
6962
|
-
if (!currentAuthenticator.value) return true;
|
|
6963
|
-
return (currentAuthenticator.value.requiredParams || []).every((key) => {
|
|
6964
|
-
const val = formValues.value[key] || "";
|
|
6965
|
-
return !!val && val.trim() !== "";
|
|
6966
|
-
});
|
|
6967
|
-
};
|
|
6968
|
-
let handleAuthenticatorSelection;
|
|
6969
|
-
const processNextStep = (response) => {
|
|
6970
|
-
if (response && "flowId" in response && "nextStep" in response) {
|
|
6971
|
-
currentFlow.value = response;
|
|
6972
|
-
if (response.nextStep?.authenticators?.length > 0) if (response.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt && response.nextStep.authenticators.length > 1) currentAuthenticator.value = null;
|
|
6973
|
-
else {
|
|
6974
|
-
const nextAuth = response.nextStep.authenticators[0];
|
|
6975
|
-
if (isPasskeyAuthenticator(nextAuth)) {
|
|
6976
|
-
handleAuthenticatorSelection(nextAuth).catch((err) => {
|
|
6977
|
-
emit("error", err);
|
|
6978
|
-
});
|
|
6979
|
-
return;
|
|
6980
|
-
}
|
|
6981
|
-
currentAuthenticator.value = nextAuth;
|
|
6982
|
-
setupFormFields(nextAuth);
|
|
6983
|
-
}
|
|
6984
|
-
if (response.nextStep?.messages) messages.value = response.nextStep.messages.map((msg) => ({
|
|
6985
|
-
message: msg.message || "",
|
|
6986
|
-
type: msg.type || "INFO"
|
|
6987
|
-
}));
|
|
6988
|
-
}
|
|
6989
|
-
};
|
|
6990
|
-
const handleRedirectionIfNeeded = (response) => {
|
|
6991
|
-
if (response && "nextStep" in response && response.nextStep && response.nextStep.stepType === EmbeddedSignInFlowStepType.AuthenticatorPrompt && response.nextStep.authenticators?.length === 1) {
|
|
6992
|
-
const responseAuth = response.nextStep.authenticators[0];
|
|
6993
|
-
if (responseAuth.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt && responseAuth.metadata?.additionalData?.redirectUrl) {
|
|
6994
|
-
const { redirectUrl } = responseAuth.metadata.additionalData;
|
|
6995
|
-
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
6996
|
-
if (!popup) return false;
|
|
6997
|
-
let messageHandler;
|
|
6998
|
-
let popupMonitor;
|
|
6999
|
-
let hasProcessedCallback = false;
|
|
7000
|
-
const cleanup = () => {
|
|
7001
|
-
window.removeEventListener("message", messageHandler);
|
|
7002
|
-
if (popupMonitor) clearInterval(popupMonitor);
|
|
7003
|
-
};
|
|
7004
|
-
messageHandler = async (event) => {
|
|
7005
|
-
if (event.source !== popup) return;
|
|
7006
|
-
const expectedOrigin = props.afterSignInUrl ? new URL(props.afterSignInUrl).origin : window.location.origin;
|
|
7007
|
-
if (event.origin !== expectedOrigin && event.origin !== window.location.origin) return;
|
|
7008
|
-
const { code, state } = event.data;
|
|
7009
|
-
if (code && state) {
|
|
7010
|
-
const payload = {
|
|
7011
|
-
flowId: currentFlow.value.flowId,
|
|
7012
|
-
selectedAuthenticator: {
|
|
7013
|
-
authenticatorId: responseAuth.authenticatorId,
|
|
7014
|
-
params: {
|
|
7015
|
-
code,
|
|
7016
|
-
state
|
|
7017
|
-
}
|
|
7018
|
-
}
|
|
7019
|
-
};
|
|
7020
|
-
await props.onSubmit(payload, {
|
|
7021
|
-
method: currentFlow.value?.links[0].method,
|
|
7022
|
-
url: currentFlow.value?.links[0].href
|
|
7023
|
-
});
|
|
7024
|
-
popup.close();
|
|
7025
|
-
cleanup();
|
|
7026
|
-
}
|
|
7027
|
-
};
|
|
7028
|
-
window.addEventListener("message", messageHandler);
|
|
7029
|
-
popupMonitor = setInterval(async () => {
|
|
7030
|
-
try {
|
|
7031
|
-
if (popup.closed) {
|
|
7032
|
-
cleanup();
|
|
7033
|
-
return;
|
|
7034
|
-
}
|
|
7035
|
-
if (hasProcessedCallback) return;
|
|
7036
|
-
try {
|
|
7037
|
-
const popupUrl = popup.location.href;
|
|
7038
|
-
if (popupUrl && (popupUrl.includes("code=") || popupUrl.includes("error="))) {
|
|
7039
|
-
hasProcessedCallback = true;
|
|
7040
|
-
const url = new URL(popupUrl);
|
|
7041
|
-
const code = url.searchParams.get("code");
|
|
7042
|
-
const state = url.searchParams.get("state");
|
|
7043
|
-
if (url.searchParams.get("error")) {
|
|
7044
|
-
popup.close();
|
|
7045
|
-
cleanup();
|
|
7046
|
-
return;
|
|
7047
|
-
}
|
|
7048
|
-
if (code && state) {
|
|
7049
|
-
const payload = {
|
|
7050
|
-
flowId: currentFlow.value.flowId,
|
|
7051
|
-
selectedAuthenticator: {
|
|
7052
|
-
authenticatorId: responseAuth.authenticatorId,
|
|
7053
|
-
params: {
|
|
7054
|
-
code,
|
|
7055
|
-
state
|
|
7056
|
-
}
|
|
7057
|
-
}
|
|
7058
|
-
};
|
|
7059
|
-
const submitResponse = await props.onSubmit(payload, {
|
|
7060
|
-
method: currentFlow.value?.links[0].method,
|
|
7061
|
-
url: currentFlow.value?.links[0].href
|
|
7062
|
-
});
|
|
7063
|
-
popup.close();
|
|
7064
|
-
emit("flowChange", submitResponse);
|
|
7065
|
-
if (submitResponse?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) emit("success", submitResponse.authData);
|
|
7066
|
-
}
|
|
7067
|
-
}
|
|
7068
|
-
} catch {}
|
|
7069
|
-
} catch {}
|
|
7070
|
-
}, 1e3);
|
|
7071
|
-
return true;
|
|
7072
|
-
}
|
|
7073
|
-
}
|
|
7074
|
-
return false;
|
|
7075
|
-
};
|
|
7076
|
-
const handleSubmit = async (submittedValues) => {
|
|
7077
|
-
if (!currentFlow.value || !currentAuthenticator.value) return;
|
|
7078
|
-
touchAllFields();
|
|
7079
|
-
if (!validateForm()) return;
|
|
7080
|
-
isInitRequestLoading.value = true;
|
|
7081
|
-
error.value = null;
|
|
7082
|
-
messages.value = [];
|
|
7083
|
-
try {
|
|
7084
|
-
const payload = {
|
|
7085
|
-
flowId: currentFlow.value.flowId,
|
|
7086
|
-
selectedAuthenticator: {
|
|
7087
|
-
authenticatorId: currentAuthenticator.value.authenticatorId,
|
|
7088
|
-
params: submittedValues
|
|
7089
|
-
}
|
|
7090
|
-
};
|
|
7091
|
-
const response = await props.onSubmit(payload, {
|
|
7092
|
-
method: currentFlow.value.links[0].method,
|
|
7093
|
-
url: currentFlow.value.links[0].href
|
|
7094
|
-
});
|
|
7095
|
-
emit("flowChange", response);
|
|
7096
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7097
|
-
emit("success", response.authData);
|
|
7098
|
-
return;
|
|
7099
|
-
}
|
|
7100
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.FailCompleted || response?.flowStatus === EmbeddedSignInFlowStatus$1.FailIncomplete) {
|
|
7101
|
-
error.value = t("errors.signin.flow.completion.failure");
|
|
7102
|
-
return;
|
|
7103
|
-
}
|
|
7104
|
-
if (handleRedirectionIfNeeded(response)) return;
|
|
7105
|
-
processNextStep(response);
|
|
7106
|
-
} catch (err) {
|
|
7107
|
-
error.value = err instanceof ThunderIDAPIError ? err.message : t("errors.signin.flow.failure");
|
|
7108
|
-
emit("error", err);
|
|
7109
|
-
} finally {
|
|
7110
|
-
isInitRequestLoading.value = false;
|
|
7111
|
-
}
|
|
7112
|
-
};
|
|
7113
|
-
handleAuthenticatorSelection = async (authenticator, formData) => {
|
|
7114
|
-
if (!currentFlow.value) return;
|
|
7115
|
-
if (formData) touchAllFields();
|
|
7116
|
-
isInitRequestLoading.value = true;
|
|
7117
|
-
error.value = null;
|
|
7118
|
-
messages.value = [];
|
|
7119
|
-
try {
|
|
7120
|
-
if (isPasskeyAuthenticator(authenticator)) {
|
|
7121
|
-
const challengeData = authenticator.metadata?.additionalData?.challengeData;
|
|
7122
|
-
if (!challengeData) throw new Error("Missing challenge data for passkey authentication");
|
|
7123
|
-
const tokenResponse = await handleWebAuthnAuthentication$1(challengeData);
|
|
7124
|
-
const payload = {
|
|
7125
|
-
flowId: currentFlow.value.flowId,
|
|
7126
|
-
selectedAuthenticator: {
|
|
7127
|
-
authenticatorId: authenticator.authenticatorId,
|
|
7128
|
-
params: { tokenResponse }
|
|
7129
|
-
}
|
|
7130
|
-
};
|
|
7131
|
-
const response = await props.onSubmit(payload, {
|
|
7132
|
-
method: currentFlow.value.links[0].method,
|
|
7133
|
-
url: currentFlow.value.links[0].href
|
|
7134
|
-
});
|
|
7135
|
-
emit("flowChange", response);
|
|
7136
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7137
|
-
emit("success", response.authData);
|
|
7138
|
-
return;
|
|
7139
|
-
}
|
|
7140
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.FailCompleted || response?.flowStatus === EmbeddedSignInFlowStatus$1.FailIncomplete) {
|
|
7141
|
-
error.value = t("errors.signin.flow.passkeys.completion.failure");
|
|
7142
|
-
return;
|
|
7143
|
-
}
|
|
7144
|
-
processNextStep(response);
|
|
7145
|
-
return;
|
|
7146
|
-
}
|
|
7147
|
-
if (authenticator.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt) {
|
|
7148
|
-
const payload = {
|
|
7149
|
-
flowId: currentFlow.value.flowId,
|
|
7150
|
-
selectedAuthenticator: {
|
|
7151
|
-
authenticatorId: authenticator.authenticatorId,
|
|
7152
|
-
params: {}
|
|
7153
|
-
}
|
|
7154
|
-
};
|
|
7155
|
-
const response = await props.onSubmit(payload, {
|
|
7156
|
-
method: currentFlow.value.links[0].method,
|
|
7157
|
-
url: currentFlow.value.links[0].href
|
|
7158
|
-
});
|
|
7159
|
-
emit("flowChange", response);
|
|
7160
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7161
|
-
emit("success", response.authData);
|
|
7162
|
-
return;
|
|
7163
|
-
}
|
|
7164
|
-
handleRedirectionIfNeeded(response);
|
|
7165
|
-
return;
|
|
7166
|
-
}
|
|
7167
|
-
if (formData) {
|
|
7168
|
-
if (!validateForm()) return;
|
|
7169
|
-
const formPayload = {
|
|
7170
|
-
flowId: currentFlow.value.flowId,
|
|
7171
|
-
selectedAuthenticator: {
|
|
7172
|
-
authenticatorId: authenticator.authenticatorId,
|
|
7173
|
-
params: formData
|
|
7174
|
-
}
|
|
7175
|
-
};
|
|
7176
|
-
const formResponse = await props.onSubmit(formPayload, {
|
|
7177
|
-
method: currentFlow.value.links[0].method,
|
|
7178
|
-
url: currentFlow.value.links[0].href
|
|
7179
|
-
});
|
|
7180
|
-
emit("flowChange", formResponse);
|
|
7181
|
-
if (formResponse?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7182
|
-
emit("success", formResponse.authData);
|
|
7183
|
-
return;
|
|
7184
|
-
}
|
|
7185
|
-
if (formResponse?.flowStatus === EmbeddedSignInFlowStatus$1.FailCompleted || formResponse?.flowStatus === EmbeddedSignInFlowStatus$1.FailIncomplete) {
|
|
7186
|
-
error.value = t("errors.signin.flow.completion.failure");
|
|
7187
|
-
return;
|
|
7188
|
-
}
|
|
7189
|
-
if (handleRedirectionIfNeeded(formResponse)) return;
|
|
7190
|
-
processNextStep(formResponse);
|
|
7191
|
-
return;
|
|
7192
|
-
}
|
|
7193
|
-
if (!!!(authenticator.metadata?.params && authenticator.metadata.params.length > 0)) {
|
|
7194
|
-
const payload = {
|
|
7195
|
-
flowId: currentFlow.value.flowId,
|
|
7196
|
-
selectedAuthenticator: {
|
|
7197
|
-
authenticatorId: authenticator.authenticatorId,
|
|
7198
|
-
params: {}
|
|
7199
|
-
}
|
|
7200
|
-
};
|
|
7201
|
-
const response = await props.onSubmit(payload, {
|
|
7202
|
-
method: currentFlow.value.links[0].method,
|
|
7203
|
-
url: currentFlow.value.links[0].href
|
|
7204
|
-
});
|
|
7205
|
-
emit("flowChange", response);
|
|
7206
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7207
|
-
emit("success", response.authData);
|
|
7208
|
-
return;
|
|
7209
|
-
}
|
|
7210
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.FailCompleted || response?.flowStatus === EmbeddedSignInFlowStatus$1.FailIncomplete) {
|
|
7211
|
-
error.value = t("errors.signin.flow.completion.failure");
|
|
7212
|
-
return;
|
|
7213
|
-
}
|
|
7214
|
-
if (handleRedirectionIfNeeded(response)) return;
|
|
7215
|
-
processNextStep(response);
|
|
7216
|
-
} else {
|
|
7217
|
-
currentAuthenticator.value = authenticator;
|
|
7218
|
-
setupFormFields(authenticator);
|
|
7219
|
-
}
|
|
7220
|
-
} catch (err) {
|
|
7221
|
-
error.value = err instanceof ThunderIDAPIError ? err.message : t("errors.signin.flow.failure");
|
|
7222
|
-
emit("error", err);
|
|
7223
|
-
} finally {
|
|
7224
|
-
isInitRequestLoading.value = false;
|
|
7225
|
-
}
|
|
7226
|
-
};
|
|
7227
|
-
const hasMultipleOptions = () => !!(currentFlow.value && "nextStep" in currentFlow.value && currentFlow.value.nextStep?.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt && currentFlow.value.nextStep?.authenticators && currentFlow.value.nextStep.authenticators.length > 1);
|
|
7228
|
-
const getAvailableAuthenticators = () => {
|
|
7229
|
-
if (!currentFlow.value || !("nextStep" in currentFlow.value) || !currentFlow.value.nextStep?.authenticators) return [];
|
|
7230
|
-
return currentFlow.value.nextStep.authenticators;
|
|
7231
|
-
};
|
|
7232
|
-
let initAttempted = false;
|
|
7233
|
-
watch(() => props.isLoading, (loading) => {
|
|
7234
|
-
if (!loading && !initAttempted && props.onInitialize) {
|
|
7235
|
-
initAttempted = true;
|
|
7236
|
-
(async () => {
|
|
7237
|
-
isInitRequestLoading.value = true;
|
|
7238
|
-
error.value = null;
|
|
7239
|
-
try {
|
|
7240
|
-
const response = await props.onInitialize();
|
|
7241
|
-
currentFlow.value = response;
|
|
7242
|
-
isInitialized.value = true;
|
|
7243
|
-
emit("flowChange", response);
|
|
7244
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus$1.SuccessCompleted) {
|
|
7245
|
-
emit("success", response.authData || {});
|
|
7246
|
-
return;
|
|
7247
|
-
}
|
|
7248
|
-
if (response?.nextStep?.authenticators?.length > 0) if (response.nextStep.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt && response.nextStep.authenticators.length > 1) currentAuthenticator.value = null;
|
|
7249
|
-
else {
|
|
7250
|
-
const authenticator = response.nextStep.authenticators[0];
|
|
7251
|
-
currentAuthenticator.value = authenticator;
|
|
7252
|
-
setupFormFields(authenticator);
|
|
7253
|
-
}
|
|
7254
|
-
if (response?.nextStep?.messages) messages.value = response.nextStep.messages.map((msg) => ({
|
|
7255
|
-
message: msg.message || "",
|
|
7256
|
-
type: msg.type || "INFO"
|
|
7257
|
-
}));
|
|
7258
|
-
} catch (err) {
|
|
7259
|
-
error.value = err instanceof ThunderIDAPIError ? err.message : t("errors.signin.initialization");
|
|
7260
|
-
emit("error", err);
|
|
7261
|
-
} finally {
|
|
7262
|
-
isInitRequestLoading.value = false;
|
|
7263
|
-
}
|
|
7264
|
-
})();
|
|
7265
|
-
}
|
|
7266
|
-
}, { immediate: true });
|
|
7267
|
-
const renderAlertVariant = (type) => {
|
|
7268
|
-
const lower = type.toLowerCase();
|
|
7269
|
-
if (lower === "error") return "error";
|
|
7270
|
-
if (lower === "warning") return "warning";
|
|
7271
|
-
if (lower === "success") return "success";
|
|
7272
|
-
return "info";
|
|
7273
|
-
};
|
|
7274
|
-
const renderMessages = () => messages.value.map((msg, i) => h(Alert_default, {
|
|
7275
|
-
key: i,
|
|
7276
|
-
severity: renderAlertVariant(msg.type)
|
|
7277
|
-
}, { default: () => msg.message }));
|
|
7278
|
-
const renderError = () => error.value ? h(Alert_default, { severity: "error" }, { default: () => error.value }) : null;
|
|
7279
|
-
return () => {
|
|
7280
|
-
const cardClass = [
|
|
7281
|
-
withVendorCSSClassPrefix("signin"),
|
|
7282
|
-
withVendorCSSClassPrefix(`signin--${props.size}`),
|
|
7283
|
-
withVendorCSSClassPrefix(`signin--${props.variant}`),
|
|
7284
|
-
props.className
|
|
7285
|
-
].filter(Boolean).join(" ");
|
|
7286
|
-
if (!isInitialized.value && isLoading()) return h("div", {}, [props.showLogo ? h("div", { class: withVendorCSSClassPrefix("signin__logo") }, [h(Logo_default)]) : null, h(Card_default, {
|
|
7287
|
-
class: cardClass,
|
|
7288
|
-
variant: props.variant
|
|
7289
|
-
}, { default: () => [h("div", { class: withVendorCSSClassPrefix("signin__loading") }, [h(Spinner_default, { size: "medium" }), h(Typography_default, { variant: "body1" }, { default: () => t("messages.loading.placeholder") })])] })]);
|
|
7290
|
-
if (hasMultipleOptions() && !currentAuthenticator.value) {
|
|
7291
|
-
const available = getAvailableAuthenticators();
|
|
7292
|
-
const userPromptAuths = available.filter((auth) => auth.metadata?.promptType === EmbeddedSignInFlowAuthenticatorPromptType.UserPrompt || auth.idp === "LOCAL" && auth.metadata?.params && auth.metadata.params.length > 0);
|
|
7293
|
-
const optionAuths = available.filter((auth) => !userPromptAuths.includes(auth)).filter((auth) => !HIDDEN_AUTHENTICATORS.includes(auth.authenticatorId));
|
|
7294
|
-
return h("div", {}, [props.showLogo ? h("div", { class: withVendorCSSClassPrefix("signin__logo") }, [h(Logo_default)]) : null, h(Card_default, {
|
|
7295
|
-
class: cardClass,
|
|
7296
|
-
variant: props.variant
|
|
7297
|
-
}, { default: () => {
|
|
7298
|
-
const children = [];
|
|
7299
|
-
if (props.showTitle || props.showSubtitle) children.push(h("div", { class: withVendorCSSClassPrefix("signin__header") }, [props.showTitle ? h(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signin.heading") }) : null, props.showSubtitle ? h(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signin.subheading") }) : null]));
|
|
7300
|
-
if (flowMessages.value?.length > 0) children.push(h("div", { class: withVendorCSSClassPrefix("signin__flow-messages") }, flowMessages.value.map((fm, i) => h(Alert_default, {
|
|
7301
|
-
key: fm.id || i,
|
|
7302
|
-
severity: fm.type
|
|
7303
|
-
}, { default: () => fm.message }))));
|
|
7304
|
-
if (messages.value.length > 0) children.push(h("div", {}, renderMessages()));
|
|
7305
|
-
const errNode = renderError();
|
|
7306
|
-
if (errNode) children.push(errNode);
|
|
7307
|
-
userPromptAuths.forEach((auth, index) => {
|
|
7308
|
-
if (index > 0) children.push(h(Divider_default, {}, { default: () => "OR" }));
|
|
7309
|
-
children.push(h("form", { onSubmit: (e) => {
|
|
7310
|
-
e.preventDefault();
|
|
7311
|
-
const fd = {};
|
|
7312
|
-
auth.metadata?.params?.forEach((p) => {
|
|
7313
|
-
fd[p.param] = formValues.value[p.param] || "";
|
|
7314
|
-
});
|
|
7315
|
-
handleAuthenticatorSelection(auth, fd);
|
|
7316
|
-
} }, [createSignInOptionFromAuthenticator(auth, formValues.value, touchedFields.value, isLoading(), handleInputChange, (a, fd) => handleAuthenticatorSelection(a, fd), t, {
|
|
7317
|
-
buttonClassName: props.buttonClassName,
|
|
7318
|
-
error: error.value,
|
|
7319
|
-
inputClassName: props.inputClassName
|
|
7320
|
-
})]));
|
|
7321
|
-
});
|
|
7322
|
-
if (userPromptAuths.length > 0 && optionAuths.length > 0) children.push(h(Divider_default, {}, { default: () => "OR" }));
|
|
7323
|
-
optionAuths.forEach((auth) => {
|
|
7324
|
-
children.push(h("div", { key: auth.authenticatorId }, [createSignInOptionFromAuthenticator(auth, formValues.value, touchedFields.value, isLoading(), handleInputChange, (a, fd) => handleAuthenticatorSelection(a, fd), t, {
|
|
7325
|
-
buttonClassName: props.buttonClassName,
|
|
7326
|
-
error: error.value,
|
|
7327
|
-
inputClassName: props.inputClassName
|
|
7328
|
-
})]));
|
|
7329
|
-
});
|
|
7330
|
-
return children;
|
|
7331
|
-
} })]);
|
|
7332
|
-
}
|
|
7333
|
-
if (!currentAuthenticator.value) return h("div", {}, [props.showLogo ? h("div", { class: withVendorCSSClassPrefix("signin__logo") }, [h(Logo_default)]) : null, h(Card_default, {
|
|
7334
|
-
class: cardClass,
|
|
7335
|
-
variant: props.variant
|
|
7336
|
-
}, { default: () => {
|
|
7337
|
-
const errNode = renderError();
|
|
7338
|
-
return errNode ? [errNode] : [h(Typography_default, { variant: "body1" }, { default: () => t("messages.loading.placeholder") })];
|
|
7339
|
-
} })]);
|
|
7340
|
-
if (isPasskeyAuthenticator(currentAuthenticator.value) && !isLoading()) {
|
|
7341
|
-
handleAuthenticatorSelection(currentAuthenticator.value);
|
|
7342
|
-
return h("div", {}, [props.showLogo ? h("div", { class: withVendorCSSClassPrefix("signin__logo") }, [h(Logo_default)]) : null, h(Card_default, {
|
|
7343
|
-
class: cardClass,
|
|
7344
|
-
variant: props.variant
|
|
7345
|
-
}, { default: () => [h("div", { style: "text-align:center" }, [h(Spinner_default, { size: "large" }), h(Typography_default, { variant: "body1" }, { default: () => t("passkey.authenticating") || "Authenticating with passkey..." })])] })]);
|
|
7346
|
-
}
|
|
7347
|
-
return h("div", {}, [props.showLogo ? h("div", { class: withVendorCSSClassPrefix("signin__logo") }, [h(Logo_default)]) : null, h(Card_default, {
|
|
7348
|
-
class: cardClass,
|
|
7349
|
-
variant: props.variant
|
|
7350
|
-
}, { default: () => {
|
|
7351
|
-
const children = [];
|
|
7352
|
-
children.push(h("div", { class: withVendorCSSClassPrefix("signin__header") }, [h(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signin.heading") }), h(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signin.subheading") })]));
|
|
7353
|
-
if (flowMessages.value?.length > 0) children.push(h("div", { class: withVendorCSSClassPrefix("signin__flow-messages") }, flowMessages.value.map((fm, i) => h(Alert_default, {
|
|
7354
|
-
key: fm.id || i,
|
|
7355
|
-
severity: fm.type
|
|
7356
|
-
}, { default: () => fm.message }))));
|
|
7357
|
-
if (messages.value.length > 0) children.push(h("div", {}, renderMessages()));
|
|
7358
|
-
const errNode = renderError();
|
|
7359
|
-
if (errNode) children.push(errNode);
|
|
7360
|
-
children.push(h("form", {
|
|
7361
|
-
class: withVendorCSSClassPrefix("signin__form"),
|
|
7362
|
-
onSubmit: (e) => {
|
|
7363
|
-
e.preventDefault();
|
|
7364
|
-
const fd = {};
|
|
7365
|
-
currentAuthenticator.value?.metadata?.params?.forEach((p) => {
|
|
7366
|
-
fd[p.param] = formValues.value[p.param] || "";
|
|
7367
|
-
});
|
|
7368
|
-
handleSubmit(fd);
|
|
7369
|
-
}
|
|
7370
|
-
}, [createSignInOptionFromAuthenticator(currentAuthenticator.value, formValues.value, touchedFields.value, isLoading(), handleInputChange, (_, fd) => handleSubmit(fd || formValues.value), t, {
|
|
7371
|
-
buttonClassName: props.buttonClassName,
|
|
7372
|
-
error: error.value,
|
|
7373
|
-
inputClassName: props.inputClassName
|
|
7374
|
-
})]));
|
|
7375
|
-
return children;
|
|
7376
|
-
} })]);
|
|
7377
|
-
};
|
|
7378
|
-
}
|
|
7379
|
-
});
|
|
7380
|
-
var BaseSignIn_default$1 = BaseSignIn$2;
|
|
7381
|
-
|
|
7382
|
-
//#endregion
|
|
7383
|
-
//#region src/components/auth/sign-in/v1/SignIn.ts
|
|
7384
|
-
/**
|
|
7385
|
-
* V1 SignIn — app-native sign-in component using the authenticator-based flow.
|
|
7386
|
-
*
|
|
7387
|
-
* Initialises the flow with `signIn({ response_mode: 'direct' })` and delegates
|
|
7388
|
-
* all UI rendering to `BaseSignInV1`.
|
|
7389
|
-
*/
|
|
7390
|
-
const SignIn$2 = defineComponent({
|
|
7391
|
-
name: "SignInV1",
|
|
7392
|
-
props: {
|
|
7393
|
-
className: {
|
|
7394
|
-
default: "",
|
|
7395
|
-
type: String
|
|
7396
|
-
},
|
|
7397
|
-
size: {
|
|
7398
|
-
default: "medium",
|
|
7399
|
-
type: String
|
|
7400
|
-
},
|
|
7401
|
-
variant: {
|
|
7402
|
-
default: "outlined",
|
|
7403
|
-
type: String
|
|
7404
|
-
}
|
|
7405
|
-
},
|
|
7406
|
-
emits: ["error", "success"],
|
|
7407
|
-
setup(props, { emit, attrs }) {
|
|
7408
|
-
const { signIn, afterSignInUrl, isInitialized, isLoading } = useThunderID_default();
|
|
7409
|
-
const handleInitialize = async () => await signIn({ response_mode: "direct" });
|
|
7410
|
-
const handleOnSubmit = async (payload, request) => await signIn(payload, request);
|
|
7411
|
-
const handleSuccess = (authData) => {
|
|
7412
|
-
emit("success", authData);
|
|
7413
|
-
if (authData && afterSignInUrl) {
|
|
7414
|
-
const url = new URL(afterSignInUrl, window.location.origin);
|
|
7415
|
-
Object.entries(authData).forEach(([key, value]) => {
|
|
7416
|
-
if (value !== void 0 && value !== null) url.searchParams.append(key, String(value));
|
|
7417
|
-
});
|
|
7418
|
-
window.location.href = url.toString();
|
|
7419
|
-
}
|
|
7420
|
-
};
|
|
7421
|
-
return () => h(BaseSignIn_default$1, {
|
|
7422
|
-
...attrs,
|
|
7423
|
-
afterSignInUrl,
|
|
7424
|
-
class: props.className,
|
|
7425
|
-
isLoading: isLoading.value || !isInitialized.value,
|
|
7426
|
-
onError: (err) => emit("error", err),
|
|
7427
|
-
onInitialize: handleInitialize,
|
|
7428
|
-
onSubmit: handleOnSubmit,
|
|
7429
|
-
onSuccess: handleSuccess,
|
|
7430
|
-
showLogo: true,
|
|
7431
|
-
showSubtitle: true,
|
|
7432
|
-
showTitle: true,
|
|
7433
|
-
size: props.size,
|
|
7434
|
-
variant: props.variant
|
|
7435
|
-
});
|
|
7436
|
-
}
|
|
7437
|
-
});
|
|
7438
|
-
var SignIn_default$1 = SignIn$2;
|
|
7439
|
-
|
|
7440
|
-
//#endregion
|
|
7441
|
-
//#region src/components/auth/sign-in/AuthOptionFactoryCore.ts
|
|
7442
|
-
const logger$3 = createVueLogger("AuthOptionFactory");
|
|
7443
|
-
/**
|
|
7444
|
-
* Inline helper for consent optional attribute key (mirrors ConsentCheckboxList.getConsentOptionalKey).
|
|
7445
|
-
*/
|
|
7446
|
-
const getConsentOptionalKey = (purposeId, attr) => `consent_${purposeId}_${attr}`;
|
|
7447
|
-
/**
|
|
7448
|
-
* Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
|
|
7449
|
-
*
|
|
7450
|
-
* DOMPurify strips unknown URI schemes from attributes (e.g. `src="emoji:🦊"` → `src=""`).
|
|
7451
|
-
* Converting them to inline spans first preserves the emoji content through sanitization.
|
|
7452
|
-
*
|
|
7453
|
-
* Converts:
|
|
7454
|
-
* - `<img src="emoji:X" alt="Y">` → `<span role="img" aria-label="Y">X</span>`
|
|
7455
|
-
* - Any remaining `emoji:X` text occurrences → `X`
|
|
7456
|
-
*/
|
|
7457
|
-
const resolveEmojiUrisInHtml = (html) => {
|
|
7458
|
-
return html.replace(/<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi, (_match, pre, src, post) => {
|
|
7459
|
-
const emoji = extractEmojiFromUri(src);
|
|
7460
|
-
if (!emoji) return _match;
|
|
7461
|
-
const altMatch = /alt="([^"]*)"/i.exec(pre + post);
|
|
7462
|
-
return `<span role="img" aria-label="${altMatch ? altMatch[1] : emoji}">${emoji}</span>`;
|
|
7463
|
-
}).replace(/emoji:([^\s"<>&]+)/g, (_, rest) => isEmojiUri(`emoji:${rest}`) ? rest : `emoji:${rest}`);
|
|
7464
|
-
};
|
|
7465
|
-
/**
|
|
7466
|
-
* Get the appropriate FieldType for an input component.
|
|
7467
|
-
*/
|
|
7468
|
-
const getFieldType = (variant) => {
|
|
7469
|
-
switch (variant) {
|
|
7470
|
-
case EmbeddedFlowComponentTypeV2.EmailInput: return FieldType$1.Email;
|
|
7471
|
-
case EmbeddedFlowComponentTypeV2.PasswordInput: return FieldType$1.Password;
|
|
7472
|
-
case EmbeddedFlowComponentTypeV2.TextInput:
|
|
7473
|
-
default: return FieldType$1.Text;
|
|
7474
|
-
}
|
|
7475
|
-
};
|
|
7476
|
-
/**
|
|
7477
|
-
* Get typography variant from component variant.
|
|
7478
|
-
*/
|
|
7479
|
-
const getTypographyVariant = (variant) => {
|
|
7480
|
-
return {
|
|
7481
|
-
BODY_1: "body1",
|
|
7482
|
-
BODY_2: "body2",
|
|
7483
|
-
BUTTON_TEXT: "body2",
|
|
7484
|
-
CAPTION: "caption",
|
|
7485
|
-
HEADING_1: "h1",
|
|
7486
|
-
HEADING_2: "h2",
|
|
7487
|
-
HEADING_3: "h3",
|
|
7488
|
-
HEADING_4: "h4",
|
|
7489
|
-
HEADING_5: "h5",
|
|
7490
|
-
HEADING_6: "h6",
|
|
7491
|
-
OVERLINE: "overline",
|
|
7492
|
-
SUBTITLE_1: "subtitle1",
|
|
7493
|
-
SUBTITLE_2: "subtitle2"
|
|
7494
|
-
}[variant] || "h3";
|
|
7495
|
-
};
|
|
7496
|
-
/**
|
|
7497
|
-
* Check if a button text or action matches a social provider.
|
|
7498
|
-
*/
|
|
7499
|
-
const matchesSocialProvider$1 = (actionId, eventType, buttonText, provider) => {
|
|
7500
|
-
const providerId = `${provider}_auth`;
|
|
7501
|
-
const providerMatches = actionId === providerId || eventType === providerId;
|
|
7502
|
-
if (buttonText.toLowerCase().includes(provider)) return true;
|
|
7503
|
-
return providerMatches;
|
|
7504
|
-
};
|
|
7505
|
-
/**
|
|
7506
|
-
* Create an auth component (VNode) from a flow component configuration.
|
|
7507
|
-
*/
|
|
7508
|
-
const createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options = {}) => {
|
|
7509
|
-
const key = options.key ?? component.id;
|
|
7510
|
-
/** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */
|
|
7511
|
-
const resolve = (text) => {
|
|
7512
|
-
if (!text || !options.t && !options.meta) return text || "";
|
|
7513
|
-
return resolveFlowTemplateLiterals(text, {
|
|
7514
|
-
meta: options.meta,
|
|
7515
|
-
t: options.t || ((k) => k)
|
|
7516
|
-
});
|
|
7517
|
-
};
|
|
7518
|
-
switch (component.type) {
|
|
7519
|
-
case EmbeddedFlowComponentTypeV2.TextInput:
|
|
7520
|
-
case EmbeddedFlowComponentTypeV2.PasswordInput:
|
|
7521
|
-
case EmbeddedFlowComponentTypeV2.EmailInput: {
|
|
7522
|
-
const identifier = component.ref ?? "";
|
|
7523
|
-
const value = formValues[identifier] || "";
|
|
7524
|
-
const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
|
|
7525
|
-
const fieldType = getFieldType(component.type);
|
|
7526
|
-
return createField({
|
|
7527
|
-
className: options.inputClassName,
|
|
7528
|
-
error,
|
|
7529
|
-
label: resolve(component.label) || "",
|
|
7530
|
-
name: identifier,
|
|
7531
|
-
onBlur: () => options.onInputBlur?.(identifier),
|
|
7532
|
-
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
7533
|
-
placeholder: resolve(component.placeholder) || "",
|
|
7534
|
-
required: component.required || false,
|
|
7535
|
-
type: fieldType,
|
|
7536
|
-
value
|
|
6688
|
+
const createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options = {}) => {
|
|
6689
|
+
const key = options.key ?? component.id;
|
|
6690
|
+
/** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */
|
|
6691
|
+
const resolve = (text) => {
|
|
6692
|
+
if (!text || !options.t && !options.meta) return text || "";
|
|
6693
|
+
return resolveFlowTemplateLiterals(text, {
|
|
6694
|
+
meta: options.meta,
|
|
6695
|
+
t: options.t || ((k) => k)
|
|
6696
|
+
});
|
|
6697
|
+
};
|
|
6698
|
+
switch (component.type) {
|
|
6699
|
+
case EmbeddedFlowComponentType$1.TextInput:
|
|
6700
|
+
case EmbeddedFlowComponentType$1.PasswordInput:
|
|
6701
|
+
case EmbeddedFlowComponentType$1.EmailInput: {
|
|
6702
|
+
const identifier = component.ref ?? "";
|
|
6703
|
+
const value = formValues[identifier] || "";
|
|
6704
|
+
const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
|
|
6705
|
+
const fieldType = getFieldType(component.type);
|
|
6706
|
+
return createField({
|
|
6707
|
+
className: options.inputClassName,
|
|
6708
|
+
error,
|
|
6709
|
+
label: resolve(component.label) || "",
|
|
6710
|
+
name: identifier,
|
|
6711
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
6712
|
+
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
6713
|
+
placeholder: resolve(component.placeholder) || "",
|
|
6714
|
+
required: component.required || false,
|
|
6715
|
+
type: fieldType,
|
|
6716
|
+
value
|
|
7537
6717
|
});
|
|
7538
6718
|
}
|
|
7539
|
-
case
|
|
6719
|
+
case EmbeddedFlowComponentType$1.Action: {
|
|
7540
6720
|
const actionId = component.id;
|
|
7541
6721
|
const eventType = component.eventType || "";
|
|
7542
6722
|
const buttonText = resolve(component.label);
|
|
7543
6723
|
const componentVariant = component.variant || "";
|
|
7544
|
-
const shouldSkipValidation = eventType.toUpperCase() ===
|
|
6724
|
+
const shouldSkipValidation = eventType.toUpperCase() === EmbeddedFlowEventType$1.Trigger;
|
|
7545
6725
|
const handleClick = () => {
|
|
7546
6726
|
if (options.onSubmit) {
|
|
7547
6727
|
const formData = {};
|
|
@@ -7549,7 +6729,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7549
6729
|
formData[field] = formValues[field];
|
|
7550
6730
|
});
|
|
7551
6731
|
const consentPrompt = options.additionalData?.["consentPrompt"];
|
|
7552
|
-
if (consentPrompt && eventType.toUpperCase() ===
|
|
6732
|
+
if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType$1.Submit) {
|
|
7553
6733
|
const isDeny = componentVariant.toLowerCase() !== "primary";
|
|
7554
6734
|
const decisions = { purposes: consentPrompt.purposes.map((p) => ({
|
|
7555
6735
|
approved: !isDeny,
|
|
@@ -7567,22 +6747,22 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7567
6747
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7568
6748
|
}
|
|
7569
6749
|
};
|
|
7570
|
-
if (matchesSocialProvider
|
|
6750
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "google")) return h(GoogleButton_default, {
|
|
7571
6751
|
class: options.buttonClassName,
|
|
7572
6752
|
key,
|
|
7573
6753
|
onClick: handleClick
|
|
7574
6754
|
});
|
|
7575
|
-
if (matchesSocialProvider
|
|
6755
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "github")) return h(GitHubButton_default, {
|
|
7576
6756
|
class: options.buttonClassName,
|
|
7577
6757
|
key,
|
|
7578
6758
|
onClick: handleClick
|
|
7579
6759
|
});
|
|
7580
|
-
if (matchesSocialProvider
|
|
6760
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook")) return h(FacebookButton_default, {
|
|
7581
6761
|
class: options.buttonClassName,
|
|
7582
6762
|
key,
|
|
7583
6763
|
onClick: handleClick
|
|
7584
6764
|
});
|
|
7585
|
-
if (matchesSocialProvider
|
|
6765
|
+
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft")) return h(MicrosoftButton_default, {
|
|
7586
6766
|
class: options.buttonClassName,
|
|
7587
6767
|
key,
|
|
7588
6768
|
onClick: handleClick
|
|
@@ -7620,7 +6800,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7620
6800
|
variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline"
|
|
7621
6801
|
}, { default: () => buttonText || "Submit" });
|
|
7622
6802
|
}
|
|
7623
|
-
case
|
|
6803
|
+
case EmbeddedFlowComponentType$1.Text: {
|
|
7624
6804
|
const variant = getTypographyVariant(component.variant ?? "");
|
|
7625
6805
|
return h(Typography_default, {
|
|
7626
6806
|
key,
|
|
@@ -7631,11 +6811,11 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7631
6811
|
variant
|
|
7632
6812
|
}, { default: () => resolve(component.label) });
|
|
7633
6813
|
}
|
|
7634
|
-
case
|
|
6814
|
+
case EmbeddedFlowComponentType$1.Divider: {
|
|
7635
6815
|
const dividerLabel = resolve(component.label) || "";
|
|
7636
6816
|
return h(Divider_default, { key }, dividerLabel ? { default: () => dividerLabel } : void 0);
|
|
7637
6817
|
}
|
|
7638
|
-
case
|
|
6818
|
+
case EmbeddedFlowComponentType$1.Select: {
|
|
7639
6819
|
const identifier = component.ref ?? "";
|
|
7640
6820
|
const value = formValues[identifier] || "";
|
|
7641
6821
|
const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
|
|
@@ -7657,7 +6837,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7657
6837
|
required: component.required
|
|
7658
6838
|
});
|
|
7659
6839
|
}
|
|
7660
|
-
case
|
|
6840
|
+
case EmbeddedFlowComponentType$1.Block:
|
|
7661
6841
|
if (component.components && component.components.length > 0) {
|
|
7662
6842
|
const blockChildren = component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, {
|
|
7663
6843
|
...options,
|
|
@@ -7669,12 +6849,12 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7669
6849
|
}, blockChildren);
|
|
7670
6850
|
}
|
|
7671
6851
|
return null;
|
|
7672
|
-
case
|
|
6852
|
+
case EmbeddedFlowComponentType$1.RichText: return h("div", {
|
|
7673
6853
|
innerHTML: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label))),
|
|
7674
6854
|
key,
|
|
7675
6855
|
style: { overflowWrap: "anywhere" }
|
|
7676
6856
|
});
|
|
7677
|
-
case
|
|
6857
|
+
case EmbeddedFlowComponentType$1.Image: {
|
|
7678
6858
|
const explicitHeight = resolve(component.height?.toString());
|
|
7679
6859
|
const explicitWidth = resolve(component.width?.toString());
|
|
7680
6860
|
return h("img", {
|
|
@@ -7688,10 +6868,10 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7688
6868
|
}
|
|
7689
6869
|
});
|
|
7690
6870
|
}
|
|
7691
|
-
case
|
|
7692
|
-
logger$
|
|
6871
|
+
case EmbeddedFlowComponentType$1.Icon:
|
|
6872
|
+
logger$2.warn(`Icon component type is not yet supported in the Vue SDK. Skipping render.`);
|
|
7693
6873
|
return null;
|
|
7694
|
-
case
|
|
6874
|
+
case EmbeddedFlowComponentType$1.Stack: {
|
|
7695
6875
|
const direction = component.direction || "row";
|
|
7696
6876
|
const gap = component.gap ?? 2;
|
|
7697
6877
|
const align = component.align || "center";
|
|
@@ -7714,10 +6894,10 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7714
6894
|
style: stackStyle
|
|
7715
6895
|
}, stackChildren.filter(Boolean));
|
|
7716
6896
|
}
|
|
7717
|
-
case
|
|
7718
|
-
logger$
|
|
6897
|
+
case EmbeddedFlowComponentType$1.Consent:
|
|
6898
|
+
logger$2.warn(`Consent component type is not yet fully supported in the Vue SDK.`);
|
|
7719
6899
|
return null;
|
|
7720
|
-
case
|
|
6900
|
+
case EmbeddedFlowComponentType$1.Timer: {
|
|
7721
6901
|
const textTemplate = resolve(component.label) || "Time remaining: {time}";
|
|
7722
6902
|
const timeoutMs = Number(options.additionalData?.["stepTimeout"]) || 0;
|
|
7723
6903
|
const expiresIn = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3)) : 0;
|
|
@@ -7728,7 +6908,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7728
6908
|
}, timerText);
|
|
7729
6909
|
}
|
|
7730
6910
|
default:
|
|
7731
|
-
logger$
|
|
6911
|
+
logger$2.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
7732
6912
|
return null;
|
|
7733
6913
|
}
|
|
7734
6914
|
};
|
|
@@ -7757,7 +6937,7 @@ const renderInviteUserComponents = (components, formValues, touchedFields, formE
|
|
|
7757
6937
|
})).filter((v) => v !== null);
|
|
7758
6938
|
|
|
7759
6939
|
//#endregion
|
|
7760
|
-
//#region src/utils/
|
|
6940
|
+
//#region src/utils/resolveTranslationsInObject.ts
|
|
7761
6941
|
/**
|
|
7762
6942
|
* Resolves all {{ t() }} and {{ meta() }} template expressions in an object's string properties.
|
|
7763
6943
|
* @param obj - The object to process
|
|
@@ -7784,7 +6964,7 @@ const resolveTranslationsInObject = (obj, t, properties = [
|
|
|
7784
6964
|
};
|
|
7785
6965
|
|
|
7786
6966
|
//#endregion
|
|
7787
|
-
//#region src/utils/
|
|
6967
|
+
//#region src/utils/resolveTranslationsInArray.ts
|
|
7788
6968
|
/**
|
|
7789
6969
|
* Recursively resolves translation and meta template strings in an array of objects.
|
|
7790
6970
|
* @param items - Array of objects to process
|
|
@@ -7801,7 +6981,7 @@ const resolveTranslationsInArray = (items, t, properties, meta) => items.map((it
|
|
|
7801
6981
|
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7802
6982
|
|
|
7803
6983
|
//#endregion
|
|
7804
|
-
//#region src/utils/
|
|
6984
|
+
//#region src/utils/flowTransformer.ts
|
|
7805
6985
|
/**
|
|
7806
6986
|
* Create a mapping from ref to identifier based on data.inputs array.
|
|
7807
6987
|
*/
|
|
@@ -7911,7 +7091,7 @@ const normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7911
7091
|
};
|
|
7912
7092
|
|
|
7913
7093
|
//#endregion
|
|
7914
|
-
//#region src/components/auth/sign-in/
|
|
7094
|
+
//#region src/components/auth/sign-in/BaseSignIn.ts
|
|
7915
7095
|
const extractFormFields$1 = (flowComponents) => {
|
|
7916
7096
|
const fields = [];
|
|
7917
7097
|
const process = (comps) => {
|
|
@@ -7947,7 +7127,7 @@ const extractFormFields$1 = (flowComponents) => {
|
|
|
7947
7127
|
* </BaseSignIn>
|
|
7948
7128
|
* ```
|
|
7949
7129
|
*/
|
|
7950
|
-
const BaseSignIn
|
|
7130
|
+
const BaseSignIn = defineComponent({
|
|
7951
7131
|
name: "BaseSignIn",
|
|
7952
7132
|
props: {
|
|
7953
7133
|
additionalData: {
|
|
@@ -8157,7 +7337,7 @@ const BaseSignIn$1 = defineComponent({
|
|
|
8157
7337
|
};
|
|
8158
7338
|
}
|
|
8159
7339
|
});
|
|
8160
|
-
var BaseSignIn_default
|
|
7340
|
+
var BaseSignIn_default = BaseSignIn;
|
|
8161
7341
|
|
|
8162
7342
|
//#endregion
|
|
8163
7343
|
//#region src/utils/oauth.ts
|
|
@@ -8182,7 +7362,7 @@ function initiateOAuthRedirect(redirectURL) {
|
|
|
8182
7362
|
}
|
|
8183
7363
|
|
|
8184
7364
|
//#endregion
|
|
8185
|
-
//#region src/utils/
|
|
7365
|
+
//#region src/utils/passkey.ts
|
|
8186
7366
|
/**
|
|
8187
7367
|
* Handles WebAuthn/Passkey registration flow for browser environments.
|
|
8188
7368
|
*
|
|
@@ -8268,7 +7448,7 @@ const handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8268
7448
|
};
|
|
8269
7449
|
|
|
8270
7450
|
//#endregion
|
|
8271
|
-
//#region src/components/auth/sign-in/
|
|
7451
|
+
//#region src/components/auth/sign-in/SignIn.ts
|
|
8272
7452
|
const EXECUTION_ID_STORAGE_KEY = "thunderid_execution_id";
|
|
8273
7453
|
/**
|
|
8274
7454
|
* SignIn — app-native sign-in component with full flow lifecycle management.
|
|
@@ -8290,7 +7470,7 @@ const EXECUTION_ID_STORAGE_KEY = "thunderid_execution_id";
|
|
|
8290
7470
|
* </SignIn>
|
|
8291
7471
|
* ```
|
|
8292
7472
|
*/
|
|
8293
|
-
const SignIn
|
|
7473
|
+
const SignIn = defineComponent({
|
|
8294
7474
|
name: "SignIn",
|
|
8295
7475
|
props: {
|
|
8296
7476
|
className: {
|
|
@@ -8404,7 +7584,7 @@ const SignIn$1 = defineComponent({
|
|
|
8404
7584
|
flowType: EmbeddedFlowType.Authentication,
|
|
8405
7585
|
...scopes && { scopes }
|
|
8406
7586
|
});
|
|
8407
|
-
if (response.type ===
|
|
7587
|
+
if (response.type === EmbeddedSignInFlowType$1.Redirection) {
|
|
8408
7588
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
8409
7589
|
if (redirectURL && window?.location) {
|
|
8410
7590
|
if (response.executionId) persistExecutionId(response.executionId);
|
|
@@ -8477,7 +7657,7 @@ const SignIn$1 = defineComponent({
|
|
|
8477
7657
|
...payload,
|
|
8478
7658
|
inputs: processedInputs
|
|
8479
7659
|
});
|
|
8480
|
-
if (response.type ===
|
|
7660
|
+
if (response.type === EmbeddedSignInFlowType$1.Redirection) {
|
|
8481
7661
|
const redirectURL = response.data?.redirectURL || response?.redirectURL;
|
|
8482
7662
|
if (redirectURL && window?.location) {
|
|
8483
7663
|
if (response.executionId) persistExecutionId(response.executionId);
|
|
@@ -8505,14 +7685,14 @@ const SignIn$1 = defineComponent({
|
|
|
8505
7685
|
return;
|
|
8506
7686
|
}
|
|
8507
7687
|
const { executionId: normalizedExecutionId, components: normalizedComponents, additionalData: normalizedAdditionalData } = normalizeFlowResponse(response, t, { resolveTranslations: false }, flowMeta.value);
|
|
8508
|
-
if (response.flowStatus ===
|
|
7688
|
+
if (response.flowStatus === EmbeddedSignInFlowStatus$1.Error) {
|
|
8509
7689
|
clearFlowState();
|
|
8510
7690
|
const err = new Error(extractErrorMessage(response, t));
|
|
8511
7691
|
setError(err);
|
|
8512
7692
|
cleanupFlowUrlParams();
|
|
8513
7693
|
throw err;
|
|
8514
7694
|
}
|
|
8515
|
-
if (response.flowStatus ===
|
|
7695
|
+
if (response.flowStatus === EmbeddedSignInFlowStatus$1.Complete) {
|
|
8516
7696
|
const finalRedirectUrl = response?.redirectUrl || response?.redirect_uri || afterSignInUrl;
|
|
8517
7697
|
isSubmitting.value = false;
|
|
8518
7698
|
persistExecutionId(null);
|
|
@@ -8617,9 +7797,9 @@ const SignIn$1 = defineComponent({
|
|
|
8617
7797
|
emit("error", err);
|
|
8618
7798
|
}
|
|
8619
7799
|
}, { deep: true });
|
|
8620
|
-
useOAuthCallback
|
|
8621
|
-
currentExecutionId,
|
|
8622
|
-
|
|
7800
|
+
useOAuthCallback({
|
|
7801
|
+
currentFlowId: currentExecutionId,
|
|
7802
|
+
flowIdStorageKey: EXECUTION_ID_STORAGE_KEY,
|
|
8623
7803
|
isInitialized,
|
|
8624
7804
|
isSubmitting,
|
|
8625
7805
|
onError: (err) => {
|
|
@@ -8629,11 +7809,11 @@ const SignIn$1 = defineComponent({
|
|
|
8629
7809
|
}
|
|
8630
7810
|
},
|
|
8631
7811
|
onSubmit: (payload) => handleSubmit({
|
|
8632
|
-
executionId: payload.
|
|
7812
|
+
executionId: payload.flowId,
|
|
8633
7813
|
inputs: payload.inputs
|
|
8634
7814
|
}),
|
|
8635
7815
|
processedFlag: oauthCodeProcessedFlag,
|
|
8636
|
-
|
|
7816
|
+
setFlowId: persistExecutionId
|
|
8637
7817
|
});
|
|
8638
7818
|
onMounted(async () => {
|
|
8639
7819
|
const urlParams = getUrlParams$1();
|
|
@@ -8673,7 +7853,7 @@ const SignIn$1 = defineComponent({
|
|
|
8673
7853
|
};
|
|
8674
7854
|
return h("div", {}, slots["default"](renderProps));
|
|
8675
7855
|
}
|
|
8676
|
-
return h(BaseSignIn_default
|
|
7856
|
+
return h(BaseSignIn_default, {
|
|
8677
7857
|
...attrs,
|
|
8678
7858
|
additionalData: additionalData.value,
|
|
8679
7859
|
class: props.className,
|
|
@@ -8689,789 +7869,13 @@ const SignIn$1 = defineComponent({
|
|
|
8689
7869
|
};
|
|
8690
7870
|
}
|
|
8691
7871
|
});
|
|
8692
|
-
var SignIn_default
|
|
7872
|
+
var SignIn_default = SignIn;
|
|
8693
7873
|
|
|
8694
7874
|
//#endregion
|
|
8695
|
-
//#region src/
|
|
7875
|
+
//#region src/utils/getAuthComponentHeadings.ts
|
|
8696
7876
|
/**
|
|
8697
|
-
*
|
|
8698
|
-
*
|
|
8699
|
-
* Routes to the V1 (authenticator-based) flow by default or the V2
|
|
8700
|
-
* (component-driven) flow when `platform` is set to `Platform.ThunderID`.
|
|
8701
|
-
*/
|
|
8702
|
-
const SignIn = defineComponent({
|
|
8703
|
-
name: "SignIn",
|
|
8704
|
-
props: {
|
|
8705
|
-
className: {
|
|
8706
|
-
default: "",
|
|
8707
|
-
type: String
|
|
8708
|
-
},
|
|
8709
|
-
size: {
|
|
8710
|
-
default: "medium",
|
|
8711
|
-
type: String
|
|
8712
|
-
},
|
|
8713
|
-
variant: {
|
|
8714
|
-
default: "outlined",
|
|
8715
|
-
type: String
|
|
8716
|
-
}
|
|
8717
|
-
},
|
|
8718
|
-
emits: ["error", "success"],
|
|
8719
|
-
setup(props, { slots, emit, attrs }) {
|
|
8720
|
-
const { platform } = useThunderID_default();
|
|
8721
|
-
return () => {
|
|
8722
|
-
if (platform === Platform.ThunderID) return h(SignIn_default$2, {
|
|
8723
|
-
...attrs,
|
|
8724
|
-
class: props.className,
|
|
8725
|
-
onError: (err) => emit("error", err),
|
|
8726
|
-
onSuccess: (data) => emit("success", data),
|
|
8727
|
-
size: props.size,
|
|
8728
|
-
variant: props.variant
|
|
8729
|
-
}, slots);
|
|
8730
|
-
return h(SignIn_default$1, {
|
|
8731
|
-
...attrs,
|
|
8732
|
-
class: props.className,
|
|
8733
|
-
onError: (err) => emit("error", err),
|
|
8734
|
-
onSuccess: (data) => emit("success", data),
|
|
8735
|
-
size: props.size,
|
|
8736
|
-
variant: props.variant
|
|
8737
|
-
}, slots);
|
|
8738
|
-
};
|
|
8739
|
-
}
|
|
8740
|
-
});
|
|
8741
|
-
var SignIn_default = SignIn;
|
|
8742
|
-
|
|
8743
|
-
//#endregion
|
|
8744
|
-
//#region src/components/auth/sign-in/BaseSignIn.ts
|
|
8745
|
-
/**
|
|
8746
|
-
* BaseSignIn — platform-aware base sign-in component.
|
|
8747
|
-
*
|
|
8748
|
-
* Routes to the V1 (authenticator-based) or V2 (component-driven) BaseSignIn
|
|
8749
|
-
* based on the configured `platform`.
|
|
8750
|
-
*/
|
|
8751
|
-
const BaseSignIn = defineComponent({
|
|
8752
|
-
name: "BaseSignIn",
|
|
8753
|
-
inheritAttrs: false,
|
|
8754
|
-
setup(_props, { attrs, slots }) {
|
|
8755
|
-
const { platform } = useThunderID_default();
|
|
8756
|
-
return () => {
|
|
8757
|
-
if (platform === Platform.ThunderID) return h(BaseSignIn_default$2, { ...attrs }, slots);
|
|
8758
|
-
return h(BaseSignIn_default$1, { ...attrs }, slots);
|
|
8759
|
-
};
|
|
8760
|
-
}
|
|
8761
|
-
});
|
|
8762
|
-
var BaseSignIn_default = BaseSignIn;
|
|
8763
|
-
|
|
8764
|
-
//#endregion
|
|
8765
|
-
//#region src/components/auth/sign-up/v1/options/SignUpOptionFactory.ts
|
|
8766
|
-
/**
|
|
8767
|
-
* Mirrors the logic in `packages/react/.../SignUp/v1/SignUpOptionFactory.tsx` —
|
|
8768
|
-
* renders the V1 flow component shapes (`TYPOGRAPHY`, `INPUT`, `BUTTON`,
|
|
8769
|
-
* `FORM`, `SELECT`, `DIVIDER`, `IMAGE`, `RICH_TEXT`) returned by the ThunderID
|
|
8770
|
-
* `/api/server/v1/flow/execute` endpoint.
|
|
8771
|
-
*
|
|
8772
|
-
* Each leaf component returns a Vue VNode (or null for unknown types). Branch
|
|
8773
|
-
* components (`FORM`) recurse so children render as a flat list.
|
|
8774
|
-
*/
|
|
8775
|
-
/**
|
|
8776
|
-
* Resolve the form-field name for an input component.
|
|
8777
|
-
* ThunderID V1 stores the bound parameter name in `config.identifier` (e.g.
|
|
8778
|
-
* `http://wso2.org/claims/emailaddress`), with `config.name` used as a fallback.
|
|
8779
|
-
*/
|
|
8780
|
-
const getInputName = (component) => {
|
|
8781
|
-
const cfg = component.config || {};
|
|
8782
|
-
return cfg.name || cfg.identifier || component.id;
|
|
8783
|
-
};
|
|
8784
|
-
/**
|
|
8785
|
-
* Map V1 INPUT variants/types to the SDK's internal `FieldType` so the existing
|
|
8786
|
-
* `createField` factory (used by the V1 sign-in flow too) produces the right
|
|
8787
|
-
* primitive (`TextField`, `PasswordField`, `Checkbox`, etc.).
|
|
8788
|
-
*/
|
|
8789
|
-
const inferFieldType = (component) => {
|
|
8790
|
-
const variant = String(component.variant || "").toUpperCase();
|
|
8791
|
-
const cfg = component.config || {};
|
|
8792
|
-
const cfgType = String(cfg.type || "").toLowerCase();
|
|
8793
|
-
if (variant === "EMAIL" || cfgType === "email") return FieldType$1.Email;
|
|
8794
|
-
if (variant === "PASSWORD" || cfgType === "password") return FieldType$1.Password;
|
|
8795
|
-
if (variant === "TELEPHONE" || cfgType === "tel") return FieldType$1.Text;
|
|
8796
|
-
if (variant === "NUMBER" || cfgType === "number") return FieldType$1.Number;
|
|
8797
|
-
if (variant === "DATE" || cfgType === "date") return FieldType$1.Date;
|
|
8798
|
-
if (variant === "CHECKBOX" || cfgType === "checkbox") return FieldType$1.Checkbox;
|
|
8799
|
-
return FieldType$1.Text;
|
|
8800
|
-
};
|
|
8801
|
-
/**
|
|
8802
|
-
* Map TYPOGRAPHY variants (H1-H6, BODY, CAPTION etc.) to the Vue Typography
|
|
8803
|
-
* primitive's variant prop.
|
|
8804
|
-
*/
|
|
8805
|
-
const inferTypographyVariant = (component) => {
|
|
8806
|
-
switch (String(component.variant || "").toUpperCase()) {
|
|
8807
|
-
case "H1": return "h1";
|
|
8808
|
-
case "H2": return "h2";
|
|
8809
|
-
case "H3": return "h3";
|
|
8810
|
-
case "H4": return "h4";
|
|
8811
|
-
case "H5": return "h5";
|
|
8812
|
-
case "H6": return "h6";
|
|
8813
|
-
case "SUBTITLE1": return "subtitle1";
|
|
8814
|
-
case "SUBTITLE2": return "subtitle2";
|
|
8815
|
-
case "BODY2": return "body2";
|
|
8816
|
-
case "CAPTION": return "caption";
|
|
8817
|
-
case "OVERLINE": return "overline";
|
|
8818
|
-
default: return "body1";
|
|
8819
|
-
}
|
|
8820
|
-
};
|
|
8821
|
-
/**
|
|
8822
|
-
* Detect whether a BUTTON looks like a known social-login provider so we can
|
|
8823
|
-
* render a branded button (matches the React V1 factory's behaviour).
|
|
8824
|
-
*/
|
|
8825
|
-
const matchesSocialProvider = (component, provider) => {
|
|
8826
|
-
const text = String(component?.config?.text || component?.config?.label || "").toLowerCase();
|
|
8827
|
-
return String(component?.variant || "").toUpperCase() === "SOCIAL" && text.includes(provider);
|
|
8828
|
-
};
|
|
8829
|
-
/**
|
|
8830
|
-
* Build a VNode for a single V1 flow component. Returns `null` for unknown
|
|
8831
|
-
* types (caller filters these out).
|
|
8832
|
-
*/
|
|
8833
|
-
const createSignUpComponent = (props) => {
|
|
8834
|
-
const { component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, onSubmit, inputClassName, buttonClassName } = props;
|
|
8835
|
-
const cfg = component.config || {};
|
|
8836
|
-
switch (component.type) {
|
|
8837
|
-
case EmbeddedFlowComponentType$1.Typography: {
|
|
8838
|
-
const text = String(cfg.text || cfg.label || "");
|
|
8839
|
-
return h(Typography_default, {
|
|
8840
|
-
style: "margin-bottom:0.5rem",
|
|
8841
|
-
variant: inferTypographyVariant(component)
|
|
8842
|
-
}, { default: () => text });
|
|
8843
|
-
}
|
|
8844
|
-
case EmbeddedFlowComponentType$1.Input: {
|
|
8845
|
-
const name = getInputName(component);
|
|
8846
|
-
const fieldType = inferFieldType(component);
|
|
8847
|
-
const value = formValues[name] || "";
|
|
8848
|
-
const isTouched = touchedFields[name] || false;
|
|
8849
|
-
return createField({
|
|
8850
|
-
className: inputClassName,
|
|
8851
|
-
disabled: isLoading,
|
|
8852
|
-
error: isTouched ? formErrors[name] : void 0,
|
|
8853
|
-
label: String(cfg.label || ""),
|
|
8854
|
-
name,
|
|
8855
|
-
onChange: (newValue) => onInputChange(name, newValue),
|
|
8856
|
-
placeholder: String(cfg.placeholder || ""),
|
|
8857
|
-
required: Boolean(cfg.required),
|
|
8858
|
-
touched: isTouched,
|
|
8859
|
-
type: fieldType,
|
|
8860
|
-
value
|
|
8861
|
-
});
|
|
8862
|
-
}
|
|
8863
|
-
case EmbeddedFlowComponentType$1.Button: {
|
|
8864
|
-
const text = String(cfg.text || cfg.label || "Submit");
|
|
8865
|
-
const isPrimary = String(component.variant || "PRIMARY").toUpperCase() === "PRIMARY";
|
|
8866
|
-
const handleClick = () => onSubmit(component, void 0);
|
|
8867
|
-
if (matchesSocialProvider(component, "google")) return h(GoogleButton_default, {
|
|
8868
|
-
class: buttonClassName,
|
|
8869
|
-
isLoading,
|
|
8870
|
-
onClick: handleClick
|
|
8871
|
-
});
|
|
8872
|
-
if (matchesSocialProvider(component, "github")) return h(GitHubButton_default, {
|
|
8873
|
-
class: buttonClassName,
|
|
8874
|
-
isLoading,
|
|
8875
|
-
onClick: handleClick
|
|
8876
|
-
});
|
|
8877
|
-
if (matchesSocialProvider(component, "microsoft")) return h(MicrosoftButton_default, {
|
|
8878
|
-
class: buttonClassName,
|
|
8879
|
-
isLoading,
|
|
8880
|
-
onClick: handleClick
|
|
8881
|
-
});
|
|
8882
|
-
if (matchesSocialProvider(component, "facebook")) return h(FacebookButton_default, {
|
|
8883
|
-
class: buttonClassName,
|
|
8884
|
-
isLoading,
|
|
8885
|
-
onClick: handleClick
|
|
8886
|
-
});
|
|
8887
|
-
return h(Button_default, {
|
|
8888
|
-
class: buttonClassName,
|
|
8889
|
-
color: isPrimary ? "primary" : "secondary",
|
|
8890
|
-
"data-testid": "thunderid-signup-submit",
|
|
8891
|
-
disabled: isLoading || !isFormValid && cfg.type === "submit",
|
|
8892
|
-
fullWidth: true,
|
|
8893
|
-
loading: isLoading,
|
|
8894
|
-
onClick: handleClick,
|
|
8895
|
-
type: cfg.type === "submit" ? "submit" : "button",
|
|
8896
|
-
variant: isPrimary ? "solid" : "outline"
|
|
8897
|
-
}, { default: () => text });
|
|
8898
|
-
}
|
|
8899
|
-
case EmbeddedFlowComponentType$1.Form: {
|
|
8900
|
-
const children = component.components || [];
|
|
8901
|
-
const nodes = [];
|
|
8902
|
-
children.forEach((child) => {
|
|
8903
|
-
const rendered = createSignUpComponent({
|
|
8904
|
-
...props,
|
|
8905
|
-
component: child
|
|
8906
|
-
});
|
|
8907
|
-
if (rendered === null) return;
|
|
8908
|
-
if (Array.isArray(rendered)) nodes.push(...rendered);
|
|
8909
|
-
else nodes.push(rendered);
|
|
8910
|
-
});
|
|
8911
|
-
return nodes;
|
|
8912
|
-
}
|
|
8913
|
-
case EmbeddedFlowComponentType$1.Divider: return h("hr", {
|
|
8914
|
-
class: "thunderid-signup__divider",
|
|
8915
|
-
style: "margin:0.75rem 0;border:0;border-top:1px solid #e5e7eb"
|
|
8916
|
-
});
|
|
8917
|
-
case EmbeddedFlowComponentType$1.Image: {
|
|
8918
|
-
const src = String(cfg.src || cfg.url || "");
|
|
8919
|
-
const alt = String(cfg.alt || "");
|
|
8920
|
-
if (!src) return null;
|
|
8921
|
-
return h("img", {
|
|
8922
|
-
alt,
|
|
8923
|
-
src,
|
|
8924
|
-
style: "max-width:100%;height:auto;display:block;margin:0.5rem auto"
|
|
8925
|
-
});
|
|
8926
|
-
}
|
|
8927
|
-
default:
|
|
8928
|
-
if (String(component.type).toUpperCase() === "RICH_TEXT") return h("div", {
|
|
8929
|
-
class: "thunderid-signup__rich-text",
|
|
8930
|
-
innerHTML: String(cfg.text || cfg.label || "")
|
|
8931
|
-
});
|
|
8932
|
-
return null;
|
|
8933
|
-
}
|
|
8934
|
-
};
|
|
8935
|
-
/**
|
|
8936
|
-
* Render an array of V1 flow components as Vue VNodes, flattening nested
|
|
8937
|
-
* containers (FORM) into a single list.
|
|
8938
|
-
*/
|
|
8939
|
-
const renderSignUpComponents$1 = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, onSubmit, options) => {
|
|
8940
|
-
const result = [];
|
|
8941
|
-
components.forEach((component) => {
|
|
8942
|
-
const rendered = createSignUpComponent({
|
|
8943
|
-
buttonClassName: options?.buttonClassName,
|
|
8944
|
-
component,
|
|
8945
|
-
formErrors,
|
|
8946
|
-
formValues,
|
|
8947
|
-
inputClassName: options?.inputClassName,
|
|
8948
|
-
isFormValid,
|
|
8949
|
-
isLoading,
|
|
8950
|
-
onInputChange,
|
|
8951
|
-
onSubmit,
|
|
8952
|
-
size: options?.size,
|
|
8953
|
-
touchedFields
|
|
8954
|
-
});
|
|
8955
|
-
if (rendered === null) return;
|
|
8956
|
-
if (Array.isArray(rendered)) result.push(...rendered);
|
|
8957
|
-
else result.push(rendered);
|
|
8958
|
-
});
|
|
8959
|
-
return result;
|
|
8960
|
-
};
|
|
8961
|
-
|
|
8962
|
-
//#endregion
|
|
8963
|
-
//#region src/components/auth/sign-up/v1/BaseSignUp.ts
|
|
8964
|
-
const logger$2 = createVueLogger("BaseSignUpV1");
|
|
8965
|
-
/**
|
|
8966
|
-
* V1 BaseSignUp — component-driven app-native sign-up for Vue.
|
|
8967
|
-
*
|
|
8968
|
-
* Mirrors `packages/react/.../SignUp/v1/BaseSignUp.tsx`. Reads the
|
|
8969
|
-
* `/api/server/v1/flow/execute` response shape (`TYPOGRAPHY`, `FORM`, `INPUT`,
|
|
8970
|
-
* `BUTTON`, `RICH_TEXT`, etc.) and renders it via the V1
|
|
8971
|
-
* `SignUpOptionFactory`. Tracks form state internally and submits steps via
|
|
8972
|
-
* the `onSubmit` prop until the flow completes.
|
|
8973
|
-
*/
|
|
8974
|
-
const BaseSignUp$2 = defineComponent({
|
|
8975
|
-
name: "BaseSignUpV1",
|
|
8976
|
-
props: {
|
|
8977
|
-
afterSignUpUrl: {
|
|
8978
|
-
default: void 0,
|
|
8979
|
-
type: String
|
|
8980
|
-
},
|
|
8981
|
-
buttonClassName: {
|
|
8982
|
-
default: "",
|
|
8983
|
-
type: String
|
|
8984
|
-
},
|
|
8985
|
-
className: {
|
|
8986
|
-
default: "",
|
|
8987
|
-
type: String
|
|
8988
|
-
},
|
|
8989
|
-
errorClassName: {
|
|
8990
|
-
default: "",
|
|
8991
|
-
type: String
|
|
8992
|
-
},
|
|
8993
|
-
inputClassName: {
|
|
8994
|
-
default: "",
|
|
8995
|
-
type: String
|
|
8996
|
-
},
|
|
8997
|
-
isInitialized: {
|
|
8998
|
-
default: true,
|
|
8999
|
-
type: Boolean
|
|
9000
|
-
},
|
|
9001
|
-
messageClassName: {
|
|
9002
|
-
default: "",
|
|
9003
|
-
type: String
|
|
9004
|
-
},
|
|
9005
|
-
onComplete: {
|
|
9006
|
-
default: void 0,
|
|
9007
|
-
type: Function
|
|
9008
|
-
},
|
|
9009
|
-
onError: {
|
|
9010
|
-
default: void 0,
|
|
9011
|
-
type: Function
|
|
9012
|
-
},
|
|
9013
|
-
onFlowChange: {
|
|
9014
|
-
default: void 0,
|
|
9015
|
-
type: Function
|
|
9016
|
-
},
|
|
9017
|
-
onInitialize: {
|
|
9018
|
-
default: void 0,
|
|
9019
|
-
type: Function
|
|
9020
|
-
},
|
|
9021
|
-
onSubmit: {
|
|
9022
|
-
default: void 0,
|
|
9023
|
-
type: Function
|
|
9024
|
-
},
|
|
9025
|
-
shouldRedirectAfterSignUp: {
|
|
9026
|
-
default: true,
|
|
9027
|
-
type: Boolean
|
|
9028
|
-
},
|
|
9029
|
-
showLogo: {
|
|
9030
|
-
default: true,
|
|
9031
|
-
type: Boolean
|
|
9032
|
-
},
|
|
9033
|
-
showSubtitle: {
|
|
9034
|
-
default: true,
|
|
9035
|
-
type: Boolean
|
|
9036
|
-
},
|
|
9037
|
-
showTitle: {
|
|
9038
|
-
default: true,
|
|
9039
|
-
type: Boolean
|
|
9040
|
-
},
|
|
9041
|
-
size: {
|
|
9042
|
-
default: "medium",
|
|
9043
|
-
type: String
|
|
9044
|
-
},
|
|
9045
|
-
variant: {
|
|
9046
|
-
default: "outlined",
|
|
9047
|
-
type: String
|
|
9048
|
-
}
|
|
9049
|
-
},
|
|
9050
|
-
emits: [
|
|
9051
|
-
"error",
|
|
9052
|
-
"flowChange",
|
|
9053
|
-
"complete"
|
|
9054
|
-
],
|
|
9055
|
-
setup(props, { slots, emit }) {
|
|
9056
|
-
const { t } = useI18n_default();
|
|
9057
|
-
const { title: flowTitle, subtitle: flowSubtitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
9058
|
-
const isLoading = ref(false);
|
|
9059
|
-
const isFlowInitialized = ref(false);
|
|
9060
|
-
const currentFlow = ref(null);
|
|
9061
|
-
const formValues = ref({});
|
|
9062
|
-
const touchedFields = ref({});
|
|
9063
|
-
const formErrors = ref({});
|
|
9064
|
-
let initializationAttempted = false;
|
|
9065
|
-
const handleError = (err) => {
|
|
9066
|
-
let errorMessage = t("errors.signup.flow.failure") || "Sign-up failed";
|
|
9067
|
-
if (err && typeof err === "object") {
|
|
9068
|
-
if (err.code && (err.message || err.description)) errorMessage = err.description || err.message;
|
|
9069
|
-
else if (err.message) errorMessage = err.message;
|
|
9070
|
-
} else if (typeof err === "string") errorMessage = err;
|
|
9071
|
-
clearMessages();
|
|
9072
|
-
addMessage({
|
|
9073
|
-
message: errorMessage,
|
|
9074
|
-
type: "error"
|
|
9075
|
-
});
|
|
9076
|
-
};
|
|
9077
|
-
/**
|
|
9078
|
-
* Walk the V1 component tree and collect every INPUT's bound parameter
|
|
9079
|
-
* name. The parameter name comes from `config.identifier` (a SCIM claim
|
|
9080
|
-
* URI) or `config.name`, falling back to the component id.
|
|
9081
|
-
*/
|
|
9082
|
-
const collectInputNames = (components) => {
|
|
9083
|
-
const names = [];
|
|
9084
|
-
const walk = (comps) => {
|
|
9085
|
-
comps.forEach((component) => {
|
|
9086
|
-
const cfg = component.config || {};
|
|
9087
|
-
if (component.type === EmbeddedFlowComponentType$1.Input) {
|
|
9088
|
-
const name = cfg.name || cfg.identifier || component.id;
|
|
9089
|
-
if (name) names.push(name);
|
|
9090
|
-
}
|
|
9091
|
-
const children = component.components || [];
|
|
9092
|
-
if (children.length > 0) walk(children);
|
|
9093
|
-
});
|
|
9094
|
-
};
|
|
9095
|
-
walk(components);
|
|
9096
|
-
return names;
|
|
9097
|
-
};
|
|
9098
|
-
const setupFormFields = (response) => {
|
|
9099
|
-
const names = collectInputNames(response.data?.components || []);
|
|
9100
|
-
const initial = {};
|
|
9101
|
-
names.forEach((name) => {
|
|
9102
|
-
initial[name] = "";
|
|
9103
|
-
});
|
|
9104
|
-
formValues.value = initial;
|
|
9105
|
-
touchedFields.value = {};
|
|
9106
|
-
formErrors.value = {};
|
|
9107
|
-
};
|
|
9108
|
-
const handleInputChange = (name, value) => {
|
|
9109
|
-
formValues.value = {
|
|
9110
|
-
...formValues.value,
|
|
9111
|
-
[name]: value
|
|
9112
|
-
};
|
|
9113
|
-
touchedFields.value = {
|
|
9114
|
-
...touchedFields.value,
|
|
9115
|
-
[name]: true
|
|
9116
|
-
};
|
|
9117
|
-
if (formErrors.value[name]) {
|
|
9118
|
-
const next = { ...formErrors.value };
|
|
9119
|
-
delete next[name];
|
|
9120
|
-
formErrors.value = next;
|
|
9121
|
-
}
|
|
9122
|
-
};
|
|
9123
|
-
const isFormValid = () => Object.keys(formErrors.value).length === 0;
|
|
9124
|
-
/**
|
|
9125
|
-
* Mirror the React V1 popup-based redirection handler for social/IdP
|
|
9126
|
-
* registration steps. Opens a popup, waits for the OAuth code, and submits
|
|
9127
|
-
* `{code, state}` as the next flow step.
|
|
9128
|
-
*
|
|
9129
|
-
* Returns `true` if redirection was handled (caller should not fall
|
|
9130
|
-
* through), `false` otherwise.
|
|
9131
|
-
*/
|
|
9132
|
-
const handleRedirectionIfNeeded = (response) => {
|
|
9133
|
-
if (response?.type !== EmbeddedFlowResponseType.Redirection || !response?.data?.redirectURL) return false;
|
|
9134
|
-
if (typeof window === "undefined") return false;
|
|
9135
|
-
const redirectUrl = response.data.redirectURL;
|
|
9136
|
-
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
9137
|
-
if (!popup) {
|
|
9138
|
-
logger$2.error("Failed to open popup window for social sign-up redirect");
|
|
9139
|
-
return false;
|
|
9140
|
-
}
|
|
9141
|
-
let processed = false;
|
|
9142
|
-
let popupMonitor;
|
|
9143
|
-
let messageHandler;
|
|
9144
|
-
const cleanup = () => {
|
|
9145
|
-
window.removeEventListener("message", messageHandler);
|
|
9146
|
-
if (popupMonitor) clearInterval(popupMonitor);
|
|
9147
|
-
};
|
|
9148
|
-
const continueWithCode = async (code, state) => {
|
|
9149
|
-
const payload = {
|
|
9150
|
-
...currentFlow.value?.flowId && { flowId: currentFlow.value.flowId },
|
|
9151
|
-
actionId: "",
|
|
9152
|
-
flowType: currentFlow.value?.flowType || "REGISTRATION",
|
|
9153
|
-
inputs: {
|
|
9154
|
-
code,
|
|
9155
|
-
state
|
|
9156
|
-
}
|
|
9157
|
-
};
|
|
9158
|
-
try {
|
|
9159
|
-
const next = await props.onSubmit(payload);
|
|
9160
|
-
props.onFlowChange?.(next);
|
|
9161
|
-
emit("flowChange", next);
|
|
9162
|
-
if (next.flowStatus === EmbeddedFlowStatus.Complete) {
|
|
9163
|
-
props.onComplete?.(next);
|
|
9164
|
-
emit("complete", next);
|
|
9165
|
-
} else if (next.flowStatus === EmbeddedFlowStatus.Incomplete) {
|
|
9166
|
-
currentFlow.value = next;
|
|
9167
|
-
setupFormFields(next);
|
|
9168
|
-
}
|
|
9169
|
-
} catch (err) {
|
|
9170
|
-
handleError(err);
|
|
9171
|
-
props.onError?.(err);
|
|
9172
|
-
emit("error", err);
|
|
9173
|
-
} finally {
|
|
9174
|
-
popup.close();
|
|
9175
|
-
cleanup();
|
|
9176
|
-
}
|
|
9177
|
-
};
|
|
9178
|
-
messageHandler = async (event) => {
|
|
9179
|
-
if (event.source !== popup) return;
|
|
9180
|
-
const expectedOrigin = props.afterSignUpUrl ? new URL(props.afterSignUpUrl).origin : window.location.origin;
|
|
9181
|
-
if (event.origin !== expectedOrigin && event.origin !== window.location.origin) return;
|
|
9182
|
-
const { code, state } = event.data || {};
|
|
9183
|
-
if (code && state && !processed) {
|
|
9184
|
-
processed = true;
|
|
9185
|
-
await continueWithCode(code, state);
|
|
9186
|
-
}
|
|
9187
|
-
};
|
|
9188
|
-
window.addEventListener("message", messageHandler);
|
|
9189
|
-
popupMonitor = setInterval(async () => {
|
|
9190
|
-
try {
|
|
9191
|
-
if (popup.closed) {
|
|
9192
|
-
cleanup();
|
|
9193
|
-
return;
|
|
9194
|
-
}
|
|
9195
|
-
if (processed) return;
|
|
9196
|
-
let popupUrl;
|
|
9197
|
-
try {
|
|
9198
|
-
popupUrl = popup.location.href;
|
|
9199
|
-
} catch {
|
|
9200
|
-
return;
|
|
9201
|
-
}
|
|
9202
|
-
if (!popupUrl) return;
|
|
9203
|
-
if (popupUrl.includes("code=") || popupUrl.includes("error=")) {
|
|
9204
|
-
const url = new URL(popupUrl);
|
|
9205
|
-
const code = url.searchParams.get("code");
|
|
9206
|
-
const state = url.searchParams.get("state");
|
|
9207
|
-
const error = url.searchParams.get("error");
|
|
9208
|
-
if (error) {
|
|
9209
|
-
processed = true;
|
|
9210
|
-
logger$2.error(`OAuth error during social sign-up: ${error}`);
|
|
9211
|
-
popup.close();
|
|
9212
|
-
cleanup();
|
|
9213
|
-
return;
|
|
9214
|
-
}
|
|
9215
|
-
if (code && state) {
|
|
9216
|
-
processed = true;
|
|
9217
|
-
await continueWithCode(code, state);
|
|
9218
|
-
}
|
|
9219
|
-
}
|
|
9220
|
-
} catch (err) {
|
|
9221
|
-
logger$2.error("Error monitoring sign-up popup");
|
|
9222
|
-
}
|
|
9223
|
-
}, 1e3);
|
|
9224
|
-
return true;
|
|
9225
|
-
};
|
|
9226
|
-
const handleSubmit = async (component, data) => {
|
|
9227
|
-
if (!currentFlow.value) return;
|
|
9228
|
-
isLoading.value = true;
|
|
9229
|
-
clearMessages();
|
|
9230
|
-
try {
|
|
9231
|
-
const filteredInputs = {};
|
|
9232
|
-
const sourceInputs = data ?? formValues.value;
|
|
9233
|
-
Object.entries(sourceInputs).forEach(([key, value]) => {
|
|
9234
|
-
if (value !== null && value !== void 0 && value !== "") filteredInputs[key] = value;
|
|
9235
|
-
});
|
|
9236
|
-
const actionId = component?.actionId || component?.id;
|
|
9237
|
-
const payload = {
|
|
9238
|
-
...currentFlow.value.flowId && { flowId: currentFlow.value.flowId },
|
|
9239
|
-
flowType: currentFlow.value.flowType || "REGISTRATION",
|
|
9240
|
-
inputs: filteredInputs,
|
|
9241
|
-
...actionId && { actionId }
|
|
9242
|
-
};
|
|
9243
|
-
const response = await props.onSubmit(payload);
|
|
9244
|
-
props.onFlowChange?.(response);
|
|
9245
|
-
emit("flowChange", response);
|
|
9246
|
-
if (response?.flowStatus === EmbeddedFlowStatus.Complete) {
|
|
9247
|
-
props.onComplete?.(response);
|
|
9248
|
-
emit("complete", response);
|
|
9249
|
-
return;
|
|
9250
|
-
}
|
|
9251
|
-
if (response?.flowStatus === EmbeddedFlowStatus.Incomplete) {
|
|
9252
|
-
if (handleRedirectionIfNeeded(response)) return;
|
|
9253
|
-
currentFlow.value = response;
|
|
9254
|
-
setupFormFields(response);
|
|
9255
|
-
}
|
|
9256
|
-
} catch (err) {
|
|
9257
|
-
handleError(err);
|
|
9258
|
-
props.onError?.(err);
|
|
9259
|
-
emit("error", err);
|
|
9260
|
-
} finally {
|
|
9261
|
-
isLoading.value = false;
|
|
9262
|
-
}
|
|
9263
|
-
};
|
|
9264
|
-
watch(() => [props.isInitialized, isFlowInitialized.value], ([initialized, flowInit]) => {
|
|
9265
|
-
if (!initialized || flowInit || initializationAttempted) return;
|
|
9266
|
-
if (!props.onInitialize) return;
|
|
9267
|
-
initializationAttempted = true;
|
|
9268
|
-
(async () => {
|
|
9269
|
-
isLoading.value = true;
|
|
9270
|
-
clearMessages();
|
|
9271
|
-
try {
|
|
9272
|
-
const response = await props.onInitialize();
|
|
9273
|
-
currentFlow.value = response;
|
|
9274
|
-
isFlowInitialized.value = true;
|
|
9275
|
-
props.onFlowChange?.(response);
|
|
9276
|
-
emit("flowChange", response);
|
|
9277
|
-
if (response?.flowStatus === EmbeddedFlowStatus.Complete) {
|
|
9278
|
-
props.onComplete?.(response);
|
|
9279
|
-
emit("complete", response);
|
|
9280
|
-
return;
|
|
9281
|
-
}
|
|
9282
|
-
if (response?.flowStatus === EmbeddedFlowStatus.Incomplete) setupFormFields(response);
|
|
9283
|
-
} catch (err) {
|
|
9284
|
-
handleError(err);
|
|
9285
|
-
props.onError?.(err);
|
|
9286
|
-
emit("error", err);
|
|
9287
|
-
} finally {
|
|
9288
|
-
isLoading.value = false;
|
|
9289
|
-
}
|
|
9290
|
-
})();
|
|
9291
|
-
}, { immediate: true });
|
|
9292
|
-
return () => {
|
|
9293
|
-
const containerClass = [
|
|
9294
|
-
withVendorCSSClassPrefix("signup"),
|
|
9295
|
-
withVendorCSSClassPrefix(`signup--${props.size}`),
|
|
9296
|
-
withVendorCSSClassPrefix(`signup--${props.variant}`),
|
|
9297
|
-
props.className
|
|
9298
|
-
].filter(Boolean).join(" ");
|
|
9299
|
-
if (slots["default"]) {
|
|
9300
|
-
const renderProps = {
|
|
9301
|
-
components: currentFlow.value?.data?.components || [],
|
|
9302
|
-
errors: formErrors.value,
|
|
9303
|
-
handleInputChange,
|
|
9304
|
-
handleSubmit,
|
|
9305
|
-
isLoading: isLoading.value,
|
|
9306
|
-
isValid: isFormValid(),
|
|
9307
|
-
messages: flowMessages.value || [],
|
|
9308
|
-
subtitle: flowSubtitle.value || t("signup.subheading") || "",
|
|
9309
|
-
title: flowTitle.value || t("signup.heading") || "",
|
|
9310
|
-
touched: touchedFields.value,
|
|
9311
|
-
values: formValues.value
|
|
9312
|
-
};
|
|
9313
|
-
return h("div", { class: containerClass }, slots["default"](renderProps));
|
|
9314
|
-
}
|
|
9315
|
-
if (!isFlowInitialized.value && isLoading.value) return h(Card_default, {
|
|
9316
|
-
class: containerClass,
|
|
9317
|
-
variant: props.variant
|
|
9318
|
-
}, () => h("div", { style: "display:flex;justify-content:center;padding:2rem" }, h(Spinner_default)));
|
|
9319
|
-
if (!currentFlow.value) return h(Card_default, {
|
|
9320
|
-
class: containerClass,
|
|
9321
|
-
variant: props.variant
|
|
9322
|
-
}, () => h(Alert_default, { variant: "error" }, () => t("errors.signup.flow.initialization.failure") || "Failed to initialize sign-up flow"));
|
|
9323
|
-
const rendered = renderSignUpComponents$1(currentFlow.value.data?.components || [], formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid(), handleInputChange, handleSubmit, {
|
|
9324
|
-
buttonClassName: props.buttonClassName,
|
|
9325
|
-
inputClassName: props.inputClassName,
|
|
9326
|
-
size: props.size
|
|
9327
|
-
});
|
|
9328
|
-
const cardChildren = [];
|
|
9329
|
-
if (props.showLogo) cardChildren.push(h("div", { style: "display:flex;justify-content:center;margin-bottom:1rem" }, [h(Logo_default)]));
|
|
9330
|
-
if (props.showTitle || props.showSubtitle) {
|
|
9331
|
-
const headerChildren = [];
|
|
9332
|
-
if (props.showTitle) headerChildren.push(h(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signup.heading") || "Sign Up" }));
|
|
9333
|
-
if (props.showSubtitle) headerChildren.push(h(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signup.subheading") || "Create your account" }));
|
|
9334
|
-
cardChildren.push(h("div", { style: "padding: 0 1rem 1rem" }, headerChildren));
|
|
9335
|
-
}
|
|
9336
|
-
if (flowMessages.value && flowMessages.value.length > 0) cardChildren.push(h("div", { style: "padding: 0 1rem" }, flowMessages.value.map((msg, i) => h(Alert_default, {
|
|
9337
|
-
class: props.messageClassName,
|
|
9338
|
-
key: msg.id || i,
|
|
9339
|
-
variant: msg.type?.toLowerCase() === "error" ? "error" : "info"
|
|
9340
|
-
}, () => msg.message))));
|
|
9341
|
-
cardChildren.push(h("form", {
|
|
9342
|
-
class: withVendorCSSClassPrefix("signup__form"),
|
|
9343
|
-
onSubmit: (e) => {
|
|
9344
|
-
e.preventDefault();
|
|
9345
|
-
handleSubmit({
|
|
9346
|
-
config: { type: "submit" },
|
|
9347
|
-
type: "BUTTON"
|
|
9348
|
-
});
|
|
9349
|
-
},
|
|
9350
|
-
style: "padding: 1rem;display:flex;flex-direction:column;gap:0.75rem"
|
|
9351
|
-
}, rendered.length > 0 ? rendered : [h(Alert_default, { variant: "warning" }, () => t("errors.signup.components.not.available") || "No components available")]));
|
|
9352
|
-
return h(Card_default, {
|
|
9353
|
-
class: containerClass,
|
|
9354
|
-
variant: props.variant
|
|
9355
|
-
}, () => cardChildren);
|
|
9356
|
-
};
|
|
9357
|
-
}
|
|
9358
|
-
});
|
|
9359
|
-
var BaseSignUp_default$1 = BaseSignUp$2;
|
|
9360
|
-
|
|
9361
|
-
//#endregion
|
|
9362
|
-
//#region src/components/auth/sign-up/v1/SignUp.ts
|
|
9363
|
-
/**
|
|
9364
|
-
* V1 SignUp container — wires `useThunderID().signUp` into `BaseSignUpV1` and
|
|
9365
|
-
* handles redirects after the flow completes.
|
|
9366
|
-
*
|
|
9367
|
-
* Mirrors `sign-up/v2/.../SignUp.ts` but invokes the V1 base component which
|
|
9368
|
-
* understands the `TYPOGRAPHY` / `INPUT` / `BUTTON` / `FORM` shapes returned by
|
|
9369
|
-
* the V1 flow API.
|
|
9370
|
-
*/
|
|
9371
|
-
const SignUp$2 = defineComponent({
|
|
9372
|
-
name: "SignUpV1",
|
|
9373
|
-
props: {
|
|
9374
|
-
afterSignUpUrl: {
|
|
9375
|
-
default: void 0,
|
|
9376
|
-
type: String
|
|
9377
|
-
},
|
|
9378
|
-
buttonClassName: {
|
|
9379
|
-
default: "",
|
|
9380
|
-
type: String
|
|
9381
|
-
},
|
|
9382
|
-
className: {
|
|
9383
|
-
default: "",
|
|
9384
|
-
type: String
|
|
9385
|
-
},
|
|
9386
|
-
errorClassName: {
|
|
9387
|
-
default: "",
|
|
9388
|
-
type: String
|
|
9389
|
-
},
|
|
9390
|
-
inputClassName: {
|
|
9391
|
-
default: "",
|
|
9392
|
-
type: String
|
|
9393
|
-
},
|
|
9394
|
-
messageClassName: {
|
|
9395
|
-
default: "",
|
|
9396
|
-
type: String
|
|
9397
|
-
},
|
|
9398
|
-
onComplete: {
|
|
9399
|
-
default: void 0,
|
|
9400
|
-
type: Function
|
|
9401
|
-
},
|
|
9402
|
-
onError: {
|
|
9403
|
-
default: void 0,
|
|
9404
|
-
type: Function
|
|
9405
|
-
},
|
|
9406
|
-
shouldRedirectAfterSignUp: {
|
|
9407
|
-
default: true,
|
|
9408
|
-
type: Boolean
|
|
9409
|
-
},
|
|
9410
|
-
showSubtitle: {
|
|
9411
|
-
default: true,
|
|
9412
|
-
type: Boolean
|
|
9413
|
-
},
|
|
9414
|
-
showTitle: {
|
|
9415
|
-
default: true,
|
|
9416
|
-
type: Boolean
|
|
9417
|
-
},
|
|
9418
|
-
size: {
|
|
9419
|
-
default: "medium",
|
|
9420
|
-
type: String
|
|
9421
|
-
},
|
|
9422
|
-
variant: {
|
|
9423
|
-
default: "outlined",
|
|
9424
|
-
type: String
|
|
9425
|
-
}
|
|
9426
|
-
},
|
|
9427
|
-
setup(props, { slots }) {
|
|
9428
|
-
const { signUp, isInitialized, applicationId } = useThunderID_default();
|
|
9429
|
-
const handleInitialize = async (payload) => {
|
|
9430
|
-
const applicationIdFromUrl = typeof window !== "undefined" ? new URL(window.location.href).searchParams.get("applicationId") : null;
|
|
9431
|
-
const effectiveApplicationId = applicationId || applicationIdFromUrl || void 0;
|
|
9432
|
-
return await signUp(payload || {
|
|
9433
|
-
flowType: EmbeddedFlowType.Registration,
|
|
9434
|
-
...effectiveApplicationId && { applicationId: effectiveApplicationId }
|
|
9435
|
-
});
|
|
9436
|
-
};
|
|
9437
|
-
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
9438
|
-
const handleComplete = (response) => {
|
|
9439
|
-
props.onComplete?.(response);
|
|
9440
|
-
const oauthRedirectUrl = response?.redirectUrl;
|
|
9441
|
-
if (props.shouldRedirectAfterSignUp && oauthRedirectUrl) {
|
|
9442
|
-
if (typeof window !== "undefined") window.location.href = oauthRedirectUrl;
|
|
9443
|
-
return;
|
|
9444
|
-
}
|
|
9445
|
-
if (props.shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType.Redirection && props.afterSignUpUrl) {
|
|
9446
|
-
if (typeof window !== "undefined") window.location.href = props.afterSignUpUrl;
|
|
9447
|
-
}
|
|
9448
|
-
};
|
|
9449
|
-
return () => h(BaseSignUp_default$1, {
|
|
9450
|
-
afterSignUpUrl: props.afterSignUpUrl,
|
|
9451
|
-
buttonClassName: props.buttonClassName,
|
|
9452
|
-
className: props.className,
|
|
9453
|
-
errorClassName: props.errorClassName,
|
|
9454
|
-
inputClassName: props.inputClassName,
|
|
9455
|
-
isInitialized: isInitialized?.value ?? false,
|
|
9456
|
-
messageClassName: props.messageClassName,
|
|
9457
|
-
onComplete: handleComplete,
|
|
9458
|
-
onError: props.onError,
|
|
9459
|
-
onInitialize: handleInitialize,
|
|
9460
|
-
onSubmit: handleOnSubmit,
|
|
9461
|
-
showSubtitle: props.showSubtitle,
|
|
9462
|
-
showTitle: props.showTitle,
|
|
9463
|
-
size: props.size,
|
|
9464
|
-
variant: props.variant
|
|
9465
|
-
}, slots["default"] ? { default: (renderProps) => slots["default"](renderProps) } : void 0);
|
|
9466
|
-
}
|
|
9467
|
-
});
|
|
9468
|
-
var SignUp_default$1 = SignUp$2;
|
|
9469
|
-
|
|
9470
|
-
//#endregion
|
|
9471
|
-
//#region src/utils/v2/getAuthComponentHeadings.ts
|
|
9472
|
-
/**
|
|
9473
|
-
* Extracts heading and subheading components from authentication flow components
|
|
9474
|
-
* and provides resolved title/subtitle text with fallback logic.
|
|
7877
|
+
* Extracts heading and subheading components from authentication flow components
|
|
7878
|
+
* and provides resolved title/subtitle text with fallback logic.
|
|
9475
7879
|
*/
|
|
9476
7880
|
const getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTitle, defaultSubtitle) => {
|
|
9477
7881
|
let heading = null;
|
|
@@ -9531,13 +7935,13 @@ const getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTi
|
|
|
9531
7935
|
var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
9532
7936
|
|
|
9533
7937
|
//#endregion
|
|
9534
|
-
//#region src/components/auth/sign-up/
|
|
7938
|
+
//#region src/components/auth/sign-up/BaseSignUp.ts
|
|
9535
7939
|
const logger$1 = createVueLogger("BaseSignUp");
|
|
9536
7940
|
const extractFormFields = (components) => {
|
|
9537
7941
|
const fields = [];
|
|
9538
7942
|
const process = (comps) => {
|
|
9539
7943
|
comps.forEach((c) => {
|
|
9540
|
-
if (c.type ===
|
|
7944
|
+
if (c.type === EmbeddedFlowComponentType$1.TextInput || c.type === EmbeddedFlowComponentType$1.PasswordInput || c.type === EmbeddedFlowComponentType$1.EmailInput || c.type === EmbeddedFlowComponentType$1.Select) {
|
|
9541
7945
|
const fieldName = c.ref || c.id;
|
|
9542
7946
|
fields.push({
|
|
9543
7947
|
name: fieldName,
|
|
@@ -9557,7 +7961,7 @@ const extractFormFields = (components) => {
|
|
|
9557
7961
|
* Manages the sign-up flow lifecycle including initialization, form state,
|
|
9558
7962
|
* passkey registration, popup-based social OAuth, and renders the server-driven UI.
|
|
9559
7963
|
*/
|
|
9560
|
-
const BaseSignUp
|
|
7964
|
+
const BaseSignUp = defineComponent({
|
|
9561
7965
|
name: "BaseSignUp",
|
|
9562
7966
|
props: {
|
|
9563
7967
|
afterSignUpUrl: {
|
|
@@ -9697,7 +8101,7 @@ const BaseSignUp$1 = defineComponent({
|
|
|
9697
8101
|
fields.forEach((field) => {
|
|
9698
8102
|
const value = formValues.value[field.name] || "";
|
|
9699
8103
|
if (field.required && (!value || value.trim() === "")) errors[field.name] = t("validations.required.field.error") || "This field is required";
|
|
9700
|
-
if ((field.type ===
|
|
8104
|
+
if ((field.type === EmbeddedFlowComponentType$1.EmailInput || field.type === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[field.name] = t("field.email.invalid") || "Invalid email address";
|
|
9701
8105
|
});
|
|
9702
8106
|
return errors;
|
|
9703
8107
|
};
|
|
@@ -9760,8 +8164,8 @@ const BaseSignUp$1 = defineComponent({
|
|
|
9760
8164
|
try {
|
|
9761
8165
|
const continueResponse = await props.onSubmit(payload);
|
|
9762
8166
|
props.onFlowChange?.(continueResponse);
|
|
9763
|
-
if (continueResponse.flowStatus ===
|
|
9764
|
-
else if (continueResponse.flowStatus ===
|
|
8167
|
+
if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus$1.Complete) props.onComplete?.(continueResponse);
|
|
8168
|
+
else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus$1.Incomplete) {
|
|
9765
8169
|
currentFlow.value = continueResponse;
|
|
9766
8170
|
setupFormFields(continueResponse);
|
|
9767
8171
|
if (continueResponse?.error) handleError(continueResponse);
|
|
@@ -9833,13 +8237,13 @@ const BaseSignUp$1 = defineComponent({
|
|
|
9833
8237
|
};
|
|
9834
8238
|
const response = normalizeFlowResponseLocal(await props.onSubmit(payload));
|
|
9835
8239
|
props.onFlowChange?.(response);
|
|
9836
|
-
if (response.flowStatus ===
|
|
8240
|
+
if (response.flowStatus === EmbeddedSignUpFlowStatus$1.Complete) {
|
|
9837
8241
|
props.onComplete?.(response);
|
|
9838
8242
|
return;
|
|
9839
8243
|
}
|
|
9840
|
-
if (response.flowStatus ===
|
|
8244
|
+
if (response.flowStatus === EmbeddedSignUpFlowStatus$1.Incomplete) {
|
|
9841
8245
|
if (handleRedirectionIfNeeded(response)) return;
|
|
9842
|
-
if (response.data?.additionalData?.
|
|
8246
|
+
if (response.data?.additionalData?.passkeyCreationOptions) {
|
|
9843
8247
|
const { passkeyCreationOptions } = response.data.additionalData;
|
|
9844
8248
|
const effectiveFlowId = response.flowId || currentFlow.value?.flowId;
|
|
9845
8249
|
passkeyProcessed = false;
|
|
@@ -9884,7 +8288,7 @@ const BaseSignUp$1 = defineComponent({
|
|
|
9884
8288
|
};
|
|
9885
8289
|
const processed = normalizeFlowResponseLocal(await props.onSubmit(payload));
|
|
9886
8290
|
props.onFlowChange?.(processed);
|
|
9887
|
-
if (processed.flowStatus ===
|
|
8291
|
+
if (processed.flowStatus === EmbeddedSignUpFlowStatus$1.Complete) props.onComplete?.(processed);
|
|
9888
8292
|
else {
|
|
9889
8293
|
currentFlow.value = processed;
|
|
9890
8294
|
setupFormFields(processed);
|
|
@@ -9921,11 +8325,11 @@ const BaseSignUp$1 = defineComponent({
|
|
|
9921
8325
|
currentFlow.value = response;
|
|
9922
8326
|
isFlowInitialized.value = true;
|
|
9923
8327
|
props.onFlowChange?.(response);
|
|
9924
|
-
if (response.flowStatus ===
|
|
8328
|
+
if (response.flowStatus === EmbeddedSignUpFlowStatus$1.Complete) {
|
|
9925
8329
|
props.onComplete?.(response);
|
|
9926
8330
|
return;
|
|
9927
8331
|
}
|
|
9928
|
-
if (response.flowStatus ===
|
|
8332
|
+
if (response.flowStatus === EmbeddedSignUpFlowStatus$1.Incomplete) {
|
|
9929
8333
|
setupFormFields(response);
|
|
9930
8334
|
if (response?.error) handleError(response);
|
|
9931
8335
|
}
|
|
@@ -10007,14 +8411,14 @@ const BaseSignUp$1 = defineComponent({
|
|
|
10007
8411
|
};
|
|
10008
8412
|
}
|
|
10009
8413
|
});
|
|
10010
|
-
var BaseSignUp_default
|
|
8414
|
+
var BaseSignUp_default = BaseSignUp;
|
|
10011
8415
|
|
|
10012
8416
|
//#endregion
|
|
10013
|
-
//#region src/components/auth/sign-up/
|
|
8417
|
+
//#region src/components/auth/sign-up/SignUp.ts
|
|
10014
8418
|
/**
|
|
10015
8419
|
* SignUp — embedded sign-up component that handles API calls and delegates UI to BaseSignUp.
|
|
10016
8420
|
*/
|
|
10017
|
-
const SignUp
|
|
8421
|
+
const SignUp = defineComponent({
|
|
10018
8422
|
name: "SignUp",
|
|
10019
8423
|
props: {
|
|
10020
8424
|
afterSignUpUrl: {
|
|
@@ -10092,7 +8496,7 @@ const SignUp$1 = defineComponent({
|
|
|
10092
8496
|
if (props.shouldRedirectAfterSignUp && response?.type !== EmbeddedFlowResponseType.Redirection && props.afterSignUpUrl && !response?.assertion) window.location.href = props.afterSignUpUrl;
|
|
10093
8497
|
if (props.shouldRedirectAfterSignUp && response?.type === EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && !response.data.redirectURL.includes("auth")) window.location.href = response.data.redirectURL;
|
|
10094
8498
|
};
|
|
10095
|
-
return () => h(BaseSignUp_default
|
|
8499
|
+
return () => h(BaseSignUp_default, {
|
|
10096
8500
|
afterSignUpUrl: props.afterSignUpUrl,
|
|
10097
8501
|
buttonClassName: props.buttonClassName,
|
|
10098
8502
|
className: props.className,
|
|
@@ -10111,56 +8515,8 @@ const SignUp$1 = defineComponent({
|
|
|
10111
8515
|
}, slots["default"] ? { default: (renderProps) => slots["default"](renderProps) } : void 0);
|
|
10112
8516
|
}
|
|
10113
8517
|
});
|
|
10114
|
-
var SignUp_default$2 = SignUp$1;
|
|
10115
|
-
|
|
10116
|
-
//#endregion
|
|
10117
|
-
//#region src/components/auth/sign-up/SignUp.ts
|
|
10118
|
-
/**
|
|
10119
|
-
* SignUp — platform-aware sign-up container.
|
|
10120
|
-
*
|
|
10121
|
-
* Routes to V1 (default, component-driven V1 flow API) or V2 (`ThunderIDV2`
|
|
10122
|
-
* platform) based on the `platform` value from {@link useThunderID}. Mirrors
|
|
10123
|
-
* the existing `SignIn` dispatcher pattern in this package.
|
|
10124
|
-
*/
|
|
10125
|
-
const SignUp = defineComponent({
|
|
10126
|
-
name: "SignUp",
|
|
10127
|
-
inheritAttrs: false,
|
|
10128
|
-
setup(_props, { attrs, slots }) {
|
|
10129
|
-
const { platform } = useThunderID_default();
|
|
10130
|
-
return () => {
|
|
10131
|
-
if (platform === Platform.ThunderID) return h(SignUp_default$2, { ...attrs }, slots);
|
|
10132
|
-
return h(SignUp_default$1, { ...attrs }, slots);
|
|
10133
|
-
};
|
|
10134
|
-
}
|
|
10135
|
-
});
|
|
10136
8518
|
var SignUp_default = SignUp;
|
|
10137
8519
|
|
|
10138
|
-
//#endregion
|
|
10139
|
-
//#region src/components/auth/sign-up/BaseSignUp.ts
|
|
10140
|
-
/**
|
|
10141
|
-
* BaseSignUp — platform-aware base sign-up component.
|
|
10142
|
-
*
|
|
10143
|
-
* Routes to V1 (component-driven, V1 flow API: `TYPOGRAPHY` / `INPUT` /
|
|
10144
|
-
* `BUTTON` / `FORM` shapes) or V2 (`ThunderIDV2` platform with `BLOCK` / `STACK`
|
|
10145
|
-
* / `TEXT_INPUT` shapes) based on the `platform` value resolved by
|
|
10146
|
-
* {@link useThunderID}.
|
|
10147
|
-
*
|
|
10148
|
-
* Mirrors the React `BaseSignUp` dispatcher and matches the existing pattern
|
|
10149
|
-
* already used by `BaseSignIn` in this package.
|
|
10150
|
-
*/
|
|
10151
|
-
const BaseSignUp = defineComponent({
|
|
10152
|
-
name: "BaseSignUp",
|
|
10153
|
-
inheritAttrs: false,
|
|
10154
|
-
setup(_props, { attrs, slots }) {
|
|
10155
|
-
const { platform } = useThunderID_default();
|
|
10156
|
-
return () => {
|
|
10157
|
-
if (platform === Platform.ThunderID) return h(BaseSignUp_default$2, { ...attrs }, slots);
|
|
10158
|
-
return h(BaseSignUp_default$1, { ...attrs }, slots);
|
|
10159
|
-
};
|
|
10160
|
-
}
|
|
10161
|
-
});
|
|
10162
|
-
var BaseSignUp_default = BaseSignUp;
|
|
10163
|
-
|
|
10164
8520
|
//#endregion
|
|
10165
8521
|
//#region src/components/control/SignedIn.ts
|
|
10166
8522
|
/**
|
|
@@ -12830,7 +11186,7 @@ const LanguageSwitcher = defineComponent({
|
|
|
12830
11186
|
var LanguageSwitcher_default = LanguageSwitcher;
|
|
12831
11187
|
|
|
12832
11188
|
//#endregion
|
|
12833
|
-
//#region src/utils/
|
|
11189
|
+
//#region src/utils/buildThemeConfigFromFlowMeta.ts
|
|
12834
11190
|
/**
|
|
12835
11191
|
* Converts a v2 `FlowMetaTheme` into a `RecursivePartial<ThemeConfig>` that
|
|
12836
11192
|
* `createTheme` can consume.
|
|
@@ -13005,4 +11361,4 @@ const createCallbackRoute = (options = {}) => {
|
|
|
13005
11361
|
};
|
|
13006
11362
|
|
|
13007
11363
|
//#endregion
|
|
13008
|
-
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, BRANDING_KEY, BaseAcceptInvite_default as BaseAcceptInvite, BaseCreateOrganization_default as BaseCreateOrganization, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseOrganizationList_default as BaseOrganizationList, BaseOrganizationProfile_default as BaseOrganizationProfile, BaseOrganizationSwitcher_default as BaseOrganizationSwitcher, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BrandingProvider_default as BrandingProvider, BuildingIcon, Button_default as Button, Callback_default as Callback, Card_default as Card, CheckIcon, Checkbox_default as Checkbox, ChevronDownIcon, CircleAlertIcon, CircleCheckIcon, CreateOrganization_default as CreateOrganization, DatePicker_default as DatePicker, Divider_default as Divider, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EyeIcon, EyeOffIcon, FLOW_KEY, FLOW_META_KEY, FacebookButton_default as FacebookButton, FieldFactory_default as FieldFactory, FieldType, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, GitHubButton_default as GitHubButton, GlobeIcon, GoogleButton_default as GoogleButton, I18N_KEY, I18nProvider_default as I18nProvider, InfoIcon, InviteUser_default as InviteUser, LanguageSwitcher_default as LanguageSwitcher, Loading_default as Loading, LogOutIcon, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, ORGANIZATION_KEY, Organization_default as Organization, OrganizationList_default as OrganizationList, OrganizationProfile_default as OrganizationProfile, OrganizationProvider_default as OrganizationProvider, OrganizationSwitcher_default as OrganizationSwitcher, OtpField_default as OtpField, PasswordField_default as PasswordField, PencilIcon, PlusIcon, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, THEME_KEY, THUNDERID_KEY, TextField_default as TextField, ThemeProvider_default as ThemeProvider, ThunderIDPlugin_default as ThunderIDPlugin, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, ThunderIDVueClient_default as ThunderIDVueClient, TriangleAlertIcon, Typography_default as Typography, USER_KEY, User_default as User, UserDropdown_default as UserDropdown, UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, XIcon, buildThemeConfigFromFlowMeta_default as buildThemeConfigFromFlowMeta, createCallbackRoute, createClassObserver, createField, createMediaQueryListener, createThunderIDGuard, detectThemeMode, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, useBranding_default as useBranding, useFlow_default as useFlow, useFlowMeta_default as useFlowMeta, useI18n_default as useI18n, useOAuthCallback,
|
|
11364
|
+
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, ArrowLeftRightIcon, BRANDING_KEY, BaseAcceptInvite_default as BaseAcceptInvite, BaseCreateOrganization_default as BaseCreateOrganization, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseOrganizationList_default as BaseOrganizationList, BaseOrganizationProfile_default as BaseOrganizationProfile, BaseOrganizationSwitcher_default as BaseOrganizationSwitcher, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BrandingProvider_default as BrandingProvider, BuildingIcon, Button_default as Button, Callback_default as Callback, Card_default as Card, CheckIcon, Checkbox_default as Checkbox, ChevronDownIcon, CircleAlertIcon, CircleCheckIcon, CreateOrganization_default as CreateOrganization, DatePicker_default as DatePicker, Divider_default as Divider, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, EyeIcon, EyeOffIcon, FLOW_KEY, FLOW_META_KEY, FacebookButton_default as FacebookButton, FieldFactory_default as FieldFactory, FieldType, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, GitHubButton_default as GitHubButton, GlobeIcon, GoogleButton_default as GoogleButton, I18N_KEY, I18nProvider_default as I18nProvider, InfoIcon, InviteUser_default as InviteUser, LanguageSwitcher_default as LanguageSwitcher, Loading_default as Loading, LogOutIcon, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, ORGANIZATION_KEY, Organization_default as Organization, OrganizationList_default as OrganizationList, OrganizationProfile_default as OrganizationProfile, OrganizationProvider_default as OrganizationProvider, OrganizationSwitcher_default as OrganizationSwitcher, OtpField_default as OtpField, PasswordField_default as PasswordField, PencilIcon, PlusIcon, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, THEME_KEY, THUNDERID_KEY, TextField_default as TextField, ThemeProvider_default as ThemeProvider, ThunderIDPlugin_default as ThunderIDPlugin, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, ThunderIDVueClient_default as ThunderIDVueClient, TriangleAlertIcon, Typography_default as Typography, USER_KEY, User_default as User, UserDropdown_default as UserDropdown, UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, XIcon, buildThemeConfigFromFlowMeta_default as buildThemeConfigFromFlowMeta, createCallbackRoute, createClassObserver, createField, createMediaQueryListener, createThunderIDGuard, detectThemeMode, getActiveTheme, getAuthComponentHeadings_default as getAuthComponentHeadings, handleWebAuthnAuthentication, hasAuthParamsInUrl, http, initiateOAuthRedirect, navigate, useBranding_default as useBranding, useFlow_default as useFlow, useFlowMeta_default as useFlowMeta, useI18n_default as useI18n, useOAuthCallback, useOrganization_default as useOrganization, useTheme_default as useTheme, useThunderID_default as useThunderID, useUser_default as useUser, validateFieldValue };
|