@useinsider/guido 3.22.0-beta.3f91a42 → 3.22.0-beta.53526b4

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 (30) hide show
  1. package/dist/config/migrator/couponBlockAlignmentMigrator.js +55 -0
  2. package/dist/config/migrator/index.js +14 -13
  3. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -14
  4. package/dist/extensions/Blocks/Items/controls/cardComposition.js +17 -14
  5. package/dist/extensions/Blocks/Items/controls/image/link.js +17 -14
  6. package/dist/extensions/Blocks/Items/controls/name/trimming.js +10 -9
  7. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  8. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +13 -12
  9. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -29
  10. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +16 -15
  11. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -25
  12. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +28 -27
  13. package/dist/extensions/Blocks/Items/controls/settingsControl.js +80 -75
  14. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  15. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
  16. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  17. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +116 -121
  18. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  19. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  20. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  21. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  22. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  23. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  24. package/dist/extensions/Blocks/common-control.js +55 -62
  25. package/dist/package.json.js +1 -1
  26. package/dist/src/config/migrator/couponBlockAlignmentMigrator.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -3
  29. package/dist/src/extensions/Blocks/common-control.d.ts +0 -2
  30. package/package.json +1 -1
@@ -4,7 +4,7 @@ var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
4
4
  import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
5
5
  import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as ut } from "../../../common-control.js";
7
- import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
7
+ import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as z, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as G, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
8
8
  import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
9
9
  import { RecommendationConfigService as T } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
@@ -142,7 +142,7 @@ class se extends ut {
142
142
  `;
143
143
  }
144
144
  onRender() {
145
- this.forgetLastPanelNode(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges();
145
+ this._initializeComposition(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges(), this._syncDisabledState();
146
146
  }
147
147
  /**
148
148
  * Card composition restructures the block (toggles/reorders/adds attribute
@@ -230,7 +230,7 @@ class se extends ut {
230
230
  }
231
231
  _hasTitle() {
232
232
  var t;
233
- return !!((t = this.currentNode) != null && t.querySelector(G));
233
+ return !!((t = this.currentNode) != null && t.querySelector(z));
234
234
  }
235
235
  _getDefaultVisibilities() {
236
236
  return { ...X };
@@ -712,7 +712,7 @@ class se extends ut {
712
712
  );
713
713
  }
714
714
  ).join(""), ot = Ct(x, l).repeat(S - B);
715
- return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
715
+ return `<tr class="${G}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
716
716
  }
717
717
  return this._getExistingRowHtml(u, j);
718
718
  }).join("");
@@ -867,7 +867,7 @@ class se extends ut {
867
867
  return t.length > 0 ? t : this._findTitleRowsByClass();
868
868
  }
869
869
  _findTitleRowsByClass() {
870
- const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(G));
870
+ const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(z));
871
871
  if (r === -1)
872
872
  return [];
873
873
  const i = e[r + 1];
@@ -974,7 +974,7 @@ class se extends ut {
974
974
  const r = this.store.recommendationConfigs.orientation;
975
975
  r !== t && (t = r, this._updateOrderableState());
976
976
  const i = Object.keys(this.store.filterList).sort().join(",");
977
- i !== e && (e = i, this.currentNode && this._initializeComposition());
977
+ i !== e && (e = i, this._initializeComposition());
978
978
  });
979
979
  }
