@thunderid/vue 0.3.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.
Files changed (62) hide show
  1. package/dist/ThunderIDVueClient.d.ts +2 -3
  2. package/dist/ThunderIDVueClient.d.ts.map +1 -1
  3. package/dist/cjs/index.cjs +239 -1872
  4. package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts +1 -1
  5. package/dist/components/auth/sign-in/AuthOptionFactoryCore.d.ts.map +1 -1
  6. package/dist/components/auth/sign-in/BaseSignIn.d.ts +60 -5
  7. package/dist/components/auth/sign-in/BaseSignIn.d.ts.map +1 -1
  8. package/dist/components/auth/sign-in/SignIn.d.ts +33 -5
  9. package/dist/components/auth/sign-in/SignIn.d.ts.map +1 -1
  10. package/dist/components/auth/sign-up/BaseSignUp.d.ts +49 -10
  11. package/dist/components/auth/sign-up/BaseSignUp.d.ts.map +1 -1
  12. package/dist/components/auth/sign-up/SignUp.d.ts +3 -6
  13. package/dist/components/auth/sign-up/SignUp.d.ts.map +1 -1
  14. package/dist/index.d.ts +5 -7
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +163 -1807
  17. package/dist/models/contexts.d.ts +1 -2
  18. package/dist/models/contexts.d.ts.map +1 -1
  19. package/dist/providers/ThunderIDProvider.d.ts.map +1 -1
  20. package/dist/utils/buildThemeConfigFromFlowMeta.d.ts.map +1 -0
  21. package/dist/utils/{v2/flowTransformer.d.ts → flowTransformer.d.ts} +2 -2
  22. package/dist/utils/flowTransformer.d.ts.map +1 -0
  23. package/dist/utils/{v2/getAuthComponentHeadings.d.ts → getAuthComponentHeadings.d.ts} +1 -1
  24. package/dist/utils/getAuthComponentHeadings.d.ts.map +1 -0
  25. package/dist/utils/passkey.d.ts.map +1 -0
  26. package/dist/utils/resolveTranslationsInArray.d.ts.map +1 -0
  27. package/dist/utils/resolveTranslationsInObject.d.ts.map +1 -0
  28. package/package.json +9 -9
  29. package/dist/components/auth/sign-in/v1/BaseSignIn.d.ts +0 -27
  30. package/dist/components/auth/sign-in/v1/BaseSignIn.d.ts.map +0 -1
  31. package/dist/components/auth/sign-in/v1/SignIn.d.ts +0 -27
  32. package/dist/components/auth/sign-in/v1/SignIn.d.ts.map +0 -1
  33. package/dist/components/auth/sign-in/v1/options/SignInOptionFactory.d.ts +0 -47
  34. package/dist/components/auth/sign-in/v1/options/SignInOptionFactory.d.ts.map +0 -1
  35. package/dist/components/auth/sign-in/v2/AuthOptionFactory.d.ts +0 -19
  36. package/dist/components/auth/sign-in/v2/AuthOptionFactory.d.ts.map +0 -1
  37. package/dist/components/auth/sign-in/v2/BaseSignIn.d.ts +0 -83
  38. package/dist/components/auth/sign-in/v2/BaseSignIn.d.ts.map +0 -1
  39. package/dist/components/auth/sign-in/v2/SignIn.d.ts +0 -56
  40. package/dist/components/auth/sign-in/v2/SignIn.d.ts.map +0 -1
  41. package/dist/components/auth/sign-up/v1/BaseSignUp.d.ts +0 -49
  42. package/dist/components/auth/sign-up/v1/BaseSignUp.d.ts.map +0 -1
  43. package/dist/components/auth/sign-up/v1/SignUp.d.ts +0 -31
  44. package/dist/components/auth/sign-up/v1/SignUp.d.ts.map +0 -1
  45. package/dist/components/auth/sign-up/v1/options/SignUpOptionFactory.d.ts +0 -50
  46. package/dist/components/auth/sign-up/v1/options/SignUpOptionFactory.d.ts.map +0 -1
  47. package/dist/components/auth/sign-up/v2/BaseSignUp.d.ts +0 -73
  48. package/dist/components/auth/sign-up/v2/BaseSignUp.d.ts.map +0 -1
  49. package/dist/components/auth/sign-up/v2/SignUp.d.ts +0 -26
  50. package/dist/components/auth/sign-up/v2/SignUp.d.ts.map +0 -1
  51. package/dist/composables/v2/useOAuthCallback.d.ts +0 -70
  52. package/dist/composables/v2/useOAuthCallback.d.ts.map +0 -1
  53. package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts.map +0 -1
  54. package/dist/utils/v2/flowTransformer.d.ts.map +0 -1
  55. package/dist/utils/v2/getAuthComponentHeadings.d.ts.map +0 -1
  56. package/dist/utils/v2/passkey.d.ts.map +0 -1
  57. package/dist/utils/v2/resolveTranslationsInArray.d.ts.map +0 -1
  58. package/dist/utils/v2/resolveTranslationsInObject.d.ts.map +0 -1
  59. /package/dist/utils/{v2/buildThemeConfigFromFlowMeta.d.ts → buildThemeConfigFromFlowMeta.d.ts} +0 -0
  60. /package/dist/utils/{v2/passkey.d.ts → passkey.d.ts} +0 -0
  61. /package/dist/utils/{v2/resolveTranslationsInArray.d.ts → resolveTranslationsInArray.d.ts} +0 -0
  62. /package/dist/utils/{v2/resolveTranslationsInObject.d.ts → resolveTranslationsInObject.d.ts} +0 -0
