@useinsider/guido 2.1.0-beta.9b06e1d → 2.1.0-beta.9b797dd

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.
Files changed (32) hide show
  1. package/dist/@types/config/schemas.js +1 -1
  2. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  3. package/dist/components/organisms/base/Toaster.vue2.js +9 -12
  4. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
  7. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
  10. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
  12. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
  13. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  14. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  15. package/dist/config/migrator/itemsBlockMigrator.js +65 -64
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +58 -39
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +116 -70
  18. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
  19. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
  20. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  21. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  22. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  23. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  24. package/dist/guido.css +1 -1
  25. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
  26. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -0
  28. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +18 -2
  29. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
  30. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  31. package/dist/stores/unsubscribe.js +37 -34
  32. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- var B = Object.defineProperty;
2
- var U = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var M = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { productPairs as v } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
- import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
1
+ var v = Object.defineProperty;
2
+ var B = (e, t, r) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var M = (e, t, r) => B(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { productPairs as U } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
+ import { ItemInCartOptions as T, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
6
  import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
7
7
  const w = {
8
8
  img: {
@@ -85,18 +85,19 @@ function q(e) {
85
85
  }[e] || u.ITEMS_TYPE.CART_ITEMS : u.ITEMS_TYPE.CART_ITEMS;
86
86
  }
87
87
  function R(e) {
88
- const t = (a, o) => a == null ? o : a === "1" || a === "true", r = (a, o) => a || o, c = e["data-type"] || e["data-source"], i = q(c);
89
- let n = e["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
- if (n && !n.includes("{{") && /^\d+$/.test(n)) {
91
- const a = parseInt(n) - 1, o = E[i];
92
- o && o[a] && (n = o[a].value);
88
+ var a;
89
+ const t = (_, c) => _ == null ? c : _ === "1" || _ === "true", r = (_, c) => _ || c, l = e["data-type"] || e["data-source"], i = q(l), n = T[i];
90
+ let o = e["data-cart_items_select_control_value"] || ((a = n == null ? void 0 : n[0]) == null ? void 0 : a.value) || g.cartItemsSelectControlValue;
91
+ if (o && !o.includes("{{") && /^\d+$/.test(o)) {
92
+ const _ = parseInt(o) - 1, c = T[i];
93
+ c && c[_] && (o = c[_].value);
93
94
  }
94
95
  return {
95
96
  initialized: !0,
96
97
  blockInstanceId: r(e["data-block-instance-id"], F()),
97
98
  source: i,
98
99
  type: i,
99
- itemsSelectValue: n,
100
+ itemsSelectValue: o,
100
101
  orientation: e["data-card_orientation_control_value"] || u.ORIENTATION.VERTICAL,
101
102
  nameTrimming: t(e["data-product_name_control_trim"], !0),
102
103
  priceHideDiscount: t(e["data-product_price_control_nodup"], !0),
@@ -154,36 +155,36 @@ class V {
154
155
  try {
155
156
  let r = this.removeJinjaConditionals(t);
156
157
  r = this.replaceTemplateVariables(r);
157
- const c = this.parser.parseFromString(r, "text/html"), i = c.querySelectorAll(
158
+ const l = this.parser.parseFromString(r, "text/html"), i = l.querySelectorAll(
158
159
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
159
160
  );
160
161
  return i.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (i.forEach((n) => {
161
- const a = this.extractConfiguration(n), o = K({
162
- orientation: a.orientation,
163
- itemsType: a.itemsType,
164
- itemId: a.itemId,
165
- currencySymbol: a.currencySymbol,
166
- currencyLocation: a.currencyLocation,
167
- formattedPrice: a.formattedPrice,
168
- configBlockAttributes: a.configBlockAttributes,
162
+ const o = this.extractConfiguration(n), a = K({
163
+ orientation: o.orientation,
164
+ itemsType: o.itemsType,
165
+ itemId: o.itemId,
166
+ currencySymbol: o.currencySymbol,
167
+ currencyLocation: o.currencyLocation,
168
+ formattedPrice: o.formattedPrice,
169
+ configBlockAttributes: o.configBlockAttributes,
169
170
  migrate: !0,
170
- nameStyles: a.nameStyles,
171
- buttonStyles: a.buttonStyles,
172
- priceStyles: a.priceStyles,
173
- originalPriceStyles: a.originalPriceStyles,
174
- quantityStyles: a.quantityStyles,
175
- nodeConfig: R(a.configBlockAttributes)
176
- }), l = this.parser.parseFromString(
177
- `<table><tbody><tr>${o}</tr></tbody></table>`,
171
+ nameStyles: o.nameStyles,
172
+ buttonStyles: o.buttonStyles,
173
+ priceStyles: o.priceStyles,
174
+ originalPriceStyles: o.originalPriceStyles,
175
+ quantityStyles: o.quantityStyles,
176
+ nodeConfig: R(o.configBlockAttributes)
177
+ }), c = this.parser.parseFromString(
178
+ `<table><tbody><tr>${a}</tr></tbody></table>`,
178
179
  "text/html"
179
180
  ).querySelector("td");
180
- if (l && n.parentNode) {
181
- const f = R(a.configBlockAttributes);
182
- l.setAttribute("esd-ext-config", JSON.stringify(f));
183
- const d = l.querySelector("esd-config-block");
184
- d && d.remove(), n.parentNode.replaceChild(l, n);
181
+ if (c && n.parentNode) {
182
+ const f = R(o.configBlockAttributes);
183
+ c.setAttribute("esd-ext-config", JSON.stringify(f));
184
+ const d = c.querySelector("esd-config-block");
185
+ d && d.remove(), n.parentNode.replaceChild(c, n);
185
186
  }
186
- }), c.documentElement.outerHTML);
187
+ }), l.documentElement.outerHTML);
187
188
  } catch (r) {
188
189
  return console.error("ItemsBlockMigrator failed:", r), t;
189
190
  }
@@ -196,14 +197,14 @@ class V {
196
197
  */
197
198
  extractConfiguration(t) {
198
199
  var C, D, P;
199
- const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", i = parseInt(c) - 1, n = E[r], a = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, c), S = s["data-card_orientation_control_value"];
200
+ const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", l = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", i = parseInt(l) - 1, n = T[r], o = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, a = t.querySelector('[product-attr="price"]'), _ = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, l), S = s["data-card_orientation_control_value"];
200
201
  let b;
201
202
  S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
202
- const p = t.querySelector('a[product-attr="name"]'), I = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (o == null ? void 0 : o.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), k = (T == null ? void 0 : T.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
203
+ const p = t.querySelector('a[product-attr="name"]'), I = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), k = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), L = (E == null ? void 0 : E.getAttribute("style")) || void 0;
203
204
  return {
204
205
  orientation: b,
205
206
  itemsType: r,
206
- itemId: a,
207
+ itemId: o,
207
208
  currencySymbol: _,
208
209
  currencyLocation: f,
209
210
  formattedPrice: d,
@@ -222,27 +223,27 @@ class V {
222
223
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
223
224
  * @param itemNumber - The item number (1-based index)
224
225
  */
225
- extractConfigBlockAttributes(t, r, c) {
226
+ extractConfigBlockAttributes(t, r, l) {
226
227
  const i = t.querySelector("esd-config-block"), n = {};
227
228
  if (!i)
228
229
  return this.getDefaultConfigBlockAttributes();
229
- if (Array.from(i.attributes).forEach((o) => {
230
- o.name.startsWith("data-") && (n[o.name] = o.value);
230
+ if (Array.from(i.attributes).forEach((a) => {
231
+ a.name.startsWith("data-") && (n[a.name] = a.value);
231
232
  }), n["data-cart_items_select_control_value"]) {
232
- const o = n["data-cart_items_select_control_value"];
233
- if (/^\d+$/.test(o)) {
234
- const _ = parseInt(o) - 1, l = E[r];
235
- l && l[_] && (n["data-cart_items_select_control_value"] = l[_].value);
233
+ const a = n["data-cart_items_select_control_value"];
234
+ if (/^\d+$/.test(a)) {
235
+ const _ = parseInt(a) - 1, c = T[r];
236
+ c && c[_] && (n["data-cart_items_select_control_value"] = c[_].value);
236
237
  }
237
238
  }
238
239
  if (n["data-product_price_control_curency"]) {
239
- const o = n["data-product_price_control_curency"];
240
- let _ = o;
241
- o === "before" ? _ = "0" : o === "after" && (_ = "1"), n["data-product_price_control_curency"] = _, n["data-product_price_currency_location"] = _;
240
+ const a = n["data-product_price_control_curency"];
241
+ let _ = a;
242
+ a === "before" ? _ = "0" : a === "after" && (_ = "1"), n["data-product_price_control_curency"] = _, n["data-product_price_currency_location"] = _;
242
243
  }
243
244
  (!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
244
- const a = { ...this.getDefaultConfigBlockAttributes(), ...n };
245
- return a["data-type"] = r, a["data-source"] = r, a["data-product_image_link"] = $(r, c), a["data-product_button_link"] = x(r, c), a;
245
+ const o = { ...this.getDefaultConfigBlockAttributes(), ...n };
246
+ return o["data-type"] = r, o["data-source"] = r, o["data-product_image_link"] = $(r, l), o["data-product_button_link"] = x(r, l), o;
246
247
  }
247
248
  /**
248
249
  * Returns default esd-config-block attributes based on the old template structure
@@ -302,15 +303,15 @@ class V {
302
303
  * contains display condition Jinja scripts that should NOT be removed.
303
304
  */
304
305
  removeJinjaConditionals(t) {
305
- const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
306
- let i = c ? t.replace(c[0], r) : t;
306
+ const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", l = t.match(/esd-custom-display-conditions="[^"]*"/);
307
+ let i = l ? t.replace(l[0], r) : t;
307
308
  return i = i.replace(
308
309
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
309
310
  ""
310
311
  ), i = i.replace(
311
312
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
312
313
  ""
313
- ), i = i.replace(/\{%\s*endif\s*%\}/g, ""), c && (i = i.replace(r, c[0])), i = i.replace(/\n\s*\n\s*\n/g, `
314
+ ), i = i.replace(/\{%\s*endif\s*%\}/g, ""), l && (i = i.replace(r, l[0])), i = i.replace(/\n\s*\n\s*\n/g, `
314
315
 
315
316
  `), i;
316
317
  }
@@ -324,26 +325,26 @@ class V {
324
325
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
325
326
  */
326
327
  replaceTemplateVariables(t) {
327
- const { PAIRS_FOR_EXTENSION: r } = v;
328
- return t.replace(/{{([^}]+)}}/g, (c, i) => {
328
+ const { PAIRS_FOR_EXTENSION: r } = U;
329
+ return t.replace(/{{([^}]+)}}/g, (l, i) => {
329
330
  const n = i.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
330
331
  if (!n)
331
- return c;
332
- const [, a, o, _] = n, l = O[a];
333
- if (!l)
334
- return console.warn(`Unknown variable prefix: ${a}`), c;
335
- const f = w[o];
332
+ return l;
333
+ const [, o, a, _] = n, c = O[o];
334
+ if (!c)
335
+ return console.warn(`Unknown variable prefix: ${o}`), l;
336
+ const f = w[a];
336
337
  if (!f)
337
- return console.warn(`Unknown variable suffix mapping for: ${o}`), c;
338
- const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][l];
338
+ return console.warn(`Unknown variable suffix mapping for: ${a}`), l;
339
+ const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][c];
339
340
  if (!p)
340
- return console.warn(`No data found for: ${d}.${l}`), c;
341
+ return console.warn(`No data found for: ${d}.${c}`), l;
341
342
  if (S) {
342
343
  const y = parseInt(_) - 1, m = p[s];
343
- return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${l}.${s}[${y}]`), c);
344
+ return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${c}.${s}[${y}]`), l);
344
345
  }
345
346
  const I = p[s];
346
- return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${l}.${s}`), c);
347
+ return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${c}.${s}`), l);
347
348
  });
348
349
  }
349
350
  }
@@ -1,8 +1,8 @@
1
- var d = Object.defineProperty;
2
- var m = (c, s, t) => s in c ? d(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
3
- var n = (c, s, t) => m(c, typeof s != "symbol" ? s + "" : s, t);
4
- import { CommonControl as h } from "../../../common-control.js";
5
- import { RecommendationConfigService as f } from "../../services/configService.js";
1
+ var m = Object.defineProperty;
2
+ var h = (c, s, t) => s in c ? m(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
3
+ var n = (c, s, t) => h(c, typeof s != "symbol" ? s + "" : s, t);
4
+ import { CommonControl as f } from "../../../common-control.js";
5
+ import { RecommendationConfigService as l } from "../../services/configService.js";
6
6
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
7
7
  import { AlgorithmControl as p } from "./algorithm.js";
8
8
  import { ALGORITHM_CONTROL_ID as W } from "./algorithm.js";
@@ -10,17 +10,17 @@ import { CurrencyControl as g } from "./currency.js";
10
10
  import { CURRENCY_CONTROL_ID as H } from "./currency.js";
11
11
  import { FiltersControl as R } from "./filters.js";
12
12
  import { FILTERS_CONTROL_ID as j } from "./filters.js";
13
- import { LocaleControl as y } from "./locale.js";
13
+ import { LocaleControl as N } from "./locale.js";
14
14
  import { LOCALE_CONTROL_ID as K } from "./locale.js";
15
- import { ProductLayoutControl as _ } from "./productLayout.js";
15
+ import { ProductLayoutControl as y } from "./productLayout.js";
16
16
  import { PRODUCT_LAYOUT_CONTROL_ID as J } from "./productLayout.js";
17
- import { ShuffleControl as N } from "./shuffle.js";
17
+ import { ShuffleControl as _ } from "./shuffle.js";
18
18
  import { SHUFFLE_CONTROL_ID as X } from "./shuffle.js";
19
- import { regenerateProductRowsWithStyles as b, getBlockElement as P, updateProductContentInPlace as I } from "./utils.js";
20
- import { formatProductPrice as tt, getCardComposition as et, getCurrentLayout as ot, reapplySpacing as rt, regenerateMobileProductRows as nt, regenerateProductRows as it, setCurrencyAttributes as st, updatePricesInPlace as ct, updateSingleProductContent as at } from "./utils.js";
21
- import { useDebounceFn as l } from "../../../../../node_modules/@vueuse/shared/index.js";
19
+ import { regenerateProductRowsWithStyles as b, getBlockElement as I, updateProductContentInPlace as P } from "./utils.js";
20
+ import { formatProductPrice as tt, getCardComposition as et, getCurrentLayout as ot, reapplySpacing as rt, regenerateMobileProductRows as it, regenerateProductRows as nt, setCurrencyAttributes as st, updatePricesInPlace as ct, updateSingleProductContent as at } from "./utils.js";
21
+ import { useDebounceFn as u } from "../../../../../node_modules/@vueuse/shared/index.js";
22
22
  const T = "recommendation-id", S = "ui-elements-recommendation-block";
23
- class $ extends h {
23
+ class z extends f {
24
24
  constructor() {
25
25
  super(...arguments);
26
26
  n(this, "store", C());
@@ -36,19 +36,19 @@ class $ extends h {
36
36
  /**
37
37
  * Debounced product fetch to prevent rapid API calls during config changes
38
38
  */
39
- n(this, "_debouncedFetchProducts", l(() => {
39
+ n(this, "_debouncedFetchProducts", u(() => {
40
40
  this.store.fetchRecommendationProducts();
41
41
  }, 500));
42
42
  /**
43
43
  * Debounced regeneration when products arrive from API
44
44
  * Tries in-place update first to preserve styles, falls back to full regeneration
45
45
  */
46
- n(this, "_debouncedRegenerateWithProducts", l(() => {
46
+ n(this, "_debouncedRegenerateWithProducts", u(() => {
47
47
  const t = this.store.recommendationProducts;
48
48
  if (!this.currentNode || !this.api)
49
49
  return;
50
50
  const e = this.api.getDocumentModifier();
51
- I({
51
+ P({
52
52
  currentNode: this.currentNode,
53
53
  documentModifier: e,
54
54
  products: t
@@ -59,7 +59,7 @@ class $ extends h {
59
59
  return S;
60
60
  }
61
61
  getTemplate() {
62
- return this.algorithmControl = new p(), this.localeControl = new y(), this.currencyControl = new g(), this.productLayoutControl = new _(), this.filtersControl = new R(), this.shuffleControl = new N(), `
62
+ return this.algorithmControl = new p(), this.localeControl = new N(), this.currencyControl = new g(), this.productLayoutControl = new y(), this.filtersControl = new R(), this.shuffleControl = new _(), `
63
63
  <div class="recommendation-controls-container">
64
64
  ${this.algorithmControl.getTemplate()}
65
65
  ${this.localeControl.getTemplate()}
@@ -95,19 +95,19 @@ class $ extends h {
95
95
  });
96
96
  }
97
97
  onTemplateNodeUpdated(t) {
98
- var i;
98
+ var r;
99
99
  super.onTemplateNodeUpdated(t);
100
100
  const e = this._getRecommendationIdFromNode(t);
101
- e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((i = this.store.blockStates[e]) != null && i.isInitialized) && this._fetchBlockData(e), [
101
+ e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
102
102
  this.algorithmControl,
103
103
  this.localeControl,
104
104
  this.currencyControl,
105
105
  this.productLayoutControl,
106
106
  this.filtersControl,
107
107
  this.shuffleControl
108
- ].forEach((r) => {
108
+ ].forEach((i) => {
109
109
  var a;
110
- r != null && r.api && (r.currentNode = t, (a = r.onTemplateNodeUpdated) == null || a.call(r, t));
110
+ i != null && i.api && (i.currentNode = t, (a = i.onTemplateNodeUpdated) == null || a.call(i, t));
111
111
  });
112
112
  }
113
113
  onDestroy() {
@@ -152,13 +152,17 @@ class $ extends h {
152
152
  * values are being prepared for the upcoming initial fetch.
153
153
  */
154
154
  _syncNodeConfigToStore() {
155
- const t = f.getConfig(this.currentNode);
155
+ var r;
156
+ const t = l.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
156
157
  this.store.patchCurrentBlockConfig({
157
158
  strategy: t.strategy,
158
159
  language: t.language,
159
160
  size: t.size,
160
161
  productIds: t.productIds,
161
- filters: t.filters,
162
+ // Only sync filters from node config during initial load.
163
+ // After initialization, the Pinia store is the source of truth
164
+ // for filters (edited via the filter drawer).
165
+ ...o ? {} : { filters: t.filters },
162
166
  shuffleProducts: t.shuffleProducts,
163
167
  currencySettings: {
164
168
  name: t.currency.code,
@@ -181,26 +185,26 @@ class $ extends h {
181
185
  this.store.fetchRecommendationFilters(),
182
186
  this.store.fetchRecommendationCreateData(),
183
187
  this.store.fetchRecommendationProducts()
184
- ])).forEach((o, i) => {
188
+ ])).forEach((o, r) => {
185
189
  o.status === "rejected" && console.warn(`Recommendation block: ${[
186
190
  "fetchRecommendationFilters",
187
191
  "fetchRecommendationCreateData",
188
192
  "fetchRecommendationProducts"
189
- ][i]} failed`, o.reason);
193
+ ][r]} failed`, o.reason);
190
194
  });
191
195
  }
192
196
  /**
193
197
  * Reads the recommendation-id attribute from the block element within the node
194
198
  */
195
199
  _getRecommendationIdFromNode(t) {
196
- const e = P(t);
200
+ const e = I(t);
197
201
  if (!e || !("getAttribute" in e))
198
202
  return null;
199
203
  const o = e.getAttribute(T);
200
204
  if (!o)
201
205
  return null;
202
- const i = parseInt(o);
203
- return Number.isNaN(i) ? null : i;
206
+ const r = parseInt(o);
207
+ return Number.isNaN(r) ? null : r;
204
208
  }
205
209
  /**
206
210
  * Listen to store changes that require product refresh or regeneration.
@@ -213,12 +217,27 @@ class $ extends h {
213
217
  const { store: t } = this;
214
218
  let e = t.recommendationProducts, o = t.$state.configVersion;
215
219
  this.storeUnsubscription = t.$subscribe(() => {
216
- const i = t.$state.configVersion;
217
- i !== o && (o = i, this._debouncedFetchProducts());
218
- const r = t.recommendationProducts, a = r !== e, u = Array.isArray(r) && r.length > 0;
219
- a && u && (e = r, this._debouncedRegenerateWithProducts());
220
+ const r = t.$state.configVersion;
221
+ r !== o && (o = r, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
222
+ const i = t.recommendationProducts, a = i !== e, d = Array.isArray(i) && i.length > 0;
223
+ a && d && (e = i, this._debouncedRegenerateWithProducts());
220
224
  });
221
225
  }
226
+ /**
227
+ * Persists the current filter state from Pinia store to the Stripo node config.
228
+ * This ensures filters survive template save/reload cycles.
229
+ */
230
+ _persistFiltersToNodeConfig() {
231
+ if (!this.currentNode || !this.api)
232
+ return;
233
+ const { filters: t } = this.store.recommendationConfigs;
234
+ l.updateConfig(
235
+ this.api,
236
+ this.currentNode,
237
+ { filters: t },
238
+ "Update recommendation filters"
239
+ );
240
+ }
222
241
  }
223
242
  export {
224
243
  W as ALGORITHM_CONTROL_ID,
@@ -229,22 +248,22 @@ export {
229
248
  j as FILTERS_CONTROL_ID,
230
249
  R as FiltersControl,
231
250
  K as LOCALE_CONTROL_ID,
232
- y as LocaleControl,
251
+ N as LocaleControl,
233
252
  J as PRODUCT_LAYOUT_CONTROL_ID,
234
- _ as ProductLayoutControl,
235
- $ as RecommendationBlockControl,
253
+ y as ProductLayoutControl,
254
+ z as RecommendationBlockControl,
236
255
  X as SHUFFLE_CONTROL_ID,
237
- N as ShuffleControl,
256
+ _ as ShuffleControl,
238
257
  tt as formatProductPrice,
239
- P as getBlockElement,
258
+ I as getBlockElement,
240
259
  et as getCardComposition,
241
260
  ot as getCurrentLayout,
242
261
  rt as reapplySpacing,
243
- nt as regenerateMobileProductRows,
244
- it as regenerateProductRows,
262
+ it as regenerateMobileProductRows,
263
+ nt as regenerateProductRows,
245
264
  b as regenerateProductRowsWithStyles,
246
265
  st as setCurrencyAttributes,
247
266
  ct as updatePricesInPlace,
248
- I as updateProductContentInPlace,
267
+ P as updateProductContentInPlace,
249
268
  at as updateSingleProductContent
250
269
  };