980
980
  /**
@@ -1027,7 +1027,7 @@ class se extends ut {
1027
1027
  [i]: e,
1028
1028
  product_attributes: { [i]: e }
1029
1029
  }, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
1030
- return `<tr class="${z}" ${R}="${r}" ${D}="1">${l}</tr>`;
1030
+ return `<tr class="${G}" ${R}="${r}" ${D}="1">${l}</tr>`;
1031
1031
  }
1032
1032
  }
1033
1033
  export {
@@ -1,15 +1,15 @@
1
1
  import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as l } from "../../../common-control.js";
2
+ import { CommonControl as m } from "../../../common-control.js";
3
3
  import { RecommendationBlockId as n } from "../../constants/blockIds.js";
4
- import { RecommendationControlId as m } from "../../constants/controlIds.js";
4
+ import { RecommendationControlId as l } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
6
- import { CSS_CLASS_TEXT_TRIM as s, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
6
+ import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
7
7
  const i = {
8
8
  TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
9
9
  };
10
- class C extends l {
10
+ class g extends m {
11
11
  getId() {
12
- return m.CUSTOM_ATTR_TEXT_TRIM;
12
+ return l.CUSTOM_ATTR_TEXT_TRIM;
13
13
  }
14
14
  getTemplate() {
15
15
  return `
@@ -23,7 +23,7 @@ class C extends l {
23
23
  `;
24
24
  }
25
25
  onRender() {
26
- this.forgetLastPanelNode(), this._listenToFormUpdates();
26
+ this._setFormValues(), this._listenToFormUpdates();
27
27
  }
28
28
  onTemplateNodeUpdated(t) {
29
29
  super.onTemplateNodeUpdated(t), this._setFormValues();
@@ -39,10 +39,10 @@ class C extends l {
39
39
  _getCurrentTrimState() {
40
40
  if (!this.currentNode || !("hasClass" in this.currentNode))
41
41
  return !1;
42
- if (this.currentNode.hasClass(s))
42
+ if (this.currentNode.hasClass(o))
43
43
  return !0;
44
44
  const t = this._getTargetElements();
45
- return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(s) : !1;
45
+ return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(o) : !1;
46
46
  }
47
47
  // ========================================================================
48
48
  // Target Element Discovery (per-attribute scoping)
@@ -62,8 +62,8 @@ class C extends l {
62
62
  return [];
63
63
  const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
64
64
  if (e) {
65
- const o = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
66
- return Array.from(t.querySelectorAll(o));
65
+ const s = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
66
+ return Array.from(t.querySelectorAll(s));
67
67
  }
68
68
  return Array.from(
69
69
  t.querySelectorAll(
@@ -80,8 +80,8 @@ class C extends l {
80
80
  return;
81
81
  t && c(this.api);
82
82
  const r = this.api.getDocumentModifier();
83
- e.forEach((o) => {
84
- t ? r.modifyHtml(o).setClass(s) : r.modifyHtml(o).removeClass(s);
83
+ e.forEach((s) => {
84
+ t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
85
85
  }), r.apply(
86
86
  new T(
87
87
  t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
@@ -95,5 +95,5 @@ class C extends l {
95
95
  }
96
96
  }
97
97
  export {
98
- C as CustomAttributeTextTrimControl
98
+ g as CustomAttributeTextTrimControl
99
99
  };
@@ -1,6 +1,6 @@
1
1
  var _ = Object.defineProperty;
2
- var N = (u, c, e) => c in u ? _(u, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[c] = e;
3
- var s = (u, c, e) => N(u, typeof c != "symbol" ? c + "" : c, e);
2
+ var N = (u, d, e) => d in u ? _(u, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[d] = e;
3
+ var s = (u, d, e) => N(u, typeof d != "symbol" ? d + "" : d, e);
4
4
  import { useConfig as g } from "../../../../../composables/useConfig.js";
5
5
  import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as P } from "../../../common-control.js";
@@ -9,10 +9,10 @@ import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
9
9
  import { RecommendationConfigService as l } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as k } from "../../store/recommendation.js";
11
11
  import { refreshBlockOutsidePanel as S } from "../../utils/blockRefresh.js";
12
- import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as L } from "../../utils/nodeConfigWriter.js";
12
+ import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as F } from "../../utils/nodeConfigWriter.js";
13
13
  import { AlgorithmControl as E } from "./algorithm.js";
14
14
  import { ALGORITHM_CONTROL_ID as _e } from "./algorithm.js";
15
- import { CurrencyControl as F } from "./currency.js";
15
+ import { CurrencyControl as L } from "./currency.js";
16
16
  import { CURRENCY_CONTROL_ID as ye } from "./currency.js";
17
17
  import { FiltersControl as D } from "./filters.js";
18
18
  import { FILTERS_CONTROL_ID as Re } from "./filters.js";
@@ -20,18 +20,18 @@ import { LayoutOrientationControl as U } from "./layoutOrientation.js";
20
20
  import { LAYOUT_ORIENTATION_CONTROL_ID as ke } from "./layoutOrientation.js";
21
21
  import { LocaleControl as v } from "./locale.js";
22
22
  import { LOCALE_CONTROL_ID as Te } from "./locale.js";
23
- import { PricePlacementControl as A } from "./pricePlacement.js";
23
+ import { PricePlacementControl as w } from "./pricePlacement.js";
24
24
  import { PRICE_PLACEMENT_CONTROL_ID as be } from "./pricePlacement.js";
25
- import { ProductCountControl as w } from "./productCount.js";
26
- import { PRODUCT_COUNT_CONTROL_ID as Le } from "./productCount.js";
25
+ import { ProductCountControl as A } from "./productCount.js";
26
+ import { PRODUCT_COUNT_CONTROL_ID as Fe } from "./productCount.js";
27
27
  import { ProductLayoutControl as V } from "./productLayout.js";
28
- import { PRODUCT_LAYOUT_CONTROL_ID as Fe } from "./productLayout.js";
28
+ import { PRODUCT_LAYOUT_CONTROL_ID as Le } from "./productLayout.js";
29
29
  import { ShuffleControl as W } from "./shuffle.js";
30
30
  import { SHUFFLE_CONTROL_ID as Ue } from "./shuffle.js";
31
31
  import { StrategyControl as x } from "./strategy.js";
32
- import { STRATEGY_CONTROL_ID as Ae } from "./strategy.js";
33
- import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as $, updateProductContentInPlace as z, regenerateProductRowsWithStyles as H } from "./utils.js";
34
- import { adjustProductsToSize as Ve, formatProductPrice as We, getCardComposition as xe, getCurrentLayout as Me, getMainContainerTbody as Ge, regenerateMobileProductRows as $e, updatePricesInPlace as ze, updateSingleProductContent as He } from "./utils.js";
32
+ import { STRATEGY_CONTROL_ID as we } from "./strategy.js";
33
+ import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as z, updateProductContentInPlace as $, regenerateProductRowsWithStyles as H } from "./utils.js";
34
+ import { adjustProductsToSize as Ve, formatProductPrice as We, getCardComposition as xe, getCurrentLayout as Me, getMainContainerTbody as Ge, regenerateMobileProductRows as ze, updatePricesInPlace as $e, updateSingleProductContent as He } from "./utils.js";
35
35
  import { useDebounceFn as C } from "../../../../../node_modules/@vueuse/shared/index.js";
36
36
  const f = "Update recommendation filters", Y = "ui-elements-recommendation-block";
37
37
  class me extends P {
@@ -69,11 +69,11 @@ class me extends P {
69
69
  s(this, "_debouncedFetchProducts", C(async (e, t) => {
70
70
  if (t !== this.panelGeneration)
71
71
  return;
72
- const n = this._getBlockConfigVersion(e);
72
+ const o = this._getBlockConfigVersion(e);
73
73
  try {
74
- await (e === null ? this.store.fetchRecommendationProducts() : this.store.fetchRecommendationProductsForBlock(e)), t === this.panelGeneration && (this.fetchedConfigVersion = Math.max(this.fetchedConfigVersion, n));
74
+ await (e === null ? this.store.fetchRecommendationProducts() : this.store.fetchRecommendationProductsForBlock(e)), t === this.panelGeneration && (this.fetchedConfigVersion = Math.max(this.fetchedConfigVersion, o));
75
75
  } finally {
76
- t === this.panelGeneration && n === this._getBlockConfigVersion(e) && this._scheduleConfigFlush();
76
+ t === this.panelGeneration && o === this._getBlockConfigVersion(e) && this._scheduleConfigFlush();
77
77
  }
78
78
  }, 500));
79
79
  /**
@@ -90,8 +90,8 @@ class me extends P {
90
90
  s(this, "_debouncedRegenerateWithProducts", C((e) => {
91
91
  if (e !== this.panelGeneration || !this.currentNode || !this.api)
92
92
  return;
93
- const t = this._getRecommendationIdFromNode(this.currentNode), n = this.store.currentRecommendationId;
94
- if (t === null || n === null || t === n || !this.store.blockStates[t]) {
93
+ const t = this._getRecommendationIdFromNode(this.currentNode), o = this.store.currentRecommendationId;
94
+ if (t === null || o === null || t === o || !this.store.blockStates[t]) {
95
95
  this.hasUnrenderedProducts = !1, this._regenerateWithProducts();
96
96
  return;
97
97
  }
@@ -100,7 +100,7 @@ class me extends P {
100
100
  try {
101
101
  this._regenerateWithProducts();
102
102
  } finally {
103
- this.store.setCurrentBlock(n);
103
+ this.store.setCurrentBlock(o);
104
104
  }
105
105
  }
106
106
  }, 100));
@@ -125,9 +125,9 @@ class me extends P {
125
125
  getTemplate() {
126
126
  var e;
127
127
  return this.rrsEnabled = g().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
128
- var n;
129
- return (n = t == null ? void 0 : t.onDestroy) == null ? void 0 : n.call(t);
130
- }), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new F(), this.productCountControl = new w(), this.productLayoutControl = new V(), this.filtersControl = new D(), this.shuffleControl = new W(), this.pricePlacementControl = new A(), this.layoutOrientationControl = new U(), this.strategyControl = this.rrsEnabled ? new x() : null, this._subControls.forEach((t) => {
128
+ var o;
129
+ return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(t);
130
+ }), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new L(), this.productCountControl = new A(), this.productLayoutControl = new V(), this.filtersControl = new D(), this.shuffleControl = new W(), this.pricePlacementControl = new w(), this.layoutOrientationControl = new U(), this.strategyControl = this.rrsEnabled ? new x() : null, this._subControls.forEach((t) => {
131
131
  t && (t.api = this.api);
132
132
  }), `
133
133
  <div class="recommendation-controls-container">
@@ -149,25 +149,32 @@ class me extends P {
149
149
  const t = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
150
150
  if (!t)
151
151
  return;
152
- const n = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), o = this.rrsEnabled && !!n && (!!(n != null && n.strategyId) || ((n == null ? void 0 : n.configVersion) ?? 0) >= R), i = this.rrsEnabled && !!n && !o;
153
- t.classList.toggle("strategy-block", o), t.classList.toggle("legacy-strategy-block", i);
152
+ const o = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= R), i = this.rrsEnabled && !!o && !n;
153
+ t.classList.toggle("strategy-block", n), t.classList.toggle("legacy-strategy-block", i);
154
154
  }
155
- onRender() {
156
- T(this.api), this.forgetLastPanelNode(), this._listenStateUpdates();
155
+ async onRender() {
156
+ var o;
157
+ T(this.api);
158
+ const e = this._getRecommendationIdFromNode(this.currentNode), t = e ?? this.store.currentRecommendationId;
159
+ if (t !== null && this.store.setCurrentBlock(t), e !== null && this._syncNodeConfigIfChanged(e), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender()), t !== null && ((o = this.store.blockStates[t]) != null && o.isInitialized)) {
160
+ this._initializeSubControls();
161
+ return;
162
+ }
163
+ await this._fetchBlockData(t), this._initializeSubControls();
157
164
  }
158
165
  onTemplateNodeUpdated(e) {
159
- var n;
166
+ var o;
160
167
  super.onTemplateNodeUpdated(e);
161
168
  const t = this._getRecommendationIdFromNode(e);
162
- t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), this._renderWithPanelNode(t), t !== null && !((n = this.store.blockStates[t]) != null && n.isInitialized) && this._fetchBlockData(t).then(() => {
169
+ t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), t !== null && !((o = this.store.blockStates[t]) != null && o.isInitialized) && this._fetchBlockData(t).then(() => {
163
170
  this._initializeSubControls();
164
- }), this._subControls.forEach((o) => {
171
+ }), this._subControls.forEach((n) => {
165
172
  var i;
166
- o != null && o.api && (o.currentNode = e, (i = o.onTemplateNodeUpdated) == null || i.call(o, e));
173
+ n != null && n.api && (n.currentNode = e, (i = n.onTemplateNodeUpdated) == null || i.call(n, e));
167
174
  });
168
175
  }
169
176
  onDestroy() {
170
- this.panelGeneration++, this.isPanelAlive = !1, this.isAwaitingPanelNode = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
177
+ this.panelGeneration++, this.isPanelAlive = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
171
178
  var t;
172
179
  return (t = e == null ? void 0 : e.onDestroy) == null ? void 0 : t.call(e);
173
180
  });
@@ -177,23 +184,11 @@ class me extends P {
177
184
  * Each sub-control manages its own form values and event listeners
178
185
  */
