@thunderid/vue 1.9.1 → 1.10.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.
@@ -2452,6 +2452,171 @@ const ADMIN_CSS = `
2452
2452
  `;
2453
2453
  var Admin_css_default = ADMIN_CSS;
2454
2454
 
2455
+ //#endregion
2456
+ //#region src/components/auth/device-grant/BaseDeviceGrant.css.ts
2457
+ const BASE_DEVICE_GRANT_CSS = `
2458
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal")} {
2459
+ box-sizing: border-box;
2460
+ width: 100%;
2461
+ max-width: calc(var(--thunderid-spacing-unit) * 60);
2462
+ margin: 0 auto;
2463
+ gap: var(--thunderid-spacing-unit);
2464
+ }
2465
+
2466
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-title")} {
2467
+ margin: 0;
2468
+ }
2469
+
2470
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-title--success")} {
2471
+ color: var(--thunderid-color-success-main);
2472
+ }
2473
+
2474
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-title--failure")} {
2475
+ color: var(--thunderid-color-error-main);
2476
+ }
2477
+
2478
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-description")} {
2479
+ margin: 0;
2480
+ }
2481
+ `;
2482
+ var BaseDeviceGrant_css_default = BASE_DEVICE_GRANT_CSS;
2483
+
2484
+ //#endregion
2485
+ //#region src/components/auth/flow/Consent.css.ts
2486
+ const CONSENT_CSS = `
2487
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent")} {
2488
+ display: flex;
2489
+ flex-direction: column;
2490
+ gap: calc(var(--thunderid-spacing-unit) * 2);
2491
+ margin-top: calc(var(--thunderid-spacing-unit) * 0.5);
2492
+ }
2493
+
2494
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__purpose")} {
2495
+ padding-bottom: calc(var(--thunderid-spacing-unit) * 2);
2496
+ }
2497
+
2498
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__section")} {
2499
+ margin-top: var(--thunderid-spacing-unit);
2500
+ }
2501
+
2502
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__header")} {
2503
+ display: flex;
2504
+ align-items: center;
2505
+ gap: calc(var(--thunderid-spacing-unit) * 0.5);
2506
+ margin-bottom: calc(var(--thunderid-spacing-unit) * 1.25);
2507
+ }
2508
+
2509
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__optional-header")} {
2510
+ display: flex;
2511
+ align-items: center;
2512
+ justify-content: space-between;
2513
+ gap: var(--thunderid-spacing-unit);
2514
+ padding-right: calc(var(--thunderid-spacing-unit) * 0.5);
2515
+ }
2516
+
2517
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__title")} {
2518
+ color: var(--thunderid-color-text-primary);
2519
+ font-weight: var(--thunderid-typography-fontWeight-bold);
2520
+ }
2521
+
2522
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__info")} {
2523
+ display: inline-flex;
2524
+ color: var(--thunderid-color-text-secondary);
2525
+ cursor: help;
2526
+ }
2527
+
2528
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__optional-header")} > .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__header")} {
2529
+ margin-bottom: calc(var(--thunderid-spacing-unit) * 1.25);
2530
+ }
2531
+
2532
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__items")} {
2533
+ display: flex;
2534
+ flex-direction: column;
2535
+ gap: calc(var(--thunderid-spacing-unit) * 1.25);
2536
+ }
2537
+
2538
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__item")} {
2539
+ display: flex;
2540
+ align-items: center;
2541
+ justify-content: space-between;
2542
+ gap: var(--thunderid-spacing-unit);
2543
+ min-height: 20px;
2544
+ }
2545
+
2546
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__item-label")} {
2547
+ display: flex;
2548
+ align-items: center;
2549
+ gap: calc(var(--thunderid-spacing-unit) * 0.75);
2550
+ }
2551
+
2552
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__bullet")} {
2553
+ width: 4px;
2554
+ height: 4px;
2555
+ flex: 0 0 4px;
2556
+ border-radius: 50%;
2557
+ background: var(--thunderid-color-text-secondary);
2558
+ }
2559
+
2560
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-container")} {
2561
+ position: relative;
2562
+ display: inline-flex;
2563
+ align-items: center;
2564
+ cursor: pointer;
2565
+ }
2566
+
2567
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input")} {
2568
+ position: absolute;
2569
+ width: 1px;
2570
+ height: 1px;
2571
+ margin: -1px;
2572
+ overflow: hidden;
2573
+ clip: rect(0 0 0 0);
2574
+ white-space: nowrap;
2575
+ }
2576
+
2577
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track")} {
2578
+ position: relative;
2579
+ display: inline-flex;
2580
+ align-items: center;
2581
+ width: 36px;
2582
+ height: 20px;
2583
+ border-radius: 9999px;
2584
+ background: var(--thunderid-color-text-secondary);
2585
+ opacity: 0.25;
2586
+ transition: background-color 0.2s ease, opacity 0.2s ease;
2587
+ }
2588
+
2589
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input")}:checked + .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track")} {
2590
+ background: var(--thunderid-color-primary-main);
2591
+ opacity: 1;
2592
+ }
2593
+
2594
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input")}:focus-visible + .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track")} {
2595
+ outline: 2px solid var(--thunderid-color-border-focus);
2596
+ outline-offset: 2px;
2597
+ }
2598
+
2599
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-thumb")} {
2600
+ position: absolute;
2601
+ left: 2px;
2602
+ width: 16px;
2603
+ height: 16px;
2604
+ border-radius: 50%;
2605
+ background: var(--thunderid-color-background-surface);
2606
+ transition: transform 0.2s ease;
2607
+ }
2608
+
2609
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input")}:checked + .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track")} .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-thumb")} {
2610
+ transform: translateX(16px);
2611
+ }
2612
+
2613
+ .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input")}:disabled + .${(0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track")} {
2614
+ cursor: not-allowed;
2615
+ opacity: 0.4;
2616
+ }
2617
+ `;
2618
+ var Consent_css_default = CONSENT_CSS;
2619
+
2455
2620
  //#endregion
