@useinsider/guido 3.17.0-beta.db80c84 → 3.17.0-beta.e6704da

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