179
186
  _initializeSubControls() {
180
- this.currentNode && this._subControls.forEach((e) => {
187
+ this._subControls.forEach((e) => {
181
188
  var t;
182
189
  e && (e.api = this.api, e.currentNode = this.currentNode, (t = e.onRender) == null || t.call(e));
183
190
  });
184
191
  }
185
- // The panel's own node, not the store's last focused block, decides what to render; the caller
186
- // fetches an uninitialized block once its config is synced.
187
- _renderWithPanelNode(e) {
188
- var t;
189
- if (!(!this.isAwaitingPanelNode || e === null)) {
190
- if (this.isAwaitingPanelNode = !1, (t = this.store.blockStates[e]) != null && t.isInitialized) {
191
- this._initializeSubControls();
192
- return;
193
- }
194
- this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender());
195
- }
196
- }
197
192
  /**
198
193
  * Syncs persisted node config into the Pinia store's block state.
199
194
  *
@@ -224,8 +219,8 @@ class me extends P {
224
219
  const t = this.store.blockStates[e];
225
220
  if (!t)
226
221
  return;
227
- const n = JSON.stringify(l.getConfig(this.currentNode)), o = t.syncedConfigFingerprint;
228
- t.syncedConfigFingerprint = n, o !== n && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
222
+ const o = JSON.stringify(l.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
223
+ t.syncedConfigFingerprint = o, n !== o && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
229
224
  }
230
225
  /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
231
226
  _isPendingStrategyIdChange() {
@@ -245,15 +240,15 @@ class me extends P {
245
240
  return !e || t !== null && e.blockId !== t ? null : e;
246
241
  }
247
242
  _getNodeConfigUpdates(e) {
248
- const { filters: t, strategy: n, strategyId: o, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: d } = g();
243
+ const { filters: t, strategy: o, strategyId: n, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: c } = g();
249
244
  return {
250
245
  filters: t,
251
- strategy: n,
252
- strategyId: o,
246
+ strategy: o,
247
+ strategyId: n,
253
248
  size: i,
254
249
  productIds: r,
255
250
  configVersion: h,
256
- ...d.value ? { partnerName: d.value } : {}
251
+ ...c.value ? { partnerName: c.value } : {}
257
252
  };
258
253
  }
259
254
  /**
@@ -292,8 +287,8 @@ class me extends P {
292
287
  const e = this.pendingNodeConfigWrite;
293
288
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !(!e || !this.api)) {
294
289
  if (e.blockId !== this.store.currentRecommendationId || !this.currentNode) {
295
- const { blockId: t, updates: n } = e;
296
- !m(t, n, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
290
+ const { blockId: t, updates: o } = e;
291
+ !m(t, o, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
297
292
  return;
298
293
  }
299
294
  O(this.currentNode, e.updates) && l.updateConfig(
@@ -312,11 +307,11 @@ class me extends P {
312
307
  _pendingDescription() {
313
308
  const e = this._pendingWriteForNode();
314
309
  if (!(!e || !this.currentNode || !B(this.currentNode, e.updates)))
315
- return L;
310
+ return F;
316
311
  }
317
312
  _syncNodeConfigToStore() {
318
- var o;
319
- const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, n = t !== null && ((o = this.store.blockStates[t]) == null ? void 0 : o.isInitialized);
313
+ var n;
314
+ const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
320
315
  this.store.patchCurrentBlockConfig({
321
316
  strategy: e.strategy,
322
317
  strategyId: e.strategyId,
@@ -331,7 +326,7 @@ class me extends P {
331
326
  // Only sync filters from node config during initial load.
332
327
  // After initialization, the Pinia store is the source of truth
333
328
  // for filters (edited via the filter drawer).
334
- ...n ? {} : { filters: e.filters },
329
+ ...o ? {} : { filters: e.filters },
335
330
  shuffleProducts: e.shuffleProducts,
336
331
  priceMovedToNextLine: e.priceMovedToNextLine,
337
332
  priceHideIfSameAsDiscounted: e.priceHideIfSameAsDiscounted,
@@ -352,27 +347,27 @@ class me extends P {
352
347
  * 2. Smart defaults for new blocks (currency, algorithm) — sequential
353
348
  * 3. Product data with correct defaults — sequential
354
349
  *
355
- * Called from onTemplateNodeUpdated() once the node config is synced.
350
+ * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
356
351
  * Marks the block as initialized to prevent redundant fetches on re-selection.
357
352
  */
358
353
  async _fetchBlockData(e) {
359
354
  if (e !== null && this.store.markBlockInitialized(e), (await Promise.allSettled([
360
355
  this.store.fetchRecommendationCreateData(),
361
356
  this.store.fetchRecommendationFilters()
362
- ])).forEach((o, i) => {
363
- o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][i]} failed`, o.reason);
357
+ ])).forEach((n, i) => {
358
+ n.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][i]} failed`, n.reason);
364
359
  }), e !== null && this.store.currentRecommendationId !== e) {
365
360
  this._refreshOutsidePanel(e, !0);
366
361
  return;
367
362
  }
