@useinsider/guido 3.8.2-beta.189e91c → 3.8.2

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 (43) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/composables/usePreviewMode.js +14 -15
  3. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  4. package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
  6. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  7. package/dist/extensions/Blocks/Recommendation/block.js +41 -60
  8. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +264 -345
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
  11. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
  12. package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
  13. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
  14. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -3
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
  22. package/dist/src/@types/config/schemas.d.ts +0 -16
  23. package/dist/src/composables/useConfig.d.ts +0 -4
  24. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  25. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  26. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  27. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  29. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  30. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -13
  31. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  32. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  33. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -10
  34. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  35. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
  36. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
  37. package/dist/src/stores/config.d.ts +0 -36
  38. package/package.json +1 -1
  39. package/dist/composables/useRecommendationPreview.js +0 -111
  40. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
  41. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  42. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
@@ -1,103 +1,103 @@
1
- var tt = Object.defineProperty;
2
- var et = (g, b, t) => b in g ? tt(g, b, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[b] = t;
3
- var I = (g, b, t) => et(g, typeof b != "symbol" ? b + "" : b, t);
4
- import { UIElementType as _, UEAttr as E, ModificationDescription as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as rt } from "../../../common-control.js";
6
- import { ATTR_PRODUCT_IMAGE as k, ATTR_PRODUCT_NAME as it, ATTR_PRODUCT_PRICE as S, ATTR_PRODUCT_OLD_PRICE as v, ATTR_PRODUCT_OMNIBUS_PRICE as ot, ATTR_PRODUCT_OMNIBUS_DISCOUNT as st, ATTR_PRODUCT_BUTTON as U, ATTR_DATA_CUSTOM_ATTRIBUTES as F, ATTR_CUSTOM_PREFIX as p, BUILT_IN_DEFAULT_ATTRIBUTES as nt } from "../../constants/selectors.js";
7
- import { DEFAULT_COMPOSITION as x, DEFAULT_VISIBILITY as M } from "../../constants/defaultConfig.js";
8
- import { RecommendationConfigService as P } from "../../services/configService.js";
1
+ var J = Object.defineProperty;
2
+ var Q = (p, _, t) => _ in p ? J(p, _, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[_] = t;
3
+ var T = (p, _, t) => Q(p, typeof _ != "symbol" ? _ + "" : _, t);
4
+ import { UIElementType as f, UEAttr as I, ModificationDescription as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as Z } from "../../../common-control.js";
6
+ import { ATTR_PRODUCT_IMAGE as L, ATTR_PRODUCT_NAME as tt, ATTR_PRODUCT_PRICE as et, ATTR_PRODUCT_OLD_PRICE as rt, ATTR_PRODUCT_OMNIBUS_PRICE as ot, ATTR_PRODUCT_OMNIBUS_DISCOUNT as st, ATTR_PRODUCT_BUTTON as B, ATTR_DATA_CUSTOM_ATTRIBUTES as q, ATTR_CUSTOM_PREFIX as m, BUILT_IN_DEFAULT_ATTRIBUTES as it } from "../../constants/selectors.js";
7
+ import { DEFAULT_COMPOSITION as P, DEFAULT_VISIBILITY as F } from "../../constants/defaultConfig.js";
8
+ import { RecommendationConfigService as nt } from "../../services/configService.js";
9
9
  import { useRecommendationExtensionStore as lt } from "../../store/recommendation.js";
10
- import { ATTRIBUTE_CELL_CLASS as at, gridElementRenderer as ct, DEFAULT_CELL_PADDING as dt, buildFillerCell as ut } from "../../templates/grid/elementRenderer.js";
10
+ import { ATTRIBUTE_CELL_CLASS as at, gridElementRenderer as ct, DEFAULT_CELL_PADDING as ut, buildFillerCell as dt } from "../../templates/grid/elementRenderer.js";
11
11
  import { listElementRenderer as mt } from "../../templates/list/elementRenderer.js";
12
- import { resolveInlinePriceOrder as ht, toDisplayName as pt, isDefaultAttribute as gt, toDisplayableAttributeValue as bt, buildElementRenderer as V } from "../../templates/utils.js";
13
- import { getTableDisplayValue as _t } from "../../utils/tagName.js";
14
- import { isPartnerManagedBlock as ft, regenerateProductRowsWithStyles as yt, getCurrentLayout as St } from "../main/utils.js";
15
- const Ct = "ui-elements-recommendation-card-composition", T = ".recommendation-attribute-row", H = ".product-card-wrapper > tbody", j = ".product-info-cell > table > tbody", W = "data-card-composition", y = "data-attribute-type", D = "data-visibility", K = {
12
+ import { toDisplayName as ht, isDefaultAttribute as pt, toDisplayableAttributeValue as _t, buildElementRenderer as w } from "../../templates/utils.js";
13
+ import { getTableDisplayValue as ft } from "../../utils/tagName.js";
14
+ import { isPartnerManagedBlock as gt, getCurrentLayout as bt } from "../main/utils.js";
15
+ const yt = "ui-elements-recommendation-card-composition", S = ".recommendation-attribute-row", N = ".product-card-wrapper > tbody", M = ".product-info-cell > table > tbody", V = "data-card-composition", y = "data-attribute-type", v = "data-visibility", x = {
16
16
  ADD_ATTRIBUTE: "addAttribute"
17
- }, f = 5, N = "reorderIcon_", At = '<svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2.5" r="1.2"/><circle cx="7" cy="2.5" r="1.2"/><circle cx="12" cy="2.5" r="1.2"/><circle cx="2" cy="7.5" r="1.2"/><circle cx="7" cy="7.5" r="1.2"/><circle cx="12" cy="7.5" r="1.2"/></svg>', m = [
18
- { key: k, label: "Product Image" },
19
- { key: it, label: "Product Name" },
20
- { key: S, label: "Product Price" },
21
- { key: v, label: "Product Original Price" },
17
+ }, g = 5, E = "reorderIcon_", h = [
18
+ { key: L, label: "Product Image" },
19
+ { key: tt, label: "Product Name" },
20
+ { key: et, label: "Product Price" },
21
+ { key: rt, label: "Product Original Price" },
22
22
  { key: ot, label: "Omnibus Price" },
23
23
  { key: st, label: "Omnibus Discount" },
24
- { key: U, label: "Product Button" }
25
- ], Tt = new Set(m.map((g) => g.key)), $ = "customAttr_", O = "deleteAttr_";
26
- class qt extends rt {
24
+ { key: B, label: "Product Button" }
25
+ ], At = new Set(h.map((p) => p.key)), C = "customAttr_", R = "deleteAttr_";
26
+ class Ut extends Z {
27
27
  constructor() {
28
28
  super(...arguments);
29
- I(this, "store", lt());
30
- I(this, "unsubscribeStore", null);
31
- I(this, "eventController", null);
29
+ T(this, "store", lt());
30
+ T(this, "unsubscribeStore", null);
31
+ T(this, "eventController", null);
32
32
  /**
33
33
  * Guard flag: when true, onTemplateNodeUpdated skips _initializeComposition.
34
34
  * Used during _onReorder to prevent multiple intermediate rebuilds.
35
35
  */
36
- I(this, "reorderInProgress", !1);
36
+ T(this, "reorderInProgress", !1);
37
37
  }
38
38
  getId() {
39
- return Ct;
39
+ return yt;
40
40
  }
41
41
  // ========================================================================
42
42
  // Lifecycle
43
43
  // ========================================================================
44
44
  getTemplate() {
45
- const t = m.map((a) => `
46
- <div data-toggle-key="${a.key}" style="display: none;">
47
- ${this._GuToggle(`visibility_${a.key}`)}
45
+ const t = h.map((l) => `
46
+ <div data-toggle-key="${l.key}" style="display: none;">
47
+ ${this._GuToggle(`visibility_${l.key}`)}
48
48
  </div>
49
49
  `).join(""), r = Array.from(
50
- { length: f },
51
- (a, d) => `
52
- <div data-custom-select-key="${$}${d}" style="display: none;">
50
+ { length: g },
51
+ (l, u) => `
52
+ <div data-custom-select-key="${C}${u}" style="display: none;">
53
53
  ${this._GuSelect({
54
- name: `${$}${d}`,
54
+ name: `${C}${u}`,
55
55
  placeholder: this.api.translate("Select Attribute"),
56
56
  options: []
57
57
  })}
58
58
  </div>
59
59
  `
60
- ).join(""), e = m.length + f, o = Array.from(
60
+ ).join(""), e = h.length + g, o = Array.from(
61
61
  { length: e },
62
- (a, d) => `
63
- <div data-reorder-icon-key="${N}${d}" style="display: none;">
64
- <${_.BUTTON}
62
+ (l, u) => `
63
+ <div data-reorder-icon-key="${E}${u}" style="display: none;">
64
+ <${f.BUTTON}
65
65
  class="drag-handle-btn flat-inline flat-white"
66
- ${E.BUTTON.name}="${N}${d}"
66
+ ${I.BUTTON.name}="${E}${u}"
67
67
  >
68
- <${_.ICON}
68
+ <${f.ICON}
69
69
  src="reorder"
70
70
  class="icon-button"
71
- ></${_.ICON}>
72
- </${_.BUTTON}>
71
+ ></${f.ICON}>
72
+ </${f.BUTTON}>
73
73
  </div>
74
74
  `
75
- ).join(""), i = Array.from(
76
- { length: f },
77
- (a, d) => `
78
- <div data-custom-delete-key="${O}${d}" style="display: none;">
79
- <${_.BUTTON}
75
+ ).join(""), s = Array.from(
76
+ { length: g },
77
+ (l, u) => `
78
+ <div data-custom-delete-key="${R}${u}" style="display: none;">
79
+ <${f.BUTTON}
80
80
  class="custom-attr-delete flat-inline flat-white"
81
- ${E.BUTTON.name}="${O}${d}"
81
+ ${I.BUTTON.name}="${R}${u}"
82
82
  >
83
- <${_.ICON}
83
+ <${f.ICON}
84
84
  src="delete"
85
85
  class="icon-button"
86
- ></${_.ICON}>
87
- </${_.BUTTON}>
86
+ ></${f.ICON}>
87
+ </${f.BUTTON}>
88
88
  </div>
89
89
  `
90
- ).join(""), s = "https://academy.insiderone.com/docs/new-editor-email-recommendation-block", n = this.api.translate(
90
+ ).join(""), i = "https://academy.insiderone.com/docs/new-editor-email-recommendation-block", n = this.api.translate(
91
91
  "Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
92
- ), c = this.api.translate("For more information, you can"), l = this.api.translate("visit Academy");
92
+ ), a = this.api.translate("For more information, you can"), c = this.api.translate("visit Academy");
93
93
  return `
94
94
  <div class="recommendation-controls-container" data-card-composition-control>
95
95
  <div class="container">
96
96
  <p class="card-composition-description">
97
97
  ${n}
98
- ${c}
98
+ ${a}
99
99
  <!-- cspell:disable-next-line -->
100
- <a href="${s}" target="_blank" rel="noopener noreferrer">${l}</a>.
100
+ <a href="${i}" target="_blank" rel="noopener noreferrer">${c}</a>.
101
101
  </p>
102
102
  </div>
103
103
 
@@ -110,7 +110,7 @@ class qt extends rt {
110
110
  </div>
111
111
 
112
112
  <div class="custom-delete-store" style="display: none;">
113
- ${i}
113
+ ${s}
114
114
  </div>
115
115
 
116
116
  <div class="reorder-icon-store" style="display: none;">
@@ -120,7 +120,7 @@ class qt extends rt {
120
120
  <div class="orderable-list" data-composition-list></div>
121
121
 
122
122
  ${this._GuButton({
123
- name: K.ADD_ATTRIBUTE,
123
+ name: x.ADD_ATTRIBUTE,
124
124
  label: this.api.translate("Add Attribute"),
125
125
  id: "guido__btn-add-attribute"
126
126
  })}
@@ -141,7 +141,7 @@ class qt extends rt {
141
141
  const t = (e = this.getContainer()) == null ? void 0 : e.querySelector("[data-card-composition-control]");
142
142
  if (!t)
143
143
  return;
144
- const r = ft(this.currentNode);
144
+ const r = gt(this.currentNode);
145
145
  t.style.pointerEvents = r ? "none" : "", t.style.opacity = r ? "0.5" : "";
146
146
  }
147
147
  onTemplateNodeUpdated(t) {
@@ -154,17 +154,17 @@ class qt extends rt {
154
154
  // Initialization
155
155
  // ========================================================================
156
156
  _initializeComposition() {
157
- const t = this._readCompositionFromNode(), r = this._readCustomAttributesFromNode(), e = this._readVisibilityFromRows(), o = this._renderOrderableItems(t, r), i = this._buildVisibilityValues(e);
158
- this.api.updateValues(i), o && this._initializeCustomSelects(r), this._updateAddButtonState();
157
+ const t = this._readCompositionFromNode(), r = this._readCustomAttributesFromNode(), e = this._readVisibilityFromRows(), o = this._renderOrderableItems(t, r), s = this._buildVisibilityValues(e);
158
+ this.api.updateValues(s), o && this._initializeCustomSelects(r), this._updateAddButtonState();
159
159
  }
160
160
  _registerValueChangeListeners() {
161
- m.forEach((t) => {
161
+ h.forEach((t) => {
162
162
  this.api.onValueChanged(`visibility_${t.key}`, (r) => {
163
163
  this._applyVisibilityToBlock(t.key, r);
164
164
  });
165
165
  });
166
- for (let t = 0; t < f; t++) {
167
- const r = `${$}${t}`, e = t;
166
+ for (let t = 0; t < g; t++) {
167
+ const r = `${C}${t}`, e = t;
168
168
  this.api.onValueChanged(r, (o) => {
169
169
  this._onCustomAttributeChanged(e, o);
170
170
  });
@@ -175,14 +175,14 @@ class qt extends rt {
175
175
  // ========================================================================
176
176
  _readCompositionFromNode() {
177
177
  if (!this.currentNode || !("getAttribute" in this.currentNode))
178
- return [...x];
179
- const t = this.currentNode.getAttribute(W);
180
- return t ? t.split(",").filter(Boolean) : [...x];
178
+ return [...P];
179
+ const t = this.currentNode.getAttribute(V);
180
+ return t ? t.split(",").filter(Boolean) : [...P];
181
181
  }
182
182
  _readCustomAttributesFromNode() {
183
183
  if (!this.currentNode || !("getAttribute" in this.currentNode))
184
184
  return [];
185
- const t = this.currentNode.getAttribute(F);
185
+ const t = this.currentNode.getAttribute(q);
186
186
  if (!t)
187
187
  return [];
188
188
  try {
@@ -194,31 +194,31 @@ class qt extends rt {
194
194
  _readVisibilityFromRows() {
195
195
  if (!this.currentNode)
196
196
  return this._getDefaultVisibilities();
197
- const t = Array.from(this.currentNode.querySelectorAll(T)), r = this._extractVisibilityFromRows(t);
197
+ const t = Array.from(this.currentNode.querySelectorAll(S)), r = this._extractVisibilityFromRows(t);
198
198
  return this._mergeWithDefaults(r);
199
199
  }
200
200
  _getDefaultVisibilities() {
201
- return { ...M };
201
+ return { ...F };
202
202
  }
203
203
  _extractVisibilityFromRows(t) {
204
204
  const r = {};
205
205
  return t.forEach((e) => {
206
206
  if (!("getAttribute" in e))
207
207
  return;
208
- const o = e.getAttribute(y), i = e.getAttribute(D);
209
- o && i !== null && (r[o] = this._parseVisibilityValue(i));
208
+ const o = e.getAttribute(y), s = e.getAttribute(v);
209
+ o && s !== null && (r[o] = this._parseVisibilityValue(s));
210
210
  }), r;
211
211
  }
212
212
  _parseVisibilityValue(t) {
213
213
  return t === "1" || t === "true";
214
214
  }
215
215
  _mergeWithDefaults(t) {
216
- return Object.entries(M).forEach(([r, e]) => {
216
+ return Object.entries(F).forEach(([r, e]) => {
217
217
  r in t || (t[r] = e);
218
218
  }), t;
219
219
  }
220
220
  _buildVisibilityValues(t) {
221
- return m.reduce((r, e) => (r[`visibility_${e.key}`] = t[e.key] ?? !0, r), {});
221
+ return h.reduce((r, e) => (r[`visibility_${e.key}`] = t[e.key] ?? !0, r), {});
222
222
  }
223
223
  // ========================================================================
224
224
  // UI Rendering (Orderable List)
@@ -233,29 +233,23 @@ class qt extends rt {
233
233
  if (!e)
234
234
  return !1;
235
235
  const o = e.querySelector("[data-composition-list]");
236
- if (!o)
236
+ if (!o || this._tryReorderInPlace(o, t))
237
237
  return !1;
238
- const i = !P.getConfig(this.currentNode).priceMovedToNextLine;
239
- if (!(o.dataset.inlinePrices !== String(i)) && this._tryReorderInPlace(o, t))
240
- return !1;
241
- o.dataset.inlinePrices = String(i);
242
- const n = new Set(r), c = ht(t);
243
- let l = 0, a = 0;
244
- const d = t.map((u) => {
245
- if (i && (u === S || u === v))
246
- return u === c.anchor ? this._createPriceGroupItemHtml(a++, c.originalFirst) : "";
247
- if (Tt.has(u)) {
248
- const h = m.find((C) => C.key === u);
249
- return this._createBuiltInItemHtml(h, a++);
238
+ const s = new Set(r);
239
+ let i = 0, n = 0;
240
+ const a = t.map((c) => {
241
+ if (At.has(c)) {
242
+ const l = h.find((u) => u.key === c);
243
+ return this._createBuiltInItemHtml(l, n++);
250
244
  }
251
- if (u.startsWith(p)) {
252
- const h = u.substring(p.length);
253
- if (n.has(h))
254
- return this._createCustomItemHtml(u, l++, a++);
245
+ if (c.startsWith(m)) {
246
+ const l = c.substring(m.length);
247
+ if (s.has(l))
248
+ return this._createCustomItemHtml(c, i++, n++);
255
249
  }
256
250
  return "";
257
251
  }).join("");
258
- return this._rescueTogglesToStore(e), this._rescueSelectsToStore(e), this._rescueDeleteButtonsToStore(e), this._rescueReorderIconsToStore(e), o.innerHTML = d, this._moveTogglesIntoItems(e), this._moveSelectsIntoItems(e, r.length), this._moveDeleteButtonsIntoItems(e, r.length), this._moveReorderIconsIntoItems(e, a), !0;
252
+ return this._rescueTogglesToStore(e), this._rescueSelectsToStore(e), this._rescueDeleteButtonsToStore(e), this._rescueReorderIconsToStore(e), o.innerHTML = a, this._moveTogglesIntoItems(e), this._moveSelectsIntoItems(e, r.length), this._moveDeleteButtonsIntoItems(e, r.length), this._moveReorderIconsIntoItems(e, n), !0;
259
253
  }
260
254
  /**
261
255
  * Attempts to reorder existing orderable-item elements to match the composition order.
@@ -267,27 +261,27 @@ class qt extends rt {
267
261
  const e = Array.from(t.querySelectorAll(".orderable-item"));
268
262
  if (e.length !== r.length)
269
263
  return !1;
270
- const o = e.map((l) => l.dataset.key).filter(Boolean);
264
+ const o = e.map((c) => c.dataset.key).filter(Boolean);
271
265
  if (o.length !== r.length)
272
266
  return !1;
273
- const i = [...o].sort().join(","), s = [...r].sort().join(",");
274
- if (i !== s || r.some((l) => l.startsWith(p)))
267
+ const s = [...o].sort().join(","), i = [...r].sort().join(",");
268
+ if (s !== i || r.some((c) => c.startsWith(m)))
275
269
  return !1;
276
270
  const n = /* @__PURE__ */ new Map();
277
- e.forEach((l) => {
278
- const { key: a } = l.dataset;
279
- if (a) {
280
- const d = n.get(a) || [];
281
- d.push(l), n.set(a, d);
271
+ e.forEach((c) => {
272
+ const { key: l } = c.dataset;
273
+ if (l) {
274
+ const u = n.get(l) || [];
275
+ u.push(c), n.set(l, u);
282
276
  }
283
277
  });
284
- const c = /* @__PURE__ */ new Map();
285
- return r.forEach((l) => {
286
- const a = n.get(l);
287
- if (!a)
278
+ const a = /* @__PURE__ */ new Map();
279
+ return r.forEach((c) => {
280
+ const l = n.get(c);
281
+ if (!l)
288
282
  return;
289
- const d = c.get(l) || 0;
290
- c.set(l, d + 1), a[d] && t.appendChild(a[d]);
283
+ const u = a.get(c) || 0;
284
+ a.set(c, u + 1), l[u] && t.appendChild(l[u]);
291
285
  }), !0;
292
286
  }
293
287
  _createBuiltInItemHtml(t, r) {
@@ -299,33 +293,6 @@ class qt extends rt {
299
293
  </div>
300
294
  `;
301
295
  }
302
- /**
303
- * Inline mode: the merged "Product Prices" group item. It moves as a unit in
304
- * the main list (both keys stay adjacent) and contains a nested 2-item drag
305
- * to reorder Product Price ↔ Product Original Price — which flips the inline
306
- * render order via `resolveInlinePriceOrder`. The group keeps a single
307
- * visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
308
- * plain drag handle (no UE button → untouched by the reorder-icon rescue).
309
- */
310
- _createPriceGroupItemHtml(t, r) {
311
- var n, c;
312
- const e = ((n = m.find((l) => l.key === S)) == null ? void 0 : n.label) ?? "Product Price", o = ((c = m.find((l) => l.key === v)) == null ? void 0 : c.label) ?? "Product Original Price", i = (l, a) => `
313
- <div class="price-suborderable-item" draggable="true" data-subkey="${l}">
314
- <span class="sub-drag-handle">${At}</span>
315
- <span class="item-label">${this.api.translate(a)}</span>
316
- </div>`, s = r ? i(v, o) + i(S, e) : i(S, e) + i(v, o);
317
- return `
318
- <div class="orderable-item price-group-item" draggable="true"
319
- data-key="${S}" data-group="prices">
320
- <div class="price-group-header">
321
- <span class="drag-handle" data-reorder-icon-slot="${t}"></span>
322
- <span class="item-label">${this.api.translate("Product Prices")}</span>
323
- <div class="item-action" data-action-for="${S}"></div>
324
- </div>
325
- <div class="price-suborderable-list">${s}</div>
326
- </div>
327
- `;
328
- }
329
296
  _createCustomItemHtml(t, r, e) {
330
297
  return `
331
298
  <div class="orderable-item" draggable="true"
@@ -346,10 +313,10 @@ class qt extends rt {
346
313
  _getSelectOptions(t, r = []) {
347
314
  const e = this._getAddableFilters();
348
315
  if (e.length > 0) {
349
- const i = new Set(r);
350
- return i.delete(t), e.filter((s) => !i.has(s.attributeName)).map((s) => ({
351
- text: s.displayName,
352
- value: s.attributeName
316
+ const s = new Set(r);
317
+ return s.delete(t), e.filter((i) => !s.has(i.attributeName)).map((i) => ({
318
+ text: i.displayName,
319
+ value: i.attributeName
353
320
  }));
354
321
  }
355
322
  return [{ text: this._getDisplayNameForAttribute(t), value: t }];
@@ -362,8 +329,8 @@ class qt extends rt {
362
329
  _initializeCustomSelects(t) {
363
330
  t.length !== 0 && setTimeout(() => {
364
331
  t.forEach((r, e) => {
365
- const o = `${$}${e}`, i = this._getSelectOptions(r, t);
366
- this.api.setUIEAttribute(o, E.SELECTPICKER.items, i), this.api.updateValues({ [o]: r });
332
+ const o = `${C}${e}`, s = this._getSelectOptions(r, t);
333
+ this.api.setUIEAttribute(o, I.SELECTPICKER.items, s), this.api.updateValues({ [o]: r });
367
334
  });
368
335
  }, 0);
369
336
  }
@@ -372,11 +339,11 @@ class qt extends rt {
372
339
  * Stripo initializes toggles at template parse time; moving the DOM node preserves bindings.
373
340
  */
374
341
  _moveTogglesIntoItems(t) {
375
- m.forEach((r) => {
342
+ h.forEach((r) => {
376
343
  const e = t.querySelector(`[data-toggle-key="${r.key}"]`), o = t.querySelector(`[data-action-for="${r.key}"]`);
377
344
  if (e && o) {
378
- const i = e.querySelector("ue-switcher");
379
- i && o.appendChild(i);
345
+ const s = e.querySelector("ue-switcher");
346
+ s && o.appendChild(s);
380
347
  }
381
348
  });
382
349
  }
@@ -386,10 +353,10 @@ class qt extends rt {
386
353
  */
387
354
  _moveSelectsIntoItems(t, r) {
388
355
  for (let e = 0; e < r; e++) {
389
- const o = `${$}${e}`, i = t.querySelector(`[data-custom-select-key="${o}"]`), s = t.querySelector(`[data-custom-select-slot="${e}"]`);
390
- if (i && s) {
391
- const n = i.querySelector("ue-select");
392
- n && s.appendChild(n);
356
+ const o = `${C}${e}`, s = t.querySelector(`[data-custom-select-key="${o}"]`), i = t.querySelector(`[data-custom-select-slot="${e}"]`);
357
+ if (s && i) {
358
+ const n = s.querySelector("ue-select");
359
+ n && i.appendChild(n);
393
360
  }
394
361
  }
395
362
  }
@@ -400,11 +367,11 @@ class qt extends rt {
400
367
  * previously-moved toggles, making them permanently lost.
401
368
  */
402
369
  _rescueTogglesToStore(t) {
403
- m.forEach((r) => {
370
+ h.forEach((r) => {
404
371
  const e = t.querySelector(`[data-toggle-key="${r.key}"]`), o = t.querySelector(`[data-action-for="${r.key}"]`);
405
372
  if (o) {
406
- const i = o.querySelector("ue-switcher");
407
- i && e && e.appendChild(i);
373
+ const s = o.querySelector("ue-switcher");
374
+ s && e && e.appendChild(s);
408
375
  }
409
376
  });
410
377
  }
@@ -413,11 +380,11 @@ class qt extends rt {
413
380
  * Same rescue pattern as _rescueTogglesToStore — prevents innerHTML from destroying them.
414
381
  */
415
382
  _rescueSelectsToStore(t) {
416
- for (let r = 0; r < f; r++) {
417
- const e = `${$}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), i = t.querySelector(`[data-custom-select-slot="${r}"]`);
418
- if (i) {
419
- const s = i.querySelector("ue-select");
420
- s && o && o.appendChild(s);
383
+ for (let r = 0; r < g; r++) {
384
+ const e = `${C}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
385
+ if (s) {
386
+ const i = s.querySelector("ue-select");
387
+ i && o && o.appendChild(i);
421
388
  }
422
389
  }
423
390
  }
@@ -427,10 +394,10 @@ class qt extends rt {
427
394
  */
428
395
  _moveDeleteButtonsIntoItems(t, r) {
429
396
  for (let e = 0; e < r; e++) {
430
- const o = `${O}${e}`, i = t.querySelector(`[data-custom-delete-key="${o}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
431
- if (i && s) {
432
- const n = i.querySelector("ue-button");
433
- n && s.appendChild(n);
397
+ const o = `${R}${e}`, s = t.querySelector(`[data-custom-delete-key="${o}"]`), i = t.querySelector(`[data-custom-delete-slot="${e}"]`);
398
+ if (s && i) {
399
+ const n = s.querySelector("ue-button");
400
+ n && i.appendChild(n);
434
401
  }
435
402
  }
436
403
  }
@@ -439,11 +406,11 @@ class qt extends rt {
439
406
  * Same rescue pattern as _rescueSelectsToStore — prevents innerHTML from destroying them.
440
407
  */
441
408
  _rescueDeleteButtonsToStore(t) {
442
- for (let r = 0; r < f; r++) {
443
- const e = `${O}${r}`, o = t.querySelector(`[data-custom-delete-key="${e}"]`), i = t.querySelector(`[data-custom-delete-slot="${r}"]`);
444
- if (i) {
445
- const s = i.querySelector("ue-button");
446
- s && o && o.appendChild(s);
409
+ for (let r = 0; r < g; r++) {
410
+ const e = `${R}${r}`, o = t.querySelector(`[data-custom-delete-key="${e}"]`), s = t.querySelector(`[data-custom-delete-slot="${r}"]`);
411
+ if (s) {
412
+ const i = s.querySelector("ue-button");
413
+ i && o && o.appendChild(i);
447
414
  }
448
415
  }
449
416
  }
@@ -453,10 +420,10 @@ class qt extends rt {
453
420
  */
454
421
  _moveReorderIconsIntoItems(t, r) {
455
422
  for (let e = 0; e < r; e++) {
456
- const o = `${N}${e}`, i = t.querySelector(`[data-reorder-icon-key="${o}"]`), s = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
457
- if (i && s) {
458
- const n = i.querySelector("ue-button");
459
- n && s.appendChild(n);
423
+ const o = `${E}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), i = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
424
+ if (s && i) {
425
+ const n = s.querySelector("ue-button");
426
+ n && i.appendChild(n);
460
427
  }
461
428
  }
462
429
  }
@@ -465,12 +432,12 @@ class qt extends rt {
465
432
  * Same rescue pattern as _rescueDeleteButtonsToStore — prevents innerHTML from destroying them.
466
433
  */
467
434
  _rescueReorderIconsToStore(t) {
468
- const r = m.length + f;
435
+ const r = h.length + g;
469
436
  for (let e = 0; e < r; e++) {
470
- const o = `${N}${e}`, i = t.querySelector(`[data-reorder-icon-key="${o}"]`), s = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
471
- if (s) {
472
- const n = s.querySelector("ue-button");
473
- n && i && i.appendChild(n);
437
+ const o = `${E}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), i = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
438
+ if (i) {
439
+ const n = i.querySelector("ue-button");
440
+ n && s && s.appendChild(n);
474
441
  }
475
442
  }
476
443
  }
@@ -484,81 +451,39 @@ class qt extends rt {
484
451
  return;
485
452
  const e = r.querySelector("[data-composition-list]"), o = r.querySelector("#guido__btn-add-attribute");
486
453
  e && (this._setupDragAndDrop(e, t), this._setupDeleteHandler(e, t)), o && o.addEventListener("click", () => {
487
- const i = new Set(this._readCustomAttributesFromNode()), s = this._getAddableFilters().find((n) => !i.has(n.attributeName));
488
- s && this._onAddAttribute(s.attributeName, s.displayName);
454
+ const s = new Set(this._readCustomAttributesFromNode()), i = this._getAddableFilters().find((n) => !s.has(n.attributeName));
455
+ i && this._onAddAttribute(i.attributeName, i.displayName);
489
456
  }, { signal: t });
490
457
  }
491
- /**
492
- * Builds the composition key order from the orderable list, expanding the
493
- * inline "Product Prices" group into its two sub-keys (in nested DOM order)
494
- * so both price keys stay adjacent and in the user-chosen order.
495
- */
496
- _extractCompositionOrder(t) {
497
- const r = [];
498
- return t.querySelectorAll(".orderable-item").forEach((e) => {
499
- const o = e;
500
- o.dataset.group === "prices" ? o.querySelectorAll(".price-suborderable-item").forEach((i) => {
501
- const s = i.dataset.subkey;
502
- s && r.push(s);
503
- }) : o.dataset.key && r.push(o.dataset.key);
504
- }), r;
505
- }
506
458
  _setupDragAndDrop(t, r) {
507
- this._registerDragHandlers(t, r, {
508
- itemSelector: ".orderable-item",
509
- ignoreSelector: ".price-suborderable-item",
510
- getDropParent: () => t
511
- }), this._registerDragHandlers(t, r, {
512
- itemSelector: ".price-suborderable-item",
513
- getDropParent: (e) => e.parentElement
514
- });
515
- }
516
- /**
517
- * Wires drag/drop reordering for one item level on the shared list. Both the
518
- * top-level items and the nested price sub-items use this; they never fight
519
- * because each only sets its `dragged` ref when its own `itemSelector` matches
520
- * at dragstart (and the top-level one additionally ignores drags originating
521
- * inside `ignoreSelector`). Every drop re-reads the full composition via
522
- * `_extractCompositionOrder`, so both levels commit through `_onReorder`
523
- * identically.
524
- */
525
- _registerDragHandlers(t, r, e) {
526
- let o = null, i = null;
527
- const s = (n) => n.target.closest(e.itemSelector);
528
- t.addEventListener("dragstart", (n) => {
459
+ let e = null, o = null;
460
+ t.addEventListener("dragstart", (s) => {
529
461
  var a;
530
- const c = n.target;
531
- if (e.ignoreSelector && c.closest(e.ignoreSelector))
532
- return;
533
- const l = s(n);
534
- l && (o = l, l.classList.add("dragging"), (a = n.dataTransfer) == null || a.setData("text/plain", l.dataset.key ?? l.dataset.subkey ?? ""));
462
+ const n = s.target.closest(".orderable-item");
463
+ n && (e = n, n.classList.add("dragging"), (a = s.dataTransfer) == null || a.setData("text/plain", n.dataset.key || ""));
535
464
  }, { signal: r }), t.addEventListener("dragend", () => {
536
- o == null || o.classList.remove("dragging"), i == null || i.classList.remove("drag-over"), o = null, i = null;
537
- }, { signal: r }), t.addEventListener("dragover", (n) => {
538
- if (!o)
465
+ e && e.classList.remove("dragging"), e = null, o == null || o.classList.remove("drag-over"), o = null;
466
+ }, { signal: r }), t.addEventListener("dragover", (s) => {
467
+ s.preventDefault();
468
+ const n = s.target.closest(".orderable-item"), a = n && n !== e ? n : null;
469
+ a !== o && (o == null || o.classList.remove("drag-over"), o = a, o == null || o.classList.add("drag-over"));
470
+ }, { signal: r }), t.addEventListener("drop", (s) => {
471
+ s.preventDefault();
472
+ const n = s.target.closest(".orderable-item");
473
+ if (!n || !e || n === e)
539
474
  return;
540
- const c = s(n);
541
- if (!c)
542
- return;
543
- n.preventDefault();
544
- const l = c !== o ? c : null;
545
- l !== i && (i == null || i.classList.remove("drag-over"), i = l, i == null || i.classList.add("drag-over"));
546
- }, { signal: r }), t.addEventListener("drop", (n) => {
547
- var d;
548
- const c = o && s(n);
549
- if (!o || !c || c === o)
550
- return;
551
- n.preventDefault();
552
- const l = c.getBoundingClientRect(), a = n.clientY < l.top + l.height / 2;
553
- (d = e.getDropParent(c)) == null || d.insertBefore(o, a ? c : c.nextSibling), i == null || i.classList.remove("drag-over"), o.classList.remove("dragging"), o = null, i = null, this._onReorder(this._extractCompositionOrder(t));
475
+ const a = n.getBoundingClientRect(), c = a.top + a.height / 2;
476
+ s.clientY < c ? t.insertBefore(e, n) : t.insertBefore(e, n.nextSibling), o == null || o.classList.remove("drag-over"), o = null, e.classList.remove("dragging");
477
+ const u = t.querySelectorAll(".orderable-item"), d = Array.from(u).map((b) => b.dataset.key).filter(Boolean);
478
+ this._onReorder(d), e = null;
554
479
  }, { signal: r });
555
480
  }
556
481
  _setupDeleteHandler(t, r) {
557
482
  t.addEventListener("click", (e) => {
558
- const i = e.target.closest(".custom-attr-delete");
559
- if (!i)
483
+ const s = e.target.closest(".custom-attr-delete");
484
+ if (!s)
560
485
  return;
561
- const s = i.closest("[data-custom-index]"), n = s == null ? void 0 : s.dataset.customIndex;
486
+ const i = s.closest("[data-custom-index]"), n = i == null ? void 0 : i.dataset.customIndex;
562
487
  n !== void 0 && this._onDeleteCustomAttribute(Number(n));
563
488
  }, { signal: r });
564
489
  }
@@ -566,10 +491,10 @@ class qt extends rt {
566
491
  // Actions (Add, Delete, Reorder)
567
492
  // ========================================================================
568
493
  _onAddAttribute(t, r) {
569
- const e = `${p}${t}`, o = this._readCompositionFromNode();
494
+ const e = `${m}${t}`, o = this._readCompositionFromNode();
570
495
  o.push(e);
571
- const i = [...this._readCustomAttributesFromNode(), t];
572
- this._updateBothAttributes(o, i), this._injectCustomAttributeHtml(t, r, e, o), this._renderOrderableItems(o, i), this._initializeCustomSelects(i), this._updateAddButtonState();
496
+ const s = [...this._readCustomAttributesFromNode(), t];
497
+ this._updateBothAttributes(o, s), this._injectCustomAttributeHtml(t, r, e, o), this._renderOrderableItems(o, s), this._initializeCustomSelects(s), this._updateAddButtonState();
573
498
  }
574
499
  /**
575
500
  * Removes a single custom attribute by its index in the customAttrs array.
@@ -579,8 +504,8 @@ class qt extends rt {
579
504
  const r = this._readCustomAttributesFromNode();
580
505
  if (r[t] === void 0)
581
506
  return;
582
- const o = this._readCompositionFromNode(), i = this._findNthCustomKeyIndex(o, t), s = o.filter((c, l) => l !== i), n = r.filter((c, l) => l !== t);
583
- this._updateBothAttributes(s, n), this._removeCustomAttributeHtml(s), this._renderOrderableItems(s, n), this._initializeCustomSelects(n), this._updateAddButtonState();
507
+ const o = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(o, t), i = o.filter((a, c) => c !== s), n = r.filter((a, c) => c !== t);
508
+ this._updateBothAttributes(i, n), this._removeCustomAttributeHtml(i), this._renderOrderableItems(i, n), this._initializeCustomSelects(n), this._updateAddButtonState();
584
509
  }
585
510
  /**
586
511
  * Handles changing a custom attribute's selection via its inline _GuSelect.
@@ -590,21 +515,16 @@ class qt extends rt {
590
515
  const e = this._readCustomAttributesFromNode(), o = e[t];
591
516
  if (o === void 0 || o === r)
592
517
  return;
593
- const i = `${p}${r}`, s = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(s, t);
594
- n !== -1 && (s[n] = i), e[t] = r;
595
- const c = this._getDisplayNameForAttribute(r);
596
- this._updateBothAttributes(s, e), this._injectCustomAttributeHtml(r, c, i, s), this._renderOrderableItems(s, e), this._initializeCustomSelects(e);
518
+ const s = `${m}${r}`, i = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(i, t);
519
+ n !== -1 && (i[n] = s), e[t] = r;
520
+ const a = this._getDisplayNameForAttribute(r);
521
+ this._updateBothAttributes(i, e), this._injectCustomAttributeHtml(r, a, s, i), this._renderOrderableItems(i, e), this._initializeCustomSelects(e);
597
522
  }
598
523
  _onReorder(t) {
599
- const r = t.filter((e) => e.startsWith(p)).map((e) => e.substring(p.length));
524
+ const r = t.filter((e) => e.startsWith(m)).map((e) => e.substring(m.length));
600
525
  this.reorderInProgress = !0;
601
526
  try {
602
- this._updateBothAttributes(t, r);
603
- const e = !P.getConfig(this.currentNode).priceMovedToNextLine;
604
- this._getCurrentLayout() === "grid" && !e ? this._reorderProductAttributes(t) : this.currentNode && yt({
605
- currentNode: this.currentNode,
606
- documentModifier: this.api.getDocumentModifier()
607
- });
527
+ this._updateBothAttributes(t, r), this._getCurrentLayout() === "grid" && this._reorderProductAttributes(t);
608
528
  } finally {
609
529
  this.reorderInProgress = !1;
610
530
  }
@@ -619,60 +539,60 @@ class qt extends rt {
619
539
  this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, r, e, o) : this._injectListAttributeRow(t, r, e, o);
620
540
  }
621
541
  _injectGridAttributeRow(t, r, e, o) {
622
- const i = this.currentNode.querySelectorAll(H);
623
- if (!(i != null && i.length))
542
+ const s = this.currentNode.querySelectorAll(N);
543
+ if (!(s != null && s.length))
624
544
  return;
625
- const s = P.getConfig(this.currentNode), c = `0 ${Math.floor(s.columnSpacing / 2)}px`, l = this.api.getDocumentModifier(), a = this.store.recommendationProducts.length;
626
- let d = 0;
627
- i.forEach((u) => {
628
- var B;
629
- const h = u.querySelector(T), C = ((B = h == null ? void 0 : h.querySelectorAll(`.${at}`)) == null ? void 0 : B.length) || 1, q = (100 / C).toFixed(2), { bgStyle: G, bgAttr: z } = this._extractSegmentBgFromCard(u), R = a > 0 ? Math.min(C, a - d) : C, Y = o.map((w) => {
630
- if (w === e) {
631
- const X = Array.from(
632
- { length: R },
633
- ($t, Q) => {
634
- const Z = this._resolveAttributeContent(
545
+ const i = nt.getConfig(this.currentNode), a = `0 ${Math.floor(i.columnSpacing / 2)}px`, c = this.api.getDocumentModifier(), l = this.store.recommendationProducts.length;
546
+ let u = 0;
547
+ s.forEach((d) => {
548
+ var k;
549
+ const b = d.querySelector(S), $ = ((k = b == null ? void 0 : b.querySelectorAll(`.${at}`)) == null ? void 0 : k.length) || 1, U = (100 / $).toFixed(2), { bgStyle: j, bgAttr: W } = this._extractSegmentBgFromCard(d), O = l > 0 ? Math.min($, l - u) : $, K = o.map((H) => {
550
+ if (H === e) {
551
+ const z = Array.from(
552
+ { length: O },
553
+ (St, Y) => {
554
+ const X = this._resolveAttributeContent(
635
555
  t,
636
556
  r,
637
- d + Q
557
+ u + Y
638
558
  );
639
559
  return this._getGridCellHtml(
640
560
  t,
641
- Z,
642
- q,
643
- G,
644
- z,
645
- c
561
+ X,
562
+ U,
563
+ j,
564
+ W,
565
+ a
646
566
  );
647
567
  }
648
- ).join(""), J = ut(q, c).repeat(C - R);
649
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${D}="1">${X}${J}</tr>`;
568
+ ).join(""), G = dt(U, a).repeat($ - O);
569
+ return `<tr class="recommendation-attribute-row" ${y}="${e}" ${v}="1">${z}${G}</tr>`;
650
570
  }
651
- const L = u.querySelector(
652
- `${T}[${y}="${w}"]`
571
+ const D = d.querySelector(
572
+ `${S}[${y}="${H}"]`
653
573
  );
654
- return L && "getOuterHTML" in L ? L.getOuterHTML() : "";
574
+ return D && "getOuterHTML" in D ? D.getOuterHTML() : "";
655
575
  }).join("");
656
- d += R, a > 0 && d >= a && (d = 0), l.modifyHtml(u).setInnerHtml(Y);
657
- }), l.apply(new A(`${this.api.translate("Add custom attribute")}: ${r}`));
576
+ u += O, l > 0 && u >= l && (u = 0), c.modifyHtml(d).setInnerHtml(K);
577
+ }), c.apply(new A(`${this.api.translate("Add custom attribute")}: ${r}`));
658
578
  }
659
579
  _injectListAttributeRow(t, r, e, o) {
660
- const i = this.currentNode.querySelectorAll(j);
661
- if (!(i != null && i.length))
580
+ const s = this.currentNode.querySelectorAll(M);
581
+ if (!(s != null && s.length))
662
582
  return;
663
- const s = o.filter((c) => c !== k && c !== U), n = this.api.getDocumentModifier();
664
- i.forEach((c, l) => {
665
- const a = s.map((d) => {
666
- if (d === e) {
667
- const h = this._resolveAttributeContent(t, r, l);
668
- return this._getListRowHtml(t, h, e);
583
+ const i = o.filter((a) => a !== L && a !== B), n = this.api.getDocumentModifier();
584
+ s.forEach((a, c) => {
585
+ const l = i.map((u) => {
586
+ if (u === e) {
587
+ const b = this._resolveAttributeContent(t, r, c);
588
+ return this._getListRowHtml(t, b, e);
669
589
  }
670
- const u = c.querySelector(
671
- `${T}[${y}="${d}"]`
590
+ const d = a.querySelector(
591
+ `${S}[${y}="${u}"]`
672
592
  );
673
- return u && "getOuterHTML" in u ? u.getOuterHTML() : "";
593
+ return d && "getOuterHTML" in d ? d.getOuterHTML() : "";
674
594
  }).join("");
675
- n.modifyHtml(c).setInnerHtml(a);
595
+ n.modifyHtml(a).setInnerHtml(l);
676
596
  }), n.apply(new A(`${this.api.translate("Add custom attribute")}: ${r}`));
677
597
  }
678
598
  /**
@@ -684,16 +604,16 @@ class qt extends rt {
684
604
  return;
685
605
  const r = this._getCurrentLayout(), e = this.api.getDocumentModifier();
686
606
  if (r === "grid") {
687
- const o = this.currentNode.querySelectorAll(H);
688
- o == null || o.forEach((i) => {
689
- const s = this._buildCompositionHtml(i, t);
690
- e.modifyHtml(i).setInnerHtml(s);
607
+ const o = this.currentNode.querySelectorAll(N);
608
+ o == null || o.forEach((s) => {
609
+ const i = this._buildCompositionHtml(s, t);
610
+ e.modifyHtml(s).setInnerHtml(i);
691
611
  });
692
612
  } else {
693
- const o = t.filter((s) => s !== k && s !== U), i = this.currentNode.querySelectorAll(j);
694
- i == null || i.forEach((s) => {
695
- const n = this._buildCompositionHtml(s, o);
696
- e.modifyHtml(s).setInnerHtml(n);
613
+ const o = t.filter((i) => i !== L && i !== B), s = this.currentNode.querySelectorAll(M);
614
+ s == null || s.forEach((i) => {
615
+ const n = this._buildCompositionHtml(i, o);
616
+ e.modifyHtml(i).setInnerHtml(n);
697
617
  });
698
618
  }
699
619
  e.apply(new A(this.api.translate("Remove custom attribute")));
@@ -709,7 +629,7 @@ class qt extends rt {
709
629
  * producing a flicker on the custom attribute dropdowns.
710
630
  */
711
631
  _updateBothAttributes(t, r) {
712
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(W, t.join(",")).setAttribute(F, JSON.stringify(r)).apply(new A(this.api.translate("Update card composition")));
632
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(V, t.join(",")).setAttribute(q, JSON.stringify(r)).apply(new A(this.api.translate("Update card composition")));
713
633
  }
714
634
  /**
715
635
  * Reorders attribute rows within each product card based on composition order.
@@ -718,13 +638,13 @@ class qt extends rt {
718
638
  _reorderProductAttributes(t) {
719
639
  if (!this.currentNode)
720
640
  return;
721
- const r = this.currentNode.querySelectorAll(H);
641
+ const r = this.currentNode.querySelectorAll(N);
722
642
  if (!(r != null && r.length))
723
643
  return;
724
644
  const e = this.api.getDocumentModifier();
725
645
  r.forEach((o) => {
726
- const i = this._buildCompositionHtml(o, t);
727
- e.modifyHtml(o).setInnerHtml(i);
646
+ const s = this._buildCompositionHtml(o, t);
647
+ e.modifyHtml(o).setInnerHtml(s);
728
648
  }), e.apply(new A(this.api.translate("Reorder product attributes")));
729
649
  }
730
650
  /**
@@ -733,8 +653,8 @@ class qt extends rt {
733
653
  */
734
654
  _buildCompositionHtml(t, r) {
735
655
  return r.reduce((e, o) => {
736
- const i = t.querySelector(`${T}[${y}="${o}"]`);
737
- return i && "getOuterHTML" in i ? e + i.getOuterHTML() : e;
656
+ const s = t.querySelector(`${S}[${y}="${o}"]`);
657
+ return s && "getOuterHTML" in s ? e + s.getOuterHTML() : e;
738
658
  }, "");
739
659
  }
740
660
  // ========================================================================
@@ -743,14 +663,14 @@ class qt extends rt {
743
663
  _applyVisibilityToBlock(t, r) {
744
664
  if (!this.currentNode)
745
665
  return;
746
- const e = this.currentNode.querySelectorAll(`${T}[${y}="${t}"]`);
666
+ const e = this.currentNode.querySelectorAll(`${S}[${y}="${t}"]`);
747
667
  if (!(e != null && e.length))
748
668
  return;
749
- const o = r ? "1" : "0", i = r ? this.api.translate("visible") : this.api.translate("hidden"), s = `${this.api.translate("Set visibility")}: ${t} → ${i}`, n = this.api.getDocumentModifier();
750
- e.forEach((c) => {
751
- const l = _t(c), a = r ? l : "none";
752
- n.modifyHtml(c).setStyle("display", a).setAttribute(D, o);
753
- }), n.apply(new A(s));
669
+ const o = r ? "1" : "0", s = r ? this.api.translate("visible") : this.api.translate("hidden"), i = `${this.api.translate("Set visibility")}: ${t} → ${s}`, n = this.api.getDocumentModifier();
670
+ e.forEach((a) => {
671
+ const c = ft(a), l = r ? c : "none";
672
+ n.modifyHtml(a).setStyle("display", l).setAttribute(v, o);
673
+ }), n.apply(new A(i));
754
674
  }
755
675
  // ========================================================================
756
676
  // Utilities
@@ -763,7 +683,7 @@ class qt extends rt {
763
683
  _findNthCustomKeyIndex(t, r) {
764
684
  let e = 0;
765
685
  for (let o = 0; o < t.length; o++)
766
- if (t[o].startsWith(p)) {
686
+ if (t[o].startsWith(m)) {
767
687
  if (e === r)
768
688
  return o;
769
689
  e++;
@@ -771,7 +691,7 @@ class qt extends rt {
771
691
  return -1;
772
692
  }
773
693
  _getCurrentLayout() {
774
- return this.store.recommendationConfigs.orientation || St(this.currentNode);
694
+ return this.store.recommendationConfigs.orientation || bt(this.currentNode);
775
695
  }
776
696
  /**
777
697
  * Extracts background color properties from existing card elements.
@@ -783,18 +703,18 @@ class qt extends rt {
783
703
  var o;
784
704
  const r = t.querySelector(".product-card-segment");
785
705
  if (r && "getAttribute" in r) {
786
- const s = (r.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
787
- if (s) {
706
+ const i = (r.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
707
+ if (i) {
788
708
  const n = r.getAttribute("bgcolor") || "";
789
- return { bgStyle: `background-color: ${s[1].trim()};`, bgAttr: n };
709
+ return { bgStyle: `background-color: ${i[1].trim()};`, bgAttr: n };
790
710
  }
791
711
  }
792
712
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(".product-card-wrapper");
793
713
  if (e && "getStyle" in e) {
794
- const i = e.getStyle("background-color");
795
- if (i && i !== "transparent") {
796
- const s = "getAttribute" in e && e.getAttribute("bgcolor") || "";
797
- return { bgStyle: `background-color: ${i};`, bgAttr: s };
714
+ const s = e.getStyle("background-color");
715
+ if (s && s !== "transparent") {
716
+ const i = "getAttribute" in e && e.getAttribute("bgcolor") || "";
717
+ return { bgStyle: `background-color: ${s};`, bgAttr: i };
798
718
  }
799
719
  }
800
720
  return { bgStyle: "", bgAttr: "" };
@@ -804,18 +724,17 @@ class qt extends rt {
804
724
  return t ? t.querySelector("[data-card-composition-control]") : null;
805
725
  }
806
726
  /**
807
- * Ensures composition reorder is enabled. Both grid and list layouts now
808
- * support reordering top-level items and the nested price sub-items are all
809
- * draggable. (Items render with `draggable="true"`; this just clears any stale
810
- * disabled state.)
727
+ * Adds/removes orderable-disabled class based on layout orientation.
728
+ * List layout hides drag handles via CSS and disables draggable attribute
729
+ * to prevent native browser drag-and-drop from working without the handle.
811
730
  */
812
731
  _updateOrderableState() {
813
- const t = this._getControlContainer();
814
- if (!t)
732
+ const r = this._getCurrentLayout() === "list", e = this._getControlContainer();
733
+ if (!e)
815
734
  return;
816
- const r = t.querySelector("[data-composition-list]");
817
- r && (r.classList.remove("orderable-disabled"), r.querySelectorAll(".orderable-item").forEach((e) => {
818
- e.setAttribute("draggable", "true");
735
+ const o = e.querySelector("[data-composition-list]");
736
+ o && (o.classList.toggle("orderable-disabled", r), o.querySelectorAll(".orderable-item").forEach((s) => {
737
+ s.setAttribute("draggable", r ? "false" : "true");
819
738
  }));
820
739
  }
821
740
  /**
@@ -823,11 +742,11 @@ class qt extends rt {
823
742
  * or when all available filters have already been added (no unused attributes left).
824
743
  */
825
744
  _updateAddButtonState() {
826
- const t = this._readCustomAttributesFromNode(), r = t.length >= f, e = new Set(t), o = this._getAddableFilters(), i = o.length > 0 && o.every((s) => e.has(s.attributeName));
745
+ const t = this._readCustomAttributesFromNode(), r = t.length >= g, e = new Set(t), o = this._getAddableFilters(), s = o.length > 0 && o.every((i) => e.has(i.attributeName));
827
746
  this.api.setUIEAttribute(
828
- K.ADD_ATTRIBUTE,
829
- E.BUTTON.disabled,
830
- r || i ? "true" : "false"
747
+ x.ADD_ATTRIBUTE,
748
+ I.BUTTON.disabled,
749
+ r || s ? "true" : "false"
831
750
  );
832
751
  }
833
752
  /**
@@ -849,7 +768,7 @@ class qt extends rt {
849
768
  * excluding default attributes already covered by built-in toggle items.
850
769
  */
851
770
  _getAddableFilters() {
852
- return Object.values(this.store.filterList).filter((t) => !(t.type === "defaultAttribute" && nt.has(t.attributeName)));
771
+ return Object.values(this.store.filterList).filter((t) => !(t.type === "defaultAttribute" && it.has(t.attributeName)));
853
772
  }
854
773
  /**
855
774
  * Looks up the display name for an attribute from the store's filterList.
@@ -857,7 +776,7 @@ class qt extends rt {
857
776
  */
858
777
  _getDisplayNameForAttribute(t) {
859
778
  const r = Object.values(this.store.filterList).find((e) => e.attributeName === t);
860
- return r ? r.displayName : pt(t);
779
+ return r ? r.displayName : ht(t);
861
780
  }
862
781
  /**
863
782
  * Resolves the display content for a custom attribute cell.
@@ -865,29 +784,29 @@ class qt extends rt {
865
784
  */
866
785
  _resolveAttributeContent(t, r, e) {
867
786
  var n;
868
- const i = this.store.recommendationProducts[e], s = gt(t, this.store.filterList) ? i == null ? void 0 : i[t] : (n = i == null ? void 0 : i.product_attributes) == null ? void 0 : n[t];
869
- return bt(s) ?? r;
787
+ const s = this.store.recommendationProducts[e], i = pt(t, this.store.filterList) ? s == null ? void 0 : s[t] : (n = s == null ? void 0 : s.product_attributes) == null ? void 0 : n[t];
788
+ return _t(i) ?? r;
870
789
  }
871
- _getGridCellHtml(t, r, e, o = "", i = "", s = "") {
872
- const n = `${p}${t}`, c = V(ct, [n], this.store.filterList), l = {
790
+ _getGridCellHtml(t, r, e, o = "", s = "", i = "") {
791
+ const n = `${m}${t}`, a = w(ct, [n], this.store.filterList), c = {
873
792
  [t]: r,
874
793
  product_attributes: { [t]: r }
875
794
  };
876
- let a = c[n](l);
877
- return a = a.replace("<td", `<td width="${e}%"`), s && (a = a.replace(
878
- `padding: ${dt}`,
879
- `padding: ${s}`
880
- )), o && (a = a.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${o}"`)), i && (a = a.replace(/border="0"/, `border="0" bgcolor="${i}"`)), a;
795
+ let l = a[n](c);
796
+ return l = l.replace("<td", `<td width="${e}%"`), i && (l = l.replace(
797
+ `padding: ${ut}`,
798
+ `padding: ${i}`
799
+ )), o && (l = l.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${o}"`)), s && (l = l.replace(/border="0"/, `border="0" bgcolor="${s}"`)), l;
881
800
  }
882
801
  _getListRowHtml(t, r, e) {
883
- const o = V(mt, [e], this.store.filterList), i = {
802
+ const o = w(mt, [e], this.store.filterList), s = {
884
803
  [t]: r,
885
804
  product_attributes: { [t]: r }
886
- }, n = o[e](i).replace(/<tr>/, "").replace(/<\/tr>/, "");
887
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${D}="1">${n}</tr>`;
805
+ }, n = o[e](s).replace(/<tr>/, "").replace(/<\/tr>/, "");
806
+ return `<tr class="recommendation-attribute-row" ${y}="${e}" ${v}="1">${n}</tr>`;
888
807
  }
889
808
  }
890
809
  export {
891
- Ct as COMPOSITION_CONTROL_BLOCK_ID,
892
- qt as RecommendationCardCompositionControl
810
+ yt as COMPOSITION_CONTROL_BLOCK_ID,
811
+ Ut as RecommendationCardCompositionControl
893
812
  };