@thunderid/vue 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3831,6 +3831,13 @@ const OTP_FIELD_CSS = `
3831
3831
  cursor: not-allowed;
3832
3832
  }
3833
3833
 
3834
+ .thunderid-otp-field__separator {
3835
+ flex: none;
3836
+ color: var(--thunderid-color-text-secondary);
3837
+ font-size: var(--thunderid-typography-fontSize-xl);
3838
+ font-weight: var(--thunderid-typography-fontWeight-medium);
3839
+ }
3840
+
3834
3841
  .thunderid-otp-field__error {
3835
3842
  font-size: var(--thunderid-typography-fontSize-xs);
3836
3843
  color: var(--thunderid-color-error-contrastText);
@@ -6273,6 +6280,10 @@ const OtpField = (0, vue.defineComponent)({
6273
6280
  required: {
6274
6281
  default: false,
6275
6282
  type: Boolean
6283
+ },
6284
+ separatorAfter: {
6285
+ default: void 0,
6286
+ type: Number
6276
6287
  }
6277
6288
  },
6278
6289
  emits: ["update:modelValue"],
@@ -6319,20 +6330,35 @@ const OtpField = (0, vue.defineComponent)({
6319
6330
  style: attrs.style
6320
6331
  }, [
6321
6332
  props.label ? (0, vue.h)("label", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__label") }, [props.label, props.required ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__required") }, " *") : null]) : null,
6322
- (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__inputs") }, Array.from({ length: props.length }, (_, i) => (0, vue.h)("input", {
6333
+ (0, vue.h)("div", {
6334
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__inputs"),
6335
+ style: props.separatorAfter && props.separatorAfter > 0 && props.separatorAfter < props.length ? {
6336
+ flexWrap: "nowrap",
6337
+ justifyContent: "center",
6338
+ gap: "calc(var(--thunderid-spacing-unit) * 0.5)"
6339
+ } : void 0
6340
+ }, Array.from({ length: props.length }, (_, i) => [(0, vue.h)("input", {
6323
6341
  "aria-label": `Digit ${i + 1}`,
6324
6342
  class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__digit"),
6325
6343
  disabled: props.disabled,
6326
6344
  inputmode: props.numericOnly ? "numeric" : "text",
6327
- key: i,
6345
+ key: `digit-${i}`,
6328
6346
  maxlength: 1,
6329
6347
  onInput: (e) => handleInput(i, e),
6330
6348
  onKeydown: (e) => handleKeydown(i, e),
6331
6349
  onPaste: (e) => handlePaste(i, e),
6332
6350
  ref: (el) => setRef(el, i),
6351
+ style: props.separatorAfter && props.separatorAfter > 0 && props.separatorAfter < props.length ? {
6352
+ width: "calc(var(--thunderid-spacing-unit) * 3.5)",
6353
+ height: "calc(var(--thunderid-spacing-unit) * 4.5)"
6354
+ } : void 0,
6333
6355
  type: "text",
6334
6356
  value: digits[i]
6335
- }))),
6357
+ }), props.separatorAfter === i + 1 ? (0, vue.h)("span", {
6358
+ "aria-hidden": "true",
6359
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__separator"),
6360
+ key: "separator"
6361
+ }, "-") : null]).flat()),
6336
6362
  props.error ? (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("otp-field__error") }, props.error) : null
6337
6363
  ]);
6338
6364
  };
@@ -7372,7 +7398,7 @@ const validateFieldValue = (value, type, required = false, touched = false) => {
7372
7398
  * Factory function to create form field VNodes based on FieldType.
7373
7399
  */
7374
7400
  const createField = (config) => {
7375
- const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true } = config;
7401
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true, separatorAfter } = config;
7376
7402
  const validationError = error || validateFieldValue(value, type, required, touched);
7377
7403
  const commonProps = {
7378
7404
  class: className,
@@ -7425,6 +7451,7 @@ const createField = (config) => {
7425
7451
  ...commonProps,
7426
7452
  ...length ? { length } : {},
7427
7453
  numericOnly,
7454
+ ...separatorAfter ? { separatorAfter } : {},
7428
7455
  "onUpdate:modelValue": onChange
7429
7456
  });
7430
7457
  case __thunderid_browser.FieldType.Number: return (0, vue.h)(TextField_default, {
@@ -8214,11 +8241,13 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8214
8241
  }
8215
8242
  case __thunderid_browser.EmbeddedFlowComponentType.OtpInput: {
8216
8243
  const identifier = component.ref ?? "";
8217
- const value = formValues[identifier] || "";
8244
+ const isDeviceUserCode = identifier === "user_code";
8245
+ const currentValue = formValues[identifier] || "";
8246
+ const value = isDeviceUserCode ? currentValue.replace(/[-\s]/g, "").toUpperCase() : currentValue;
8218
8247
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
8219
8248
  const reportedLength = Number(options.additionalData?.["otpLength"]);
8220
- const otpLength = Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : void 0;
8221
- const numericOnly = options.additionalData?.["otpNumericOnly"] !== "false";
8249
+ const otpLength = isDeviceUserCode ? 8 : Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : void 0;
8250
+ const numericOnly = !isDeviceUserCode && options.additionalData?.["otpNumericOnly"] !== "false";
8222
8251
  return createField({
8223
8252
  className: options.inputClassName,
8224
8253
  error,
@@ -8226,6 +8255,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8226
8255
  length: otpLength,
8227
8256
  name: identifier,
8228
8257
  numericOnly,
8258
+ separatorAfter: isDeviceUserCode ? 4 : void 0,
8229
8259
  onBlur: () => options.onInputBlur?.(identifier),
8230
8260
  onChange: (newValue) => onInputChange(identifier, newValue),
8231
8261
  placeholder: resolve(component.placeholder) || "",
@@ -1 +1 @@
1
- {"version":3,"file":"AuthOptionFactoryCore.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/flow/AuthOptionFactoryCore.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,oBAAoB,EACpB,qBAAqB,EAiBtB,MAAM,oBAAoB,CAAC;AAC5B,OA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B,WAAW,MAAM,IAAI,EACrB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACpD,UAAU;IACR,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5G,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,CAAC,CAAC,EAAE,aAAa,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,KACA,KAAK,EAkBkC,CAAC"}
@@ -12,6 +12,7 @@ export interface FieldConfig {
12
12
  length?: number;
13
13
  name: string;
14
14
  numericOnly?: boolean;
15
+ separatorAfter?: number;
15
16
  onBlur?: () => void;
16
17
  onChange: (value: string) => void;
17
18
  options?: SelectOption[];
@@ -1 +1 @@
1
- {"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/flow/FieldFactory.ts"],"names":[],"mappings":"AAGA,OAA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B,KAAK,KAAK,EAAqB,MAAM,KAAK,CAAC;AAKlF,OAAe,EAAC,KAAK,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,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,KAgIjD,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,YAAY,EAAE,SAkClB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -6,6 +6,6 @@
6
6
  * Elements:
7
7
  * __label | __required | __inputs | __digit | __error
8
8
  */
9
- declare const OTP_FIELD_CSS = "\n/* ============================================================\n OtpField\n ============================================================ */\n\n.thunderid-otp-field {\n display: flex;\n flex-direction: column;\n gap: calc(var(--thunderid-spacing-unit) * 0.75);\n font-family: var(--thunderid-typography-fontFamily);\n}\n\n.thunderid-otp-field__label {\n font-size: var(--thunderid-typography-fontSize-sm);\n font-weight: var(--thunderid-typography-fontWeight-medium);\n color: var(--thunderid-color-text-primary);\n display: block;\n line-height: var(--thunderid-typography-lineHeight-normal);\n}\n\n.thunderid-otp-field__required {\n color: var(--thunderid-color-error-main);\n margin-left: 2px;\n}\n\n.thunderid-otp-field__inputs {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: var(--thunderid-spacing-unit);\n}\n\n.thunderid-otp-field__digit {\n flex: none;\n width: calc(var(--thunderid-spacing-unit) * 6);\n height: calc(var(--thunderid-spacing-unit) * 6);\n text-align: center;\n border: 2px solid var(--thunderid-input-borderColor);\n /* Keeps the digit box's corners between a subtle minimum and 25% of its own\n size, so a brand radius token of 0 (sharp cards/buttons) doesn't render\n as a harsh square here, and an oversized token can't turn it into a\n near-circle. */\n border-radius: clamp(4px, var(--thunderid-border-radius-medium), 25%);\n font-family: var(--thunderid-typography-fontFamily);\n font-size: var(--thunderid-typography-fontSize-xl);\n font-weight: var(--thunderid-typography-fontWeight-medium);\n color: var(--thunderid-color-text-primary);\n background-color: var(--thunderid-color-background-surface);\n box-sizing: border-box;\n outline: none;\n transition:\n border-color var(--thunderid-transition-fast),\n box-shadow var(--thunderid-transition-fast);\n}\n.thunderid-otp-field__digit:focus {\n border-color: var(--thunderid-input-focusBorderColor);\n box-shadow: var(--thunderid-input-focusRing);\n}\n.thunderid-otp-field__digit:disabled {\n background-color: var(--thunderid-color-background-disabled);\n color: var(--thunderid-color-action-disabled);\n cursor: not-allowed;\n}\n\n.thunderid-otp-field__error {\n font-size: var(--thunderid-typography-fontSize-xs);\n color: var(--thunderid-color-error-contrastText);\n line-height: var(--thunderid-typography-lineHeight-normal);\n}\n";
9
+ declare const OTP_FIELD_CSS = "\n/* ============================================================\n OtpField\n ============================================================ */\n\n.thunderid-otp-field {\n display: flex;\n flex-direction: column;\n gap: calc(var(--thunderid-spacing-unit) * 0.75);\n font-family: var(--thunderid-typography-fontFamily);\n}\n\n.thunderid-otp-field__label {\n font-size: var(--thunderid-typography-fontSize-sm);\n font-weight: var(--thunderid-typography-fontWeight-medium);\n color: var(--thunderid-color-text-primary);\n display: block;\n line-height: var(--thunderid-typography-lineHeight-normal);\n}\n\n.thunderid-otp-field__required {\n color: var(--thunderid-color-error-main);\n margin-left: 2px;\n}\n\n.thunderid-otp-field__inputs {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: var(--thunderid-spacing-unit);\n}\n\n.thunderid-otp-field__digit {\n flex: none;\n width: calc(var(--thunderid-spacing-unit) * 6);\n height: calc(var(--thunderid-spacing-unit) * 6);\n text-align: center;\n border: 2px solid var(--thunderid-input-borderColor);\n /* Keeps the digit box's corners between a subtle minimum and 25% of its own\n size, so a brand radius token of 0 (sharp cards/buttons) doesn't render\n as a harsh square here, and an oversized token can't turn it into a\n near-circle. */\n border-radius: clamp(4px, var(--thunderid-border-radius-medium), 25%);\n font-family: var(--thunderid-typography-fontFamily);\n font-size: var(--thunderid-typography-fontSize-xl);\n font-weight: var(--thunderid-typography-fontWeight-medium);\n color: var(--thunderid-color-text-primary);\n background-color: var(--thunderid-color-background-surface);\n box-sizing: border-box;\n outline: none;\n transition:\n border-color var(--thunderid-transition-fast),\n box-shadow var(--thunderid-transition-fast);\n}\n.thunderid-otp-field__digit:focus {\n border-color: var(--thunderid-input-focusBorderColor);\n box-shadow: var(--thunderid-input-focusRing);\n}\n.thunderid-otp-field__digit:disabled {\n background-color: var(--thunderid-color-background-disabled);\n color: var(--thunderid-color-action-disabled);\n cursor: not-allowed;\n}\n\n.thunderid-otp-field__separator {\n flex: none;\n color: var(--thunderid-color-text-secondary);\n font-size: var(--thunderid-typography-fontSize-xl);\n font-weight: var(--thunderid-typography-fontWeight-medium);\n}\n\n.thunderid-otp-field__error {\n font-size: var(--thunderid-typography-fontSize-xs);\n color: var(--thunderid-color-error-contrastText);\n line-height: var(--thunderid-typography-lineHeight-normal);\n}\n";
10
10
  export default OTP_FIELD_CSS;
11
11
  //# sourceMappingURL=OtpField.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OtpField.css.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/OtpField/OtpField.css.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,y4EAsElB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"OtpField.css.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/OtpField/OtpField.css.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,umFA6ElB,CAAC;AAEF,eAAe,aAAa,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;AAkB/G,QAAA,MAAM,QAAQ,EAAE,SA+Gd,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;AAmB/G,QAAA,MAAM,QAAQ,EAAE,SAwId,CAAC;AAEH,eAAe,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -3805,6 +3805,13 @@ const OTP_FIELD_CSS = `