368
363
  this._applySmartDefaults();
369
- const n = this._getBlockConfigVersion(e);
364
+ const o = this._getBlockConfigVersion(e);
370
365
  try {
371
366
  await this.store.fetchRecommendationProducts();
372
- } catch (o) {
373
- console.warn("Recommendation block: fetchRecommendationProducts failed", o);
367
+ } catch (n) {
368
+ console.warn("Recommendation block: fetchRecommendationProducts failed", n);
374
369
  }
375
- e !== null && !this._isPanelOn(e) && this._refreshOutsidePanel(e, this._getBlockConfigVersion(e) !== n);
370
+ e !== null && !this._isPanelOn(e) && this._refreshOutsidePanel(e, this._getBlockConfigVersion(e) !== o);
376
371
  }
377
372
  _isPanelOn(e) {
378
373
  return this.isPanelAlive && this.store.currentRecommendationId === e;
@@ -391,51 +386,51 @@ class me extends P {
391
386
  if (!this.currentNode || !this.api)
392
387
  return;
393
388
  const e = l.getConfig(this.currentNode), t = {};
394
- let n = null, o = null, i = null;
389
+ let o = null, n = null, i = null;
395
390
  if (e.currency.code === a.currency.code) {
396
391
  const { currencyList: r } = this.store;
397
392
  r.length > 0 && (r.some(
398
- (d) => d.value === `price.${a.currency.code}`
399
- ) || (n = r[0].value.replace("price.", ""), t.currency = {
393
+ (c) => c.value === `price.${a.currency.code}`
394
+ ) || (o = r[0].value.replace("price.", ""), t.currency = {
400
395
  ...a.currency,
401
- code: n,
402
- symbol: n
396
+ code: o,
397
+ symbol: o
403
398
  }));
404
399
  }
405
400
  if (e.strategy === a.strategy) {
406
401
  const r = this.store.getActivePredictiveAlgorithms;
407
402
  r.length > 0 && (r.some(
408
- (d) => d.value === a.strategy
409
- ) || (o = r[0].value, t.strategy = o));
403
+ (c) => c.value === a.strategy
404
+ ) || (n = r[0].value, t.strategy = n));
410
405
  }
411
406
  if (e.language === a.language) {
412
407
  const r = this.store.getLanguages;
413
408
  r.length > 0 && (r.some(
414
- (d) => d.value === a.language
409
+ (c) => c.value === a.language
415
410
  ) || (i = r[0].value, t.language = i));
416
411
  }
417
- !n && !o && !i || (l.updateConfig(
412
+ !o && !n && !i || (l.updateConfig(
418
413
  this.api,
419
414
  this.currentNode,
420
415
  t,
421
416
  "Applied smart defaults"
422
- ), n && t.currency && M({
417
+ ), o && t.currency && M({
423
418
  currentNode: this.currentNode,
424
419
  documentModifier: this.api.getDocumentModifier(),
425
420
  currency: t.currency
426
421
  }), this.store.patchCurrentBlockConfig({
427
- ...n ? {
422
+ ...o ? {
428
423
  currencySettings: {
429
- name: n,
430
- value: n,
431
- symbol: n,
424
+ name: o,
425
+ value: o,
426
+ symbol: o,
432
427
  alignment: a.currency.alignment === "before" ? "0" : "1",
433
428
  decimalCount: a.currency.decimalCount.toString(),
434
429
  decimalSeparator: a.currency.decimalSeparator,
435
430
  thousandSeparator: a.currency.thousandSeparator
436
431
  }
437
432
  } : {},
438
- ...o ? { strategy: o } : {},
433
+ ...n ? { strategy: n } : {},
439
434
  ...i ? { language: i } : {}
440
435
  }, { triggerRefetch: !1 }));
441
436
  }
@@ -446,30 +441,30 @@ class me extends P {
446
441
  const t = G(e);
447
442
  if (!t || !("getAttribute" in t))
448
443
  return null;
449
- const n = t.getAttribute(I);
450
- if (!n)
444
+ const o = t.getAttribute(I);
445
+ if (!o)
451
446
  return null;
452
- const o = parseInt(n);
453
- return Number.isNaN(o) ? null : o;
447
+ const n = parseInt(o);
448
+ return Number.isNaN(n) ? null : n;
454
449
  }
455
450
  /**
456
451
  * Lands what the panel still owes its block before it stops watching it: the config now, the
457
452
  * products through a block-scoped refresh. Never throws — it runs from Stripo's teardown.
458
453
  */
459
- _finishBlockOutsidePanel({ blockId: e, fetchedConfigVersion: t, hasUnrenderedProducts: n } = this._trackedBlockSnapshot()) {
454
+ _finishBlockOutsidePanel({ blockId: e, fetchedConfigVersion: t, hasUnrenderedProducts: o } = this._trackedBlockSnapshot()) {
460
455
  try {
461
456
  this._flushPendingNodeConfig();
462
- const o = e === null ? void 0 : this.store.blockStates[e];
463
- if (e === null || !o)
457
+ const n = e === null ? void 0 : this.store.blockStates[e];
458
+ if (e === null || !n)
464
459
  return;
465
- const i = t !== o.configVersion;
460
+ const i = t !== n.configVersion;
466
461
  i && !m(
467
462
  e,
468
- this._getNodeConfigUpdates(o.recommendationConfigs),
463
+ this._getNodeConfigUpdates(n.recommendationConfigs),
469
464
  f
470
- ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || n) && this._refreshOutsidePanel(e, i);
471
- } catch (o) {
472
- console.error("[recommendation] finishing the block outside the panel failed", o);
465
+ ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || o) && this._refreshOutsidePanel(e, i);
466
+ } catch (n) {
467
+ console.error("[recommendation] finishing the block outside the panel failed", n);
473
468
  }
474
469
  }
475
470
  _trackedBlockSnapshot() {
@@ -481,13 +476,13 @@ class me extends P {
481
476
  }
482
477
  _refreshOutsidePanel(e, t) {
483
478
  S(e, {
484
- pickUpdates: (n) => this._getNodeConfigUpdates(n),
479
+ pickUpdates: (o) => this._getNodeConfigUpdates(o),
485
480
  description: "Update recommendation configuration",
486
481
  fetch: t
487
- }).then((n) => {
488
- !n && this.store.blockStates[e] && console.error("[recommendation] refresh outside the panel did not reach a node", { blockId: e });
489
- }).catch((n) => {
490
- console.error("[recommendation] refresh outside the panel failed", n);
482
+ }).then((o) => {
483
+ !o && this.store.blockStates[e] && console.error("[recommendation] refresh outside the panel did not reach a node", { blockId: e });
484
+ }).catch((o) => {
485
+ console.error("[recommendation] refresh outside the panel failed", o);
491
486
  });
492
487
  }
493
488
  _getBlockConfigVersion(e) {
@@ -502,25 +497,25 @@ class me extends P {
502
497
  this.hasUnrenderedProducts = !0;
503
498
  return;
504
499
  }
505
- const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), n = this._pendingDescription(), o = this._stagePendingNodeConfig(t);
506
- if ($(this.currentNode)) {
507
- o && (t.apply(
508
- new y(n ?? "Update recommendation configuration")
500
+ const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), o = this._pendingDescription(), n = this._stagePendingNodeConfig(t);
501
+ if (z(this.currentNode)) {
502
+ n && (t.apply(
503
+ new y(o ?? "Update recommendation configuration")
509
504
  ), this._consumePendingNodeConfig());
510
505
  return;
511
506
  }
512
- z({
507
+ $({
513
508
  currentNode: this.currentNode,
514
509
  documentModifier: t,
515
510
  products: e,
516
- description: n,
517
- onApplied: o ? () => this._consumePendingNodeConfig() : void 0
511
+ description: o,
512
+ onApplied: n ? () => this._consumePendingNodeConfig() : void 0
518
513
  }) || H({
519
514
  currentNode: this.currentNode,
520
515
  documentModifier: t,
521
516
  products: e,
522
- description: n
523
- }) && o && this._consumePendingNodeConfig();
517
+ description: o
518
+ }) && n && this._consumePendingNodeConfig();
524
519
  }
525
520
  // Spent only once it landed with the cards (never when another block's write stayed unstaged):
526
521
  // kept alive, it blocks the store resync an Undo needs and the flush writes the undone ids back.
@@ -542,18 +537,18 @@ class me extends P {
542
537
  */
543
538
  _listenStateUpdates() {
544
539
  const { store: e } = this;
545
- let t = e.recommendationProducts, n = this._getBlockConfigVersion(e.currentRecommendationId);
546
- this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = n, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
547
- const o = e.currentRecommendationId;
548
- if (o !== this.trackedBlockId) {
540
+ let t = e.recommendationProducts, o = this._getBlockConfigVersion(e.currentRecommendationId);
541
+ this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
542
+ const n = e.currentRecommendationId;
543
+ if (n !== this.trackedBlockId) {
549
544
  const p = this._trackedBlockSnapshot();
550
- this.panelGeneration++, this.trackedBlockId = o, t = e.recommendationProducts, n = this._getBlockConfigVersion(o), this.fetchedConfigVersion = n, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(p);
545
+ this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(p);
551
546
  return;
552
547
  }
553
- const i = this._getBlockConfigVersion(o);
554
- i !== n && (n = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(o, this.panelGeneration));
555
- const r = e.recommendationProducts, h = r !== t, d = Array.isArray(r) && r.length > 0;
556
- h && d && (t = r, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
548
+ const i = this._getBlockConfigVersion(n);
549
+ i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(n, this.panelGeneration));
550
+ const r = e.recommendationProducts, h = r !== t, c = Array.isArray(r) && r.length > 0;
551
+ h && c && (t = r, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
557
552
  });
558
553
  }
559
554
  }
@@ -562,7 +557,7 @@ export {
562
557
  E as AlgorithmControl,
563
558
  Y as CONTROL_BLOCK_ID,
564
559
  ye as CURRENCY_CONTROL_ID,
565
- F as CurrencyControl,
560
+ L as CurrencyControl,
566
561
  Re as FILTERS_CONTROL_ID,
567
562
  D as FiltersControl,
568
563
  ke as LAYOUT_ORIENTATION_CONTROL_ID,
@@ -570,14 +565,14 @@ export {
570
565
  U as LayoutOrientationControl,
571
566
  v as LocaleControl,
572
567
  be as PRICE_PLACEMENT_CONTROL_ID,
573
- Le as PRODUCT_COUNT_CONTROL_ID,
574
- Fe as PRODUCT_LAYOUT_CONTROL_ID,
575
- A as PricePlacementControl,
576
- w as ProductCountControl,
568
+ Fe as PRODUCT_COUNT_CONTROL_ID,
569
+ Le as PRODUCT_LAYOUT_CONTROL_ID,
570
+ w as PricePlacementControl,
571
+ A as ProductCountControl,
577
572
  V as ProductLayoutControl,
578
573
  me as RecommendationBlockControl,
579
574
  Ue as SHUFFLE_CONTROL_ID,
580
- Ae as STRATEGY_CONTROL_ID,
575
+ we as STRATEGY_CONTROL_ID,
581
576
  W as ShuffleControl,
582
577
  x as StrategyControl,
583
578
  Ve as adjustProductsToSize,
@@ -586,11 +581,11 @@ export {
586
581
  xe as getCardComposition,
587
582
  Me as getCurrentLayout,
588
583
  Ge as getMainContainerTbody,
589
- $ as isPartnerManagedBlock,
590
- $e as regenerateMobileProductRows,
584
+ z as isPartnerManagedBlock,
585
+ ze as regenerateMobileProductRows,
591
586
  H as regenerateProductRowsWithStyles,
592
587
  M as setCurrencyAttributes,
593
- ze as updatePricesInPlace,
594
- z as updateProductContentInPlace,
588
+ $e as updatePricesInPlace,
589
+ $ as updateProductContentInPlace,
595
590
  He as updateSingleProductContent
596
591
  };