@useinsider/guido 3.30.0-beta.4cfd8a2 → 3.30.0-beta.569ec62

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 (29) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +11 -16
  2. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
  4. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  5. package/dist/composables/useExport.js +8 -7
  6. package/dist/composables/useHtmlValidator.js +102 -100
  7. package/dist/composables/useToaster.js +11 -10
  8. package/dist/composables/useVersionHistoryApi.js +22 -21
  9. package/dist/composables/validators/useLiquidValidator.js +26 -24
  10. package/dist/config/migrator/itemsBlockMigrator.js +164 -161
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +148 -141
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +53 -53
  13. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +40 -39
  14. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -26
  15. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +33 -32
  16. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +23 -22
  17. package/dist/extensions/Blocks/Recommendation/templates/utils.js +79 -78
  18. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +50 -41
  19. package/dist/guido.css +1 -1
  20. package/dist/package.json.js +2 -2
  21. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +2 -0
  22. package/dist/src/stores/preview.d.ts +3 -0
  23. package/dist/src/utils/ampPreviewSanitizer.d.ts +5 -0
  24. package/dist/src/utils/htmlEscape.d.ts +5 -0
  25. package/dist/stores/preview.js +21 -15
  26. package/dist/utils/ampPreviewSanitizer.js +46 -0
  27. package/dist/utils/htmlEscape.js +5 -1
  28. package/dist/utils/pairProductVariables.js +98 -108
  29. package/package.json +1 -1
