@useinsider/guido 3.17.0-beta.668ca65 → 3.17.0-beta.a18fbda

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 (59) hide show
  1. package/README.md +5 -6
  2. package/dist/@types/config/schemas.js +6 -7
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +83 -83
  5. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  6. package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
  7. package/dist/composables/useActionsApi.js +82 -67
  8. package/dist/composables/useAutoSave.js +31 -26
  9. package/dist/composables/useCustomInterfaceAppearance.js +38 -52
  10. package/dist/composables/useEditorLock.js +20 -0
  11. package/dist/composables/useGuidoStateBridge.js +37 -31
  12. package/dist/composables/useRecommendation.js +34 -41
  13. package/dist/composables/useSave.js +39 -36
  14. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  15. package/dist/config/migrator/recommendationMigrator.js +4 -5
  16. package/dist/enums/academy.js +1 -2
  17. package/dist/enums/date.js +3 -5
  18. package/dist/enums/extensions/recommendationBlock.js +1 -3
  19. package/dist/extensions/Blocks/Recommendation/block.js +21 -26
  20. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
  21. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +166 -162
  23. package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
  24. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +79 -165
  25. package/dist/extensions/Blocks/common-control.js +19 -22
  26. package/dist/guido.css +1 -1
  27. package/dist/services/recommendationApi.js +30 -69
  28. package/dist/src/@types/config/schemas.d.ts +0 -2
  29. package/dist/src/composables/useConfig.d.ts +0 -2
  30. package/dist/src/composables/useEditorLock.d.ts +10 -0
  31. package/dist/src/composables/useRecommendation.d.ts +0 -1
  32. package/dist/src/enums/academy.d.ts +0 -1
  33. package/dist/src/enums/date.d.ts +0 -1
  34. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  35. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -2
  36. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -10
  38. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -150
  39. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  41. package/dist/src/services/recommendationApi.d.ts +1 -4
  42. package/dist/src/stores/config.d.ts +0 -18
  43. package/dist/src/stores/save-as-template.d.ts +3 -4
  44. package/dist/utils/dateUtil.js +10 -23
  45. package/dist/utils/templatePreparation.js +34 -35
  46. package/package.json +2 -3
  47. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -21
  48. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -105
  49. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +0 -19
  50. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +0 -62
  51. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -124
  52. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  53. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +0 -15
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -16
  55. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -2
  56. package/dist/static/assets/icons/line-change.svg.js +0 -5
  57. package/dist/static/assets/icons/line-delete.svg.js +0 -5
  58. package/dist/static/assets/icons/line-plus.svg.js +0 -5
  59. package/dist/static/styles/components/recommendation-strategy.css.js +0 -155
@@ -1,58 +1,53 @@
1
- var C = Object.defineProperty;
2
- var g = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
3
- var n = (d, c, t) => g(d, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as p } from "../../../../../composables/useConfig.js";
5
- import { CommonControl as y } from "../../../common-control.js";
6
- import { CURRENT_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
7
- import { RecommendationConfigService as m } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as N } from "../../store/recommendation.js";
9
- import { AlgorithmControl as I } from "./algorithm.js";
10
- import { ALGORITHM_CONTROL_ID as it } from "./algorithm.js";
1
+ var f = Object.defineProperty;
2
+ var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
+ var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
4
+ import { CommonControl as g } from "../../../common-control.js";
5
+ import { DEFAULT_NODE_CONFIG as c } from "../../constants/defaultConfig.js";
6
+ import { RecommendationConfigService as h } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
8
+ import { AlgorithmControl as N } from "./algorithm.js";
9
+ import { ALGORITHM_CONTROL_ID as tt } from "./algorithm.js";
11
10
  import { CurrencyControl as R } from "./currency.js";