@@ -164,7 +164,7 @@ const FlowMetaProvider = (0, vue.defineComponent)({
164
164
  isLoading.value = true;
165
165
  error.value = null;
166
166
  try {
167
- meta.value = await (0, __thunderid_browser.getFlowMetaV2)({
167
+ meta.value = await (0, __thunderid_browser.getFlowMeta)({
168
168
  baseUrl,
169
169
  ...applicationId ? {
170
170
  id: applicationId,
@@ -182,7 +182,7 @@ const FlowMetaProvider = (0, vue.defineComponent)({
182
182
  isLoading.value = true;
183
183
  error.value = null;
184
184
  try {
185
- const result = await (0, __thunderid_browser.getFlowMetaV2)({
185
+ const result = await (0, __thunderid_browser.getFlowMeta)({
186
186
  baseUrl,
187
187
  ...applicationId ? {
188
188
  id: applicationId,
@@ -374,7 +374,7 @@ const PACKAGE_NAME = "@thunderid/vue";
374
374
  * Package-level logger for `@thunderid/vue`.
375
375
  * Use this when logging is not tied to a specific component.
376
376
  */
377
- const logger$7 = (0, __thunderid_browser.createPackageLogger)(PACKAGE_NAME);
377
+ const logger$6 = (0, __thunderid_browser.createPackageLogger)(PACKAGE_NAME);
378
378
  /**
379
379
  * Creates a component-scoped logger prefixed with `@thunderid/vue - <component>`.
380
380
  *
@@ -384,7 +384,7 @@ const createVueLogger = (component) => (0, __thunderid_browser.createPackageComp
384
384
 
385
385
  //#endregion
386
386
  //#region src/providers/I18nProvider.ts
387
- const logger$6 = createVueLogger("I18nProvider");
387
+ const logger$5 = createVueLogger("I18nProvider");
388
388
  const DEFAULT_STORAGE_KEY = "thunderid-i18n-language";
389
389
  const DEFAULT_URL_PARAM = "lang";
390
390
  const deriveRootDomain = (hostname) => {
@@ -425,7 +425,7 @@ const createStorageAdapter = (strategy, key, cookieDomain) => {
425
425
  try {
426
426
  window.localStorage.setItem(key, language);
427
427
  } catch {
428
- logger$6.warn("Failed to persist language preference to localStorage.");
428
+ logger$5.warn("Failed to persist language preference to localStorage.");
429
429
  }
430
430
  }
431
431
  };
@@ -547,7 +547,7 @@ const I18nProvider = (0, vue.defineComponent)({
547
547
  };
548
548
  const setLanguage = (language) => {
549
549
  if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
550
- else logger$6.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
550
+ else logger$5.warn(`Language '${language}' is not available. Available languages: ${Object.keys(mergedBundlesComputed.value).join(", ")}`);
551
551
  };
552
552
  (0, vue.provide)(I18N_KEY, {
553
553
  bundles: (0, vue.readonly)(mergedBundlesComputed),
@@ -637,7 +637,7 @@ var OrganizationProvider_default = OrganizationProvider;
637
637
 
638
638
  //#endregion
639
639
  //#region src/providers/ThemeProvider.ts
640
- const logger$5 = createVueLogger("ThemeProvider");
640
+ const logger$4 = createVueLogger("ThemeProvider");
641
641
  const ThemeProvider = (0, vue.defineComponent)({
642
642
  name: "ThemeProvider",
643
643
  props: {
@@ -671,7 +671,7 @@ const ThemeProvider = (0, vue.defineComponent)({
671
671
  if (props.mode === "branding") colorScheme.value = brandingActiveTheme;
672
672
  else if (props.mode === "system" && !brandingContext?.isLoading.value) colorScheme.value = brandingActiveTheme;
673
673
  });
674
- if (props.inheritFromBranding && !brandingContext) logger$5.warn("ThemeProvider: inheritFromBranding is enabled but BrandingProvider is not available. Make sure to wrap your app with BrandingProvider or ThunderIDProvider.");
674
+ 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.");
675
675
  const finalThemeConfig = (0, vue.computed)(() => {
676
676
  const themeConfig = props.theme;
677
677
  const brandingTheme = props.inheritFromBranding ? brandingContext?.theme.value : null;
@@ -1072,13 +1072,13 @@ var ThunderIDVueClient = class extends __thunderid_browser.ThunderIDBrowserClien
1072
1072
  const configData = await this.getStorageManager().getConfigData();
1073
1073
  const authIdFromUrl = new URL(window.location.href).searchParams.get("authId");
1074
1074
  const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId");
1075
- const response = await (0, __thunderid_browser.executeEmbeddedSignInFlowV2)({
1075
+ const response = await (0, __thunderid_browser.executeEmbeddedSignInFlow)({
1076
1076
  authId: authIdFromUrl || authIdFromStorage || "",
1077
1077
  baseUrl: configData?.baseUrl || "",
1078
1078
  payload: arg1,
1079
1079
  url: arg2?.url
1080
1080
  });
1081
- if (response && typeof response === "object" && response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatusV2.Complete && response.assertion) {
1081
+ if (response && typeof response === "object" && response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Complete && response.assertion) {
1082
1082
  const decodedAssertion = await this.decodeJwtToken(response.assertion);
1083
1083
  const createdAt = decodedAssertion.iat ? decodedAssertion.iat * 1e3 : Date.now();
1084
1084
  const expiresIn = decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;
@@ -1108,7 +1108,7 @@ var ThunderIDVueClient = class extends __thunderid_browser.ThunderIDBrowserClien
1108
1108
  const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId");
1109
1109
  const authId = authIdFromUrl || authIdFromStorage || "";
1110
1110
  if (authIdFromUrl && !authIdFromStorage) await this.getStorageManager().setHybridDataParameter("authId", authIdFromUrl);
1111
- const response = await (0, __thunderid_browser.executeEmbeddedSignUpFlowV2)({
1111
+ const response = await (0, __thunderid_browser.executeEmbeddedSignUpFlow)({
1112
1112
  authId,
1113
1113
  baseUrl,
1114
1114
  payload: typeof firstArg === "object" && "flowType" in firstArg ? {
@@ -1116,7 +1116,7 @@ var ThunderIDVueClient = class extends __thunderid_browser.ThunderIDBrowserClien
1116
1116
  verbose: true
1117
1117
  } : firstArg
1118
1118
  });
1119
- if (response && typeof response === "object" && response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatusV2.Complete && response.assertion) {
1119
+ if (response && typeof response === "object" && response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Complete && response.assertion) {
1120
1120
  const decodedAssertion = await this.decodeJwtToken(response.assertion);
1121
1121
  const createdAt = decodedAssertion.iat ? decodedAssertion.iat * 1e3 : Date.now();
1122
1122
  const expiresIn = decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;
@@ -1214,10 +1214,6 @@ const ThunderIDProvider = (0, vue.defineComponent)({
1214
1214
  default: void 0,
1215
1215
  type: String
1216
1216
  },
1217
- platform: {
1218
- default: void 0,
1219
- type: String
1220
- },
1221
1217
  scopes: {
1222
1218
  default: void 0,
1223
1219
  type: [Array, String]
@@ -1370,7 +1366,6 @@ const ThunderIDProvider = (0, vue.defineComponent)({
1370
1366
  isSignedIn,
1371
1367
  organization: currentOrganization,
1372
1368
  organizationHandle: props.organizationHandle,
1373
- platform: __thunderid_browser.Platform.ThunderID,
1374
1369
  reInitialize: async (config) => {
1375
1370
  const result = await client.reInitialize(config);
1376
1371
  return typeof result === "boolean" ? result : true;
@@ -4862,7 +4857,7 @@ var useUser_default = useUser;
4862
4857
 
4863
4858
  //#endregion
4864
4859
  //#region src/composables/useOAuthCallback.ts
4865
- function cleanupUrlParams$1() {
4860
+ function cleanupUrlParams() {
4866
4861
  if (typeof window === "undefined") return;
4867
4862
  const url = new URL(window.location.href);
4868
4863
  url.searchParams.delete("code");
@@ -4898,7 +4893,7 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
4898
4893
  oauthCodeProcessedFlag.value = true;
4899
4894
  if (tokenValidationFlag) tokenValidationFlag.value = true;
4900
4895
  onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
4901
- cleanupUrlParams$1();
4896
+ cleanupUrlParams();
4902
4897
  return;
4903
4898
  }
4904
4899
  if (!code || oauthCodeProcessedFlag.value) return;
@@ -4908,7 +4903,7 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
4908
4903
  if (!flowIdToUse) {
4909
4904
  oauthCodeProcessedFlag.value = true;
4910
4905
  onError?.(/* @__PURE__ */ new Error("Invalid flow. Missing flowId."));
4911
- cleanupUrlParams$1();
4906
+ cleanupUrlParams();
4912
4907
  return;
4913
4908
  }
4914
4909
  oauthCodeProcessedFlag.value = true;
@@ -4927,88 +4922,6 @@ function useOAuthCallback({ currentFlowId, flowIdStorageKey = "thunderid_flow_id
4927
4922
  onFlowChange?.(response);
4928
4923
  if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") onComplete?.();
4929
4924
  if (response?.flowStatus === "ERROR" || response?.status === "ERROR") onError?.(response);
4930
- cleanupUrlParams$1();
4931
- } catch (err) {
4932
- onError?.(err);
4933
- cleanupUrlParams$1();
4934
- }
4935
- })();
4936
- }, { immediate: true });
4937
- }
4938
-
4939
- //#endregion
4940
- //#region src/composables/v2/useOAuthCallback.ts
4941
- /**
4942
- * Removes OAuth-related query parameters from the current URL without triggering a navigation.
4943
- * This prevents re-processing the callback on subsequent renders or page interactions.
4944
- */
4945
- function cleanupUrlParams() {
4946
- if (typeof window === "undefined") return;
4947
- const url = new URL(window.location.href);
4948
- url.searchParams.delete("code");
4949
- url.searchParams.delete("nonce");
4950
- url.searchParams.delete("state");
4951
- url.searchParams.delete("error");
4952
- url.searchParams.delete("error_description");
4953
- window.history.replaceState({}, "", url.toString());
4954
- }
4955
- /**
4956
- * Processes OAuth callbacks by detecting auth code in URL, resolving executionId, and submitting to server.
4957
- * Used by SignIn, SignUp, and AcceptInvite components.
4958
- *
4959
- * Vue composable equivalent of React's useOAuthCallback hook.
4960
- */
4961
- function useOAuthCallback$1({ currentExecutionId, executionIdStorageKey = "thunderid_execution_id", isInitialized, isSubmitting, onComplete, onError, onFlowChange, onProcessingStart, onSubmit, processedFlag, setExecutionId, tokenValidationAttemptedFlag }) {
4962
- /** Ensures OAuth code is submitted only once, even across reactive re-evaluations */
4963
- const oauthCodeProcessedFlag = processedFlag ?? { value: false };
4964
- /** Tracks whether token validation has been attempted; used to coordinate with AcceptInvite */
4965
- const tokenValidationFlag = tokenValidationAttemptedFlag;
4966
- (0, vue.watch)(() => [
4967
- isInitialized.value,
4968
- currentExecutionId.value,
4969
- isSubmitting?.value
4970
- ], ([initialized, , submitting]) => {
4971
- if (!initialized || submitting) return;
4972
- const urlParams = new URLSearchParams(window.location.search);
4973
- const code = urlParams.get("code");
4974
- const nonce = urlParams.get("nonce");
4975
- const state = urlParams.get("state");
4976
- const executionIdFromUrl = urlParams.get("executionId");
4977
- const error = urlParams.get("error");
4978
- const errorDescription = urlParams.get("error_description");
4979
- if (error) {
4980
- oauthCodeProcessedFlag.value = true;
4981
- if (tokenValidationFlag) tokenValidationFlag.value = true;
4982
- onError?.(new Error(errorDescription || error || "OAuth authentication failed"));
4983
- cleanupUrlParams();
4984
- return;
4985
- }
4986
- if (!code || oauthCodeProcessedFlag.value) return;
4987
- if (tokenValidationFlag?.value) return;
4988
- const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
4989
- const executionIdToUse = currentExecutionId.value || storedExecutionId || executionIdFromUrl || state || null;
4990
- if (!executionIdToUse) {
4991
- oauthCodeProcessedFlag.value = true;
4992
- onError?.(/* @__PURE__ */ new Error("Invalid flow. Missing executionId."));
4993
- cleanupUrlParams();
4994
- return;
4995
- }
4996
- oauthCodeProcessedFlag.value = true;
4997
- if (tokenValidationFlag) tokenValidationFlag.value = true;
4998
- onProcessingStart?.();
4999
- if (!currentExecutionId.value && setExecutionId) setExecutionId(executionIdToUse);
5000
- (async () => {
5001
- try {
5002
- const response = await onSubmit({
5003
- executionId: executionIdToUse,
5004
- inputs: {
5005
- code,
5006
- ...nonce && { nonce }
5007
- }
5008
- });
5009
- onFlowChange?.(response);
5010
- if (response?.flowStatus === "COMPLETE" || response?.status === "COMPLETE") onComplete?.();
5011
- if (response?.flowStatus === "ERROR" || response?.status === "ERROR") onError?.(response);
5012
4925
  cleanupUrlParams();
5013
4926
  } catch (err) {
5014
4927
  onError?.(err);
@@ -6267,7 +6180,7 @@ var SignUpButton_default = SignUpButton;
6267
6180
 
6268
6181
  //#endregion
6269
6182
  //#region src/components/auth/Callback.ts
6270
- const logger$4 = createVueLogger("Callback");
6183
+ const logger$3 = createVueLogger("Callback");
6271
6184
  /**
6272
6185
  * Callback — headless component that handles OAuth callback parameter forwarding.
6273
6186
  *
@@ -6355,7 +6268,7 @@ const Callback = (0, vue.defineComponent)({
6355
6268
  navigate$4(`${returnPath}?${params.toString()}`);
6356
6269
  } catch (err) {
6357
6270
  const errorMessage = err instanceof Error ? err.message : "OAuth callback processing failed";
6358
- logger$4.error("OAuth callback error:", err);
6271
+ logger$3.error("OAuth callback error:", err);
6359
6272
  props.onError?.(err instanceof Error ? err : new Error(errorMessage));
6360
6273
  const params = new URLSearchParams();
6361
6274
  params.set("error", "callback_error");
@@ -6731,843 +6644,110 @@ const FieldFactory = (0, vue.defineComponent)({
6731
6644
  var FieldFactory_default = FieldFactory;
6732
6645
 
6733
6646
  //#endregion
6734
- //#region src/components/auth/sign-in/v1/options/SignInOptionFactory.ts
6735
- /**
6736
- * Renders form fields for authenticators that require user input (e.g. UsernamePassword, IdentifierFirst).
6737
- */
6738
- const renderFormFields = (props) => {
6739
- const { authenticator, formValues, touchedFields, isLoading, onInputChange, inputClassName, buttonClassName, t } = props;
6740
- const fieldNodes = (authenticator.metadata?.params?.sort((a, b) => a.order - b.order)?.filter((param) => param.param !== "totp") || []).map((param) => (0, vue.h)("div", { key: param.param }, createField({
6741
- className: inputClassName,
6742
- disabled: isLoading,
6743
- label: param.displayName,
6744
- name: param.param,
6745
- onChange: (value) => onInputChange(param.param, value),
6746
- placeholder: t("elements.fields.generic.placeholder", { field: (param.displayName || param.param).toLowerCase() }),
6747
- required: authenticator.requiredParams.includes(param.param),
6748
- touched: touchedFields[param.param] || false,
6749
- type: param.type === __thunderid_browser.EmbeddedSignInFlowAuthenticatorParamType.String && param.confidential ? __thunderid_browser.FieldType.Password : __thunderid_browser.FieldType.Text,
6750
- value: formValues[param.param] || ""
6751
- })));
6752
- fieldNodes.push((0, vue.h)(Button_default, {
6753
- class: buttonClassName,
6754
- color: "primary",
6755
- "data-testid": "thunderid-signin-submit",
6756
- disabled: isLoading,
6757
- fullWidth: true,
6758
- loading: isLoading,
6759
- type: "submit",
6760
- variant: "solid"
6761
- }, { default: () => t("username.password.buttons.submit.text") }));
6762
- return fieldNodes;
6763
- };
6647
+ //#region src/components/auth/sign-in/AuthOptionFactoryCore.ts
6648
+ const logger$2 = createVueLogger("AuthOptionFactory");
6764
6649
  /**
6765
- * Renders a multi-option button for authenticators that require selection
6766
- * but no immediate user input (e.g. EmailOtp, SmsOtp, Totp, Passkey).
6767
- */
6768
- const renderMultiOptionButton = (props) => {
6769
- const { authenticator, isLoading, onSubmit, buttonClassName, t } = props;
6770
- let authenticatorName = authenticator.authenticator;
6771
- if (authenticator.idp !== __thunderid_browser.EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) authenticatorName = authenticator.idp;
6772
- const displayName = t("elements.buttons.multi.option.text", { connection: authenticatorName });
6773
- return (0, vue.h)(Button_default, {
6774
- class: buttonClassName,
6775
- color: "secondary",
6776
- disabled: isLoading,
6777
- fullWidth: true,
6778
- onClick: () => onSubmit(authenticator),
6779
- startIcon: (0, vue.h)("svg", {
6780
- height: "18",
6781
- viewBox: "0 0 24 24",
6782
- width: "18",
6783
- xmlns: "http://www.w3.org/2000/svg"
6784
- }, [(0, vue.h)("path", {
6785
- d: {
6786
- [__thunderid_browser.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",
6787
- [__thunderid_browser.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",
6788
- [__thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp]: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12c5.16-1.26 9-6.45 9-12V5z"
6789
- }[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",
6790
- fill: "currentColor"
6791
- })]),
6792
- type: "button",
6793
- variant: "solid"
6794
- }, { default: () => displayName });
6795
- };
6650
+ * Inline helper for consent optional attribute key (mirrors ConsentCheckboxList.getConsentOptionalKey).
6651
+ */
6652
+ const getConsentOptionalKey = (purposeId, attr) => `consent_${purposeId}_${attr}`;
6796
6653
  /**
6797
- * Renders a generic social/federated login button for unknown federated authenticators.
6798
- */
6799
- const renderSocialButton = (props) => {
6800
- const { authenticator, isLoading, onSubmit, buttonClassName, t } = props;
6801
- return (0, vue.h)(Button_default, {
6802
- class: buttonClassName,
6803
- color: "secondary",
6804
- disabled: isLoading,
6805
- fullWidth: true,
6806
- onClick: () => onSubmit(authenticator),
6807
- startIcon: (0, vue.h)("svg", {
6808
- height: "18",
6809
- viewBox: "0 0 24 24",
6810
- width: "18",
6811
- xmlns: "http://www.w3.org/2000/svg"
6812
- }, [(0, vue.h)("path", {
6813
- 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",
6814
- fill: "currentColor"
6815
- })]),
6816
- type: "button",
6817
- variant: "outline"
6818
- }, { default: () => t("elements.buttons.social.text", { connection: authenticator.idp }) });
6654
+ * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
6655
+ *
6656
+ * DOMPurify strips unknown URI schemes from attributes (e.g. `src="emoji:🦊"` → `src=""`).
6657
+ * Converting them to inline spans first preserves the emoji content through sanitization.
6658
+ *
6659
+ * Converts:
6660
+ * - `<img src="emoji:X" alt="Y">` → `<span role="img" aria-label="Y">X</span>`
6661
+ * - Any remaining `emoji:X` text occurrences → `X`
6662
+ */
6663
+ const resolveEmojiUrisInHtml = (html) => {
6664
+ return html.replace(/<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi, (_match, pre, src, post) => {
6665
+ const emoji = (0, __thunderid_browser.extractEmojiFromUri)(src);
6666
+ if (!emoji) return _match;
6667
+ const altMatch = /alt="([^"]*)"/i.exec(pre + post);
6668
+ return `<span role="img" aria-label="${altMatch ? altMatch[1] : emoji}">${emoji}</span>`;
6669
+ }).replace(/emoji:([^\s"<>&]+)/g, (_, rest) => (0, __thunderid_browser.isEmojiUri)(`emoji:${rest}`) ? rest : `emoji:${rest}`);
6819
6670
  };
6820
6671
  /**
6821
- * Creates the appropriate sign-in VNode(s) based on the authenticator's ID.
6672
+ * Get the appropriate FieldType for an input component.
6822
6673
  */
6823
- const createSignInOption = (props) => {
6824
- const { authenticator, onSubmit, buttonClassName, isLoading } = props;
6825
- const hasParams = !!(authenticator.metadata?.params && authenticator.metadata.params.length > 0);
6826
- switch (authenticator.authenticatorId) {
6827
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.UsernamePassword:
6828
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.IdentifierFirst: return (0, vue.h)("div", {}, renderFormFields(props));
6829
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Google: return (0, vue.h)(GoogleButton_default, {
6830
- class: buttonClassName,
6831
- isLoading,
6832
- onClick: () => onSubmit(authenticator)
6833
- });
6834
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.GitHub: return (0, vue.h)(GitHubButton_default, {
6835
- class: buttonClassName,
6836
- isLoading,
6837
- onClick: () => onSubmit(authenticator)
6838
- });
6839
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Microsoft: return (0, vue.h)(MicrosoftButton_default, {
6840
- class: buttonClassName,
6841
- isLoading,
6842
- onClick: () => onSubmit(authenticator)
6843
- });
6844
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Facebook: return (0, vue.h)(FacebookButton_default, {
6845
- class: buttonClassName,
6846
- isLoading,
6847
- onClick: () => onSubmit(authenticator)
6848
- });
6849
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.EmailOtp:
6850
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Totp:
6851
- case __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.SmsOtp: return hasParams ? (0, vue.h)("div", {}, renderFormFields(props)) : renderMultiOptionButton(props);
6852
- default:
6853
- if (authenticator.idp !== __thunderid_browser.EmbeddedSignInFlowAuthenticatorKnownIdPType.Local) return renderSocialButton(props);
6854
- return hasParams ? (0, vue.h)("div", {}, renderFormFields(props)) : renderMultiOptionButton(props);
6674
+ const getFieldType = (variant) => {
6675
+ switch (variant) {
6676
+ case __thunderid_browser.EmbeddedFlowComponentType.EmailInput: return __thunderid_browser.FieldType.Email;
6677
+ case __thunderid_browser.EmbeddedFlowComponentType.PasswordInput: return __thunderid_browser.FieldType.Password;
6678
+ case __thunderid_browser.EmbeddedFlowComponentType.TextInput:
6679
+ default: return __thunderid_browser.FieldType.Text;
6855
6680
  }
6856
6681
  };
6857
6682
  /**
6858
- * Convenience function to create sign-in option VNode(s) from an authenticator.
6859
- */
6860
- const createSignInOptionFromAuthenticator = (authenticator, formValues, touchedFields, isLoading, onInputChange, onSubmit, t, options) => createSignInOption({
6861
- authenticator,
6862
- formValues,
6863
- isLoading,
6864
- onInputChange,
6865
- onSubmit,
6866
- t,
6867
- touchedFields,
6868
- ...options
6869
- });
6870
-
6871
- //#endregion
6872
- //#region src/components/auth/sign-in/v1/BaseSignIn.ts
6683
+ * Get typography variant from component variant.
6684
+ */
6685
+ const getTypographyVariant = (variant) => {
6686
+ return {
6687
+ BODY_1: "body1",
6688
+ BODY_2: "body2",
6689
+ BUTTON_TEXT: "body2",
6690
+ CAPTION: "caption",
6691
+ HEADING_1: "h1",
6692
+ HEADING_2: "h2",
6693
+ HEADING_3: "h3",
6694
+ HEADING_4: "h4",
6695
+ HEADING_5: "h5",
6696
+ HEADING_6: "h6",
6697
+ OVERLINE: "overline",
6698
+ SUBTITLE_1: "subtitle1",
6699
+ SUBTITLE_2: "subtitle2"
6700
+ }[variant] || "h3";
6701
+ };
6873
6702
  /**
6874
- * Authenticators that are currently hidden from the UI.
6875
- * OrganizationSSO is not yet supported in app-native authentication.
6703
+ * Check if a button text or action matches a social provider.
6876
6704
  */
6877
- const HIDDEN_AUTHENTICATORS = ["T3JnYW5pemF0aW9uQXV0aGVudGljYXRvcjpTU08"];
6878
- const isPasskeyAuthenticator = (authenticator) => authenticator.authenticatorId === __thunderid_browser.ApplicationNativeAuthenticationConstants.SupportedAuthenticators.Passkey && authenticator.metadata?.promptType === __thunderid_browser.EmbeddedSignInFlowAuthenticatorPromptType.InternalPrompt && !!authenticator.metadata?.additionalData?.challengeData;
6705
+ const matchesSocialProvider = (actionId, eventType, buttonText, provider) => {
6706
+ const providerId = `${provider}_auth`;
6707
+ const providerMatches = actionId === providerId || eventType === providerId;
6708
+ if (buttonText.toLowerCase().includes(provider)) return true;
6709
+ return providerMatches;
6710
+ };
6879
6711
  /**
6880
- * V1 BaseSignIn component — authenticator-based app-native sign-in for Vue.
6881
- *
6882
- * Handles multi-step authentication flows, form rendering per-authenticator,
6883
- * redirect popups for OAuth, and passkey/FIDO WebAuthn.
6712
+ * Create an auth component (VNode) from a flow component configuration.
6884
6713
  */
6885
- const BaseSignIn$2 = (0, vue.defineComponent)({
6886
- name: "BaseSignInV1",
6887
- props: {
6888
- afterSignInUrl: {
6889
- default: void 0,
6890
- type: String
6891
- },
6892
- buttonClassName: {
6893
- default: "",
6894
- type: String
6895
- },
6896
- className: {
6897
- default: "",
6898
- type: String
6899
- },
6900
- errorClassName: {
6901
- default: "",
6902
- type: String
6903
- },
6904
- inputClassName: {
6905
- default: "",
6906
- type: String
6907
- },
6908
- isLoading: {
6909
- default: false,
6910
- type: Boolean
6911
- },
6912
- messageClassName: {
6913
- default: "",
6914
- type: String
6915
- },
6916
- onInitialize: {
6917
- default: void 0,
6918
- type: Function
6919
- },
6920
- onSubmit: {
6921
- default: void 0,
6922
- type: Function
6923
- },
6924
- showLogo: {
6925
- default: true,
6926
- type: Boolean
6927
- },
6928
- showSubtitle: {
6929
- default: true,
6930
- type: Boolean
6931
- },
6932
- showTitle: {
6933
- default: true,
6934
- type: Boolean
6935
- },
6936
- size: {
6937
- default: "medium",
6938
- type: String
6939
- },
6940
- variant: {
6941
- default: "outlined",
6942
- type: String
6943
- }
6944
- },
6945
- emits: [
6946
- "error",
6947
- "flowChange",
6948
- "success"
6949
- ],
6950
- setup(props, { emit }) {
6951
- const { t } = useI18n_default();
6952
- const { title: flowTitle, subtitle: flowSubtitle, messages: flowMessages } = useFlow_default();
6953
- const isInitRequestLoading = (0, vue.ref)(false);
6954
- const isInitialized = (0, vue.ref)(false);
6955
- const currentFlow = (0, vue.ref)(null);
6956
- const currentAuthenticator = (0, vue.ref)(null);
6957
- const error = (0, vue.ref)(null);
6958
- const messages = (0, vue.ref)([]);
6959
- const formValues = (0, vue.ref)({});
6960
- const touchedFields = (0, vue.ref)({});
6961
- const isLoading = () => props.isLoading || isInitRequestLoading.value;
6962
- const setupFormFields = (authenticator) => {
6963
- const vals = {};
6964
- authenticator.metadata?.params?.forEach((param) => {
6965
- vals[param.param] = "";
6966
- });
6967
- formValues.value = vals;
6968
- touchedFields.value = {};
6969
- };
6970
- const handleInputChange = (param, value) => {
6971
- formValues.value = {
6972
- ...formValues.value,
6973
- [param]: value
6974
- };
6975
- touchedFields.value = {
6976
- ...touchedFields.value,
6977
- [param]: true
6978
- };
6979
- };
6980
- const touchAllFields = () => {
6981
- const touched = {};
6982
- Object.keys(formValues.value).forEach((key) => {
6983
- touched[key] = true;
6984
- });
6985
- touchedFields.value = touched;
6986
- };
6987
- const validateForm = () => {
6988
- if (!currentAuthenticator.value) return true;
6989
- return (currentAuthenticator.value.requiredParams || []).every((key) => {
6990
- const val = formValues.value[key] || "";
6991
- return !!val && val.trim() !== "";
6992
- });
6993
- };
6994
- let handleAuthenticatorSelection;
6995
- const processNextStep = (response) => {
6996
- if (response && "flowId" in response && "nextStep" in response) {
6997
- currentFlow.value = response;
6998
- if (response.nextStep?.authenticators?.length > 0) if (response.nextStep.stepType === __thunderid_browser.EmbeddedSignInFlowStepType.MultiOptionsPrompt && response.nextStep.authenticators.length > 1) currentAuthenticator.value = null;
6999
- else {
7000
- const nextAuth = response.nextStep.authenticators[0];
7001
- if (isPasskeyAuthenticator(nextAuth)) {
7002
- handleAuthenticatorSelection(nextAuth).catch((err) => {
7003
- emit("error", err);
7004
- });
7005
- return;
7006
- }
7007
- currentAuthenticator.value = nextAuth;
7008
- setupFormFields(nextAuth);
7009
- }
7010
- if (response.nextStep?.messages) messages.value = response.nextStep.messages.map((msg) => ({
7011
- message: msg.message || "",
7012
- type: msg.type || "INFO"
7013
- }));
7014
- }
7015
- };
7016
- const handleRedirectionIfNeeded = (response) => {
7017
- if (response && "nextStep" in response && response.nextStep && response.nextStep.stepType === __thunderid_browser.EmbeddedSignInFlowStepType.AuthenticatorPrompt && response.nextStep.authenticators?.length === 1) {
7018
- const responseAuth = response.nextStep.authenticators[0];
7019
- if (responseAuth.metadata?.promptType === __thunderid_browser.EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt && responseAuth.metadata?.additionalData?.redirectUrl) {
7020
- const { redirectUrl } = responseAuth.metadata.additionalData;
7021
- const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
7022
- if (!popup) return false;
7023
- let messageHandler;
7024
- let popupMonitor;
7025
- let hasProcessedCallback = false;
7026
- const cleanup = () => {
7027
- window.removeEventListener("message", messageHandler);
7028
- if (popupMonitor) clearInterval(popupMonitor);
7029
- };
7030
- messageHandler = async (event) => {
7031
- if (event.source !== popup) return;
7032
- const expectedOrigin = props.afterSignInUrl ? new URL(props.afterSignInUrl).origin : window.location.origin;
7033
- if (event.origin !== expectedOrigin && event.origin !== window.location.origin) return;
7034
- const { code, state } = event.data;
7035
- if (code && state) {
7036
- const payload = {
7037
- flowId: currentFlow.value.flowId,
7038
- selectedAuthenticator: {
7039
- authenticatorId: responseAuth.authenticatorId,
7040
- params: {
7041
- code,
7042
- state
7043
- }
7044
- }
7045
- };
7046
- await props.onSubmit(payload, {
7047
- method: currentFlow.value?.links[0].method,
7048
- url: currentFlow.value?.links[0].href
7049
- });
7050
- popup.close();
7051
- cleanup();
7052
- }
7053
- };
7054
- window.addEventListener("message", messageHandler);
7055
- popupMonitor = setInterval(async () => {
7056
- try {
7057
- if (popup.closed) {
7058
- cleanup();
7059
- return;
7060
- }
7061
- if (hasProcessedCallback) return;
7062
- try {
7063
- const popupUrl = popup.location.href;
7064
- if (popupUrl && (popupUrl.includes("code=") || popupUrl.includes("error="))) {
7065
- hasProcessedCallback = true;
7066
- const url = new URL(popupUrl);
7067
- const code = url.searchParams.get("code");
7068
- const state = url.searchParams.get("state");
7069
- if (url.searchParams.get("error")) {
7070
- popup.close();
7071
- cleanup();
7072
- return;
7073
- }
7074
- if (code && state) {
7075
- const payload = {
7076
- flowId: currentFlow.value.flowId,
7077
- selectedAuthenticator: {
7078
- authenticatorId: responseAuth.authenticatorId,
7079
- params: {
7080
- code,
7081
- state
7082
- }
7083
- }
7084
- };
7085
- const submitResponse = await props.onSubmit(payload, {
7086
- method: currentFlow.value?.links[0].method,
7087
- url: currentFlow.value?.links[0].href
7088
- });
7089
- popup.close();
7090
- emit("flowChange", submitResponse);
7091
- if (submitResponse?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) emit("success", submitResponse.authData);
7092
- }
7093
- }
7094
- } catch {}
7095
- } catch {}
7096
- }, 1e3);
7097
- return true;
7098
- }
7099
- }
7100
- return false;
7101
- };
7102
- const handleSubmit = async (submittedValues) => {
7103
- if (!currentFlow.value || !currentAuthenticator.value) return;
7104
- touchAllFields();
7105
- if (!validateForm()) return;
7106
- isInitRequestLoading.value = true;
7107
- error.value = null;
7108
- messages.value = [];
7109
- try {
7110
- const payload = {
7111
- flowId: currentFlow.value.flowId,
7112
- selectedAuthenticator: {
7113
- authenticatorId: currentAuthenticator.value.authenticatorId,
7114
- params: submittedValues
7115
- }
7116
- };
7117
- const response = await props.onSubmit(payload, {
7118
- method: currentFlow.value.links[0].method,
7119
- url: currentFlow.value.links[0].href
7120
- });
7121
- emit("flowChange", response);
7122
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7123
- emit("success", response.authData);
7124
- return;
7125
- }
7126
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailIncomplete) {
7127
- error.value = t("errors.signin.flow.completion.failure");
7128
- return;
7129
- }
7130
- if (handleRedirectionIfNeeded(response)) return;
7131
- processNextStep(response);
7132
- } catch (err) {
7133
- error.value = err instanceof __thunderid_browser.ThunderIDAPIError ? err.message : t("errors.signin.flow.failure");
7134
- emit("error", err);
7135
- } finally {
7136
- isInitRequestLoading.value = false;
7137
- }
7138
- };
7139
- handleAuthenticatorSelection = async (authenticator, formData) => {
7140
- if (!currentFlow.value) return;
7141
- if (formData) touchAllFields();
7142
- isInitRequestLoading.value = true;
7143
- error.value = null;
7144
- messages.value = [];
7145
- try {
7146
- if (isPasskeyAuthenticator(authenticator)) {
7147
- const challengeData = authenticator.metadata?.additionalData?.challengeData;
7148
- if (!challengeData) throw new Error("Missing challenge data for passkey authentication");
7149
- const tokenResponse = await (0, __thunderid_browser.handleWebAuthnAuthentication)(challengeData);
7150
- const payload = {
7151
- flowId: currentFlow.value.flowId,
7152
- selectedAuthenticator: {
7153
- authenticatorId: authenticator.authenticatorId,
7154
- params: { tokenResponse }
7155
- }
7156
- };
7157
- const response = await props.onSubmit(payload, {
7158
- method: currentFlow.value.links[0].method,
7159
- url: currentFlow.value.links[0].href
7160
- });
7161
- emit("flowChange", response);
7162
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7163
- emit("success", response.authData);
7164
- return;
7165
- }
7166
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailIncomplete) {
7167
- error.value = t("errors.signin.flow.passkeys.completion.failure");
7168
- return;
7169
- }
7170
- processNextStep(response);
7171
- return;
7172
- }
7173
- if (authenticator.metadata?.promptType === __thunderid_browser.EmbeddedSignInFlowAuthenticatorPromptType.RedirectionPrompt) {
7174
- const payload = {
7175
- flowId: currentFlow.value.flowId,
7176
- selectedAuthenticator: {
7177
- authenticatorId: authenticator.authenticatorId,
7178
- params: {}
7179
- }
7180
- };
7181
- const response = await props.onSubmit(payload, {
7182
- method: currentFlow.value.links[0].method,
7183
- url: currentFlow.value.links[0].href
7184
- });
7185
- emit("flowChange", response);
7186
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7187
- emit("success", response.authData);
7188
- return;
7189
- }
7190
- handleRedirectionIfNeeded(response);
7191
- return;
7192
- }
7193
- if (formData) {
7194
- if (!validateForm()) return;
7195
- const formPayload = {
7196
- flowId: currentFlow.value.flowId,
7197
- selectedAuthenticator: {
7198
- authenticatorId: authenticator.authenticatorId,
7199
- params: formData
7200
- }
7201
- };
7202
- const formResponse = await props.onSubmit(formPayload, {
7203
- method: currentFlow.value.links[0].method,
7204
- url: currentFlow.value.links[0].href
7205
- });
7206
- emit("flowChange", formResponse);
7207
- if (formResponse?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7208
- emit("success", formResponse.authData);
7209
- return;
7210
- }
7211
- if (formResponse?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailCompleted || formResponse?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailIncomplete) {
7212
- error.value = t("errors.signin.flow.completion.failure");
7213
- return;
7214
- }
7215
- if (handleRedirectionIfNeeded(formResponse)) return;
7216
- processNextStep(formResponse);
7217
- return;
7218
- }
7219
- if (!!!(authenticator.metadata?.params && authenticator.metadata.params.length > 0)) {
7220
- const payload = {
7221
- flowId: currentFlow.value.flowId,
7222
- selectedAuthenticator: {
7223
- authenticatorId: authenticator.authenticatorId,
7224
- params: {}
7225
- }
7226
- };
7227
- const response = await props.onSubmit(payload, {
7228
- method: currentFlow.value.links[0].method,
7229
- url: currentFlow.value.links[0].href
7230
- });
7231
- emit("flowChange", response);
7232
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7233
- emit("success", response.authData);
7234
- return;
7235
- }
7236
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailCompleted || response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.FailIncomplete) {
7237
- error.value = t("errors.signin.flow.completion.failure");
7238
- return;
7239
- }
7240
- if (handleRedirectionIfNeeded(response)) return;
7241
- processNextStep(response);
7242
- } else {
7243
- currentAuthenticator.value = authenticator;
7244
- setupFormFields(authenticator);
7245
- }
7246
- } catch (err) {
7247
- error.value = err instanceof __thunderid_browser.ThunderIDAPIError ? err.message : t("errors.signin.flow.failure");
7248
- emit("error", err);
7249
- } finally {
7250
- isInitRequestLoading.value = false;
7251
- }
7252
- };
7253
- const hasMultipleOptions = () => !!(currentFlow.value && "nextStep" in currentFlow.value && currentFlow.value.nextStep?.stepType === __thunderid_browser.EmbeddedSignInFlowStepType.MultiOptionsPrompt && currentFlow.value.nextStep?.authenticators && currentFlow.value.nextStep.authenticators.length > 1);
7254
- const getAvailableAuthenticators = () => {
7255
- if (!currentFlow.value || !("nextStep" in currentFlow.value) || !currentFlow.value.nextStep?.authenticators) return [];
7256
- return currentFlow.value.nextStep.authenticators;
7257
- };
7258
- let initAttempted = false;
7259
- (0, vue.watch)(() => props.isLoading, (loading) => {
7260
- if (!loading && !initAttempted && props.onInitialize) {
7261
- initAttempted = true;
7262
- (async () => {
7263
- isInitRequestLoading.value = true;
7264
- error.value = null;
7265
- try {
7266
- const response = await props.onInitialize();
7267
- currentFlow.value = response;
7268
- isInitialized.value = true;
7269
- emit("flowChange", response);
7270
- if (response?.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.SuccessCompleted) {
7271
- emit("success", response.authData || {});
7272
- return;
7273
- }
7274
- if (response?.nextStep?.authenticators?.length > 0) if (response.nextStep.stepType === __thunderid_browser.EmbeddedSignInFlowStepType.MultiOptionsPrompt && response.nextStep.authenticators.length > 1) currentAuthenticator.value = null;
7275
- else {
7276
- const authenticator = response.nextStep.authenticators[0];
7277
- currentAuthenticator.value = authenticator;
7278
- setupFormFields(authenticator);
7279
- }
7280
- if (response?.nextStep?.messages) messages.value = response.nextStep.messages.map((msg) => ({
7281
- message: msg.message || "",
7282
- type: msg.type || "INFO"
7283
- }));
7284
- } catch (err) {
7285
- error.value = err instanceof __thunderid_browser.ThunderIDAPIError ? err.message : t("errors.signin.initialization");
7286
- emit("error", err);
7287
- } finally {
7288
- isInitRequestLoading.value = false;
7289
- }
7290
- })();
7291
- }
7292
- }, { immediate: true });
7293
- const renderAlertVariant = (type) => {
7294
- const lower = type.toLowerCase();
7295
- if (lower === "error") return "error";
7296
- if (lower === "warning") return "warning";
7297
- if (lower === "success") return "success";
7298
- return "info";
7299
- };
7300
- const renderMessages = () => messages.value.map((msg, i) => (0, vue.h)(Alert_default, {
7301
- key: i,
7302
- severity: renderAlertVariant(msg.type)
7303
- }, { default: () => msg.message }));
7304
- const renderError = () => error.value ? (0, vue.h)(Alert_default, { severity: "error" }, { default: () => error.value }) : null;
7305
- return () => {
7306
- const cardClass = [
7307
- (0, __thunderid_browser.withVendorCSSClassPrefix)("signin"),
7308
- (0, __thunderid_browser.withVendorCSSClassPrefix)(`signin--${props.size}`),
7309
- (0, __thunderid_browser.withVendorCSSClassPrefix)(`signin--${props.variant}`),
7310
- props.className
7311
- ].filter(Boolean).join(" ");
7312
- if (!isInitialized.value && isLoading()) return (0, vue.h)("div", {}, [props.showLogo ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__logo") }, [(0, vue.h)(Logo_default)]) : null, (0, vue.h)(Card_default, {
7313
- class: cardClass,
7314
- variant: props.variant
7315
- }, { default: () => [(0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__loading") }, [(0, vue.h)(Spinner_default, { size: "medium" }), (0, vue.h)(Typography_default, { variant: "body1" }, { default: () => t("messages.loading.placeholder") })])] })]);
7316
- if (hasMultipleOptions() && !currentAuthenticator.value) {
7317
- const available = getAvailableAuthenticators();
7318
- const userPromptAuths = available.filter((auth) => auth.metadata?.promptType === __thunderid_browser.EmbeddedSignInFlowAuthenticatorPromptType.UserPrompt || auth.idp === "LOCAL" && auth.metadata?.params && auth.metadata.params.length > 0);
7319
- const optionAuths = available.filter((auth) => !userPromptAuths.includes(auth)).filter((auth) => !HIDDEN_AUTHENTICATORS.includes(auth.authenticatorId));
7320
- return (0, vue.h)("div", {}, [props.showLogo ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__logo") }, [(0, vue.h)(Logo_default)]) : null, (0, vue.h)(Card_default, {
7321
- class: cardClass,
7322
- variant: props.variant
7323
- }, { default: () => {
7324
- const children = [];
7325
- if (props.showTitle || props.showSubtitle) children.push((0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__header") }, [props.showTitle ? (0, vue.h)(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signin.heading") }) : null, props.showSubtitle ? (0, vue.h)(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signin.subheading") }) : null]));
7326
- if (flowMessages.value?.length > 0) children.push((0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__flow-messages") }, flowMessages.value.map((fm, i) => (0, vue.h)(Alert_default, {
7327
- key: fm.id || i,
7328
- severity: fm.type
7329
- }, { default: () => fm.message }))));
7330
- if (messages.value.length > 0) children.push((0, vue.h)("div", {}, renderMessages()));
7331
- const errNode = renderError();
7332
- if (errNode) children.push(errNode);
7333
- userPromptAuths.forEach((auth, index) => {
7334
- if (index > 0) children.push((0, vue.h)(Divider_default, {}, { default: () => "OR" }));
7335
- children.push((0, vue.h)("form", { onSubmit: (e) => {
7336
- e.preventDefault();
7337
- const fd = {};
7338
- auth.metadata?.params?.forEach((p) => {
7339
- fd[p.param] = formValues.value[p.param] || "";
7340
- });
7341
- handleAuthenticatorSelection(auth, fd);
7342
- } }, [createSignInOptionFromAuthenticator(auth, formValues.value, touchedFields.value, isLoading(), handleInputChange, (a, fd) => handleAuthenticatorSelection(a, fd), t, {
7343
- buttonClassName: props.buttonClassName,
7344
- error: error.value,
7345
- inputClassName: props.inputClassName
7346
- })]));
7347
- });
7348
- if (userPromptAuths.length > 0 && optionAuths.length > 0) children.push((0, vue.h)(Divider_default, {}, { default: () => "OR" }));
7349
- optionAuths.forEach((auth) => {
7350
- children.push((0, vue.h)("div", { key: auth.authenticatorId }, [createSignInOptionFromAuthenticator(auth, formValues.value, touchedFields.value, isLoading(), handleInputChange, (a, fd) => handleAuthenticatorSelection(a, fd), t, {
7351
- buttonClassName: props.buttonClassName,
7352
- error: error.value,
7353
- inputClassName: props.inputClassName
7354
- })]));
7355
- });
7356
- return children;
7357
- } })]);
7358
- }
7359
- if (!currentAuthenticator.value) return (0, vue.h)("div", {}, [props.showLogo ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__logo") }, [(0, vue.h)(Logo_default)]) : null, (0, vue.h)(Card_default, {
7360
- class: cardClass,
7361
- variant: props.variant
7362
- }, { default: () => {
7363
- const errNode = renderError();
7364
- return errNode ? [errNode] : [(0, vue.h)(Typography_default, { variant: "body1" }, { default: () => t("messages.loading.placeholder") })];
7365
- } })]);
7366
- if (isPasskeyAuthenticator(currentAuthenticator.value) && !isLoading()) {
7367
- handleAuthenticatorSelection(currentAuthenticator.value);
7368
- return (0, vue.h)("div", {}, [props.showLogo ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__logo") }, [(0, vue.h)(Logo_default)]) : null, (0, vue.h)(Card_default, {
7369
- class: cardClass,
7370
- variant: props.variant
7371
- }, { default: () => [(0, vue.h)("div", { style: "text-align:center" }, [(0, vue.h)(Spinner_default, { size: "large" }), (0, vue.h)(Typography_default, { variant: "body1" }, { default: () => t("passkey.authenticating") || "Authenticating with passkey..." })])] })]);
7372
- }
7373
- return (0, vue.h)("div", {}, [props.showLogo ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__logo") }, [(0, vue.h)(Logo_default)]) : null, (0, vue.h)(Card_default, {
7374
- class: cardClass,
7375
- variant: props.variant
7376
- }, { default: () => {
7377
- const children = [];
7378
- children.push((0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__header") }, [(0, vue.h)(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signin.heading") }), (0, vue.h)(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signin.subheading") })]));
7379
- if (flowMessages.value?.length > 0) children.push((0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__flow-messages") }, flowMessages.value.map((fm, i) => (0, vue.h)(Alert_default, {
7380
- key: fm.id || i,
7381
- severity: fm.type
7382
- }, { default: () => fm.message }))));
7383
- if (messages.value.length > 0) children.push((0, vue.h)("div", {}, renderMessages()));
7384
- const errNode = renderError();
7385
- if (errNode) children.push(errNode);
7386
- children.push((0, vue.h)("form", {
7387
- class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signin__form"),
7388
- onSubmit: (e) => {
7389
- e.preventDefault();
7390
- const fd = {};
7391
- currentAuthenticator.value?.metadata?.params?.forEach((p) => {
7392
- fd[p.param] = formValues.value[p.param] || "";
7393
- });
7394
- handleSubmit(fd);
7395
- }
7396
- }, [createSignInOptionFromAuthenticator(currentAuthenticator.value, formValues.value, touchedFields.value, isLoading(), handleInputChange, (_, fd) => handleSubmit(fd || formValues.value), t, {
7397
- buttonClassName: props.buttonClassName,
7398
- error: error.value,
7399
- inputClassName: props.inputClassName
7400
- })]));
7401
- return children;
7402
- } })]);
7403
- };
7404
- }
7405
- });
7406
- var BaseSignIn_default$1 = BaseSignIn$2;
7407
-
7408
- //#endregion
7409
- //#region src/components/auth/sign-in/v1/SignIn.ts
7410
- /**
7411
- * V1 SignIn — app-native sign-in component using the authenticator-based flow.
7412
- *
7413
- * Initialises the flow with `signIn({ response_mode: 'direct' })` and delegates
7414
- * all UI rendering to `BaseSignInV1`.
7415
- */
7416
- const SignIn$2 = (0, vue.defineComponent)({
7417
- name: "SignInV1",
7418
- props: {
7419
- className: {
7420
- default: "",
7421
- type: String
7422
- },
7423
- size: {
7424
- default: "medium",
7425
- type: String
7426
- },
7427
- variant: {
7428
- default: "outlined",
7429
- type: String
7430
- }
7431
- },
7432
- emits: ["error", "success"],
7433
- setup(props, { emit, attrs }) {
7434
- const { signIn, afterSignInUrl, isInitialized, isLoading } = useThunderID_default();
7435
- const handleInitialize = async () => await signIn({ response_mode: "direct" });
7436
- const handleOnSubmit = async (payload, request) => await signIn(payload, request);
7437
- const handleSuccess = (authData) => {
7438
- emit("success", authData);
7439
- if (authData && afterSignInUrl) {
7440
- const url = new URL(afterSignInUrl, window.location.origin);
7441
- Object.entries(authData).forEach(([key, value]) => {
7442
- if (value !== void 0 && value !== null) url.searchParams.append(key, String(value));
7443
- });
7444
- window.location.href = url.toString();
7445
- }
7446
- };
7447
- return () => (0, vue.h)(BaseSignIn_default$1, {
7448
- ...attrs,
7449
- afterSignInUrl,
7450
- class: props.className,
7451
- isLoading: isLoading.value || !isInitialized.value,
7452
- onError: (err) => emit("error", err),
7453
- onInitialize: handleInitialize,
7454
- onSubmit: handleOnSubmit,
7455
- onSuccess: handleSuccess,
7456
- showLogo: true,
7457
- showSubtitle: true,
7458
- showTitle: true,
7459
- size: props.size,
7460
- variant: props.variant
7461
- });
7462
- }
7463
- });
7464
- var SignIn_default$1 = SignIn$2;
7465
-
7466
- //#endregion
7467
- //#region src/components/auth/sign-in/AuthOptionFactoryCore.ts
7468
- const logger$3 = createVueLogger("AuthOptionFactory");
7469
- /**
7470
- * Inline helper for consent optional attribute key (mirrors ConsentCheckboxList.getConsentOptionalKey).
7471
- */
7472
- const getConsentOptionalKey = (purposeId, attr) => `consent_${purposeId}_${attr}`;
7473
- /**
7474
- * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
7475
- *
7476
- * DOMPurify strips unknown URI schemes from attributes (e.g. `src="emoji:🦊"` → `src=""`).
7477
- * Converting them to inline spans first preserves the emoji content through sanitization.
7478
- *
7479
- * Converts:
7480
- * - `<img src="emoji:X" alt="Y">` → `<span role="img" aria-label="Y">X</span>`
7481
- * - Any remaining `emoji:X` text occurrences → `X`
7482
- */
7483
- const resolveEmojiUrisInHtml = (html) => {
7484
- return html.replace(/<img([^>]*)src="(emoji:[^"]+)"([^>]*)\/?>/gi, (_match, pre, src, post) => {
7485
- const emoji = (0, __thunderid_browser.extractEmojiFromUri)(src);
7486
- if (!emoji) return _match;
7487
- const altMatch = /alt="([^"]*)"/i.exec(pre + post);
7488
- return `<span role="img" aria-label="${altMatch ? altMatch[1] : emoji}">${emoji}</span>`;
7489
- }).replace(/emoji:([^\s"<>&]+)/g, (_, rest) => (0, __thunderid_browser.isEmojiUri)(`emoji:${rest}`) ? rest : `emoji:${rest}`);
7490
- };
7491
- /**
7492
- * Get the appropriate FieldType for an input component.
7493
- */
7494
- const getFieldType = (variant) => {
7495
- switch (variant) {
7496
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.EmailInput: return __thunderid_browser.FieldType.Email;
7497
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.PasswordInput: return __thunderid_browser.FieldType.Password;
7498
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.TextInput:
7499
- default: return __thunderid_browser.FieldType.Text;
7500
- }
7501
- };
7502
- /**
7503
- * Get typography variant from component variant.
7504
- */
7505
- const getTypographyVariant = (variant) => {
7506
- return {
7507
- BODY_1: "body1",
7508
- BODY_2: "body2",
7509
- BUTTON_TEXT: "body2",
7510
- CAPTION: "caption",
7511
- HEADING_1: "h1",
7512
- HEADING_2: "h2",
7513
- HEADING_3: "h3",
7514
- HEADING_4: "h4",
7515
- HEADING_5: "h5",
7516
- HEADING_6: "h6",
7517
- OVERLINE: "overline",
7518
- SUBTITLE_1: "subtitle1",
7519
- SUBTITLE_2: "subtitle2"
7520
- }[variant] || "h3";
7521
- };
7522
- /**
7523
- * Check if a button text or action matches a social provider.
7524
- */
7525
- const matchesSocialProvider$1 = (actionId, eventType, buttonText, provider) => {
7526
- const providerId = `${provider}_auth`;
7527
- const providerMatches = actionId === providerId || eventType === providerId;
7528
- if (buttonText.toLowerCase().includes(provider)) return true;
7529
- return providerMatches;
7530
- };
7531
- /**
7532
- * Create an auth component (VNode) from a flow component configuration.
7533
- */
7534
- const createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options = {}) => {
7535
- const key = options.key ?? component.id;
7536
- /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */
7537
- const resolve = (text) => {
7538
- if (!text || !options.t && !options.meta) return text || "";
7539
- return (0, __thunderid_browser.resolveFlowTemplateLiterals)(text, {
7540
- meta: options.meta,
7541
- t: options.t || ((k) => k)
7542
- });
7543
- };
7544
- switch (component.type) {
7545
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.TextInput:
7546
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.PasswordInput:
7547
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.EmailInput: {
7548
- const identifier = component.ref ?? "";
7549
- const value = formValues[identifier] || "";
7550
- const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
7551
- const fieldType = getFieldType(component.type);
7552
- return createField({
7553
- className: options.inputClassName,
7554
- error,
7555
- label: resolve(component.label) || "",
7556
- name: identifier,
7557
- onBlur: () => options.onInputBlur?.(identifier),
7558
- onChange: (newValue) => onInputChange(identifier, newValue),
7559
- placeholder: resolve(component.placeholder) || "",
7560
- required: component.required || false,
7561
- type: fieldType,
7562
- value
6714
+ const createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options = {}) => {
6715
+ const key = options.key ?? component.id;
6716
+ /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */
6717
+ const resolve = (text) => {
6718
+ if (!text || !options.t && !options.meta) return text || "";
6719
+ return (0, __thunderid_browser.resolveFlowTemplateLiterals)(text, {
6720
+ meta: options.meta,
6721
+ t: options.t || ((k) => k)
6722
+ });
6723
+ };
6724
+ switch (component.type) {
6725
+ case __thunderid_browser.EmbeddedFlowComponentType.TextInput:
6726
+ case __thunderid_browser.EmbeddedFlowComponentType.PasswordInput:
6727
+ case __thunderid_browser.EmbeddedFlowComponentType.EmailInput: {
6728
+ const identifier = component.ref ?? "";
6729
+ const value = formValues[identifier] || "";
6730
+ const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
6731
+ const fieldType = getFieldType(component.type);
6732
+ return createField({
6733
+ className: options.inputClassName,
6734
+ error,
6735
+ label: resolve(component.label) || "",
6736
+ name: identifier,
6737
+ onBlur: () => options.onInputBlur?.(identifier),
6738
+ onChange: (newValue) => onInputChange(identifier, newValue),
6739
+ placeholder: resolve(component.placeholder) || "",
6740
+ required: component.required || false,
6741
+ type: fieldType,
6742
+ value
7563
6743
  });
7564
6744
  }
7565
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Action: {
6745
+ case __thunderid_browser.EmbeddedFlowComponentType.Action: {
7566
6746
  const actionId = component.id;
7567
6747
  const eventType = component.eventType || "";
7568
6748
  const buttonText = resolve(component.label);
7569
6749
  const componentVariant = component.variant || "";
7570
- const shouldSkipValidation = eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventTypeV2.Trigger;
6750
+ const shouldSkipValidation = eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventType.Trigger;
7571
6751
  const handleClick = () => {
7572
6752
  if (options.onSubmit) {
7573
6753
  const formData = {};
@@ -7575,7 +6755,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7575
6755
  formData[field] = formValues[field];
7576
6756
  });
7577
6757
  const consentPrompt = options.additionalData?.["consentPrompt"];
7578
- if (consentPrompt && eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventTypeV2.Submit) {
6758
+ if (consentPrompt && eventType.toUpperCase() === __thunderid_browser.EmbeddedFlowEventType.Submit) {
7579
6759
  const isDeny = componentVariant.toLowerCase() !== "primary";
7580
6760
  const decisions = { purposes: consentPrompt.purposes.map((p) => ({
7581
6761
  approved: !isDeny,
@@ -7593,22 +6773,22 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7593
6773
  options.onSubmit(component, formData, shouldSkipValidation);
7594
6774
  }
7595
6775
  };
7596
- if (matchesSocialProvider$1(actionId, eventType, buttonText, "google")) return (0, vue.h)(GoogleButton_default, {
6776
+ if (matchesSocialProvider(actionId, eventType, buttonText, "google")) return (0, vue.h)(GoogleButton_default, {
7597
6777
  class: options.buttonClassName,
7598
6778
  key,
7599
6779
  onClick: handleClick
7600
6780
  });
7601
- if (matchesSocialProvider$1(actionId, eventType, buttonText, "github")) return (0, vue.h)(GitHubButton_default, {
6781
+ if (matchesSocialProvider(actionId, eventType, buttonText, "github")) return (0, vue.h)(GitHubButton_default, {
7602
6782
  class: options.buttonClassName,
7603
6783
  key,
7604
6784
  onClick: handleClick
7605
6785
  });
7606
- if (matchesSocialProvider$1(actionId, eventType, buttonText, "facebook")) return (0, vue.h)(FacebookButton_default, {
6786
+ if (matchesSocialProvider(actionId, eventType, buttonText, "facebook")) return (0, vue.h)(FacebookButton_default, {
7607
6787
  class: options.buttonClassName,
7608
6788
  key,
7609
6789
  onClick: handleClick
7610
6790
  });
7611
- if (matchesSocialProvider$1(actionId, eventType, buttonText, "microsoft")) return (0, vue.h)(MicrosoftButton_default, {
6791
+ if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft")) return (0, vue.h)(MicrosoftButton_default, {
7612
6792
  class: options.buttonClassName,
7613
6793
  key,
7614
6794
  onClick: handleClick
@@ -7646,7 +6826,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7646
6826
  variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline"
7647
6827
  }, { default: () => buttonText || "Submit" });
7648
6828
  }
7649
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Text: {
6829
+ case __thunderid_browser.EmbeddedFlowComponentType.Text: {
7650
6830
  const variant = getTypographyVariant(component.variant ?? "");
7651
6831
  return (0, vue.h)(Typography_default, {
7652
6832
  key,
@@ -7657,11 +6837,11 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7657
6837
  variant
7658
6838
  }, { default: () => resolve(component.label) });
7659
6839
  }
7660
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Divider: {
6840
+ case __thunderid_browser.EmbeddedFlowComponentType.Divider: {
7661
6841
  const dividerLabel = resolve(component.label) || "";
7662
6842
  return (0, vue.h)(Divider_default, { key }, dividerLabel ? { default: () => dividerLabel } : void 0);
7663
6843
  }
7664
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Select: {
6844
+ case __thunderid_browser.EmbeddedFlowComponentType.Select: {
7665
6845
  const identifier = component.ref ?? "";
7666
6846
  const value = formValues[identifier] || "";
7667
6847
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
@@ -7683,7 +6863,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7683
6863
  required: component.required
7684
6864
  });
7685
6865
  }
7686
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Block:
6866
+ case __thunderid_browser.EmbeddedFlowComponentType.Block:
7687
6867
  if (component.components && component.components.length > 0) {
7688
6868
  const blockChildren = component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, {
7689
6869
  ...options,
@@ -7695,12 +6875,12 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7695
6875
  }, blockChildren);
7696
6876
  }
7697
6877
  return null;
7698
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.RichText: return (0, vue.h)("div", {
6878
+ case __thunderid_browser.EmbeddedFlowComponentType.RichText: return (0, vue.h)("div", {
7699
6879
  innerHTML: dompurify.default.sanitize(resolveEmojiUrisInHtml(resolve(component.label))),
7700
6880
  key,
7701
6881
  style: { overflowWrap: "anywhere" }
7702
6882
  });
7703
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Image: {
6883
+ case __thunderid_browser.EmbeddedFlowComponentType.Image: {
7704
6884
  const explicitHeight = resolve(component.height?.toString());
7705
6885
  const explicitWidth = resolve(component.width?.toString());
7706
6886
  return (0, vue.h)("img", {
@@ -7714,10 +6894,10 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7714
6894
  }
7715
6895
  });
7716
6896
  }
7717
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Icon:
7718
- logger$3.warn(`Icon component type is not yet supported in the Vue SDK. Skipping render.`);
6897
+ case __thunderid_browser.EmbeddedFlowComponentType.Icon:
6898
+ logger$2.warn(`Icon component type is not yet supported in the Vue SDK. Skipping render.`);
7719
6899
  return null;
7720
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Stack: {
6900
+ case __thunderid_browser.EmbeddedFlowComponentType.Stack: {
7721
6901
  const direction = component.direction || "row";
7722
6902
  const gap = component.gap ?? 2;
7723
6903
  const align = component.align || "center";
@@ -7740,10 +6920,10 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7740
6920
  style: stackStyle
7741
6921
  }, stackChildren.filter(Boolean));
7742
6922
  }
7743
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Consent:
7744
- logger$3.warn(`Consent component type is not yet fully supported in the Vue SDK.`);
6923
+ case __thunderid_browser.EmbeddedFlowComponentType.Consent:
6924
+ logger$2.warn(`Consent component type is not yet fully supported in the Vue SDK.`);
7745
6925
  return null;
7746
- case __thunderid_browser.EmbeddedFlowComponentTypeV2.Timer: {
6926
+ case __thunderid_browser.EmbeddedFlowComponentType.Timer: {
7747
6927
  const textTemplate = resolve(component.label) || "Time remaining: {time}";
7748
6928
  const timeoutMs = Number(options.additionalData?.["stepTimeout"]) || 0;
7749
6929
  const expiresIn = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3)) : 0;
@@ -7754,7 +6934,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
7754
6934
  }, timerText);
7755
6935
  }
7756
6936
  default:
7757
- logger$3.warn(`Unsupported component type: ${component.type}. Skipping render.`);
6937
+ logger$2.warn(`Unsupported component type: ${component.type}. Skipping render.`);
7758
6938
  return null;
7759
6939
  }
7760
6940
  };
@@ -7783,7 +6963,7 @@ const renderInviteUserComponents = (components, formValues, touchedFields, formE
7783
6963
  })).filter((v) => v !== null);
7784
6964
 
7785
6965
  //#endregion
7786
- //#region src/utils/v2/resolveTranslationsInObject.ts
6966
+ //#region src/utils/resolveTranslationsInObject.ts
7787
6967
  /**
7788
6968
  * Resolves all {{ t() }} and {{ meta() }} template expressions in an object's string properties.
7789
6969
  * @param obj - The object to process
@@ -7810,7 +6990,7 @@ const resolveTranslationsInObject = (obj, t, properties = [
7810
6990
  };
7811
6991
 
7812
6992
  //#endregion
7813
- //#region src/utils/v2/resolveTranslationsInArray.ts
6993
+ //#region src/utils/resolveTranslationsInArray.ts
7814
6994
  /**
7815
6995
  * Recursively resolves translation and meta template strings in an array of objects.
7816
6996
  * @param items - Array of objects to process
@@ -7827,7 +7007,7 @@ const resolveTranslationsInArray = (items, t, properties, meta) => items.map((it
7827
7007
  var resolveTranslationsInArray_default = resolveTranslationsInArray;
7828
7008
 
7829
7009
  //#endregion
7830
- //#region src/utils/v2/flowTransformer.ts
7010
+ //#region src/utils/flowTransformer.ts
7831
7011
  /**
7832
7012
  * Create a mapping from ref to identifier based on data.inputs array.
7833
7013
  */
@@ -7937,7 +7117,7 @@ const normalizeFlowResponse = (response, t, options = {}, meta) => {
7937
7117
  };
7938
7118
 
7939
7119
  //#endregion
7940
- //#region src/components/auth/sign-in/v2/BaseSignIn.ts
7120
+ //#region src/components/auth/sign-in/BaseSignIn.ts
7941
7121
  const extractFormFields$1 = (flowComponents) => {
7942
7122
  const fields = [];
7943
7123
  const process = (comps) => {
@@ -7973,7 +7153,7 @@ const extractFormFields$1 = (flowComponents) => {
7973
7153
  * </BaseSignIn>
7974
7154
  * ```
7975
7155
  */
7976
- const BaseSignIn$1 = (0, vue.defineComponent)({
7156
+ const BaseSignIn = (0, vue.defineComponent)({
7977
7157
  name: "BaseSignIn",
7978
7158
  props: {
7979
7159
  additionalData: {
@@ -8183,7 +7363,7 @@ const BaseSignIn$1 = (0, vue.defineComponent)({
8183
7363
  };
8184
7364
  }
8185
7365
  });
8186
- var BaseSignIn_default$2 = BaseSignIn$1;
7366
+ var BaseSignIn_default = BaseSignIn;
8187
7367
 
8188
7368
  //#endregion
8189
7369
  //#region src/utils/oauth.ts
@@ -8208,7 +7388,7 @@ function initiateOAuthRedirect(redirectURL) {
8208
7388
  }
8209
7389
 
8210
7390
  //#endregion
8211
- //#region src/utils/v2/passkey.ts
7391
+ //#region src/utils/passkey.ts
8212
7392
  /**
8213
7393
  * Handles WebAuthn/Passkey registration flow for browser environments.
8214
7394
  *
@@ -8294,7 +7474,7 @@ const handlePasskeyAuthentication = async (challengeData) => {
8294
7474
  };
8295
7475
 
8296
7476
  //#endregion
8297
- //#region src/components/auth/sign-in/v2/SignIn.ts
7477
+ //#region src/components/auth/sign-in/SignIn.ts
8298
7478
  const EXECUTION_ID_STORAGE_KEY = "thunderid_execution_id";
8299
7479
  /**
8300
7480
  * SignIn — app-native sign-in component with full flow lifecycle management.
@@ -8316,7 +7496,7 @@ const EXECUTION_ID_STORAGE_KEY = "thunderid_execution_id";
8316
7496
  * </SignIn>
8317
7497
  * ```
8318
7498
  */
8319
- const SignIn$1 = (0, vue.defineComponent)({
7499
+ const SignIn = (0, vue.defineComponent)({
8320
7500
  name: "SignIn",
8321
7501
  props: {
8322
7502
  className: {
@@ -8430,7 +7610,7 @@ const SignIn$1 = (0, vue.defineComponent)({
8430
7610
  flowType: __thunderid_browser.EmbeddedFlowType.Authentication,
8431
7611
  ...scopes && { scopes }
8432
7612
  });
8433
- if (response.type === __thunderid_browser.EmbeddedSignInFlowTypeV2.Redirection) {
7613
+ if (response.type === __thunderid_browser.EmbeddedSignInFlowType.Redirection) {
8434
7614
  const redirectURL = response.data?.redirectURL || response?.redirectURL;
8435
7615
  if (redirectURL && window?.location) {
8436
7616
  if (response.executionId) persistExecutionId(response.executionId);
@@ -8503,7 +7683,7 @@ const SignIn$1 = (0, vue.defineComponent)({
8503
7683
  ...payload,
8504
7684
  inputs: processedInputs
8505
7685
  });
8506
- if (response.type === __thunderid_browser.EmbeddedSignInFlowTypeV2.Redirection) {
7686
+ if (response.type === __thunderid_browser.EmbeddedSignInFlowType.Redirection) {
8507
7687
  const redirectURL = response.data?.redirectURL || response?.redirectURL;
8508
7688
  if (redirectURL && window?.location) {
8509
7689
  if (response.executionId) persistExecutionId(response.executionId);
@@ -8531,14 +7711,14 @@ const SignIn$1 = (0, vue.defineComponent)({
8531
7711
  return;
8532
7712
  }
8533
7713
  const { executionId: normalizedExecutionId, components: normalizedComponents, additionalData: normalizedAdditionalData } = normalizeFlowResponse(response, t, { resolveTranslations: false }, flowMeta.value);
8534
- if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatusV2.Error) {
7714
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Error) {
8535
7715
  clearFlowState();
8536
7716
  const err = new Error(extractErrorMessage(response, t));
8537
7717
  setError(err);
8538
7718
  cleanupFlowUrlParams();
8539
7719
  throw err;
8540
7720
  }
8541
- if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatusV2.Complete) {
7721
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Complete) {
8542
7722
  const finalRedirectUrl = response?.redirectUrl || response?.redirect_uri || afterSignInUrl;
8543
7723
  isSubmitting.value = false;
8544
7724
  persistExecutionId(null);
@@ -8633,868 +7813,92 @@ const SignIn$1 = (0, vue.defineComponent)({
8633
7813
  isActive: false
8634
7814
  };
8635
7815
  } catch (error) {
8636
- const err = error;
8637
- passkeyState.value = {
8638
- ...passkeyState.value,
8639
- error: err,
8640
- isActive: false
8641
- };
8642
- flowError.value = err;
8643
- emit("error", err);
8644
- }
8645
- }, { deep: true });
8646
- useOAuthCallback$1({
8647
- currentExecutionId,
8648
- executionIdStorageKey: EXECUTION_ID_STORAGE_KEY,
8649
- isInitialized,
8650
- isSubmitting,
8651
- onError: (err) => {
8652
- if (!flowError.value) {
8653
- clearFlowState();
8654
- setError(err instanceof Error ? err : new Error(String(err)));
8655
- }
8656
- },
8657
- onSubmit: (payload) => handleSubmit({
8658
- executionId: payload.executionId,
8659
- inputs: payload.inputs
8660
- }),
8661
- processedFlag: oauthCodeProcessedFlag,
8662
- setExecutionId: persistExecutionId
8663
- });
8664
- (0, vue.onMounted)(async () => {
8665
- const urlParams = getUrlParams$1();
8666
- if (urlParams.authId) {
8667
- const sm = getStorageManager();
8668
- if (sm) await sm.setHybridDataParameter("authId", urlParams.authId);
8669
- }
8670
- });
8671
- (0, vue.watch)(() => [
8672
- isInitialized.value,
8673
- sdkLoading.value,
8674
- isFlowInitialized.value,
8675
- currentExecutionId.value,
8676
- isSubmitting.value
8677
- ], ([initialized, loading, flowInit, executionId, submitting]) => {
8678
- const urlParams = getUrlParams$1();
8679
- const hasOAuthCode = !!urlParams.code;
8680
- const hasOAuthState = !!urlParams.state;
8681
- if (initialized && !loading && !flowInit && !initializationAttempted && !executionId && !hasOAuthCode && !hasOAuthState && !submitting && !oauthCodeProcessedFlag.value) {
8682
- initializationAttempted = true;
8683
- initializeFlow();
8684
- }
8685
- });
8686
- return () => {
8687
- const combinedIsLoading = sdkLoading.value || isSubmitting.value || !isInitialized.value;
8688
- if (slots["default"]) {
8689
- const renderProps = {
8690
- additionalData: additionalData.value,
8691
- components: components.value,
8692
- error: flowError.value,
8693
- initialize: initializeFlow,
8694
- isInitialized: isFlowInitialized.value,
8695
- isLoading: combinedIsLoading,
8696
- isTimeoutDisabled: isTimeoutDisabled.value,
8697
- meta: flowMeta.value,
8698
- onSubmit: handleSubmit
8699
- };
8700
- return (0, vue.h)("div", {}, slots["default"](renderProps));
8701
- }
8702
- return (0, vue.h)(BaseSignIn_default$2, {
8703
- ...attrs,
8704
- additionalData: additionalData.value,
8705
- class: props.className,
8706
- components: components.value,
8707
- error: flowError.value,
8708
- isLoading: combinedIsLoading || !isFlowInitialized.value,
8709
- isTimeoutDisabled: isTimeoutDisabled.value,
8710
- onError: (err) => emit("error", err),
8711
- onSubmit: handleSubmit,
8712
- size: props.size,
8713
- variant: props.variant
8714
- });
8715
- };
8716
- }
8717
- });
8718
- var SignIn_default$2 = SignIn$1;
8719
-
8720
- //#endregion
8721
- //#region src/components/auth/sign-in/SignIn.ts
8722
- /**
8723
- * SignIn — platform-aware sign-in component.
8724
- *
8725
- * Routes to the V1 (authenticator-based) flow by default or the V2
8726
- * (component-driven) flow when `platform` is set to `Platform.ThunderID`.
8727
- */
8728
- const SignIn = (0, vue.defineComponent)({
8729
- name: "SignIn",
8730
- props: {
8731
- className: {
8732
- default: "",
8733
- type: String
8734
- },
8735
- size: {
8736
- default: "medium",
8737
- type: String
8738
- },
8739
- variant: {
8740
- default: "outlined",
8741
- type: String
8742
- }
8743
- },
8744
- emits: ["error", "success"],
8745
- setup(props, { slots, emit, attrs }) {
8746
- const { platform } = useThunderID_default();
8747
- return () => {
8748
- if (platform === __thunderid_browser.Platform.ThunderID) return (0, vue.h)(SignIn_default$2, {
8749
- ...attrs,
8750
- class: props.className,
8751
- onError: (err) => emit("error", err),
8752
- onSuccess: (data) => emit("success", data),
8753
- size: props.size,
8754
- variant: props.variant
8755
- }, slots);
8756
- return (0, vue.h)(SignIn_default$1, {
8757
- ...attrs,
8758
- class: props.className,
8759
- onError: (err) => emit("error", err),
8760
- onSuccess: (data) => emit("success", data),
8761
- size: props.size,
8762
- variant: props.variant
8763
- }, slots);
8764
- };
8765
- }
8766
- });
8767
- var SignIn_default = SignIn;
8768
-
8769
- //#endregion
8770
- //#region src/components/auth/sign-in/BaseSignIn.ts
8771
- /**
8772
- * BaseSignIn — platform-aware base sign-in component.
8773
- *
8774
- * Routes to the V1 (authenticator-based) or V2 (component-driven) BaseSignIn
8775
- * based on the configured `platform`.
8776
- */
8777
- const BaseSignIn = (0, vue.defineComponent)({
8778
- name: "BaseSignIn",
8779
- inheritAttrs: false,
8780
- setup(_props, { attrs, slots }) {
8781
- const { platform } = useThunderID_default();
8782
- return () => {
8783
- if (platform === __thunderid_browser.Platform.ThunderID) return (0, vue.h)(BaseSignIn_default$2, { ...attrs }, slots);
8784
- return (0, vue.h)(BaseSignIn_default$1, { ...attrs }, slots);
8785
- };
8786
- }
8787
- });
8788
- var BaseSignIn_default = BaseSignIn;
8789
-
8790
- //#endregion
8791
- //#region src/components/auth/sign-up/v1/options/SignUpOptionFactory.ts
8792
- /**
8793
- * Mirrors the logic in `packages/react/.../SignUp/v1/SignUpOptionFactory.tsx` —
8794
- * renders the V1 flow component shapes (`TYPOGRAPHY`, `INPUT`, `BUTTON`,
8795
- * `FORM`, `SELECT`, `DIVIDER`, `IMAGE`, `RICH_TEXT`) returned by the ThunderID
8796
- * `/api/server/v1/flow/execute` endpoint.
8797
- *
8798
- * Each leaf component returns a Vue VNode (or null for unknown types). Branch
8799
- * components (`FORM`) recurse so children render as a flat list.
8800
- */
8801
- /**
8802
- * Resolve the form-field name for an input component.
8803
- * ThunderID V1 stores the bound parameter name in `config.identifier` (e.g.
8804
- * `http://wso2.org/claims/emailaddress`), with `config.name` used as a fallback.
8805
- */
8806
- const getInputName = (component) => {
8807
- const cfg = component.config || {};
8808
- return cfg.name || cfg.identifier || component.id;
8809
- };
8810
- /**
8811
- * Map V1 INPUT variants/types to the SDK's internal `FieldType` so the existing
8812
- * `createField` factory (used by the V1 sign-in flow too) produces the right
8813
- * primitive (`TextField`, `PasswordField`, `Checkbox`, etc.).
8814
- */
8815
- const inferFieldType = (component) => {
8816
- const variant = String(component.variant || "").toUpperCase();
8817
- const cfg = component.config || {};
8818
- const cfgType = String(cfg.type || "").toLowerCase();
8819
- if (variant === "EMAIL" || cfgType === "email") return __thunderid_browser.FieldType.Email;
8820
- if (variant === "PASSWORD" || cfgType === "password") return __thunderid_browser.FieldType.Password;
8821
- if (variant === "TELEPHONE" || cfgType === "tel") return __thunderid_browser.FieldType.Text;
8822
- if (variant === "NUMBER" || cfgType === "number") return __thunderid_browser.FieldType.Number;
8823
- if (variant === "DATE" || cfgType === "date") return __thunderid_browser.FieldType.Date;
8824
- if (variant === "CHECKBOX" || cfgType === "checkbox") return __thunderid_browser.FieldType.Checkbox;
8825
- return __thunderid_browser.FieldType.Text;
8826
- };
8827
- /**
8828
- * Map TYPOGRAPHY variants (H1-H6, BODY, CAPTION etc.) to the Vue Typography
8829
- * primitive's variant prop.
8830
- */
8831
- const inferTypographyVariant = (component) => {
8832
- switch (String(component.variant || "").toUpperCase()) {
8833
- case "H1": return "h1";
8834
- case "H2": return "h2";
8835
- case "H3": return "h3";
8836
- case "H4": return "h4";
8837
- case "H5": return "h5";
8838
- case "H6": return "h6";
8839
- case "SUBTITLE1": return "subtitle1";
8840
- case "SUBTITLE2": return "subtitle2";
8841
- case "BODY2": return "body2";
8842
- case "CAPTION": return "caption";
8843
- case "OVERLINE": return "overline";
8844
- default: return "body1";
8845
- }
8846
- };
8847
- /**
8848
- * Detect whether a BUTTON looks like a known social-login provider so we can
8849
- * render a branded button (matches the React V1 factory's behaviour).
8850
- */
8851
- const matchesSocialProvider = (component, provider) => {
8852
- const text = String(component?.config?.text || component?.config?.label || "").toLowerCase();
8853
- return String(component?.variant || "").toUpperCase() === "SOCIAL" && text.includes(provider);
8854
- };
8855
- /**
8856
- * Build a VNode for a single V1 flow component. Returns `null` for unknown
8857
- * types (caller filters these out).
8858
- */
8859
- const createSignUpComponent = (props) => {
8860
- const { component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, onSubmit, inputClassName, buttonClassName } = props;
8861
- const cfg = component.config || {};
8862
- switch (component.type) {
8863
- case __thunderid_browser.EmbeddedFlowComponentType.Typography: {
8864
- const text = String(cfg.text || cfg.label || "");
8865
- return (0, vue.h)(Typography_default, {
8866
- style: "margin-bottom:0.5rem",
8867
- variant: inferTypographyVariant(component)
8868
- }, { default: () => text });
8869
- }
8870
- case __thunderid_browser.EmbeddedFlowComponentType.Input: {
8871
- const name = getInputName(component);
8872
- const fieldType = inferFieldType(component);
8873
- const value = formValues[name] || "";
8874
- const isTouched = touchedFields[name] || false;
8875
- return createField({
8876
- className: inputClassName,
8877
- disabled: isLoading,
8878
- error: isTouched ? formErrors[name] : void 0,
8879
- label: String(cfg.label || ""),
8880
- name,
8881
- onChange: (newValue) => onInputChange(name, newValue),
8882
- placeholder: String(cfg.placeholder || ""),
8883
- required: Boolean(cfg.required),
8884
- touched: isTouched,
8885
- type: fieldType,
8886
- value
8887
- });
8888
- }
8889
- case __thunderid_browser.EmbeddedFlowComponentType.Button: {
8890
- const text = String(cfg.text || cfg.label || "Submit");
8891
- const isPrimary = String(component.variant || "PRIMARY").toUpperCase() === "PRIMARY";
8892
- const handleClick = () => onSubmit(component, void 0);
8893
- if (matchesSocialProvider(component, "google")) return (0, vue.h)(GoogleButton_default, {
8894
- class: buttonClassName,
8895
- isLoading,
8896
- onClick: handleClick
8897
- });
8898
- if (matchesSocialProvider(component, "github")) return (0, vue.h)(GitHubButton_default, {
8899
- class: buttonClassName,
8900
- isLoading,
8901
- onClick: handleClick
8902
- });
8903
- if (matchesSocialProvider(component, "microsoft")) return (0, vue.h)(MicrosoftButton_default, {
8904
- class: buttonClassName,
8905
- isLoading,
8906
- onClick: handleClick
8907
- });
8908
- if (matchesSocialProvider(component, "facebook")) return (0, vue.h)(FacebookButton_default, {
8909
- class: buttonClassName,
8910
- isLoading,
8911
- onClick: handleClick
8912
- });
8913
- return (0, vue.h)(Button_default, {
8914
- class: buttonClassName,
8915
- color: isPrimary ? "primary" : "secondary",
8916
- "data-testid": "thunderid-signup-submit",
8917
- disabled: isLoading || !isFormValid && cfg.type === "submit",
8918
- fullWidth: true,
8919
- loading: isLoading,
8920
- onClick: handleClick,
8921
- type: cfg.type === "submit" ? "submit" : "button",
8922
- variant: isPrimary ? "solid" : "outline"
8923
- }, { default: () => text });
8924
- }
8925
- case __thunderid_browser.EmbeddedFlowComponentType.Form: {
8926
- const children = component.components || [];
8927
- const nodes = [];
8928
- children.forEach((child) => {
8929
- const rendered = createSignUpComponent({
8930
- ...props,
8931
- component: child
8932
- });
8933
- if (rendered === null) return;
8934
- if (Array.isArray(rendered)) nodes.push(...rendered);
8935
- else nodes.push(rendered);
8936
- });
8937
- return nodes;
8938
- }
8939
- case __thunderid_browser.EmbeddedFlowComponentType.Divider: return (0, vue.h)("hr", {
8940
- class: "thunderid-signup__divider",
8941
- style: "margin:0.75rem 0;border:0;border-top:1px solid #e5e7eb"
8942
- });
8943
- case __thunderid_browser.EmbeddedFlowComponentType.Image: {
8944
- const src = String(cfg.src || cfg.url || "");
8945
- const alt = String(cfg.alt || "");
8946
- if (!src) return null;
8947
- return (0, vue.h)("img", {
8948
- alt,
8949
- src,
8950
- style: "max-width:100%;height:auto;display:block;margin:0.5rem auto"
8951
- });
8952
- }
8953
- default:
8954
- if (String(component.type).toUpperCase() === "RICH_TEXT") return (0, vue.h)("div", {
8955
- class: "thunderid-signup__rich-text",
8956
- innerHTML: String(cfg.text || cfg.label || "")
8957
- });
8958
- return null;
8959
- }
8960
- };
8961
- /**
8962
- * Render an array of V1 flow components as Vue VNodes, flattening nested
8963
- * containers (FORM) into a single list.
8964
- */
8965
- const renderSignUpComponents$1 = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, onSubmit, options) => {
8966
- const result = [];
8967
- components.forEach((component) => {
8968
- const rendered = createSignUpComponent({
8969
- buttonClassName: options?.buttonClassName,
8970
- component,
8971
- formErrors,
8972
- formValues,
8973
- inputClassName: options?.inputClassName,
8974
- isFormValid,
8975
- isLoading,
8976
- onInputChange,
8977
- onSubmit,
8978
- size: options?.size,
8979
- touchedFields
8980
- });
8981
- if (rendered === null) return;
8982
- if (Array.isArray(rendered)) result.push(...rendered);
8983
- else result.push(rendered);
8984
- });
8985
- return result;
8986
- };
8987
-
8988
- //#endregion
8989
- //#region src/components/auth/sign-up/v1/BaseSignUp.ts
8990
- const logger$2 = createVueLogger("BaseSignUpV1");
8991
- /**
8992
- * V1 BaseSignUp — component-driven app-native sign-up for Vue.
8993
- *
8994
- * Mirrors `packages/react/.../SignUp/v1/BaseSignUp.tsx`. Reads the
8995
- * `/api/server/v1/flow/execute` response shape (`TYPOGRAPHY`, `FORM`, `INPUT`,
8996
- * `BUTTON`, `RICH_TEXT`, etc.) and renders it via the V1
8997
- * `SignUpOptionFactory`. Tracks form state internally and submits steps via
8998
- * the `onSubmit` prop until the flow completes.
8999
- */
9000
- const BaseSignUp$2 = (0, vue.defineComponent)({
9001
- name: "BaseSignUpV1",
9002
- props: {
9003
- afterSignUpUrl: {
9004
- default: void 0,
9005
- type: String
9006
- },
9007
- buttonClassName: {
9008
- default: "",
9009
- type: String
9010
- },
9011
- className: {
9012
- default: "",
9013
- type: String
9014
- },
9015
- errorClassName: {
9016
- default: "",
9017
- type: String
9018
- },
9019
- inputClassName: {
9020
- default: "",
9021
- type: String
9022
- },
9023
- isInitialized: {
9024
- default: true,
9025
- type: Boolean
9026
- },
9027
- messageClassName: {
9028
- default: "",
9029
- type: String
9030
- },
9031
- onComplete: {
9032
- default: void 0,
9033
- type: Function
9034
- },
9035
- onError: {
9036
- default: void 0,
9037
- type: Function
9038
- },
9039
- onFlowChange: {
9040
- default: void 0,
9041
- type: Function
9042
- },
9043
- onInitialize: {
9044
- default: void 0,
9045
- type: Function
9046
- },
9047
- onSubmit: {
9048
- default: void 0,
9049
- type: Function
9050
- },
9051
- shouldRedirectAfterSignUp: {
9052
- default: true,
9053
- type: Boolean
9054
- },
9055
- showLogo: {
9056
- default: true,
9057
- type: Boolean
9058
- },
9059
- showSubtitle: {
9060
- default: true,
9061
- type: Boolean
9062
- },
9063
- showTitle: {
9064
- default: true,
9065
- type: Boolean
9066
- },
9067
- size: {
9068
- default: "medium",
9069
- type: String
9070
- },
9071
- variant: {
9072
- default: "outlined",
9073
- type: String
9074
- }
9075
- },
9076
- emits: [
9077
- "error",
9078
- "flowChange",
9079
- "complete"
9080
- ],
9081
- setup(props, { slots, emit }) {
9082
- const { t } = useI18n_default();
9083
- const { title: flowTitle, subtitle: flowSubtitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
9084
- const isLoading = (0, vue.ref)(false);
9085
- const isFlowInitialized = (0, vue.ref)(false);
9086
- const currentFlow = (0, vue.ref)(null);
9087
- const formValues = (0, vue.ref)({});
9088
- const touchedFields = (0, vue.ref)({});
9089
- const formErrors = (0, vue.ref)({});
9090
- let initializationAttempted = false;
9091
- const handleError = (err) => {
9092
- let errorMessage = t("errors.signup.flow.failure") || "Sign-up failed";
9093
- if (err && typeof err === "object") {
9094
- if (err.code && (err.message || err.description)) errorMessage = err.description || err.message;
9095
- else if (err.message) errorMessage = err.message;
9096
- } else if (typeof err === "string") errorMessage = err;
9097
- clearMessages();
9098
- addMessage({
9099
- message: errorMessage,
9100
- type: "error"
9101
- });
9102
- };
9103
- /**
9104
- * Walk the V1 component tree and collect every INPUT's bound parameter
9105
- * name. The parameter name comes from `config.identifier` (a SCIM claim
9106
- * URI) or `config.name`, falling back to the component id.
9107
- */
9108
- const collectInputNames = (components) => {
9109
- const names = [];
9110
- const walk = (comps) => {
9111
- comps.forEach((component) => {
9112
- const cfg = component.config || {};
9113
- if (component.type === __thunderid_browser.EmbeddedFlowComponentType.Input) {
9114
- const name = cfg.name || cfg.identifier || component.id;
9115
- if (name) names.push(name);
9116
- }
9117
- const children = component.components || [];
9118
- if (children.length > 0) walk(children);
9119
- });
9120
- };
9121
- walk(components);
9122
- return names;
9123
- };
9124
- const setupFormFields = (response) => {
9125
- const names = collectInputNames(response.data?.components || []);
9126
- const initial = {};
9127
- names.forEach((name) => {
9128
- initial[name] = "";
9129
- });
9130
- formValues.value = initial;
9131
- touchedFields.value = {};
9132
- formErrors.value = {};
9133
- };
9134
- const handleInputChange = (name, value) => {
9135
- formValues.value = {
9136
- ...formValues.value,
9137
- [name]: value
9138
- };
9139
- touchedFields.value = {
9140
- ...touchedFields.value,
9141
- [name]: true
9142
- };
9143
- if (formErrors.value[name]) {
9144
- const next = { ...formErrors.value };
9145
- delete next[name];
9146
- formErrors.value = next;
9147
- }
9148
- };
9149
- const isFormValid = () => Object.keys(formErrors.value).length === 0;
9150
- /**
9151
- * Mirror the React V1 popup-based redirection handler for social/IdP
9152
- * registration steps. Opens a popup, waits for the OAuth code, and submits
9153
- * `{code, state}` as the next flow step.
9154
- *
9155
- * Returns `true` if redirection was handled (caller should not fall
9156
- * through), `false` otherwise.
9157
- */
9158
- const handleRedirectionIfNeeded = (response) => {
9159
- if (response?.type !== __thunderid_browser.EmbeddedFlowResponseType.Redirection || !response?.data?.redirectURL) return false;
9160
- if (typeof window === "undefined") return false;
9161
- const redirectUrl = response.data.redirectURL;
9162
- const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
9163
- if (!popup) {
9164
- logger$2.error("Failed to open popup window for social sign-up redirect");
9165
- return false;
9166
- }
9167
- let processed = false;
9168
- let popupMonitor;
9169
- let messageHandler;
9170
- const cleanup = () => {
9171
- window.removeEventListener("message", messageHandler);
9172
- if (popupMonitor) clearInterval(popupMonitor);
9173
- };
9174
- const continueWithCode = async (code, state) => {
9175
- const payload = {
9176
- ...currentFlow.value?.flowId && { flowId: currentFlow.value.flowId },
9177
- actionId: "",
9178
- flowType: currentFlow.value?.flowType || "REGISTRATION",
9179
- inputs: {
9180
- code,
9181
- state
9182
- }
9183
- };
9184
- try {
9185
- const next = await props.onSubmit(payload);
9186
- props.onFlowChange?.(next);
9187
- emit("flowChange", next);
9188
- if (next.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) {
9189
- props.onComplete?.(next);
9190
- emit("complete", next);
9191
- } else if (next.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) {
9192
- currentFlow.value = next;
9193
- setupFormFields(next);
9194
- }
9195
- } catch (err) {
9196
- handleError(err);
9197
- props.onError?.(err);
9198
- emit("error", err);
9199
- } finally {
9200
- popup.close();
9201
- cleanup();
9202
- }
9203
- };
9204
- messageHandler = async (event) => {
9205
- if (event.source !== popup) return;
9206
- const expectedOrigin = props.afterSignUpUrl ? new URL(props.afterSignUpUrl).origin : window.location.origin;
9207
- if (event.origin !== expectedOrigin && event.origin !== window.location.origin) return;
9208
- const { code, state } = event.data || {};
9209
- if (code && state && !processed) {
9210
- processed = true;
9211
- await continueWithCode(code, state);
9212
- }
9213
- };
9214
- window.addEventListener("message", messageHandler);
9215
- popupMonitor = setInterval(async () => {
9216
- try {
9217
- if (popup.closed) {
9218
- cleanup();
9219
- return;
9220
- }
9221
- if (processed) return;
9222
- let popupUrl;
9223
- try {
9224
- popupUrl = popup.location.href;
9225
- } catch {
9226
- return;
9227
- }
9228
- if (!popupUrl) return;
9229
- if (popupUrl.includes("code=") || popupUrl.includes("error=")) {
9230
- const url = new URL(popupUrl);
9231
- const code = url.searchParams.get("code");
9232
- const state = url.searchParams.get("state");
9233
- const error = url.searchParams.get("error");
9234
- if (error) {
9235
- processed = true;
9236
- logger$2.error(`OAuth error during social sign-up: ${error}`);
9237
- popup.close();
9238
- cleanup();
9239
- return;
9240
- }
9241
- if (code && state) {
9242
- processed = true;
9243
- await continueWithCode(code, state);
9244
- }
9245
- }
9246
- } catch (err) {
9247
- logger$2.error("Error monitoring sign-up popup");
9248
- }
9249
- }, 1e3);
9250
- return true;
9251
- };
9252
- const handleSubmit = async (component, data) => {
9253
- if (!currentFlow.value) return;
9254
- isLoading.value = true;
9255
- clearMessages();
9256
- try {
9257
- const filteredInputs = {};
9258
- const sourceInputs = data ?? formValues.value;
9259
- Object.entries(sourceInputs).forEach(([key, value]) => {
9260
- if (value !== null && value !== void 0 && value !== "") filteredInputs[key] = value;
9261
- });
9262
- const actionId = component?.actionId || component?.id;
9263
- const payload = {
9264
- ...currentFlow.value.flowId && { flowId: currentFlow.value.flowId },
9265
- flowType: currentFlow.value.flowType || "REGISTRATION",
9266
- inputs: filteredInputs,
9267
- ...actionId && { actionId }
7816
+ const err = error;
7817
+ passkeyState.value = {
7818
+ ...passkeyState.value,
7819
+ error: err,
7820
+ isActive: false
9268
7821
  };
9269
- const response = await props.onSubmit(payload);
9270
- props.onFlowChange?.(response);
9271
- emit("flowChange", response);
9272
- if (response?.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) {
9273
- props.onComplete?.(response);
9274
- emit("complete", response);
9275
- return;
9276
- }
9277
- if (response?.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) {
9278
- if (handleRedirectionIfNeeded(response)) return;
9279
- currentFlow.value = response;
9280
- setupFormFields(response);
9281
- }
9282
- } catch (err) {
9283
- handleError(err);
9284
- props.onError?.(err);
7822
+ flowError.value = err;
9285
7823
  emit("error", err);
9286
- } finally {
9287
- isLoading.value = false;
9288
7824
  }
9289
- };
9290
- (0, vue.watch)(() => [props.isInitialized, isFlowInitialized.value], ([initialized, flowInit]) => {
9291
- if (!initialized || flowInit || initializationAttempted) return;
9292
- if (!props.onInitialize) return;
9293
- initializationAttempted = true;
9294
- (async () => {
9295
- isLoading.value = true;
9296
- clearMessages();
9297
- try {
9298
- const response = await props.onInitialize();
9299
- currentFlow.value = response;
9300
- isFlowInitialized.value = true;
9301
- props.onFlowChange?.(response);
9302
- emit("flowChange", response);
9303
- if (response?.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) {
9304
- props.onComplete?.(response);
9305
- emit("complete", response);
9306
- return;
9307
- }
9308
- if (response?.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) setupFormFields(response);
9309
- } catch (err) {
9310
- handleError(err);
9311
- props.onError?.(err);
9312
- emit("error", err);
9313
- } finally {
9314
- isLoading.value = false;
7825
+ }, { deep: true });
7826
+ useOAuthCallback({
7827
+ currentFlowId: currentExecutionId,
7828
+ flowIdStorageKey: EXECUTION_ID_STORAGE_KEY,
7829
+ isInitialized,
7830
+ isSubmitting,
7831
+ onError: (err) => {
7832
+ if (!flowError.value) {
7833
+ clearFlowState();
7834
+ setError(err instanceof Error ? err : new Error(String(err)));
9315
7835
  }
9316
- })();
9317
- }, { immediate: true });
7836
+ },
7837
+ onSubmit: (payload) => handleSubmit({
7838
+ executionId: payload.flowId,
7839
+ inputs: payload.inputs
7840
+ }),
7841
+ processedFlag: oauthCodeProcessedFlag,
7842
+ setFlowId: persistExecutionId
7843
+ });
7844
+ (0, vue.onMounted)(async () => {
7845
+ const urlParams = getUrlParams$1();
7846
+ if (urlParams.authId) {
7847
+ const sm = getStorageManager();
7848
+ if (sm) await sm.setHybridDataParameter("authId", urlParams.authId);
7849
+ }
7850
+ });
7851
+ (0, vue.watch)(() => [
7852
+ isInitialized.value,
7853
+ sdkLoading.value,
7854
+ isFlowInitialized.value,
7855
+ currentExecutionId.value,
7856
+ isSubmitting.value
7857
+ ], ([initialized, loading, flowInit, executionId, submitting]) => {
7858
+ const urlParams = getUrlParams$1();
7859
+ const hasOAuthCode = !!urlParams.code;
7860
+ const hasOAuthState = !!urlParams.state;
7861
+ if (initialized && !loading && !flowInit && !initializationAttempted && !executionId && !hasOAuthCode && !hasOAuthState && !submitting && !oauthCodeProcessedFlag.value) {
7862
+ initializationAttempted = true;
7863
+ initializeFlow();
7864
+ }
7865
+ });
9318
7866
  return () => {
9319
- const containerClass = [
9320
- (0, __thunderid_browser.withVendorCSSClassPrefix)("signup"),
9321
- (0, __thunderid_browser.withVendorCSSClassPrefix)(`signup--${props.size}`),
9322
- (0, __thunderid_browser.withVendorCSSClassPrefix)(`signup--${props.variant}`),
9323
- props.className
9324
- ].filter(Boolean).join(" ");
7867
+ const combinedIsLoading = sdkLoading.value || isSubmitting.value || !isInitialized.value;
9325
7868
  if (slots["default"]) {
9326
7869
  const renderProps = {
9327
- components: currentFlow.value?.data?.components || [],
9328
- errors: formErrors.value,
9329
- handleInputChange,
9330
- handleSubmit,
9331
- isLoading: isLoading.value,
9332
- isValid: isFormValid(),
9333
- messages: flowMessages.value || [],
9334
- subtitle: flowSubtitle.value || t("signup.subheading") || "",
9335
- title: flowTitle.value || t("signup.heading") || "",
9336
- touched: touchedFields.value,
9337
- values: formValues.value
7870
+ additionalData: additionalData.value,
7871
+ components: components.value,
7872
+ error: flowError.value,
7873
+ initialize: initializeFlow,
7874
+ isInitialized: isFlowInitialized.value,
7875
+ isLoading: combinedIsLoading,
7876
+ isTimeoutDisabled: isTimeoutDisabled.value,
7877
+ meta: flowMeta.value,
7878
+ onSubmit: handleSubmit
9338
7879
  };
9339
- return (0, vue.h)("div", { class: containerClass }, slots["default"](renderProps));
9340
- }
9341
- if (!isFlowInitialized.value && isLoading.value) return (0, vue.h)(Card_default, {
9342
- class: containerClass,
9343
- variant: props.variant
9344
- }, () => (0, vue.h)("div", { style: "display:flex;justify-content:center;padding:2rem" }, (0, vue.h)(Spinner_default)));
9345
- if (!currentFlow.value) return (0, vue.h)(Card_default, {
9346
- class: containerClass,
9347
- variant: props.variant
9348
- }, () => (0, vue.h)(Alert_default, { variant: "error" }, () => t("errors.signup.flow.initialization.failure") || "Failed to initialize sign-up flow"));
9349
- const rendered = renderSignUpComponents$1(currentFlow.value.data?.components || [], formValues.value, touchedFields.value, formErrors.value, isLoading.value, isFormValid(), handleInputChange, handleSubmit, {
9350
- buttonClassName: props.buttonClassName,
9351
- inputClassName: props.inputClassName,
9352
- size: props.size
9353
- });
9354
- const cardChildren = [];
9355
- if (props.showLogo) cardChildren.push((0, vue.h)("div", { style: "display:flex;justify-content:center;margin-bottom:1rem" }, [(0, vue.h)(Logo_default)]));
9356
- if (props.showTitle || props.showSubtitle) {
9357
- const headerChildren = [];
9358
- if (props.showTitle) headerChildren.push((0, vue.h)(Typography_default, { variant: "h2" }, { default: () => flowTitle.value || t("signup.heading") || "Sign Up" }));
9359
- if (props.showSubtitle) headerChildren.push((0, vue.h)(Typography_default, { variant: "body1" }, { default: () => flowSubtitle.value || t("signup.subheading") || "Create your account" }));
9360
- cardChildren.push((0, vue.h)("div", { style: "padding: 0 1rem 1rem" }, headerChildren));
7880
+ return (0, vue.h)("div", {}, slots["default"](renderProps));
9361
7881
  }
9362
- if (flowMessages.value && flowMessages.value.length > 0) cardChildren.push((0, vue.h)("div", { style: "padding: 0 1rem" }, flowMessages.value.map((msg, i) => (0, vue.h)(Alert_default, {
9363
- class: props.messageClassName,
9364
- key: msg.id || i,
9365
- variant: msg.type?.toLowerCase() === "error" ? "error" : "info"
9366
- }, () => msg.message))));
9367
- cardChildren.push((0, vue.h)("form", {
9368
- class: (0, __thunderid_browser.withVendorCSSClassPrefix)("signup__form"),
9369
- onSubmit: (e) => {
9370
- e.preventDefault();
9371
- handleSubmit({
9372
- config: { type: "submit" },
9373
- type: "BUTTON"
9374
- });
9375
- },
9376
- style: "padding: 1rem;display:flex;flex-direction:column;gap:0.75rem"
9377
- }, rendered.length > 0 ? rendered : [(0, vue.h)(Alert_default, { variant: "warning" }, () => t("errors.signup.components.not.available") || "No components available")]));
9378
- return (0, vue.h)(Card_default, {
9379
- class: containerClass,
7882
+ return (0, vue.h)(BaseSignIn_default, {
7883
+ ...attrs,
7884
+ additionalData: additionalData.value,
7885
+ class: props.className,
7886
+ components: components.value,
7887
+ error: flowError.value,
7888
+ isLoading: combinedIsLoading || !isFlowInitialized.value,
7889
+ isTimeoutDisabled: isTimeoutDisabled.value,
7890
+ onError: (err) => emit("error", err),
7891
+ onSubmit: handleSubmit,
7892
+ size: props.size,
9380
7893
  variant: props.variant
9381
- }, () => cardChildren);
9382
- };
9383
- }
9384
- });
9385
- var BaseSignUp_default$1 = BaseSignUp$2;
9386
-
9387
- //#endregion
9388
- //#region src/components/auth/sign-up/v1/SignUp.ts
9389
- /**
9390
- * V1 SignUp container — wires `useThunderID().signUp` into `BaseSignUpV1` and
9391
- * handles redirects after the flow completes.
9392
- *
9393
- * Mirrors `sign-up/v2/.../SignUp.ts` but invokes the V1 base component which
9394
- * understands the `TYPOGRAPHY` / `INPUT` / `BUTTON` / `FORM` shapes returned by
9395
- * the V1 flow API.
9396
- */
9397
- const SignUp$2 = (0, vue.defineComponent)({
9398
- name: "SignUpV1",
9399
- props: {
9400
- afterSignUpUrl: {
9401
- default: void 0,
9402
- type: String
9403
- },
9404
- buttonClassName: {
9405
- default: "",
9406
- type: String
9407
- },
9408
- className: {
9409
- default: "",
9410
- type: String
9411
- },
9412
- errorClassName: {
9413
- default: "",
9414
- type: String
9415
- },
9416
- inputClassName: {
9417
- default: "",
9418
- type: String
9419
- },
9420
- messageClassName: {
9421
- default: "",
9422
- type: String
9423
- },
9424
- onComplete: {
9425
- default: void 0,
9426
- type: Function
9427
- },
9428
- onError: {
9429
- default: void 0,
9430
- type: Function
9431
- },
9432
- shouldRedirectAfterSignUp: {
9433
- default: true,
9434
- type: Boolean
9435
- },
9436
- showSubtitle: {
9437
- default: true,
9438
- type: Boolean
9439
- },
9440
- showTitle: {
9441
- default: true,
9442
- type: Boolean
9443
- },
9444
- size: {
9445
- default: "medium",
9446
- type: String
9447
- },
9448
- variant: {
9449
- default: "outlined",
9450
- type: String
9451
- }
9452
- },
9453
- setup(props, { slots }) {
9454
- const { signUp, isInitialized, applicationId } = useThunderID_default();
9455
- const handleInitialize = async (payload) => {
9456
- const applicationIdFromUrl = typeof window !== "undefined" ? new URL(window.location.href).searchParams.get("applicationId") : null;
9457
- const effectiveApplicationId = applicationId || applicationIdFromUrl || void 0;
9458
- return await signUp(payload || {
9459
- flowType: __thunderid_browser.EmbeddedFlowType.Registration,
9460
- ...effectiveApplicationId && { applicationId: effectiveApplicationId }
9461
7894
  });
9462
7895
  };
9463
- const handleOnSubmit = async (payload) => await signUp(payload);
9464
- const handleComplete = (response) => {
9465
- props.onComplete?.(response);
9466
- const oauthRedirectUrl = response?.redirectUrl;
9467
- if (props.shouldRedirectAfterSignUp && oauthRedirectUrl) {
9468
- if (typeof window !== "undefined") window.location.href = oauthRedirectUrl;
9469
- return;
9470
- }
9471
- if (props.shouldRedirectAfterSignUp && response?.type !== __thunderid_browser.EmbeddedFlowResponseType.Redirection && props.afterSignUpUrl) {
9472
- if (typeof window !== "undefined") window.location.href = props.afterSignUpUrl;
9473
- }
9474
- };
9475
- return () => (0, vue.h)(BaseSignUp_default$1, {
9476
- afterSignUpUrl: props.afterSignUpUrl,
9477
- buttonClassName: props.buttonClassName,
9478
- className: props.className,
9479
- errorClassName: props.errorClassName,
9480
- inputClassName: props.inputClassName,
9481
- isInitialized: isInitialized?.value ?? false,
9482
- messageClassName: props.messageClassName,
9483
- onComplete: handleComplete,
9484
- onError: props.onError,
9485
- onInitialize: handleInitialize,
9486
- onSubmit: handleOnSubmit,
9487
- showSubtitle: props.showSubtitle,
9488
- showTitle: props.showTitle,
9489
- size: props.size,
9490
- variant: props.variant
9491
- }, slots["default"] ? { default: (renderProps) => slots["default"](renderProps) } : void 0);
9492
7896
  }
9493
7897
  });
9494
- var SignUp_default$1 = SignUp$2;
7898
+ var SignIn_default = SignIn;
9495
7899
 
9496
7900
  //#endregion
9497
- //#region src/utils/v2/getAuthComponentHeadings.ts
7901
+ //#region src/utils/getAuthComponentHeadings.ts
9498
7902
  /**
9499
7903
  * Extracts heading and subheading components from authentication flow components
9500
7904
  * and provides resolved title/subtitle text with fallback logic.
@@ -9557,13 +7961,13 @@ const getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTi
9557
7961
  var getAuthComponentHeadings_default = getAuthComponentHeadings;
9558
7962
 
9559
7963
  //#endregion
9560
- //#region src/components/auth/sign-up/v2/BaseSignUp.ts
7964
+ //#region src/components/auth/sign-up/BaseSignUp.ts
9561
7965
  const logger$1 = createVueLogger("BaseSignUp");
9562
7966
  const extractFormFields = (components) => {
9563
7967
  const fields = [];
9564
7968
  const process = (comps) => {
9565
7969
  comps.forEach((c) => {
9566
- if (c.type === __thunderid_browser.EmbeddedFlowComponentTypeV2.TextInput || c.type === __thunderid_browser.EmbeddedFlowComponentTypeV2.PasswordInput || c.type === __thunderid_browser.EmbeddedFlowComponentTypeV2.EmailInput || c.type === __thunderid_browser.EmbeddedFlowComponentTypeV2.Select) {
7970
+ if (c.type === __thunderid_browser.EmbeddedFlowComponentType.TextInput || c.type === __thunderid_browser.EmbeddedFlowComponentType.PasswordInput || c.type === __thunderid_browser.EmbeddedFlowComponentType.EmailInput || c.type === __thunderid_browser.EmbeddedFlowComponentType.Select) {
9567
7971
  const fieldName = c.ref || c.id;
9568
7972
  fields.push({
9569
7973
  name: fieldName,
@@ -9583,7 +7987,7 @@ const extractFormFields = (components) => {
9583
7987
  * Manages the sign-up flow lifecycle including initialization, form state,
9584
7988
  * passkey registration, popup-based social OAuth, and renders the server-driven UI.
9585
7989
  */
9586
- const BaseSignUp$1 = (0, vue.defineComponent)({
7990
+ const BaseSignUp = (0, vue.defineComponent)({
9587
7991
  name: "BaseSignUp",
9588
7992
  props: {
9589
7993
  afterSignUpUrl: {
@@ -9723,7 +8127,7 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
9723
8127
  fields.forEach((field) => {
9724
8128
  const value = formValues.value[field.name] || "";
9725
8129
  if (field.required && (!value || value.trim() === "")) errors[field.name] = t("validations.required.field.error") || "This field is required";
9726
- if ((field.type === __thunderid_browser.EmbeddedFlowComponentTypeV2.EmailInput || field.type === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[field.name] = t("field.email.invalid") || "Invalid email address";
8130
+ if ((field.type === __thunderid_browser.EmbeddedFlowComponentType.EmailInput || field.type === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[field.name] = t("field.email.invalid") || "Invalid email address";
9727
8131
  });
9728
8132
  return errors;
9729
8133
  };
@@ -9786,8 +8190,8 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
9786
8190
  try {
9787
8191
  const continueResponse = await props.onSubmit(payload);
9788
8192
  props.onFlowChange?.(continueResponse);
9789
- if (continueResponse.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) props.onComplete?.(continueResponse);
9790
- else if (continueResponse.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) {
8193
+ if (continueResponse.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Complete) props.onComplete?.(continueResponse);
8194
+ else if (continueResponse.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Incomplete) {
9791
8195
  currentFlow.value = continueResponse;
9792
8196
  setupFormFields(continueResponse);
9793
8197
  if (continueResponse?.error) handleError(continueResponse);
@@ -9859,13 +8263,13 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
9859
8263
  };
9860
8264
  const response = normalizeFlowResponseLocal(await props.onSubmit(payload));
9861
8265
  props.onFlowChange?.(response);
9862
- if (response.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) {
8266
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Complete) {
9863
8267
  props.onComplete?.(response);
9864
8268
  return;
9865
8269
  }
9866
- if (response.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) {
8270
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Incomplete) {
9867
8271
  if (handleRedirectionIfNeeded(response)) return;
9868
- if (response.data?.additionalData?.["passkeyCreationOptions"]) {
8272
+ if (response.data?.additionalData?.passkeyCreationOptions) {
9869
8273
  const { passkeyCreationOptions } = response.data.additionalData;
9870
8274
  const effectiveFlowId = response.flowId || currentFlow.value?.flowId;
9871
8275
  passkeyProcessed = false;
@@ -9910,7 +8314,7 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
9910
8314
  };
9911
8315
  const processed = normalizeFlowResponseLocal(await props.onSubmit(payload));
9912
8316
  props.onFlowChange?.(processed);
9913
- if (processed.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) props.onComplete?.(processed);
8317
+ if (processed.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Complete) props.onComplete?.(processed);
9914
8318
  else {
9915
8319
  currentFlow.value = processed;
9916
8320
  setupFormFields(processed);
@@ -9947,11 +8351,11 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
9947
8351
  currentFlow.value = response;
9948
8352
  isFlowInitialized.value = true;
9949
8353
  props.onFlowChange?.(response);
9950
- if (response.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Complete) {
8354
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Complete) {
9951
8355
  props.onComplete?.(response);
9952
8356
  return;
9953
8357
  }
9954
- if (response.flowStatus === __thunderid_browser.EmbeddedFlowStatus.Incomplete) {
8358
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignUpFlowStatus.Incomplete) {
9955
8359
  setupFormFields(response);
9956
8360
  if (response?.error) handleError(response);
9957
8361
  }
@@ -10033,14 +8437,14 @@ const BaseSignUp$1 = (0, vue.defineComponent)({
10033
8437
  };
10034
8438
  }
10035
8439
  });
10036
- var BaseSignUp_default$2 = BaseSignUp$1;
8440
+ var BaseSignUp_default = BaseSignUp;
10037
8441
 
10038
8442
  //#endregion
10039
- //#region src/components/auth/sign-up/v2/SignUp.ts
8443
+ //#region src/components/auth/sign-up/SignUp.ts
10040
8444
  /**
10041
8445
  * SignUp — embedded sign-up component that handles API calls and delegates UI to BaseSignUp.
10042
8446
  */
10043
- const SignUp$1 = (0, vue.defineComponent)({
8447
+ const SignUp = (0, vue.defineComponent)({
10044
8448
  name: "SignUp",
10045
8449
  props: {
10046
8450
  afterSignUpUrl: {
@@ -10118,7 +8522,7 @@ const SignUp$1 = (0, vue.defineComponent)({
10118
8522
  if (props.shouldRedirectAfterSignUp && response?.type !== __thunderid_browser.EmbeddedFlowResponseType.Redirection && props.afterSignUpUrl && !response?.assertion) window.location.href = props.afterSignUpUrl;
10119
8523
  if (props.shouldRedirectAfterSignUp && response?.type === __thunderid_browser.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && !response.data.redirectURL.includes("auth")) window.location.href = response.data.redirectURL;
10120
8524
  };
10121
- return () => (0, vue.h)(BaseSignUp_default$2, {
8525
+ return () => (0, vue.h)(BaseSignUp_default, {
10122
8526
  afterSignUpUrl: props.afterSignUpUrl,
10123
8527
  buttonClassName: props.buttonClassName,
10124
8528
  className: props.className,
@@ -10137,56 +8541,8 @@ const SignUp$1 = (0, vue.defineComponent)({
10137
8541
  }, slots["default"] ? { default: (renderProps) => slots["default"](renderProps) } : void 0);
10138
8542
  }
10139
8543
  });
10140
- var SignUp_default$2 = SignUp$1;
10141
-
10142
- //#endregion
10143
- //#region src/components/auth/sign-up/SignUp.ts
10144
- /**
10145
- * SignUp — platform-aware sign-up container.
10146
- *
10147
- * Routes to V1 (default, component-driven V1 flow API) or V2 (`ThunderIDV2`
10148
- * platform) based on the `platform` value from {@link useThunderID}. Mirrors
10149
- * the existing `SignIn` dispatcher pattern in this package.
10150
- */
10151
- const SignUp = (0, vue.defineComponent)({
10152
- name: "SignUp",
10153
- inheritAttrs: false,
10154
- setup(_props, { attrs, slots }) {
10155
- const { platform } = useThunderID_default();
10156
- return () => {
10157
- if (platform === __thunderid_browser.Platform.ThunderID) return (0, vue.h)(SignUp_default$2, { ...attrs }, slots);
10158
- return (0, vue.h)(SignUp_default$1, { ...attrs }, slots);
10159
- };
10160
- }
10161
- });
10162
8544
  var SignUp_default = SignUp;
10163
8545
 
10164
- //#endregion
10165
- //#region src/components/auth/sign-up/BaseSignUp.ts
10166
- /**
10167
- * BaseSignUp — platform-aware base sign-up component.
10168
- *
10169
- * Routes to V1 (component-driven, V1 flow API: `TYPOGRAPHY` / `INPUT` /
10170
- * `BUTTON` / `FORM` shapes) or V2 (`ThunderIDV2` platform with `BLOCK` / `STACK`
10171
- * / `TEXT_INPUT` shapes) based on the `platform` value resolved by
10172
- * {@link useThunderID}.
10173
- *
10174
- * Mirrors the React `BaseSignUp` dispatcher and matches the existing pattern
10175
- * already used by `BaseSignIn` in this package.
10176
- */
10177
- const BaseSignUp = (0, vue.defineComponent)({
10178
- name: "BaseSignUp",
10179
- inheritAttrs: false,
10180
- setup(_props, { attrs, slots }) {
10181
- const { platform } = useThunderID_default();
10182
- return () => {
10183
- if (platform === __thunderid_browser.Platform.ThunderID) return (0, vue.h)(BaseSignUp_default$2, { ...attrs }, slots);
10184
- return (0, vue.h)(BaseSignUp_default$1, { ...attrs }, slots);
10185
- };
10186
- }
10187
- });
10188
- var BaseSignUp_default = BaseSignUp;
10189
-
10190
8546
  //#endregion
10191
8547
  //#region src/components/control/SignedIn.ts
10192
8548
  /**
@@ -12856,7 +11212,7 @@ const LanguageSwitcher = (0, vue.defineComponent)({
12856
11212
  var LanguageSwitcher_default = LanguageSwitcher;
12857
11213
 
12858
11214
  //#endregion
12859
- //#region src/utils/v2/buildThemeConfigFromFlowMeta.ts
11215
+ //#region src/utils/buildThemeConfigFromFlowMeta.ts
12860
11216
  /**
12861
11217
  * Converts a v2 `FlowMetaTheme` into a `RecursivePartial<ThemeConfig>` that
12862
11218
  * `createTheme` can consume.
@@ -13065,37 +11421,49 @@ exports.Divider = Divider_default;
13065
11421
  Object.defineProperty(exports, 'EmbeddedFlowActionVariant', {
13066
11422
  enumerable: true,
13067
11423
  get: function () {
13068
- return __thunderid_browser.EmbeddedFlowActionVariantV2;
11424
+ return __thunderid_browser.EmbeddedFlowActionVariant;
13069
11425
  }
13070
11426
  });
13071
11427
  Object.defineProperty(exports, 'EmbeddedFlowComponentType', {
13072
11428
  enumerable: true,
13073
11429
  get: function () {
13074
- return __thunderid_browser.EmbeddedFlowComponentTypeV2;
11430
+ return __thunderid_browser.EmbeddedFlowComponentType;
13075
11431
  }
13076
11432
  });
13077
11433
  Object.defineProperty(exports, 'EmbeddedFlowEventType', {
13078
11434
  enumerable: true,
13079
11435
  get: function () {
13080
- return __thunderid_browser.EmbeddedFlowEventTypeV2;
11436
+ return __thunderid_browser.EmbeddedFlowEventType;
13081
11437
  }
13082
11438
  });
13083
11439
  Object.defineProperty(exports, 'EmbeddedFlowTextVariant', {
13084
11440
  enumerable: true,
13085
11441
  get: function () {
13086
- return __thunderid_browser.EmbeddedFlowTextVariantV2;
11442
+ return __thunderid_browser.EmbeddedFlowTextVariant;
13087
11443
  }
13088
11444
  });
13089
11445
  Object.defineProperty(exports, 'EmbeddedSignInFlowStatus', {
13090
11446
  enumerable: true,
13091
11447
  get: function () {
13092
- return __thunderid_browser.EmbeddedSignInFlowStatusV2;
11448
+ return __thunderid_browser.EmbeddedSignInFlowStatus;
13093
11449
  }
13094
11450
  });
13095
11451
  Object.defineProperty(exports, 'EmbeddedSignInFlowType', {
13096
11452
  enumerable: true,
13097
11453
  get: function () {
13098
- return __thunderid_browser.EmbeddedSignInFlowTypeV2;
11454
+ return __thunderid_browser.EmbeddedSignInFlowType;
11455
+ }
11456
+ });
11457
+ Object.defineProperty(exports, 'EmbeddedSignUpFlowStatus', {
11458
+ enumerable: true,
11459
+ get: function () {
11460
+ return __thunderid_browser.EmbeddedSignUpFlowStatus;
11461
+ }
11462
+ });
11463
+ Object.defineProperty(exports, 'EmbeddedSignUpFlowType', {
11464
+ enumerable: true,
11465
+ get: function () {
11466
+ return __thunderid_browser.EmbeddedSignUpFlowType;
13099
11467
  }
13100
11468
  });
13101
11469
  exports.EyeIcon = EyeIcon;
@@ -13224,7 +11592,6 @@ exports.useFlow = useFlow_default;
13224
11592
  exports.useFlowMeta = useFlowMeta_default;
13225
11593
  exports.useI18n = useI18n_default;
13226
11594
  exports.useOAuthCallback = useOAuthCallback;
13227
- exports.useOAuthCallbackV2 = useOAuthCallback$1;
13228
11595
  exports.useOrganization = useOrganization_default;
13229
11596
  exports.useTheme = useTheme_default;
13230
11597
  exports.useThunderID = useThunderID_default;