@useinsider/guido 3.8.1-beta.95947aa → 3.8.1-beta.9f4cb2c

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 (34) hide show
  1. package/dist/composables/useHtmlValidator.js +133 -180
  2. package/dist/config/compiler/utils/recommendationCompilerUtils.js +57 -58
  3. package/dist/config/migrator/recommendation/extractors.js +22 -44
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
  5. package/dist/config/migrator/recommendationMigrator.js +31 -30
  6. package/dist/extensions/Blocks/Recommendation/block.js +1 -4
  7. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +20 -26
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +145 -176
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +57 -58
  10. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +31 -43
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +45 -55
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +59 -66
  14. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
  15. package/dist/extensions/Blocks/Recommendation/extension.js +2 -3
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +12 -13
  19. package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -7
  20. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  21. package/dist/src/composables/useHtmlValidator.d.ts +0 -27
  22. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
  23. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
  24. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  25. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
  26. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
  30. package/package.json +1 -1
  31. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
  32. package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
  33. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
  34. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
@@ -1,42 +1,42 @@
1
- var Q = Object.defineProperty;
2
- var Z = (p, g, t) => g in p ? Q(p, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[g] = t;
3
- var T = (p, g, t) => Z(p, typeof g != "symbol" ? g + "" : g, t);
4
- import { UIElementType as f, UEAttr as v, ModificationDescription as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as tt } from "../../../common-control.js";
6
- import { ATTR_PRODUCT_IMAGE as B, ATTR_PRODUCT_NAME as et, ATTR_PRODUCT_PRICE as rt, ATTR_PRODUCT_OLD_PRICE as ot, ATTR_PRODUCT_OMNIBUS_PRICE as st, ATTR_PRODUCT_OMNIBUS_DISCOUNT as it, ATTR_PRODUCT_BUTTON as H, ATTR_DATA_CUSTOM_ATTRIBUTES as F, ATTR_CUSTOM_PREFIX as d, BUILT_IN_DEFAULT_ATTRIBUTES as nt } from "../../constants/selectors.js";
7
- import { DEFAULT_COMPOSITION as P, DEFAULT_VISIBILITY as w } from "../../constants/defaultConfig.js";
8
- import { RecommendationConfigService as $ } 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 S = (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 D, 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 U, 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
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 { toDisplayName as ht, isDefaultAttribute as pt, toDisplayableAttributeValue as gt, buildElementRenderer as M } from "../../templates/utils.js";
12
+ import { toDisplayName as ht, isDefaultAttribute as pt, toDisplayableAttributeValue as _t, buildElementRenderer as w } from "../../templates/utils.js";
13
13
  import { getTableDisplayValue as ft } from "../../utils/tagName.js";
14
- import { isPartnerManagedBlock as _t, getCurrentLayout as bt } from "../main/utils.js";
15
- const yt = "ui-elements-recommendation-card-composition", A = ".recommendation-attribute-row", L = ".product-card-wrapper > tbody", V = ".product-info-cell > table > tbody", x = "data-card-composition", y = "data-attribute-type", N = "data-visibility", j = {
14
+ import { getCurrentLayout as gt } from "../main/utils.js";
15
+ const bt = "ui-elements-recommendation-card-composition", C = ".recommendation-attribute-row", L = ".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
- }, _ = 5, E = "reorderIcon_", h = [
18
- { key: B, label: "Product Image" },
19
- { key: et, label: "Product Name" },
20
- { key: rt, label: "Product Price" },
21
- { key: ot, label: "Product Original Price" },
22
- { key: st, label: "Omnibus Price" },
23
- { key: it, label: "Omnibus Discount" },
24
- { key: H, label: "Product Button" }
25
- ], Ct = new Set(h.map((p) => p.key)), S = "customAttr_", R = "deleteAttr_";
26
- class Ht extends tt {
17
+ }, g = 5, E = "reorderIcon_", h = [
18
+ { key: D, label: "Product Image" },
19
+ { key: tt, label: "Product Name" },
20
+ { key: et, label: "Product Price" },
21
+ { key: rt, label: "Product Original Price" },
22
+ { key: ot, label: "Omnibus Price" },
23
+ { key: st, label: "Omnibus Discount" },
24
+ { key: U, label: "Product Button" }
25
+ ], yt = new Set(h.map((p) => p.key)), T = "customAttr_", R = "deleteAttr_";
26
+ class Ut extends Z {
27
27
  constructor() {
28
28
  super(...arguments);
29
- T(this, "store", lt());
30
- T(this, "unsubscribeStore", null);
31
- T(this, "eventController", null);
29
+ S(this, "store", lt());
30
+ S(this, "unsubscribeStore", null);
31
+ S(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
- T(this, "reorderInProgress", !1);
36
+ S(this, "reorderInProgress", !1);
37
37
  }
38
38
  getId() {
39
- return yt;
39
+ return bt;
40
40
  }
41
41
  // ========================================================================
42
42
  // Lifecycle
@@ -47,23 +47,23 @@ class Ht extends tt {
47
47
  ${this._GuToggle(`visibility_${l.key}`)}
48
48
  </div>
49
49
  `).join(""), r = Array.from(
50
- { length: _ },
50
+ { length: g },
51
51
  (l, u) => `
52
- <div data-custom-select-key="${S}${u}" style="display: none;">
52
+ <div data-custom-select-key="${T}${u}" style="display: none;">
53
53
  ${this._GuSelect({
54
- name: `${S}${u}`,
54
+ name: `${T}${u}`,
55
55
  placeholder: this.api.translate("Select Attribute"),
56
56
  options: []
57
57
  })}
58
58
  </div>
59
59
  `
60
- ).join(""), e = h.length + _, o = Array.from(
60
+ ).join(""), e = h.length + g, o = Array.from(
61
61
  { length: e },
62
62
  (l, u) => `
63
63
  <div data-reorder-icon-key="${E}${u}" style="display: none;">
64
64
  <${f.BUTTON}
65
65
  class="drag-handle-btn flat-inline flat-white"
66
- ${v.BUTTON.name}="${E}${u}"
66
+ ${I.BUTTON.name}="${E}${u}"
67
67
  >
68
68
  <${f.ICON}
69
69
  src="reorder"
@@ -73,12 +73,12 @@ class Ht extends tt {
73
73
  </div>
74
74
  `
75
75
  ).join(""), s = Array.from(
76
- { length: _ },
76
+ { length: g },
77
77
  (l, u) => `
78
78
  <div data-custom-delete-key="${R}${u}" style="display: none;">
79
79
  <${f.BUTTON}
80
80
  class="custom-attr-delete flat-inline flat-white"
81
- ${v.BUTTON.name}="${R}${u}"
81
+ ${I.BUTTON.name}="${R}${u}"
82
82
  >
83
83
  <${f.ICON}
84
84
  src="delete"
@@ -89,15 +89,15 @@ class Ht extends tt {
89
89
  `
90
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"), a = 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="${i}" target="_blank" rel="noopener noreferrer">${a}</a>.
100
+ <a href="${i}" target="_blank" rel="noopener noreferrer">${c}</a>.
101
101
  </p>
102
102
  </div>
103
103
 
@@ -120,7 +120,7 @@ class Ht extends tt {
120
120
  <div class="orderable-list" data-composition-list></div>
121
121
 
122
122
  ${this._GuButton({
123
- name: j.ADD_ATTRIBUTE,
123
+ name: x.ADD_ATTRIBUTE,
124
124
  label: this.api.translate("Add Attribute"),
125
125
  id: "guido__btn-add-attribute"
126
126
  })}
@@ -128,24 +128,10 @@ class Ht extends tt {
128
128
  `;
129
129
  }
130
130
  onRender() {
131
- this._initializeComposition(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges(), this._syncDisabledState();
132
- }
133
- /**
134
- * Card composition restructures the block (toggles/reorders/adds attribute
135
- * cells), which would corrupt a partner-managed (`ins-skip-compile`) block's
136
- * preserved markup. There is no native tab-disable API, so the whole control
137
- * container is rendered inert (greyed + non-interactive) instead.
138
- */
139
- _syncDisabledState() {
140
- var e;
141
- const t = (e = this.getContainer()) == null ? void 0 : e.querySelector("[data-card-composition-control]");
142
- if (!t)
143
- return;
144
- const r = _t(this.currentNode);
145
- t.style.pointerEvents = r ? "none" : "", t.style.opacity = r ? "0.5" : "";
131
+ this._initializeComposition(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges();
146
132
  }
147
133
  onTemplateNodeUpdated(t) {
148
- super.onTemplateNodeUpdated(t), !this.reorderInProgress && (this._initializeComposition(), this._updateOrderableState(), this._syncDisabledState());
134
+ super.onTemplateNodeUpdated(t), !this.reorderInProgress && (this._initializeComposition(), this._updateOrderableState());
149
135
  }
150
136
  onDestroy() {
151
137
  super.onDestroy(), this.eventController && (this.eventController.abort(), this.eventController = null), this.unsubscribeStore && (this.unsubscribeStore(), this.unsubscribeStore = null);
@@ -163,8 +149,8 @@ class Ht extends tt {
163
149
  this._applyVisibilityToBlock(t.key, r);
164
150
  });
165
151
  });
166
- for (let t = 0; t < _; t++) {
167
- const r = `${S}${t}`, e = t;
152
+ for (let t = 0; t < g; t++) {
153
+ const r = `${T}${t}`, e = t;
168
154
  this.api.onValueChanged(r, (o) => {
169
155
  this._onCustomAttributeChanged(e, o);
170
156
  });
@@ -176,42 +162,36 @@ class Ht extends tt {
176
162
  _readCompositionFromNode() {
177
163
  if (!this.currentNode || !("getAttribute" in this.currentNode))
178
164
  return [...P];
179
- const t = this.currentNode.getAttribute(x);
180
- if (t)
181
- return t.split(",").filter(Boolean);
182
- const { composition: r } = $.getConfig(this.currentNode);
183
- return r != null && r.length ? [...r] : [...P];
165
+ const t = this.currentNode.getAttribute(V);
166
+ return t ? t.split(",").filter(Boolean) : [...P];
184
167
  }
185
168
  _readCustomAttributesFromNode() {
186
169
  if (!this.currentNode || !("getAttribute" in this.currentNode))
187
170
  return [];
188
- const t = this.currentNode.getAttribute(F);
189
- if (t)
190
- try {
191
- return JSON.parse(t);
192
- } catch {
193
- return [];
194
- }
195
- return this._readCompositionFromNode().filter((r) => r.startsWith(d)).map((r) => r.substring(d.length));
171
+ const t = this.currentNode.getAttribute(q);
172
+ if (!t)
173
+ return [];
174
+ try {
175
+ return JSON.parse(t);
176
+ } catch {
177
+ return [];
178
+ }
196
179
  }
197
180
  _readVisibilityFromRows() {
198
181
  if (!this.currentNode)
199
182
  return this._getDefaultVisibilities();
200
- const t = Array.from(this.currentNode.querySelectorAll(A)), r = this._extractVisibilityFromRows(t);
201
- if (Object.keys(r).length > 0)
202
- return this._mergeWithDefaults(r);
203
- const e = $.getConfig(this.currentNode).visibility;
204
- return this._mergeWithDefaults({ ...e });
183
+ const t = Array.from(this.currentNode.querySelectorAll(C)), r = this._extractVisibilityFromRows(t);
184
+ return this._mergeWithDefaults(r);
205
185
  }
206
186
  _getDefaultVisibilities() {
207
- return { ...w };
187
+ return { ...F };
208
188
  }
209
189
  _extractVisibilityFromRows(t) {
210
190
  const r = {};
211
191
  return t.forEach((e) => {
212
192
  if (!("getAttribute" in e))
213
193
  return;
214
- const o = e.getAttribute(y), s = e.getAttribute(N);
194
+ const o = e.getAttribute(y), s = e.getAttribute(v);
215
195
  o && s !== null && (r[o] = this._parseVisibilityValue(s));
216
196
  }), r;
217
197
  }
@@ -219,7 +199,7 @@ class Ht extends tt {
219
199
  return t === "1" || t === "true";
220
200
  }
221
201
  _mergeWithDefaults(t) {
222
- return Object.entries(w).forEach(([r, e]) => {
202
+ return Object.entries(F).forEach(([r, e]) => {
223
203
  r in t || (t[r] = e);
224
204
  }), t;
225
205
  }
@@ -243,19 +223,19 @@ class Ht extends tt {
243
223
  return !1;
244
224
  const s = new Set(r);
245
225
  let i = 0, n = 0;
246
- const c = t.map((a) => {
247
- if (Ct.has(a)) {
248
- const l = h.find((u) => u.key === a);
226
+ const a = t.map((c) => {
227
+ if (yt.has(c)) {
228
+ const l = h.find((u) => u.key === c);
249
229
  return this._createBuiltInItemHtml(l, n++);
250
230
  }
251
- if (a.startsWith(d)) {
252
- const l = a.substring(d.length);
231
+ if (c.startsWith(m)) {
232
+ const l = c.substring(m.length);
253
233
  if (s.has(l))
254
- return this._createCustomItemHtml(a, i++, n++);
234
+ return this._createCustomItemHtml(c, i++, n++);
255
235
  }
256
236
  return "";
257
237
  }).join("");
258
- return this._rescueTogglesToStore(e), this._rescueSelectsToStore(e), this._rescueDeleteButtonsToStore(e), this._rescueReorderIconsToStore(e), o.innerHTML = c, this._moveTogglesIntoItems(e), this._moveSelectsIntoItems(e, r.length), this._moveDeleteButtonsIntoItems(e, r.length), this._moveReorderIconsIntoItems(e, n), !0;
238
+ 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
239
  }
260
240
  /**
261
241
  * Attempts to reorder existing orderable-item elements to match the composition order.
@@ -267,27 +247,27 @@ class Ht extends tt {
267
247
  const e = Array.from(t.querySelectorAll(".orderable-item"));
268
248
  if (e.length !== r.length)
269
249
  return !1;
270
- const o = e.map((a) => a.dataset.key).filter(Boolean);
250
+ const o = e.map((c) => c.dataset.key).filter(Boolean);
271
251
  if (o.length !== r.length)
272
252
  return !1;
273
253
  const s = [...o].sort().join(","), i = [...r].sort().join(",");
274
- if (s !== i || r.some((a) => a.startsWith(d)))
254
+ if (s !== i || r.some((c) => c.startsWith(m)))
275
255
  return !1;
276
256
  const n = /* @__PURE__ */ new Map();
277
- e.forEach((a) => {
278
- const { key: l } = a.dataset;
257
+ e.forEach((c) => {
258
+ const { key: l } = c.dataset;
279
259
  if (l) {
280
260
  const u = n.get(l) || [];
281
- u.push(a), n.set(l, u);
261
+ u.push(c), n.set(l, u);
282
262
  }
283
263
  });
284
- const c = /* @__PURE__ */ new Map();
285
- return r.forEach((a) => {
286
- const l = n.get(a);
264
+ const a = /* @__PURE__ */ new Map();
265
+ return r.forEach((c) => {
266
+ const l = n.get(c);
287
267
  if (!l)
288
268
  return;
289
- const u = c.get(a) || 0;
290
- c.set(a, u + 1), l[u] && t.appendChild(l[u]);
269
+ const u = a.get(c) || 0;
270
+ a.set(c, u + 1), l[u] && t.appendChild(l[u]);
291
271
  }), !0;
292
272
  }
293
273
  _createBuiltInItemHtml(t, r) {
@@ -335,8 +315,8 @@ class Ht extends tt {
335
315
  _initializeCustomSelects(t) {
336
316
  t.length !== 0 && setTimeout(() => {
337
317
  t.forEach((r, e) => {
338
- const o = `${S}${e}`, s = this._getSelectOptions(r, t);
339
- this.api.setUIEAttribute(o, v.SELECTPICKER.items, s), this.api.updateValues({ [o]: r });
318
+ const o = `${T}${e}`, s = this._getSelectOptions(r, t);
319
+ this.api.setUIEAttribute(o, I.SELECTPICKER.items, s), this.api.updateValues({ [o]: r });
340
320
  });
341
321
  }, 0);
342
322
  }
@@ -359,7 +339,7 @@ class Ht extends tt {
359
339
  */
360
340
  _moveSelectsIntoItems(t, r) {
361
341
  for (let e = 0; e < r; e++) {
362
- const o = `${S}${e}`, s = t.querySelector(`[data-custom-select-key="${o}"]`), i = t.querySelector(`[data-custom-select-slot="${e}"]`);
342
+ const o = `${T}${e}`, s = t.querySelector(`[data-custom-select-key="${o}"]`), i = t.querySelector(`[data-custom-select-slot="${e}"]`);
363
343
  if (s && i) {
364
344
  const n = s.querySelector("ue-select");
365
345
  n && i.appendChild(n);
@@ -386,8 +366,8 @@ class Ht extends tt {
386
366
  * Same rescue pattern as _rescueTogglesToStore — prevents innerHTML from destroying them.
387
367
  */
388
368
  _rescueSelectsToStore(t) {
389
- for (let r = 0; r < _; r++) {
390
- const e = `${S}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
369
+ for (let r = 0; r < g; r++) {
370
+ const e = `${T}${r}`, o = t.querySelector(`[data-custom-select-key="${e}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
391
371
  if (s) {
392
372
  const i = s.querySelector("ue-select");
393
373
  i && o && o.appendChild(i);
@@ -412,7 +392,7 @@ class Ht extends tt {
412
392
  * Same rescue pattern as _rescueSelectsToStore — prevents innerHTML from destroying them.
413
393
  */
414
394
  _rescueDeleteButtonsToStore(t) {
415
- for (let r = 0; r < _; r++) {
395
+ for (let r = 0; r < g; r++) {
416
396
  const e = `${R}${r}`, o = t.querySelector(`[data-custom-delete-key="${e}"]`), s = t.querySelector(`[data-custom-delete-slot="${r}"]`);
417
397
  if (s) {
418
398
  const i = s.querySelector("ue-button");
@@ -438,7 +418,7 @@ class Ht extends tt {
438
418
  * Same rescue pattern as _rescueDeleteButtonsToStore — prevents innerHTML from destroying them.
439
419
  */
440
420
  _rescueReorderIconsToStore(t) {
441
- const r = h.length + _;
421
+ const r = h.length + g;
442
422
  for (let e = 0; e < r; e++) {
443
423
  const o = `${E}${e}`, s = t.querySelector(`[data-reorder-icon-key="${o}"]`), i = t.querySelector(`[data-reorder-icon-slot="${e}"]`);
444
424
  if (i) {
@@ -464,24 +444,24 @@ class Ht extends tt {
464
444
  _setupDragAndDrop(t, r) {
465
445
  let e = null, o = null;
466
446
  t.addEventListener("dragstart", (s) => {
467
- var c;
447
+ var a;
468
448
  const n = s.target.closest(".orderable-item");
469
- n && (e = n, n.classList.add("dragging"), (c = s.dataTransfer) == null || c.setData("text/plain", n.dataset.key || ""));
449
+ n && (e = n, n.classList.add("dragging"), (a = s.dataTransfer) == null || a.setData("text/plain", n.dataset.key || ""));
470
450
  }, { signal: r }), t.addEventListener("dragend", () => {
471
451
  e && e.classList.remove("dragging"), e = null, o == null || o.classList.remove("drag-over"), o = null;
472
452
  }, { signal: r }), t.addEventListener("dragover", (s) => {
473
453
  s.preventDefault();
474
- const n = s.target.closest(".orderable-item"), c = n && n !== e ? n : null;
475
- c !== o && (o == null || o.classList.remove("drag-over"), o = c, o == null || o.classList.add("drag-over"));
454
+ const n = s.target.closest(".orderable-item"), a = n && n !== e ? n : null;
455
+ a !== o && (o == null || o.classList.remove("drag-over"), o = a, o == null || o.classList.add("drag-over"));
476
456
  }, { signal: r }), t.addEventListener("drop", (s) => {
477
457
  s.preventDefault();
478
458
  const n = s.target.closest(".orderable-item");
479
459
  if (!n || !e || n === e)
480
460
  return;
481
- const c = n.getBoundingClientRect(), a = c.top + c.height / 2;
482
- s.clientY < a ? t.insertBefore(e, n) : t.insertBefore(e, n.nextSibling), o == null || o.classList.remove("drag-over"), o = null, e.classList.remove("dragging");
483
- const u = t.querySelectorAll(".orderable-item"), m = Array.from(u).map((b) => b.dataset.key).filter(Boolean);
484
- this._onReorder(m), e = null;
461
+ const a = n.getBoundingClientRect(), c = a.top + a.height / 2;
462
+ 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");
463
+ const u = t.querySelectorAll(".orderable-item"), d = Array.from(u).map((b) => b.dataset.key).filter(Boolean);
464
+ this._onReorder(d), e = null;
485
465
  }, { signal: r });
486
466
  }
487
467
  _setupDeleteHandler(t, r) {
@@ -497,7 +477,7 @@ class Ht extends tt {
497
477
  // Actions (Add, Delete, Reorder)
498
478
  // ========================================================================
499
479
  _onAddAttribute(t, r) {
500
- const e = `${d}${t}`, o = this._readCompositionFromNode();
480
+ const e = `${m}${t}`, o = this._readCompositionFromNode();
501
481
  o.push(e);
502
482
  const s = [...this._readCustomAttributesFromNode(), t];
503
483
  this._updateBothAttributes(o, s), this._injectCustomAttributeHtml(t, r, e, o), this._renderOrderableItems(o, s), this._initializeCustomSelects(s), this._updateAddButtonState();
@@ -510,7 +490,7 @@ class Ht extends tt {
510
490
  const r = this._readCustomAttributesFromNode();
511
491
  if (r[t] === void 0)
512
492
  return;
513
- const o = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(o, t), i = o.filter((c, a) => a !== s), n = r.filter((c, a) => a !== t);
493
+ const o = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(o, t), i = o.filter((a, c) => c !== s), n = r.filter((a, c) => c !== t);
514
494
  this._updateBothAttributes(i, n), this._removeCustomAttributeHtml(i), this._renderOrderableItems(i, n), this._initializeCustomSelects(n), this._updateAddButtonState();
515
495
  }
516
496
  /**
@@ -521,13 +501,13 @@ class Ht extends tt {
521
501
  const e = this._readCustomAttributesFromNode(), o = e[t];
522
502
  if (o === void 0 || o === r)
523
503
  return;
524
- const s = `${d}${r}`, i = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(i, t);
504
+ const s = `${m}${r}`, i = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(i, t);
525
505
  n !== -1 && (i[n] = s), e[t] = r;
526
- const c = this._getDisplayNameForAttribute(r);
527
- this._updateBothAttributes(i, e), this._injectCustomAttributeHtml(r, c, s, i), this._renderOrderableItems(i, e), this._initializeCustomSelects(e);
506
+ const a = this._getDisplayNameForAttribute(r);
507
+ this._updateBothAttributes(i, e), this._injectCustomAttributeHtml(r, a, s, i), this._renderOrderableItems(i, e), this._initializeCustomSelects(e);
528
508
  }
529
509
  _onReorder(t) {
530
- const r = t.filter((e) => e.startsWith(d)).map((e) => e.substring(d.length));
510
+ const r = t.filter((e) => e.startsWith(m)).map((e) => e.substring(m.length));
531
511
  this.reorderInProgress = !0;
532
512
  try {
533
513
  this._updateBothAttributes(t, r), this._getCurrentLayout() === "grid" && this._reorderProductAttributes(t);
@@ -548,58 +528,58 @@ class Ht extends tt {
548
528
  const s = this.currentNode.querySelectorAll(L);
549
529
  if (!(s != null && s.length))
550
530
  return;
551
- const i = $.getConfig(this.currentNode), c = `0 ${Math.floor(i.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), l = this.store.recommendationProducts.length;
531
+ const i = nt.getConfig(this.currentNode), a = `0 ${Math.floor(i.columnSpacing / 2)}px`, c = this.api.getDocumentModifier(), l = this.store.recommendationProducts.length;
552
532
  let u = 0;
553
- s.forEach((m) => {
554
- var k;
555
- const b = m.querySelector(A), I = ((k = b == null ? void 0 : b.querySelectorAll(`.${at}`)) == null ? void 0 : k.length) || 1, U = (100 / I).toFixed(2), { bgStyle: W, bgAttr: K } = this._extractSegmentBgFromCard(m), O = l > 0 ? Math.min(I, l - u) : I, z = o.map((q) => {
556
- if (q === e) {
557
- const G = Array.from(
533
+ s.forEach((d) => {
534
+ var H;
535
+ const b = d.querySelector(C), $ = ((H = b == null ? void 0 : b.querySelectorAll(`.${at}`)) == null ? void 0 : H.length) || 1, B = (100 / $).toFixed(2), { bgStyle: j, bgAttr: W } = this._extractSegmentBgFromCard(d), O = l > 0 ? Math.min($, l - u) : $, K = o.map((k) => {
536
+ if (k === e) {
537
+ const z = Array.from(
558
538
  { length: O },
559
- (At, X) => {
560
- const J = this._resolveAttributeContent(
539
+ (At, Y) => {
540
+ const X = this._resolveAttributeContent(
561
541
  t,
562
542
  r,
563
- u + X
543
+ u + Y
564
544
  );
565
545
  return this._getGridCellHtml(
566
546
  t,
567
- J,
568
- U,
547
+ X,
548
+ B,
549
+ j,
569
550
  W,
570
- K,
571
- c
551
+ a
572
552
  );
573
553
  }
574
- ).join(""), Y = dt(U, c).repeat(I - O);
575
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${N}="1">${G}${Y}</tr>`;
554
+ ).join(""), G = dt(B, a).repeat($ - O);
555
+ return `<tr class="recommendation-attribute-row" ${y}="${e}" ${v}="1">${z}${G}</tr>`;
576
556
  }
577
- const D = m.querySelector(
578
- `${A}[${y}="${q}"]`
557
+ const N = d.querySelector(
558
+ `${C}[${y}="${k}"]`
579
559
  );
580
- return D && "getOuterHTML" in D ? D.getOuterHTML() : "";
560
+ return N && "getOuterHTML" in N ? N.getOuterHTML() : "";
581
561
  }).join("");
582
- u += O, l > 0 && u >= l && (u = 0), a.modifyHtml(m).setInnerHtml(z);
583
- }), a.apply(new C(`${this.api.translate("Add custom attribute")}: ${r}`));
562
+ u += O, l > 0 && u >= l && (u = 0), c.modifyHtml(d).setInnerHtml(K);
563
+ }), c.apply(new A(`${this.api.translate("Add custom attribute")}: ${r}`));
584
564
  }
585
565
  _injectListAttributeRow(t, r, e, o) {
586
- const s = this.currentNode.querySelectorAll(V);
566
+ const s = this.currentNode.querySelectorAll(M);
587
567
  if (!(s != null && s.length))
588
568
  return;
589
- const i = o.filter((c) => c !== B && c !== H), n = this.api.getDocumentModifier();
590
- s.forEach((c, a) => {
569
+ const i = o.filter((a) => a !== D && a !== U), n = this.api.getDocumentModifier();
570
+ s.forEach((a, c) => {
591
571
  const l = i.map((u) => {
592
572
  if (u === e) {
593
- const b = this._resolveAttributeContent(t, r, a);
573
+ const b = this._resolveAttributeContent(t, r, c);
594
574
  return this._getListRowHtml(t, b, e);
595
575
  }
596
- const m = c.querySelector(
597
- `${A}[${y}="${u}"]`
576
+ const d = a.querySelector(
577
+ `${C}[${y}="${u}"]`
598
578
  );
599
- return m && "getOuterHTML" in m ? m.getOuterHTML() : "";
579
+ return d && "getOuterHTML" in d ? d.getOuterHTML() : "";
600
580
  }).join("");
601
- n.modifyHtml(c).setInnerHtml(l);
602
- }), n.apply(new C(`${this.api.translate("Add custom attribute")}: ${r}`));
581
+ n.modifyHtml(a).setInnerHtml(l);
582
+ }), n.apply(new A(`${this.api.translate("Add custom attribute")}: ${r}`));
603
583
  }
604
584
  /**
605
585
  * Removes a custom attribute by rebuilding product card content without it.
@@ -616,13 +596,13 @@ class Ht extends tt {
616
596
  e.modifyHtml(s).setInnerHtml(i);
617
597
  });
618
598
  } else {
619
- const o = t.filter((i) => i !== B && i !== H), s = this.currentNode.querySelectorAll(V);
599
+ const o = t.filter((i) => i !== D && i !== U), s = this.currentNode.querySelectorAll(M);
620
600
  s == null || s.forEach((i) => {
621
601
  const n = this._buildCompositionHtml(i, o);
622
602
  e.modifyHtml(i).setInnerHtml(n);
623
603
  });
624
604
  }
625
- e.apply(new C(this.api.translate("Remove custom attribute")));
605
+ e.apply(new A(this.api.translate("Remove custom attribute")));
626
606
  }
627
607
  // ========================================================================
628
608
  // DOM Mutation (Block Root Attributes, Reorder)
@@ -635,13 +615,7 @@ class Ht extends tt {
635
615
  * producing a flicker on the custom attribute dropdowns.
636
616
  */
637
617
  _updateBothAttributes(t, r) {
638
- if (!this.currentNode)
639
- return;
640
- const e = {
641
- ...$.getConfig(this.currentNode),
642
- composition: t
643
- };
644
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(x, t.join(",")).setAttribute(F, JSON.stringify(r)).setNodeConfig(e).apply(new C(this.api.translate("Update card composition")));
618
+ 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")));
645
619
  }
646
620
  /**
647
621
  * Reorders attribute rows within each product card based on composition order.
@@ -657,7 +631,7 @@ class Ht extends tt {
657
631
  r.forEach((o) => {
658
632
  const s = this._buildCompositionHtml(o, t);
659
633
  e.modifyHtml(o).setInnerHtml(s);
660
- }), e.apply(new C(this.api.translate("Reorder product attributes")));
634
+ }), e.apply(new A(this.api.translate("Reorder product attributes")));
661
635
  }
662
636
  /**
663
637
  * Builds HTML string with attributes ordered according to composition.
@@ -665,7 +639,7 @@ class Ht extends tt {
665
639
  */
666
640
  _buildCompositionHtml(t, r) {
667
641
  return r.reduce((e, o) => {
668
- const s = t.querySelector(`${A}[${y}="${o}"]`);
642
+ const s = t.querySelector(`${C}[${y}="${o}"]`);
669
643
  return s && "getOuterHTML" in s ? e + s.getOuterHTML() : e;
670
644
  }, "");
671
645
  }
@@ -675,19 +649,14 @@ class Ht extends tt {
675
649
  _applyVisibilityToBlock(t, r) {
676
650
  if (!this.currentNode)
677
651
  return;
678
- const e = this.currentNode.querySelectorAll(`${A}[${y}="${t}"]`);
652
+ const e = this.currentNode.querySelectorAll(`${C}[${y}="${t}"]`);
679
653
  if (!(e != null && e.length))
680
654
  return;
681
655
  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();
682
656
  e.forEach((a) => {
683
- const l = ft(a), u = r ? l : "none";
684
- n.modifyHtml(a).setStyle("display", u).setAttribute(N, o);
685
- });
686
- const c = {
687
- ...$.getConfig(this.currentNode),
688
- visibility: { ...this._readVisibilityFromRows(), [t]: r }
689
- };
690
- n.modifyHtml(this.currentNode).setNodeConfig(c), n.apply(new C(i));
657
+ const c = ft(a), l = r ? c : "none";
658
+ n.modifyHtml(a).setStyle("display", l).setAttribute(v, o);
659
+ }), n.apply(new A(i));
691
660
  }
692
661
  // ========================================================================
693
662
  // Utilities
@@ -700,7 +669,7 @@ class Ht extends tt {
700
669
  _findNthCustomKeyIndex(t, r) {
701
670
  let e = 0;
702
671
  for (let o = 0; o < t.length; o++)
703
- if (t[o].startsWith(d)) {
672
+ if (t[o].startsWith(m)) {
704
673
  if (e === r)
705
674
  return o;
706
675
  e++;
@@ -708,7 +677,7 @@ class Ht extends tt {
708
677
  return -1;
709
678
  }
710
679
  _getCurrentLayout() {
711
- return this.store.recommendationConfigs.orientation || bt(this.currentNode);
680
+ return this.store.recommendationConfigs.orientation || gt(this.currentNode);
712
681
  }
713
682
  /**
714
683
  * Extracts background color properties from existing card elements.
@@ -759,10 +728,10 @@ class Ht extends tt {
759
728
  * or when all available filters have already been added (no unused attributes left).
760
729
  */
761
730
  _updateAddButtonState() {
762
- const t = this._readCustomAttributesFromNode(), r = t.length >= _, e = new Set(t), o = this._getAddableFilters(), s = o.length > 0 && o.every((i) => e.has(i.attributeName));
731
+ 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));
763
732
  this.api.setUIEAttribute(
764
- j.ADD_ATTRIBUTE,
765
- v.BUTTON.disabled,
733
+ x.ADD_ATTRIBUTE,
734
+ I.BUTTON.disabled,
766
735
  r || s ? "true" : "false"
767
736
  );
768
737
  }
@@ -785,7 +754,7 @@ class Ht extends tt {
785
754
  * excluding default attributes already covered by built-in toggle items.
786
755
  */
787
756
  _getAddableFilters() {
788
- return Object.values(this.store.filterList).filter((t) => !(t.type === "defaultAttribute" && nt.has(t.attributeName)));
757
+ return Object.values(this.store.filterList).filter((t) => !(t.type === "defaultAttribute" && it.has(t.attributeName)));
789
758
  }
790
759
  /**
791
760
  * Looks up the display name for an attribute from the store's filterList.
@@ -802,28 +771,28 @@ class Ht extends tt {
802
771
  _resolveAttributeContent(t, r, e) {
803
772
  var n;
804
773
  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];
805
- return gt(i) ?? r;
774
+ return _t(i) ?? r;
806
775
  }
807
776
  _getGridCellHtml(t, r, e, o = "", s = "", i = "") {
808
- const n = `${d}${t}`, c = M(ct, [n], this.store.filterList), a = {
777
+ const n = `${m}${t}`, a = w(ct, [n], this.store.filterList), c = {
809
778
  [t]: r,
810
779
  product_attributes: { [t]: r }
811
780
  };
812
- let l = c[n](a);
781
+ let l = a[n](c);
813
782
  return l = l.replace("<td", `<td width="${e}%"`), i && (l = l.replace(
814
783
  `padding: ${ut}`,
815
784
  `padding: ${i}`
816
785
  )), o && (l = l.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${o}"`)), s && (l = l.replace(/border="0"/, `border="0" bgcolor="${s}"`)), l;
817
786
  }
818
787
  _getListRowHtml(t, r, e) {
819
- const o = M(mt, [e], this.store.filterList), s = {
788
+ const o = w(mt, [e], this.store.filterList), s = {
820
789
  [t]: r,
821
790
  product_attributes: { [t]: r }
822
791
  }, n = o[e](s).replace(/<tr>/, "").replace(/<\/tr>/, "");
823
- return `<tr class="recommendation-attribute-row" ${y}="${e}" ${N}="1">${n}</tr>`;
792
+ return `<tr class="recommendation-attribute-row" ${y}="${e}" ${v}="1">${n}</tr>`;
824
793
  }
825
794
  }
826
795
  export {
827
- yt as COMPOSITION_CONTROL_BLOCK_ID,
828
- Ht as RecommendationCardCompositionControl
796
+ bt as COMPOSITION_CONTROL_BLOCK_ID,
797
+ Ut as RecommendationCardCompositionControl
829
798
  };