@useinsider/guido 3.24.0-beta.89982ef → 3.24.0-beta.9312ed2

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 (123) hide show
  1. package/README.md +2 -1
  2. package/dist/@types/config/schemas.js +49 -47
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +81 -85
  5. package/dist/composables/useActionsApi.js +2 -2
  6. package/dist/composables/useBlocksConfig.js +20 -31
  7. package/dist/composables/useEditorTrackingIds.js +49 -0
  8. package/dist/composables/useModuleRepair.js +14 -12
  9. package/dist/composables/useSave.js +57 -52
  10. package/dist/composables/useSaveValidation.js +118 -110
  11. package/dist/composables/useTranslations.js +1 -2
  12. package/dist/composables/validators/useUnsubscribeBlockValidator.js +48 -33
  13. package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
  14. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
  15. package/dist/config/migrator/index.js +16 -15
  16. package/dist/config/migrator/itemsPriceFormatMigrator.js +20 -0
  17. package/dist/enums/academy.js +0 -1
  18. package/dist/enums/save-validation.js +1 -1
  19. package/dist/extensions/Blocks/Items/block.js +115 -77
  20. package/dist/extensions/Blocks/Items/constants/currency.js +59 -14
  21. package/dist/extensions/Blocks/Items/controls/blockBackground/index.js +11 -0
  22. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +34 -23
  23. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +62 -51
  24. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +18 -17
  25. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -31
  26. package/dist/extensions/Blocks/Items/controls/priceFormat.js +135 -0
  27. package/dist/extensions/Blocks/Items/controls/settingsControl.js +141 -120
  28. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  29. package/dist/extensions/Blocks/Items/extension.js +15 -13
  30. package/dist/extensions/Blocks/Items/items.css.js +19 -0
  31. package/dist/extensions/Blocks/Items/settingsPanel.js +35 -25
  32. package/dist/extensions/Blocks/Items/template.js +250 -212
  33. package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +185 -0
  34. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -8
  35. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -24
  36. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +23 -22
  37. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +1 -0
  38. package/dist/extensions/Blocks/controlFactories.js +104 -104
  39. package/dist/guido.css +1 -1
  40. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  41. package/dist/node_modules/valibot/dist/index.js +261 -297
  42. package/dist/package.json.js +1 -1
  43. package/dist/services/templateLibraryApi.js +39 -36
  44. package/dist/src/@types/config/schemas.d.ts +8 -4
  45. package/dist/src/composables/useConfig.d.ts +4 -2
  46. package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
  47. package/dist/src/composables/useSaveValidation.d.ts +1 -1
  48. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +4 -0
  49. package/dist/src/config/migrator/index.d.ts +4 -1
  50. package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +1 -0
  51. package/dist/src/enums/academy.d.ts +0 -1
  52. package/dist/src/enums/save-validation.d.ts +2 -1
  53. package/dist/src/extensions/Blocks/Items/block.d.ts +6 -9
  54. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +32 -0
  55. package/dist/src/extensions/Blocks/Items/controls/blockBackground/index.d.ts +15 -0
  56. package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +24 -0
  57. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +1 -0
  58. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +2 -0
  59. package/dist/src/extensions/Blocks/Items/template.d.ts +4 -1
  60. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +3 -0
  61. package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +66 -0
  62. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  63. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +12 -0
  64. package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -1
  65. package/dist/src/stores/config.d.ts +40 -167
  66. package/dist/src/utils/itemsCurrencyRepair.d.ts +5 -1
  67. package/dist/src/utils/linkTrackingIds.d.ts +24 -22
  68. package/dist/static/styles/variables.css.js +0 -1
  69. package/dist/stores/config.js +6 -13
  70. package/dist/utils/itemsCurrencyRepair.js +29 -24
  71. package/dist/utils/linkTrackingIds.js +72 -72
  72. package/dist/utils/pairProductVariables.js +119 -100
  73. package/dist/utils/templatePreparation.js +59 -72
  74. package/package.json +1 -1
  75. package/dist/@types/display-condition.js +0 -25
  76. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -17
  77. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
  78. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  79. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
  80. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +0 -17
  81. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +0 -45
  82. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -36
  83. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
  84. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  85. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  86. package/dist/composables/useDisplayConditions.js +0 -117
  87. package/dist/enums/display-condition.js +0 -12
  88. package/dist/extensions/DisplayConditions/bridge.js +0 -25
  89. package/dist/extensions/DisplayConditions/constants.js +0 -26
  90. package/dist/extensions/DisplayConditions/control.js +0 -215
  91. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -226
  92. package/dist/extensions/DisplayConditions/extension.js +0 -28
  93. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  94. package/dist/extensions/DisplayConditions/library.js +0 -30
  95. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  96. package/dist/extensions/LinkTracking/extension.js +0 -17
  97. package/dist/extensions/LinkTracking/writer.js +0 -41
  98. package/dist/services/displayConditionApi.js +0 -39
  99. package/dist/src/@types/display-condition.d.ts +0 -61
  100. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  101. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  102. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +0 -18
  103. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  104. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  105. package/dist/src/composables/useDisplayConditions.d.ts +0 -18
  106. package/dist/src/enums/display-condition.d.ts +0 -15
  107. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
  108. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -23
  109. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
  110. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  111. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  112. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  113. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  114. package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
  115. package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
  116. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  117. package/dist/src/services/displayConditionApi.d.ts +0 -8
  118. package/dist/src/stores/display-condition.d.ts +0 -86
  119. package/dist/src/utils/displayCondition.d.ts +0 -11
  120. package/dist/src/utils/protectTableText.d.ts +0 -2
  121. package/dist/stores/display-condition.js +0 -29
  122. package/dist/utils/displayCondition.js +0 -29
  123. package/dist/utils/protectTableText.js +0 -22
