@useinsider/guido 3.6.0-beta.6fd3d23 → 3.6.0-beta.70bbf9f

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 (35) hide show
  1. package/dist/composables/useHtmlValidator.js +165 -118
  2. package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
  3. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  4. package/dist/config/migrator/recommendation/extractors.js +44 -22
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  6. package/dist/config/migrator/recommendationMigrator.js +30 -31
  7. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +38 -24
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +39 -38
  10. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +45 -35
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -52
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -67
  14. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  15. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -4
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -2
  20. package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
  21. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +8 -8
  22. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -17
  23. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  24. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  25. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  26. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  27. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  28. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  33. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  34. package/package.json +1 -1
  35. /package/dist/src/{extensions/Blocks/Recommendation/utils/priceFormatter.test.d.ts → composables/useHtmlValidator.test.d.ts} +0 -0
@@ -1,15 +1,16 @@
1
- var I = Object.defineProperty;
2
- var E = (a, n, t) => n in a ? I(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var u = (a, n, t) => E(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { EditorStatePropertyType as O, PreviewDeviceMode as f, UEAttr as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as T } from "../../../common-control.js";
6
- import { MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as L, DEFAULT_COLUMN_SPACING as P, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
7
- import { RecommendationConfigService as i } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as D } from "../../store/recommendation.js";
9
- import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as C } from "../mobileLayout/cssRules.js";
10
- import { getCurrentLayout as w, getBlockElement as U, regenerateProductRowsWithStyles as b, regenerateMobileProductRows as g, adjustProductsToSize as A } from "./utils.js";
1
+ var g = Object.defineProperty;
2
+ var T = (a, n, t) => n in a ? g(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
+ var u = (a, n, t) => T(a, typeof n != "symbol" ? n + "" : n, t);
4
+ import { UEAttr as d, EditorStatePropertyType as p, PreviewDeviceMode as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as f } from "../../../common-control.js";
6
+ import "../../constants/selectors.js";
7
+ import { MAX_PRODUCTS_PER_ROW as b, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as C, DEFAULT_COLUMN_SPACING as P, DEFAULT_MOBILE_COLUMN_SPACING as D } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as o } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
10
+ import { setMobileLayoutOptOut as L, ensureMobileCssRulesExist as m } from "../mobileLayout/cssRules.js";
11
+ import { isPartnerManagedBlock as U, getCurrentLayout as w, getBlockElement as A, regenerateProductRowsWithStyles as I, regenerateMobileProductRows as E, adjustProductsToSize as S } from "./utils.js";
11
12
  import { useDebounceFn as B } from "../../../../../node_modules/@vueuse/shared/index.js";
12
- const S = "recommendation-product-layout-control", e = {
13
+ const W = "recommendation-product-layout-control", e = {
13
14
  // "Products in One Row" — shown when toggle is OFF
14
15
  PRODUCT_IN_ROW: "cardsInRow",
15
16
  PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
@@ -23,11 +24,11 @@ const S = "recommendation-product-layout-control", e = {
23
24
  MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
24
25
  MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
25
26
  };
26
- class v extends T {
27
+ class X extends f {
27
28
  constructor() {
28
29
  super(...arguments);
29
30
  // Store is used for backward compatibility with product fetching and regeneration
30
- u(this, "store", D());
31
+ u(this, "store", y());
31
32
  u(this, "storeUnsubscription", () => {
32
33
  });
33
34
  u(this, "_debouncedRegenerateProductRows", B(() => {
@@ -35,7 +36,7 @@ class v extends T {
35
36
  }, 500));
36
37
  }
37
38
  getId() {
38
- return S;
39
+ return W;
39
40
  }
40
41
  getTemplate() {
41
42
  return `
@@ -45,12 +46,12 @@ class v extends T {
45
46
  text: this.api.translate("Products in One Row"),
46
47
  name: e.PRODUCT_IN_ROW_LABEL
47
48
  }),
48
- this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: p }),
49
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: b }),
49
50
  this._GuLabel({
50
51
  text: this.api.translate("Products in One Row on Desktop"),
51
52
  name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
52
53
  }),
53
- this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: p }),
54
+ this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: b }),
54
55
  this._GuLabel({
55
56
  text: this.api.translate("Products in One Row on Mobile"),
56
57
  name: e.MOBILE_CARDS_IN_ROW_LABEL
@@ -74,16 +75,25 @@ class v extends T {
74
75
  `;
75
76
  }
76
77
  onRender() {
77
- this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates(), this._listenEditorModeChanges();
78
+ this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this._syncDisabledState(), this._listenToFormUpdates(), this._listenStateUpdates(), this._listenEditorModeChanges();
78
79
  }
79
80
  onTemplateNodeUpdated(t) {
80
- super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
81
+ super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility(), this._syncDisabledState();
82
+ }
83
+ /**
84
+ * Products-per-row and mobile-layout restructure the block, which is
85
+ * meaningless for partner-managed (`ins-skip-compile`) blocks — disable
86
+ * these inputs there. Disabling coexists with the visibility logic above.
87
+ */
88
+ _syncDisabledState() {
89
+ const t = U(this.currentNode);
90
+ this.api.setUIEAttribute(e.PRODUCT_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, d.SWITCHER.disabled, t);
81
91
  }
82
92
  onDestroy() {
83
93
  this.storeUnsubscription();
84
94
  }
85
95
  _setFormValues() {
86
- const t = i.getConfig(this.currentNode);
96
+ const t = o.getConfig(this.currentNode);
87
97
  this.api.updateValues({
88
98
  [e.PRODUCT_IN_ROW]: t.cardsInRow,
89
99
  [e.PRODUCT_IN_ROW_DESKTOP]: t.cardsInRow,
@@ -95,7 +105,7 @@ class v extends T {
95
105
  * Returns true when the editor preview is in mobile mode.
96
106
  */
97
107
  _isMobilePreview() {
98
- return this.api.getEditorState()[O.previewDeviceMode] === f.MOBILE;
108
+ return this.api.getEditorState()[p.previewDeviceMode] === N.MOBILE;
99
109
  }
100
110
  /**
101
111
  * Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
@@ -110,22 +120,22 @@ class v extends T {
110
120
  */
111
121
  _updateProductsInRowVisibility() {
112
122
  var R;
113
- const t = i.getConfig(this.currentNode), o = (t.layout || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, d = this._isMobilePreview();
114
- this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, o), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, o);
115
- const c = o && !r, _ = o && r && !d, l = o && r && d;
116
- this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, _), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, l);
117
- const h = (R = this.getContainer()) == null ? void 0 : R.querySelector("[data-product-layout-control]");
118
- h && (h.style.display = o ? "" : "none");
123
+ const t = o.getConfig(this.currentNode), i = (t.layout || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, _ = this._isMobilePreview();
124
+ this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, i), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, i);
125
+ const c = i && !r, l = i && r && !_, h = i && r && _;
126
+ this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, l), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, h);
127
+ const O = (R = this.getContainer()) == null ? void 0 : R.querySelector("[data-product-layout-control]");
128
+ O && (O.style.display = i ? "" : "none");
119
129
  }
120
130
  /**
121
131
  * Initializes the mobile layout toggle using the same pattern as shuffle.ts.
122
132
  * Sets the initial UI attribute value from the node config.
123
133
  */
124
134
  _initializeMobileLayoutToggle() {
125
- const t = i.getConfig(this.currentNode);
135
+ const t = o.getConfig(this.currentNode);
126
136
  this.api.setUIEAttribute(
127
137
  e.MOBILE_LAYOUT_TOGGLE,
128
- N.SELECTPICKER.items,
138
+ d.SELECTPICKER.items,
129
139
  t.mobileLayoutEnabled
130
140
  );
131
141
  }
@@ -137,13 +147,13 @@ class v extends T {
137
147
  _onMobileLayoutToggleChange(t) {
138
148
  if (!this.currentNode)
139
149
  return;
140
- const s = i.getConfig(this.currentNode);
150
+ const s = o.getConfig(this.currentNode);
141
151
  if (s.mobileLayoutEnabled === t)
142
152
  return;
143
- const o = U(this.currentNode);
153
+ const i = A(this.currentNode);
144
154
  if (t) {
145
- const r = s.previousMobileCardsInRow || L;
146
- i.updateConfig(
155
+ const r = s.previousMobileCardsInRow || C;
156
+ o.updateConfig(
147
157
  this.api,
148
158
  this.currentNode,
149
159
  {
@@ -154,25 +164,25 @@ class v extends T {
154
164
  ), this.store.patchCurrentBlockConfig(
155
165
  { mobileLayoutEnabled: !0 },
156
166
  { triggerRefetch: !1 }
157
- ), o && m(this.api, o, !1), C(this.api), b({
167
+ ), i && L(this.api, i, !1), m(this.api), I({
158
168
  currentNode: this.currentNode,
159
169
  documentModifier: this.api.getDocumentModifier()
160
170
  });
161
171
  } else {
162
172
  const r = s.mobileCardsInRow;
163
- i.updateConfig(
173
+ o.updateConfig(
164
174
  this.api,
165
175
  this.currentNode,
166
176
  {
167
177
  mobileLayoutEnabled: !1,
168
178
  previousMobileCardsInRow: r,
169
- mobileCardsInRow: L
179
+ mobileCardsInRow: C
170
180
  },
171
181
  "Disabled mobile layout optimization"
172
182
  ), this.store.patchCurrentBlockConfig(
173
183
  { mobileLayoutEnabled: !1 },
174
184
  { triggerRefetch: !1 }
175
- ), o && m(this.api, o, !0), g({
185
+ ), i && L(this.api, i, !0), E({
176
186
  currentNode: this.currentNode,
177
187
  documentModifier: this.api.getDocumentModifier()
178
188
  });
@@ -180,36 +190,36 @@ class v extends T {
180
190
  this._setFormValues(), this._updateProductsInRowVisibility();
181
191
  }
182
192
  _onProductsInRowChange(t) {
183
- if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
193
+ if (!this.currentNode || o.getConfig(this.currentNode).cardsInRow === t)
184
194
  return;
185
- const o = t === 1 ? 0 : P;
186
- i.updateConfig(
195
+ const i = t === 1 ? 0 : P;
196
+ o.updateConfig(
187
197
  this.api,
188
198
  this.currentNode,
189
- { cardsInRow: t, columnSpacing: o },
199
+ { cardsInRow: t, columnSpacing: i },
190
200
  `Changed products per row to ${t}`
191
201
  ), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
192
202
  }
193
203
  _onMobileCardsInRowChange(t) {
194
- if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
204
+ if (!this.currentNode || o.getConfig(this.currentNode).mobileCardsInRow === t)
195
205
  return;
196
- const o = t === 1 ? 0 : y;
197
- i.updateConfig(
206
+ const i = t === 1 ? 0 : D;
207
+ o.updateConfig(
198
208
  this.api,
199
209
  this.currentNode,
200
- { mobileCardsInRow: t, mobileColumnSpacing: o },
210
+ { mobileCardsInRow: t, mobileColumnSpacing: i },
201
211
  `Changed mobile products per row to ${t}`
202
- ), C(this.api), g({
212
+ ), m(this.api), E({
203
213
  currentNode: this.currentNode,
204
214
  documentModifier: this.api.getDocumentModifier()
205
215
  });
206
216
  }
207
217
  _regenerateProductRows() {
208
- const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = A(this.store.recommendationProducts, s);
209
- b({
218
+ const t = o.getConfig(this.currentNode), s = parseInt(t.size) || 6, i = S(this.store.recommendationProducts, s);
219
+ I({
210
220
  currentNode: this.currentNode,
211
221
  documentModifier: this.api.getDocumentModifier(),
212
- products: o
222
+ products: i
213
223
  });
214
224
  }
215
225
  _listenToFormUpdates() {
@@ -241,14 +251,14 @@ class v extends T {
241
251
  */
242
252
  _listenEditorModeChanges() {
243
253
  this.api.onEditorStatePropUpdated(
244
- O.previewDeviceMode,
254
+ p.previewDeviceMode,
245
255
  () => {
246
- i.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
256
+ o.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
247
257
  }
248
258
  );
249
259
  }
250
260
  }
251
261
  export {
252
- S as PRODUCT_LAYOUT_CONTROL_ID,
253
- v as ProductLayoutControl
262
+ W as PRODUCT_LAYOUT_CONTROL_ID,
263
+ X as ProductLayoutControl
254
264
  };
@@ -1,36 +1,40 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
3
+ import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as v, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as w, DESKTOP_CONTAINER_SELECTOR as h, CONTAINER_SELECTOR as W, ATTR_PRODUCT_ATTR as j } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as E } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
- import { prepareProductRows as _ } from "../../templates/index.js";
7
- import { formatPrice as j } from "../../utils/priceFormatter.js";
8
- import { isTdNode as F } from "../../utils/tagName.js";
9
- import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as V } from "../../templates/utils.js";
10
- const M = "recommendation-block-v2";
11
- function h(t) {
6
+ import { prepareProductRows as N } from "../../templates/index.js";
7
+ import { formatPrice as F } from "../../utils/priceFormatter.js";
8
+ import { isTdNode as V } from "../../utils/tagName.js";
9
+ import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as M, sanitizeImageUrl as G } from "../../templates/utils.js";
10
+ const R = "recommendation-block-v2";
11
+ function A(t) {
12
12
  if (!t)
13
13
  return null;
14
14
  if ("getAttribute" in t) {
15
15
  const e = t.getAttribute("class");
16
- if (e && e.includes(M))
16
+ if (e && e.includes(R))
17
17
  return t;
18
18
  }
19
- return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
19
+ return "querySelector" in t ? t.querySelector(`.${R}`) ?? null : null;
20
+ }
21
+ function K(t) {
22
+ const e = A(t);
23
+ return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(v);
20
24
  }
21
25
  function b(t) {
22
- const e = h(t);
26
+ const e = A(t);
23
27
  if (!e || !("getAttribute" in e))
24
28
  return "grid";
25
29
  const o = e.getAttribute("data-layout");
26
30
  return o === "list" || o === "horizontal" ? "list" : "grid";
27
31
  }
28
32
  function x(t) {
29
- const e = h(t);
33
+ const e = A(t);
30
34
  if (!e || !("getAttribute" in e))
31
- return R;
35
+ return M;
32
36
  const o = e.getAttribute("data-card-composition");
33
- return o ? o.split(",").filter(Boolean) : R;
37
+ return o ? o.split(",").filter(Boolean) : M;
34
38
  }
35
39
  function D(t) {
36
40
  if (!t || !("childNodes" in t))
@@ -47,14 +51,14 @@ function S(t, e, o) {
47
51
  function U(t, e) {
48
52
  return t && t.length > 0 ? t : e.length > 0 ? e : L();
49
53
  }
50
- function G(t) {
54
+ function Y(t) {
51
55
  const { currentNode: e, documentModifier: o } = t;
52
56
  if (!e || !("querySelector" in e))
53
57
  return;
54
- const n = e.querySelector(k);
58
+ const n = e.querySelector(w);
55
59
  n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
56
60
  }
57
- function Y(t) {
61
+ function X(t) {
58
62
  const {
59
63
  currentNode: e,
60
64
  documentModifier: o,
@@ -66,20 +70,20 @@ function Y(t) {
66
70
  return;
67
71
  const r = i ?? b(e), s = E.getConfig(e);
68
72
  if (r === "list" || !s.mobileLayoutEnabled) {
69
- G({ currentNode: e, documentModifier: o });
73
+ Y({ currentNode: e, documentModifier: o });
70
74
  return;
71
75
  }
72
- const u = e.querySelector(k);
76
+ const u = e.querySelector(w);
73
77
  if (!u)
74
78
  return;
75
- const l = C(), d = U(n, l.recommendationProducts), a = c ?? x(e), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(d, r, {
79
+ const l = C(), d = U(n, l.recommendationProducts), a = c ?? x(e), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${N(d, r, {
76
80
  productsPerRow: s.mobileCardsInRow,
77
81
  composition: a,
78
82
  filterList: l.filterList
79
83
  })}</table></td>`;
80
84
  o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
81
85
  }
82
- function K(t) {
86
+ function z(t) {
83
87
  const {
84
88
  currentNode: e,
85
89
  documentModifier: o,
@@ -90,15 +94,15 @@ function K(t) {
90
94
  } = t;
91
95
  if (!e || !("querySelector" in e))
92
96
  return;
93
- const s = e.querySelector(P) ?? e.querySelector(v);
97
+ const s = e.querySelector(h) ?? e.querySelector(W);
94
98
  if (!s)
95
99
  return;
96
- const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ?? b(e), g = _(l, f, {
100
+ const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ?? b(e), g = N(l, f, {
97
101
  productsPerRow: d,
98
102
  composition: a,
99
103
  filterList: u.filterList
100
104
  });
101
- o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), Y(t), n == null || n();
105
+ o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), X(t), n == null || n();
102
106
  }
103
107
  function T(t, e, o, n) {
104
108
  const c = `0 ${Math.floor(o / 2)}px`;
@@ -111,7 +115,7 @@ function T(t, e, o, n) {
111
115
  t.querySelectorAll(".product-card-wrapper")
112
116
  ).forEach((u) => {
113
117
  const l = "parentNode" in u ? u.parentNode : null;
114
- l && F(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
118
+ l && V(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
115
119
  }), r;
116
120
  }
117
121
  function I(t, e, o) {
@@ -121,13 +125,13 @@ function I(t, e, o) {
121
125
  e.modifyHtml(r).setStyle("height", n), c = !0;
122
126
  }), c;
123
127
  }
124
- function X(t) {
128
+ function J(t) {
125
129
  const { currentNode: e, documentModifier: o } = t;
126
130
  if (!e)
127
131
  return;
128
132
  const n = E.getConfig(e), i = b(e);
129
133
  let c = !1;
130
- const r = e.querySelector(P);
134
+ const r = e.querySelector(h);
131
135
  if (r) {
132
136
  c = T(
133
137
  r,
@@ -160,9 +164,9 @@ function X(t) {
160
164
  }
161
165
  c && o.apply(new p("Reapply spacing after regeneration"));
162
166
  }
163
- function se(t) {
167
+ function de(t) {
164
168
  const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
165
- e && K({
169
+ e && z({
166
170
  currentNode: e,
167
171
  documentModifier: o,
168
172
  products: i,
@@ -170,12 +174,12 @@ function se(t) {
170
174
  composition: r,
171
175
  afterRegenerate: () => {
172
176
  setTimeout(() => {
173
- X({ currentNode: e, documentModifier: o });
177
+ J({ currentNode: e, documentModifier: o });
174
178
  }, 0), n == null || n();
175
179
  }
176
180
  });
177
181
  }
178
- function ae(t, e) {
182
+ function fe(t, e) {
179
183
  return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
180
184
  }
181
185
  function H() {
@@ -189,14 +193,14 @@ function H() {
189
193
  thousandSeparator: e.thousandSeparator
190
194
  };
191
195
  }
192
- function A(t, e = "price") {
196
+ function P(t, e = "price") {
193
197
  const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
194
- return j({
198
+ return F({
195
199
  price: i,
196
200
  currency: o
197
201
  });
198
202
  }
199
- function z(t) {
203
+ function Q(t) {
200
204
  var c, r;
201
205
  const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
202
206
  return i > 0 ? `-${i}%` : "0%";
@@ -205,24 +209,24 @@ function $(t) {
205
209
  const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
206
210
  let s = !1;
207
211
  if (n && "querySelector" in n) {
208
- const u = n.querySelector("strong") ?? n.querySelector("p"), l = A(o, "price");
212
+ const u = n.querySelector("strong") ?? n.querySelector("p"), l = P(o, "price");
209
213
  S(e, u ?? null, l) && (s = !0);
210
214
  }
211
215
  if (i && "querySelector" in i) {
212
- const u = i.querySelector("strong") ?? i.querySelector("p"), l = A(o, "original_price");
216
+ const u = i.querySelector("strong") ?? i.querySelector("p"), l = P(o, "original_price");
213
217
  S(e, u ?? null, l) && (s = !0);
214
218
  }
215
219
  if (c && "querySelector" in c) {
216
- const u = c.querySelector(".omnibus-price-value") ?? null, l = A(o, "original_price");
220
+ const u = c.querySelector(".omnibus-price-value") ?? null, l = P(o, "original_price");
217
221
  S(e, u, l) && (s = !0);
218
222
  }
219
223
  if (r && "querySelector" in r) {
220
- const u = r.querySelector(".omnibus-discount-value") ?? null, l = z(o);
224
+ const u = r.querySelector(".omnibus-discount-value") ?? null, l = Q(o);
221
225
  S(e, u, l) && (s = !0);
222
226
  }
223
227
  return s;
224
228
  }
225
- function J(t) {
229
+ function Z(t) {
226
230
  const {
227
231
  documentModifier: e,
228
232
  product: o,
@@ -237,7 +241,7 @@ function J(t) {
237
241
  let d = !1;
238
242
  if (n && "querySelector" in n) {
239
243
  const a = n.querySelector("img");
240
- a && (e.modifyHtml(a).setAttribute("src", V(o.image_url)).setAttribute("alt", o.name), d = !0);
244
+ a && (e.modifyHtml(a).setAttribute("src", G(o.image_url)).setAttribute("alt", o.name), d = !0);
241
245
  const f = n.querySelector("a");
242
246
  f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
243
247
  }
@@ -259,10 +263,10 @@ function J(t) {
259
263
  return d;
260
264
  }
261
265
  function B(t) {
262
- return "querySelector" in t ? t.querySelector(P) ?? t : t;
266
+ return "querySelector" in t ? t.querySelector(h) ?? t : t;
263
267
  }
264
268
  const O = "product_attribute.";
265
- function Q(t, e) {
269
+ function ee(t, e) {
266
270
  var n;
267
271
  let o;
268
272
  if (t.startsWith(O)) {
@@ -272,7 +276,7 @@ function Q(t, e) {
272
276
  o = e[t];
273
277
  return typeof o == "string" && o.length > 0 ? o : typeof o == "number" ? String(o) : null;
274
278
  }
275
- function Z(t, e, o) {
279
+ function te(t, e, o) {
276
280
  if (!("querySelectorAll" in t))
277
281
  return !1;
278
282
  const n = t.querySelectorAll(
@@ -284,7 +288,7 @@ function Z(t, e, o) {
284
288
  n.forEach((r) => {
285
289
  if (!("getAttribute" in r))
286
290
  return;
287
- const s = r.getAttribute(W);
291
+ const s = r.getAttribute(j);
288
292
  if (!s)
289
293
  return;
290
294
  const u = i.get(s) ?? [];
@@ -296,7 +300,7 @@ function Z(t, e, o) {
296
300
  r.slice(0, u).forEach((l, d) => {
297
301
  if (!("querySelector" in l))
298
302
  return;
299
- const a = Q(s, o[d]);
303
+ const a = ee(s, o[d]);
300
304
  if (a === null)
301
305
  return;
302
306
  const f = l.querySelector("p") ?? null;
@@ -304,7 +308,7 @@ function Z(t, e, o) {
304
308
  });
305
309
  }), c;
306
310
  }
307
- function w(t, e, o) {
311
+ function _(t, e, o) {
308
312
  if (!("querySelectorAll" in t))
309
313
  return !1;
310
314
  const n = t.querySelectorAll(
@@ -324,7 +328,7 @@ function w(t, e, o) {
324
328
  ), d = Math.min(n.length, o.length);
325
329
  let a = !1;
326
330
  for (let f = 0; f < d; f++) {
327
- const g = J({
331
+ const g = Z({
328
332
  documentModifier: e,
329
333
  product: o[f],
330
334
  imageEl: n[f] ?? null,
@@ -337,9 +341,9 @@ function w(t, e, o) {
337
341
  });
338
342
  a = a || g;
339
343
  }
340
- return Z(t, e, o) && (a = !0), a;
344
+ return te(t, e, o) && (a = !0), a;
341
345
  }
342
- function de(t) {
346
+ function me(t) {
343
347
  const { currentNode: e, documentModifier: o, products: n } = t;
344
348
  if (!e || !("querySelectorAll" in e))
345
349
  return !1;
@@ -348,12 +352,12 @@ function de(t) {
348
352
  `[esd-extension-block-id="${m.IMAGE}"]`
349
353
  ).length !== n.length)
350
354
  return !1;
351
- let r = w(i, o, n);
355
+ let r = _(i, o, n);
352
356
  const s = b(e), u = E.getConfig(e);
353
357
  if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
354
358
  const l = e.querySelector(q);
355
359
  if (l) {
356
- const d = w(
360
+ const d = _(
357
361
  l,
358
362
  o,
359
363
  n
@@ -363,7 +367,7 @@ function de(t) {
363
367
  }
364
368
  return r && o.apply(new p("Updated product content in-place")), !0;
365
369
  }
366
- function N(t, e, o) {
370
+ function k(t, e, o) {
367
371
  if (!("querySelectorAll" in t))
368
372
  return !1;
369
373
  const n = t.querySelectorAll(
@@ -387,27 +391,29 @@ function N(t, e, o) {
387
391
  }) && (u = !0);
388
392
  return u;
389
393
  }
390
- function fe(t) {
394
+ function pe(t) {
391
395
  const { currentNode: e, documentModifier: o } = t;
392
396
  if (!e || !("querySelectorAll" in e))
393
397
  return !1;
398
+ if (K(e))
399
+ return !0;
394
400
  const i = C().recommendationProducts;
395
401
  if (i.length === 0)
396
402
  return !1;
397
403
  const c = B(e);
398
- let r = N(c, o, i);
404
+ let r = k(c, o, i);
399
405
  const s = b(e), u = E.getConfig(e);
400
406
  if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
401
407
  const l = e.querySelector(q);
402
408
  if (l) {
403
- const d = N(l, o, i);
409
+ const d = k(l, o, i);
404
410
  r = r || d;
405
411
  }
406
412
  }
407
413
  return r && o.apply(new p("Updated price formatting in-place")), r;
408
414
  }
409
- function me(t) {
410
- const { currentNode: e, documentModifier: o, currency: n } = t, i = h(e);
415
+ function ye(t) {
416
+ const { currentNode: e, documentModifier: o, currency: n } = t, i = A(e);
411
417
  if (!i)
412
418
  return;
413
419
  const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
@@ -416,17 +422,18 @@ function me(t) {
416
422
  r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
417
423
  }
418
424
  export {
419
- ae as adjustProductsToSize,
420
- A as formatProductPrice,
421
- h as getBlockElement,
425
+ fe as adjustProductsToSize,
426
+ P as formatProductPrice,
427
+ A as getBlockElement,
422
428
  x as getCardComposition,
423
429
  b as getCurrentLayout,
424
- X as reapplySpacing,
425
- Y as regenerateMobileProductRows,
426
- K as regenerateProductRows,
427
- se as regenerateProductRowsWithStyles,
428
- me as setCurrencyAttributes,
429
- fe as updatePricesInPlace,
430
- de as updateProductContentInPlace,
431
- J as updateSingleProductContent
430
+ K as isPartnerManagedBlock,
431
+ J as reapplySpacing,
432
+ X as regenerateMobileProductRows,
433
+ z as regenerateProductRows,
434
+ de as regenerateProductRowsWithStyles,
435
+ ye as setCurrencyAttributes,
436
+ pe as updatePricesInPlace,
437
+ me as updateProductContentInPlace,
438
+ Z as updateSingleProductContent
432
439
  };
@@ -1,11 +1,12 @@
1
1
  var m = Object.defineProperty;
2
- var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ var p = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as c, UEAttr as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as d } from "../../common-control.js";
6
6
  import { RecommendationControlId as C } from "../constants/controlIds.js";
7
+ import "../constants/selectors.js";
7
8
  const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
8
- class h extends d {
9
+ class O extends d {
9
10
  constructor() {
10
11
  super(...arguments);
11
12
  a(this, "_repositionedElement", null);
@@ -17,7 +18,7 @@ class h extends d {
17
18
  return `
18
19
  <div class="${r}">
19
20
  <${c.ICON}
20
- ${p.ICON.src}="migration-info-icon"
21
+ ${_.ICON.src}="migration-info-icon"
21
22
  class="${r}__icon">
22
23
  </${c.ICON}>
23
24
  <p class="${r}__text">
@@ -61,5 +62,5 @@ class h extends d {
61
62
  }
62
63
  export {
63
64
  S as SYNC_INFO_MESSAGE_CONTROL_ID,
64
- h as SyncInfoMessageControl
65
+ O as SyncInfoMessageControl
65
66
  };