@useinsider/guido 3.8.1 → 3.8.2-beta.189e91c

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 (86) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
  3. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
  4. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  5. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  7. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  9. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
  10. package/dist/composables/useHtmlCompiler.js +13 -10
  11. package/dist/composables/useHtmlValidator.js +180 -133
  12. package/dist/composables/usePreviewInteractionGuard.js +17 -0
  13. package/dist/composables/usePreviewMode.js +15 -14
  14. package/dist/composables/useRecommendationPreview.js +111 -0
  15. package/dist/composables/useSave.js +14 -14
  16. package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
  17. package/dist/config/compiler/htmlCompilerRules.js +38 -10
  18. package/dist/config/compiler/recommendationCompilerRules.js +84 -109
  19. package/dist/config/compiler/utils/recommendationCompilerUtils.js +98 -89
  20. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  21. package/dist/config/migrator/recommendation/extractors.js +44 -22
  22. package/dist/config/migrator/recommendation/htmlBuilder.js +170 -163
  23. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  24. package/dist/config/migrator/recommendationMigrator.js +30 -31
  25. package/dist/extensions/Blocks/Recommendation/block.js +60 -41
  26. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  27. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  28. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -20
  29. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +359 -264
  30. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -83
  31. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +43 -31
  32. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  34. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +55 -45
  35. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +175 -166
  36. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  37. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  38. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  39. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  40. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  41. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +6 -3
  42. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
  43. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -53
  44. package/dist/extensions/Blocks/Recommendation/templates/index.js +20 -16
  45. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
  46. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
  47. package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
  48. package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
  49. package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
  50. package/dist/guido.css +1 -1
  51. package/dist/src/@types/config/schemas.d.ts +16 -0
  52. package/dist/src/composables/useConfig.d.ts +4 -0
  53. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  54. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  55. package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
  56. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  57. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
  58. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  59. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  60. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  61. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  62. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  63. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  64. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  65. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  66. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +36 -3
  67. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  68. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  69. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  73. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  74. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
  75. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  76. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  77. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
  78. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  79. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
  80. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  81. package/dist/src/stores/config.d.ts +36 -0
  82. package/dist/src/stores/unsubscribe.d.ts +11 -1
  83. package/dist/src/utils/ampErrorFilter.d.ts +1 -0
  84. package/dist/stores/unsubscribe.js +8 -7
  85. package/dist/utils/ampErrorFilter.js +6 -5
  86. package/package.json +1 -1
@@ -1,200 +1,206 @@
1
1
  import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { CURRENCY_ATTR as p, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as F, MOBILE_ROW_SELECTOR as N, ATTR_PRODUCT_ATTR as G, PRODUCT_ATTRIBUTE_PREFIX as R } from "../../constants/selectors.js";
3
+ import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as F, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as N, CONTAINER_SELECTOR as G, MOBILE_ROW_SELECTOR as w, ATTR_PRODUCT_ATTR as K, PRODUCT_ATTRIBUTE_PREFIX as T } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as S } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
6
- import { prepareProductRows as _ } from "../../templates/index.js";
7
- import { captureStyles as k } from "../../utils/captureStyleTemplates.js";
6
+ import { prepareProductRows as L } from "../../templates/index.js";
7
+ import { captureStyles as _ } from "../../utils/captureStyleTemplates.js";
8
8
  import { formatPrice as V } from "../../utils/priceFormatter.js";
9
- import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as T, sanitizeImageUrl as W, toDisplayableAttributeValue as Y } from "../../templates/utils.js";
9
+ import { getDefaultProducts as k, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as W, isSamePrice as Y, toDisplayableAttributeValue as X } from "../../templates/utils.js";
10
10
  const M = "recommendation-block-v2";