@@ -1,36 +1,37 @@
1
- var at = Object.defineProperty;
2
- var ct = (_, g, t) => g in _ ? at(_, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[g] = t;
3
- var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
4
- import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
5
- import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { CommonControl as ut } from "../../../common-control.js";
7
- import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
8
- import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
9
- import { RecommendationConfigService as T } from "../../services/configService.js";
10
- import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
11
- import { ATTRIBUTE_CELL_CLASS as bt, gridElementRenderer as yt, DEFAULT_CELL_PADDING as Tt, buildFillerCell as Ct } from "../../templates/grid/elementRenderer.js";
12
- import { listElementRenderer as St } from "../../templates/list/elementRenderer.js";
13
- import { buildTitleRows as At, DEFAULT_TITLE_PARAGRAPH as It, DEFAULT_TITLE_TEXT as $t } from "../../templates/titleRows.js";
14
- import { toDisplayName as vt, toDisplayableAttributeValue as Nt, buildElementRenderer as J } from "../../templates/utils.js";
15
- import { normalizeCompositionKeys as Et, normalizeCustomAttrValues as Rt, compositionKeyToProductAttr as k, resolveRowVisibilityKeys as Lt, filterToProductAttrValue as C, findAttributeRow as Ot, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Dt, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
16
- import { getTableDisplayValue as Ht } from "../../utils/tagName.js";
17
- import { isPartnerManagedBlock as Pt, regenerateProductRowsWithStyles as wt, getMainContainerTbody as Bt, getCurrentLayout as kt } from "../main/utils.js";
18
- import { resolveInlinePriceOrder as Mt } from "../../utils/inlinePriceOrder.js";
19
- const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
1
+ var dt = Object.defineProperty;
2
+ var ut = (_, f, t) => f in _ ? dt(_, f, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[f] = t;
3
+ var v = (_, f, t) => ut(_, typeof f != "symbol" ? f + "" : f, t);
4
+ import { ACADEMY_LINKS as mt } from "../../../../../enums/academy.js";
5
+ import { escapeHtml as M } from "../../../../../utils/htmlEscape.js";
6
+ import { UIElementType as g, UEAttr as O, ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ import { CommonControl as ht } from "../../../common-control.js";
8
+ import { ATTR_PRODUCT_IMAGE as x, ATTR_PRODUCT_NAME as pt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as _t, ATTR_PRODUCT_OMNIBUS_DISCOUNT as ft, ATTR_PRODUCT_BUTTON as V, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as G, ATTR_DATA_CUSTOM_ATTRIBUTES as z, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as Y, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as X, CSS_CLASS_SPACER as gt, BUILT_IN_DEFAULT_ATTRIBUTES as bt } from "../../constants/selectors.js";
9
+ import { DEFAULT_COMPOSITION as J, DEFAULT_VISIBILITY as Q } from "../../constants/defaultConfig.js";
10
+ import { RecommendationConfigService as C } from "../../services/configService.js";
11
+ import { useRecommendationExtensionStore as yt } from "../../store/recommendation.js";
12
+ import { ATTRIBUTE_CELL_CLASS as Tt, gridElementRenderer as Ct, DEFAULT_CELL_PADDING as St, buildFillerCell as At } from "../../templates/grid/elementRenderer.js";
13
+ import { listElementRenderer as It } from "../../templates/list/elementRenderer.js";
14
+ import { buildTitleRows as $t, DEFAULT_TITLE_PARAGRAPH as vt, DEFAULT_TITLE_TEXT as Nt } from "../../templates/titleRows.js";
15
+ import { toDisplayName as Et, toDisplayableAttributeValue as Rt, buildElementRenderer as Z } from "../../templates/utils.js";
16
+ import { normalizeCompositionKeys as Lt, dropMalformedCompositionKeys as Ot, normalizeCustomAttrValues as Dt, isWellFormedProductAttr as H, compositionKeyToProductAttr as U, resolveRowVisibilityKeys as Ht, filterToProductAttrValue as b, findAttributeRow as Pt, rewriteLegacyRowKeyHtml as tt, bareAttributeName as P, isDefaultProductAttr as wt, productAttrToCompositionKey as q } from "../../utils/compositionKeys.js";
17
+ import { getTableDisplayValue as Bt } from "../../utils/tagName.js";
18
+ import { isPartnerManagedBlock as kt, regenerateProductRowsWithStyles as Mt, getMainContainerTbody as Ut, getCurrentLayout as qt } from "../main/utils.js";
19
+ import { resolveInlinePriceOrder as Ft } from "../../utils/inlinePriceOrder.js";
20
+ const xt = "ui-elements-recommendation-card-composition", F = ".product-card-wrapper > tbody", et = ".product-info-cell > table > tbody", rt = {
20
21
  ADD_ATTRIBUTE: "addAttribute"
21
- }, b = 5, P = "reorderIcon_", qt = '<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 = [
22
- { key: q, label: "Product Image" },
23
- { key: mt, label: "Product Name" },
22
+ }, y = 5, w = "reorderIcon_", Vt = '<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 = [
23
+ { key: x, label: "Product Image" },
24
+ { key: pt, label: "Product Name" },
24
25
  { key: p, label: "Product Price" },
25
26
  { key: I, label: "Product Original Price" },
26
- { key: ht, label: "Omnibus Price" },
27
- { key: pt, label: "Omnibus Discount" },
28
- { key: F, label: "Product Button" }
29
- ], L = { key: $, label: "Title" }, Ft = new Set(m.map((_) => _.key)), A = "customAttr_", w = "deleteAttr_";
30
- class oe extends ut {
27
+ { key: _t, label: "Omnibus Price" },
28
+ { key: ft, label: "Omnibus Discount" },
29
+ { key: V, label: "Product Button" }
30
+ ], L = { key: $, label: "Title" }, jt = new Set(m.map((_) => _.key)), A = "customAttr_", B = "deleteAttr_";
31
+ class ce extends ht {
31
32
  constructor() {
32
33
  super(...arguments);
33
- v(this, "store", ft());
34
+ v(this, "store", yt());
34
35
  v(this, "unsubscribeStore", null);
35
36
  v(this, "eventController", null);
36
37
  /**
@@ -40,7 +41,7 @@ class oe extends ut {
40
41
  v(this, "reorderInProgress", !1);
41
42
  }
42
43
  getId() {
43
- return Ut;
44
+ return xt;
44
45
  }
45
46
  // ========================================================================
46
47
  // Lifecycle
@@ -51,7 +52,7 @@ class oe extends ut {
51
52
  ${this._GuToggle(`visibility_${d.key}`)}
52
53
  </div>
53
54
  `).join(""), e = Array.from(
54
- { length: b },
55
+ { length: y },
55
56
  (d, c) => `
56
57
  <div data-custom-select-key="${A}${c}" style="display: none;">
57
58
  ${this._GuSelect({
@@ -63,37 +64,37 @@ class oe extends ut {
63
64
  })}
64
65
  </div>
65
66
  `
66
- ).join(""), r = m.length + b, i = Array.from(
67
+ ).join(""), r = m.length + y, i = Array.from(
67
68
  { length: r },
68
69
  (d, c) => `
69
- <div data-reorder-icon-key="${P}${c}" style="display: none;">
70
- <${f.BUTTON}
70
+ <div data-reorder-icon-key="${w}${c}" style="display: none;">
71
+ <${g.BUTTON}
71
72
  class="guido-drag-handle-btn flat-inline flat-white"
72
- ${O.BUTTON.name}="${P}${c}"
73
+ ${O.BUTTON.name}="${w}${c}"
73
74
  >
74
- <${f.ICON}
75
+ <${g.ICON}
75
76
  src="reorder"
76
77
  class="icon-button"
77
- ></${f.ICON}>
78
- </${f.BUTTON}>
78
+ ></${g.ICON}>
79
+ </${g.BUTTON}>
79
80
  </div>
80
81
  `
81
82
  ).join(""), s = Array.from(
82
- { length: b },
83
+ { length: y },
83
84
  (d, c) => `
84
- <div data-custom-delete-key="${w}${c}" style="display: none;">
85
- <${f.BUTTON}
85
+ <div data-custom-delete-key="${B}${c}" style="display: none;">
86
+ <${g.BUTTON}
86
87
  class="custom-attr-delete flat-inline flat-white"
87
- ${O.BUTTON.name}="${w}${c}"
88
+ ${O.BUTTON.name}="${B}${c}"
88
89
  >
89
- <${f.ICON}
90
+ <${g.ICON}
90
91
  src="delete"
91
92
  class="icon-button"
92
- ></${f.ICON}>
93
- </${f.BUTTON}>
93
+ ></${g.ICON}>
94
+ </${g.BUTTON}>
94
95
  </div>
95
96
  `
96
- ).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
97
+ ).join(""), o = mt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
97
98
  "Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
98
99
  ), l = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
99
100
  return `
@@ -135,7 +136,7 @@ class oe extends ut {
135
136
  <div class="orderable-list" data-composition-list></div>
136
137
 
137
138
  ${this._GuButton({
138
- name: tt.ADD_ATTRIBUTE,
139
+ name: rt.ADD_ATTRIBUTE,
139
140
  label: this.api.translate("Add Attribute"),
140
141
  id: "guido__btn-add-attribute"
141
142
  })}
@@ -156,7 +157,7 @@ class oe extends ut {
156
157
  const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
157
158
  if (!t)
158
159
  return;
159
- const e = Pt(this.currentNode);
160
+ const e = kt(this.currentNode);
160
161
  t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
161
162
  }
162
163
  onTemplateNodeUpdated(t) {
@@ -178,7 +179,7 @@ class oe extends ut {
178
179
  this._applyVisibilityToBlock(t.key, e);
179
180
  });
180
181
  });
181
- for (let t = 0; t < b; t++) {
182
+ for (let t = 0; t < y; t++) {
182
183
  const e = `${A}${t}`, r = t;
183
184
  this.api.onValueChanged(e, (i) => {
184
185
  this._onCustomAttributeChanged(r, i);
@@ -190,32 +191,36 @@ class oe extends ut {
190
191
  // ========================================================================
191
192
  _readCompositionFromNode() {
192
193
  if (!this.currentNode || !("getAttribute" in this.currentNode))
193
- return [...Y];
194
- const t = this.currentNode.getAttribute(K);
194
+ return [...J];
195
+ const t = this.currentNode.getAttribute(G);
195
196
  if (t)
196
197
  return this._normalizeComposition(t.split(",").filter(Boolean));
197
- const { composition: e } = T.getConfig(this.currentNode);
198
- return e != null && e.length ? this._normalizeComposition([...e]) : [...Y];
198
+ const { composition: e } = C.getConfig(this.currentNode);
199
+ return e != null && e.length ? this._normalizeComposition([...e]) : [...J];
199
200
  }
200
201
  /** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
201
202
  _normalizeComposition(t) {
202
- return Et(t, this.currentNode, this.store.filterList);
203
+ return Lt(
204
+ Ot(t),
205
+ this.currentNode,
206
+ this.store.filterList
207
+ );
203
208
  }
204
209
  _readCustomAttributesFromNode() {
205
210
  if (!this.currentNode || !("getAttribute" in this.currentNode))
206
211
  return [];
207
- const t = this.currentNode.getAttribute(W);
212
+ const t = this.currentNode.getAttribute(z);
208
213
  if (t)
209
214
  try {
210
- return Rt(
211
- JSON.parse(t).map((e) => String(e)),
215
+ return Dt(
216
+ JSON.parse(t).map((e) => String(e)).filter(H),
212
217
  this.currentNode,
213
218
  this.store.filterList
214
219
  );
215
220
  } catch {
216
221
  return [];
217
222
  }
218
- return this._readCompositionFromNode().filter((e) => e.startsWith(N)).map(k);
223
+ return this._readCompositionFromNode().filter((e) => e.startsWith(N)).map(U);
219
224
  }
220
225
  _readVisibilityFromRows() {
221
226
  if (!this.currentNode)
@@ -223,7 +228,7 @@ class oe extends ut {
223
228
  const t = Array.from(this.currentNode.querySelectorAll(E)), e = this._extractVisibilityFromRows(t);
224
229
  if (Object.keys(e).length > 0)
225
230
  return this._withTitlePresence(this._mergeWithDefaults(e));
226
- const r = T.getConfig(this.currentNode).visibility;
231
+ const r = C.getConfig(this.currentNode).visibility;
227
232
  return this._withTitlePresence(this._mergeWithDefaults({ ...r }));
228
233
  }
229
234
  _withTitlePresence(t) {
@@ -231,10 +236,10 @@ class oe extends ut {
231
236
  }
232
237
  _hasTitle() {
233
238
  var t;
234
- return !!((t = this.currentNode) != null && t.querySelector(G));
239
+ return !!((t = this.currentNode) != null && t.querySelector(Y));
235
240
  }
236
241
  _getDefaultVisibilities() {
237
- return { ...X };
242
+ return { ...Q };
238
243
  }
239
244
  _extractVisibilityFromRows(t) {
240
245
  const e = {};
@@ -242,7 +247,7 @@ class oe extends ut {
242
247
  if (!("getAttribute" in r))
243
248
  return;
244
249
  const i = r.getAttribute(D);
245
- i !== null && Lt(r).forEach((s) => {
250
+ i !== null && Ht(r).forEach((s) => {
246
251
  e[s] = this._parseVisibilityValue(i);
247
252
  });
248
253
  }), e;
@@ -251,7 +256,7 @@ class oe extends ut {
251
256
  return t === "1" || t === "true";
252
257
  }
253
258
  _mergeWithDefaults(t) {
254
- return Object.entries(X).forEach(([e, r]) => {
259
+ return Object.entries(Q).forEach(([e, r]) => {
255
260
  e in t || (t[e] = r);
256
261
  }), t;
257
262
  }
@@ -277,17 +282,17 @@ class oe extends ut {
277
282
  if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
278
283
  return !1;
279
284
  i.dataset.inlinePrices = String(s);
280
- const n = new Set(e), l = Mt(t);
285
+ const n = new Set(e), l = Ft(t);
281
286
  let a = 0, d = 0;
282
287
  const c = t.map((u) => {
283
288
  if (s && (u === p || u === I))
284
289
  return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
285
- if (Ft.has(u)) {
290
+ if (jt.has(u)) {
286
291
  const h = m.find((S) => S.key === u);
287
292
  return this._createBuiltInItemHtml(h, d++);
288
293
  }
289
294
  if (u.startsWith(N)) {
290
- const h = k(u);
295
+ const h = U(u);
291
296
  if (n.has(h))
292
297
  return this._createCustomItemHtml(u, a++, d++);
293
298
  }
@@ -349,7 +354,7 @@ class oe extends ut {
349
354
  var n, l;
350
355
  const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === I)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
351
356
  <div class="price-suborderable-item" draggable="true" data-subkey="${a}">
352
- <span class="sub-drag-handle">${qt}</span>
357
+ <span class="sub-drag-handle">${Vt}</span>
353
358
  <span class="item-label">${this.api.translate(d)}</span>
354
359
  </div>`, o = e ? s(I, i) + s(p, r) : s(p, r) + s(I, i);
355
360
  return `
@@ -367,7 +372,7 @@ class oe extends ut {
367
372
  _createCustomItemHtml(t, e, r) {
368
373
  return `
369
374
  <div class="orderable-item" draggable="true"
370
- data-key="${t}" data-custom-index="${e}">
375
+ data-key="${M(t)}" data-custom-index="${e}">
371
376
  <span class="guido-drag-handle" data-reorder-icon-slot="${r}"></span>
372
377
  <div class="custom-attr-select-wrap"
373
378
  data-custom-select-slot="${e}"></div>
@@ -398,13 +403,13 @@ class oe extends ut {
398
403
  const i = /* @__PURE__ */ new Map();
399
404
  r.forEach((o) => i.set(o.attributeName, (i.get(o.attributeName) ?? 0) + 1));
400
405
  const s = new Set(e);
401
- return s.delete(t), r.filter((o) => !s.has(C(o))).map((o) => ({
406
+ return s.delete(t), r.filter((o) => !s.has(b(o))).map((o) => ({
402
407
  text: this._toOptionLabel(
403
408
  o.displayName,
404
409
  o.type === "defaultAttribute",
405
410
  (i.get(o.attributeName) ?? 0) > 1
406
411
  ),
407
- value: C(o)
412
+ value: b(o)
408
413
  }));
409
414
  }
410
415
  /**
@@ -466,7 +471,7 @@ class oe extends ut {
466
471
  * Same rescue pattern as _rescueTogglesToStore — prevents innerHTML from destroying them.
467
472
  */
468
473
  _rescueSelectsToStore(t) {
469
- for (let e = 0; e < b; e++) {
474
+ for (let e = 0; e < y; e++) {
470
475
  const r = `${A}${e}`, i = t.querySelector(`[data-custom-select-key="${r}"]`), s = t.querySelector(`[data-custom-select-slot="${e}"]`);
471
476
  if (s) {
472
477
  const o = s.querySelector("ue-select");
@@ -480,7 +485,7 @@ class oe extends ut {
480
485
  */
481
486
  _moveDeleteButtonsIntoItems(t, e) {
482
487
  for (let r = 0; r < e; r++) {
483
- const i = `${w}${r}`, s = t.querySelector(`[data-custom-delete-key="${i}"]`), o = t.querySelector(`[data-custom-delete-slot="${r}"]`);
488
+ const i = `${B}${r}`, s = t.querySelector(`[data-custom-delete-key="${i}"]`), o = t.querySelector(`[data-custom-delete-slot="${r}"]`);
484
489
  if (s && o) {
485
490
  const n = s.querySelector("ue-button");
486
491
  n && o.appendChild(n);
@@ -492,8 +497,8 @@ class oe extends ut {
492
497
  * Same rescue pattern as _rescueSelectsToStore — prevents innerHTML from destroying them.
493
498
  */
494
499
  _rescueDeleteButtonsToStore(t) {
495
- for (let e = 0; e < b; e++) {
496
- const r = `${w}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
500
+ for (let e = 0; e < y; e++) {
501
+ const r = `${B}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
497
502
  if (s) {
498
503
  const o = s.querySelector("ue-button");
499
504
  o && i && i.appendChild(o);
@@ -506,7 +511,7 @@ class oe extends ut {
506
511
  */
507
512
  _moveReorderIconsIntoItems(t, e) {
508
513
  for (let r = 0; r < e; r++) {
509
- const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
514
+ const i = `${w}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
510
515
  if (s && o) {
511
516
  const n = s.querySelector("ue-button");
512
517
  n && o.appendChild(n);
@@ -518,9 +523,9 @@ class oe extends ut {
518
523
  * Same rescue pattern as _rescueDeleteButtonsToStore — prevents innerHTML from destroying them.
519
524
  */
520
525
  _rescueReorderIconsToStore(t) {
521
- const e = m.length + b;
526
+ const e = m.length + y;
522
527
  for (let r = 0; r < e; r++) {
523
- const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
528
+ const i = `${w}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
524
529
  if (o) {
525
530
  const n = o.querySelector("ue-button");
526
531
  n && s && s.appendChild(n);
@@ -537,8 +542,8 @@ class oe extends ut {
537
542
  return;
538
543
  const r = e.querySelector("[data-composition-list]"), i = e.querySelector("#guido__btn-add-attribute");
539
544
  r && (this._setupDragAndDrop(r, t), this._setupDeleteHandler(r, t)), i && i.addEventListener("click", () => {
540
- const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(C(n)));
541
- o && this._onAddAttribute(C(o), o.displayName);
545
+ const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(b(n)));
546
+ o && this._onAddAttribute(b(o), o.displayName);
542
547
  }, { signal: t });
543
548
  }
544
549
  /**
@@ -619,7 +624,9 @@ class oe extends ut {
619
624
  // Actions (Add, Delete, Reorder)
620
625
  // ========================================================================
621
626
  _onAddAttribute(t, e) {
622
- const r = M(t), i = this._readCompositionFromNode();
627
+ if (!H(t))
628
+ return;
629
+ const r = q(t), i = this._readCompositionFromNode();
623
630
  i.push(r);
624
631
  const s = [...this._readCustomAttributesFromNode(), t];
625
632
  this._updateBothAttributes(i, s), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, s), this._initializeCustomSelects(s), this._updateAddButtonState();
@@ -641,20 +648,20 @@ class oe extends ut {
641
648
  */
642
649
  _onCustomAttributeChanged(t, e) {
643
650
  const r = this._readCustomAttributesFromNode(), i = r[t];
644
- if (i === void 0 || i === e)
651
+ if (i === void 0 || i === e || !H(e))
645
652
  return;
646
- const s = M(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
653
+ const s = q(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
647
654
  n !== -1 && (o[n] = s), r[t] = e;
648
655
  const l = this._getDisplayNameForAttribute(e);
649
656
  this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
650
657
  }
651
658
  _onReorder(t) {
652
- const e = t.filter((r) => r.startsWith(N)).map(k);
659
+ const e = t.filter((r) => r.startsWith(N)).map(U);
653
660
  this.reorderInProgress = !0;
654
661
  try {
655
662
  this._updateBothAttributes(t, e);
656
663
  const r = this._isInlinePrices();
657
- this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && wt({
664
+ this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Mt({
658
665
  currentNode: this.currentNode,
659
666
  documentModifier: this.api.getDocumentModifier()
660
667
  });
@@ -672,13 +679,13 @@ class oe extends ut {
672
679
  * DOM converge on the next composition change without writing on open.
673
680
  */
674
681
  _getExistingRowHtml(t, e) {
675
- const r = Ot(t, e);
682
+ const r = Pt(t, e);
676
683
  if (r && "getOuterHTML" in r)
677
- return Q(r.getOuterHTML(), e);
684
+ return tt(r.getOuterHTML(), e);
678
685
  const i = t.querySelector(
679
686
  `${E}[${R}="${e}"]`
680
687
  );
681
- return i && "getOuterHTML" in i ? Q(i.getOuterHTML(), e) : "";
688
+ return i && "getOuterHTML" in i ? tt(i.getOuterHTML(), e) : "";
682
689
  }
683
690
  _injectCustomAttributeHtml(t, e, r, i) {
684
691
  if (!this.currentNode)
@@ -686,45 +693,45 @@ class oe extends ut {
686
693
  this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i) : this._injectListAttributeRow(t, e, r, i);
687
694
  }
688
695
  _injectGridAttributeRow(t, e, r, i) {
689
- const s = this.currentNode.querySelectorAll(U);
696
+ const s = this.currentNode.querySelectorAll(F);
690
697
  if (!(s != null && s.length))
691
698
  return;
692
- const o = T.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
699
+ const o = C.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
693
700
  let c = 0;
694
701
  s.forEach((u) => {
695
- var V;
696
- const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, x = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
697
- if (j === r) {
698
- const st = Array.from(
699
- { length: B },
700
- (xt, nt) => {
701
- const lt = this._resolveAttributeContent(
702
+ var K;
703
+ const h = u.querySelector(E), S = ((K = h == null ? void 0 : h.querySelectorAll(`.${Tt}`)) == null ? void 0 : K.length) || 1, j = (100 / S).toFixed(2), { bgStyle: it, bgAttr: st } = this._extractSegmentBgFromCard(u), k = d > 0 ? Math.min(S, d - c) : S, ot = i.map((W) => {
704
+ if (W === r) {
705
+ const nt = Array.from(
706
+ { length: k },
707
+ (Kt, at) => {
708
+ const ct = this._resolveAttributeContent(
702
709
  t,
703
710
  e,
704
- c + nt
711
+ c + at
705
712
  );
706
713
  return this._getGridCellHtml(
707
714
  t,
708
- lt,
709
- x,
710
- et,
711
- rt,
715
+ ct,
716
+ j,
717
+ it,
718
+ st,
712
719
  l
713
720
  );
714
721
  }
715
- ).join(""), ot = Ct(x, l).repeat(S - B);
716
- return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
722
+ ).join(""), lt = At(j, l).repeat(S - k);
723
+ return `<tr class="${X}" ${R}="${M(r)}" ${D}="1">${nt}${lt}</tr>`;
717
724
  }
718
- return this._getExistingRowHtml(u, j);
725
+ return this._getExistingRowHtml(u, W);
719
726
  }).join("");
720
- c += B, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(it);
721
- }), a.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
727
+ c += k, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(ot);
728
+ }), a.apply(new T(`${this.api.translate("Add custom attribute")}: ${e}`));
722
729
  }
723
730
  _injectListAttributeRow(t, e, r, i) {
724
- const s = this.currentNode.querySelectorAll(Z);
731
+ const s = this.currentNode.querySelectorAll(et);
725
732
  if (!(s != null && s.length))
726
733
  return;
727
- const o = i.filter((l) => l !== q && l !== F), n = this.api.getDocumentModifier();
734
+ const o = i.filter((l) => l !== x && l !== V), n = this.api.getDocumentModifier();
728
735
  s.forEach((l, a) => {
729
736
  const d = o.map((c) => {
730
737
  if (c === r) {
@@ -734,7 +741,7 @@ class oe extends ut {
734
741
  return this._getExistingRowHtml(l, c);
735
742
  }).join("");
736
743
  n.modifyHtml(l).setInnerHtml(d);
737
- }), n.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
744
+ }), n.apply(new T(`${this.api.translate("Add custom attribute")}: ${e}`));
738
745
  }
739
746
  /**
740
747
  * Removes a custom attribute by rebuilding product card content without it.
@@ -745,19 +752,19 @@ class oe extends ut {
745
752
  return;
746
753
  const e = this._getCurrentLayout(), r = this.api.getDocumentModifier();
747
754
  if (e === "grid") {
748
- const i = this.currentNode.querySelectorAll(U);
755
+ const i = this.currentNode.querySelectorAll(F);
749
756
  i == null || i.forEach((s) => {
750
757
  const o = this._buildCompositionHtml(s, t);
751
758
  r.modifyHtml(s).setInnerHtml(o);
752
759
  });
753
760
  } else {
754
- const i = t.filter((o) => o !== q && o !== F), s = this.currentNode.querySelectorAll(Z);
761
+ const i = t.filter((o) => o !== x && o !== V), s = this.currentNode.querySelectorAll(et);
755
762
  s == null || s.forEach((o) => {
756
763
  const n = this._buildCompositionHtml(o, i);
757
764
  r.modifyHtml(o).setInnerHtml(n);
758
765
  });
759
766
  }
760
- r.apply(new y(this.api.translate("Remove custom attribute")));
767
+ r.apply(new T(this.api.translate("Remove custom attribute")));
761
768
  }
762
769
  // ========================================================================
763
770
  // DOM Mutation (Block Root Attributes, Reorder)
@@ -773,10 +780,10 @@ class oe extends ut {
773
780
  if (!this.currentNode)
774
781
  return;
775
782
  const r = {
776
- ...T.getConfig(this.currentNode),
783
+ ...C.getConfig(this.currentNode),
777
784
  composition: t
778
785
  };
779
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(K, t.join(",")).setAttribute(W, JSON.stringify(e)).setNodeConfig(r).apply(new y(this.api.translate("Update card composition")));
786
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(G, t.join(",")).setAttribute(z, JSON.stringify(e)).setNodeConfig(r).apply(new T(this.api.translate("Update card composition")));
780
787
  }
781
788
  /**
782
789
  * Reorders attribute rows within each product card based on composition order.
@@ -785,14 +792,14 @@ class oe extends ut {
785
792
  _reorderProductAttributes(t) {
786
793
  if (!this.currentNode)
787
794
  return;
788
- const e = this.currentNode.querySelectorAll(U);
795
+ const e = this.currentNode.querySelectorAll(F);
789
796
  if (!(e != null && e.length))
790
797
  return;
791
798
  const r = this.api.getDocumentModifier();
792
799
  e.forEach((i) => {
793
800
  const s = this._buildCompositionHtml(i, t);
794
801
  r.modifyHtml(i).setInnerHtml(s);
795
- }), r.apply(new y(this.api.translate("Reorder product attributes")));
802
+ }), r.apply(new T(this.api.translate("Reorder product attributes")));
796
803
  }
797
804
  /**
798
805
  * Builds HTML string with attributes ordered according to composition.
@@ -816,27 +823,27 @@ class oe extends ut {
816
823
  return;
817
824
  const o = e ? "1" : "0", n = e ? this.api.translate("visible") : this.api.translate("hidden"), l = `${this.api.translate("Set visibility")}: ${t} → ${n}`, a = this.api.getDocumentModifier();
818
825
  s.forEach((c) => {
819
- const u = Ht(c), h = e ? u : "none";
826
+ const u = Bt(c), h = e ? u : "none";
820
827
  a.modifyHtml(c).setStyle("display", h).setAttribute(D, o);
821
828
  });
822
829
  const d = {
823
- ...T.getConfig(this.currentNode),
830
+ ...C.getConfig(this.currentNode),
824
831
  visibility: {
825
832
  ...this._readVisibilityFromRows(),
826
833
  ...Object.fromEntries(r.map((c) => [c, e]))
827
834
  }
828
835
  };
829
- a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new y(l));
836
+ a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new T(l));
830
837
  }
831
838
  /** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
832
839
  _resolveVisibilityKeys(t) {
833
840
  return this._isInlinePrices() && t === p ? [p, I] : [t];
834
841
  }
835
842
  _isInlinePrices() {
836
- return !T.getConfig(this.currentNode).priceMovedToNextLine;
843
+ return !C.getConfig(this.currentNode).priceMovedToNextLine;
837
844
  }
838
845
  _applyTitleVisibilityToBlock(t) {
839
- const e = T.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
846
+ const e = C.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
840
847
  if (!this.currentNode || s)
841
848
  return;
842
849
  const o = this.api.getDocumentModifier();
@@ -846,7 +853,7 @@ class oe extends ut {
846
853
  visibility: { ...this._readVisibilityFromRows(), [$]: t }
847
854
  });
848
855
  const n = t ? this.api.translate("visible") : this.api.translate("hidden");
849
- o.apply(new y(
856
+ o.apply(new T(
850
857
  `${this.api.translate("Set visibility")}: ${$} → ${n}`
851
858
  ));
852
859
  }
@@ -854,7 +861,7 @@ class oe extends ut {
854
861
  const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
855
862
  if (!e || r === null)
856
863
  return null;
857
- const i = t.previousTitleHtml || At(this._defaultTitleParagraph(), !0, t.rowSpacing);
864
+ const i = t.previousTitleHtml || $t(this._defaultTitleParagraph(), !0, t.rowSpacing);
858
865
  return { containerBody: e, html: i + r };
859
866
  }
860
867
  _readTitleHtml(t) {
@@ -868,23 +875,23 @@ class oe extends ut {
868
875
  return t.length > 0 ? t : this._findTitleRowsByClass();
869
876
  }
870
877
  _findTitleRowsByClass() {
871
- const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(G));
878
+ const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(Y));
872
879
  if (r === -1)
873
880
  return [];
874
881
  const i = e[r + 1];
875
882
  return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
876
883
  }
877
884
  _isSpacerRow(t) {
878
- return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(_t));
885
+ return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(gt));
879
886
  }
880
887
  _findTitleContainerBody() {
881
- return (this.currentNode ? Bt(this.currentNode) : null) ?? void 0;
888
+ return (this.currentNode ? Ut(this.currentNode) : null) ?? void 0;
882
889
  }
883
890
  _readInnerHtml(t) {
884
891
  return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
885
892
  }
886
893
  _defaultTitleParagraph() {
887
- return It.replace("{-{-TITLE-}-}", this.api.translate($t));
894
+ return vt.replace("{-{-TITLE-}-}", this.api.translate(Nt));
888
895
  }
889
896
  // ========================================================================
890
897
  // Utilities
@@ -905,7 +912,7 @@ class oe extends ut {
905
912
  return -1;
906
913
  }
907
914
  _getCurrentLayout() {
908
- return this.store.recommendationConfigs.orientation || kt(this.currentNode);
915
+ return this.store.recommendationConfigs.orientation || qt(this.currentNode);
909
916
  }
910
917
  /**
911
918
  * Extracts background color properties from existing card elements.
@@ -957,9 +964,9 @@ class oe extends ut {
957
964
  * or when all available filters have already been added (no unused attributes left).
958
965
  */
959
966
  _updateAddButtonState() {
960
- const t = this._readCustomAttributesFromNode(), e = t.length >= b, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(C(o)));
967
+ const t = this._readCustomAttributesFromNode(), e = t.length >= y, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(b(o)));
961
968
  this.api.setUIEAttribute(
962
- tt.ADD_ATTRIBUTE,
969
+ rt.ADD_ATTRIBUTE,
963
970
  O.BUTTON.disabled,
964
971
  e || s ? "true" : "false"
965
972
  );
@@ -989,8 +996,8 @@ class oe extends ut {
989
996
  */
990
997
  _getAddableFilters() {
991
998
  const t = /* @__PURE__ */ new Set();
992
- return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && gt.has(e.attributeName))).filter((e) => {
993
- const r = C(e);
999
+ return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && bt.has(e.attributeName))).filter((e) => H(b(e))).filter((e) => {
1000
+ const r = b(e);
994
1001
  return t.has(r) ? !1 : (t.add(r), !0);
995
1002
  });
996
1003
  }
@@ -1000,8 +1007,8 @@ class oe extends ut {
1000
1007
  * resolve to their own entry. Falls back to Title Case of the bare name.
1001
1008
  */
1002
1009
  _getDisplayNameForAttribute(t) {
1003
- const e = Object.values(this.store.filterList).find((r) => C(r) === t);
1004
- return e ? e.displayName : vt(H(t));
1010
+ const e = Object.values(this.store.filterList).find((r) => b(r) === t);
1011
+ return e ? e.displayName : Et(P(t));
1005
1012
  }
1006
1013
  /**
1007
1014
  * Resolves the display content for a custom attribute cell.
@@ -1009,29 +1016,29 @@ class oe extends ut {
1009
1016
  */
1010
1017
  _resolveAttributeContent(t, e, r) {
1011
1018
  var l;
1012
- const s = this.store.recommendationProducts[r], o = H(t), n = Dt(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
1013
- return Nt(n) ?? e;
1019
+ const s = this.store.recommendationProducts[r], o = P(t), n = wt(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
1020
+ return Rt(n) ?? e;
1014
1021
  }
1015
1022
  _getGridCellHtml(t, e, r, i = "", s = "", o = "") {
1016
- const n = M(t), l = H(t), a = J(yt, [n], this.store.filterList), d = {
1023
+ const n = q(t), l = P(t), a = Z(Ct, [n], this.store.filterList), d = {
1017
1024
  [l]: e,
1018
1025
  product_attributes: { [l]: e }
1019
1026
  };
1020
1027
  let c = a[n](d);
1021
1028
  return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
1022
- `padding: ${Tt}`,
1029
+ `padding: ${St}`,
1023
1030
  `padding: ${o}`
1024
1031
  )), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
1025
1032
  }
1026
1033
  _getListRowHtml(t, e, r) {
1027
- const i = H(t), s = J(St, [r], this.store.filterList), o = {
1034
+ const i = P(t), s = Z(It, [r], this.store.filterList), o = {
1028
1035
  [i]: e,
1029
1036
  product_attributes: { [i]: e }
1030
1037
  }, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
1031
- return `<tr class="${z}" ${R}="${r}" ${D}="1">${l}</tr>`;
1038
+ return `<tr class="${X}" ${R}="${M(r)}" ${D}="1">${l}</tr>`;
1032
1039
  }
1033
1040
  }
1034
1041
  export {
1035
- Ut as COMPOSITION_CONTROL_BLOCK_ID,
1036
- oe as RecommendationCardCompositionControl
1042
+ xt as COMPOSITION_CONTROL_BLOCK_ID,
1043
+ ce as RecommendationCardCompositionControl
1037
1044
  };