2456
2621
  //#region src/components/auth/sign-in/BaseSignIn.css.ts
2457
2622
  /**
@@ -4168,6 +4333,8 @@ const STYLES = [
4168
4333
  Spinner_css_default,
4169
4334
  DataTable_css_default,
4170
4335
  BaseSignIn_css_default,
4336
+ Consent_css_default,
4337
+ BaseDeviceGrant_css_default,
4171
4338
  ChangeCredential_css_default,
4172
4339
  LanguageSwitcher_css_default,
4173
4340
  UserDropdown_css_default,
@@ -6172,6 +6339,10 @@ var OtpField_default = OtpField;
6172
6339
  const Typography = (0, vue.defineComponent)({
6173
6340
  name: "Typography",
6174
6341
  props: {
6342
+ color: {
6343
+ default: void 0,
6344
+ type: String
6345
+ },
6175
6346
  component: {
6176
6347
  default: void 0,
6177
6348
  type: String
@@ -6183,7 +6354,7 @@ const Typography = (0, vue.defineComponent)({
6183
6354
  },
6184
6355
  setup(props, { slots, attrs }) {
6185
6356
  return () => {
6186
- return (0, vue.h)(props.component || {
6357
+ const tag = props.component ?? {
6187
6358
  body1: "p",
6188
6359
  body2: "p",
6189
6360
  caption: "span",
@@ -6196,13 +6367,29 @@ const Typography = (0, vue.defineComponent)({
6196
6367
  overline: "span",
6197
6368
  subtitle1: "h6",
6198
6369
  subtitle2: "h6"
6199
- }[props.variant] || "p", {
6370
+ }[props.variant] ?? "p";
6371
+ const colorVar = {
6372
+ error: "var(--thunderid-color-error-main)",
6373
+ info: "var(--thunderid-color-info-main)",
6374
+ inherit: "inherit",
6375
+ primary: "var(--thunderid-color-primary-main)",
6376
+ secondary: "var(--thunderid-color-secondary-main)",
6377
+ success: "var(--thunderid-color-success-main)",
6378
+ textPrimary: "var(--thunderid-color-text-primary)",
6379
+ textSecondary: "var(--thunderid-color-text-secondary)",
6380
+ warning: "var(--thunderid-color-warning-main)"
6381
+ };
6382
+ const style = {
6383
+ ...attrs.style,
6384
+ ...props.color ? { color: colorVar[props.color] } : {}
6385
+ };
6386
+ return (0, vue.h)(tag, {
6200
6387
  class: [
6201
6388
  (0, __thunderid_browser.withVendorCSSClassPrefix)("typography"),
6202
6389
  (0, __thunderid_browser.withVendorCSSClassPrefix)(`typography--${props.variant}`),
6203
6390
  attrs.class || ""
6204
6391
  ].filter(Boolean).join(" "),
6205
- style: attrs.style
6392
+ style
6206
6393
  }, slots["default"]?.());
6207
6394
  };
6208
6395
  }
@@ -7052,6 +7239,111 @@ const normalizeFlowResponse = (response, t, options = {}, meta) => {
7052
7239
  };
7053
7240
  };
7054
7241
 
7242
+ //#endregion
7243
+ //#region src/components/auth/flow/Consent.ts
7244
+ const getConsentOptionalKey = (purposeId, attrName) => `__consent_opt__${purposeId}__${attrName}`;
7245
+ const isObject = (value) => typeof value === "object" && value !== null;
7246
+ const parsePurposes = (consentData) => {
7247
+ if (!consentData) return [];
7248
+ let parsed = consentData;
7249
+ if (typeof consentData === "string") try {
7250
+ parsed = JSON.parse(consentData);
7251
+ } catch {
7252
+ return [];
7253
+ }
7254
+ const rawPurposes = Array.isArray(parsed) ? parsed : parsed?.purposes;
7255
+ if (!Array.isArray(rawPurposes)) return [];
7256
+ return rawPurposes.filter((purpose) => isObject(purpose) && typeof purpose["purposeId"] === "string").map((purpose) => ({
7257
+ ...purpose,
7258
+ essential: Array.isArray(purpose["essential"]) ? purpose["essential"].filter((element) => isObject(element) && typeof element["name"] === "string") : [],
7259
+ optional: Array.isArray(purpose["optional"]) ? purpose["optional"].filter((element) => isObject(element) && typeof element["name"] === "string") : []
7260
+ })).sort((a, b) => Number(b.type === "permissions") - Number(a.type === "permissions"));
7261
+ };
7262
+ const Consent = (0, vue.defineComponent)({
7263
+ name: "Consent",
7264
+ props: {
7265
+ consentData: {
7266
+ default: void 0,
7267
+ type: [
7268
+ String,
7269
+ Array,
7270
+ Object
7271
+ ]
7272
+ },
7273
+ formValues: {
7274
+ required: true,
7275
+ type: Object
7276
+ },
7277
+ onInputChange: {
7278
+ required: true,
7279
+ type: Function
7280
+ },
7281
+ t: {
7282
+ default: void 0,
7283
+ type: Function
7284
+ }
7285
+ },
7286
+ setup(props, { slots }) {
7287
+ const translate = (key, fallback = "") => {
7288
+ const value = props.t?.(key);
7289
+ return value && value !== key ? value : fallback;
7290
+ };
7291
+ const toggle = (id, checked, label, onChange) => (0, vue.h)("label", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-container") }, [(0, vue.h)("input", {
7292
+ "aria-label": label,
7293
+ checked,
7294
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-input"),
7295
+ id,
7296
+ onChange: (event) => onChange(event.target.checked),
7297
+ role: "switch",
7298
+ type: "checkbox"
7299
+ }), (0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-track") }, [(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__toggle-thumb") })])]);
7300
+ const sectionTitle = (label, info) => [(0, vue.h)(Typography_default, {
7301
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__title"),
7302
+ component: "span",
7303
+ variant: "subtitle2"
7304
+ }, () => label), info ? (0, vue.h)("span", {
7305
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__info"),
7306
+ title: info,
7307
+ "aria-label": info,
7308
+ role: "img"
7309
+ }, [(0, vue.h)(InfoIcon)]) : null].filter((node) => node !== null);
7310
+ return () => {
7311
+ const purposes = parsePurposes(props.consentData);
7312
+ if (purposes.length === 0) return null;
7313
+ if (slots["default"]) return (0, vue.h)("div", slots["default"]({
7314
+ formValues: props.formValues,
7315
+ onInputChange: props.onInputChange,
7316
+ purposes
7317
+ }));
7318
+ return (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent") }, purposes.map((purpose) => {
7319
+ const permission = purpose.type === "permissions";
7320
+ const optionalName = permission ? translate("consent.optional_scope", "Optional Permissions") : translate("consent.optional_claims", "Optional Attributes");
7321
+ const essentialName = permission ? translate("consent.essential_scope", "Essential Permissions") : translate("consent.essential_claims", "Essential Attributes");
7322
+ const allSelected = purpose.optional.length > 0 && purpose.optional.every((element) => props.formValues[getConsentOptionalKey(purpose.purposeId, element.name)] === "true");
7323
+ const itemList = (elements, essential) => (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__items") }, elements.map((element) => {
7324
+ const key = getConsentOptionalKey(purpose.purposeId, element.name);
7325
+ const label = translate(`consent.${element.name}`, element.name);
7326
+ return (0, vue.h)("div", {
7327
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__item"),
7328
+ key: element.name
7329
+ }, [(0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__item-label") }, [(0, vue.h)("span", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__bullet") }), (0, vue.h)(Typography_default, {
7330
+ component: "span",
7331
+ variant: "body2"
7332
+ }, () => label)]), essential ? (0, vue.h)(Typography_default, {
7333
+ component: "span",
7334
+ variant: "body2"
7335
+ }, () => translate("consent.required", "Required")) : toggle(`consent_opt_${purpose.purposeId}_${element.name}`, props.formValues[key] === "true", label, (value) => props.onInputChange(key, value ? "true" : "false"))]);
7336
+ }));
7337
+ return (0, vue.h)("section", {
7338
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__purpose"),
7339
+ key: purpose.purposeId
7340
+ }, [purpose.essential.length > 0 ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__section") }, [(0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__header") }, sectionTitle(essentialName, translate(permission ? "consent.essential_scope.info" : "consent.essential_claims.info", permission ? "" : "These attributes are required for the service to function properly."))), itemList(purpose.essential, true)]) : null, purpose.optional.length > 0 ? (0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__section") }, [(0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__optional-header") }, [(0, vue.h)("div", { class: (0, __thunderid_browser.withVendorCSSClassPrefix)("consent__header") }, sectionTitle(optionalName, translate(permission ? "consent.optional_scope.info" : "consent.optional_claims.info", permission ? "" : "These attributes are optional and can be provided at your discretion."))), toggle(`consent_opt_${purpose.purposeId}_all`, allSelected, optionalName, (checked) => purpose.optional.forEach((element) => props.onInputChange(getConsentOptionalKey(purpose.purposeId, element.name), checked ? "true" : "false")))]), itemList(purpose.optional, false)]) : null]);
7341
+ }));
7342
+ };
7343
+ }
7344
+ });
7345
+ var Consent_default = Consent;
7346
+
7055
7347
  //#endregion
7056
7348
  //#region src/components/auth/flow/FieldFactory.ts
7057
7349
  /**
@@ -7788,10 +8080,6 @@ var MicrosoftButton_default = MicrosoftButton;
7788
8080
  //#region src/components/auth/flow/AuthOptionFactoryCore.ts
7789
8081
  const logger$2 = createVueLogger("AuthOptionFactory");
7790
8082
  /**
7791
- * Inline helper for consent optional attribute key (mirrors ConsentCheckboxList.getConsentOptionalKey).
7792
- */
7793
- const getConsentOptionalKey = (purposeId, attr) => `consent_${purposeId}_${attr}`;
7794
- /**
7795
8083
  * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.
7796
8084
  *
7797
8085
  * DOMPurify strips unknown URI schemes from attributes (e.g. `src="emoji:🦊"` → `src=""`).
@@ -7841,6 +8129,17 @@ const getTypographyVariant = (variant) => {
7841
8129
  SUBTITLE_2: "subtitle2"
7842
8130
  }[variant] || "h3";
7843
8131
  };
8132
+ const getTypographyColor = (color) => {
8133
+ switch (color?.toUpperCase()) {
8134
+ case "ERROR": return "error";
8135
+ case "INFO": return "info";
8136
+ case "PRIMARY": return "primary";
8137
+ case "SECONDARY": return "secondary";
8138
+ case "SUCCESS": return "success";
8139
+ case "WARNING": return "warning";
8140
+ default: return;
8141
+ }
8142
+ };
7844
8143
  /**
7845
8144
  * Check if a button text or action matches a social provider.
7846
8145
  */
