@useinsider/guido 3.17.0 → 3.18.0

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