3805
3805
  cursor: not-allowed;
3806
3806
  }
3807
3807
 
3808
+ .thunderid-otp-field__separator {
3809
+ flex: none;
3810
+ color: var(--thunderid-color-text-secondary);
3811
+ font-size: var(--thunderid-typography-fontSize-xl);
3812
+ font-weight: var(--thunderid-typography-fontWeight-medium);
3813
+ }
3814
+
3808
3815
  .thunderid-otp-field__error {
3809
3816
  font-size: var(--thunderid-typography-fontSize-xs);
3810
3817
  color: var(--thunderid-color-error-contrastText);
@@ -6247,6 +6254,10 @@ const OtpField = defineComponent({
6247
6254
  required: {
6248
6255
  default: false,
6249
6256
  type: Boolean
6257
+ },
6258
+ separatorAfter: {
6259
+ default: void 0,
6260
+ type: Number
6250
6261
  }
6251
6262
  },
6252
6263
  emits: ["update:modelValue"],
@@ -6293,20 +6304,35 @@ const OtpField = defineComponent({
6293
6304
  style: attrs.style
6294
6305
  }, [
6295
6306
  props.label ? h("label", { class: withVendorCSSClassPrefix("otp-field__label") }, [props.label, props.required ? h("span", { class: withVendorCSSClassPrefix("otp-field__required") }, " *") : null]) : null,
6296
- h("div", { class: withVendorCSSClassPrefix("otp-field__inputs") }, Array.from({ length: props.length }, (_, i) => h("input", {
6307
+ h("div", {
6308
+ class: withVendorCSSClassPrefix("otp-field__inputs"),
6309
+ style: props.separatorAfter && props.separatorAfter > 0 && props.separatorAfter < props.length ? {
6310
+ flexWrap: "nowrap",
6311
+ justifyContent: "center",
6312
+ gap: "calc(var(--thunderid-spacing-unit) * 0.5)"
6313
+ } : void 0
6314
+ }, Array.from({ length: props.length }, (_, i) => [h("input", {
6297
6315
  "aria-label": `Digit ${i + 1}`,
6298
6316
  class: withVendorCSSClassPrefix("otp-field__digit"),
6299
6317
  disabled: props.disabled,
6300
6318
  inputmode: props.numericOnly ? "numeric" : "text",
6301
- key: i,
6319
+ key: `digit-${i}`,
6302
6320
  maxlength: 1,
6303
6321
  onInput: (e) => handleInput(i, e),
6304
6322
  onKeydown: (e) => handleKeydown(i, e),
6305
6323
  onPaste: (e) => handlePaste(i, e),
6306
6324
  ref: (el) => setRef(el, i),
6325
+ style: props.separatorAfter && props.separatorAfter > 0 && props.separatorAfter < props.length ? {
6326
+ width: "calc(var(--thunderid-spacing-unit) * 3.5)",
6327
+ height: "calc(var(--thunderid-spacing-unit) * 4.5)"
6328
+ } : void 0,
6307
6329
  type: "text",
6308
6330
  value: digits[i]
6309
- }))),
6331
+ }), props.separatorAfter === i + 1 ? h("span", {
6332
+ "aria-hidden": "true",
6333
+ class: withVendorCSSClassPrefix("otp-field__separator"),
6334
+ key: "separator"
6335
+ }, "-") : null]).flat()),
6310
6336
  props.error ? h("span", { class: withVendorCSSClassPrefix("otp-field__error") }, props.error) : null
6311
6337
  ]);
6312
6338
  };
@@ -7346,7 +7372,7 @@ const validateFieldValue = (value, type, required = false, touched = false) => {
7346
7372
  * Factory function to create form field VNodes based on FieldType.
7347
7373
  */
7348
7374
  const createField = (config) => {
7349
- const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true } = config;
7375
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, options = [], touched = false, placeholder, length, numericOnly = true, separatorAfter } = config;
7350
7376
  const validationError = error || validateFieldValue(value, type, required, touched);
7351
7377
  const commonProps = {
7352
7378
  class: className,
@@ -7399,6 +7425,7 @@ const createField = (config) => {
7399
7425
  ...commonProps,
7400
7426
  ...length ? { length } : {},
7401
7427
  numericOnly,
7428
+ ...separatorAfter ? { separatorAfter } : {},
7402
7429
  "onUpdate:modelValue": onChange
7403
7430
  });
7404
7431
  case FieldType$1.Number: return h(TextField_default, {
@@ -8188,11 +8215,13 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8188
8215
  }
8189
8216
  case EmbeddedFlowComponentType$1.OtpInput: {
8190
8217
  const identifier = component.ref ?? "";
8191
- const value = formValues[identifier] || "";
8218
+ const isDeviceUserCode = identifier === "user_code";
8219
+ const currentValue = formValues[identifier] || "";
8220
+ const value = isDeviceUserCode ? currentValue.replace(/[-\s]/g, "").toUpperCase() : currentValue;
8192
8221
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
8193
8222
  const reportedLength = Number(options.additionalData?.["otpLength"]);
8194
- const otpLength = Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : void 0;
8195
- const numericOnly = options.additionalData?.["otpNumericOnly"] !== "false";
8223
+ const otpLength = isDeviceUserCode ? 8 : Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : void 0;
8224
+ const numericOnly = !isDeviceUserCode && options.additionalData?.["otpNumericOnly"] !== "false";
8196
8225
  return createField({
8197
8226
  className: options.inputClassName,
8198
8227
  error,
@@ -8200,6 +8229,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8200
8229
  length: otpLength,
8201
8230
  name: identifier,
8202
8231
  numericOnly,
8232
+ separatorAfter: isDeviceUserCode ? 4 : void 0,
8203
8233
  onBlur: () => options.onInputBlur?.(identifier),
8204
8234
  onChange: (newValue) => onInputChange(identifier, newValue),
8205
8235
  placeholder: resolve(component.placeholder) || "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/vue",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Vue SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",