11
- function q(e) {
12
- if (!e)
11
+ function A(t) {
12
+ if (!t)
13
13
  return null;
14
- if ("getAttribute" in e) {
15
- const t = e.getAttribute("class");
16
- if (t && t.includes(M))
17
- return e;
14
+ if ("getAttribute" in t) {
15
+ const e = t.getAttribute("class");
16
+ if (e && e.includes(M))
17
+ return t;
18
18
  }
19
- return "querySelector" in e ? e.querySelector(`.${M}`) ?? null : null;
19
+ return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
20
+ }
21
+ function z(t) {
22
+ const e = A(t);
23
+ return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(F);
20
24
  }
21
- function C(e) {
22
- const t = q(e);
23
- if (!t || !("getAttribute" in t))
25
+ function C(t) {
26
+ const e = A(t);
27
+ if (!e || !("getAttribute" in e))
24
28
  return "grid";
25
- const n = t.getAttribute("data-layout");
29
+ const n = e.getAttribute("data-layout");
26
30
  return n === "list" || n === "horizontal" ? "list" : "grid";
27
31
  }
28
- function x(e) {
29
- const t = q(e);
30
- if (!t || !("getAttribute" in t))
31
- return T;
32
- const n = t.getAttribute("data-card-composition");
33
- return n ? n.split(",").filter(Boolean) : T;
32
+ function x(t) {
33
+ const e = A(t);
34
+ if (!e || !("getAttribute" in e))
35
+ return R;
36
+ const n = e.getAttribute("data-card-composition");
37
+ return n ? n.split(",").filter(Boolean) : R;
34
38
  }
35
- function D(e) {
36
- if (!e || !("childNodes" in e))
39
+ function D(t) {
40
+ if (!t || !("childNodes" in t))
37
41
  return null;
38
- const t = e.childNodes(), n = t.find(
42
+ const e = t.childNodes(), n = e.find(
39
43
  (o) => "getType" in o && o.getType() === "text"
40
44
  );
41
- return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : D(r), null);
45
+ return n || e.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : D(r), null);
42
46
  }
43
- function b(e, t, n) {
44
- const o = D(t);
45
- return o ? (e.modifyHtml(o).setText(n), !0) : !1;
47
+ function b(t, e, n) {
48
+ const o = D(e);
49
+ return o ? (t.modifyHtml(o).setText(n), !0) : !1;
46
50
  }
47
- function H(e, t) {
48
- return e && e.length > 0 ? e : t.length > 0 ? t : L();
51
+ function H(t, e) {
52
+ return t && t.length > 0 ? t : e.length > 0 ? e : k();
49
53
  }
50
- function U(e) {
51
- if (typeof e == "number")
52
- return `0 ${e / 2}px`;
54
+ function U(t) {
55
+ if (typeof t == "number")
56
+ return `0 ${t / 2}px`;
53
57
  }
54
- function K(e) {
55
- const { currentNode: t, documentModifier: n } = e;
56
- if (!t || !("querySelector" in t))
58
+ function J(t) {
59
+ const { currentNode: e, documentModifier: n } = t;
60
+ if (!e || !("querySelector" in e))
57
61
  return !1;
58
- const o = t.querySelector(N);
62
+ const o = e.querySelector(w);
59
63
  return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
60
64
  }
61
- function X(e) {
62
- return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
65
+ function Q(t) {
66
+ return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
63
67
  }
64
- function z(e) {
65
- const t = e.querySelector(".container");
66
- return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
68
+ function Z(t) {
69
+ const e = t.querySelector(".container");
70
+ return !e || !("childNodes" in e) ? null : e.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
67
71
  }
68
- function J(e, t, n) {
69
- const o = z(e);
72
+ function ee(t, e, n) {
73
+ const o = Z(t);
70
74
  if (!o || !("childNodes" in o))
71
75
  return;
72
- const r = o.childNodes().map(X).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
73
- t.modifyHtml(o).setInnerHtml(r + s), t.apply(new g("Added mobile product row"));
76
+ const r = o.childNodes().map(Q).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
77
+ e.modifyHtml(o).setInnerHtml(r + s), e.apply(new g("Added mobile product row"));
74
78
  }
75
- function $(e, t = {}) {
79
+ function $(t, e = {}) {
76
80
  const {
77
81
  currentNode: n,
78
82
  documentModifier: o,
79
83
  products: r,
80
84
  layout: s,
81
85
  composition: i
82
- } = e;
86
+ } = t;
83
87
  if (!n || !("querySelector" in n))
84
88
  return !1;
85
89
  const u = s ?? C(n), c = S.getConfig(n);
86
90
  if (u === "list" || !c.mobileLayoutEnabled)
87
- return K({ currentNode: n, documentModifier: o });
88
- const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), y = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(a, u, {
91
+ return J({ currentNode: n, documentModifier: o });
92
+ const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${L(a, u, {
89
93
  productsPerRow: c.mobileCardsInRow,
90
94
  composition: d,
91
95
  filterList: l.filterList,
92
- // One product per row has no gutter — suppress padding without clobbering the stored value.
93
- cellPadding: c.mobileCardsInRow === 1 ? "0" : U(c.mobileColumnSpacing),
96
+ priceInline: !c.priceMovedToNextLine,
97
+ // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
98
+ cellPadding: U(c.mobileColumnSpacing),
94
99
  rowSpacingPx: c.mobileRowSpacing,
95
- ...t
96
- })}</table></td>`, E = n.querySelector(N);
97
- return E ? (o.modifyHtml(E).setInnerHtml(y), !0) : (J(n, o, y), !1);
100
+ ...e
101
+ })}</table></td>`, E = n.querySelector(w);
102
+ return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (ee(n, o, p), !1);
98
103
  }
99
- function fe(e) {
100
- $(e, k(e.currentNode)) && e.documentModifier.apply(new g("Updated mobile product rows"));
104
+ function ye(t) {
105
+ $(t, _(t.currentNode)) && t.documentModifier.apply(new g("Updated mobile product rows"));
101
106
  }
102
- function Q(e, t = {}) {
107
+ function te(t, e = {}) {
103
108
  const {
104
109
  currentNode: n,
105
110
  documentModifier: o,
106
111
  products: r,
107
112
  layout: s,
108
113
  composition: i
109
- } = e;
114
+ } = t;
110
115
  if (!n || !("querySelector" in n))
111
116
  return !1;
112
- const u = n.querySelector(w) ?? n.querySelector(F);
117
+ const u = n.querySelector(N) ?? n.querySelector(G);
113
118
  if (!u)
114
119
  return !1;
115
- const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), y = S.getConfig(n), E = _(l, f, {
120
+ const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), p = S.getConfig(n), E = L(l, f, {
116
121
  productsPerRow: a,
117
122
  composition: d,
118
123
  filterList: c.filterList,
119
- // One product per row has no gutter — suppress padding without clobbering the stored value.
120
- cellPadding: a === 1 ? "0" : U(y.columnSpacing),
121
- rowSpacingPx: y.rowSpacing,
122
- ...t
124
+ priceInline: !p.priceMovedToNextLine,
125
+ // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
126
+ cellPadding: U(p.columnSpacing),
127
+ rowSpacingPx: p.rowSpacing,
128
+ ...e
123
129
  });
124
130
  return o.modifyHtml(u).setInnerHtml(E), !0;
125
131
  }
126
- function me(e) {
132
+ function be(t) {
127
133
  const {
128
- currentNode: t,
134
+ currentNode: e,
129
135
  documentModifier: n,
130
136
  afterRegenerate: o,
131
137
  products: r,
132
138
  layout: s,
133
139
  composition: i,
134
140
  skipStylePreservation: u
135
- } = e;
136
- if (!t)
141
+ } = t;
142
+ if (!e)
137
143
  return;
138
- const c = u ? {} : k(t), l = {
139
- currentNode: t,
144
+ const c = u ? {} : _(e), l = {
145
+ currentNode: e,
140
146
  documentModifier: n,
141
147
  products: r,
142
148
  layout: s,
143
149
  composition: i
144
150
  };
145
- let a = Q(l, c);
151
+ let a = te(l, c);
146
152
  a = $(l, c) || a, a && n.apply(new g("Regenerate products with styles")), o == null || o();
147
153
  }
148
- function ye(e, t) {
149
- return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...L(t - e.length)];
154
+ function ge(t, e) {
155
+ return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...k(e - t.length)];
150
156
  }
151
157
  function B() {
152
- const e = P(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
158
+ const t = P(), { currencySettings: e } = t.recommendationConfigs, n = parseInt(e.decimalCount);
153
159
  return {
154
- code: t.value,
155
- symbol: t.symbol,
156
- alignment: t.alignment === "0" ? "before" : "after",
160
+ code: e.value,
161
+ symbol: e.symbol,
162
+ alignment: e.alignment === "0" ? "before" : "after",
157
163
  decimalCount: Number.isNaN(n) ? 2 : n,
158
- decimalSeparator: t.decimalSeparator,
159
- thousandSeparator: t.thousandSeparator
164
+ decimalSeparator: e.decimalSeparator,
165
+ thousandSeparator: e.thousandSeparator
160
166
  };
161
167
  }
162
- function A(e, t = "price") {
163
- const n = B(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
168
+ function q(t, e = "price") {
169
+ const n = B(), o = t[e], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
164
170
  return V({
165
171
  price: r,
166
172
  currency: n
167
173
  });
168
174
  }
169
- function Z(e) {
175
+ function ne(t) {
170
176
  var s, i;
171
- const t = B(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((i = e.price) == null ? void 0 : i[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
177
+ const e = B(), n = ((s = t.original_price) == null ? void 0 : s[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, o = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
172
178
  return r > 0 ? `-${r}%` : "0%";
173
179
  }
174
- function v(e) {
175
- const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = e;
180
+ function v(t) {
181
+ const { documentModifier: e, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = t;
176
182
  let u = !1;
177
183
  if (o && "querySelector" in o) {
178
- const c = o.querySelector("strong") ?? o.querySelector("p"), l = A(n, "price");
179
- b(t, c ?? null, l) && (u = !0);
184
+ const c = o.querySelector("strong") ?? o.querySelector("p"), l = q(n, "price");
185
+ b(e, c ?? null, l) && (u = !0);
180
186
  }
181
187
  if (r && "querySelector" in r) {
182
- const c = r.querySelector("strong") ?? r.querySelector("p"), l = A(n, "original_price");
183
- b(t, c ?? null, l) && (u = !0);
188
+ const c = r.querySelector("strong") ?? r.querySelector("p"), l = q(n, "original_price");
189
+ b(e, c ?? null, l) && (u = !0), e.modifyHtml(r).setAttribute("data-same-price", String(Y(n))), u = !0;
184
190
  }
185
191
  if (s && "querySelector" in s) {
186
- const c = s.querySelector(".omnibus-price-value") ?? null, l = A(n, "original_price");
187
- b(t, c, l) && (u = !0);
192
+ const c = s.querySelector(".omnibus-price-value") ?? null, l = q(n, "original_price");
193
+ b(e, c, l) && (u = !0);
188
194
  }
189
195
  if (i && "querySelector" in i) {
190
- const c = i.querySelector(".omnibus-discount-value") ?? null, l = Z(n);
191
- b(t, c, l) && (u = !0);
196
+ const c = i.querySelector(".omnibus-discount-value") ?? null, l = ne(n);
197
+ b(e, c, l) && (u = !0);
192
198
  }
193
199
  return u;
194
200
  }
195
- function ee(e) {
201
+ function oe(t) {
196
202
  const {
197
- documentModifier: t,
203
+ documentModifier: e,
198
204
  product: n,
199
205
  imageEl: o,
200
206
  nameEl: r,
@@ -203,20 +209,20 @@ function ee(e) {
203
209
  omnibusPriceEl: u,
204
210
  omnibusDiscountEl: c,
205
211
  buttonEl: l
206
- } = e;
212
+ } = t;
207
213
  let a = !1;
208
214
  if (o && "querySelector" in o) {
209
215
  const d = o.querySelector("img");
210
- d && (t.modifyHtml(d).setAttribute("src", W(n.image_url)).setAttribute("alt", n.name), a = !0);
216
+ d && (e.modifyHtml(d).setAttribute("src", W(n.image_url)).setAttribute("alt", n.name), a = !0);
211
217
  const f = o.querySelector("a");
212
- f && (t.modifyHtml(f).setAttribute("href", n.url), a = !0);
218
+ f && (e.modifyHtml(f).setAttribute("href", n.url), a = !0);
213
219
  }
214
220
  if (r && "querySelector" in r) {
215
221
  const d = r.querySelector("strong") ?? r.querySelector("p");
216
- b(t, d ?? null, n.name) && (a = !0);
222
+ b(e, d ?? null, n.name) && (a = !0);
217
223
  }
218
224
  if (v({
219
- documentModifier: t,
225
+ documentModifier: e,
220
226
  product: n,
221
227
  priceEl: s,
222
228
  oldPriceEl: i,
@@ -224,27 +230,27 @@ function ee(e) {
224
230
  omnibusDiscountEl: c
225
231
  }) && (a = !0), l && "querySelector" in l) {
226
232
  const d = l.querySelector("a.es-button") || l.querySelector("a");
227
- d && (t.modifyHtml(d).setAttribute("href", n.url), a = !0);
233
+ d && (e.modifyHtml(d).setAttribute("href", n.url), a = !0);
228
234
  }
229
235
  return a;
230
236
  }
231
- function j(e) {
232
- return "querySelector" in e ? e.querySelector(w) ?? e : e;
237
+ function j(t) {
238
+ return "querySelector" in t ? t.querySelector(N) ?? t : t;
233
239
  }
234
- function te(e, t) {
240
+ function re(t, e) {
235
241
  var o;
236
242
  let n;
237
- if (e.startsWith(R)) {
238
- const r = e.slice(R.length);
239
- n = (o = t.product_attributes) == null ? void 0 : o[r];
243
+ if (t.startsWith(T)) {
244
+ const r = t.slice(T.length);
245
+ n = (o = e.product_attributes) == null ? void 0 : o[r];
240
246
  } else
241
- n = t[e];
242
- return Y(n) || null;
247
+ n = e[t];
248
+ return X(n) || null;
243
249
  }
244
- function ne(e, t, n) {
245
- if (!("querySelectorAll" in e))
250
+ function ie(t, e, n) {
251
+ if (!("querySelectorAll" in t))
246
252
  return !1;
247
- const o = e.querySelectorAll(
253
+ const o = t.querySelectorAll(
248
254
  `[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
249
255
  );
250
256
  if (o.length === 0)
@@ -253,7 +259,7 @@ function ne(e, t, n) {
253
259
  o.forEach((i) => {
254
260
  if (!("getAttribute" in i))
255
261
  return;
256
- const u = i.getAttribute(G);
262
+ const u = i.getAttribute(K);
257
263
  if (!u)
258
264
  return;
259
265
  const c = r.get(u) ?? [];
@@ -265,36 +271,36 @@ function ne(e, t, n) {
265
271
  i.slice(0, c).forEach((l, a) => {
266
272
  if (!("querySelector" in l))
267
273
  return;
268
- const d = te(u, n[a]);
274
+ const d = re(u, n[a]);
269
275
  if (d === null)
270
276
  return;
271
277
  const f = l.querySelector("p") ?? null;
272
- b(t, f, d) && (s = !0);
278
+ b(e, f, d) && (s = !0);
273
279
  });
274
280
  }), s;
275
281
  }
276
- function h(e, t, n) {
277
- if (!("querySelectorAll" in e))
282
+ function I(t, e, n) {
283
+ if (!("querySelectorAll" in t))
278
284
  return !1;
279
- const o = e.querySelectorAll(
285
+ const o = t.querySelectorAll(
280
286
  `[esd-extension-block-id="${m.IMAGE}"]`
281
- ), r = e.querySelectorAll(
287
+ ), r = t.querySelectorAll(
282
288
  `[esd-extension-block-id="${m.NAME}"]`
283
- ), s = e.querySelectorAll(
289
+ ), s = t.querySelectorAll(
284
290
  `[esd-extension-block-id="${m.PRICE}"]`
285
- ), i = e.querySelectorAll(
291
+ ), i = t.querySelectorAll(
286
292
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
287
- ), u = e.querySelectorAll(
293
+ ), u = t.querySelectorAll(
288
294
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
289
- ), c = e.querySelectorAll(
295
+ ), c = t.querySelectorAll(
290
296
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
291
- ), l = e.querySelectorAll(
297
+ ), l = t.querySelectorAll(
292
298
  `[esd-extension-block-id="${m.BUTTON}"]`
293
299
  ), a = Math.min(o.length, n.length);
294
300
  let d = !1;
295
301
  for (let f = 0; f < a; f++) {
296
- const y = ee({
297
- documentModifier: t,
302
+ const p = oe({
303
+ documentModifier: e,
298
304
  product: n[f],
299
305
  imageEl: o[f] ?? null,
300
306
  nameEl: r[f] ?? null,
@@ -304,25 +310,25 @@ function h(e, t, n) {
304
310
  omnibusDiscountEl: c[f] ?? null,
305
311
  buttonEl: l[f] ?? null
306
312
  });
307
- d = d || y;
313
+ d = d || p;
308
314
  }
309
- return ne(e, t, n) && (d = !0), d;
315
+ return ie(t, e, n) && (d = !0), d;
310
316
  }
311
- function pe(e) {
312
- const { currentNode: t, documentModifier: n, products: o } = e;
313
- if (!t || !("querySelectorAll" in t))
317
+ function Se(t) {
318
+ const { currentNode: e, documentModifier: n, products: o } = t;
319
+ if (!e || !("querySelectorAll" in e))
314
320
  return !1;
315
- const r = j(t);
321
+ const r = j(e);
316
322
  if (!("querySelectorAll" in r) || r.querySelectorAll(
317
323
  `[esd-extension-block-id="${m.IMAGE}"]`
318
324
  ).length !== o.length)
319
325
  return !1;
320
- let i = h(r, n, o);
321
- const u = C(t), c = S.getConfig(t);
322
- if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
323
- const l = t.querySelector(O);
326
+ let i = I(r, n, o);
327
+ const u = C(e), c = S.getConfig(e);
328
+ if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
329
+ const l = e.querySelector(O);
324
330
  if (l) {
325
- const a = h(
331
+ const a = I(
326
332
  l,
327
333
  n,
328
334
  o
@@ -332,22 +338,22 @@ function pe(e) {
332
338
  }
333
339
  return i && n.apply(new g("Updated product content in-place")), !0;
334
340
  }
335
- function I(e, t, n) {
336
- if (!("querySelectorAll" in e))
341
+ function h(t, e, n) {
342
+ if (!("querySelectorAll" in t))
337
343
  return !1;
338
- const o = e.querySelectorAll(
344
+ const o = t.querySelectorAll(
339
345
  `[esd-extension-block-id="${m.PRICE}"]`
340
- ), r = e.querySelectorAll(
346
+ ), r = t.querySelectorAll(
341
347
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
342
- ), s = e.querySelectorAll(
348
+ ), s = t.querySelectorAll(
343
349
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
344
- ), i = e.querySelectorAll(
350
+ ), i = t.querySelectorAll(
345
351
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
346
352
  ), u = Math.min(o.length, n.length);
347
353
  let c = !1;
348
354
  for (let l = 0; l < u; l++)
349
355
  v({
350
- documentModifier: t,
356
+ documentModifier: e,
351
357
  product: n[l],
352
358
  priceEl: o[l] ?? null,
353
359
  oldPriceEl: r[l] ?? null,
@@ -356,44 +362,47 @@ function I(e, t, n) {
356
362
  }) && (c = !0);
357
363
  return c;
358
364
  }
359
- function be(e) {
360
- const { currentNode: t, documentModifier: n } = e;
361
- if (!t || !("querySelectorAll" in t))
365
+ function Ee(t) {
366
+ const { currentNode: e, documentModifier: n } = t;
367
+ if (!e || !("querySelectorAll" in e))
362
368
  return !1;
369
+ if (z(e))
370
+ return !0;
363
371
  const r = P().recommendationProducts;
364
372
  if (r.length === 0)
365
373
  return !1;
366
- const s = j(t);
367
- let i = I(s, n, r);
368
- const u = C(t), c = S.getConfig(t);
369
- if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
370
- const l = t.querySelector(O);
374
+ const s = j(e);
375
+ let i = h(s, n, r);
376
+ const u = C(e), c = S.getConfig(e);
377
+ if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
378
+ const l = e.querySelector(O);
371
379
  if (l) {
372
- const a = I(l, n, r);
380
+ const a = h(l, n, r);
373
381
  i = i || a;
374
382
  }
375
383
  }
376
384
  return i && n.apply(new g("Updated price formatting in-place")), i;
377
385
  }
378
- function ge(e) {
379
- const { currentNode: t, documentModifier: n, currency: o } = e, r = q(t);
386
+ function Pe(t) {
387
+ const { currentNode: e, documentModifier: n, currency: o } = t, r = A(e);
380
388
  if (!r)
381
389
  return;
382
390
  const s = o.alignment === "before" ? "0" : "1", i = (u, c) => {
383
391
  n.modifyHtml(r).setAttribute(u, c);
384
392
  };
385
- i(p.CURRENCY, o.code), i(p.SYMBOL, o.symbol), i(p.ALIGNMENT, s), i(p.THOUSAND_SEPARATOR, o.thousandSeparator), i(p.DECIMAL_SEPARATOR, o.decimalSeparator), i(p.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new g("Update currency attributes"));
393
+ i(y.CURRENCY, o.code), i(y.SYMBOL, o.symbol), i(y.ALIGNMENT, s), i(y.THOUSAND_SEPARATOR, o.thousandSeparator), i(y.DECIMAL_SEPARATOR, o.decimalSeparator), i(y.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new g("Update currency attributes"));
386
394
  }
387
395
  export {
388
- ye as adjustProductsToSize,
389
- A as formatProductPrice,
390
- q as getBlockElement,
396
+ ge as adjustProductsToSize,
397
+ q as formatProductPrice,
398
+ A as getBlockElement,
391
399
  x as getCardComposition,
392
400
  C as getCurrentLayout,
393
- fe as regenerateMobileProductRows,
394
- me as regenerateProductRowsWithStyles,
395
- ge as setCurrencyAttributes,
396
- be as updatePricesInPlace,
397
- pe as updateProductContentInPlace,
398
- ee as updateSingleProductContent
401
+ z as isPartnerManagedBlock,
402
+ ye as regenerateMobileProductRows,
403
+ be as regenerateProductRowsWithStyles,
404
+ Pe as setCurrencyAttributes,
405
+ Ee as updatePricesInPlace,
406
+ Se as updateProductContentInPlace,
407
+ oe as updateSingleProductContent
399
408
  };
@@ -1,11 +1,12 @@
1
1
  var m = Object.defineProperty;
2
- var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ var p = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as c, UEAttr as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as d } from "../../common-control.js";
6
6
  import { RecommendationControlId as C } from "../constants/controlIds.js";
7
+ import "../constants/selectors.js";
7
8
  const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
8
- class h extends d {
9
+ class O extends d {
9
10
  constructor() {
10
11
  super(...arguments);
11
12
  a(this, "_repositionedElement", null);
@@ -17,7 +18,7 @@ class h extends d {
17
18
  return `
18
19
  <div class="${r}">
19
20
  <${c.ICON}
20
- ${p.ICON.src}="migration-info-icon"
21
+ ${_.ICON.src}="migration-info-icon"
21
22
  class="${r}__icon">
22
23
  </${c.ICON}>
23
24
  <p class="${r}__text">
@@ -61,5 +62,5 @@ class h extends d {
61
62
  }
62
63
  export {
63
64
  S as SYNC_INFO_MESSAGE_CONTROL_ID,
64
- h as SyncInfoMessageControl
65
+ O as SyncInfoMessageControl
65
66
  };