@@ -8028,11 +8327,15 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8028
8327
  }
8029
8328
  case __thunderid_browser.EmbeddedFlowComponentType.Text: {
8030
8329
  const variant = getTypographyVariant(component.variant ?? "");
8330
+ const align = typeof component.align === "string" ? component.align : "left";
8331
+ const color = getTypographyColor(component.color);
8031
8332
  return (0, vue.h)(Typography_default, {
8333
+ id: component.id,
8032
8334
  key,
8335
+ color,
8033
8336
  style: {
8034
8337
  marginBottom: "0.5rem",
8035
- textAlign: typeof component.align === "string" ? component.align : "left"
8338
+ textAlign: align
8036
8339
  },
8037
8340
  variant
8038
8341
  }, { default: () => resolve(component.label) });
@@ -8155,9 +8458,13 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
8155
8458
  style: stackStyle
8156
8459
  }, stackChildren.filter(Boolean));
8157
8460
  }
8158
- case __thunderid_browser.EmbeddedFlowComponentType.Consent:
8159
- logger$2.warn(`Consent component type is not yet fully supported in the Vue SDK.`);
8160
- return null;
8461
+ case __thunderid_browser.EmbeddedFlowComponentType.Consent: return (0, vue.h)(Consent_default, {
8462
+ consentData: options.additionalData?.["consentPrompt"],
8463
+ formValues,
8464
+ key,
8465
+ onInputChange,
8466
+ t: options.t
8467
+ });
8161
8468
  case __thunderid_browser.EmbeddedFlowComponentType.Timer: {
8162
8469
  const textTemplate = resolve(component.label) || "Time remaining: {time}";
8163
8470
  const timeoutMs = Number(options.additionalData?.["stepTimeout"]) || 0;
@@ -8288,6 +8595,10 @@ const BaseSignIn = (0, vue.defineComponent)({
8288
8595
  default: "",
8289
8596
  type: String
8290
8597
  },
8598
+ initialValues: {
8599
+ default: () => ({}),
8600
+ type: Object
8601
+ },
8291
8602
  isLoading: {
8292
8603
  default: false,
8293
8604
  type: Boolean
@@ -8304,6 +8615,10 @@ const BaseSignIn = (0, vue.defineComponent)({
8304
8615
  default: void 0,
8305
8616
  type: Function
8306
8617
  },
8618
+ serverFieldErrors: {
8619
+ default: null,
8620
+ type: Array
8621
+ },
8307
8622
  size: {
8308
8623
  default: "medium",
8309
8624
  type: String
@@ -8325,9 +8640,9 @@ const BaseSignIn = (0, vue.defineComponent)({
8325
8640
  const touchedFields = (0, vue.ref)({});
8326
8641
  (0, vue.watch)(() => props.components, (newComponents) => {
8327
8642
  const fields = extractFormFields$1(newComponents || []);
8328
- const freshValues = {};
8643
+ const freshValues = { ...props.initialValues };
8329
8644
  fields.forEach((f) => {
8330
- freshValues[f.name] = "";
8645
+ freshValues[f.name] = props.initialValues[f.name] ?? "";
8331
8646
  });
8332
8647
  formValues.value = freshValues;
8333
8648
  touchedFields.value = {};
@@ -8335,14 +8650,23 @@ const BaseSignIn = (0, vue.defineComponent)({
8335
8650
  deep: false,
8336
8651
  immediate: true
8337
8652
  });
8653
+ (0, vue.watch)(() => props.initialValues, (initialValues) => {
8654
+ formValues.value = {
8655
+ ...formValues.value,
8656
+ ...initialValues
8657
+ };
8658
+ }, { deep: true });
8338
8659
  const formErrors = (0, vue.computed)(() => {
8339
8660
  const fields = extractFormFields$1(props.components || []);
8340
8661
  const errors = {};
8662
+ (props.serverFieldErrors ?? []).forEach((fieldError) => {
8663
+ if (!(fieldError.identifier in errors)) errors[fieldError.identifier] = fieldError.message;
8664
+ });
8341
8665
  fields.forEach((field) => {
8342
8666
  const value = formValues.value[field.name] || "";
8343
8667
  const isTouched = touchedFields.value[field.name] || false;
8344
- if (field.required && isTouched && (!value || value.trim() === "")) errors[field.name] = t("validations.required.field.error") || "This field is required";
8345
- if (field.type === "EMAIL_INPUT" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[field.name] = t("field.email.invalid") || "Invalid email address";
8668
+ if (!(field.name in errors) && field.required && isTouched && (!value || value.trim() === "")) errors[field.name] = t("validations.required.field.error") || "This field is required";
8669
+ if (!(field.name in errors) && field.type === "EMAIL_INPUT" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) errors[field.name] = t("field.email.invalid") || "Invalid email address";
8346
8670
  });
8347
8671
  return errors;
8348
8672
  });
@@ -8805,7 +9129,7 @@ const SignIn = (0, vue.defineComponent)({
8805
9129
  approved: !isDeny,
8806
9130
  name: e.name
8807
9131
  })), ...(p.optional ?? []).map((e) => {
8808
- const key = `__consent_opt__${p.purposeId}__${e.name}`;
9132
+ const key = getConsentOptionalKey(p.purposeId, e.name);
8809
9133
  return (0, __thunderid_browser.getConsentElementDecision)(p.purposeId, e, !isDeny && processedInputs[key] === "true", processedInputs);
8810
9134
  })],
8811
9135
  purposeName: p.purposeName
@@ -9045,6 +9369,281 @@ const SignIn = (0, vue.defineComponent)({
9045
9369
  });
9046
9370
  var SignIn_default = SignIn;
9047
9371
 
9372
+ //#endregion
9373
+ //#region src/components/auth/device-grant/BaseDeviceGrant.ts
9374
+ /** Renders Device Grant flow steps and terminal status without owning flow execution. */
9375
+ const BaseDeviceGrant = (0, vue.defineComponent)({
9376
+ name: "BaseDeviceGrant",
9377
+ props: {
9378
+ components: {
9379
+ default: () => [],
9380
+ type: Array
9381
+ },
9382
+ additionalData: {
9383
+ default: () => ({}),
9384
+ type: Object
9385
+ },
9386
+ initialValues: {
9387
+ default: () => ({}),
9388
+ type: Object
9389
+ },
9390
+ onSubmit: {
9391
+ required: true,
9392
+ type: Function
9393
+ },
9394
+ result: {
9395
+ default: null,
9396
+ type: String
9397
+ },
9398
+ className: {
9399
+ default: "",
9400
+ type: String
9401
+ },
9402
+ variant: {
9403
+ default: "flat",
9404
+ type: String
9405
+ },
9406
+ size: {
9407
+ default: "medium",
9408
+ type: String
9409
+ },
9410
+ isLoading: {
9411
+ default: false,
9412
+ type: Boolean
9413
+ },
9414
+ error: {
9415
+ default: null,
9416
+ type: Object
9417
+ },
9418
+ serverFieldErrors: {
9419
+ default: null,
9420
+ type: Array
9421
+ },
9422
+ completeMessage: {
9423
+ default: void 0,
9424
+ type: String
9425
+ },
9426
+ completeDescription: {
9427
+ default: void 0,
9428
+ type: String
9429
+ },
9430
+ failedMessage: {
9431
+ default: void 0,
9432
+ type: String
9433
+ },
9434
+ failedDescription: {
9435
+ default: void 0,
9436
+ type: String
9437
+ }
9438
+ },
9439
+ setup(props, { slots, attrs }) {
9440
+ const { t } = useI18n_default();
9441
+ return () => {
9442
+ if (props.result && props.components.length === 0) {
9443
+ const success = props.result === "success" && !props.error;
9444
+ const failedMessage = props.failedMessage ?? t("deviceGrant.messages.failed");
9445
+ const title = success ? props.completeMessage ?? t("deviceGrant.messages.complete") : failedMessage;
9446
+ const description = success ? props.completeDescription ?? t("deviceGrant.messages.completeDescription") : !props.error || props.error.message === failedMessage ? props.failedDescription ?? t("deviceGrant.messages.failedDescription") : props.error.message;
9447
+ return (0, vue.h)(Card_default, {
9448
+ ...attrs,
9449
+ class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal"), props.className].filter(Boolean).join(" "),
9450
+ "data-testid": "device-grant-result",
9451
+ variant: props.variant
9452
+ }, () => [(0, vue.h)(Typography_default, {
9453
+ class: [(0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-title"), (0, __thunderid_browser.withVendorCSSClassPrefix)(`devicegrant__terminal-title--${success ? "success" : "failure"}`)].join(" "),
9454
+ component: "h2",
9455
+ variant: "h6"
9456
+ }, () => title), (0, vue.h)(Typography_default, {
9457
+ class: (0, __thunderid_browser.withVendorCSSClassPrefix)("devicegrant__terminal-description"),
9458
+ component: "p",
9459
+ variant: "caption"
9460
+ }, () => description)]);
9461
+ }
9462
+ return (0, vue.h)(BaseSignIn_default, {
9463
+ ...attrs,
9464
+ className: props.className,
9465
+ components: props.components,
9466
+ additionalData: props.additionalData,
9467
+ error: props.error,
9468
+ initialValues: props.initialValues,
9469
+ isLoading: props.isLoading,
9470
+ onSubmit: props.onSubmit,
9471
+ serverFieldErrors: props.serverFieldErrors,
9472
+ size: props.size,
9473
+ variant: props.variant
9474
+ }, slots["default"] ? { default: (renderProps) => slots["default"]?.({
9475
+ ...renderProps,
9476
+ result: props.result
9477
+ }) } : void 0);
9478
+ };
9479
+ }
9480
+ });
9481
+ var BaseDeviceGrant_default = BaseDeviceGrant;
9482
+
9483
+ //#endregion
9484
+ //#region src/components/auth/device-grant/DeviceGrant.ts
9485
+ const hasUserCodeInput = (components) => components.some((component) => component.ref === "user_code" || Array.isArray(component.components) && hasUserCodeInput(component.components));
9486
+ /** Runs the application's configured Device Grant flow and exposes its state for custom renderers. */
9487
+ const DeviceGrant = (0, vue.defineComponent)({
9488
+ name: "DeviceGrant",
9489
+ props: {
9490
+ className: {
9491
+ default: "",
9492
+ type: String
9493
+ },
9494
+ size: {
9495
+ default: "medium",
9496
+ type: String
9497
+ },
9498
+ variant: {
9499
+ default: "flat",
9500
+ type: String
9501
+ },
9502
+ onComplete: {
9503
+ default: void 0,
9504
+ type: Function
9505
+ },
9506
+ onError: {
9507
+ default: void 0,
9508
+ type: Function
9509
+ }
9510
+ },
9511
+ emits: ["complete", "error"],
9512
+ setup(props, { emit, slots }) {
9513
+ const { applicationId, baseUrl } = useThunderID_default();
9514
+ const { meta } = useFlowMeta_default();
9515
+ const { t } = useI18n_default();
9516
+ const components = (0, vue.ref)([]);
9517
+ const initialValues = (0, vue.ref)({});
9518
+ const additionalData = (0, vue.ref)({});
9519
+ const serverFieldErrors = (0, vue.ref)(null);
9520
+ const executionId = (0, vue.ref)("");
9521
+ const challengeToken = (0, vue.ref)("");
9522
+ const error = (0, vue.ref)(null);
9523
+ const isLoading = (0, vue.ref)(false);
9524
+ const result = (0, vue.ref)(null);
9525
+ const flowStartAttempted = (0, vue.ref)(false);
9526
+ const applyResponse = (response) => {
9527
+ const normalized = normalizeFlowResponse(response, t, { resolveTranslations: false }, meta.value);
9528
+ executionId.value = response.executionId ?? "";
9529
+ challengeToken.value = response.challengeToken ?? "";
9530
+ components.value = normalized.components ?? [];
9531
+ additionalData.value = normalized.additionalData ?? {};
9532
+ serverFieldErrors.value = response.data?.fieldErrors ?? null;
9533
+ error.value = response.error ? new Error(extractErrorMessage(response, t)) : null;
9534
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Complete) {
9535
+ result.value = "success";
9536
+ props.onComplete?.(response);
9537
+ emit("complete", response);
9538
+ return;
9539
+ }
9540
+ if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Error) {
9541
+ error.value = new Error(extractErrorMessage(response, t, "deviceGrant.messages.failed"));
9542
+ result.value = "failure";
9543
+ props.onError?.(error.value);
9544
+ emit("error", error.value);
9545
+ return;
9546
+ }
9547
+ result.value = null;
9548
+ };
9549
+ const clearVerificationParameters = () => {
9550
+ const url = new URL(window.location.href);
9551
+ url.searchParams.delete("user_code");
9552
+ url.searchParams.delete("applicationId");
9553
+ window.history.replaceState(window.history.state, "", url.toString());
9554
+ };
9555
+ const startFlow = async (appId) => {
9556
+ isLoading.value = true;
9557
+ error.value = null;
9558
+ try {
9559
+ const response = await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9560
+ baseUrl,
9561
+ payload: {
9562
+ applicationId: appId,
9563
+ flowType: __thunderid_browser.EmbeddedFlowType.DeviceGrant,
9564
+ inputs: {}
9565
+ }
9566
+ });
9567
+ clearVerificationParameters();
9568
+ applyResponse(response);
9569
+ } catch (cause) {
9570
+ const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9571
+ components.value = [];
9572
+ additionalData.value = {};
9573
+ serverFieldErrors.value = null;
9574
+ error.value = flowError;
9575
+ result.value = "failure";
9576
+ props.onError?.(flowError);
9577
+ emit("error", flowError);
9578
+ } finally {
9579
+ isLoading.value = false;
9580
+ }
9581
+ };
9582
+ const submit = async (payload, actionId) => {
9583
+ isLoading.value = true;
9584
+ error.value = null;
9585
+ result.value = null;
9586
+ try {
9587
+ if (!executionId.value) return;
9588
+ const inputs = Object.fromEntries(Object.entries(payload.inputs ?? {}).filter(([key]) => !key.startsWith("__consent_opt__")));
9589
+ if (!hasUserCodeInput(components.value)) delete inputs["user_code"];
9590
+ applyResponse(await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
9591
+ baseUrl,
9592
+ payload: {
9593
+ action: payload.action ?? actionId,
9594
+ challengeToken: challengeToken.value,
9595
+ executionId: executionId.value,
9596
+ inputs
9597
+ }
9598
+ }));
9599
+ } catch (cause) {
9600
+ const flowError = cause instanceof Error ? cause : new Error(t("deviceGrant.errors.continue"));
9601
+ components.value = [];
9602
+ additionalData.value = {};
9603
+ serverFieldErrors.value = null;
9604
+ error.value = flowError;
9605
+ result.value = "failure";
9606
+ props.onError?.(flowError);
9607
+ emit("error", flowError);
9608
+ } finally {
9609
+ isLoading.value = false;
9610
+ }
9611
+ };
9612
+ (0, vue.onMounted)(() => {
9613
+ const url = new URL(window.location.href);
9614
+ const code = url.searchParams.get("user_code");
9615
+ if (code) initialValues.value = { user_code: code };
9616
+ const applicationIdFromUrl = url.searchParams.get("applicationId");
9617
+ const appId = applicationIdFromUrl?.trim() ? applicationIdFromUrl : applicationId;
9618
+ if (!appId) {
9619
+ const flowError = new Error(t("deviceGrant.errors.start"));
9620
+ error.value = flowError;
9621
+ result.value = "failure";
9622
+ props.onError?.(flowError);
9623
+ emit("error", flowError);
9624
+ return;
9625
+ }
9626
+ if (flowStartAttempted.value) return;
9627
+ flowStartAttempted.value = true;
9628
+ startFlow(appId);
9629
+ });
9630
+ return () => (0, vue.h)(BaseDeviceGrant_default, {
9631
+ className: props.className,
9632
+ components: components.value,
9633
+ additionalData: additionalData.value,
9634
+ error: error.value,
9635
+ initialValues: initialValues.value,
9636
+ isLoading: isLoading.value,
9637
+ onSubmit: (payload, component) => submit(payload, component.id),
9638
+ result: result.value,
9639
+ serverFieldErrors: serverFieldErrors.value,
9640
+ size: props.size,
9641
+ variant: props.variant
9642
+ }, slots["default"] ? { default: slots["default"] } : void 0);
9643
+ }
9644
+ });
9645
+ var DeviceGrant_default = DeviceGrant;
9646
+
9048
9647
  //#endregion
9049
9648
  //#region src/utils/getAuthComponentHeadings.ts
9050
9649
  /**
@@ -16851,6 +17450,7 @@ exports.BaseApplicationDetails = BaseApplicationDetails_default;
16851
17450
  exports.BaseApplicationList = BaseApplicationList_default;
16852
17451
  exports.BaseAuthFlowSelect = BaseAuthFlowSelect_default;
16853
17452
  exports.BaseChangeCredential = BaseChangeCredential_default;
17453
+ exports.BaseDeviceGrant = BaseDeviceGrant_default;
16854
17454
  exports.BaseGroupCreate = BaseGroupCreate_default;
16855
17455
  exports.BaseGroupList = BaseGroupList_default;
16856
17456
  exports.BaseGroupMembers = BaseGroupMembers_default;
@@ -16882,10 +17482,12 @@ exports.Checkbox = Checkbox_default;
16882
17482
  exports.ChevronDownIcon = ChevronDownIcon;
16883
17483
  exports.CircleAlertIcon = CircleAlertIcon;
16884
17484
  exports.CircleCheckIcon = CircleCheckIcon;
17485
+ exports.Consent = Consent_default;
16885
17486
  exports.CopyableText = CopyableText_default;
16886
17487
  exports.DEFAULT_USER_CREATE_FIELDS = DEFAULT_USER_CREATE_FIELDS;
16887
17488
  exports.DataTable = DataTable_default;
16888
17489
  exports.DatePicker = DatePicker_default;
17490
+ exports.DeviceGrant = DeviceGrant_default;
16889
17491
  exports.Divider = Divider_default;
16890
17492
  Object.defineProperty(exports, 'EmbeddedFlowActionVariant', {
16891
17493
  enumerable: true,