@@ -1,14 +1,13 @@
1
1
  import { useConfig as C } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as O } from "../../../composables/useRecommendation.js";
3
- import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as T } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useRecommendationExtensionStore as B } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { protectTableText as N, restoreTableText as L } from "../../../utils/protectTableText.js";
6
- import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
7
- function R(t, r, e, o, c = "") {
3
+ import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as B } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useRecommendationExtensionStore as N } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { isIgnoredRecommendationBlock as T } from "./recommendationIgnoreUtils.js";
6
+ function L(t, r, e, o, c = "") {
8
7
  const i = `{{${c}${t}_${r}_${e}}}`, n = `{{${c}${t}_${r}_currency}}`;
9
8
  return o === "before" ? `${n} ${i}` : `${i} ${n}`;
10
9
  }
11
- function b(t) {
10
+ function A(t) {
12
11
  let r = t;
13
12
  for (; r.children.length === 1; )
14
13
  [r] = r.children;
@@ -20,12 +19,12 @@ function _(t, r, e, o, c, i) {
20
19
  const n = t.querySelector("img");
21
20
  n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
22
21
  const s = t.querySelector("a");
23
- s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(T));
22
+ s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(B));
24
23
  break;
25
24
  }
26
25
  case "productName": {
27
26
  const n = t.querySelector("p");
28
- n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
27
+ n && (A(n).textContent = `{{${i}${e}_${o}_name}}`);
29
28
  break;
30
29
  }
31
30
  // Inline mode ("Move to next line" OFF) merges BOTH prices into one row
