@thunderid/vue 0.13.2 → 1.0.1

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.
@@ -465,8 +465,7 @@ const I18nProvider = (0, vue.defineComponent)({
465
465
  if (fallbackBundle?.translations[key]) translation = fallbackBundle.translations[key];
466
466
  }
467
467
  if (!translation) translation = key;
468
- if (params && Object.keys(params).length > 0) return Object.entries(params).reduce((acc, [paramKey, paramValue]) => acc.replaceAll(`{${paramKey}}`, String(paramValue)), translation);
469
- return translation;
468
+ return (0, __thunderid_browser.substituteTranslationParams)(translation, params);
470
469
  };
471
470
  const setLanguage = (language) => {
472
471
  if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
@@ -4400,6 +4399,8 @@ var DatePicker_default = DatePicker;
4400
4399
 
4401
4400
  //#endregion
4402
4401
  //#region src/components/primitives/OtpField/OtpField.ts
4402
+ const NON_NUMERIC_OTP_CHARS = /[^0-9]/g;
4403
+ const NON_ALPHANUMERIC_OTP_CHARS = /[^0-9A-Z]/g;
4403
4404
  const OtpField = (0, vue.defineComponent)({
4404
4405
  name: "OtpField",
4405
4406
  props: {
@@ -4427,6 +4428,10 @@ const OtpField = (0, vue.defineComponent)({
4427
4428
  default: void 0,
4428
4429
  type: String
4429
4430
  },
4431
+ numericOnly: {
4432
+ default: true,
4433
+ type: Boolean
4434
+ },
4430
4435
  required: {
4431
4436
  default: false,
4432
4437
  type: Boolean
@@ -4440,7 +4445,7 @@ const OtpField = (0, vue.defineComponent)({
4440
4445
  };
4441
4446
  const handleInput = (index, e) => {
4442
4447
  const target = e.target;
4443
- const val = target.value.replace(/\D/g, "").slice(0, 1);
4448
+ const val = props.numericOnly ? target.value.replace(NON_NUMERIC_OTP_CHARS, "").slice(0, 1) : target.value.toUpperCase().replace(NON_ALPHANUMERIC_OTP_CHARS, "").slice(0, 1);
4444
4449
  target.value = val;
4445
4450
  const current = (props.modelValue || "").split("");
4446
4451
  while (current.length < props.length) current.push("");
@@ -4463,7 +4468,7 @@ const OtpField = (0, vue.defineComponent)({
4463
4468
  "aria-label": `Digit ${i + 1}`,
4464
4469
  class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__digit"),
4465
4470
  disabled: props.disabled,
4466
- inputmode: "numeric",
4471
+ inputmode: props.numericOnly ? "numeric" : "text",
4467
4472
  key: i,
4468
4473
  maxlength: 1,
4469
4474
  onInput: (e) => handleInput(i, e),
@@ -4715,13 +4720,34 @@ var BaseSignInButton_default = BaseSignInButton;
4715
4720
  *
4716
4721
  * If a custom `signInUrl` is configured, navigates to it instead.
4717
4722
  * Falls back to i18n translation for the button text.
4723
+ *
4724
+ * By default, slot content is rendered *inside* the styled button (matching
4725
+ * {@link BaseSignInButton}'s convention) — the click handler and styling are
4726
+ * wired up for you.
4727
+ *
4728
+ * @example
4729
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
4730
+ * <SignInButton>Sign In</SignInButton>
4731
+ * <SignInButton v-slot="{ isLoading }">{{ isLoading ? 'Signing in…' : 'Sign in' }}</SignInButton>
4732
+ *
4733
+ * @example
4734
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
4735
+ * <SignInButton as-child v-slot="{ signIn, isLoading }">
4736
+ * <button @click="signIn" :disabled="isLoading">Sign In</button>
4737
+ * </SignInButton>
4718
4738
  */
4719
4739
  const SignInButton = (0, vue.defineComponent)({
4720
4740
  name: "SignInButton",
4721
- props: { signInOptions: {
4722
- default: void 0,
4723
- type: Object
4724
- } },
4741
+ props: {
4742
+ asChild: {
4743
+ default: false,
4744
+ type: Boolean
4745
+ },
4746
+ signInOptions: {
4747
+ default: void 0,
4748
+ type: Object
4749
+ }
4750
+ },
4725
4751
  emits: ["click", "error"],
4726
4752
  setup(props, { slots, emit, attrs }) {
4727
4753
  const { signIn, signInUrl, signInOptions: contextSignInOptions } = useThunderID_default();
@@ -4740,19 +4766,23 @@ const SignInButton = (0, vue.defineComponent)({
4740
4766
  }
4741
4767
  };
4742
4768
  return () => {
4743
- if (slots["default"]) {
4769
+ if (props.asChild && slots["default"]) {
4744
4770
  const nodes = slots["default"]({
4745
4771
  isLoading: isLoading.value,
4746
4772
  signIn: handleSignIn
4747
4773
  });
4748
4774
  return nodes.length === 1 ? nodes[0] : (0, vue.h)(vue.Fragment, null, nodes);
4749
4775
  }
4776
+ const slotContent = slots["default"] ? () => slots["default"]({
4777
+ isLoading: isLoading.value,
4778
+ signIn: handleSignIn
4779
+ }) : void 0;
4750
4780
  return (0, vue.h)(BaseSignInButton_default, {
4751
4781
  class: attrs.class,
4752
4782
  isLoading: isLoading.value,
4753
4783
  onClick: handleSignIn,
4754
4784
  style: attrs.style
4755
- });
4785
+ }, slotContent);
4756
4786
  };
4757
4787
  }
4758
4788
  });
@@ -4919,11 +4949,30 @@ var BaseSignUpButton_default = BaseSignUpButton;
4919
4949
  *
4920
4950
  * If a custom `signUpUrl` is configured, navigates to it instead.
4921
4951
  * Falls back to i18n translation for the button text.
4952
+ *
4953
+ * By default, slot content is rendered *inside* the styled button (matching
4954
+ * {@link BaseSignUpButton}'s convention) — the click handler and styling are
4955
+ * wired up for you.
4956
+ *
4957
+ * @example
4958
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
4959
+ * <SignUpButton>Sign Up</SignUpButton>
4960
+ * <SignUpButton v-slot="{ isLoading }">{{ isLoading ? 'Signing up…' : 'Sign up' }}</SignUpButton>
4961
+ *
4962
+ * @example
4963
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
4964
+ * <SignUpButton as-child v-slot="{ signUp, isLoading }">
4965
+ * <button @click="signUp" :disabled="isLoading">Sign Up</button>
4966
+ * </SignUpButton>
4922
4967
  */
4923
4968
  const SignUpButton = (0, vue.defineComponent)({
4924
4969
  name: "SignUpButton",
4970
+ props: { asChild: {
4971
+ default: false,
4972
+ type: Boolean
4973
+ } },
4925
4974
  emits: ["click", "error"],
4926
- setup(_, { slots, emit, attrs }) {
4975
+ setup(props, { slots, emit, attrs }) {
4927
4976
  const { signUp, signUpUrl } = useThunderID_default();
4928
4977
  const isLoading = (0, vue.ref)(false);
4929
4978
  const handleSignUp = async (e) => {
@@ -4940,19 +4989,23 @@ const SignUpButton = (0, vue.defineComponent)({
4940
4989
  }
4941
4990
  };
4942
4991
  return () => {
4943
- if (slots["default"]) {
4992
+ if (props.asChild && slots["default"]) {
4944
4993
  const nodes = slots["default"]({
4945
4994
  isLoading: isLoading.value,
4946
4995
  signUp: handleSignUp
4947
4996
  });
4948
4997
  return nodes.length === 1 ? nodes[0] : (0, vue.h)(vue.Fragment, null, nodes);
4949
4998
  }
4999
+ const slotContent = slots["default"] ? () => slots["default"]({
5000
+ isLoading: isLoading.value,
5001
+ signUp: handleSignUp
5002
+ }) : void 0;
4950
5003
  return (0, vue.h)(BaseSignUpButton_default, {
4951
5004
  class: attrs.class,
4952
5005
  isLoading: isLoading.value,
4953
5006
  onClick: handleSignUp,
4954
5007
  style: attrs.style
4955
- });
5008
+ }, slotContent);
4956
5009
  };
4957
5010
  }
4958
5011
  });
@@ -5637,7 +5690,7 @@ const validateFieldValue = (value, type, required = false, touched = false) => {
5637
5690
  * Factory function to create form field VNodes based on FieldType.
5638
5691
  */
5639
5692
  const createField = (config) => {
5640
- const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder } = config;
5693
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true } = config;
5641
5694
  const validationError = error || validateFieldValue(value, type, required, touched);
5642
5695
  const commonProps = {
5643
5696
  class: className,
@@ -5682,6 +5735,8 @@ const createField = (config) => {
5682
5735
  }
5683
5736
  case __thunderid_browser.FieldType.Otp: return (0, vue.h)(OtpField_default, {
5684
5737
  ...commonProps,
5738
+ ...length ? { length } : {},
5739
+ numericOnly,
5685
5740
  "onUpdate:modelValue": onChange
5686
5741
  });
5687
5742
  case __thunderid_browser.FieldType.Number: return (0, vue.h)(TextField_default, {
@@ -6227,8 +6282,10 @@ const transformComponents = (response, t, resolveTranslations = true, meta) => {
6227
6282
  * Extract error message from flow error response.
6228
6283
  *
6229
6284
  * Resolution order:
6230
- * 1. Structured `error` object: try i18n lookup via `t(error.message.key)`.
6231
- * 2. Fallback to `defaultValue` from `message`, then `description`.
6285
+ * 1. Structured `error` object: try i18n lookup via `t(error.message.key, error.message.params)`.
6286
+ * Bundle entries keep the backend's `{{param(name)}}` placeholders, so `params` must be passed
6287
+ * through; a resolved value that still holds an unsubstituted placeholder is treated as a miss.
6288
+ * 2. Fallback to `defaultValue` from `message`, then `description` (the backend pre-substitutes it).
6232
6289
  * 3. Standard `Error.message`.
6233
6290
  * 4. Generic translated fallback via `defaultErrorKey`.
6234
6291
  */
@@ -6236,11 +6293,12 @@ const extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic")
6236
6293
  if (error && typeof error === "object" && error.error) {
6237
6294
  const flowError = error.error;
6238
6295
  if (flowError?.message?.key) {
6239
- const translated = t(flowError.message.key);
6240
- if (translated && translated !== flowError.message.key) return translated;
6296
+ const params = flowError.message.params;
6297
+ const translated = t(flowError.message.key, params);
6298
+ if (translated && translated !== flowError.message.key && !(0, __thunderid_browser.hasUnresolvedTranslationParams)(translated)) return translated;
6241
6299
  const systemKey = `system.${flowError.message.key}`;
6242
- const systemTranslated = t(systemKey);
6243
- if (systemTranslated && systemTranslated !== systemKey) return systemTranslated;
6300
+ const systemTranslated = t(systemKey, params);
6301
+ if (systemTranslated && systemTranslated !== systemKey && !(0, __thunderid_browser.hasUnresolvedTranslationParams)(systemTranslated)) return systemTranslated;
6244
6302
  }
6245
6303
  const fallback = flowError?.message?.defaultValue ?? flowError?.description?.defaultValue;
6246
6304
  if (fallback) return fallback;
@@ -4,6 +4,21 @@ import { type Component } from 'vue';
4
4
  *
5
5
  * If a custom `signInUrl` is configured, navigates to it instead.
6
6
  * Falls back to i18n translation for the button text.
7
+ *
8
+ * By default, slot content is rendered *inside* the styled button (matching
9
+ * {@link BaseSignInButton}'s convention) — the click handler and styling are
10
+ * wired up for you.
11
+ *
12
+ * @example
13
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
14
+ * <SignInButton>Sign In</SignInButton>
15
+ * <SignInButton v-slot="{ isLoading }">{{ isLoading ? 'Signing in…' : 'Sign in' }}</SignInButton>
16
+ *
17
+ * @example
18
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
19
+ * <SignInButton as-child v-slot="{ signIn, isLoading }">
20
+ * <button @click="signIn" :disabled="isLoading">Sign In</button>
21
+ * </SignInButton>
7
22
  */
8
23
  declare const SignInButton: Component;
9
24
  export default SignInButton;
@@ -1 +1 @@
1
- {"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../../src/components/actions/SignInButton.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,KAAK,CAAC;AAIb;;;;;GAKG;AACH,QAAA,MAAM,YAAY,EAAE,SA8ClB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../../src/components/actions/SignInButton.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,KAAK,CAAC;AAIb;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,YAAY,EAAE,SA6DlB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -4,6 +4,21 @@ import { type Component } from 'vue';
4
4
  *
5
5
  * If a custom `signUpUrl` is configured, navigates to it instead.
6
6
  * Falls back to i18n translation for the button text.
7
+ *
8
+ * By default, slot content is rendered *inside* the styled button (matching
9
+ * {@link BaseSignUpButton}'s convention) — the click handler and styling are
10
+ * wired up for you.
11
+ *
12
+ * @example
13
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
14
+ * <SignUpButton>Sign Up</SignUpButton>
15
+ * <SignUpButton v-slot="{ isLoading }">{{ isLoading ? 'Signing up…' : 'Sign up' }}</SignUpButton>
16
+ *
17
+ * @example
18
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
19
+ * <SignUpButton as-child v-slot="{ signUp, isLoading }">
20
+ * <button @click="signUp" :disabled="isLoading">Sign Up</button>
21
+ * </SignUpButton>
7
22
  */
8
23
  declare const SignUpButton: Component;
9
24
  export default SignUpButton;
@@ -1 +1 @@
1
- {"version":3,"file":"SignUpButton.d.ts","sourceRoot":"","sources":["../../../src/components/actions/SignUpButton.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoC,KAAK,SAAS,EAA0C,MAAM,KAAK,CAAC;AAI/G;;;;;GAKG;AACH,QAAA,MAAM,YAAY,EAAE,SA2ClB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SignUpButton.d.ts","sourceRoot":"","sources":["../../../src/components/actions/SignUpButton.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoC,KAAK,SAAS,EAA0C,MAAM,KAAK,CAAC;AAI/G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,YAAY,EAAE,SAyDlB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -9,7 +9,9 @@ export interface FieldConfig {
9
9
  disabled?: boolean;
10
10
  error?: string;
11
11
  label: string;
12
+ length?: number;
12
13
  name: string;
14
+ numericOnly?: boolean;
13
15
  onBlur?: () => void;
14
16
  onChange: (value: string) => void;
15
17
  options?: SelectOption[];
@@ -1 +1 @@
1
- {"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/components/factories/FieldFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAC,KAAK,SAAS,EAAiB,KAAK,KAAK,EAAqB,MAAM,KAAK,CAAC;AAKlF,OAAe,EAAC,KAAK,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGtE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAA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,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAgBD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,MAAM,SAAS,EACf,kBAAgB,EAChB,iBAAe,KACd,MAAM,GAAG,IAsBX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,KAAG,KAsHjD,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,YAAY,EAAE,SAkClB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OtpField.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/OtpField/OtpField.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,SAAS,EAA6E,MAAM,KAAK,CAAC;AAY/G,QAAA,MAAM,QAAQ,EAAE,SAiFd,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"OtpField.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/OtpField/OtpField.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,SAAS,EAA6E,MAAM,KAAK,CAAC;AAkB/G,QAAA,MAAM,QAAQ,EAAE,SAqFd,CAAC;AAEH,eAAe,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ConsentConstants, DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getUsersMeMeta, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
1
+ import { ConsentConstants, DEFAULT_THEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowComponentType as EmbeddedFlowComponentType$1, EmbeddedFlowEventType, EmbeddedFlowEventType as EmbeddedFlowEventType$1, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatus$1, EmbeddedSignInFlowType, EmbeddedSignInFlowType as EmbeddedSignInFlowType$1, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatus$1, EmbeddedSignUpFlowType, FetchHttpClient, FieldType, FieldType as FieldType$1, FlowMetaType, ThunderIDAPIError, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, TranslationBundleConstants, arrayBufferToBase64url, base64urlToArrayBuffer, createClassObserver, createClassObserver as createClassObserver$1, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createPackageComponentLogger, createPackageLogger, createTheme, deepMerge, detectThemeMode, detectThemeMode as detectThemeMode$1, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, extractEmojiFromUri, extractUserClaimsFromIdToken, generateFlattenedUserProfile, get, getActiveTheme, getDefaultI18nBundles, getFlowMeta, getUsersMe, getUsersMeMeta, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, hasUnresolvedTranslationParams, http, isEmojiUri, isEmpty, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeTranslations, resolveFlowTemplateLiterals, resolveLogoUri, resolveResourceEndpoint, startCase, substituteTranslationParams, updateMeProfile, withVendorCSSClassPrefix } from "@thunderid/browser";
2
2
  import { Fragment, Teleport, computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, watch } from "vue";
3
3
  import DOMPurify from "dompurify";
4
4
 
@@ -439,8 +439,7 @@ const I18nProvider = defineComponent({
439
439
  if (fallbackBundle?.translations[key]) translation = fallbackBundle.translations[key];
440
440
  }
441
441
  if (!translation) translation = key;
442
- if (params && Object.keys(params).length > 0) return Object.entries(params).reduce((acc, [paramKey, paramValue]) => acc.replaceAll(`{${paramKey}}`, String(paramValue)), translation);
443
- return translation;
442
+ return substituteTranslationParams(translation, params);
444
443
  };
445
444
  const setLanguage = (language) => {
446
445
  if (mergedBundlesComputed.value[language]) currentLanguage.value = language;
@@ -4374,6 +4373,8 @@ var DatePicker_default = DatePicker;
4374
4373
 
4375
4374
  //#endregion
4376
4375
  //#region src/components/primitives/OtpField/OtpField.ts
4376
+ const NON_NUMERIC_OTP_CHARS = /[^0-9]/g;
4377
+ const NON_ALPHANUMERIC_OTP_CHARS = /[^0-9A-Z]/g;
4377
4378
  const OtpField = defineComponent({
4378
4379
  name: "OtpField",
4379
4380
  props: {
@@ -4401,6 +4402,10 @@ const OtpField = defineComponent({
4401
4402
  default: void 0,
4402
4403
  type: String
4403
4404
  },
4405
+ numericOnly: {
4406
+ default: true,
4407
+ type: Boolean
4408
+ },
4404
4409
  required: {
4405
4410
  default: false,
4406
4411
  type: Boolean
@@ -4414,7 +4419,7 @@ const OtpField = defineComponent({
4414
4419
  };
4415
4420
  const handleInput = (index, e) => {
4416
4421
  const target = e.target;
4417
- const val = target.value.replace(/\D/g, "").slice(0, 1);
4422
+ const val = props.numericOnly ? target.value.replace(NON_NUMERIC_OTP_CHARS, "").slice(0, 1) : target.value.toUpperCase().replace(NON_ALPHANUMERIC_OTP_CHARS, "").slice(0, 1);
4418
4423
  target.value = val;
4419
4424
  const current = (props.modelValue || "").split("");
4420
4425
  while (current.length < props.length) current.push("");
@@ -4437,7 +4442,7 @@ const OtpField = defineComponent({
4437
4442
  "aria-label": `Digit ${i + 1}`,
4438
4443
  class: withVendorCSSClassPrefix("otp-field__digit"),
4439
4444
  disabled: props.disabled,
4440
- inputmode: "numeric",
4445
+ inputmode: props.numericOnly ? "numeric" : "text",
4441
4446
  key: i,
4442
4447
  maxlength: 1,
4443
4448
  onInput: (e) => handleInput(i, e),
@@ -4689,13 +4694,34 @@ var BaseSignInButton_default = BaseSignInButton;
4689
4694
  *
4690
4695
  * If a custom `signInUrl` is configured, navigates to it instead.
4691
4696
  * Falls back to i18n translation for the button text.
4697
+ *
4698
+ * By default, slot content is rendered *inside* the styled button (matching
4699
+ * {@link BaseSignInButton}'s convention) — the click handler and styling are
4700
+ * wired up for you.
4701
+ *
4702
+ * @example
4703
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
4704
+ * <SignInButton>Sign In</SignInButton>
4705
+ * <SignInButton v-slot="{ isLoading }">{{ isLoading ? 'Signing in…' : 'Sign in' }}</SignInButton>
4706
+ *
4707
+ * @example
4708
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
4709
+ * <SignInButton as-child v-slot="{ signIn, isLoading }">
4710
+ * <button @click="signIn" :disabled="isLoading">Sign In</button>
4711
+ * </SignInButton>
4692
4712
  */
4693
4713
  const SignInButton = defineComponent({
4694
4714
  name: "SignInButton",
4695
- props: { signInOptions: {
4696
- default: void 0,
4697
- type: Object
4698
- } },
4715
+ props: {
4716
+ asChild: {
4717
+ default: false,
4718
+ type: Boolean
4719
+ },
4720
+ signInOptions: {
4721
+ default: void 0,
4722
+ type: Object
4723
+ }
4724
+ },
4699
4725
  emits: ["click", "error"],
4700
4726
  setup(props, { slots, emit, attrs }) {
4701
4727
  const { signIn, signInUrl, signInOptions: contextSignInOptions } = useThunderID_default();
@@ -4714,19 +4740,23 @@ const SignInButton = defineComponent({
4714
4740
  }
4715
4741
  };
4716
4742
  return () => {
4717
- if (slots["default"]) {
4743
+ if (props.asChild && slots["default"]) {
4718
4744
  const nodes = slots["default"]({
4719
4745
  isLoading: isLoading.value,
4720
4746
  signIn: handleSignIn
4721
4747
  });
4722
4748
  return nodes.length === 1 ? nodes[0] : h(Fragment, null, nodes);
4723
4749
  }
4750
+ const slotContent = slots["default"] ? () => slots["default"]({
4751
+ isLoading: isLoading.value,
4752
+ signIn: handleSignIn
4753
+ }) : void 0;
4724
4754
  return h(BaseSignInButton_default, {
4725
4755
  class: attrs.class,
4726
4756
  isLoading: isLoading.value,
4727
4757
  onClick: handleSignIn,
4728
4758
  style: attrs.style
4729
- });
4759
+ }, slotContent);
4730
4760
  };
4731
4761
  }
4732
4762
  });
@@ -4893,11 +4923,30 @@ var BaseSignUpButton_default = BaseSignUpButton;
4893
4923
  *
4894
4924
  * If a custom `signUpUrl` is configured, navigates to it instead.
4895
4925
  * Falls back to i18n translation for the button text.
4926
+ *
4927
+ * By default, slot content is rendered *inside* the styled button (matching
4928
+ * {@link BaseSignUpButton}'s convention) — the click handler and styling are
4929
+ * wired up for you.
4930
+ *
4931
+ * @example
4932
+ * <!-- Default: content is wrapped in the styled, click-wired button -->
4933
+ * <SignUpButton>Sign Up</SignUpButton>
4934
+ * <SignUpButton v-slot="{ isLoading }">{{ isLoading ? 'Signing up…' : 'Sign up' }}</SignUpButton>
4935
+ *
4936
+ * @example
4937
+ * <!-- asChild: full control — you render the element and wire the click yourself -->
4938
+ * <SignUpButton as-child v-slot="{ signUp, isLoading }">
4939
+ * <button @click="signUp" :disabled="isLoading">Sign Up</button>
4940
+ * </SignUpButton>
4896
4941
  */
4897
4942
  const SignUpButton = defineComponent({
4898
4943
  name: "SignUpButton",
4944
+ props: { asChild: {
4945
+ default: false,
4946
+ type: Boolean
4947
+ } },
4899
4948
  emits: ["click", "error"],
4900
- setup(_, { slots, emit, attrs }) {
4949
+ setup(props, { slots, emit, attrs }) {
4901
4950
  const { signUp, signUpUrl } = useThunderID_default();
4902
4951
  const isLoading = ref(false);
4903
4952
  const handleSignUp = async (e) => {
@@ -4914,19 +4963,23 @@ const SignUpButton = defineComponent({
4914
4963
  }
4915
4964
  };
4916
4965
  return () => {
4917
- if (slots["default"]) {
4966
+ if (props.asChild && slots["default"]) {
4918
4967
  const nodes = slots["default"]({
4919
4968
  isLoading: isLoading.value,
4920
4969
  signUp: handleSignUp
4921
4970
  });
4922
4971
  return nodes.length === 1 ? nodes[0] : h(Fragment, null, nodes);
4923
4972
  }
4973
+ const slotContent = slots["default"] ? () => slots["default"]({
4974
+ isLoading: isLoading.value,
4975
+ signUp: handleSignUp
4976
+ }) : void 0;
4924
4977
  return h(BaseSignUpButton_default, {
4925
4978
  class: attrs.class,
4926
4979
  isLoading: isLoading.value,
4927
4980
  onClick: handleSignUp,
4928
4981
  style: attrs.style
4929
- });
4982
+ }, slotContent);
4930
4983
  };
4931
4984
  }
4932
4985
  });
@@ -5611,7 +5664,7 @@ const validateFieldValue = (value, type, required = false, touched = false) => {
5611
5664
  * Factory function to create form field VNodes based on FieldType.
5612
5665
  */
5613
5666
  const createField = (config) => {
5614
- const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder } = config;
5667
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true } = config;
5615
5668
  const validationError = error || validateFieldValue(value, type, required, touched);
5616
5669
  const commonProps = {
5617
5670
  class: className,
@@ -5656,6 +5709,8 @@ const createField = (config) => {
5656
5709
  }
5657
5710
  case FieldType$1.Otp: return h(OtpField_default, {
5658
5711
  ...commonProps,
5712
+ ...length ? { length } : {},
5713
+ numericOnly,
5659
5714
  "onUpdate:modelValue": onChange
5660
5715
  });
5661
5716
  case FieldType$1.Number: return h(TextField_default, {
@@ -6201,8 +6256,10 @@ const transformComponents = (response, t, resolveTranslations = true, meta) => {
6201
6256
  * Extract error message from flow error response.
6202
6257
  *
6203
6258
  * Resolution order:
6204
- * 1. Structured `error` object: try i18n lookup via `t(error.message.key)`.
6205
- * 2. Fallback to `defaultValue` from `message`, then `description`.
6259
+ * 1. Structured `error` object: try i18n lookup via `t(error.message.key, error.message.params)`.
6260
+ * Bundle entries keep the backend's `{{param(name)}}` placeholders, so `params` must be passed
6261
+ * through; a resolved value that still holds an unsubstituted placeholder is treated as a miss.
6262
+ * 2. Fallback to `defaultValue` from `message`, then `description` (the backend pre-substitutes it).
6206
6263
  * 3. Standard `Error.message`.
6207
6264
  * 4. Generic translated fallback via `defaultErrorKey`.
6208
6265
  */
@@ -6210,11 +6267,12 @@ const extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic")
6210
6267
  if (error && typeof error === "object" && error.error) {
6211
6268
  const flowError = error.error;
6212
6269
  if (flowError?.message?.key) {
6213
- const translated = t(flowError.message.key);
6214
- if (translated && translated !== flowError.message.key) return translated;
6270
+ const params = flowError.message.params;
6271
+ const translated = t(flowError.message.key, params);
6272
+ if (translated && translated !== flowError.message.key && !hasUnresolvedTranslationParams(translated)) return translated;
6215
6273
  const systemKey = `system.${flowError.message.key}`;
6216
- const systemTranslated = t(systemKey);
6217
- if (systemTranslated && systemTranslated !== systemKey) return systemTranslated;
6274
+ const systemTranslated = t(systemKey, params);
6275
+ if (systemTranslated && systemTranslated !== systemKey && !hasUnresolvedTranslationParams(systemTranslated)) return systemTranslated;
6218
6276
  }
6219
6277
  const fallback = flowError?.message?.defaultValue ?? flowError?.description?.defaultValue;
6220
6278
  if (fallback) return fallback;
@@ -1 +1 @@
1
- {"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../src/providers/I18nProvider.ts"],"names":[],"mappings":"AAcA,OAAO,EAQL,KAAK,SAAS,EAKf,MAAM,KAAK,CAAC;AA6Gb,QAAA,MAAM,YAAY,EAAE,SAoLlB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../src/providers/I18nProvider.ts"],"names":[],"mappings":"AAeA,OAAO,EAQL,KAAK,SAAS,EAKf,MAAM,KAAK,CAAC;AA6Gb,QAAA,MAAM,YAAY,EAAE,SA4KlB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -23,7 +23,7 @@
23
23
  * This transformer is used by both SignIn and SignUp v2 components to ensure
24
24
  * consistent response handling across all embedded flows.
25
25
  */
26
- import { EmbeddedFlowComponent, FlowMetadataResponse } from '@thunderid/browser';
26
+ import { EmbeddedFlowComponent, FlowMetadataResponse, I18nMessage } from '@thunderid/browser';
27
27
  type TranslationFn = (key: string, params?: Record<string, string | number>) => string;
28
28
  /**
29
29
  * Generic flow error response interface that covers common error structure
@@ -31,14 +31,8 @@ type TranslationFn = (key: string, params?: Record<string, string | number>) =>
31
31
  export interface FlowErrorResponse {
32
32
  error?: {
33
33
  code: string;
34
- description: {
35
- key: string;
36
- defaultValue?: string;
37
- };
38
- message: {
39
- key: string;
40
- defaultValue?: string;
41
- };
34
+ description: I18nMessage;
35
+ message: I18nMessage;
42
36
  };
43
37
  executionId: string;
44
38
  flowStatus: 'ERROR';
@@ -71,8 +65,10 @@ export declare const transformComponents: (response: any, t: TranslationFn, reso
71
65
  * Extract error message from flow error response.
72
66
  *
73
67
  * Resolution order:
74
- * 1. Structured `error` object: try i18n lookup via `t(error.message.key)`.
75
- * 2. Fallback to `defaultValue` from `message`, then `description`.
68
+ * 1. Structured `error` object: try i18n lookup via `t(error.message.key, error.message.params)`.
69
+ * Bundle entries keep the backend's `{{param(name)}}` placeholders, so `params` must be passed
70
+ * through; a resolved value that still holds an unsubstituted placeholder is treated as a miss.
71
+ * 2. Fallback to `defaultValue` from `message`, then `description` (the backend pre-substitutes it).
76
72
  * 3. Standard `Error.message`.
77
73
  * 4. Generic translated fallback via `defaultErrorKey`.
78
74
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flowTransformer.d.ts","sourceRoot":"","sources":["../../src/utils/flowTransformer.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAG/E,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;QAClD,OAAO,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,YAAY,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,6 @@
1
1
  {
2
2
  "name": "@thunderid/vue",
3
- "version": "0.13.2",
3
+ "version": "1.0.1",
4
4
  "description": "Vue SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "dompurify": "3.4.11",
61
61
  "tslib": "2.8.1",
62
- "@thunderid/browser": "^0.13.1"
62
+ "@thunderid/browser": "^1.0.1"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"