@thunderid/vue 1.10.3 → 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) || "",
@@ -8644,6 +8674,7 @@ const BaseSignIn = (0, vue.defineComponent)({
8644
8674
  const isLoading = (0, vue.computed)(() => props.isLoading || isSubmitting.value);
8645
8675
  const formValues = (0, vue.ref)({});
8646
8676
  const touchedFields = (0, vue.ref)({});
8677
+ const serverFormErrors = (0, vue.ref)({});
8647
8678
  (0, vue.watch)(() => props.components, (newComponents) => {
8648
8679
  const fields = extractFormFields$1(newComponents || []);
8649
8680
  const freshValues = { ...props.initialValues };
@@ -8652,6 +8683,7 @@ const BaseSignIn = (0, vue.defineComponent)({
8652
8683
  });
8653
8684
  formValues.value = freshValues;
8654
8685
  touchedFields.value = {};
8686
+ serverFormErrors.value = {};
8655
8687
  }, {
8656
8688
  deep: false,
8657
8689
  immediate: true
@@ -8662,12 +8694,24 @@ const BaseSignIn = (0, vue.defineComponent)({
8662
8694
  ...initialValues
8663
8695
  };
8664
8696
  }, { deep: true });
8665
- const formErrors = (0, vue.computed)(() => {
8666
- const fields = extractFormFields$1(props.components || []);
8697
+ (0, vue.watch)(() => props.serverFieldErrors, (fieldErrors) => {
8667
8698
  const errors = {};
8668
- (props.serverFieldErrors ?? []).forEach((fieldError) => {
8669
- if (!(fieldError.identifier in errors)) errors[fieldError.identifier] = fieldError.message;
8699
+ const touched = {};
8700
+ (fieldErrors ?? []).forEach((fieldError) => {
8701
+ if (!(fieldError.identifier in errors)) {
8702
+ errors[fieldError.identifier] = fieldError.message;
8703
+ touched[fieldError.identifier] = true;
8704
+ }
8670
8705
  });
8706
+ serverFormErrors.value = errors;
8707
+ if (Object.keys(touched).length > 0) touchedFields.value = {
8708
+ ...touchedFields.value,
8709
+ ...touched
8710
+ };
8711
+ }, { immediate: true });
8712
+ const formErrors = (0, vue.computed)(() => {
8713
+ const fields = extractFormFields$1(props.components || []);
8714
+ const errors = { ...serverFormErrors.value };
8671
8715
  fields.forEach((field) => {
8672
8716
  const value = formValues.value[field.name] || "";
8673
8717
  const isTouched = touchedFields.value[field.name] || false;
@@ -8691,6 +8735,11 @@ const BaseSignIn = (0, vue.defineComponent)({
8691
8735
  ...formValues.value,
8692
8736
  [name]: value
8693
8737
  };
8738
+ if (name in serverFormErrors.value) {
8739
+ const errors = { ...serverFormErrors.value };
8740
+ delete errors[name];
8741
+ serverFormErrors.value = errors;
8742
+ }
8694
8743
  };
8695
8744
  const handleInputBlur = (name) => {
8696
8745
  touchedFields.value = {
@@ -9111,39 +9160,24 @@ const SignIn = (0, vue.defineComponent)({
9111
9160
  const handleSubmit = async (payload) => {
9112
9161
  const effectiveExecutionId = payload.executionId || currentExecutionId.value;
9113
9162
  if (!effectiveExecutionId) throw new Error("No active flow ID");
9114
- const processedInputs = { ...payload.inputs };
9163
+ let processedInputs = { ...payload.inputs };
9115
9164
  if (additionalData.value?.["consentPrompt"]) try {
9116
9165
  const consentRaw = additionalData.value["consentPrompt"];
9117
9166
  const purposes = typeof consentRaw === "string" ? JSON.parse(consentRaw) : consentRaw.purposes || consentRaw;
9118
9167
  let isDeny = false;
9119
9168
  if (payload.action) {
9120
- const findAction = (comps) => {
9169
+ const findAction$1 = (comps) => {
9121
9170
  if (!comps?.length) return null;
9122
9171
  const found = comps.find((c) => c.id === payload.action);
9123
9172
  if (found) return found;
9124
- return comps.reduce((acc, c) => acc || (c.components ? findAction(c.components) : null), null);
9173
+ return comps.reduce((acc, c) => acc || (c.components ? findAction$1(c.components) : null), null);
9125
9174
  };
9126
- const submitAction = findAction(components.value);
9175
+ const submitAction = findAction$1(components.value);
9127
9176
  if (submitAction && submitAction.variant?.toLowerCase() !== "primary") isDeny = true;
9128
9177
  }
9129
- const decisions = {
9178
+ processedInputs = (0, __thunderid_browser.compileConsentDecisions)(processedInputs, purposes, {
9130
9179
  approved: !isDeny,
9131
- ...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {},
9132
- purposes: purposes.map((p) => ({
9133
- approved: !isDeny,
9134
- elements: [...(p.essential ?? []).map((e) => ({
9135
- approved: !isDeny,
9136
- name: e.name
9137
- })), ...(p.optional ?? []).map((e) => {
9138
- const key = getConsentOptionalKey(p.purposeId, e.name);
9139
- return (0, __thunderid_browser.getConsentElementDecision)(p.purposeId, e, !isDeny && processedInputs[key] === "true", processedInputs);
9140
- })],
9141
- purposeName: p.purposeName
9142
- }))
9143
- };
9144
- processedInputs["consent_decisions"] = JSON.stringify(decisions);
9145
- Object.keys(processedInputs).forEach((key) => {
9146
- if (key.startsWith("__consent_opt__") || key.startsWith(__thunderid_browser.CONSENT_MODIFIED_KEY_PREFIX) || key.startsWith(__thunderid_browser.CONSENT_INVALID_KEY_PREFIX)) delete processedInputs[key];
9180
+ ...isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {}
9147
9181
  });
9148
9182
  } catch {}
9149
9183
  try {
@@ -9417,6 +9451,10 @@ const BaseDeviceGrant = (0, vue.defineComponent)({
9417
9451
  default: false,
9418
9452
  type: Boolean
9419
9453
  },
9454
+ isTimeoutDisabled: {
9455
+ default: false,
9456
+ type: Boolean
9457
+ },
9420
9458
  error: {
9421
9459
  default: null,
9422
9460
  type: Object
@@ -9473,6 +9511,7 @@ const BaseDeviceGrant = (0, vue.defineComponent)({
9473
9511
  error: props.error,
9474
9512
  initialValues: props.initialValues,
9475
9513
  isLoading: props.isLoading,
9514
+ isTimeoutDisabled: props.isTimeoutDisabled,
9476
9515
  onSubmit: props.onSubmit,
9477
9516
  serverFieldErrors: props.serverFieldErrors,
9478
9517
  size: props.size,
@@ -9488,7 +9527,51 @@ var BaseDeviceGrant_default = BaseDeviceGrant;
9488
9527
 
9489
9528
  //#endregion
9490
9529
  //#region src/components/auth/device-grant/DeviceGrant.ts
9530
+ const toDeviceGrantError = (cause, fallbackMessage) => {
9531
+ if (cause instanceof __thunderid_browser.ThunderIDAPIError || cause instanceof __thunderid_browser.ThunderIDRuntimeError) return cause;
9532
+ return new __thunderid_browser.ThunderIDRuntimeError(cause instanceof Error ? cause.message : fallbackMessage, "DEVICE_GRANT_ERROR", "vue", cause);
9533
+ };
9491
9534
  const hasUserCodeInput = (components) => components.some((component) => component.ref === "user_code" || Array.isArray(component.components) && hasUserCodeInput(component.components));
9535
+ const findAction = (components, actionId) => {
9536
+ for (const component of components) {
9537
+ if (component.id === actionId) return component;
9538
+ if (component.components) {
9539
+ const nestedAction = findAction(component.components, actionId);
9540
+ if (nestedAction) return nestedAction;
9541
+ }
9542
+ }
9543
+ };
9544
+ const parseConsentPurposes = (value) => {
9545
+ let parsed = value;
9546
+ if (typeof parsed === "string") try {
9547
+ parsed = JSON.parse(parsed);
9548
+ } catch {
9549
+ return null;
9550
+ }
9551
+ if (Array.isArray(parsed)) return parsed;
9552
+ if (typeof parsed === "object" && parsed !== null && "purposes" in parsed && Array.isArray(parsed.purposes)) return parsed.purposes;
9553
+ return null;
9554
+ };
9555
+ const CONSENT_REASON_KEY = "__consent_reason__";
9556
+ const flattenComponents = (items) => items.flatMap((component) => [component, ...flattenComponents(component.components ?? [])]);
9557
+ const findConsentSubmitActionId = (items) => {
9558
+ const actions = flattenComponents(items).filter((component) => component.id && component.eventType?.toUpperCase() === "SUBMIT");
9559
+ return (actions.find((component) => component.variant?.toLowerCase() !== "primary") ?? actions[0])?.id;
9560
+ };
9561
+ const compileConsentInputs = (inputs, actionId, components, additionalData) => {
9562
+ const action = actionId ? findAction(components, actionId) : void 0;
9563
+ const purposes = parseConsentPurposes(additionalData["consentPrompt"]);
9564
+ const consentReason = inputs[CONSENT_REASON_KEY];
9565
+ const cleanInputs = { ...inputs };
9566
+ delete cleanInputs[CONSENT_REASON_KEY];
9567
+ const isSubmitAction = Boolean(action && action.eventType?.toUpperCase() !== "TRIGGER");
9568
+ const isTimeout = consentReason === __thunderid_browser.ConsentConstants.REASON_TIMEOUT;
9569
+ const isDeny = isTimeout || Boolean(action && isSubmitAction && action.variant?.toLowerCase() !== "primary");
9570
+ return (0, __thunderid_browser.compileConsentDecisions)(cleanInputs, isSubmitAction ? purposes : null, {
9571
+ approved: !isDeny,
9572
+ ...isTimeout ? { reason: __thunderid_browser.ConsentConstants.REASON_TIMEOUT } : isDeny ? { reason: __thunderid_browser.ConsentConstants.REASON_USER_DENIED } : {}
9573
+ });
9574
+ };
9492
9575
  /** Runs the application's configured Device Grant flow and exposes its state for custom renderers. */
9493
9576
  const DeviceGrant = (0, vue.defineComponent)({
9494
9577
  name: "DeviceGrant",
@@ -9504,19 +9587,11 @@ const DeviceGrant = (0, vue.defineComponent)({
9504
9587
  variant: {
9505
9588
  default: "flat",
9506
9589
  type: String
9507
- },
9508
- onComplete: {
9509
- default: void 0,
9510
- type: Function
9511
- },
9512
- onError: {
9513
- default: void 0,
9514
- type: Function
9515
9590
  }
9516
9591
  },
9517
9592
  emits: ["complete", "error"],
9518
9593
  setup(props, { emit, slots }) {
9519
- const { applicationId, baseUrl } = useThunderID_default();
9594
+ const { applicationId, baseUrl, getStorageManager, isInitialized, isLoading: sdkLoading, vendor } = useThunderID_default();
9520
9595
  const { meta } = useFlowMeta_default();
9521
9596
  const { t } = useI18n_default();
9522
9597
  const components = (0, vue.ref)([]);
@@ -9525,28 +9600,61 @@ const DeviceGrant = (0, vue.defineComponent)({
9525
9600
  const serverFieldErrors = (0, vue.ref)(null);
9526
9601
  const executionId = (0, vue.ref)("");
9527
9602
  const challengeToken = (0, vue.ref)("");
9603
+ const challengeTokenRef = { current: "" };
9604
+ const isStorageReady = (0, vue.ref)(false);
9528
9605
  const error = (0, vue.ref)(null);
9529
9606
  const isLoading = (0, vue.ref)(false);
9607
+ const isTimeoutDisabled = (0, vue.ref)(false);
9530
9608
  const result = (0, vue.ref)(null);
9531
9609
  const flowStartAttempted = (0, vue.ref)(false);
9532
- const applyResponse = (response) => {
9610
+ const executionIdStorageKey = `${vendor}_device_grant_execution_id`;
9611
+ const oauthCodeProcessedFlag = { value: false };
9612
+ const persistExecutionId = (id) => {
9613
+ executionId.value = id ?? "";
9614
+ if (id) sessionStorage.setItem(executionIdStorageKey, id);
9615
+ else sessionStorage.removeItem(executionIdStorageKey);
9616
+ };
9617
+ const persistChallengeToken = async (token) => {
9618
+ challengeTokenRef.current = token ?? "";
9619
+ challengeToken.value = token ?? "";
9620
+ try {
9621
+ const storageManager = getStorageManager?.();
9622
+ if (storageManager) if (token) await storageManager.setTemporaryDataParameter("challengeToken", token);
9623
+ else await storageManager.removeTemporaryDataParameter("challengeToken");
9624
+ } catch {}
9625
+ };
9626
+ const handleError = (flowError) => {
9627
+ components.value = [];
9628
+ additionalData.value = {};
9629
+ serverFieldErrors.value = null;
9630
+ error.value = flowError;
9631
+ result.value = "failure";
9632
+ emit("error", flowError);
9633
+ };
9634
+ const applyResponse = async (response) => {
9635
+ const redirectURL = response.data?.redirectURL ?? response.redirectUrl;
9636
+ if (response.type === __thunderid_browser.EmbeddedSignInFlowType.Redirection && typeof redirectURL === "string") {
9637
+ persistExecutionId(response.executionId ?? null);
9638
+ await persistChallengeToken(response.challengeToken ?? null);
9639
+ initiateOAuthRedirect(redirectURL, vendor);
9640
+ return;
9641
+ }
9533
9642
  const normalized = normalizeFlowResponse(response, t, { resolveTranslations: false }, meta.value);
9534
- executionId.value = response.executionId ?? "";
9535
- challengeToken.value = response.challengeToken ?? "";
9643
+ persistExecutionId(response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Incomplete ? response.executionId ?? null : null);
9644
+ await persistChallengeToken(response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Incomplete ? response.challengeToken ?? null : null);
9536
9645
  components.value = normalized.components ?? [];
9537
9646
  additionalData.value = normalized.additionalData ?? {};
9647
+ isTimeoutDisabled.value = false;
9538
9648
  serverFieldErrors.value = response.data?.fieldErrors ?? null;
9539
9649
  error.value = response.error ? new Error(extractErrorMessage(response, t)) : null;
9540
9650
  if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Complete) {
9541
9651
  result.value = "success";
9542
- props.onComplete?.(response);
9543
9652
  emit("complete", response);
9544
9653
  return;
9545
9654
  }
9546
9655
  if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Error) {
9547
- error.value = new Error(extractErrorMessage(response, t, "deviceGrant.messages.failed"));
9656
+ error.value = new __thunderid_browser.ThunderIDRuntimeError(extractErrorMessage(response, t, "deviceGrant.messages.failed"), "DEVICE_GRANT_ERROR", "vue");
9548
9657
  result.value = "failure";
9549
- props.onError?.(error.value);
9550
9658
  emit("error", error.value);
9551
9659
  return;
9552
9660
  }
@@ -9558,29 +9666,36 @@ const DeviceGrant = (0, vue.defineComponent)({
9558
9666
  url.searchParams.delete("applicationId");
9559
9667
  window.history.replaceState(window.history.state, "", url.toString());
9560
9668
  };
9561
- const startFlow = async (appId) => {
9669
+ const startFlow = async (appId, resumeId) => {
9562
9670
  isLoading.value = true;
9563
9671
  error.value = null;
9564
9672
  try {
9565
- const response = await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9566
- baseUrl,
9567
- payload: {
9568
- applicationId: appId,
9569
- flowType: __thunderid_browser.EmbeddedFlowType.DeviceGrant,
9570
- inputs: {}
9673
+ const challengeFromStorage = challengeTokenRef.current;
9674
+ let response;
9675
+ try {
9676
+ response = await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9677
+ baseUrl,
9678
+ payload: resumeId ? {
9679
+ executionId: resumeId,
9680
+ ...challengeFromStorage ? { challengeToken: challengeFromStorage } : {}
9681
+ } : {
9682
+ applicationId: appId,
9683
+ flowType: __thunderid_browser.EmbeddedFlowType.DeviceGrant,
9684
+ inputs: {}
9685
+ }
9686
+ });
9687
+ } catch (resumeError) {
9688
+ if (resumeId && resumeError instanceof __thunderid_browser.ThunderIDAPIError && resumeError.statusCode === 400) {
9689
+ persistExecutionId(null);
9690
+ await persistChallengeToken(null);
9691
+ throw new __thunderid_browser.ThunderIDRuntimeError(t("deviceGrant.errors.continue"), "DEVICE_GRANT_ERROR", "vue");
9571
9692
  }
9572
- });
9573
- clearVerificationParameters();
9574
- applyResponse(response);
9693
+ throw resumeError;
9694
+ }
9695
+ if (!resumeId) clearVerificationParameters();
9696
+ await applyResponse(response);
9575
9697
  } catch (cause) {
9576
- const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9577
- components.value = [];
9578
- additionalData.value = {};
9579
- serverFieldErrors.value = null;
9580
- error.value = flowError;
9581
- result.value = "failure";
9582
- props.onError?.(flowError);
9583
- emit("error", flowError);
9698
+ handleError(toDeviceGrantError(cause, t("deviceGrant.errors.continue")));
9584
9699
  } finally {
9585
9700
  isLoading.value = false;
9586
9701
  }
@@ -9591,48 +9706,121 @@ const DeviceGrant = (0, vue.defineComponent)({
9591
9706
  result.value = null;
9592
9707
  try {
9593
9708
  if (!executionId.value) return;
9594
- const inputs = Object.fromEntries(Object.entries(payload.inputs ?? {}).filter(([key]) => !key.startsWith("__consent_opt__")));
9709
+ const action = payload.action ?? actionId;
9710
+ const inputs = compileConsentInputs(payload.inputs ?? {}, action, components.value, additionalData.value);
9595
9711
  if (!hasUserCodeInput(components.value)) delete inputs["user_code"];
9596
- applyResponse(await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9712
+ await applyResponse(await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9597
9713
  baseUrl,
9598
9714
  payload: {
9599
- action: payload.action ?? actionId,
9715
+ action,
9600
9716
  challengeToken: challengeToken.value,
9601
9717
  executionId: executionId.value,
9602
9718
  inputs
9603
9719
  }
9604
9720
  }));
9605
9721
  } catch (cause) {
9606
- const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9607
- components.value = [];
9608
- additionalData.value = {};
9609
- serverFieldErrors.value = null;
9610
- error.value = flowError;
9611
- result.value = "failure";
9612
- props.onError?.(flowError);
9613
- emit("error", flowError);
9722
+ handleError(toDeviceGrantError(cause, t("deviceGrant.errors.continue")));
9614
9723
  } finally {
9615
9724
  isLoading.value = false;
9616
9725
  }
9617
9726
  };
9618
- (0, vue.onMounted)(() => {
9727
+ let timeoutHandle = null;
9728
+ let timeoutSubmittedFor = null;
9729
+ (0, vue.watch)(() => [additionalData.value["stepTimeout"], executionId.value], ([stepTimeout, activeExecutionId]) => {
9730
+ if (timeoutHandle) clearTimeout(timeoutHandle);
9731
+ timeoutHandle = null;
9732
+ const timeoutMs = Number(stepTimeout) || 0;
9733
+ if (timeoutMs <= 0 || !activeExecutionId) {
9734
+ isTimeoutDisabled.value = false;
9735
+ return;
9736
+ }
9737
+ timeoutHandle = setTimeout(() => {
9738
+ isTimeoutDisabled.value = true;
9739
+ const expiredError = new __thunderid_browser.ThunderIDRuntimeError(t("errors.signin.timeout") || "Time allowed to complete the step has expired.", "DEVICE_GRANT_ERROR", "vue");
9740
+ const actionId = additionalData.value["consentPrompt"] ? findConsentSubmitActionId(components.value) : void 0;
9741
+ if (actionId && timeoutSubmittedFor !== timeoutMs) {
9742
+ timeoutSubmittedFor = timeoutMs;
9743
+ submit({
9744
+ action: actionId,
9745
+ inputs: { [CONSENT_REASON_KEY]: __thunderid_browser.ConsentConstants.REASON_TIMEOUT }
9746
+ }, actionId);
9747
+ return;
9748
+ }
9749
+ handleError(expiredError);
9750
+ }, Math.max(0, timeoutMs - Date.now()));
9751
+ });
9752
+ (0, vue.onUnmounted)(() => {
9753
+ if (timeoutHandle) clearTimeout(timeoutHandle);
9754
+ });
9755
+ const sdkReady = isInitialized ?? (0, vue.ref)(true);
9756
+ const sdkIsLoading = sdkLoading ?? (0, vue.ref)(false);
9757
+ const callbackReady = (0, vue.computed)(() => sdkReady.value && !sdkIsLoading.value && isStorageReady.value);
9758
+ (0, vue.watch)(() => [sdkReady.value, sdkIsLoading.value], async ([ready, loading]) => {
9759
+ if (!ready || loading || isStorageReady.value) return;
9760
+ try {
9761
+ const storedChallengeToken = (await getStorageManager?.()?.getTemporaryData())?.["challengeToken"];
9762
+ if (typeof storedChallengeToken === "string") {
9763
+ challengeTokenRef.current = storedChallengeToken;
9764
+ challengeToken.value = storedChallengeToken;
9765
+ }
9766
+ } catch {} finally {
9767
+ isStorageReady.value = true;
9768
+ }
9769
+ }, { immediate: true });
9770
+ useOAuthCallback({
9771
+ currentFlowId: executionId,
9772
+ flowIdStorageKey: executionIdStorageKey,
9773
+ isInitialized: callbackReady,
9774
+ isSubmitting: isLoading,
9775
+ onError: (cause) => {
9776
+ persistExecutionId(null);
9777
+ persistChallengeToken(null);
9778
+ handleError(toDeviceGrantError(cause, String(cause)));
9779
+ },
9780
+ onFlowChange: (response) => void applyResponse(response),
9781
+ onSubmit: async (payload) => {
9782
+ isLoading.value = true;
9783
+ try {
9784
+ return await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9785
+ baseUrl,
9786
+ payload: {
9787
+ challengeToken: challengeTokenRef.current || challengeToken.value,
9788
+ executionId: payload.flowId,
9789
+ inputs: payload.inputs
9790
+ }
9791
+ });
9792
+ } finally {
9793
+ isLoading.value = false;
9794
+ }
9795
+ },
9796
+ processedFlag: oauthCodeProcessedFlag,
9797
+ setFlowId: persistExecutionId
9798
+ });
9799
+ (0, vue.watch)(() => [
9800
+ sdkReady.value,
9801
+ sdkIsLoading.value,
9802
+ isStorageReady.value
9803
+ ], async ([ready, loading, storageReady]) => {
9804
+ if (!ready || loading || !storageReady || flowStartAttempted.value) return;
9619
9805
  const url = new URL(window.location.href);
9620
9806
  const code = url.searchParams.get("user_code");
9621
9807
  if (code) initialValues.value = { user_code: code };
9622
9808
  const applicationIdFromUrl = url.searchParams.get("applicationId");
9623
9809
  const appId = applicationIdFromUrl?.trim() ? applicationIdFromUrl : applicationId;
9624
- if (!appId) {
9625
- const flowError = new Error(t("deviceGrant.errors.start"));
9810
+ if (url.searchParams.has("code") || url.searchParams.has("state") || url.searchParams.has("error") || oauthCodeProcessedFlag.value) return;
9811
+ const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
9812
+ if (!appId && !storedExecutionId) {
9813
+ flowStartAttempted.value = true;
9814
+ const flowError = new __thunderid_browser.ThunderIDRuntimeError(t("deviceGrant.errors.start"), "DEVICE_GRANT_ERROR", "vue");
9626
9815
  error.value = flowError;
9627
9816
  result.value = "failure";
9628
- props.onError?.(flowError);
9629
9817
  emit("error", flowError);
9630
9818
  return;
9631
9819
  }
9632
9820
  if (flowStartAttempted.value) return;
9633
9821
  flowStartAttempted.value = true;
9634
- startFlow(appId);
9635
- });
9822
+ await startFlow(appId ?? "", storedExecutionId ?? void 0);
9823
+ }, { immediate: true });
9636
9824
  return () => (0, vue.h)(BaseDeviceGrant_default, {
9637
9825
  className: props.className,
9638
9826
  components: components.value,
@@ -9640,6 +9828,7 @@ const DeviceGrant = (0, vue.defineComponent)({
9640
9828
  error: error.value,
9641
9829
  initialValues: initialValues.value,
9642
9830
  isLoading: isLoading.value,
9831
+ isTimeoutDisabled: isTimeoutDisabled.value,
9643
9832
  onSubmit: (payload, component) => submit(payload, component.id),
9644
9833
  result: result.value,
9645
9834
  serverFieldErrors: serverFieldErrors.value,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseDeviceGrant.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/device-grant/BaseDeviceGrant.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAC,KAAK,SAAS,EAAmE,MAAM,KAAK,CAAC;AAKrG,OAAO,KAAK,EAAC,qBAAqB,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAElF,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;AAE7D,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,GAAG,UAAU,CAAC;IAC9G,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,yFAAyF;AACzF,QAAA,MAAM,eAAe,EAAE,SA0FrB,CAAC;AAEH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"BaseDeviceGrant.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/device-grant/BaseDeviceGrant.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAC,KAAK,SAAS,EAAmE,MAAM,KAAK,CAAC;AAKrG,OAAO,KAAK,EAAC,qBAAqB,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAElF,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;AAE7D,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,eAAe,GAAG,UAAU,CAAC;IAC9G,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,QAAQ,EAAE,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,yFAAyF;AACzF,QAAA,MAAM,eAAe,EAAE,SA4FrB,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceGrant.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/device-grant/DeviceGrant.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,KAAK,SAAS,EAAmF,MAAM,KAAK,CAAC;AAErH,OAAO,KAAK,EAAC,0BAA0B,EAAoB,MAAM,mBAAmB,CAAC;AAMrF,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAgBhE,sGAAsG;AACtG,QAAA,MAAM,WAAW,EAAE,SAsKjB,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"DeviceGrant.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/device-grant/DeviceGrant.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,KAAK,CAAC;AAEb,OAAO,KAAK,EAAC,0BAA0B,EAAoB,MAAM,mBAAmB,CAAC;AAkBrF,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAgFhE,sGAAsG;AACtG,QAAA,MAAM,WAAW,EAAE,SA6TjB,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -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,OAAO,KAAK,EAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAAI,KAAK,KAAK,EAAC,MAAM,KAAK,CAAC;AAgDlC,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAokBvF,YAAY,EAAC,aAAa,EAAC,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,qBAAqB,EAAE,EACnC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,eAAe,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,Y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AAI,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,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,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,MAAM,CAAC,EAAE,M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AAEH,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/sign-in/SignIn.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,qBAAqB,EAErB,yBAAyB,EAIzB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,KAAK,CAAC;AAoBb;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,EAAE,SAsmBZ,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../src/components/auth/sign-in/SignIn.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,qBAAqB,EAErB,yBAAyB,EAIzB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,SAAS,EAWf,MAAM,KAAK,CAAC;AAmBb;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,EAAE,SA2kBZ,CAAC;AAEH,eAAe,MAAM,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
@@ -1,4 +1,4 @@
1
- import { ADMINISTRATION_FLOW_TYPE, APPLICATION_GRANT_TYPES, AccountLifecycleFlowConfigKey, AccountLifecycleFlowConfigKey as AccountLifecycleFlowConfigKey$1, AdministrationFlowConfigKey, AdministrationFlowData, AdministrationFlowError, AdministrationFlowInput, AdministrationModes, AgentQueryKeys, AgentQueryKeys as AgentQueryKeys$1, ApplicationQueryKeys, ApplicationQueryKeys as ApplicationQueryKeys$1, AuthFlowSelectConstants, CONSENT_INVALID_KEY_PREFIX, CONSENT_MODIFIED_KEY_PREFIX, ConsentConstants, CredentialConstants, DEFAULT_APPLICATION_GRANT_TYPES, 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, GroupQueryKeys, GroupQueryKeys as GroupQueryKeys$1, RoleQueryKeys, RoleQueryKeys as RoleQueryKeys$1, SPAUtils, SelectConstants, ThunderIDAPIError, ThunderIDAPIError as ThunderIDAPIError$1, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, ThunderIDWordmark, TranslationBundleConstants, UserQueryKeys, UserQueryKeys as UserQueryKeys$1, UserSelectConstants, UserTypeSelectConstants, addGroupMembers, addGroupMembers as addGroupMembers$1, addRoleAssignments, addRoleAssignments as addRoleAssignments$1, applyGatewayConfiguration, arrayBufferToBase64url, base64urlToArrayBuffer, bem, copyTextToClipboard, createAction, createAgent, createAgent as createAgent$1, createAgentType, createApplication, createApplication as createApplication$1, createApplicationSharingPolicy, createClassObserver, createClassObserver as createClassObserver$1, createConfigurationVersion, createConnection, createDesignTheme, createFlow, createGateway, createGatewaySecret, createGatewayVariable, createGroup, createGroup as createGroup$1, createHttpClientFetcher, createLayout, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createNotificationTemplate, createOrganizationUnit, createPackageComponentLogger, createPackageLogger, createResource, createResourceInvalidator, createResourceInvalidator as createResourceInvalidator$1, createResourceOptionsLoader, createResourceServer, createRole, createRole as createRole$1, createSecret, createTheme, createUser, createUser as createUser$1, createUserByPath, createUserSharingPolicy, createUserType, createVariable, deepMerge, deleteAction, deleteAgent, deleteAgent as deleteAgent$1, deleteAgentType, deleteApplication, deleteApplication as deleteApplication$1, deleteApplicationSharingPolicy, deleteConnection, deleteDesignTheme, deleteFlow, deleteGateway, deleteGatewaySecret, deleteGatewayVariable, deleteGroup, deleteImportedConfiguration, deleteLayout, deleteNotificationTemplate, deleteOrganizationUnit, deleteOrganizationUnitByPath, deleteResource, deleteResourceServer, deleteRole, deleteSecret, deleteTranslation, deleteTranslations, deleteUser, deleteUser as deleteUser$1, deleteUserSharingPolicy, deleteUserType, deleteVariable, detectThemeMode, detectThemeMode as detectThemeMode$1, evaluateChangePasswordForm, executeAdministrationFlow, executeEmbeddedDeviceGrantFlow, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, exportConfiguration, extractEmojiFromUri, extractUserClaimsFromIdToken, fallbackResourceInvalidator, findAdministrationFlows, generateFlattenedUserProfile, get, getAccountLifecycleActions, getAccountLifecycleActions as getAccountLifecycleActions$1, getAction, getActions, getActiveTheme, getAgent, getAgent as getAgent$1, getAgentGroups, getAgentGroups as getAgentGroups$1, getAgentName, getAgentName as getAgentName$1, getAgentRoles, getAgentRoles as getAgentRoles$1, getAgentType, getAgentTypes, getAgentTypes as getAgentTypes$1, getAgents, getAgents as getAgents$1, getApplication, getApplication as getApplication$1, getApplicationClientSecret, getApplicationOAuthConfig, getApplicationOverlayRules, getApplicationSharingPolicies, getApplicationSharingPolicy, getApplications, getApplications as getApplications$1, getConfigurationVersion, getConfigurationVersions, getConnection, getConnectionUsages, getConnections, getConnectionsMeta, getConsentElementDecision, getDefaultI18nBundles, getDesignTheme, getDesignThemeUsages, getDesignThemes, getFlow, getFlowMeta, getFlowUsages, getFlowVersion, getFlowVersions, getFlows, getFlows as getFlows$1, getGateway, getGatewayAppliedConfiguration, getGatewayAppliedVersion, getGatewayConfigurationDiff, getGatewaySecret, getGatewaySecrets, getGatewayVariable, getGatewayVariables, getGateways, getGroup, getGroupMembers, getGroupMembers as getGroupMembers$1, getGroups, getGroups as getGroups$1, getLanguages, getLayout, getLayoutUsages, getLayouts, getNotificationTemplate, getNotificationTemplates, getOrganizationUnit, getOrganizationUnitByPath, getOrganizationUnitChildren, getOrganizationUnitGroups, getOrganizationUnitRoles, getOrganizationUnitUsers, getOrganizationUnits, getResource, getResourceServer, getResourceServers, getResources, getRole, getRole as getRole$1, getRoleAssignments, getRoleAssignments as getRoleAssignments$1, getRoles, getRoles as getRoles$1, getSecret, getSecrets, getSelectMessages, getServerConfig, getServerConfigs, getTokenPermissions, getUser, getUser as getUser$1, getUserGroups, getUserGroups as getUserGroups$1, getUserOverlayRules, getUserSharingPolicies, getUserSharingPolicy, getUserType, getUserTypes, getUserTypes as getUserTypes$1, getUserUsages, getUsers, getUsers as getUsers$1, getUsersByPath, getUsersMe, getUsersMeMeta, getVariable, getVariables, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, hasPermission, hasPermission as hasPermission$1, hasUnresolvedTranslationParams, http, importConfiguration, isApplicationSubmissionValid, isEmojiUri, isEmpty, loadUntilOptionsGrow, mapCredentialUpdateError, mergeOptionsBatch, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeSelectOptions, normalizeTranslations, parseKeyValuePairs, parseKeyValuePairs as parseKeyValuePairs$1, parseRedirectUris, previewCimdDocument, regenerateAgentSecret, regenerateClientSecret, regenerateClientSecret as regenerateClientSecret$1, regenerateFlowSecret, removeGroupMembers, removeGroupMembers as removeGroupMembers$1, removeRoleAssignments, removeRoleAssignments as removeRoleAssignments$1, resolveAdministrationFlowHandles, resolveAdministrationFlowId, resolveAdministrationFlows, resolveAdministrationFlows as resolveAdministrationFlows$1, resolveChangeCredentialPolicy, resolveDesign, resolveFlowTemplateLiterals, resolveLogoUri, resolveManagedIdentityName, resolvePageSize, resolveRequestBaseUrl, resolveResourceEndpoint, resolveTranslation, resolveTranslations, restoreFlowVersion, revertGatewayConfiguration, runAccountLifecycleAction, runAccountLifecycleAction as runAccountLifecycleAction$1, runAdministrationFlow, setTranslation, setTranslations, startCase, substituteTranslationParams, supportsCredential, suspendAgent, suspendApplication, suspendUser, toAuthFlowSelectPage, toCreateApplicationRequest, toEqualityFilter, toError, toManagementErrorMessage, toUpdateApplicationRequest, toUserSelectPage, toUserTypeSelectPage, unlockAgent, unlockUser, unsuspendAgent, unsuspendApplication, unsuspendUser, updateAction, updateAgent, updateAgentType, updateApplication, updateApplication as updateApplication$1, updateApplicationSharingPolicy, updateConnection, updateDesignTheme, updateFlow, updateGateway, updateGatewaySecret, updateGatewayVariable, updateGroup, updateLayout, updateMeCredentials, updateMeProfile, updateNotificationTemplate, updateOrganizationUnit, updateOrganizationUnitByPath, updateResource, updateResourceServer, updateRole, updateSecret, updateServerConfig, updateUser, updateUser as updateUser$1, updateUserCredentials, updateUserSharingPolicy, updateUserType, updateVariable, withVendorCSSClassPrefix } from "@thunderid/browser";
1
+ import { ADMINISTRATION_FLOW_TYPE, APPLICATION_GRANT_TYPES, AccountLifecycleFlowConfigKey, AccountLifecycleFlowConfigKey as AccountLifecycleFlowConfigKey$1, AdministrationFlowConfigKey, AdministrationFlowData, AdministrationFlowError, AdministrationFlowInput, AdministrationModes, AgentQueryKeys, AgentQueryKeys as AgentQueryKeys$1, ApplicationQueryKeys, ApplicationQueryKeys as ApplicationQueryKeys$1, AuthFlowSelectConstants, ConsentConstants, CredentialConstants, DEFAULT_APPLICATION_GRANT_TYPES, 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, GroupQueryKeys, GroupQueryKeys as GroupQueryKeys$1, RoleQueryKeys, RoleQueryKeys as RoleQueryKeys$1, SPAUtils, SelectConstants, ThunderIDAPIError, ThunderIDAPIError as ThunderIDAPIError$1, ThunderIDBrowserClient, ThunderIDError, ThunderIDRuntimeError, ThunderIDRuntimeError as ThunderIDRuntimeError$1, ThunderIDWordmark, TranslationBundleConstants, UserQueryKeys, UserQueryKeys as UserQueryKeys$1, UserSelectConstants, UserTypeSelectConstants, addGroupMembers, addGroupMembers as addGroupMembers$1, addRoleAssignments, addRoleAssignments as addRoleAssignments$1, applyGatewayConfiguration, arrayBufferToBase64url, base64urlToArrayBuffer, bem, compileConsentDecisions, copyTextToClipboard, createAction, createAgent, createAgent as createAgent$1, createAgentType, createApplication, createApplication as createApplication$1, createApplicationSharingPolicy, createClassObserver, createClassObserver as createClassObserver$1, createConfigurationVersion, createConnection, createDesignTheme, createFlow, createGateway, createGatewaySecret, createGatewayVariable, createGroup, createGroup as createGroup$1, createHttpClientFetcher, createLayout, createMediaQueryListener, createMediaQueryListener as createMediaQueryListener$1, createNotificationTemplate, createOrganizationUnit, createPackageComponentLogger, createPackageLogger, createResource, createResourceInvalidator, createResourceInvalidator as createResourceInvalidator$1, createResourceOptionsLoader, createResourceServer, createRole, createRole as createRole$1, createSecret, createTheme, createUser, createUser as createUser$1, createUserByPath, createUserSharingPolicy, createUserType, createVariable, deepMerge, deleteAction, deleteAgent, deleteAgent as deleteAgent$1, deleteAgentType, deleteApplication, deleteApplication as deleteApplication$1, deleteApplicationSharingPolicy, deleteConnection, deleteDesignTheme, deleteFlow, deleteGateway, deleteGatewaySecret, deleteGatewayVariable, deleteGroup, deleteImportedConfiguration, deleteLayout, deleteNotificationTemplate, deleteOrganizationUnit, deleteOrganizationUnitByPath, deleteResource, deleteResourceServer, deleteRole, deleteSecret, deleteTranslation, deleteTranslations, deleteUser, deleteUser as deleteUser$1, deleteUserSharingPolicy, deleteUserType, deleteVariable, detectThemeMode, detectThemeMode as detectThemeMode$1, evaluateChangePasswordForm, executeAdministrationFlow, executeEmbeddedDeviceGrantFlow, executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow, exportConfiguration, extractEmojiFromUri, extractUserClaimsFromIdToken, fallbackResourceInvalidator, findAdministrationFlows, generateFlattenedUserProfile, get, getAccountLifecycleActions, getAccountLifecycleActions as getAccountLifecycleActions$1, getAction, getActions, getActiveTheme, getAgent, getAgent as getAgent$1, getAgentGroups, getAgentGroups as getAgentGroups$1, getAgentName, getAgentName as getAgentName$1, getAgentRoles, getAgentRoles as getAgentRoles$1, getAgentType, getAgentTypes, getAgentTypes as getAgentTypes$1, getAgents, getAgents as getAgents$1, getApplication, getApplication as getApplication$1, getApplicationClientSecret, getApplicationOAuthConfig, getApplicationOverlayRules, getApplicationSharingPolicies, getApplicationSharingPolicy, getApplications, getApplications as getApplications$1, getConfigurationVersion, getConfigurationVersions, getConnection, getConnectionUsages, getConnections, getConnectionsMeta, getConsentElementDecision, getDefaultI18nBundles, getDesignTheme, getDesignThemeUsages, getDesignThemes, getFlow, getFlowMeta, getFlowUsages, getFlowVersion, getFlowVersions, getFlows, getFlows as getFlows$1, getGateway, getGatewayAppliedConfiguration, getGatewayAppliedVersion, getGatewayConfigurationDiff, getGatewaySecret, getGatewaySecrets, getGatewayVariable, getGatewayVariables, getGateways, getGroup, getGroupMembers, getGroupMembers as getGroupMembers$1, getGroups, getGroups as getGroups$1, getLanguages, getLayout, getLayoutUsages, getLayouts, getNotificationTemplate, getNotificationTemplates, getOrganizationUnit, getOrganizationUnitByPath, getOrganizationUnitChildren, getOrganizationUnitGroups, getOrganizationUnitRoles, getOrganizationUnitUsers, getOrganizationUnits, getResource, getResourceServer, getResourceServers, getResources, getRole, getRole as getRole$1, getRoleAssignments, getRoleAssignments as getRoleAssignments$1, getRoles, getRoles as getRoles$1, getSecret, getSecrets, getSelectMessages, getServerConfig, getServerConfigs, getTokenPermissions, getUser, getUser as getUser$1, getUserGroups, getUserGroups as getUserGroups$1, getUserOverlayRules, getUserSharingPolicies, getUserSharingPolicy, getUserType, getUserTypes, getUserTypes as getUserTypes$1, getUserUsages, getUsers, getUsers as getUsers$1, getUsersByPath, getUsersMe, getUsersMeMeta, getVariable, getVariables, getVendorPrefix, handleWebAuthnAuthentication, hasAuthParamsInUrl, hasAuthParamsInUrl as hasAuthParamsInUrl$1, hasCalledForThisInstanceInUrl, hasPermission, hasPermission as hasPermission$1, hasUnresolvedTranslationParams, http, importConfiguration, isApplicationSubmissionValid, isEmojiUri, isEmpty, loadUntilOptionsGrow, mapCredentialUpdateError, mergeOptionsBatch, navigate, navigate as navigate$1, normalizeBorderRadius, normalizeSelectOptions, normalizeTranslations, parseKeyValuePairs, parseKeyValuePairs as parseKeyValuePairs$1, parseRedirectUris, previewCimdDocument, regenerateAgentSecret, regenerateClientSecret, regenerateClientSecret as regenerateClientSecret$1, regenerateFlowSecret, removeGroupMembers, removeGroupMembers as removeGroupMembers$1, removeRoleAssignments, removeRoleAssignments as removeRoleAssignments$1, resolveAdministrationFlowHandles, resolveAdministrationFlowId, resolveAdministrationFlows, resolveAdministrationFlows as resolveAdministrationFlows$1, resolveChangeCredentialPolicy, resolveDesign, resolveFlowTemplateLiterals, resolveLogoUri, resolveManagedIdentityName, resolvePageSize, resolveRequestBaseUrl, resolveResourceEndpoint, resolveTranslation, resolveTranslations, restoreFlowVersion, revertGatewayConfiguration, runAccountLifecycleAction, runAccountLifecycleAction as runAccountLifecycleAction$1, runAdministrationFlow, setTranslation, setTranslations, startCase, substituteTranslationParams, supportsCredential, suspendAgent, suspendApplication, suspendUser, toAuthFlowSelectPage, toCreateApplicationRequest, toEqualityFilter, toError, toManagementErrorMessage, toUpdateApplicationRequest, toUserSelectPage, toUserTypeSelectPage, unlockAgent, unlockUser, unsuspendAgent, unsuspendApplication, unsuspendUser, updateAction, updateAgent, updateAgentType, updateApplication, updateApplication as updateApplication$1, updateApplicationSharingPolicy, updateConnection, updateDesignTheme, updateFlow, updateGateway, updateGatewaySecret, updateGatewayVariable, updateGroup, updateLayout, updateMeCredentials, updateMeProfile, updateNotificationTemplate, updateOrganizationUnit, updateOrganizationUnitByPath, updateResource, updateResourceServer, updateRole, updateSecret, updateServerConfig, updateUser, updateUser as updateUser$1, updateUserCredentials, updateUserSharingPolicy, updateUserType, updateVariable, withVendorCSSClassPrefix } from "@thunderid/browser";
2
2
  import { Comment, Fragment, Teleport, computed, defineComponent, getCurrentInstance, getCurrentScope, h, inject, nextTick, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, provide, readonly, ref, shallowReadonly, shallowRef, toValue, useId, watch } from "vue";
3
3
  import DOMPurify from "dompurify";
4
4
 
@@ -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) || "",
@@ -8618,6 +8648,7 @@ const BaseSignIn = defineComponent({
8618
8648
  const isLoading = computed(() => props.isLoading || isSubmitting.value);
8619
8649
  const formValues = ref({});
8620
8650
  const touchedFields = ref({});
8651
+ const serverFormErrors = ref({});
8621
8652
  watch(() => props.components, (newComponents) => {
8622
8653
  const fields = extractFormFields$1(newComponents || []);
8623
8654
  const freshValues = { ...props.initialValues };
@@ -8626,6 +8657,7 @@ const BaseSignIn = defineComponent({
8626
8657
  });
8627
8658
  formValues.value = freshValues;
8628
8659
  touchedFields.value = {};
8660
+ serverFormErrors.value = {};
8629
8661
  }, {
8630
8662
  deep: false,
8631
8663
  immediate: true
@@ -8636,12 +8668,24 @@ const BaseSignIn = defineComponent({
8636
8668
  ...initialValues
8637
8669
  };
8638
8670
  }, { deep: true });
8639
- const formErrors = computed(() => {
8640
- const fields = extractFormFields$1(props.components || []);
8671
+ watch(() => props.serverFieldErrors, (fieldErrors) => {
8641
8672
  const errors = {};
8642
- (props.serverFieldErrors ?? []).forEach((fieldError) => {
8643
- if (!(fieldError.identifier in errors)) errors[fieldError.identifier] = fieldError.message;
8673
+ const touched = {};
8674
+ (fieldErrors ?? []).forEach((fieldError) => {
8675
+ if (!(fieldError.identifier in errors)) {
8676
+ errors[fieldError.identifier] = fieldError.message;
8677
+ touched[fieldError.identifier] = true;
8678
+ }
8644
8679
  });
8680
+ serverFormErrors.value = errors;
8681
+ if (Object.keys(touched).length > 0) touchedFields.value = {
8682
+ ...touchedFields.value,
8683
+ ...touched
8684
+ };
8685
+ }, { immediate: true });
8686
+ const formErrors = computed(() => {
8687
+ const fields = extractFormFields$1(props.components || []);
8688
+ const errors = { ...serverFormErrors.value };
8645
8689
  fields.forEach((field) => {
8646
8690
  const value = formValues.value[field.name] || "";
8647
8691
  const isTouched = touchedFields.value[field.name] || false;
@@ -8665,6 +8709,11 @@ const BaseSignIn = defineComponent({
8665
8709
  ...formValues.value,
8666
8710
  [name]: value
8667
8711
  };
8712
+ if (name in serverFormErrors.value) {
8713
+ const errors = { ...serverFormErrors.value };
8714
+ delete errors[name];
8715
+ serverFormErrors.value = errors;
8716
+ }
8668
8717
  };
8669
8718
  const handleInputBlur = (name) => {
8670
8719
  touchedFields.value = {
@@ -9085,39 +9134,24 @@ const SignIn = defineComponent({
9085
9134
  const handleSubmit = async (payload) => {
9086
9135
  const effectiveExecutionId = payload.executionId || currentExecutionId.value;
9087
9136
  if (!effectiveExecutionId) throw new Error("No active flow ID");
9088
- const processedInputs = { ...payload.inputs };
9137
+ let processedInputs = { ...payload.inputs };
9089
9138
  if (additionalData.value?.["consentPrompt"]) try {
9090
9139
  const consentRaw = additionalData.value["consentPrompt"];
9091
9140
  const purposes = typeof consentRaw === "string" ? JSON.parse(consentRaw) : consentRaw.purposes || consentRaw;
9092
9141
  let isDeny = false;
9093
9142
  if (payload.action) {
9094
- const findAction = (comps) => {
9143
+ const findAction$1 = (comps) => {
9095
9144
  if (!comps?.length) return null;
9096
9145
  const found = comps.find((c) => c.id === payload.action);
9097
9146
  if (found) return found;
9098
- return comps.reduce((acc, c) => acc || (c.components ? findAction(c.components) : null), null);
9147
+ return comps.reduce((acc, c) => acc || (c.components ? findAction$1(c.components) : null), null);
9099
9148
  };
9100
- const submitAction = findAction(components.value);
9149
+ const submitAction = findAction$1(components.value);
9101
9150
  if (submitAction && submitAction.variant?.toLowerCase() !== "primary") isDeny = true;
9102
9151
  }
9103
- const decisions = {
9152
+ processedInputs = compileConsentDecisions(processedInputs, purposes, {
9104
9153
  approved: !isDeny,
9105
- ...isDeny ? { reason: ConsentConstants.REASON_USER_DENIED } : {},
9106
- purposes: purposes.map((p) => ({
9107
- approved: !isDeny,
9108
- elements: [...(p.essential ?? []).map((e) => ({
9109
- approved: !isDeny,
9110
- name: e.name
9111
- })), ...(p.optional ?? []).map((e) => {
9112
- const key = getConsentOptionalKey(p.purposeId, e.name);
9113
- return getConsentElementDecision(p.purposeId, e, !isDeny && processedInputs[key] === "true", processedInputs);
9114
- })],
9115
- purposeName: p.purposeName
9116
- }))
9117
- };
9118
- processedInputs["consent_decisions"] = JSON.stringify(decisions);
9119
- Object.keys(processedInputs).forEach((key) => {
9120
- if (key.startsWith("__consent_opt__") || key.startsWith(CONSENT_MODIFIED_KEY_PREFIX) || key.startsWith(CONSENT_INVALID_KEY_PREFIX)) delete processedInputs[key];
9154
+ ...isDeny ? { reason: ConsentConstants.REASON_USER_DENIED } : {}
9121
9155
  });
9122
9156
  } catch {}
9123
9157
  try {
@@ -9391,6 +9425,10 @@ const BaseDeviceGrant = defineComponent({
9391
9425
  default: false,
9392
9426
  type: Boolean
9393
9427
  },
9428
+ isTimeoutDisabled: {
9429
+ default: false,
9430
+ type: Boolean
9431
+ },
9394
9432
  error: {
9395
9433
  default: null,
9396
9434
  type: Object
@@ -9447,6 +9485,7 @@ const BaseDeviceGrant = defineComponent({
9447
9485
  error: props.error,
9448
9486
  initialValues: props.initialValues,
9449
9487
  isLoading: props.isLoading,
9488
+ isTimeoutDisabled: props.isTimeoutDisabled,
9450
9489
  onSubmit: props.onSubmit,
9451
9490
  serverFieldErrors: props.serverFieldErrors,
9452
9491
  size: props.size,
@@ -9462,7 +9501,51 @@ var BaseDeviceGrant_default = BaseDeviceGrant;
9462
9501
 
9463
9502
  //#endregion
9464
9503
  //#region src/components/auth/device-grant/DeviceGrant.ts
9504
+ const toDeviceGrantError = (cause, fallbackMessage) => {
9505
+ if (cause instanceof ThunderIDAPIError$1 || cause instanceof ThunderIDRuntimeError$1) return cause;
9506
+ return new ThunderIDRuntimeError$1(cause instanceof Error ? cause.message : fallbackMessage, "DEVICE_GRANT_ERROR", "vue", cause);
9507
+ };
9465
9508
  const hasUserCodeInput = (components) => components.some((component) => component.ref === "user_code" || Array.isArray(component.components) && hasUserCodeInput(component.components));
9509
+ const findAction = (components, actionId) => {
9510
+ for (const component of components) {
9511
+ if (component.id === actionId) return component;
9512
+ if (component.components) {
9513
+ const nestedAction = findAction(component.components, actionId);
9514
+ if (nestedAction) return nestedAction;
9515
+ }
9516
+ }
9517
+ };
9518
+ const parseConsentPurposes = (value) => {
9519
+ let parsed = value;
9520
+ if (typeof parsed === "string") try {
9521
+ parsed = JSON.parse(parsed);
9522
+ } catch {
9523
+ return null;
9524
+ }
9525
+ if (Array.isArray(parsed)) return parsed;
9526
+ if (typeof parsed === "object" && parsed !== null && "purposes" in parsed && Array.isArray(parsed.purposes)) return parsed.purposes;
9527
+ return null;
9528
+ };
9529
+ const CONSENT_REASON_KEY = "__consent_reason__";
9530
+ const flattenComponents = (items) => items.flatMap((component) => [component, ...flattenComponents(component.components ?? [])]);
9531
+ const findConsentSubmitActionId = (items) => {
9532
+ const actions = flattenComponents(items).filter((component) => component.id && component.eventType?.toUpperCase() === "SUBMIT");
9533
+ return (actions.find((component) => component.variant?.toLowerCase() !== "primary") ?? actions[0])?.id;
9534
+ };
9535
+ const compileConsentInputs = (inputs, actionId, components, additionalData) => {
9536
+ const action = actionId ? findAction(components, actionId) : void 0;
9537
+ const purposes = parseConsentPurposes(additionalData["consentPrompt"]);
9538
+ const consentReason = inputs[CONSENT_REASON_KEY];
9539
+ const cleanInputs = { ...inputs };
9540
+ delete cleanInputs[CONSENT_REASON_KEY];
9541
+ const isSubmitAction = Boolean(action && action.eventType?.toUpperCase() !== "TRIGGER");
9542
+ const isTimeout = consentReason === ConsentConstants.REASON_TIMEOUT;
9543
+ const isDeny = isTimeout || Boolean(action && isSubmitAction && action.variant?.toLowerCase() !== "primary");
9544
+ return compileConsentDecisions(cleanInputs, isSubmitAction ? purposes : null, {
9545
+ approved: !isDeny,
9546
+ ...isTimeout ? { reason: ConsentConstants.REASON_TIMEOUT } : isDeny ? { reason: ConsentConstants.REASON_USER_DENIED } : {}
9547
+ });
9548
+ };
9466
9549
  /** Runs the application's configured Device Grant flow and exposes its state for custom renderers. */
9467
9550
  const DeviceGrant = defineComponent({
9468
9551
  name: "DeviceGrant",
@@ -9478,19 +9561,11 @@ const DeviceGrant = defineComponent({
9478
9561
  variant: {
9479
9562
  default: "flat",
9480
9563
  type: String
9481
- },
9482
- onComplete: {
9483
- default: void 0,
9484
- type: Function
9485
- },
9486
- onError: {
9487
- default: void 0,
9488
- type: Function
9489
9564
  }
9490
9565
  },
9491
9566
  emits: ["complete", "error"],
9492
9567
  setup(props, { emit, slots }) {
9493
- const { applicationId, baseUrl } = useThunderID_default();
9568
+ const { applicationId, baseUrl, getStorageManager, isInitialized, isLoading: sdkLoading, vendor } = useThunderID_default();
9494
9569
  const { meta } = useFlowMeta_default();
9495
9570
  const { t } = useI18n_default();
9496
9571
  const components = ref([]);
@@ -9499,28 +9574,61 @@ const DeviceGrant = defineComponent({
9499
9574
  const serverFieldErrors = ref(null);
9500
9575
  const executionId = ref("");
9501
9576
  const challengeToken = ref("");
9577
+ const challengeTokenRef = { current: "" };
9578
+ const isStorageReady = ref(false);
9502
9579
  const error = ref(null);
9503
9580
  const isLoading = ref(false);
9581
+ const isTimeoutDisabled = ref(false);
9504
9582
  const result = ref(null);
9505
9583
  const flowStartAttempted = ref(false);
9506
- const applyResponse = (response) => {
9584
+ const executionIdStorageKey = `${vendor}_device_grant_execution_id`;
9585
+ const oauthCodeProcessedFlag = { value: false };
9586
+ const persistExecutionId = (id) => {
9587
+ executionId.value = id ?? "";
9588
+ if (id) sessionStorage.setItem(executionIdStorageKey, id);
9589
+ else sessionStorage.removeItem(executionIdStorageKey);
9590
+ };
9591
+ const persistChallengeToken = async (token) => {
9592
+ challengeTokenRef.current = token ?? "";
9593
+ challengeToken.value = token ?? "";
9594
+ try {
9595
+ const storageManager = getStorageManager?.();
9596
+ if (storageManager) if (token) await storageManager.setTemporaryDataParameter("challengeToken", token);
9597
+ else await storageManager.removeTemporaryDataParameter("challengeToken");
9598
+ } catch {}
9599
+ };
9600
+ const handleError = (flowError) => {
9601
+ components.value = [];
9602
+ additionalData.value = {};
9603
+ serverFieldErrors.value = null;
9604
+ error.value = flowError;
9605
+ result.value = "failure";
9606
+ emit("error", flowError);
9607
+ };
9608
+ const applyResponse = async (response) => {
9609
+ const redirectURL = response.data?.redirectURL ?? response.redirectUrl;
9610
+ if (response.type === EmbeddedSignInFlowType$1.Redirection && typeof redirectURL === "string") {
9611
+ persistExecutionId(response.executionId ?? null);
9612
+ await persistChallengeToken(response.challengeToken ?? null);
9613
+ initiateOAuthRedirect(redirectURL, vendor);
9614
+ return;
9615
+ }
9507
9616
  const normalized = normalizeFlowResponse(response, t, { resolveTranslations: false }, meta.value);
9508
- executionId.value = response.executionId ?? "";
9509
- challengeToken.value = response.challengeToken ?? "";
9617
+ persistExecutionId(response.flowStatus === EmbeddedSignInFlowStatus$1.Incomplete ? response.executionId ?? null : null);
9618
+ await persistChallengeToken(response.flowStatus === EmbeddedSignInFlowStatus$1.Incomplete ? response.challengeToken ?? null : null);
9510
9619
  components.value = normalized.components ?? [];
9511
9620
  additionalData.value = normalized.additionalData ?? {};
9621
+ isTimeoutDisabled.value = false;
9512
9622
  serverFieldErrors.value = response.data?.fieldErrors ?? null;
9513
9623
  error.value = response.error ? new Error(extractErrorMessage(response, t)) : null;
9514
9624
  if (response.flowStatus === EmbeddedSignInFlowStatus$1.Complete) {
9515
9625
  result.value = "success";
9516
- props.onComplete?.(response);
9517
9626
  emit("complete", response);
9518
9627
  return;
9519
9628
  }
9520
9629
  if (response.flowStatus === EmbeddedSignInFlowStatus$1.Error) {
9521
- error.value = new Error(extractErrorMessage(response, t, "deviceGrant.messages.failed"));
9630
+ error.value = new ThunderIDRuntimeError$1(extractErrorMessage(response, t, "deviceGrant.messages.failed"), "DEVICE_GRANT_ERROR", "vue");
9522
9631
  result.value = "failure";
9523
- props.onError?.(error.value);
9524
9632
  emit("error", error.value);
9525
9633
  return;
9526
9634
  }
@@ -9532,29 +9640,36 @@ const DeviceGrant = defineComponent({
9532
9640
  url.searchParams.delete("applicationId");
9533
9641
  window.history.replaceState(window.history.state, "", url.toString());
9534
9642
  };
9535
- const startFlow = async (appId) => {
9643
+ const startFlow = async (appId, resumeId) => {
9536
9644
  isLoading.value = true;
9537
9645
  error.value = null;
9538
9646
  try {
9539
- const response = await executeEmbeddedDeviceGrantFlow({
9540
- baseUrl,
9541
- payload: {
9542
- applicationId: appId,
9543
- flowType: EmbeddedFlowType.DeviceGrant,
9544
- inputs: {}
9647
+ const challengeFromStorage = challengeTokenRef.current;
9648
+ let response;
9649
+ try {
9650
+ response = await executeEmbeddedDeviceGrantFlow({
9651
+ baseUrl,
9652
+ payload: resumeId ? {
9653
+ executionId: resumeId,
9654
+ ...challengeFromStorage ? { challengeToken: challengeFromStorage } : {}
9655
+ } : {
9656
+ applicationId: appId,
9657
+ flowType: EmbeddedFlowType.DeviceGrant,
9658
+ inputs: {}
9659
+ }
9660
+ });
9661
+ } catch (resumeError) {
9662
+ if (resumeId && resumeError instanceof ThunderIDAPIError$1 && resumeError.statusCode === 400) {
9663
+ persistExecutionId(null);
9664
+ await persistChallengeToken(null);
9665
+ throw new ThunderIDRuntimeError$1(t("deviceGrant.errors.continue"), "DEVICE_GRANT_ERROR", "vue");
9545
9666
  }
9546
- });
9547
- clearVerificationParameters();
9548
- applyResponse(response);
9667
+ throw resumeError;
9668
+ }
9669
+ if (!resumeId) clearVerificationParameters();
9670
+ await applyResponse(response);
9549
9671
  } catch (cause) {
9550
- const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9551
- components.value = [];
9552
- additionalData.value = {};
9553
- serverFieldErrors.value = null;
9554
- error.value = flowError;
9555
- result.value = "failure";
9556
- props.onError?.(flowError);
9557
- emit("error", flowError);
9672
+ handleError(toDeviceGrantError(cause, t("deviceGrant.errors.continue")));
9558
9673
  } finally {
9559
9674
  isLoading.value = false;
9560
9675
  }
@@ -9565,48 +9680,121 @@ const DeviceGrant = defineComponent({
9565
9680
  result.value = null;
9566
9681
  try {
9567
9682
  if (!executionId.value) return;
9568
- const inputs = Object.fromEntries(Object.entries(payload.inputs ?? {}).filter(([key]) => !key.startsWith("__consent_opt__")));
9683
+ const action = payload.action ?? actionId;
9684
+ const inputs = compileConsentInputs(payload.inputs ?? {}, action, components.value, additionalData.value);
9569
9685
  if (!hasUserCodeInput(components.value)) delete inputs["user_code"];
9570
- applyResponse(await executeEmbeddedDeviceGrantFlow({
9686
+ await applyResponse(await executeEmbeddedDeviceGrantFlow({
9571
9687
  baseUrl,
9572
9688
  payload: {
9573
- action: payload.action ?? actionId,
9689
+ action,
9574
9690
  challengeToken: challengeToken.value,
9575
9691
  executionId: executionId.value,
9576
9692
  inputs
9577
9693
  }
9578
9694
  }));
9579
9695
  } catch (cause) {
9580
- const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9581
- components.value = [];
9582
- additionalData.value = {};
9583
- serverFieldErrors.value = null;
9584
- error.value = flowError;
9585
- result.value = "failure";
9586
- props.onError?.(flowError);
9587
- emit("error", flowError);
9696
+ handleError(toDeviceGrantError(cause, t("deviceGrant.errors.continue")));
9588
9697
  } finally {
9589
9698
  isLoading.value = false;
9590
9699
  }
9591
9700
  };
9592
- onMounted(() => {
9701
+ let timeoutHandle = null;
9702
+ let timeoutSubmittedFor = null;
9703
+ watch(() => [additionalData.value["stepTimeout"], executionId.value], ([stepTimeout, activeExecutionId]) => {
9704
+ if (timeoutHandle) clearTimeout(timeoutHandle);
9705
+ timeoutHandle = null;
9706
+ const timeoutMs = Number(stepTimeout) || 0;
9707
+ if (timeoutMs <= 0 || !activeExecutionId) {
9708
+ isTimeoutDisabled.value = false;
9709
+ return;
9710
+ }
9711
+ timeoutHandle = setTimeout(() => {
9712
+ isTimeoutDisabled.value = true;
9713
+ const expiredError = new ThunderIDRuntimeError$1(t("errors.signin.timeout") || "Time allowed to complete the step has expired.", "DEVICE_GRANT_ERROR", "vue");
9714
+ const actionId = additionalData.value["consentPrompt"] ? findConsentSubmitActionId(components.value) : void 0;
9715
+ if (actionId && timeoutSubmittedFor !== timeoutMs) {
9716
+ timeoutSubmittedFor = timeoutMs;
9717
+ submit({
9718
+ action: actionId,
9719
+ inputs: { [CONSENT_REASON_KEY]: ConsentConstants.REASON_TIMEOUT }
9720
+ }, actionId);
9721
+ return;
9722
+ }
9723
+ handleError(expiredError);
9724
+ }, Math.max(0, timeoutMs - Date.now()));
9725
+ });
9726
+ onUnmounted(() => {
9727
+ if (timeoutHandle) clearTimeout(timeoutHandle);
9728
+ });
9729
+ const sdkReady = isInitialized ?? ref(true);
9730
+ const sdkIsLoading = sdkLoading ?? ref(false);
9731
+ const callbackReady = computed(() => sdkReady.value && !sdkIsLoading.value && isStorageReady.value);
9732
+ watch(() => [sdkReady.value, sdkIsLoading.value], async ([ready, loading]) => {
9733
+ if (!ready || loading || isStorageReady.value) return;
9734
+ try {
9735
+ const storedChallengeToken = (await getStorageManager?.()?.getTemporaryData())?.["challengeToken"];
9736
+ if (typeof storedChallengeToken === "string") {
9737
+ challengeTokenRef.current = storedChallengeToken;
9738
+ challengeToken.value = storedChallengeToken;
9739
+ }
9740
+ } catch {} finally {
9741
+ isStorageReady.value = true;
9742
+ }
9743
+ }, { immediate: true });
9744
+ useOAuthCallback({
9745
+ currentFlowId: executionId,
9746
+ flowIdStorageKey: executionIdStorageKey,
9747
+ isInitialized: callbackReady,
9748
+ isSubmitting: isLoading,
9749
+ onError: (cause) => {
9750
+ persistExecutionId(null);
9751
+ persistChallengeToken(null);
9752
+ handleError(toDeviceGrantError(cause, String(cause)));
9753
+ },
9754
+ onFlowChange: (response) => void applyResponse(response),
9755
+ onSubmit: async (payload) => {
9756
+ isLoading.value = true;
9757
+ try {
9758
+ return await executeEmbeddedDeviceGrantFlow({
9759
+ baseUrl,
9760
+ payload: {
9761
+ challengeToken: challengeTokenRef.current || challengeToken.value,
9762
+ executionId: payload.flowId,
9763
+ inputs: payload.inputs
9764
+ }
9765
+ });
9766
+ } finally {
9767
+ isLoading.value = false;
9768
+ }
9769
+ },
9770
+ processedFlag: oauthCodeProcessedFlag,
9771
+ setFlowId: persistExecutionId
9772
+ });
9773
+ watch(() => [
9774
+ sdkReady.value,
9775
+ sdkIsLoading.value,
9776
+ isStorageReady.value
9777
+ ], async ([ready, loading, storageReady]) => {
9778
+ if (!ready || loading || !storageReady || flowStartAttempted.value) return;
9593
9779
  const url = new URL(window.location.href);
9594
9780
  const code = url.searchParams.get("user_code");
9595
9781
  if (code) initialValues.value = { user_code: code };
9596
9782
  const applicationIdFromUrl = url.searchParams.get("applicationId");
9597
9783
  const appId = applicationIdFromUrl?.trim() ? applicationIdFromUrl : applicationId;
9598
- if (!appId) {
9599
- const flowError = new Error(t("deviceGrant.errors.start"));
9784
+ if (url.searchParams.has("code") || url.searchParams.has("state") || url.searchParams.has("error") || oauthCodeProcessedFlag.value) return;
9785
+ const storedExecutionId = sessionStorage.getItem(executionIdStorageKey);
9786
+ if (!appId && !storedExecutionId) {
9787
+ flowStartAttempted.value = true;
9788
+ const flowError = new ThunderIDRuntimeError$1(t("deviceGrant.errors.start"), "DEVICE_GRANT_ERROR", "vue");
9600
9789
  error.value = flowError;
9601
9790
  result.value = "failure";
9602
- props.onError?.(flowError);
9603
9791
  emit("error", flowError);
9604
9792
  return;
9605
9793
  }
9606
9794
  if (flowStartAttempted.value) return;
9607
9795
  flowStartAttempted.value = true;
9608
- startFlow(appId);
9609
- });
9796
+ await startFlow(appId ?? "", storedExecutionId ?? void 0);
9797
+ }, { immediate: true });
9610
9798
  return () => h(BaseDeviceGrant_default, {
9611
9799
  className: props.className,
9612
9800
  components: components.value,
@@ -9614,6 +9802,7 @@ const DeviceGrant = defineComponent({
9614
9802
  error: error.value,
9615
9803
  initialValues: initialValues.value,
9616
9804
  isLoading: isLoading.value,
9805
+ isTimeoutDisabled: isTimeoutDisabled.value,
9617
9806
  onSubmit: (payload, component) => submit(payload, component.id),
9618
9807
  result: result.value,
9619
9808
  serverFieldErrors: serverFieldErrors.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/vue",
3
- "version": "1.10.3",
3
+ "version": "1.12.0",
4
4
  "description": "Vue SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -57,7 +57,7 @@
57
57
  }
58
58
  },
59
59
  "dependencies": {
60
- "@thunderid/browser": "^1.9.3",
60
+ "@thunderid/browser": "^1.10.0",
61
61
  "dompurify": "3.4.17",
62
62
  "tslib": "2.8.1"
63
63
  },