@useinsider/guido 3.17.0-beta.e23d5cd → 3.17.0-beta.e324492

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 (50) hide show
  1. package/dist/components/Guido.vue.js +7 -7
  2. package/dist/components/Guido.vue2.js +59 -57
  3. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  4. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  5. package/dist/composables/useStripo.js +14 -14
  6. package/dist/config/i18n/en/labels.json.js +1 -1
  7. package/dist/config/migrator/index.js +9 -8
  8. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  9. package/dist/config/migrator/recommendation/extractors.js +29 -24
  10. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  11. package/dist/config/migrator/recommendationMigrator.js +30 -25
  12. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  13. package/dist/extensions/Blocks/Recommendation/block.js +12 -11
  14. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  16. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +24 -22
  17. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +329 -257
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +127 -113
  20. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  23. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  24. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +37 -26
  26. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  27. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  28. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  29. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  30. package/dist/guido.css +1 -1
  31. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  32. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  33. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  34. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  35. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  36. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  37. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  38. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  39. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -4
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  43. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  44. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +38 -0
  45. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  46. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  47. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  48. package/dist/static/styles/customEditorStyle.css.js +3 -1
  49. package/dist/utils/templatePreparation.js +37 -36
  50. package/package.json +1 -1
@@ -1,34 +1,35 @@
1
- var ot = Object.defineProperty;
2
- var st = (h, p, t) => p in h ? ot(h, p, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[p] = t;
3
- var $ = (h, p, t) => st(h, typeof p != "symbol" ? p + "" : p, t);
4
- import { ACADEMY_LINKS as nt } from "../../../../../enums/academy.js";
5
- import { UIElementType as g, UEAttr as N, ModificationDescription as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { CommonControl as lt } from "../../../common-control.js";
7
- import { ATTR_PRODUCT_IMAGE as B, ATTR_PRODUCT_NAME as at, ATTR_PRODUCT_PRICE as C, ATTR_PRODUCT_OLD_PRICE as v, ATTR_PRODUCT_OMNIBUS_PRICE as ct, ATTR_PRODUCT_OMNIBUS_DISCOUNT as ut, ATTR_PRODUCT_BUTTON as q, ATTR_DATA_CARD_COMPOSITION as V, ATTR_DATA_CUSTOM_ATTRIBUTES as j, ATTR_CUSTOM_PREFIX as I, SELECTOR_ATTRIBUTE_ROW as E, ATTR_DATA_ATTRIBUTE_TYPE as R, BUILT_IN_DEFAULT_ATTRIBUTES as dt } from "../../constants/selectors.js";
8
- import { DEFAULT_COMPOSITION as K, DEFAULT_VISIBILITY as W } from "../../constants/defaultConfig.js";
9
- import { RecommendationConfigService as _ } from "../../services/configService.js";
10
- import { useRecommendationExtensionStore as mt } from "../../store/recommendation.js";
11
- import { ATTRIBUTE_CELL_CLASS as ht, gridElementRenderer as pt, DEFAULT_CELL_PADDING as gt, buildFillerCell as ft } from "../../templates/grid/elementRenderer.js";
12
- import { listElementRenderer as bt } from "../../templates/list/elementRenderer.js";
13
- import { resolveInlinePriceOrder as _t, toDisplayName as yt, toDisplayableAttributeValue as Ct, buildElementRenderer as z } from "../../templates/utils.js";
14
- import { normalizeCompositionKeys as St, normalizeCustomAttrValues as At, compositionKeyToProductAttr as w, resolveRowCompositionKey as Tt, filterToProductAttrValue as y, findAttributeRow as $t, rewriteLegacyRowKeyHtml as G, bareAttributeName as D, isDefaultProductAttr as It, productAttrToCompositionKey as U } from "../../utils/compositionKeys.js";
15
- import { getTableDisplayValue as vt } from "../../utils/tagName.js";
16
- import { isPartnerManagedBlock as Nt, regenerateProductRowsWithStyles as Et, getCurrentLayout as Rt } from "../main/utils.js";
17
- const Dt = "ui-elements-recommendation-card-composition", k = ".product-card-wrapper > tbody", Y = ".product-info-cell > table > tbody", O = "data-visibility", X = {
1
+ var at = Object.defineProperty;
2
+ var ct = (h, p, t) => p in h ? at(h, p, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[p] = t;
3
+ var $ = (h, p, t) => ct(h, typeof p != "symbol" ? p + "" : p, t);
4
+ import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
5
+ import { UIElementType as _, 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 C, ATTR_PRODUCT_OLD_PRICE as L, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as x, ATTR_RECOMMENDATION_TITLE as I, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as v, SELECTOR_ATTRIBUTE_ROW as N, SELECTOR_TITLE_CELL as z, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as E, CSS_CLASS_ATTRIBUTE_ROW as G, 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 g } 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 { resolveInlinePriceOrder as vt, toDisplayName as Nt, toDisplayableAttributeValue as Et, buildElementRenderer as J } from "../../templates/utils.js";
15
+ import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as Lt, compositionKeyToProductAttr as k, resolveRowCompositionKey as Ot, filterToProductAttrValue as T, findAttributeRow as Dt, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Ht, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
16
+ import { getTableDisplayValue as Pt } from "../../utils/tagName.js";
17
+ import { isPartnerManagedBlock as wt, regenerateProductRowsWithStyles as Bt, getMainContainerTbody as kt, getCurrentLayout as Mt } from "../main/utils.js";
18
+ const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
18
19
  ADD_ATTRIBUTE: "addAttribute"
19
- }, f = 5, L = "reorderIcon_", Ot = '<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 = [
20
- { key: B, label: "Product Image" },
21
- { key: at, label: "Product Name" },
20
+ }, f = 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 = [
21
+ { key: q, label: "Product Image" },
22
+ { key: mt, label: "Product Name" },
22
23
  { key: C, label: "Product Price" },
23
- { key: v, label: "Product Original Price" },
24
- { key: ct, label: "Omnibus Price" },
25
- { key: ut, label: "Omnibus Discount" },
26
- { key: q, label: "Product Button" }
27
- ], Lt = new Set(m.map((h) => h.key)), T = "customAttr_", P = "deleteAttr_";
28
- class Gt extends lt {
24
+ { key: L, label: "Product Original Price" },
25
+ { key: ht, label: "Omnibus Price" },
26
+ { key: pt, label: "Omnibus Discount" },
27
+ { key: x, label: "Product Button" }
28
+ ], R = { key: I, label: "Title" }, xt = new Set(m.map((h) => h.key)), A = "customAttr_", w = "deleteAttr_";
29
+ class se extends ut {
29
30
  constructor() {
30
31
  super(...arguments);
31
- $(this, "store", mt());
32
+ $(this, "store", ft());
32
33
  $(this, "unsubscribeStore", null);
33
34
  $(this, "eventController", null);
34
35
  /**
@@ -38,22 +39,22 @@ class Gt extends lt {
38
39
  $(this, "reorderInProgress", !1);
39
40
  }
40
41
  getId() {
41
- return Dt;
42
+ return Ut;
42
43
  }
43
44
  // ========================================================================
44
45
  // Lifecycle
45
46
  // ========================================================================
46
47
  getTemplate() {
47
- const t = m.map((u) => `
48
- <div data-toggle-key="${u.key}" style="display: none;">
49
- ${this._GuToggle(`visibility_${u.key}`)}
48
+ const t = m.map((d) => `
49
+ <div data-toggle-key="${d.key}" style="display: none;">
50
+ ${this._GuToggle(`visibility_${d.key}`)}
50
51
  </div>
51
52
  `).join(""), e = Array.from(
52
53
  { length: f },
53
- (u, c) => `
54
- <div data-custom-select-key="${T}${c}" style="display: none;">
54
+ (d, c) => `
55
+ <div data-custom-select-key="${A}${c}" style="display: none;">
55
56
  ${this._GuSelect({
56
- name: `${T}${c}`,
57
+ name: `${A}${c}`,
57
58
  placeholder: this.api.translate("Select Attribute"),
58
59
  options: [],
59
60
  // A partner's attribute list runs long; search beats scrolling.
@@ -63,35 +64,35 @@ class Gt extends lt {
63
64
  `
64
65
  ).join(""), r = m.length + f, i = Array.from(
65
66
  { length: r },
66
- (u, c) => `
67
- <div data-reorder-icon-key="${L}${c}" style="display: none;">
68
- <${g.BUTTON}
67
+ (d, c) => `
68
+ <div data-reorder-icon-key="${P}${c}" style="display: none;">
69
+ <${_.BUTTON}
69
70
  class="drag-handle-btn flat-inline flat-white"
70
- ${N.BUTTON.name}="${L}${c}"
71
+ ${O.BUTTON.name}="${P}${c}"
71
72
  >
72
- <${g.ICON}
73
+ <${_.ICON}
73
74
  src="reorder"
74
75
  class="icon-button"
75
- ></${g.ICON}>
76
- </${g.BUTTON}>
76
+ ></${_.ICON}>
77
+ </${_.BUTTON}>
77
78
  </div>
78
79
  `
79
- ).join(""), o = Array.from(
80
+ ).join(""), s = Array.from(
80
81
  { length: f },
81
- (u, c) => `
82
- <div data-custom-delete-key="${P}${c}" style="display: none;">
83
- <${g.BUTTON}
82
+ (d, c) => `
83
+ <div data-custom-delete-key="${w}${c}" style="display: none;">
84
+ <${_.BUTTON}
84
85
  class="custom-attr-delete flat-inline flat-white"
85
- ${N.BUTTON.name}="${P}${c}"
86
+ ${O.BUTTON.name}="${w}${c}"
86
87
  >
87
- <${g.ICON}
88
+ <${_.ICON}
88
89
  src="delete"
89
90
  class="icon-button"
90
- ></${g.ICON}>
91
- </${g.BUTTON}>
91
+ ></${_.ICON}>
92
+ </${_.BUTTON}>
92
93
  </div>
93
94
  `
94
- ).join(""), s = nt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
95
+ ).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
95
96
  "Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
96
97
  ), l = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
97
98
  return `
@@ -101,7 +102,7 @@ class Gt extends lt {
101
102
  ${n}
102
103
  ${l}
103
104
  <!-- cspell:disable-next-line -->
104
- <a href="${s}" target="_blank" rel="noopener noreferrer">${a}</a>.
105
+ <a href="${o}" target="_blank" rel="noopener noreferrer">${a}</a>.
105
106
  </p>
106
107
  </div>
107
108
 
@@ -114,17 +115,26 @@ class Gt extends lt {
114
115
  </div>
115
116
 
116
117
  <div class="custom-delete-store" style="display: none;">
117
- ${o}
118
+ ${s}
118
119
  </div>
119
120
 
120
121
  <div class="reorder-icon-store" style="display: none;">
121
122
  ${i}
122
123
  </div>
123
124
 
125
+ <div class="orderable-list">
126
+ <div class="orderable-item title-item" data-key="${R.key}">
127
+ <span class="item-label">${this.api.translate(R.label)}</span>
128
+ <div class="item-action">
129
+ ${this._GuToggle(`visibility_${R.key}`)}
130
+ </div>
131
+ </div>
132
+ </div>
133
+
124
134
  <div class="orderable-list" data-composition-list></div>
125
135
 
126
136
  ${this._GuButton({
127
- name: X.ADD_ATTRIBUTE,
137
+ name: tt.ADD_ATTRIBUTE,
128
138
  label: this.api.translate("Add Attribute"),
129
139
  id: "guido__btn-add-attribute"
130
140
  })}
@@ -145,7 +155,7 @@ class Gt extends lt {
145
155
  const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
146
156
  if (!t)
147
157
  return;
148
- const e = Nt(this.currentNode);
158
+ const e = wt(this.currentNode);
149
159
  t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
150
160
  }
151
161
  onTemplateNodeUpdated(t) {
@@ -158,17 +168,17 @@ class Gt extends lt {
158
168
  // Initialization
159
169
  // ========================================================================
160
170
  _initializeComposition() {
161
- const t = this._readCompositionFromNode(), e = this._readCustomAttributesFromNode(), r = this._readVisibilityFromRows(), i = this._renderOrderableItems(t, e), o = this._buildVisibilityValues(r);
162
- this.api.updateValues(o), i && this._initializeCustomSelects(e), this._updateAddButtonState();
171
+ const t = this._readCompositionFromNode(), e = this._readCustomAttributesFromNode(), r = this._readVisibilityFromRows(), i = this._renderOrderableItems(t, e), s = this._buildVisibilityValues(r);
172
+ this.api.updateValues(s), i && this._initializeCustomSelects(e), this._updateAddButtonState();
163
173
  }
164
174
  _registerValueChangeListeners() {
165
- m.forEach((t) => {
175
+ [R, ...m].forEach((t) => {
166
176
  this.api.onValueChanged(`visibility_${t.key}`, (e) => {
167
177
  this._applyVisibilityToBlock(t.key, e);
168
178
  });
169
179
  });
170
180
  for (let t = 0; t < f; t++) {
171
- const e = `${T}${t}`, r = t;
181
+ const e = `${A}${t}`, r = t;
172
182
  this.api.onValueChanged(e, (i) => {
173
183
  this._onCustomAttributeChanged(r, i);
174
184
  });
@@ -179,24 +189,24 @@ class Gt extends lt {
179
189
  // ========================================================================
180
190
  _readCompositionFromNode() {
181
191
  if (!this.currentNode || !("getAttribute" in this.currentNode))
182
- return [...K];
183
- const t = this.currentNode.getAttribute(V);
192
+ return [...Y];
193
+ const t = this.currentNode.getAttribute(K);
184
194
  if (t)
185
195
  return this._normalizeComposition(t.split(",").filter(Boolean));
186
- const { composition: e } = _.getConfig(this.currentNode);
187
- return e != null && e.length ? this._normalizeComposition([...e]) : [...K];
196
+ const { composition: e } = g.getConfig(this.currentNode);
197
+ return e != null && e.length ? this._normalizeComposition([...e]) : [...Y];
188
198
  }
189
199
  /** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
190
200
  _normalizeComposition(t) {
191
- return St(t, this.currentNode, this.store.filterList);
201
+ return Rt(t, this.currentNode, this.store.filterList);
192
202
  }
193
203
  _readCustomAttributesFromNode() {
194
204
  if (!this.currentNode || !("getAttribute" in this.currentNode))
195
205
  return [];
196
- const t = this.currentNode.getAttribute(j);
206
+ const t = this.currentNode.getAttribute(W);
197
207
  if (t)
198
208
  try {
199
- return At(
209
+ return Lt(
200
210
  JSON.parse(t).map((e) => String(e)),
201
211
  this.currentNode,
202
212
  this.store.filterList
@@ -204,39 +214,46 @@ class Gt extends lt {
204
214
  } catch {
205
215
  return [];
206
216
  }
207
- return this._readCompositionFromNode().filter((e) => e.startsWith(I)).map(w);
217
+ return this._readCompositionFromNode().filter((e) => e.startsWith(v)).map(k);
208
218
  }
209
219
  _readVisibilityFromRows() {
210
220
  if (!this.currentNode)
211
221
  return this._getDefaultVisibilities();
212
- const t = Array.from(this.currentNode.querySelectorAll(E)), e = this._extractVisibilityFromRows(t);
222
+ const t = Array.from(this.currentNode.querySelectorAll(N)), e = this._extractVisibilityFromRows(t);
213
223
  if (Object.keys(e).length > 0)
214
- return this._mergeWithDefaults(e);
215
- const r = _.getConfig(this.currentNode).visibility;
216
- return this._mergeWithDefaults({ ...r });
224
+ return this._withTitlePresence(this._mergeWithDefaults(e));
225
+ const r = g.getConfig(this.currentNode).visibility;
226
+ return this._withTitlePresence(this._mergeWithDefaults({ ...r }));
227
+ }
228
+ _withTitlePresence(t) {
229
+ return t[I] = this._hasTitle(), t;
230
+ }
231
+ _hasTitle() {
232
+ var t;
233
+ return !!((t = this.currentNode) != null && t.querySelector(z));
217
234
  }
218
235
  _getDefaultVisibilities() {
219
- return { ...W };
236
+ return { ...X };
220
237
  }
221
238
  _extractVisibilityFromRows(t) {
222
239
  const e = {};
223
240
  return t.forEach((r) => {
224
241
  if (!("getAttribute" in r))
225
242
  return;
226
- const i = Tt(r), o = r.getAttribute(O);
227
- i && o !== null && (e[i] = this._parseVisibilityValue(o));
243
+ const i = Ot(r), s = r.getAttribute(D);
244
+ i && s !== null && (e[i] = this._parseVisibilityValue(s));
228
245
  }), e;
229
246
  }
230
247
  _parseVisibilityValue(t) {
231
248
  return t === "1" || t === "true";
232
249
  }
233
250
  _mergeWithDefaults(t) {
234
- return Object.entries(W).forEach(([e, r]) => {
251
+ return Object.entries(X).forEach(([e, r]) => {
235
252
  e in t || (t[e] = r);
236
253
  }), t;
237
254
  }
238
255
  _buildVisibilityValues(t) {
239
- return m.reduce((e, r) => (e[`visibility_${r.key}`] = t[r.key] ?? !0, e), {});
256
+ return [R, ...m].reduce((e, r) => (e[`visibility_${r.key}`] = t[r.key] ?? !0, e), {});
240
257
  }
241
258
  // ========================================================================
242
259
  // UI Rendering (Orderable List)
@@ -253,27 +270,27 @@ class Gt extends lt {
253
270
  const i = r.querySelector("[data-composition-list]");
254
271
  if (!i)
255
272
  return !1;
256
- const o = !_.getConfig(this.currentNode).priceMovedToNextLine;
257
- if (!(i.dataset.inlinePrices !== String(o)) && this._tryReorderInPlace(i, t))
273
+ const s = !g.getConfig(this.currentNode).priceMovedToNextLine;
274
+ if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
258
275
  return !1;
259
- i.dataset.inlinePrices = String(o);
260
- const n = new Set(e), l = _t(t);
261
- let a = 0, u = 0;
262
- const c = t.map((d) => {
263
- if (o && (d === C || d === v))
264
- return d === l.anchor ? this._createPriceGroupItemHtml(u++, l.originalFirst) : "";
265
- if (Lt.has(d)) {
266
- const b = m.find((S) => S.key === d);
267
- return this._createBuiltInItemHtml(b, u++);
276
+ i.dataset.inlinePrices = String(s);
277
+ const n = new Set(e), l = vt(t);
278
+ let a = 0, d = 0;
279
+ const c = t.map((u) => {
280
+ if (s && (u === C || u === L))
281
+ return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
282
+ if (xt.has(u)) {
283
+ const b = m.find((S) => S.key === u);
284
+ return this._createBuiltInItemHtml(b, d++);
268
285
  }
269
- if (d.startsWith(I)) {
270
- const b = w(d);
286
+ if (u.startsWith(v)) {
287
+ const b = k(u);
271
288
  if (n.has(b))
272
- return this._createCustomItemHtml(d, a++, u++);
289
+ return this._createCustomItemHtml(u, a++, d++);
273
290
  }
274
291
  return "";
275
292
  }).join("");
276
- return this._rescueTogglesToStore(r), this._rescueSelectsToStore(r), this._rescueDeleteButtonsToStore(r), this._rescueReorderIconsToStore(r), i.innerHTML = c, this._moveTogglesIntoItems(r), this._moveSelectsIntoItems(r, e.length), this._moveDeleteButtonsIntoItems(r, e.length), this._moveReorderIconsIntoItems(r, u), !0;
293
+ return this._rescueTogglesToStore(r), this._rescueSelectsToStore(r), this._rescueDeleteButtonsToStore(r), this._rescueReorderIconsToStore(r), i.innerHTML = c, this._moveTogglesIntoItems(r), this._moveSelectsIntoItems(r, e.length), this._moveDeleteButtonsIntoItems(r, e.length), this._moveReorderIconsIntoItems(r, d), !0;
277
294
  }
278
295
  /**
279
296
  * Attempts to reorder existing orderable-item elements to match the composition order.
@@ -288,24 +305,24 @@ class Gt extends lt {
288
305
  const i = r.map((a) => a.dataset.key).filter(Boolean);
289
306
  if (i.length !== e.length)
290
307
  return !1;
291
- const o = [...i].sort().join(","), s = [...e].sort().join(",");
292
- if (o !== s || e.some((a) => a.startsWith(I)))
308
+ const s = [...i].sort().join(","), o = [...e].sort().join(",");
309
+ if (s !== o || e.some((a) => a.startsWith(v)))
293
310
  return !1;
294
311
  const n = /* @__PURE__ */ new Map();
295
312
  r.forEach((a) => {
296
- const { key: u } = a.dataset;
297
- if (u) {
298
- const c = n.get(u) || [];
299
- c.push(a), n.set(u, c);
313
+ const { key: d } = a.dataset;
314
+ if (d) {
315
+ const c = n.get(d) || [];
316
+ c.push(a), n.set(d, c);
300
317
  }
301
318
  });
302
319
  const l = /* @__PURE__ */ new Map();
303
320
  return e.forEach((a) => {
304
- const u = n.get(a);
305
- if (!u)
321
+ const d = n.get(a);
322
+ if (!d)
306
323
  return;
307
324
  const c = l.get(a) || 0;
308
- l.set(a, c + 1), u[c] && t.appendChild(u[c]);
325
+ l.set(a, c + 1), d[c] && t.appendChild(d[c]);
309
326
  }), !0;
310
327
  }
311
328
  _createBuiltInItemHtml(t, e) {
@@ -327,11 +344,11 @@ class Gt extends lt {
327
344
  */
328
345
  _createPriceGroupItemHtml(t, e) {
329
346
  var n, l;
330
- const r = ((n = m.find((a) => a.key === C)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === v)) == null ? void 0 : l.label) ?? "Product Original Price", o = (a, u) => `
347
+ const r = ((n = m.find((a) => a.key === C)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === L)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
331
348
  <div class="price-suborderable-item" draggable="true" data-subkey="${a}">
332
- <span class="sub-drag-handle">${Ot}</span>
333
- <span class="item-label">${this.api.translate(u)}</span>
334
- </div>`, s = e ? o(v, i) + o(C, r) : o(C, r) + o(v, i);
349
+ <span class="sub-drag-handle">${qt}</span>
350
+ <span class="item-label">${this.api.translate(d)}</span>
351
+ </div>`, o = e ? s(L, i) + s(C, r) : s(C, r) + s(L, i);
335
352
  return `
336
353
  <div class="orderable-item price-group-item" draggable="true"
337
354
  data-key="${C}" data-group="prices">
@@ -340,7 +357,7 @@ class Gt extends lt {
340
357
  <span class="item-label">${this.api.translate("Product Prices")}</span>
341
358
  <div class="item-action" data-action-for="${C}"></div>
342
359
  </div>
343
- <div class="price-suborderable-list">${s}</div>
360
+ <div class="price-suborderable-list">${o}</div>
344
361
  </div>
345
362
  `;
346
363
  }
@@ -376,15 +393,15 @@ class Gt extends lt {
376
393
  if (r.length === 0)
377
394
  return [{ text: this._getDisplayNameForAttribute(t), value: t }];
378
395
  const i = /* @__PURE__ */ new Map();
379
- r.forEach((s) => i.set(s.attributeName, (i.get(s.attributeName) ?? 0) + 1));
380
- const o = new Set(e);
381
- return o.delete(t), r.filter((s) => !o.has(y(s))).map((s) => ({
396
+ r.forEach((o) => i.set(o.attributeName, (i.get(o.attributeName) ?? 0) + 1));
397
+ const s = new Set(e);
398
+ return s.delete(t), r.filter((o) => !s.has(T(o))).map((o) => ({
382
399
  text: this._toOptionLabel(
383
- s.displayName,
384
- s.type === "defaultAttribute",
385
- (i.get(s.attributeName) ?? 0) > 1
400
+ o.displayName,
401
+ o.type === "defaultAttribute",
402
+ (i.get(o.attributeName) ?? 0) > 1
386
403
  ),
387
- value: y(s)
404
+ value: T(o)
388
405
  }));
389
406
  }
390
407
  /**
@@ -395,8 +412,8 @@ class Gt extends lt {
395
412
  _initializeCustomSelects(t) {
396
413
  t.length !== 0 && setTimeout(() => {
397
414
  t.forEach((e, r) => {
398
- const i = `${T}${r}`, o = this._getSelectOptions(e, t);
399
- this.api.setUIEAttribute(i, N.SELECTPICKER.items, o), this.api.updateValues({ [i]: e });
415
+ const i = `${A}${r}`, s = this._getSelectOptions(e, t);
416
+ this.api.setUIEAttribute(i, O.SELECTPICKER.items, s), this.api.updateValues({ [i]: e });
400
417
  });
401
418
  }, 0);
402
419
  }
@@ -408,8 +425,8 @@ class Gt extends lt {
408
425
  m.forEach((e) => {
409
426
  const r = t.querySelector(`[data-toggle-key="${e.key}"]`), i = t.querySelector(`[data-action-for="${e.key}"]`);
410
427
  if (r && i) {
411
- const o = r.querySelector("ue-switcher");
412
- o && i.appendChild(o);
428
+ const s = r.querySelector("ue-switcher");
429
+ s && i.appendChild(s);
413
430
  }
414
431
  });
415
432
  }
@@ -419,10 +436,10 @@ class Gt extends lt {
419
436
  */
420
437
  _moveSelectsIntoItems(t, e) {
421
438
  for (let r = 0; r < e; r++) {
422
- const i = `${T}${r}`, o = t.querySelector(`[data-custom-select-key="${i}"]`), s = t.querySelector(`[data-custom-select-slot="${r}"]`);
423
- if (o && s) {
424
- const n = o.querySelector("ue-select");
425
- n && s.appendChild(n);
439
+ const i = `${A}${r}`, s = t.querySelector(`[data-custom-select-key="${i}"]`), o = t.querySelector(`[data-custom-select-slot="${r}"]`);
440
+ if (s && o) {
441
+ const n = s.querySelector("ue-select");
442
+ n && o.appendChild(n);
426
443
  }
427
444
  }
428
445
  }
@@ -436,8 +453,8 @@ class Gt extends lt {
436
453
  m.forEach((e) => {
437
454
  const r = t.querySelector(`[data-toggle-key="${e.key}"]`), i = t.querySelector(`[data-action-for="${e.key}"]`);
438
455
  if (i) {
439
- const o = i.querySelector("ue-switcher");
440
- o && r && r.appendChild(o);
456
+ const s = i.querySelector("ue-switcher");
457
+ s && r && r.appendChild(s);
441
458
  }
442
459
  });
443
460
  }
@@ -447,10 +464,10 @@ class Gt extends lt {
447
464
  */
448
465
  _rescueSelectsToStore(t) {
449
466
  for (let e = 0; e < f; e++) {
450
- const r = `${T}${e}`, i = t.querySelector(`[data-custom-select-key="${r}"]`), o = t.querySelector(`[data-custom-select-slot="${e}"]`);
451
- if (o) {
452
- const s = o.querySelector("ue-select");
453
- s && i && i.appendChild(s);
467
+ const r = `${A}${e}`, i = t.querySelector(`[data-custom-select-key="${r}"]`), s = t.querySelector(`[data-custom-select-slot="${e}"]`);
468
+ if (s) {
469
+ const o = s.querySelector("ue-select");
470
+ o && i && i.appendChild(o);
454
471
  }
455
472
  }
456
473
  }
@@ -460,10 +477,10 @@ class Gt extends lt {
460
477
  */
461
478
  _moveDeleteButtonsIntoItems(t, e) {
462
479
  for (let r = 0; r < e; r++) {
463
- const i = `${P}${r}`, o = t.querySelector(`[data-custom-delete-key="${i}"]`), s = t.querySelector(`[data-custom-delete-slot="${r}"]`);
464
- if (o && s) {
465
- const n = o.querySelector("ue-button");
466
- n && s.appendChild(n);
480
+ const i = `${w}${r}`, s = t.querySelector(`[data-custom-delete-key="${i}"]`), o = t.querySelector(`[data-custom-delete-slot="${r}"]`);
481
+ if (s && o) {
482
+ const n = s.querySelector("ue-button");
483
+ n && o.appendChild(n);
467
484
  }
468
485
  }
469
486
  }
@@ -473,10 +490,10 @@ class Gt extends lt {
473
490
  */
474
491
  _rescueDeleteButtonsToStore(t) {
475
492
  for (let e = 0; e < f; e++) {
476
- const r = `${P}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), o = t.querySelector(`[data-custom-delete-slot="${e}"]`);
477
- if (o) {
478
- const s = o.querySelector("ue-button");
479
- s && i && i.appendChild(s);
493
+ const r = `${w}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
494
+ if (s) {
495
+ const o = s.querySelector("ue-button");
496
+ o && i && i.appendChild(o);
480
497
  }
481
498
  }
482
499
  }
@@ -486,10 +503,10 @@ class Gt extends lt {
486
503
  */
487
504
  _moveReorderIconsIntoItems(t, e) {
488
505
  for (let r = 0; r < e; r++) {
489
- const i = `${L}${r}`, o = t.querySelector(`[data-reorder-icon-key="${i}"]`), s = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
490
- if (o && s) {
491
- const n = o.querySelector("ue-button");
492
- n && s.appendChild(n);
506
+ const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
507
+ if (s && o) {
508
+ const n = s.querySelector("ue-button");
509
+ n && o.appendChild(n);
493
510
  }
494
511
  }
495
512
  }
@@ -500,10 +517,10 @@ class Gt extends lt {
500
517
  _rescueReorderIconsToStore(t) {
501
518
  const e = m.length + f;
502
519
  for (let r = 0; r < e; r++) {
503
- const i = `${L}${r}`, o = t.querySelector(`[data-reorder-icon-key="${i}"]`), s = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
504
- if (s) {
505
- const n = s.querySelector("ue-button");
506
- n && o && o.appendChild(n);
520
+ const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
521
+ if (o) {
522
+ const n = o.querySelector("ue-button");
523
+ n && s && s.appendChild(n);
507
524
  }
508
525
  }
509
526
  }
@@ -517,8 +534,8 @@ class Gt extends lt {
517
534
  return;
518
535
  const r = e.querySelector("[data-composition-list]"), i = e.querySelector("#guido__btn-add-attribute");
519
536
  r && (this._setupDragAndDrop(r, t), this._setupDeleteHandler(r, t)), i && i.addEventListener("click", () => {
520
- const o = new Set(this._readCustomAttributesFromNode()), s = this._getAddableFilters().find((n) => !o.has(y(n)));
521
- s && this._onAddAttribute(y(s), s.displayName);
537
+ const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(T(n)));
538
+ o && this._onAddAttribute(T(o), o.displayName);
522
539
  }, { signal: t });
523
540
  }
524
541
  /**
@@ -530,9 +547,9 @@ class Gt extends lt {
530
547
  const e = [];
531
548
  return t.querySelectorAll(".orderable-item").forEach((r) => {
532
549
  const i = r;
533
- i.dataset.group === "prices" ? i.querySelectorAll(".price-suborderable-item").forEach((o) => {
534
- const s = o.dataset.subkey;
535
- s && e.push(s);
550
+ i.dataset.group === "prices" ? i.querySelectorAll(".price-suborderable-item").forEach((s) => {
551
+ const o = s.dataset.subkey;
552
+ o && e.push(o);
536
553
  }) : i.dataset.key && e.push(i.dataset.key);
537
554
  }), e;
538
555
  }
@@ -556,42 +573,42 @@ class Gt extends lt {
556
573
  * identically.
557
574
  */
558
575
  _registerDragHandlers(t, e, r) {
559
- let i = null, o = null;
560
- const s = (n) => n.target.closest(r.itemSelector);
576
+ let i = null, s = null;
577
+ const o = (n) => n.target.closest(r.itemSelector);
561
578
  t.addEventListener("dragstart", (n) => {
562
- var u;
579
+ var d;
563
580
  const l = n.target;
564
581
  if (r.ignoreSelector && l.closest(r.ignoreSelector))
565
582
  return;
566
- const a = s(n);
567
- a && (i = a, a.classList.add("dragging"), (u = n.dataTransfer) == null || u.setData("text/plain", a.dataset.key ?? a.dataset.subkey ?? ""));
583
+ const a = o(n);
584
+ a && (i = a, a.classList.add("dragging"), (d = n.dataTransfer) == null || d.setData("text/plain", a.dataset.key ?? a.dataset.subkey ?? ""));
568
585
  }, { signal: e }), t.addEventListener("dragend", () => {
569
- i == null || i.classList.remove("dragging"), o == null || o.classList.remove("drag-over"), i = null, o = null;
586
+ i == null || i.classList.remove("dragging"), s == null || s.classList.remove("drag-over"), i = null, s = null;
570
587
  }, { signal: e }), t.addEventListener("dragover", (n) => {
571
588
  if (!i)
572
589
  return;
573
- const l = s(n);
590
+ const l = o(n);
574
591
  if (!l)
575
592
  return;
576
593
  n.preventDefault();
577
594
  const a = l !== i ? l : null;
578
- a !== o && (o == null || o.classList.remove("drag-over"), o = a, o == null || o.classList.add("drag-over"));
595
+ a !== s && (s == null || s.classList.remove("drag-over"), s = a, s == null || s.classList.add("drag-over"));
579
596
  }, { signal: e }), t.addEventListener("drop", (n) => {
580
597
  var c;
581
- const l = i && s(n);
598
+ const l = i && o(n);
582
599
  if (!i || !l || l === i)
583
600
  return;
584
601
  n.preventDefault();
585
- const a = l.getBoundingClientRect(), u = n.clientY < a.top + a.height / 2;
586
- (c = r.getDropParent(l)) == null || c.insertBefore(i, u ? l : l.nextSibling), o == null || o.classList.remove("drag-over"), i.classList.remove("dragging"), i = null, o = null, this._onReorder(this._extractCompositionOrder(t));
602
+ const a = l.getBoundingClientRect(), d = n.clientY < a.top + a.height / 2;
603
+ (c = r.getDropParent(l)) == null || c.insertBefore(i, d ? l : l.nextSibling), s == null || s.classList.remove("drag-over"), i.classList.remove("dragging"), i = null, s = null, this._onReorder(this._extractCompositionOrder(t));
587
604
  }, { signal: e });
588
605
  }
589
606
  _setupDeleteHandler(t, e) {
590
607
  t.addEventListener("click", (r) => {
591
- const o = r.target.closest(".custom-attr-delete");
592
- if (!o)
608
+ const s = r.target.closest(".custom-attr-delete");
609
+ if (!s)
593
610
  return;
594
- const s = o.closest("[data-custom-index]"), n = s == null ? void 0 : s.dataset.customIndex;
611
+ const o = s.closest("[data-custom-index]"), n = o == null ? void 0 : o.dataset.customIndex;
595
612
  n !== void 0 && this._onDeleteCustomAttribute(Number(n));
596
613
  }, { signal: e });
597
614
  }
@@ -599,10 +616,10 @@ class Gt extends lt {
599
616
  // Actions (Add, Delete, Reorder)
600
617
  // ========================================================================
601
618
  _onAddAttribute(t, e) {
602
- const r = U(t), i = this._readCompositionFromNode();
619
+ const r = M(t), i = this._readCompositionFromNode();
603
620
  i.push(r);
604
- const o = [...this._readCustomAttributesFromNode(), t];
605
- this._updateBothAttributes(i, o), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, o), this._initializeCustomSelects(o), this._updateAddButtonState();
621
+ const s = [...this._readCustomAttributesFromNode(), t];
622
+ this._updateBothAttributes(i, s), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, s), this._initializeCustomSelects(s), this._updateAddButtonState();
606
623
  }
607
624
  /**
608
625
  * Removes a single custom attribute by its index in the customAttrs array.
@@ -612,8 +629,8 @@ class Gt extends lt {
612
629
  const e = this._readCustomAttributesFromNode();
613
630
  if (e[t] === void 0)
614
631
  return;
615
- const i = this._readCompositionFromNode(), o = this._findNthCustomKeyIndex(i, t), s = i.filter((l, a) => a !== o), n = e.filter((l, a) => a !== t);
616
- this._updateBothAttributes(s, n), this._removeCustomAttributeHtml(s), this._renderOrderableItems(s, n), this._initializeCustomSelects(n), this._updateAddButtonState();
632
+ const i = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(i, t), o = i.filter((l, a) => a !== s), n = e.filter((l, a) => a !== t);
633
+ this._updateBothAttributes(o, n), this._removeCustomAttributeHtml(o), this._renderOrderableItems(o, n), this._initializeCustomSelects(n), this._updateAddButtonState();
617
634
  }
618
635
  /**
619
636
  * Handles changing a custom attribute's selection via its inline _GuSelect.
@@ -623,18 +640,18 @@ class Gt extends lt {
623
640
  const r = this._readCustomAttributesFromNode(), i = r[t];
624
641
  if (i === void 0 || i === e)
625
642
  return;
626
- const o = U(e), s = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(s, t);
627
- n !== -1 && (s[n] = o), r[t] = e;
643
+ const s = M(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
644
+ n !== -1 && (o[n] = s), r[t] = e;
628
645
  const l = this._getDisplayNameForAttribute(e);
629
- this._updateBothAttributes(s, r), this._injectCustomAttributeHtml(e, l, o, s), this._renderOrderableItems(s, r), this._initializeCustomSelects(r);
646
+ this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
630
647
  }
631
648
  _onReorder(t) {
632
- const e = t.filter((r) => r.startsWith(I)).map(w);
649
+ const e = t.filter((r) => r.startsWith(v)).map(k);
633
650
  this.reorderInProgress = !0;
634
651
  try {
635
652
  this._updateBothAttributes(t, e);
636
- const r = !_.getConfig(this.currentNode).priceMovedToNextLine;
637
- this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Et({
653
+ const r = !g.getConfig(this.currentNode).priceMovedToNextLine;
654
+ this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Bt({
638
655
  currentNode: this.currentNode,
639
656
  documentModifier: this.api.getDocumentModifier()
640
657
  });
@@ -652,13 +669,13 @@ class Gt extends lt {
652
669
  * DOM converge on the next composition change without writing on open.
653
670
  */
654
671
  _getExistingRowHtml(t, e) {
655
- const r = $t(t, e);
672
+ const r = Dt(t, e);
656
673
  if (r && "getOuterHTML" in r)
657
- return G(r.getOuterHTML(), e);
674
+ return Q(r.getOuterHTML(), e);
658
675
  const i = t.querySelector(
659
- `${E}[${R}="${e}"]`
676
+ `${N}[${E}="${e}"]`
660
677
  );
661
- return i && "getOuterHTML" in i ? G(i.getOuterHTML(), e) : "";
678
+ return i && "getOuterHTML" in i ? Q(i.getOuterHTML(), e) : "";
662
679
  }
663
680
  _injectCustomAttributeHtml(t, e, r, i) {
664
681
  if (!this.currentNode)
@@ -666,55 +683,55 @@ class Gt extends lt {
666
683
  this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i) : this._injectListAttributeRow(t, e, r, i);
667
684
  }
668
685
  _injectGridAttributeRow(t, e, r, i) {
669
- const o = this.currentNode.querySelectorAll(k);
670
- if (!(o != null && o.length))
686
+ const s = this.currentNode.querySelectorAll(U);
687
+ if (!(s != null && s.length))
671
688
  return;
672
- const s = _.getConfig(this.currentNode), l = `0 ${Math.floor(s.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), u = this.store.recommendationProducts.length;
689
+ const o = g.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
673
690
  let c = 0;
674
- o.forEach((d) => {
675
- var F;
676
- const b = d.querySelector(E), S = ((F = b == null ? void 0 : b.querySelectorAll(`.${ht}`)) == null ? void 0 : F.length) || 1, x = (100 / S).toFixed(2), { bgStyle: J, bgAttr: Q } = this._extractSegmentBgFromCard(d), H = u > 0 ? Math.min(S, u - c) : S, Z = i.map((M) => {
677
- if (M === r) {
678
- const tt = Array.from(
679
- { length: H },
680
- (Pt, rt) => {
681
- const it = this._resolveAttributeContent(
691
+ s.forEach((u) => {
692
+ var V;
693
+ const b = u.querySelector(N), S = ((V = b == null ? void 0 : b.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, F = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
694
+ if (j === r) {
695
+ const st = Array.from(
696
+ { length: B },
697
+ (Ft, nt) => {
698
+ const lt = this._resolveAttributeContent(
682
699
  t,
683
700
  e,
684
- c + rt
701
+ c + nt
685
702
  );
686
703
  return this._getGridCellHtml(
687
704
  t,
688
- it,
689
- x,
690
- J,
691
- Q,
705
+ lt,
706
+ F,
707
+ et,
708
+ rt,
692
709
  l
693
710
  );
694
711
  }
695
- ).join(""), et = ft(x, l).repeat(S - H);
696
- return `<tr class="recommendation-attribute-row" ${R}="${r}" ${O}="1">${tt}${et}</tr>`;
712
+ ).join(""), ot = Ct(F, l).repeat(S - B);
713
+ return `<tr class="${G}" ${E}="${r}" ${D}="1">${st}${ot}</tr>`;
697
714
  }
698
- return this._getExistingRowHtml(d, M);
715
+ return this._getExistingRowHtml(u, j);
699
716
  }).join("");
700
- c += H, u > 0 && c >= u && (c = 0), a.modifyHtml(d).setInnerHtml(Z);
701
- }), a.apply(new A(`${this.api.translate("Add custom attribute")}: ${e}`));
717
+ c += B, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(it);
718
+ }), a.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
702
719
  }
703
720
  _injectListAttributeRow(t, e, r, i) {
704
- const o = this.currentNode.querySelectorAll(Y);
705
- if (!(o != null && o.length))
721
+ const s = this.currentNode.querySelectorAll(Z);
722
+ if (!(s != null && s.length))
706
723
  return;
707
- const s = i.filter((l) => l !== B && l !== q), n = this.api.getDocumentModifier();
708
- o.forEach((l, a) => {
709
- const u = s.map((c) => {
724
+ const o = i.filter((l) => l !== q && l !== x), n = this.api.getDocumentModifier();
725
+ s.forEach((l, a) => {
726
+ const d = o.map((c) => {
710
727
  if (c === r) {
711
- const d = this._resolveAttributeContent(t, e, a);
712
- return this._getListRowHtml(t, d, r);
728
+ const u = this._resolveAttributeContent(t, e, a);
729
+ return this._getListRowHtml(t, u, r);
713
730
  }
714
731
  return this._getExistingRowHtml(l, c);
715
732
  }).join("");
716
- n.modifyHtml(l).setInnerHtml(u);
717
- }), n.apply(new A(`${this.api.translate("Add custom attribute")}: ${e}`));
733
+ n.modifyHtml(l).setInnerHtml(d);
734
+ }), n.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
718
735
  }
719
736
  /**
720
737
  * Removes a custom attribute by rebuilding product card content without it.
@@ -725,19 +742,19 @@ class Gt extends lt {
725
742
  return;
726
743
  const e = this._getCurrentLayout(), r = this.api.getDocumentModifier();
727
744
  if (e === "grid") {
728
- const i = this.currentNode.querySelectorAll(k);
729
- i == null || i.forEach((o) => {
730
- const s = this._buildCompositionHtml(o, t);
731
- r.modifyHtml(o).setInnerHtml(s);
745
+ const i = this.currentNode.querySelectorAll(U);
746
+ i == null || i.forEach((s) => {
747
+ const o = this._buildCompositionHtml(s, t);
748
+ r.modifyHtml(s).setInnerHtml(o);
732
749
  });
733
750
  } else {
734
- const i = t.filter((s) => s !== B && s !== q), o = this.currentNode.querySelectorAll(Y);
735
- o == null || o.forEach((s) => {
736
- const n = this._buildCompositionHtml(s, i);
737
- r.modifyHtml(s).setInnerHtml(n);
751
+ const i = t.filter((o) => o !== q && o !== x), s = this.currentNode.querySelectorAll(Z);
752
+ s == null || s.forEach((o) => {
753
+ const n = this._buildCompositionHtml(o, i);
754
+ r.modifyHtml(o).setInnerHtml(n);
738
755
  });
739
756
  }
740
- r.apply(new A(this.api.translate("Remove custom attribute")));
757
+ r.apply(new y(this.api.translate("Remove custom attribute")));
741
758
  }
742
759
  // ========================================================================
743
760
  // DOM Mutation (Block Root Attributes, Reorder)
@@ -753,10 +770,10 @@ class Gt extends lt {
753
770
  if (!this.currentNode)
754
771
  return;
755
772
  const r = {
756
- ..._.getConfig(this.currentNode),
773
+ ...g.getConfig(this.currentNode),
757
774
  composition: t
758
775
  };
759
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(V, t.join(",")).setAttribute(j, JSON.stringify(e)).setNodeConfig(r).apply(new A(this.api.translate("Update card composition")));
776
+ 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")));
760
777
  }
761
778
  /**
762
779
  * Reorders attribute rows within each product card based on composition order.
@@ -765,14 +782,14 @@ class Gt extends lt {
765
782
  _reorderProductAttributes(t) {
766
783
  if (!this.currentNode)
767
784
  return;
768
- const e = this.currentNode.querySelectorAll(k);
785
+ const e = this.currentNode.querySelectorAll(U);
769
786
  if (!(e != null && e.length))
770
787
  return;
771
788
  const r = this.api.getDocumentModifier();
772
789
  e.forEach((i) => {
773
- const o = this._buildCompositionHtml(i, t);
774
- r.modifyHtml(i).setInnerHtml(o);
775
- }), r.apply(new A(this.api.translate("Reorder product attributes")));
790
+ const s = this._buildCompositionHtml(i, t);
791
+ r.modifyHtml(i).setInnerHtml(s);
792
+ }), r.apply(new y(this.api.translate("Reorder product attributes")));
776
793
  }
777
794
  /**
778
795
  * Builds HTML string with attributes ordered according to composition.
@@ -787,19 +804,74 @@ class Gt extends lt {
787
804
  _applyVisibilityToBlock(t, e) {
788
805
  if (!this.currentNode)
789
806
  return;
790
- const r = this.currentNode.querySelectorAll(`${E}[${R}="${t}"]`);
807
+ if (t === I) {
808
+ this._applyTitleVisibilityToBlock(e);
809
+ return;
810
+ }
811
+ const r = this.currentNode.querySelectorAll(`${N}[${E}="${t}"]`);
791
812
  if (!(r != null && r.length))
792
813
  return;
793
- const i = e ? "1" : "0", o = e ? this.api.translate("visible") : this.api.translate("hidden"), s = `${this.api.translate("Set visibility")}: ${t} → ${o}`, n = this.api.getDocumentModifier();
814
+ const i = e ? "1" : "0", s = e ? this.api.translate("visible") : this.api.translate("hidden"), o = `${this.api.translate("Set visibility")}: ${t} → ${s}`, n = this.api.getDocumentModifier();
794
815
  r.forEach((a) => {
795
- const u = vt(a), c = e ? u : "none";
796
- n.modifyHtml(a).setStyle("display", c).setAttribute(O, i);
816
+ const d = Pt(a), c = e ? d : "none";
817
+ n.modifyHtml(a).setStyle("display", c).setAttribute(D, i);
797
818
  });
798
819
  const l = {
799
- ..._.getConfig(this.currentNode),
820
+ ...g.getConfig(this.currentNode),
800
821
  visibility: { ...this._readVisibilityFromRows(), [t]: e }
801
822
  };
802
- n.modifyHtml(this.currentNode).setNodeConfig(l), n.apply(new A(s));
823
+ n.modifyHtml(this.currentNode).setNodeConfig(l), n.apply(new y(o));
824
+ }
825
+ _applyTitleVisibilityToBlock(t) {
826
+ const e = g.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
827
+ if (!this.currentNode || s)
828
+ return;
829
+ const o = this.api.getDocumentModifier();
830
+ r ? o.modifyHtml(r.containerBody).setInnerHtml(r.html) : i.forEach((l) => o.modifyHtml(l).delete()), o.modifyHtml(this.currentNode).setNodeConfig({
831
+ ...e,
832
+ previousTitleHtml: t ? e.previousTitleHtml : this._readTitleHtml(i),
833
+ visibility: { ...this._readVisibilityFromRows(), [I]: t }
834
+ });
835
+ const n = t ? this.api.translate("visible") : this.api.translate("hidden");
836
+ o.apply(new y(
837
+ `${this.api.translate("Set visibility")}: ${I} → ${n}`
838
+ ));
839
+ }
840
+ _resolveTitleInjection(t) {
841
+ const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
842
+ if (!e || r === null)
843
+ return null;
844
+ const i = t.previousTitleHtml || At(this._defaultTitleParagraph(), !0, t.rowSpacing);
845
+ return { containerBody: e, html: i + r };
846
+ }
847
+ _readTitleHtml(t) {
848
+ return t.map((e) => "getOuterHTML" in e ? e.getOuterHTML() : "").join("");
849
+ }
850
+ _findTitleRows() {
851
+ var e;
852
+ const t = Array.from(((e = this.currentNode) == null ? void 0 : e.querySelectorAll(
853
+ `${N}[${E}="${I}"]`
854
+ )) ?? []);
855
+ return t.length > 0 ? t : this._findTitleRowsByClass();
856
+ }
857
+ _findTitleRowsByClass() {
858
+ const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(z));
859
+ if (r === -1)
860
+ return [];
861
+ const i = e[r + 1];
862
+ return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
863
+ }
864
+ _isSpacerRow(t) {
865
+ return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(_t));
866
+ }
867
+ _findTitleContainerBody() {
868
+ return (this.currentNode ? kt(this.currentNode) : null) ?? void 0;
869
+ }
870
+ _readInnerHtml(t) {
871
+ return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
872
+ }
873
+ _defaultTitleParagraph() {
874
+ return It.replace("{-{-TITLE-}-}", this.api.translate($t));
803
875
  }
804
876
  // ========================================================================
805
877
  // Utilities
@@ -812,7 +884,7 @@ class Gt extends lt {
812
884
  _findNthCustomKeyIndex(t, e) {
813
885
  let r = 0;
814
886
  for (let i = 0; i < t.length; i++)
815
- if (t[i].startsWith(I)) {
887
+ if (t[i].startsWith(v)) {
816
888
  if (r === e)
817
889
  return i;
818
890
  r++;
@@ -820,7 +892,7 @@ class Gt extends lt {
820
892
  return -1;
821
893
  }
822
894
  _getCurrentLayout() {
823
- return this.store.recommendationConfigs.orientation || Rt(this.currentNode);
895
+ return this.store.recommendationConfigs.orientation || Mt(this.currentNode);
824
896
  }
825
897
  /**
826
898
  * Extracts background color properties from existing card elements.
@@ -832,18 +904,18 @@ class Gt extends lt {
832
904
  var i;
833
905
  const e = t.querySelector(".product-card-segment");
834
906
  if (e && "getAttribute" in e) {
835
- const s = (e.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
836
- if (s) {
907
+ const o = (e.getAttribute("style") || "").match(/background-color:\s*([^;]+)/);
908
+ if (o) {
837
909
  const n = e.getAttribute("bgcolor") || "";
838
- return { bgStyle: `background-color: ${s[1].trim()};`, bgAttr: n };
910
+ return { bgStyle: `background-color: ${o[1].trim()};`, bgAttr: n };
839
911
  }
840
912
  }
841
913
  const r = (i = this.currentNode) == null ? void 0 : i.querySelector(".product-card-wrapper");
842
914
  if (r && "getStyle" in r) {
843
- const o = r.getStyle("background-color");
844
- if (o && o !== "transparent") {
845
- const s = "getAttribute" in r && r.getAttribute("bgcolor") || "";
846
- return { bgStyle: `background-color: ${o};`, bgAttr: s };
915
+ const s = r.getStyle("background-color");
916
+ if (s && s !== "transparent") {
917
+ const o = "getAttribute" in r && r.getAttribute("bgcolor") || "";
918
+ return { bgStyle: `background-color: ${s};`, bgAttr: o };
847
919
  }
848
920
  }
849
921
  return { bgStyle: "", bgAttr: "" };
@@ -872,11 +944,11 @@ class Gt extends lt {
872
944
  * or when all available filters have already been added (no unused attributes left).
873
945
  */
874
946
  _updateAddButtonState() {
875
- const t = this._readCustomAttributesFromNode(), e = t.length >= f, r = new Set(t), i = this._getAddableFilters(), o = i.length > 0 && i.every((s) => r.has(y(s)));
947
+ const t = this._readCustomAttributesFromNode(), e = t.length >= f, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(T(o)));
876
948
  this.api.setUIEAttribute(
877
- X.ADD_ATTRIBUTE,
878
- N.BUTTON.disabled,
879
- e || o ? "true" : "false"
949
+ tt.ADD_ATTRIBUTE,
950
+ O.BUTTON.disabled,
951
+ e || s ? "true" : "false"
880
952
  );
881
953
  }
882
954
  /**
@@ -904,8 +976,8 @@ class Gt extends lt {
904
976
  */
905
977
  _getAddableFilters() {
906
978
  const t = /* @__PURE__ */ new Set();
907
- return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && dt.has(e.attributeName))).filter((e) => {
908
- const r = y(e);
979
+ return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && gt.has(e.attributeName))).filter((e) => {
980
+ const r = T(e);
909
981
  return t.has(r) ? !1 : (t.add(r), !0);
910
982
  });
911
983
  }
@@ -915,8 +987,8 @@ class Gt extends lt {
915
987
  * resolve to their own entry. Falls back to Title Case of the bare name.
916
988
  */
917
989
  _getDisplayNameForAttribute(t) {
918
- const e = Object.values(this.store.filterList).find((r) => y(r) === t);
919
- return e ? e.displayName : yt(D(t));
990
+ const e = Object.values(this.store.filterList).find((r) => T(r) === t);
991
+ return e ? e.displayName : Nt(H(t));
920
992
  }
921
993
  /**
922
994
  * Resolves the display content for a custom attribute cell.
@@ -924,29 +996,29 @@ class Gt extends lt {
924
996
  */
925
997
  _resolveAttributeContent(t, e, r) {
926
998
  var l;
927
- const o = this.store.recommendationProducts[r], s = D(t), n = It(t) ? o == null ? void 0 : o[s] : (l = o == null ? void 0 : o.product_attributes) == null ? void 0 : l[s];
928
- return Ct(n) ?? e;
999
+ const s = this.store.recommendationProducts[r], o = H(t), n = Ht(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
1000
+ return Et(n) ?? e;
929
1001
  }
930
- _getGridCellHtml(t, e, r, i = "", o = "", s = "") {
931
- const n = U(t), l = D(t), a = z(pt, [n], this.store.filterList), u = {
1002
+ _getGridCellHtml(t, e, r, i = "", s = "", o = "") {
1003
+ const n = M(t), l = H(t), a = J(yt, [n], this.store.filterList), d = {
932
1004
  [l]: e,
933
1005
  product_attributes: { [l]: e }
934
1006
  };
935
- let c = a[n](u);
936
- return c = c.replace("<td", `<td width="${r}%"`), s && (c = c.replace(
937
- `padding: ${gt}`,
938
- `padding: ${s}`
939
- )), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), o && (c = c.replace(/border="0"/, `border="0" bgcolor="${o}"`)), c;
1007
+ let c = a[n](d);
1008
+ return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
1009
+ `padding: ${Tt}`,
1010
+ `padding: ${o}`
1011
+ )), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
940
1012
  }
941
1013
  _getListRowHtml(t, e, r) {
942
- const i = D(t), o = z(bt, [r], this.store.filterList), s = {
1014
+ const i = H(t), s = J(St, [r], this.store.filterList), o = {
943
1015
  [i]: e,
944
1016
  product_attributes: { [i]: e }
945
- }, l = o[r](s).replace(/<tr>/, "").replace(/<\/tr>/, "");
946
- return `<tr class="recommendation-attribute-row" ${R}="${r}" ${O}="1">${l}</tr>`;
1017
+ }, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
1018
+ return `<tr class="${G}" ${E}="${r}" ${D}="1">${l}</tr>`;
947
1019
  }
948
1020
  }
949
1021
  export {
950
- Dt as COMPOSITION_CONTROL_BLOCK_ID,
951
- Gt as RecommendationCardCompositionControl
1022
+ Ut as COMPOSITION_CONTROL_BLOCK_ID,
1023
+ se as RecommendationCardCompositionControl
952
1024
  };