12
- import { CURRENCY_CONTROL_ID as at } from "./currency.js";
13
- import { FiltersControl as b } from "./filters.js";
14
- import { FILTERS_CONTROL_ID as lt } from "./filters.js";
15
- import { LayoutOrientationControl as T } from "./layoutOrientation.js";
16
- import { LAYOUT_ORIENTATION_CONTROL_ID as dt } from "./layoutOrientation.js";
17
- import { LocaleControl as S } from "./locale.js";
18
- import { LOCALE_CONTROL_ID as ht } from "./locale.js";
19
- import { PricePlacementControl as O } from "./pricePlacement.js";
20
- import { PRICE_PLACEMENT_CONTROL_ID as Ct } from "./pricePlacement.js";
21
- import { ProductCountControl as P } from "./productCount.js";
22
- import { PRODUCT_COUNT_CONTROL_ID as pt } from "./productCount.js";
23
- import { ProductLayoutControl as L } from "./productLayout.js";
24
- import { PRODUCT_LAYOUT_CONTROL_ID as _t } from "./productLayout.js";
25
- import { ShuffleControl as k } from "./shuffle.js";
26
- import { SHUFFLE_CONTROL_ID as It } from "./shuffle.js";
27
- import { StrategyControl as E } from "./strategy.js";
28
- import { STRATEGY_CONTROL_ID as bt } from "./strategy.js";
29
- import { setCurrencyAttributes as D, getBlockElement as B, isPartnerManagedBlock as w, updateProductContentInPlace as A, regenerateProductRowsWithStyles as v } from "./utils.js";
30
- import { adjustProductsToSize as St, formatProductPrice as Ot, getCardComposition as Pt, getCurrentLayout as Lt, regenerateMobileProductRows as kt, updatePricesInPlace as Et, updateSingleProductContent as Dt } from "./utils.js";
31
- import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
32
- const x = "recommendation-id", F = "ui-elements-recommendation-block";
33
- class ot extends y {
11
+ import { CURRENCY_CONTROL_ID as ot } from "./currency.js";
12
+ import { FiltersControl as I } from "./filters.js";
13
+ import { FILTERS_CONTROL_ID as nt } from "./filters.js";
14
+ import { LayoutOrientationControl as _ } from "./layoutOrientation.js";
15
+ import { LAYOUT_ORIENTATION_CONTROL_ID as st } from "./layoutOrientation.js";
16
+ import { LocaleControl as b } from "./locale.js";
17
+ import { LOCALE_CONTROL_ID as lt } from "./locale.js";
18
+ import { PricePlacementControl as T } from "./pricePlacement.js";
19
+ import { PRICE_PLACEMENT_CONTROL_ID as ut } from "./pricePlacement.js";
20
+ import { ProductCountControl as O } from "./productCount.js";
21
+ import { PRODUCT_COUNT_CONTROL_ID as ht } from "./productCount.js";
22
+ import { ProductLayoutControl as P } from "./productLayout.js";
23
+ import { PRODUCT_LAYOUT_CONTROL_ID as Ct } from "./productLayout.js";
24
+ import { ShuffleControl as S } from "./shuffle.js";
25
+ import { SHUFFLE_CONTROL_ID as pt } from "./shuffle.js";
26
+ import { setCurrencyAttributes as L, getBlockElement as k, isPartnerManagedBlock as D, updateProductContentInPlace as E, regenerateProductRowsWithStyles as A } from "./utils.js";
27
+ import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, regenerateMobileProductRows as _t, updatePricesInPlace as bt, updateSingleProductContent as Tt } from "./utils.js";
28
+ import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
29
+ const v = "recommendation-id", w = "ui-elements-recommendation-block";
30
+ class Q extends g {
34
31
  constructor() {
35
32
  super(...arguments);
36
- n(this, "store", N());
37
- n(this, "storeUnsubscription", () => {
33
+ s(this, "store", y());
34
+ s(this, "storeUnsubscription", () => {
38
35
  });
39
- n(this, "syncedBlockIds", /* @__PURE__ */ new Set());
36
+ s(this, "syncedBlockIds", /* @__PURE__ */ new Set());
40
37
  // Sub-control instances for lifecycle management
41
- n(this, "algorithmControl", null);
42
- n(this, "localeControl", null);
43
- n(this, "currencyControl", null);
44
- n(this, "productCountControl", null);
45
- n(this, "productLayoutControl", null);
46
- n(this, "filtersControl", null);
47
- n(this, "shuffleControl", null);
48
- n(this, "pricePlacementControl", null);
49
- n(this, "layoutOrientationControl", null);
50
- n(this, "strategyControl", null);
51
- n(this, "rrsEnabled", !1);
38
+ s(this, "algorithmControl", null);
39
+ s(this, "localeControl", null);
40
+ s(this, "currencyControl", null);
41
+ s(this, "productCountControl", null);
42
+ s(this, "productLayoutControl", null);
43
+ s(this, "filtersControl", null);
44
+ s(this, "shuffleControl", null);
45
+ s(this, "pricePlacementControl", null);
46
+ s(this, "layoutOrientationControl", null);
52
47
  /**
53
48
  * Debounced product fetch to prevent rapid API calls during config changes
54
49
  */
55
- n(this, "_debouncedFetchProducts", h(() => {
50
+ s(this, "_debouncedFetchProducts", m(() => {
56
51
  this.store.fetchRecommendationProducts();
57
52
  }, 500));
58
53
  /**
@@ -66,16 +61,16 @@ class ot extends y {
66
61
  * count. The store pads products to the configured size, so in-place only
67
62
  * fails when the size actually changed.
68
63
  */
69
- n(this, "_debouncedRegenerateWithProducts", h(() => {
64
+ s(this, "_debouncedRegenerateWithProducts", m(() => {
70
65
  const t = this.store.recommendationProducts;
71
- if (!this.currentNode || !this.api || w(this.currentNode))
66
+ if (!this.currentNode || !this.api || D(this.currentNode))
72
67
  return;
73
68
  const e = this.api.getDocumentModifier();
74
- A({
69
+ E({
75
70
  currentNode: this.currentNode,
76
71
  documentModifier: e,
77
72
  products: t
78
- }) || v({
73
+ }) || A({
79
74
  currentNode: this.currentNode,
80
75
  documentModifier: e,
81
76
  products: t
@@ -83,32 +78,23 @@ class ot extends y {
83
78
  }, 100));
84
79
  }
85
80
  getId() {
86
- return F;
81
+ return w;
87
82
  }
88
- get _subControls() {
89
- return [
90
- this.layoutOrientationControl,
91
- this.productCountControl,
83
+ getTemplate() {
84
+ return this.algorithmControl = new N(), this.localeControl = new b(), this.currencyControl = new R(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new I(), this.shuffleControl = new S(), this.pricePlacementControl = new T(), this.layoutOrientationControl = new _(), [
92
85
  this.algorithmControl,
93
86
  this.localeControl,
94
87
  this.currencyControl,
88
+ this.productCountControl,
95
89
  this.productLayoutControl,
96
90
  this.filtersControl,
97
91
  this.shuffleControl,
98
92
  this.pricePlacementControl,
99
- this.strategyControl
100
- ];
101
- }
102
- getTemplate() {
103
- var t;
104
- return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
105
- var o;
106
- return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
107
- }), this.algorithmControl = new I(), this.localeControl = new S(), this.currencyControl = new R(), this.productCountControl = new P(), this.productLayoutControl = new L(), this.filtersControl = new b(), this.shuffleControl = new k(), this.pricePlacementControl = new O(), this.layoutOrientationControl = new T(), this.strategyControl = this.rrsEnabled ? new E() : null, this._subControls.forEach((e) => {
108
- e && (e.api = this.api);
93
+ this.layoutOrientationControl
94
+ ].forEach((e) => {
95
+ e.api = this.api;
109
96
  }), `
110
97
  <div class="recommendation-controls-container">
111
- ${((t = this.strategyControl) == null ? void 0 : t.getTemplate()) ?? ""}
112
98
  ${this.layoutOrientationControl.getTemplate()}
113
99
  ${this.productCountControl.getTemplate()}
114
100
  ${this.productLayoutControl.getTemplate()}
@@ -121,38 +107,50 @@ class ot extends y {
121
107
  </div>
122
108
  `;
123
109
  }
124
- _showControlsForBlock(t) {
125
- var i;
126
- const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
127
- if (!e)
128
- return;
129
- const o = this._getRecommendationIdFromNode(t) === null ? null : m.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
130
- e.classList.toggle("strategy-block", r);
131
- }
132
110
  async onRender() {
133
111
  var o;
134
112
  const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
135
- if (e !== null && this.store.setCurrentBlock(e), t !== null && !this.syncedBlockIds.has(t) && (this.syncedBlockIds.add(t), this._syncNodeConfigToStore()), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
113
+ if (e !== null && this.store.setCurrentBlock(e), t !== null && !this.syncedBlockIds.has(t) && (this.syncedBlockIds.add(t), this._syncNodeConfigToStore()), this._listenStateUpdates(), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
136
114
  this._initializeSubControls();
137
115
  return;
138
116
  }
139
117
  await this._fetchBlockData(e), this._initializeSubControls();
140
118
  }
141
119
  onTemplateNodeUpdated(t) {
142
- var o;
120
+ var r;
143
121
  super.onTemplateNodeUpdated(t);
144
122
  const e = this._getRecommendationIdFromNode(t);
145
- e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), this._showControlsForBlock(t), e !== null && !((o = this.store.blockStates[e]) != null && o.isInitialized) && this._fetchBlockData(e).then(() => {
123
+ e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e).then(() => {
146
124
  this._initializeSubControls();
147
- }), this._subControls.forEach((r) => {
125
+ }), [
126
+ this.layoutOrientationControl,
127
+ this.productCountControl,
128
+ this.algorithmControl,
129
+ this.localeControl,
130
+ this.currencyControl,
131
+ this.productLayoutControl,
132
+ this.filtersControl,
133
+ this.shuffleControl,
134
+ this.pricePlacementControl
135
+ ].forEach((n) => {
148
136
  var i;
149
- r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
137
+ n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
150
138
  });
151
139
  }
152
140
  onDestroy() {
153
- this.storeUnsubscription(), this._subControls.forEach((t) => {
154
- var e;
155
- return (e = t == null ? void 0 : t.onDestroy) == null ? void 0 : e.call(t);
141
+ this.storeUnsubscription(), [
142
+ this.layoutOrientationControl,
143
+ this.productCountControl,
144
+ this.algorithmControl,
145
+ this.localeControl,
146
+ this.currencyControl,
147
+ this.productLayoutControl,
148
+ this.filtersControl,
149
+ this.shuffleControl,
150
+ this.pricePlacementControl
151
+ ].forEach((e) => {
152
+ var o;
153
+ return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
156
154
  });
157
155
  }
158
156
  /**
@@ -160,14 +158,25 @@ class ot extends y {
160
158
  * Each sub-control manages its own form values and event listeners
161
159
  */
162
160
  _initializeSubControls() {
163
- this._subControls.forEach((t) => {
164
- var e;
165
- t && (t.api = this.api, t.currentNode = this.currentNode, (e = t.onRender) == null || e.call(t));
161
+ [
162
+ this.layoutOrientationControl,
163
+ this.productCountControl,
164
+ this.algorithmControl,
165
+ this.localeControl,
166
+ this.currencyControl,
167
+ this.productLayoutControl,
168
+ this.filtersControl,
169
+ this.shuffleControl,
170
+ this.pricePlacementControl
171
+ ].forEach((e) => {
172
+ var o;
173
+ e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
166
174
  });
167
175
  }
168
176
  /**
169
177
  * Syncs persisted node config into the Pinia store's block state.
170
178
  *
179
+ * setCurrentBlock() creates a default entry (USD, en_US, mostPopular).
171
180
  * For saved templates, the real config lives in the node (e.g., TRY, tr_TR).
172
181
  * This method reads it and patches the store so fetchRecommendationProducts()
173
182
  * uses the correct values.
@@ -177,10 +186,9 @@ class ot extends y {
177
186
  */
178
187
  _syncNodeConfigToStore() {
179
188
  var r;
180
- const t = m.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
189
+ const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
181
190
  this.store.patchCurrentBlockConfig({
182
191
  strategy: t.strategy,
183
- strategyId: t.strategyId,
184
192
  language: t.language,
185
193
  size: t.size,
186
194
  productIds: t.productIds,
@@ -241,36 +249,36 @@ class ot extends y {
241
249
  _applySmartDefaults() {
242
250
  if (!this.currentNode || !this.api)
243
251
  return;
244
- const t = m.getConfig(this.currentNode), e = {};
245
- let o = null, r = null, i = null;
246
- if (t.currency.code === a.currency.code) {
247
- const { currencyList: s } = this.store;
248
- s.length > 0 && (s.some(
249
- (u) => u.value === `price.${a.currency.code}`
250
- ) || (o = s[0].value.replace("price.", ""), e.currency = {
251
- ...a.currency,
252
+ const t = h.getConfig(this.currentNode), e = {};
253
+ let o = null, r = null, n = null;
254
+ if (t.currency.code === c.currency.code) {
255
+ const { currencyList: i } = this.store;
256
+ i.length > 0 && (i.some(
257
+ (u) => u.value === `price.${c.currency.code}`
258
+ ) || (o = i[0].value.replace("price.", ""), e.currency = {
259
+ ...c.currency,
252
260
  code: o,
253
261
  symbol: o
254
262
  }));
255
263
  }
256
- if (t.strategy === a.strategy) {
257
- const s = this.store.getActivePredictiveAlgorithms;
258
- s.length > 0 && (s.some(
259
- (u) => u.value === a.strategy
260
- ) || (r = s[0].value, e.strategy = r));
264
+ if (t.strategy === c.strategy) {
265
+ const i = this.store.getActivePredictiveAlgorithms;
266
+ i.length > 0 && (i.some(
267
+ (u) => u.value === c.strategy
268
+ ) || (r = i[0].value, e.strategy = r));
261
269
  }
262
- if (t.language === a.language) {
263
- const s = this.store.getLanguages;
264
- s.length > 0 && (s.some(
265
- (u) => u.value === a.language
266
- ) || (i = s[0].value, e.language = i));
270
+ if (t.language === c.language) {
271
+ const i = this.store.getLanguages;
272
+ i.length > 0 && (i.some(
273
+ (u) => u.value === c.language
274
+ ) || (n = i[0].value, e.language = n));
267
275
  }
268
- !o && !r && !i || (m.updateConfig(
276
+ !o && !r && !n || (h.updateConfig(
269
277
  this.api,
270
278
  this.currentNode,
271
279
  e,
272
280
  "Applied smart defaults"
273
- ), o && e.currency && D({
281
+ ), o && e.currency && L({
274
282
  currentNode: this.currentNode,
275
283
  documentModifier: this.api.getDocumentModifier(),
276
284
  currency: e.currency
@@ -280,24 +288,24 @@ class ot extends y {
280
288
  name: o,
281
289
  value: o,
282
290
  symbol: o,
283
- alignment: a.currency.alignment === "before" ? "0" : "1",
284
- decimalCount: a.currency.decimalCount.toString(),
285
- decimalSeparator: a.currency.decimalSeparator,
286
- thousandSeparator: a.currency.thousandSeparator
291
+ alignment: c.currency.alignment === "before" ? "0" : "1",
292
+ decimalCount: c.currency.decimalCount.toString(),
293
+ decimalSeparator: c.currency.decimalSeparator,
294
+ thousandSeparator: c.currency.thousandSeparator
287
295
  }
288
296
  } : {},
289
297
  ...r ? { strategy: r } : {},
290
- ...i ? { language: i } : {}
298
+ ...n ? { language: n } : {}
291
299
  }, { triggerRefetch: !1 }));
292
300
  }
293
301
  /**
294
302
  * Reads the recommendation-id attribute from the block element within the node
295
303
  */
296
304
  _getRecommendationIdFromNode(t) {
297
- const e = B(t);
305
+ const e = k(t);
298
306
  if (!e || !("getAttribute" in e))
299
307
  return null;
300
- const o = e.getAttribute(x);
308
+ const o = e.getAttribute(v);
301
309
  if (!o)
302
310
  return null;
303
311
  const r = parseInt(o);
@@ -320,68 +328,64 @@ class ot extends y {
320
328
  const { store: t } = this;
321
329
  let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
322
330
  this.storeUnsubscription = t.$subscribe(() => {
323
- const i = t.currentRecommendationId;
324
- if (i !== r) {
325
- r = i, e = t.recommendationProducts, o = t.$state.configVersion;
331
+ const n = t.currentRecommendationId;
332
+ if (n !== r) {
333
+ r = n, e = t.recommendationProducts, o = t.$state.configVersion;
326
334
  return;
327
335
  }
328
- const s = t.$state.configVersion;
329
- s !== o && (o = s, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
330
- const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
331
- u && f && (e = l, this._debouncedRegenerateWithProducts());
336
+ const i = t.$state.configVersion;
337
+ i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
338
+ const a = t.recommendationProducts, u = a !== e, C = Array.isArray(a) && a.length > 0;
339
+ u && C && (e = a, this._debouncedRegenerateWithProducts());
332
340
  });
333
341
  }
334
342
  /**
335
- * Persists filter + strategy state to the Stripo node config so it survives
336
- * save/reload (strategyId must reach esd-ext-config before any save).
337
- * `size` rides along: assigning a strategy writes it to the store only, and a
338
- * stale node config would rebuild the block against the old slot count.
343
+ * Persists the current filter state from Pinia store to the Stripo node config.
344
+ * This ensures filters survive template save/reload cycles.
339
345
  */
340
346
  _persistFiltersToNodeConfig() {
341
347
  if (!this.currentNode || !this.api)
342
348
  return;
343
- const { filters: t, strategyId: e, size: o } = this.store.recommendationConfigs, r = m.getConfig(this.currentNode);
344
- JSON.stringify(r.filters) === JSON.stringify(t) && r.strategyId === e && r.size === o || m.updateConfig(
349
+ const { filters: t } = this.store.recommendationConfigs, e = h.getConfig(this.currentNode).filters;
350
+ JSON.stringify(e) !== JSON.stringify(t) && h.updateConfig(
345
351
  this.api,
346
352
  this.currentNode,
347
- { filters: t, strategyId: e, size: o },
353
+ { filters: t },
348
354
  "Update recommendation filters"
349
355
  );
350
356
  }
351
357
  }
352
358
  export {
353
- it as ALGORITHM_CONTROL_ID,
354
- I as AlgorithmControl,
355
- F as CONTROL_BLOCK_ID,
356
- at as CURRENCY_CONTROL_ID,
359
+ tt as ALGORITHM_CONTROL_ID,
360
+ N as AlgorithmControl,
361
+ w as CONTROL_BLOCK_ID,
362
+ ot as CURRENCY_CONTROL_ID,
357
363
  R as CurrencyControl,
358
- lt as FILTERS_CONTROL_ID,
359
- b as FiltersControl,
360
- dt as LAYOUT_ORIENTATION_CONTROL_ID,
361
- ht as LOCALE_CONTROL_ID,
362
- T as LayoutOrientationControl,
363
- S as LocaleControl,
364
- Ct as PRICE_PLACEMENT_CONTROL_ID,
365
- pt as PRODUCT_COUNT_CONTROL_ID,
366
- _t as PRODUCT_LAYOUT_CONTROL_ID,
367
- O as PricePlacementControl,
368
- P as ProductCountControl,
369
- L as ProductLayoutControl,
370
- ot as RecommendationBlockControl,
371
- It as SHUFFLE_CONTROL_ID,
372
- bt as STRATEGY_CONTROL_ID,
373
- k as ShuffleControl,
374
- E as StrategyControl,
375
- St as adjustProductsToSize,
376
- Ot as formatProductPrice,
377
- B as getBlockElement,
378
- Pt as getCardComposition,
379
- Lt as getCurrentLayout,
380
- w as isPartnerManagedBlock,
381
- kt as regenerateMobileProductRows,
382
- v as regenerateProductRowsWithStyles,
383
- D as setCurrencyAttributes,
384
- Et as updatePricesInPlace,
385
- A as updateProductContentInPlace,
386
- Dt as updateSingleProductContent
364
+ nt as FILTERS_CONTROL_ID,
365
+ I as FiltersControl,
366
+ st as LAYOUT_ORIENTATION_CONTROL_ID,
367
+ lt as LOCALE_CONTROL_ID,
368
+ _ as LayoutOrientationControl,
369
+ b as LocaleControl,
370
+ ut as PRICE_PLACEMENT_CONTROL_ID,
371
+ ht as PRODUCT_COUNT_CONTROL_ID,
372
+ Ct as PRODUCT_LAYOUT_CONTROL_ID,
373
+ T as PricePlacementControl,
374
+ O as ProductCountControl,
375
+ P as ProductLayoutControl,
376
+ Q as RecommendationBlockControl,
377
+ pt as SHUFFLE_CONTROL_ID,
378
+ S as ShuffleControl,
379
+ yt as adjustProductsToSize,
380
+ Nt as formatProductPrice,
381
+ k as getBlockElement,
382
+ Rt as getCardComposition,
383
+ It as getCurrentLayout,
384
+ D as isPartnerManagedBlock,
385
+ _t as regenerateMobileProductRows,
386
+ A as regenerateProductRowsWithStyles,
387
+ L as setCurrencyAttributes,
388
+ bt as updatePricesInPlace,
389
+ E as updateProductContentInPlace,
390
+ Tt as updateSingleProductContent
387
391
  };
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as h } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { PRE_RRS_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as c } from "../constants/defaultConfig.js";
1
+ import { ModificationDescription as C } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CURRENT_CONFIG_VERSION as l, DEFAULT_NODE_CONFIG as c } from "../constants/defaultConfig.js";
3
3
  import { setCurrencyAttributes as D } from "../controls/main/utils.js";
4
- import { hasMinimalConfig as S } from "../types/nodeConfig.js";
5
- function A(n) {
6
- return n === "." || n === "," || n === " ";
4
+ import { hasMinimalConfig as A } from "../types/nodeConfig.js";
5
+ function S(e) {
6
+ return e === "." || e === "," || e === " ";
7
7
  }
8
- function N(n) {
9
- return n === "." || n === "," || n === " " || n === "";
8
+ function N(e) {
9
+ return e === "." || e === "," || e === " " || e === "";
10
10
  }
11
- class F {
11
+ class M {
12
12
  // ========================================================================
13
13
  // Read Operations
14
14
  // ========================================================================
@@ -48,7 +48,7 @@ class F {
48
48
  return !1;
49
49
  try {
50
50
  const t = i.getNodeConfig();
51
- return S(t);
51
+ return A(t);
52
52
  } catch {
53
53
  return !1;
54
54
  }
@@ -82,9 +82,9 @@ class F {
82
82
  * @param description - Human-readable description for undo/redo
83
83
  * @returns The new complete configuration
84
84
  */
85
- static updateConfig(i, t, o, e) {
85
+ static updateConfig(i, t, o, n) {
86
86
  const r = this.getConfig(t), u = this.deepMerge(r, o);
87
- return this.saveConfig(i, t, u, e), u;
87
+ return this.saveConfig(i, t, u, n), u;
88
88
  }
89
89
  /**
90
90
  * Initialize configuration for a new block
@@ -107,12 +107,12 @@ class F {
107
107
  static initializeConfig(i, t, o) {
108
108
  if (this.hasConfig(t))
109
109
  return { config: o ? this.updateConfig(i, t, o, "Initialize recommendation block") : this.getConfig(t), wasFreshDrop: !1 };
110
- const e = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
111
- return this.saveConfig(i, t, e, "Initialize recommendation block"), D({
110
+ const n = o ? this.mergeWithDefaults(o) : this.cloneDefaults();
111
+ return this.saveConfig(i, t, n, "Initialize recommendation block"), D({
112
112
  currentNode: t,
113
113
  documentModifier: i.getDocumentModifier(),
114
- currency: e.currency
115
- }), { config: e, wasFreshDrop: !0 };
114
+ currency: n.currency
115
+ }), { config: n, wasFreshDrop: !0 };
116
116
  }
117
117
  /**
118
118
  * Save complete configuration to a node
@@ -123,9 +123,9 @@ class F {
123
123
  * @param config - Complete configuration to save
124
124
  * @param description - Human-readable description for undo/redo
125
125
  */
126
- static saveConfig(i, t, o, e) {
126
+ static saveConfig(i, t, o, n) {
127
127
  try {
128
- i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new h(e));
128
+ i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new C(n));
129
129
  } catch (r) {
130
130
  console.warn("[RecommendationConfigService] Failed to save config:", r);
131
131
  }
@@ -154,33 +154,33 @@ class F {
154
154
  */
155
155
  static migrateFromDataAttributes(i, t) {
156
156
  const o = {
157
- configVersion: C
157
+ configVersion: l
158
158
  };
159
159
  if ("getAttribute" in t && typeof t.getAttribute == "function") {
160
- const e = t.getAttribute("esd-ext-config");
161
- if (e)
160
+ const n = t.getAttribute("esd-ext-config");
161
+ if (n)
162
162
  try {
163
- const s = JSON.parse(e);
164
- s && typeof s == "object" && Object.assign(o, s);
163
+ const s = JSON.parse(n);
164
+ s && typeof s == "object" && (Object.assign(o, s), o.configVersion = l);
165
165
  } catch {
166
166
  }
167
167
  const r = t.getAttribute("data-layout");
168
168
  r === "list" || r === "horizontal" ? o.layout = "list" : (r === "grid" || r === "vertical") && (o.layout = "grid");
169
169
  const u = t.getAttribute("data-card-composition");
170
170
  u && (o.composition = u.split(",").filter(Boolean));
171
- const l = t.getAttribute("data-column-spacing");
172
- l && (o.columnSpacing = parseInt(l) || c.columnSpacing);
173
- const b = t.getAttribute("data-row-spacing");
174
- if (b && (o.rowSpacing = parseInt(b) || c.rowSpacing), !o.currency) {
175
- const s = t.getAttribute("currency"), p = t.getAttribute("currency-symbol"), y = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
176
- if (s || p || y || f || g || m) {
177
- const a = c.currency, d = m ? parseInt(m) : NaN;
171
+ const b = t.getAttribute("data-column-spacing");
172
+ b && (o.columnSpacing = parseInt(b) || c.columnSpacing);
173
+ const p = t.getAttribute("data-row-spacing");
174
+ if (p && (o.rowSpacing = parseInt(p) || c.rowSpacing), !o.currency) {
175
+ const s = t.getAttribute("currency"), y = t.getAttribute("currency-symbol"), d = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
176
+ if (s || y || d || f || g || m) {
177
+ const a = c.currency, h = m ? parseInt(m) : NaN;
178
178
  o.currency = {
179
179
  code: s ?? a.code,
180
- symbol: p ?? a.symbol,
181
- alignment: y === "0" ? "before" : "after",
182
- decimalCount: Number.isFinite(d) ? d : a.decimalCount,
183
- decimalSeparator: A(g) ? g : a.decimalSeparator,
180
+ symbol: y ?? a.symbol,
181
+ alignment: d === "0" ? "before" : "after",
182
+ decimalCount: Number.isFinite(h) ? h : a.decimalCount,
183
+ decimalSeparator: S(g) ? g : a.decimalSeparator,
184
184
  thousandSeparator: N(f) ? f : a.thousandSeparator
185
185
  };
186
186
  }
@@ -194,7 +194,7 @@ class F {
194
194
  * @returns True if migration is needed
195
195
  */
196
196
  static needsMigration(i) {
197
- return i ? !this.hasConfig(i) : !1;
197
+ return i ? this.hasConfig(i) ? this.getConfigVersion(i) < l : !0 : !1;
198
198
  }
199
199
  // ========================================================================
200
200
  // Internal Helpers
@@ -279,5 +279,5 @@ class F {
279
279
  }
280
280
  }
281
281
  export {
282
- F as RecommendationConfigService
282
+ M as RecommendationConfigService
283
283
  };