@alviere/ui 0.13.2 → 0.14.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.
package/dist/index.js CHANGED
@@ -7975,7 +7975,7 @@ var root_1$h = /* @__PURE__ */ from_html(`<label class="alviere-text-input__labe
7975
7975
  var root_2$c = /* @__PURE__ */ from_html(`<textarea class="alviere-text-input__textarea svelte-1auzwdn" spellcheck="true"></textarea>`);
7976
7976
  var root_3$c = /* @__PURE__ */ from_html(`<input class="alviere-text-input__input svelte-1auzwdn" spellcheck="true"/>`);
7977
7977
  var root_5$7 = /* @__PURE__ */ from_html(`<button type="button" class="alviere-text-input__action-button svelte-1auzwdn"><span class="alviere-text-input__action-icon svelte-1auzwdn">?</span></button>`);
7978
- var root_7$4 = /* @__PURE__ */ from_svg(`<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="m2.707 1.293 7.17 7.17.002.002 1.504 1.504 7.21 7.21-.001-.001 4.115 4.115-1.414 1.414-4.297-4.296C15.485 19.434 13.82 20 12 20c-2.959 0-5.461-1.46-7.51-3.85a16.59 16.59 0 0 1-1.796-2.56 12.546 12.546 0 0 1-.613-1.197L1.91 12l.17-.395c.11-.252.315-.668.618-1.195.5-.872 1.1-1.743 1.803-2.56.3-.349.614-.68.94-.993l-4.15-4.149zM6.856 8.27l-.256.252c-.199.2-.393.411-.581.63a14.7 14.7 0 0 0-1.843 2.718l-.069.13.145.275.179.322c.439.768.966 1.538 1.578 2.252C7.711 16.835 9.71 18 12 18c1.222 0 2.358-.334 3.426-.962l.123-.076-1.517-1.516A4 4 0 0 1 8.553 9.97zM12 4c2.959 0 5.461 1.46 7.51 3.849a16.59 16.59 0 0 1 1.796 2.56l.208.375c.126.234.228.437.306.603l.1.219.169.395-.17.395a12.7 12.7 0 0 1-.548 1.073c-.37.655-.8 1.318-1.292 1.963l-.302.385-1.553-1.26a14.947 14.947 0 0 0 1.404-2.07l.16-.289.104-.201-.144-.273-.178-.322a14.613 14.613 0 0 0-1.58-2.252C16.289 7.165 14.291 6 12.001 6c-.478 0-.942.05-1.395.151l-.337.085-.537-1.927A8.409 8.409 0 0 1 12 4zm-1.933 7.482-.036.166a2 2 0 0 0 2.321 2.321l.164-.038z" fill="currentcolor" fill-rule="evenodd"></path></svg>`);
7978
+ var root_7$3 = /* @__PURE__ */ from_svg(`<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="m2.707 1.293 7.17 7.17.002.002 1.504 1.504 7.21 7.21-.001-.001 4.115 4.115-1.414 1.414-4.297-4.296C15.485 19.434 13.82 20 12 20c-2.959 0-5.461-1.46-7.51-3.85a16.59 16.59 0 0 1-1.796-2.56 12.546 12.546 0 0 1-.613-1.197L1.91 12l.17-.395c.11-.252.315-.668.618-1.195.5-.872 1.1-1.743 1.803-2.56.3-.349.614-.68.94-.993l-4.15-4.149zM6.856 8.27l-.256.252c-.199.2-.393.411-.581.63a14.7 14.7 0 0 0-1.843 2.718l-.069.13.145.275.179.322c.439.768.966 1.538 1.578 2.252C7.711 16.835 9.71 18 12 18c1.222 0 2.358-.334 3.426-.962l.123-.076-1.517-1.516A4 4 0 0 1 8.553 9.97zM12 4c2.959 0 5.461 1.46 7.51 3.849a16.59 16.59 0 0 1 1.796 2.56l.208.375c.126.234.228.437.306.603l.1.219.169.395-.17.395a12.7 12.7 0 0 1-.548 1.073c-.37.655-.8 1.318-1.292 1.963l-.302.385-1.553-1.26a14.947 14.947 0 0 0 1.404-2.07l.16-.289.104-.201-.144-.273-.178-.322a14.613 14.613 0 0 0-1.58-2.252C16.289 7.165 14.291 6 12.001 6c-.478 0-.942.05-1.395.151l-.337.085-.537-1.927A8.409 8.409 0 0 1 12 4zm-1.933 7.482-.036.166a2 2 0 0 0 2.321 2.321l.164-.038z" fill="currentcolor" fill-rule="evenodd"></path></svg>`);
7979
7979
  var root_8$3 = /* @__PURE__ */ from_svg(`<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="M12 4c4.278 0 7.61 2.667 10 8-2.39 5.333-5.722 8-10 8s-7.61-2.667-10-8c2.39-5.333 5.722-8 10-8zm0 2c-4.41 0-6.707 4.479-7.699 5.999C5.295 13.518 7.604 18 12 18c4.41 0 6.707-4.479 7.699-5.999C18.705 10.482 16.396 6 12 6zm0 2c2.176 0 3.945 1.794 3.945 4s-1.77 4-3.945 4c-2.176 0-3.945-1.794-3.945-4S9.825 8 12 8zm0 2c-1.088 0-1.973.897-1.973 2s.885 2 1.973 2 1.973-.897 1.973-2-.885-2-1.973-2z" fill="currentcolor" fill-rule="evenodd"></path></svg>`);
7980
7980
  var root_6$5 = /* @__PURE__ */ from_html(`<button type="button" class="alviere-text-input__reveal-button svelte-1auzwdn"><!></button>`);
7981
7981
  var root_4$b = /* @__PURE__ */ from_html(`<div class="alviere-text-input__actions svelte-1auzwdn"><!> <!></div>`);
@@ -8623,7 +8623,7 @@ function TextInput($$anchor, $$props) {
8623
8623
  var node_5 = child(button_1);
8624
8624
  {
8625
8625
  var consequent_3 = ($$anchor4) => {
8626
- var svg = root_7$4();
8626
+ var svg = root_7$3();
8627
8627
  append($$anchor4, svg);
8628
8628
  };
8629
8629
  var alternate_1 = ($$anchor4) => {
@@ -11813,7 +11813,7 @@ var root_1$b = /* @__PURE__ */ from_html(`<label class="alviere-search-select__l
11813
11813
  var root_2$6 = /* @__PURE__ */ from_html(`<div class="alviere-search-select__display-value svelte-roni7d"> </div>`);
11814
11814
  var root_3$7 = /* @__PURE__ */ from_html(`<button type="button" class="alviere-search-select__clear-button svelte-roni7d" aria-label="Clear selection"><!></button>`);
11815
11815
  var root_5$5 = /* @__PURE__ */ from_html(`<div class="alviere-search-select__loading-message svelte-roni7d"> </div>`);
11816
- var root_7$3 = /* @__PURE__ */ from_html(`<div class="alviere-search-select__no-options-message svelte-roni7d"> </div>`);
11816
+ var root_7$2 = /* @__PURE__ */ from_html(`<div class="alviere-search-select__no-options-message svelte-roni7d"> </div>`);
11817
11817
  var root_9$3 = /* @__PURE__ */ from_html(`<div role="option" tabindex="0"> </div>`);
11818
11818
  var root_4$6 = /* @__PURE__ */ from_html(`<div id="search-select-dropdown" class="alviere-search-select__dropdown svelte-roni7d" role="listbox"><div class="alviere-search-select__options-list svelte-roni7d"><!></div></div>`);
11819
11819
  var root_10$1 = /* @__PURE__ */ from_html(`<div class="alviere-search-select__required svelte-roni7d">Required</div>`);
@@ -12394,7 +12394,7 @@ function SearchSelect($$anchor, $$props) {
12394
12394
  var node_7 = first_child(fragment);
12395
12395
  {
12396
12396
  var consequent_4 = ($$anchor4) => {
12397
- var div_9 = root_7$3();
12397
+ var div_9 = root_7$2();
12398
12398
  var text_3 = child(div_9, true);
12399
12399
  reset(div_9);
12400
12400
  template_effect(() => set_text(text_3, noOptionsMessage()));
@@ -16005,7 +16005,7 @@ const accountNumberHelpSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="640
16005
16005
  var root_1$8 = /* @__PURE__ */ from_html(`<div class="spinner-container svelte-t9z8bl"><alviere-spinner></alviere-spinner></div>`, 2);
16006
16006
  var root_4$5 = /* @__PURE__ */ from_html(`<alviere-badge> </alviere-badge>`, 2);
16007
16007
  var root_6$3 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value svelte-t9z8bl"> </span></div>`);
16008
- var root_7$2 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value description svelte-t9z8bl"> </span></div>`);
16008
+ var root_7$1 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value description svelte-t9z8bl"> </span></div>`);
16009
16009
  var root_5$4 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value svelte-t9z8bl"> </span></div> <!> <!>`, 1);
16010
16010
  var root_8$2 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value svelte-t9z8bl"> </span></div>`);
16011
16011
  var root_3$6 = /* @__PURE__ */ from_html(`<alviere-list-item><div slot="leading"><alviere-badge> </alviere-badge></div> <div slot="primary-text"><span> </span></div> <div slot="badges"><!></div> <div slot="actions"><alviere-button></alviere-button> <alviere-button></alviere-button></div> <div slot="expanded-content"><div class="bank-accounts-section__card-content svelte-t9z8bl"><div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value svelte-t9z8bl"> </span></div> <div class="bank-accounts-section__card-content__info-row svelte-t9z8bl"><span class="label svelte-t9z8bl"> </span> <span class="value svelte-t9z8bl"> </span></div> <!> <!></div></div></alviere-list-item>`, 2);
@@ -16786,7 +16786,7 @@ function AddBankAccount($$anchor, $$props) {
16786
16786
  var node_5 = sibling(node_4, 2);
16787
16787
  {
16788
16788
  var consequent_3 = ($$anchor5) => {
16789
- var div_14 = root_7$2();
16789
+ var div_14 = root_7$1();
16790
16790
  var span_9 = child(div_14);
16791
16791
  var text_13 = child(span_9);
16792
16792
  reset(span_9);
@@ -17530,14 +17530,74 @@ customElements.define("alviere-add-bank-account", create_custom_element(
17530
17530
  [],
17531
17531
  true
17532
17532
  ));
17533
+ function createLegalTextsResolver({ getDocumentTypes, getCore }) {
17534
+ let resolvedDocuments = /* @__PURE__ */ state(proxy([]));
17535
+ let isLoading = /* @__PURE__ */ state(false);
17536
+ let hasResolved = /* @__PURE__ */ state(false);
17537
+ let error = /* @__PURE__ */ state(null);
17538
+ let lastSignature = null;
17539
+ const getKey = (doc) => `${doc.type}:${doc.version || "latest"}`;
17540
+ user_effect(() => {
17541
+ const core = getCore();
17542
+ const documentTypes = getDocumentTypes();
17543
+ const signature = documentTypes.map(getKey).join("|");
17544
+ if (!core) return;
17545
+ if (signature === lastSignature) return;
17546
+ lastSignature = signature;
17547
+ if (!signature) {
17548
+ set(resolvedDocuments, [], true);
17549
+ set(hasResolved, true);
17550
+ return;
17551
+ }
17552
+ void fetchLegalTexts(core, documentTypes);
17553
+ });
17554
+ async function fetchLegalTexts(core, documentTypes) {
17555
+ set(isLoading, true);
17556
+ set(error, null);
17557
+ const service = core.createLegalTextsService();
17558
+ try {
17559
+ const results = await Promise.all(documentTypes.map(async (doc) => {
17560
+ var _a2, _b;
17561
+ const response = await service.getLegalTexts(doc.type, doc.version);
17562
+ const legalText = ((_a2 = response.legal_texts) == null ? void 0 : _a2.find((t) => t.latest)) || ((_b = response.legal_texts) == null ? void 0 : _b[0]) || null;
17563
+ return { doc, legalText };
17564
+ }));
17565
+ set(resolvedDocuments, results.filter((r2) => r2.legalText !== null).map((r2) => ({ ...r2.doc, legalText: r2.legalText })), true);
17566
+ uiLogger.info("Legal texts resolved from backend:", get$1(resolvedDocuments).map((d) => d.type));
17567
+ } catch (err) {
17568
+ set(error, err instanceof Error ? err.message : "Failed to load legal texts.", true);
17569
+ uiLogger.error("❌ Failed to resolve legal texts", err);
17570
+ set(resolvedDocuments, [], true);
17571
+ } finally {
17572
+ set(isLoading, false);
17573
+ set(hasResolved, true);
17574
+ }
17575
+ }
17576
+ return {
17577
+ get resolvedDocuments() {
17578
+ return get$1(resolvedDocuments);
17579
+ },
17580
+ get requiresLegalTexts() {
17581
+ return get$1(resolvedDocuments).length > 0;
17582
+ },
17583
+ get isLoading() {
17584
+ return get$1(isLoading);
17585
+ },
17586
+ get hasResolved() {
17587
+ return get$1(hasResolved);
17588
+ },
17589
+ get error() {
17590
+ return get$1(error);
17591
+ }
17592
+ };
17593
+ }
17533
17594
  var root_1$7 = /* @__PURE__ */ from_html(`<div class="spinner-container svelte-1l48sab"><alviere-spinner></alviere-spinner></div>`, 2);
17534
17595
  var root_2$3 = /* @__PURE__ */ from_html(`<alviere-currency-input></alviere-currency-input>`, 2);
17535
17596
  var root_4$4 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm__summary-row svelte-1l48sab"><span class="alviere-checkout-confirm__summary-label svelte-1l48sab"> </span> <span class="alviere-checkout-confirm__summary-value svelte-1l48sab"> </span></div>`);
17536
17597
  var root_3$5 = /* @__PURE__ */ from_html(`<section class="alviere-checkout-confirm__summary svelte-1l48sab"><div class="alviere-checkout-confirm__summary-row svelte-1l48sab"><span class="alviere-checkout-confirm__summary-label svelte-1l48sab"> </span> <span class="alviere-checkout-confirm__summary-value svelte-1l48sab"> </span></div> <div class="alviere-checkout-confirm__summary-row svelte-1l48sab"><span class="alviere-checkout-confirm__summary-label svelte-1l48sab"> </span> <span class="alviere-checkout-confirm__summary-value svelte-1l48sab"> </span></div> <!> <div class="alviere-checkout-confirm__summary-divider svelte-1l48sab" aria-hidden="true"></div> <div class="alviere-checkout-confirm__summary-row alviere-checkout-confirm__summary-row--total svelte-1l48sab"><span class="alviere-checkout-confirm__summary-label svelte-1l48sab"> </span> <span class="alviere-checkout-confirm__summary-value svelte-1l48sab"> </span></div></section>`);
17537
- var root_5$3 = /* @__PURE__ */ from_html(`<alviere-legal-text-consent></alviere-legal-text-consent>`, 2);
17538
- var root_6$2 = /* @__PURE__ */ from_html(`<alviere-checkbox></alviere-checkbox>`, 2);
17539
- var root_7$1 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm__timing-info svelte-1l48sab"><!></div>`);
17540
- var root$7 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm svelte-1l48sab"><!> <div class="alviere-checkout-confirm__payment-info svelte-1l48sab"><!> <div class="alviere-checkout-confirm__terms-and-conditions"><p> </p> <!></div> <!> <alviere-button> </alviere-button></div></div>`, 2);
17598
+ var root_5$3 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm__terms-and-conditions"><p> </p> <alviere-legal-text-consent></alviere-legal-text-consent></div>`, 2);
17599
+ var root_6$2 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm__timing-info svelte-1l48sab"><!></div>`);
17600
+ var root$7 = /* @__PURE__ */ from_html(`<div class="alviere-checkout-confirm svelte-1l48sab"><!> <div class="alviere-checkout-confirm__payment-info svelte-1l48sab"><!> <!> <!> <alviere-button> </alviere-button></div></div>`, 2);
17541
17601
  const $$css$a = {
17542
17602
  hash: "svelte-1l48sab",
17543
17603
  code: ":root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;--alv-font-family-grotesque: 'Darker Grotesque', sans-serif;--alv-font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkout-confirm.svelte-1l48sab {display:flex;flex-direction:column;gap:1rem;position:relative;padding:1rem 0;}.alviere-checkout-confirm__payment-info.svelte-1l48sab {display:flex;flex-direction:column;gap:2rem;}.alviere-checkout-confirm__payment-info.svelte-1l48sab alviere-button:where(.svelte-1l48sab) {align-self:center;}.alviere-checkout-confirm__summary.svelte-1l48sab {width:100%;display:flex;flex-direction:column;gap:0.5rem;}.alviere-checkout-confirm__summary-row.svelte-1l48sab {display:flex;align-items:baseline;justify-content:space-between;gap:1rem;}.alviere-checkout-confirm__summary-row--total.svelte-1l48sab {font-weight:600;color:#000000;}.alviere-checkout-confirm__summary-label.svelte-1l48sab {color:#000000;font-size:1rem;}.alviere-checkout-confirm__summary-value.svelte-1l48sab {color:#000000;font-size:1rem;font-weight:400;text-align:right;overflow-wrap:anywhere;}.alviere-checkout-confirm__summary-divider.svelte-1l48sab {border-top:1px dashed #000000;margin:0.25rem 0;}.alviere-checkout-confirm__timing-info.svelte-1l48sab {width:100%;}.alviere-checkout-confirm.svelte-1l48sab .spinner-container:where(.svelte-1l48sab) {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}"
@@ -17546,6 +17606,7 @@ function CheckoutConfirm($$anchor, $$props) {
17546
17606
  push($$props, true);
17547
17607
  append_styles$1($$anchor, $$css$a);
17548
17608
  const $flowRecipeStore = () => store_get(flowRecipeStore, "$flowRecipeStore", $$stores);
17609
+ const $flowCoreStore = () => store_get(flowCoreStore, "$flowCoreStore", $$stores);
17549
17610
  const [$$stores, $$cleanup] = setup_stores();
17550
17611
  var _a2;
17551
17612
  var _b;
@@ -17555,7 +17616,6 @@ function CheckoutConfirm($$anchor, $$props) {
17555
17616
  let hostElement = /* @__PURE__ */ state(null);
17556
17617
  let isSending = /* @__PURE__ */ state(false);
17557
17618
  let selfAmount = /* @__PURE__ */ state(proxy(amount()));
17558
- let isAgreedToTerms = /* @__PURE__ */ state(false);
17559
17619
  let legalTextsAccepted = /* @__PURE__ */ state(false);
17560
17620
  let acceptedLegalTextUuids = /* @__PURE__ */ state(proxy([]));
17561
17621
  let resolvedProfileData = /* @__PURE__ */ user_derived(() => () => {
@@ -17573,10 +17633,6 @@ function CheckoutConfirm($$anchor, $$props) {
17573
17633
  var _a3, _b2;
17574
17634
  return (_b2 = (_a3 = get$1(resolvedProfileData)().recipe) === null || _a3 === void 0 ? void 0 : _a3.steps) === null || _b2 === void 0 ? void 0 : _b2.find((step) => step.type === "CHECKOUT_CONFIRM");
17575
17635
  });
17576
- const legalTextsConfig = /* @__PURE__ */ user_derived(() => () => {
17577
- var _a3, _b2, _c2;
17578
- return (_a3 = config() === null || config() === void 0 ? void 0 : config().legalTexts) !== null && _a3 !== void 0 ? _a3 : (_c2 = (_b2 = get$1(resolvedProfileRecipe)()) === null || _b2 === void 0 ? void 0 : _b2.config) === null || _c2 === void 0 ? void 0 : _c2.legalTexts;
17579
- });
17580
17636
  const componentLabels = /* @__PURE__ */ user_derived(() => () => Object.assign({}, (config() === null || config() === void 0 ? void 0 : config().labels) || {}));
17581
17637
  const recipeLabels = /* @__PURE__ */ user_derived(() => () => {
17582
17638
  var _a3, _b2;
@@ -17591,13 +17647,14 @@ function CheckoutConfirm($$anchor, $$props) {
17591
17647
  componentLabels: get$1(componentLabels)(),
17592
17648
  recipeLabels: get$1(recipeLabels)()
17593
17649
  });
17594
- const legalTextDocuments = /* @__PURE__ */ user_derived(() => () => {
17595
- var _a3;
17596
- return ((_a3 = get$1(legalTextsConfig)()) === null || _a3 === void 0 ? void 0 : _a3.documents) || [];
17650
+ const legalTextDocumentTypes = /* @__PURE__ */ user_derived(() => () => {
17651
+ var _a3, _b2, _c2, _d2, _e, _f;
17652
+ return (_f = (_b2 = (_a3 = config() === null || config() === void 0 ? void 0 : config().legalTexts) === null || _a3 === void 0 ? void 0 : _a3.documents) !== null && _b2 !== void 0 ? _b2 : (_e = (_d2 = (_c2 = get$1(resolvedProfileRecipe)()) === null || _c2 === void 0 ? void 0 : _c2.config) === null || _d2 === void 0 ? void 0 : _d2.legalTexts) === null || _e === void 0 ? void 0 : _e.documents) !== null && _f !== void 0 ? _f : [];
17597
17653
  });
17598
- const requiresLegalTexts = /* @__PURE__ */ user_derived(() => () => {
17599
- var _a3;
17600
- return ((_a3 = get$1(legalTextsConfig)()) === null || _a3 === void 0 ? void 0 : _a3.required) === true && get$1(legalTextDocuments)().length > 0;
17654
+ const core = /* @__PURE__ */ user_derived(() => $flowCoreStore().core || (jwt() ? getAlviereCore({ jwt: jwt(), debug: debug() }) : null));
17655
+ const legalTextsResolver = createLegalTextsResolver({
17656
+ getDocumentTypes: () => get$1(legalTextDocumentTypes)(),
17657
+ getCore: () => get$1(core)
17601
17658
  });
17602
17659
  const isAmountEditable = /* @__PURE__ */ user_derived(() => (_d = (_a2 = config() === null || config() === void 0 ? void 0 : config().amountEditable) !== null && _a2 !== void 0 ? _a2 : (_c = (_b = get$1(resolvedProfileRecipe)()) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.amountEditable) !== null && _d !== void 0 ? _d : amountEditable());
17603
17660
  function parseNumericAmount(value) {
@@ -17660,10 +17717,6 @@ function CheckoutConfirm($$anchor, $$props) {
17660
17717
  const normalizedPaymentMethodStatus = /* @__PURE__ */ user_derived(() => (paymentMethodStatus() || "").toString().trim().toUpperCase());
17661
17718
  const isPaymentMethodPending = /* @__PURE__ */ user_derived(() => get$1(normalizedPaymentMethodStatus) === "PENDING");
17662
17719
  const paymentTimingMessage = /* @__PURE__ */ user_derived(() => get$1(isPaymentMethodPending) ? getOptionalInfoLabel("paymentTimingPendingInfoLabel") || getOptionalInfoLabel("paymentTimingInfoLabel") : getOptionalInfoLabel("paymentTimingInfoLabel") || getOptionalInfoLabel("paymentTimingPendingInfoLabel"));
17663
- function handleTermsChange(event2) {
17664
- set(isAgreedToTerms, event2.detail.checked, true);
17665
- uiLogger.info("Terms agreement changed:", get$1(isAgreedToTerms));
17666
- }
17667
17720
  function handleAmountChange(event2) {
17668
17721
  set(selfAmount, event2.detail.rawValue, true);
17669
17722
  uiLogger.info("Amount changed:", get$1(selfAmount));
@@ -17678,13 +17731,13 @@ function CheckoutConfirm($$anchor, $$props) {
17678
17731
  set(selfAmount, amount());
17679
17732
  }
17680
17733
  });
17681
- const canPay = /* @__PURE__ */ user_derived(() => () => get$1(requiresLegalTexts)() ? get$1(legalTextsAccepted) : get$1(isAgreedToTerms));
17734
+ const canPay = /* @__PURE__ */ user_derived(() => () => !legalTextsResolver.requiresLegalTexts || get$1(legalTextsAccepted));
17682
17735
  async function handlePay() {
17683
17736
  set(isSending, true);
17684
17737
  await new Promise((resolve) => setTimeout(resolve, 500));
17685
17738
  set(isSending, false);
17686
17739
  if (get$1(hostElement)) {
17687
- const acceptedLegalDocs = get$1(requiresLegalTexts)() ? get$1(acceptedLegalTextUuids) : void 0;
17740
+ const acceptedLegalDocs = legalTextsResolver.requiresLegalTexts ? get$1(acceptedLegalTextUuids) : void 0;
17688
17741
  const customEvent = new CustomEvent(ComponentEvents.FORM_SUCCESS, {
17689
17742
  detail: Object.assign(
17690
17743
  {
@@ -17905,37 +17958,32 @@ function CheckoutConfirm($$anchor, $$props) {
17905
17958
  else $$render(alternate, false);
17906
17959
  });
17907
17960
  }
17908
- var div_7 = sibling(node_1, 2);
17909
- var p = child(div_7);
17910
- var text_8 = child(p, true);
17911
- reset(p);
17912
- var node_3 = sibling(p, 2);
17961
+ var node_3 = sibling(node_1, 2);
17913
17962
  {
17914
17963
  var consequent_3 = ($$anchor2) => {
17915
- var alviere_legal_text_consent = root_5$3();
17916
- template_effect(() => set_custom_element_data(alviere_legal_text_consent, "documents", get$1(legalTextDocuments)()));
17964
+ var div_7 = root_5$3();
17965
+ var p = child(div_7);
17966
+ var text_8 = child(p, true);
17967
+ reset(p);
17968
+ var alviere_legal_text_consent = sibling(p, 2);
17969
+ template_effect(() => set_custom_element_data(alviere_legal_text_consent, "resolvedDocuments", legalTextsResolver.resolvedDocuments));
17917
17970
  template_effect(() => set_custom_element_data(alviere_legal_text_consent, "jwt", jwt()));
17918
17971
  template_effect(() => set_custom_element_data(alviere_legal_text_consent, "debug", debug()));
17972
+ reset(div_7);
17973
+ template_effect(($0) => set_text(text_8, $0), [
17974
+ () => getLabel("legalTextsPromptLabel", "Review and accept the terms below to continue.")
17975
+ ]);
17919
17976
  event$1("legal-texts-change", alviere_legal_text_consent, handleLegalTextsChange);
17920
- append($$anchor2, alviere_legal_text_consent);
17921
- };
17922
- var alternate_1 = ($$anchor2) => {
17923
- var alviere_checkbox = root_6$2();
17924
- template_effect(() => set_custom_element_data(alviere_checkbox, "checked", get$1(isAgreedToTerms)));
17925
- template_effect(() => set_custom_element_data(alviere_checkbox, "label", getLabel("agreeToTermsLabel", "I agree to the terms and conditions")));
17926
- alviere_checkbox.__change = handleTermsChange;
17927
- append($$anchor2, alviere_checkbox);
17977
+ append($$anchor2, div_7);
17928
17978
  };
17929
17979
  if_block(node_3, ($$render) => {
17930
- if (get$1(requiresLegalTexts)()) $$render(consequent_3);
17931
- else $$render(alternate_1, false);
17980
+ if (legalTextsResolver.requiresLegalTexts) $$render(consequent_3);
17932
17981
  });
17933
17982
  }
17934
- reset(div_7);
17935
- var node_4 = sibling(div_7, 2);
17983
+ var node_4 = sibling(node_3, 2);
17936
17984
  {
17937
17985
  var consequent_4 = ($$anchor2) => {
17938
- var div_8 = root_7$1();
17986
+ var div_8 = root_6$2();
17939
17987
  var node_5 = child(div_8);
17940
17988
  {
17941
17989
  let $0 = /* @__PURE__ */ user_derived(() => get$1(paymentTimingMessage) || "");
@@ -17964,22 +18012,12 @@ function CheckoutConfirm($$anchor, $$props) {
17964
18012
  reset(div_2);
17965
18013
  reset(div);
17966
18014
  bind_this(div, ($$value) => set(hostElement, $$value), () => get$1(hostElement));
17967
- template_effect(
17968
- ($0, $1) => {
17969
- set_text(text_8, $0);
17970
- set_text(text_9, $1);
17971
- },
17972
- [
17973
- () => getLabel("legalTextsPromptLabel", "Review and accept the terms below to continue."),
17974
- () => getLabel("payButtonLabel", "Pay")
17975
- ]
17976
- );
18015
+ template_effect(($0) => set_text(text_9, $0), [() => getLabel("payButtonLabel", "Pay")]);
17977
18016
  append($$anchor, div);
17978
18017
  var $$pop = pop($$exports);
17979
18018
  $$cleanup();
17980
18019
  return $$pop;
17981
18020
  }
17982
- delegate(["change"]);
17983
18021
  customElements.define("alviere-checkout-confirm", create_custom_element(
17984
18022
  CheckoutConfirm,
17985
18023
  {
@@ -18670,23 +18708,34 @@ function LegalTextConsent($$anchor, $$props) {
18670
18708
  append_styles$1($$anchor, $$css$4);
18671
18709
  const $flowCoreStore = () => store_get(flowCoreStore, "$flowCoreStore", $$stores);
18672
18710
  const [$$stores, $$cleanup] = setup_stores();
18673
- let documents = prop($$props, "documents", 31, () => proxy([])), jwt = prop($$props, "jwt", 15, ""), debug = prop($$props, "debug", 15, false);
18711
+ let documents = prop($$props, "documents", 31, () => proxy([])), jwt = prop($$props, "jwt", 15, ""), debug = prop($$props, "debug", 15, false), resolvedDocumentsProp = prop($$props, "resolvedDocuments", 15, void 0);
18674
18712
  const dispatch = createEventDispatcher();
18675
- let legalTexts = /* @__PURE__ */ state(proxy({}));
18676
- let accepted = /* @__PURE__ */ state(proxy({}));
18713
+ let internalLegalTexts = /* @__PURE__ */ state(proxy({}));
18677
18714
  let isLoading = /* @__PURE__ */ state(false);
18678
18715
  let error = /* @__PURE__ */ state(null);
18679
- let lastDocsSignature = /* @__PURE__ */ state(null);
18716
+ let lastDocsSignature = null;
18680
18717
  let isModalOpen = /* @__PURE__ */ state(false);
18681
18718
  let activeDocKey = /* @__PURE__ */ state(null);
18682
- const core = /* @__PURE__ */ user_derived(() => $flowCoreStore().core || (jwt() ? getAlviereCore({ jwt: jwt(), debug: debug() }) : null));
18719
+ let accepted = /* @__PURE__ */ state(proxy({}));
18683
18720
  const getKey = (doc) => `${doc.type}:${doc.version || "latest"}`;
18684
18721
  const formatTypeLabel = (type) => type.toLowerCase().split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
18722
+ const displayItems = /* @__PURE__ */ user_derived(() => () => {
18723
+ if (resolvedDocumentsProp() !== void 0) {
18724
+ return resolvedDocumentsProp();
18725
+ }
18726
+ return documents().map((doc) => {
18727
+ var _a2;
18728
+ return Object.assign(Object.assign({}, doc), {
18729
+ legalText: (_a2 = get$1(internalLegalTexts)[getKey(doc)]) !== null && _a2 !== void 0 ? _a2 : null
18730
+ });
18731
+ });
18732
+ });
18685
18733
  const emitChange = () => {
18686
- const allAccepted = documents().every((doc) => get$1(accepted)[getKey(doc)]);
18687
- const acceptedLegalTextUuids = documents().filter((doc) => get$1(accepted)[getKey(doc)]).map((doc) => {
18734
+ const items = get$1(displayItems)();
18735
+ const allAccepted = items.every((item) => get$1(accepted)[getKey(item)]);
18736
+ const acceptedLegalTextUuids = items.filter((item) => get$1(accepted)[getKey(item)]).map((item) => {
18688
18737
  var _a2;
18689
- return (_a2 = get$1(legalTexts)[getKey(doc)]) === null || _a2 === void 0 ? void 0 : _a2.legal_text_uuid;
18738
+ return (_a2 = item.legalText) === null || _a2 === void 0 ? void 0 : _a2.legal_text_uuid;
18690
18739
  }).filter((uuid) => !!uuid);
18691
18740
  dispatch("legal-texts-change", {
18692
18741
  accepted: get$1(accepted),
@@ -18694,23 +18743,32 @@ function LegalTextConsent($$anchor, $$props) {
18694
18743
  acceptedLegalTextUuids
18695
18744
  });
18696
18745
  };
18697
- const activeDocument = /* @__PURE__ */ user_derived(() => () => {
18698
- if (!get$1(activeDocKey)) return null;
18699
- return documents().find((doc) => getKey(doc) === get$1(activeDocKey)) || null;
18746
+ let lastResolvedSignature = null;
18747
+ user_effect(() => {
18748
+ if (resolvedDocumentsProp() === void 0) return;
18749
+ const signature = resolvedDocumentsProp().map(getKey).join("|");
18750
+ if (signature === lastResolvedSignature) return;
18751
+ lastResolvedSignature = signature;
18752
+ untrack$1(() => {
18753
+ const nextAccepted = Object.assign({}, get$1(accepted));
18754
+ resolvedDocumentsProp().forEach((doc) => {
18755
+ const key = getKey(doc);
18756
+ if (!(key in nextAccepted)) {
18757
+ nextAccepted[key] = false;
18758
+ }
18759
+ });
18760
+ set(accepted, nextAccepted, true);
18761
+ emitChange();
18762
+ });
18700
18763
  });
18701
- const activeLegalText = /* @__PURE__ */ user_derived(() => () => {
18702
- if (!get$1(activeDocKey)) return null;
18703
- return get$1(legalTexts)[get$1(activeDocKey)] || null;
18764
+ const core = /* @__PURE__ */ user_derived(() => resolvedDocumentsProp() !== void 0 ? null : $flowCoreStore().core || (jwt() ? getAlviereCore({ jwt: jwt(), debug: debug() }) : null));
18765
+ user_effect(() => {
18766
+ if (resolvedDocumentsProp() !== void 0) return;
18767
+ const signature = documents().map(getKey).join("|");
18768
+ if (!signature || signature === lastDocsSignature) return;
18769
+ lastDocsSignature = signature;
18770
+ void loadLegalTexts();
18704
18771
  });
18705
- function handleToggle(doc, event2) {
18706
- var _a2, _b, _c;
18707
- const detail = event2.detail;
18708
- const targetChecked = (_a2 = event2.target) === null || _a2 === void 0 ? void 0 : _a2.checked;
18709
- const checked = (_c = (_b = detail === null || detail === void 0 ? void 0 : detail.checked) !== null && _b !== void 0 ? _b : targetChecked) !== null && _c !== void 0 ? _c : false;
18710
- const key = getKey(doc);
18711
- set(accepted, Object.assign(Object.assign({}, get$1(accepted)), { [key]: checked }), true);
18712
- emitChange();
18713
- }
18714
18772
  async function loadLegalTexts() {
18715
18773
  if (!get$1(core) || documents().length === 0) {
18716
18774
  return;
@@ -18736,7 +18794,7 @@ function LegalTextConsent($$anchor, $$props) {
18736
18794
  nextAccepted[key] = false;
18737
18795
  }
18738
18796
  });
18739
- set(legalTexts, nextTexts, true);
18797
+ set(internalLegalTexts, nextTexts, true);
18740
18798
  set(accepted, nextAccepted, true);
18741
18799
  emitChange();
18742
18800
  } catch (err) {
@@ -18746,27 +18804,42 @@ function LegalTextConsent($$anchor, $$props) {
18746
18804
  set(isLoading, false);
18747
18805
  }
18748
18806
  }
18749
- user_effect(() => {
18750
- const signature = documents().map(getKey).join("|");
18751
- if (!signature || signature === get$1(lastDocsSignature)) {
18752
- return;
18753
- }
18754
- set(lastDocsSignature, signature, true);
18755
- void loadLegalTexts();
18807
+ function handleToggle(item, event2) {
18808
+ var _a2, _b, _c;
18809
+ const detail = event2.detail;
18810
+ const targetChecked = (_a2 = event2.target) === null || _a2 === void 0 ? void 0 : _a2.checked;
18811
+ const checked = (_c = (_b = detail === null || detail === void 0 ? void 0 : detail.checked) !== null && _b !== void 0 ? _b : targetChecked) !== null && _c !== void 0 ? _c : false;
18812
+ const key = getKey(item);
18813
+ set(accepted, Object.assign(Object.assign({}, get$1(accepted)), { [key]: checked }), true);
18814
+ emitChange();
18815
+ }
18816
+ const activeDocument = /* @__PURE__ */ user_derived(() => () => {
18817
+ if (!get$1(activeDocKey)) return null;
18818
+ return get$1(displayItems)().find((item) => getKey(item) === get$1(activeDocKey)) || null;
18819
+ });
18820
+ const activeLegalText = /* @__PURE__ */ user_derived(() => () => {
18821
+ var _a2;
18822
+ return ((_a2 = get$1(activeDocument)()) === null || _a2 === void 0 ? void 0 : _a2.legalText) || null;
18823
+ });
18824
+ const modalTitle = /* @__PURE__ */ user_derived(() => () => {
18825
+ var _a2;
18826
+ const doc = get$1(activeDocument)();
18827
+ if (!doc) return "Terms";
18828
+ return doc.label || ((_a2 = get$1(activeLegalText)()) === null || _a2 === void 0 ? void 0 : _a2.title) || formatTypeLabel(doc.type);
18756
18829
  });
18757
- function handleView(doc) {
18830
+ function handleView(item) {
18758
18831
  var _a2, _b;
18759
- set(activeDocKey, getKey(doc), true);
18760
- const legalText = get$1(legalTexts)[get$1(activeDocKey)] || null;
18832
+ set(activeDocKey, getKey(item), true);
18833
+ const legalText = item.legalText;
18761
18834
  const documentText = (_a2 = legalText === null || legalText === void 0 ? void 0 : legalText.document_text) === null || _a2 === void 0 ? void 0 : _a2.trim();
18762
18835
  const documentUrl = (_b = legalText === null || legalText === void 0 ? void 0 : legalText.document_url) === null || _b === void 0 ? void 0 : _b.trim();
18763
18836
  if (!documentText && documentUrl && typeof window !== "undefined") {
18764
18837
  window.open(documentUrl, "_blank", "noopener");
18765
- dispatch("view", { document: doc, legalText });
18838
+ dispatch("view", { document: item, legalText });
18766
18839
  return;
18767
18840
  }
18768
18841
  set(isModalOpen, true);
18769
- dispatch("view", { document: doc, legalText });
18842
+ dispatch("view", { document: item, legalText });
18770
18843
  }
18771
18844
  function handleModalClose() {
18772
18845
  set(isModalOpen, false);
@@ -18792,6 +18865,13 @@ function LegalTextConsent($$anchor, $$props) {
18792
18865
  set debug($$value = false) {
18793
18866
  debug($$value);
18794
18867
  flushSync();
18868
+ },
18869
+ get resolvedDocuments() {
18870
+ return resolvedDocumentsProp();
18871
+ },
18872
+ set resolvedDocuments($$value = void 0) {
18873
+ resolvedDocumentsProp($$value);
18874
+ flushSync();
18795
18875
  }
18796
18876
  };
18797
18877
  var fragment = root$1();
@@ -18821,18 +18901,18 @@ function LegalTextConsent($$anchor, $$props) {
18821
18901
  var alternate = ($$anchor3) => {
18822
18902
  var fragment_2 = comment();
18823
18903
  var node_2 = first_child(fragment_2);
18824
- each(node_2, 17, documents, index, ($$anchor4, doc) => {
18825
- const key = /* @__PURE__ */ user_derived(() => getKey(get$1(doc)));
18904
+ each(node_2, 17, () => get$1(displayItems)(), index, ($$anchor4, item) => {
18905
+ const key = /* @__PURE__ */ user_derived(() => getKey(get$1(item)));
18826
18906
  var div_3 = root_5$2();
18827
18907
  var alviere_checkbox = child(div_3);
18828
18908
  template_effect(() => set_custom_element_data(alviere_checkbox, "checked", !!get$1(accepted)[get$1(key)]));
18829
- alviere_checkbox.__change = (event2) => handleToggle(get$1(doc), event2);
18909
+ alviere_checkbox.__change = (event2) => handleToggle(get$1(item), event2);
18830
18910
  var span = child(alviere_checkbox);
18831
18911
  var button = sibling(child(span), 2);
18832
18912
  button.__click = (event2) => {
18833
18913
  event2.preventDefault();
18834
18914
  event2.stopPropagation();
18835
- handleView(get$1(doc));
18915
+ handleView(get$1(item));
18836
18916
  };
18837
18917
  var text_2 = child(button, true);
18838
18918
  reset(button);
@@ -18842,7 +18922,7 @@ function LegalTextConsent($$anchor, $$props) {
18842
18922
  template_effect(($0) => set_text(text_2, $0), [
18843
18923
  () => {
18844
18924
  var _a2;
18845
- return ((_a2 = get$1(legalTexts)[get$1(key)]) == null ? void 0 : _a2.title) || get$1(doc).label || formatTypeLabel(get$1(doc).type);
18925
+ return ((_a2 = get$1(item).legalText) == null ? void 0 : _a2.title) || get$1(item).label || formatTypeLabel(get$1(item).type);
18846
18926
  }
18847
18927
  ]);
18848
18928
  append($$anchor4, div_3);
@@ -18868,10 +18948,7 @@ function LegalTextConsent($$anchor, $$props) {
18868
18948
  reset(div);
18869
18949
  var alviere_modal = sibling(div, 2);
18870
18950
  template_effect(() => set_custom_element_data(alviere_modal, "open", get$1(isModalOpen)));
18871
- template_effect(() => {
18872
- var _a2;
18873
- return set_custom_element_data(alviere_modal, "title", get$1(activeDocument)() ? get$1(activeDocument)().label || ((_a2 = get$1(activeLegalText)()) == null ? void 0 : _a2.title) || formatTypeLabel(get$1(activeDocument)().type) : "Terms");
18874
- });
18951
+ template_effect(() => set_custom_element_data(alviere_modal, "title", get$1(modalTitle)()));
18875
18952
  var node_3 = child(alviere_modal);
18876
18953
  {
18877
18954
  var consequent_2 = ($$anchor2) => {
@@ -18926,7 +19003,7 @@ function LegalTextConsent($$anchor, $$props) {
18926
19003
  return $$pop;
18927
19004
  }
18928
19005
  delegate(["change", "click"]);
18929
- create_custom_element(LegalTextConsent, { documents: {}, jwt: {}, debug: {} }, [], [], true);
19006
+ create_custom_element(LegalTextConsent, { documents: {}, jwt: {}, debug: {}, resolvedDocuments: {} }, [], [], true);
18930
19007
  var root_4$2 = /* @__PURE__ */ from_html(`<alviere-button></alviere-button>`, 2);
18931
19008
  var root_2$1 = /* @__PURE__ */ from_html(`<div class="alviere-modal svelte-14kdpon"><button type="button" class="alviere-modal__backdrop svelte-14kdpon" aria-label="Close modal" tabindex="-1"></button> <div class="alviere-modal__dialog svelte-14kdpon" role="dialog" aria-modal="true"><div class="alviere-modal__header svelte-14kdpon"><div class="alviere-modal__title svelte-14kdpon"><!></div> <!></div> <div class="alviere-modal__body svelte-14kdpon"><!></div> <div class="alviere-modal__footer svelte-14kdpon"><!></div></div></div>`);
18932
19009
  const $$css$3 = {