@@ -33,16 +32,16 @@ function _(t, r, e, o, c, i) {
33
32
  // substitute by cell content, not by the row's anchor (SD-145161).
34
33
  case "productPrice":
35
34
  case "productOldPrice": {
36
- const n = (l, d) => {
37
- l && (b(l).textContent = R(
35
+ const n = (a, l) => {
36
+ a && (A(a).textContent = L(
38
37
  e,
39
38
  o,
40
- d,
39
+ l,
41
40
  c,
42
41
  i
43
42
  ));
44
- }, s = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !s && !a ? t.querySelector("p") : null;
45
- n(s ?? (r === "productPrice" ? u : null), "price"), n(a ?? (r === "productOldPrice" ? u : null), "original_price");
43
+ }, s = t.querySelector(".product-price p"), d = t.querySelector(".product-old-price p"), u = !s && !d ? t.querySelector("p") : null;
44
+ n(s ?? (r === "productPrice" ? u : null), "price"), n(d ?? (r === "productOldPrice" ? u : null), "original_price");
46
45
  break;
47
46
  }
48
47
  case "productButton": {
@@ -71,72 +70,72 @@ function _(t, r, e, o, c, i) {
71
70
  default: {
72
71
  const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
73
72
  if (n) {
74
- const s = n.getAttribute("product-attr"), a = n.querySelector("p");
75
- a && (b(a).textContent = `{{${i}${e}_${o}_${s}}}`);
73
+ const s = n.getAttribute("product-attr"), d = n.querySelector("p");
74
+ d && (A(d).textContent = `{{${i}${e}_${o}_${s}}}`);
76
75
  }
77
76
  break;
78
77
  }
79
78
  }
80
79
  }
81
- const w = "name";
80
+ const P = "name";
82
81
  function y(t, r, e, o) {
83
- const c = `${o}${r}_${e}_${w}`;
82
+ const c = `${o}${r}_${e}_${P}`;
84
83
  return {
85
84
  open: t.createComment(`{% if ${c} and ${c} != "" %}`),
86
85
  close: t.createComment("{% endif %}")
87
86
  };
88
87
  }
89
- function D(t, r, e) {
88
+ function R(t, r, e) {
90
89
  return y(t, r, 0, e);
91
90
  }
92
- function v(t, r, e, o) {
91
+ function w(t, r, e, o) {
93
92
  if (!t.innerHTML.includes("{{"))
94
93
  return;
95
94
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
96
95
  t.insertBefore(c, t.firstChild), t.appendChild(i);
97
96
  }
98
- function W(t, r, e, o) {
97
+ function D(t, r, e, o) {
99
98
  var n, s;
100
99
  if (!t.innerHTML.includes("{{"))
101
100
  return;
102
101
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
103
102
  (n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
104
103
  }
105
- function H(t, r, e, o) {
104
+ function v(t, r, e, o) {
106
105
  t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
107
- i.querySelectorAll("[data-attribute-type]").forEach((a) => {
108
- const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
109
- l.length > 0 ? l.forEach((d) => {
110
- _(d, u, r, n, e, o);
111
- }) : _(a, u, r, n, e, o);
112
- }), W(i, r, n, o);
106
+ i.querySelectorAll("[data-attribute-type]").forEach((d) => {
107
+ const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
108
+ a.length > 0 ? a.forEach((l) => {
109
+ _(l, u, r, n, e, o);
110
+ }) : _(d, u, r, n, e, o);
111
+ }), D(i, r, n, o);
113
112
  });
114
113
  }
115
- function x(t, r, e, o) {
114
+ function H(t, r, e, o) {
116
115
  const c = t.querySelectorAll(".recommendation-product-row");
117
116
  if (!c.length)
118
117
  return;
119
118
  const [i] = c, n = i.querySelector("[data-attribute-type]"), s = n ? n.querySelectorAll(".attribute-cell").length : 1;
120
- c.forEach((a, u) => {
121
- a.querySelectorAll("[data-attribute-type]").forEach((d) => {
122
- const p = d.getAttribute("data-attribute-type") || "";
123
- d.querySelectorAll(".attribute-cell").forEach((m, h) => {
119
+ c.forEach((d, u) => {
120
+ d.querySelectorAll("[data-attribute-type]").forEach((l) => {
121
+ const p = l.getAttribute("data-attribute-type") || "";
122
+ l.querySelectorAll(".attribute-cell").forEach((m, h) => {
124
123
  const S = u * s + h;
125
- _(m, p, r, S, e, o), v(m, r, S, o);
124
+ _(m, p, r, S, e, o), w(m, r, S, o);
126
125
  });
127
126
  });
128
127
  });
129
128
  }
130
- function F(t, r, e, o) {
129
+ function W(t, r, e, o) {
131
130
  t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
132
- x(i, r, e, o);
131
+ H(i, r, e, o);
133
132
  });
134
133
  }
135
- function G(t, r, e) {
134
+ function F(t, r, e) {
136
135
  const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
137
- o === "list" ? H(t, r, i, e) : F(t, r, i, e);
136
+ o === "list" ? v(t, r, i, e) : W(t, r, i, e);
138
137
  }
139
- function A(t, r, e) {
138
+ function b(t, r, e) {
140
139
  const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
141
140
  return c ? parseInt(c[1]) : e;
142
141
  }
@@ -151,7 +150,7 @@ function g(t) {
151
150
  const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
152
151
  return e && $(e[1]) ? e[1] : null;
153
152
  }
154
- function V(t, r) {
153
+ function x(t, r) {
155
154
  let e = t.parentElement;
156
155
  for (; e && e !== r; ) {
157
156
  if (e.tagName === "TD" && g(e))
@@ -160,64 +159,62 @@ function V(t, r) {
160
159
  }
161
160
  return null;
162
161
  }
163
- function U(t) {
164
- const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, c = Math.max(0, e - o);
162
+ function G(t) {
163
+ const r = t.getAttribute("style") || "", e = b(r, "width", 600), o = b(r, "padding", 0) * 2, c = Math.max(0, e - o);
165
164
  c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
166
165
  if (i.hasAttribute("width"))
167
166
  return;
168
- const n = V(i, t);
167
+ const n = x(i, t);
169
168
  if (!n)
170
169
  return;
171
- const s = g(n), a = A(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), l = Math.max(1, u - a), d = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(d);
170
+ const s = g(n), d = b(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
172
171
  if (p) {
173
- i.setAttribute("width", String(Math.max(1, Math.min(l, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
172
+ i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
174
173
  return;
175
174
  }
176
- if (i.setAttribute("width", String(l)), !/\bwidth\s*:\s*\d/i.test(d)) {
177
- const f = d && !d.trim().endsWith(";") ? "; " : "";
178
- i.setAttribute("style", `${d}${f}width: ${l}px`);
175
+ if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
176
+ const f = l && !l.trim().endsWith(";") ? "; " : "";
177
+ i.setAttribute("style", `${l}${f}width: ${a}px`);
179
178
  }
180
179
  });
181
180
  }
182
- const E = "MSO_MOBILE_HIDE_START", X = "MSO_MOBILE_HIDE_END";
183
- function j(t, r) {
181
+ const E = "MSO_MOBILE_HIDE_START", V = "MSO_MOBILE_HIDE_END";
182
+ function U(t, r) {
184
183
  t.querySelectorAll(q).forEach((e) => {
185
184
  var i, n;
186
185
  const o = e.querySelector(M);
187
186
  if (!o || o.children.length === 0)
188
187
  return;
189
188
  const c = e.previousSibling;
190
- (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(X), e.nextSibling));
189
+ (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(V), e.nextSibling));
191
190
  });
192
191
  }
193
- function Y(t, r) {
192
+ function X(t, r) {
194
193
  const e = t.match(/<!DOCTYPE[^>]*>/i);
195
194
  return (e ? `${e[0]}
196
195
  ` : "") + r.documentElement.outerHTML;
197
196
  }
198
- function I(t) {
199
- const r = N(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
197
+ function Q(t) {
198
+ const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
200
199
  if (!o.length)
201
200
  return t;
202
- const { buildCampaignUrl: c } = O(), i = B();
201
+ const { buildCampaignUrl: c } = O(), i = N();
203
202
  i.recommendationCampaignUrls = {};
204
203
  const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
205
- o.forEach((u) => {
206
- var d, p, f, m;
207
- const l = u.getAttribute("recommendation-id");
208
- if (l) {
209
- if ((d = u.parentNode) == null || d.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(l), j(u, e), !P(u)) {
210
- G(u, l, s);
211
- const { open: h, close: S } = D(e, l, s);
204
+ return o.forEach((u) => {
205
+ var l, p, f, m;
206
+ const a = u.getAttribute("recommendation-id");
207
+ if (a) {
208
+ if ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(a), U(u, e), !T(u)) {
209
+ F(u, a, s);
210
+ const { open: h, close: S } = R(e, a, s);
212
211
  (f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
213
212
  }
214
- U(u);
213
+ G(u);
215
214
  }
216
- });
217
- const a = Y(r, e);
218
- return L(a.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
215
+ }), X(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
219
216
  }
220
217
  export {
221
- R as formatPriceVariable,
222
- I as prepareRecommendationBlocks
218
+ L as formatPriceVariable,
219
+ Q as prepareRecommendationBlocks
223
220
  };
@@ -1,18 +1,19 @@
1
- import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
- import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
- import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
6
- import { migrateRadioButton as g } from "./radioButtonMigrator.js";
7
- import { migrateRecommendation as p } from "./recommendationMigrator.js";
8
- import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
9
- import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
10
- import { migrateSocialIcons as s } from "./socialIconMigrator.js";
11
- import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
12
- const h = async (o, t = {}, r) => {
13
- let m = o;
14
- return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
1
+ import { migrateCheckbox as e } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
3
+ import { migrateFullStoryScripts as c } from "./fullStoryScriptMigrator.js";
4
+ import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
5
+ import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
6
+ import { migrateProductNameLink as p } from "./productNameLinkMigrator.js";
7
+ import { migrateRadioButton as f } from "./radioButtonMigrator.js";
8
+ import { migrateRecommendation as l } from "./recommendationMigrator.js";
9
+ import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
10
+ import { migrateRecommendationTitle as s } from "./recommendationTitleMigrator.js";
11
+ import { migrateSocialIcons as k } from "./socialIconMigrator.js";
12
+ import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
13
+ const H = async (t, i = {}, r, o) => {
14
+ let m = t;
15
+ return m = e(m), m = f(m), m = await P(m), m = a(m), m = l(m, i), r && (m = d(m, r)), m = s(m), m = g(m), o != null && o.itemsPriceFormatting && (m = n(m)), m = p(m), m = k(m), m = c(m), m;
15
16
  };
16
17
  export {
17
- h as migrate
18
+ H as migrate
18
19
  };
@@ -0,0 +1,20 @@
1
+ import { ITEMS_PRICE_FORMAT_ATTR as e } from "../../extensions/Blocks/Items/constants/currency.js";
2
+ import { applyPriceFormatOpsToElement as o, planPriceFormatOps as n, snapshotPriceFormatFromElement as c } from "../../extensions/Blocks/Items/utils/priceFormatOps.js";
3
+ import { protectLiquid as i, restoreLiquid as s } from "../../utils/liquidProtection.js";
4
+ const m = `td.ins-product-td.items-block-v2:not([${e.DECIMAL_COUNT}])`, a = (r) => o(
5
+ r,
6
+ n(c(r), { convertLegacy: !0 })
7
+ );
8
+ function T(r) {
9
+ if (typeof r != "string" || !r.includes("ins-product-td"))
10
+ return r;
11
+ try {
12
+ const t = new DOMParser().parseFromString(i(r), "text/html");
13
+ return Array.from(t.querySelectorAll(m)).map(a).includes(!0) ? s(t.documentElement.outerHTML) : r;
14
+ } catch (t) {
15
+ return console.error("ItemsPriceFormatMigrator failed:", t), r;
16
+ }
17
+ }
18
+ export {
19
+ T as migrateItemsPriceFormat
20
+ };
@@ -2,7 +2,6 @@ const e = "https://academy.insiderone.com", o = {
2
2
  EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
- EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
6
5
  EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
7
6
  };
8
7
  export {
@@ -1,4 +1,4 @@
1
- var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
1
+ var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s.ExternallyManagedUnsubscribe = "externally-managed-unsubscribe", s))(n || {});
2
2
  export {
3
3
  n as SaveValidationRule
4
4
  };
@@ -1,33 +1,42 @@
1
1
  var k = Object.defineProperty;
2
- var S = (d, l, t) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
- var g = (d, l, t) => S(d, typeof l != "symbol" ? l + "" : l, t);
4
- import { BlockId as D } from "../../../enums/block.js";
5
- import { useOnboardingStore as T } from "../../../stores/onboarding.js";
6
- import { getMigrationBannerHtml as N } from "../../../utils/migrationBannerHtml.js";
7
- import { Block as H, BlockCompositionType as R, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { PRODUCT_WRAPPER_SELECTOR as M, isZeroWidthValue as m } from "./constants/cardWidth.js";
9
- import { currencyAttrTargets as w, ITEMS_CURRENCY_ATTR as y } from "./constants/currency.js";
10
- import { ItemsBlockId as E } from "./enums/controlEnums.js";
11
- import { SETTINGS_ENUMS as b, DefaultConfigValues as p } from "./enums/settingsEnums.js";
12
- import { getDefaultTemplate as O } from "./template.js";
13
- import { getItemsBlockContainer as _, getItemsBlockConfig as C, deriveItemNumber as B, generateBlockInstanceId as P, getDefaultItemsBlockConfig as v } from "./utils/nodeConfigUtils.js";
14
- const A = D.Items, V = "Reconcile Items currency DOM attributes";
15
- class $ extends H {
2
+ var E = (h, d, t) => d in h ? k(h, d, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[d] = t;
3
+ var C = (h, d, t) => E(h, typeof d != "symbol" ? d + "" : d, t);
4
+ import { useConfig as P } from "../../../composables/useConfig.js";
5
+ import { BlockId as H } from "../../../enums/block.js";
6
+ import { useOnboardingStore as N } from "../../../stores/onboarding.js";
7
+ import { getMigrationBannerHtml as R } from "../../../utils/migrationBannerHtml.js";
8
+ import { Block as M, BlockCompositionType as O, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
+ import { PRODUCT_WRAPPER_SELECTOR as w, isZeroWidthValue as g } from "./constants/cardWidth.js";
10
+ import { DEFAULT_ITEMS_PRICE_FORMAT as I, isNewPriceFormatRoot as v, currencyAttrTargets as B, ITEMS_CURRENCY_ATTR as y } from "./constants/currency.js";
11
+ import { ItemsBlockId as A } from "./enums/controlEnums.js";
12
+ import { SETTINGS_ENUMS as S, DefaultConfigValues as b } from "./enums/settingsEnums.js";
13
+ import { getDefaultTemplate as F } from "./template.js";
14
+ import { getItemsBlockContainer as T, getItemsBlockConfig as _, deriveItemNumber as L, generateBlockInstanceId as x, getDefaultItemsBlockConfig as V } from "./utils/nodeConfigUtils.js";
15
+ import { buildPriceFormatSnapshot as W, planPriceFormatOps as z, samePriceText as U, replacePriceText as Y, paragraphKindOf as j } from "./utils/priceFormatOps.js";
16
+ const D = H.Items, q = "Reconcile Items currency DOM attributes";
17
+ function K() {
18
+ return {
19
+ priceThousandSeparator: I.thousandSeparator,
20
+ priceDecimalSeparator: I.decimalSeparator,
21
+ priceDecimalCount: I.decimalCount
22
+ };
23
+ }
24
+ class at extends M {
16
25
  constructor() {
17
26
  super(...arguments);
18
27
  /** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
19
- g(this, "_currencyHealed", /* @__PURE__ */ new Set());
28
+ C(this, "_currencyHealed", /* @__PURE__ */ new Set());
20
29
  /** blockInstanceIds already claimed by a live block this session (SD-147588 collision detection). */
21
- g(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
30
+ C(this, "_seenInstanceIds", /* @__PURE__ */ new Set());
22
31
  }
23
32
  getId() {
24
- return A;
33
+ return D;
25
34
  }
26
35
  getIcon() {
27
36
  return "items-icon";
28
37
  }
29
38
  getBlockCompositionType() {
30
- return R.CONTAINER;
39
+ return O.CONTAINER;
31
40
  }
32
41
  getName() {
33
42
  return this.api.translate("Items");
@@ -36,20 +45,21 @@ class $ extends H {
36
45
  return this.api.translate("Items lets you display personalized products based on user behavior.");
37
46
  }
38
47
  getSettingsPanelTitleHtml() {
39
- return N(
40
- A,
48
+ return R(
49
+ D,
41
50
  this.api.translate("Items"),
42
51
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
43
52
  );
44
53
  }
45
54
  getTemplate() {
46
- return O({
47
- orientation: b.ORIENTATION.VERTICAL,
48
- itemsType: b.ITEMS_TYPE.CART_ITEMS,
55
+ return F({
56
+ orientation: S.ORIENTATION.VERTICAL,
57
+ itemsType: S.ITEMS_TYPE.CART_ITEMS,
49
58
  itemId: "{{Abandoned Cart Item (1) Url}}",
50
- currencySymbol: p.productPriceCurrencySymbolControlValue,
51
- currencyLocation: p.productPriceCurrencyLocationControlValue,
52
- formattedPrice: p.productPriceFormattedControlValue === "1"
59
+ currencySymbol: b.productPriceCurrencySymbolControlValue,
60
+ currencyLocation: b.productPriceCurrencyLocationControlValue,
61
+ formattedPrice: b.productPriceFormattedControlValue === "1",
62
+ priceFormat: this._isPriceFormattingEnabled() ? I : void 0
53
63
  });
54
64
  }
55
65
  allowInnerBlocksDND() {
@@ -59,26 +69,29 @@ class $ extends H {
59
69
  return !0;
60
70
  }
61
71
  onCreated(t) {
62
- const e = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
63
- c.querySelector('[product-attr="imageSrc"] img') || e.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
64
- const r = _(t);
65
- if (!r)
72
+ const e = this.api.getDocumentModifier(), s = this.api.getDocumentRootCssNode();
73
+ s.querySelector('[product-attr="imageSrc"] img') || e.modifyCss(s).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
74
+ const o = T(t);
75
+ if (!o)
66
76
  return;
67
- const o = r.getNodeConfig(), n = o && Object.keys(o).length > 0, i = C(t);
68
- if (i != null && i.initialized) {
69
- if (!n) {
70
- const a = this.api.getDocumentModifier();
71
- a.modifyHtml(r).setNodeConfig(i), this._stampProductTdDomAttributes(r, i, a), this._healCollapsedWidths(r, a), this._shouldReconcileCurrency(i) && this._reconcileCurrencyDomAttributes(r, i, a), a.apply(new u("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(i.blockInstanceId);
77
+ const i = o.getNodeConfig(), c = i && Object.keys(i).length > 0, r = _(t);
78
+ if (r != null && r.initialized) {
79
+ if (!c) {
80
+ const l = this.api.getDocumentModifier();
81
+ l.modifyHtml(o).setNodeConfig(r), this._stampProductTdDomAttributes(o, r, l), this._healCollapsedWidths(o, l), this._shouldReconcileCurrency(r) && this._reconcileCurrencyDomAttributes(o, r, l), l.apply(new p("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(r.blockInstanceId);
72
82
  return;
73
83
  }
74
84
  } else {
75
- const a = v(), I = this.api.getDocumentModifier();
76
- I.modifyHtml(r).setNodeConfig(a), this._stampProductTdDomAttributes(r, a, I, !0), I.apply(new u("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
85
+ const l = {
86
+ ...V(),
87
+ ...this._isPriceFormattingEnabled() ? K() : {}
88
+ }, f = this.api.getDocumentModifier();
89
+ f.modifyHtml(o).setNodeConfig(l), this._stampProductTdDomAttributes(o, l, f, !0), f.apply(new p("Initialize Items block with default configuration")), N().startOnboarding("itemsOnboarding");
77
90
  return;
78
91
  }
79
- const s = this._resolveInstanceId(i.blockInstanceId), f = this.api.getDocumentModifier();
80
- let h = !1;
81
- s !== i.blockInstanceId && (f.modifyHtml(r).setNodeConfig({ ...i, blockInstanceId: s }), h = !0), !this._currencyHealed.has(s) && this._reconcileCurrencyDomAttributes(r, i, f) && (h = !0), this._healCollapsedWidths(r, f) && (h = !0), h && f.apply(new u("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(s);
92
+ const n = this._resolveInstanceId(r.blockInstanceId), a = { ...r, blockInstanceId: n }, u = this.api.getDocumentModifier();
93
+ let m = !1;
94
+ n !== r.blockInstanceId && (u.modifyHtml(o).setNodeConfig(a), m = !0), !this._currencyHealed.has(n) && this._reconcileCurrencyDomAttributes(o, a, u) && (m = !0), this._healCollapsedWidths(o, u) && (m = !0), m && u.apply(new p("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(n);
82
95
  }
83
96
  /**
84
97
  * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
@@ -87,23 +100,23 @@ class $ extends H {
87
100
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
88
101
  */
89
102
  onDocumentChanged(t) {
90
- const e = _(t);
103
+ const e = T(t);
91
104
  if (!e)
92
105
  return;
93
- const c = e.getNodeConfig();
94
- if (c && Object.keys(c).length > 0) {
95
- const i = C(t);
96
- if (i != null && i.initialized && this._shouldReconcileCurrency(i)) {
97
- const s = this.api.getDocumentModifier();
98
- this._reconcileCurrencyDomAttributes(e, i, s) && s.apply(new u(V)), this._markCurrencyHealed(i.blockInstanceId);
106
+ const s = e.getNodeConfig();
107
+ if (s && Object.keys(s).length > 0) {
108
+ const r = _(t);
109
+ if (r != null && r.initialized && this._shouldReconcileCurrency(r)) {
110
+ const n = this.api.getDocumentModifier();
111
+ this._reconcileCurrencyDomAttributes(e, r, n) && n.apply(new p(q)), this._markCurrencyHealed(r.blockInstanceId);
99
112
  }
100
113
  return;
101
114
  }
102
- const o = C(t);
103
- if (!(o != null && o.initialized))
115
+ const i = _(t);
116
+ if (!(i != null && i.initialized))
104
117
  return;
105
- const n = this.api.getDocumentModifier();
106
- n.modifyHtml(e).setNodeConfig(o), this._stampProductTdDomAttributes(e, o, n), this._healCollapsedWidths(e, n), this._shouldReconcileCurrency(o) && this._reconcileCurrencyDomAttributes(e, o, n), n.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(o.blockInstanceId);
118
+ const c = this.api.getDocumentModifier();
119
+ c.modifyHtml(e).setNodeConfig(i), this._stampProductTdDomAttributes(e, i, c), this._healCollapsedWidths(e, c), this._shouldReconcileCurrency(i) && this._reconcileCurrencyDomAttributes(e, i, c), c.apply(new p("Recover Items block config from saved module")), this._markCurrencyHealed(i.blockInstanceId);
107
120
  }
108
121
  /**
109
122
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -113,21 +126,21 @@ class $ extends H {
113
126
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
114
127
  * relies on this td-level fallback in pairProductVariables.
115
128
  */
116
- _stampProductTdDomAttributes(t, e, c, r = !1) {
117
- const o = B(e.itemsSelectValue, e.type), n = (i, s) => {
118
- r && t.getAttribute(i) || c.modifyHtml(t).setAttribute(i, s);
129
+ _stampProductTdDomAttributes(t, e, s, o = !1) {
130
+ const i = L(e.itemsSelectValue, e.type), c = (r, n) => {
131
+ o && t.getAttribute(r) || s.modifyHtml(t).setAttribute(r, n);
119
132
  };
120
- n("data-type", e.type), n("data-number", o), n("data-nodup", String(e.priceHideDiscount));
133
+ c("data-type", e.type), c("data-number", i), c("data-nodup", String(e.priceHideDiscount));
121
134
  }
122
135
  /**
123
136
  * Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
124
137
  * on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
125
138
  */
126
139
  _healCollapsedWidths(t, e) {
127
- const r = t.querySelectorAll(M).filter((o) => m(o.getAttribute("width")) || m(o.getStyle("width")));
128
- return !m(t.getAttribute("width")) && !r.length ? !1 : (t.hasClass("esd-container-frame") && e.modifyHtml(t).removeClass("esd-container-frame"), t.getAttribute("width") !== null && e.modifyHtml(t).removeAttribute("width"), r.forEach((o) => {
129
- const n = o.getAttribute("width");
130
- (n === null || m(n)) && e.modifyHtml(o).setAttribute("width", "100%"), m(o.getStyle("width")) && e.modifyHtml(o).setStyle("width", "100%");
140
+ const o = t.querySelectorAll(w).filter((i) => g(i.getAttribute("width")) || g(i.getStyle("width")));
141
+ return !g(t.getAttribute("width")) && !o.length ? !1 : (t.hasClass("esd-container-frame") && e.modifyHtml(t).removeClass("esd-container-frame"), t.getAttribute("width") !== null && e.modifyHtml(t).removeAttribute("width"), o.forEach((i) => {
142
+ const c = i.getAttribute("width");
143
+ (c === null || g(c)) && e.modifyHtml(i).setAttribute("width", "100%"), g(i.getStyle("width")) && e.modifyHtml(i).setStyle("width", "100%");
131
144
  }), !0);
132
145
  }
133
146
  /**
@@ -156,30 +169,55 @@ class $ extends H {
156
169
  let e = t;
157
170
  if (!e || this._seenInstanceIds.has(e))
158
171
  do
159
- e = P();
172
+ e = x();
160
173
  while (this._seenInstanceIds.has(e));
161
174
  return this._seenInstanceIds.add(e), e;
162
175
  }
163
176
  /**
164
- * Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
165
- * attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
166
- * Config is the source of truth — never derive from visible text.
167
- *
168
- * Authority split lives in `currencyAttrTargets` (SD-147588) — position only when a location
169
- * is recorded, symbol only when customized — so this heal and the module-drop repair can't drift.
170
- *
171
- * Returns true only when an attr actually changed, so the caller can skip an empty apply that
172
- * would otherwise re-trigger onDocumentChanged and loop.
177
+ * Single self-heal slot: the flag only decides whether a legacy root is converted; a root
178
+ * already in the new format is reconciled from config regardless. Returns whether anything was queued.
173
179
  */
174
- _reconcileCurrencyDomAttributes(t, e, c) {
175
- const { position: r, symbol: o } = w(e), n = t.querySelectorAll(`.${E.PRICE} p`);
176
- let i = !1;
177
- return n.forEach((s) => {
178
- r !== void 0 && s.getAttribute(y.POSITION) !== r && (c.modifyHtml(s).setAttribute(y.POSITION, r), i = !0), o !== void 0 && s.getAttribute(y.SYMBOL) !== o && (c.modifyHtml(s).setAttribute(y.SYMBOL, o), i = !0);
179
- }), i;
180
+ _reconcileCurrencyDomAttributes(t, e, s) {
181
+ const o = this._isPriceFormattingEnabled();
182
+ if (!o && !v(t))
183
+ return this._reconcileLegacyCurrencyAttributes(t, e, s);
184
+ const i = this._priceParagraphs(t), c = W({
185
+ rootAttr: (n) => t.getAttribute(n),
186
+ config: e,
187
+ paragraphs: i.map(({ kind: n, node: a }) => ({
188
+ kind: n,
189
+ attr: (u) => a.getAttribute(u),
190
+ text: a.getInnerText()
191
+ }))
192
+ }), r = z(c, { convertLegacy: o });
193
+ return r.changed ? (Object.entries(r.rootSet).forEach(([n, a]) => {
194
+ s.modifyHtml(t).setAttribute(n, a);
195
+ }), i.forEach(({ kind: n, node: a }) => {
196
+ var l;
197
+ r.paragraphRemove.filter((f) => a.getAttribute(f) !== null).forEach((f) => s.modifyHtml(a).removeAttribute(f));
198
+ const u = (l = r.texts) == null ? void 0 : l[n], m = a.getInnerText();
199
+ u !== void 0 && !U(m, u) && s.modifyHtml(a).setInnerHtml(Y(a.getInnerHTML(), m, u));
200
+ }), r.configPatch && s.modifyHtml(t).setNodeConfig({ ...e, ...r.configPatch }), !0) : !1;
201
+ }
202
+ /** Legacy `<p>` contract via `currencyAttrTargets`: position when recorded, symbol only when custom. */
203
+ _reconcileLegacyCurrencyAttributes(t, e, s) {
204
+ const { position: o, symbol: i } = B(e), c = t.querySelectorAll(`.${A.PRICE} p`);
205
+ let r = !1;
206
+ return c.forEach((n) => {
207
+ o !== void 0 && n.getAttribute(y.POSITION) !== o && (s.modifyHtml(n).setAttribute(y.POSITION, o), r = !0), i !== void 0 && n.getAttribute(y.SYMBOL) !== i && (s.modifyHtml(n).setAttribute(y.SYMBOL, i), r = !0);
208
+ }), r;
209
+ }
210
+ _priceParagraphs(t) {
211
+ return t.querySelectorAll(`.${A.PRICE} p`).flatMap((s) => {
212
+ const o = j(s.getAttribute("product-attr"));
213
+ return o ? [{ kind: o, node: s }] : [];
214
+ });
215
+ }
216
+ _isPriceFormattingEnabled() {
217
+ return P().isFeatureEnabled("itemsPriceFormatting");
180
218
  }
181
219
  }
182
220
  export {
183
- A as BLOCK_ID,
184
- $ as ItemsBlock
221
+ D as BLOCK_ID,
222
+ at as ItemsBlock
185
223
  };