@useinsider/guido 3.0.0-beta.7d3a300 → 3.0.0-beta.952fc1f

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 (58) hide show
  1. package/dist/config/i18n/en/tooltips.json.js +1 -2
  2. package/dist/extensions/Blocks/Recommendation/block.js +56 -38
  3. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  4. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  5. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  6. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  7. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  8. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
  10. package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +35 -27
  11. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
  13. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
  14. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  15. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +198 -204
  16. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
  17. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
  18. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  19. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  20. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  21. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  22. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +134 -142
  23. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
  24. package/dist/extensions/Blocks/Recommendation/extension.js +13 -13
  25. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +35 -0
  26. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -15
  27. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -0
  28. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -27
  29. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  30. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
  31. package/dist/extensions/Blocks/common-control.js +90 -41
  32. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
  33. package/dist/package.json.js +1 -1
  34. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +2 -1
  35. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +2 -2
  36. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
  38. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
  41. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
  42. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
  43. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
  44. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
  45. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
  46. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  47. package/dist/src/extensions/Blocks/common-control.d.ts +24 -2
  48. package/dist/static/styles/components/button.css.js +7 -13
  49. package/dist/static/styles/components/narrow-panel.css.js +0 -52
  50. package/dist/static/styles/components/wide-panel.css.js +1 -0
  51. package/dist/static/styles/customEditorStyle.css.js +9 -0
  52. package/package.json +3 -3
  53. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  54. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  55. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  56. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  57. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  58. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
@@ -1,14 +1,14 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as A, CONTAINER_SELECTOR as $, MOBILE_ROW_SELECTOR as N } from "../../constants/selectors.js";
4
- import { RecommendationConfigService as k } from "../../services/configService.js";
5
- import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
2
+ import { RecommendationBlockId as f } from "../../constants/blockIds.js";
3
+ import { MOBILE_CONTAINER_SELECTOR as P, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as q, CONTAINER_SELECTOR as $ } from "../../constants/selectors.js";
4
+ import { RecommendationConfigService as E } from "../../services/configService.js";
5
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
6
  import { prepareProductRows as T } from "../../templates/index.js";
7
7
  import { formatPrice as B } from "../../utils/priceFormatter.js";
8
8
  import { isTdNode as v } from "../../utils/tagName.js";
9
- import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as M, sanitizeImageUrl as j } from "../../templates/utils.js";
9
+ import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as j } from "../../templates/utils.js";
10
10
  const h = "recommendation-block-v2";
11
- function P(t) {
11
+ function M(t) {
12
12
  if (!t)
13
13
  return null;
14
14
  if ("getAttribute" in t) {
@@ -16,145 +16,137 @@ function P(t) {
16
16
  if (e && e.includes(h))
17
17
  return t;
18
18
  }
19
- return "querySelector" in t ? t.querySelector(`.${h}`) ?? null : null;
19
+ return "querySelector" in t ? t.querySelector(`.${h}`) : null;
20
20
  }
21
- function b(t) {
22
- const e = P(t);
21
+ function g(t) {
22
+ const e = M(t);
23
23
  if (!e || !("getAttribute" in e))
24
24
  return "grid";
25
25
  const o = e.getAttribute("data-layout");
26
26
  return o === "list" || o === "horizontal" ? "list" : "grid";
27
27
  }
28
- function x(t) {
29
- const e = P(t);
28
+ function L(t) {
29
+ const e = M(t);
30
30
  if (!e || !("getAttribute" in e))
31
- return M;
31
+ return R;
32
32
  const o = e.getAttribute("data-card-composition");
33
- return o ? o.split(",").filter(Boolean) : M;
33
+ return o ? o.split(",").filter(Boolean) : R;
34
34
  }
35
- function S(t, e, o) {
35
+ function b(t, e, o) {
36
36
  if (!e || !("childNodes" in e))
37
37
  return !1;
38
- const r = e.childNodes().find(
38
+ const i = e.childNodes().find(
39
39
  (c) => "getType" in c && c.getType() === "text"
40
40
  );
41
- return r ? (t.modifyHtml(r).setText(o), !0) : !1;
41
+ return i ? (t.modifyHtml(i).setText(o), !0) : !1;
42
42
  }
43
- function D(t, e) {
43
+ function x(t, e) {
44
44
  return t && t.length > 0 ? t : e.length > 0 ? e : _();
45
45
  }
46
46
  function V(t) {
47
47
  const { currentNode: e, documentModifier: o } = t;
48
48
  if (!e || !("querySelector" in e))
49
49
  return;
50
- const n = e.querySelector(N), r = e.querySelector(g);
51
- n && o.modifyHtml(n).setStyle("display", "none"), r && o.modifyHtml(r).setInnerHtml(""), (n || r) && o.apply(new p("Hide mobile row for list layout"));
50
+ const n = e.querySelector(k);
51
+ n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
52
52
  }
53
53
  function W(t) {
54
- const { currentNode: e, documentModifier: o } = t;
55
- if (!e || !("querySelector" in e))
56
- return;
57
- const n = e.querySelector(N);
58
- n && o.modifyHtml(n).removeStyle("display").apply(new p("Show mobile row for grid layout"));
59
- }
60
- function G(t) {
61
54
  const {
62
55
  currentNode: e,
63
56
  documentModifier: o,
64
57
  products: n,
65
- layout: r,
58
+ layout: i,
66
59
  composition: c
67
60
  } = t;
68
61
  if (!e || !("querySelector" in e))
69
62
  return;
70
- const i = r ?? b(e);
71
- if (i === "list") {
63
+ const r = i ?? g(e), u = E.getConfig(e);
64
+ if (r === "list" || !u.mobileLayoutEnabled) {
72
65
  V({ currentNode: e, documentModifier: o });
73
66
  return;
74
67
  }
75
- W({ currentNode: e, documentModifier: o });
76
- const s = e.querySelector(g);
68
+ const s = e.querySelector(k);
77
69
  if (!s)
78
70
  return;
79
- const u = E(), l = k.getConfig(e), f = D(n, u.recommendationProducts), d = c ?? x(e), a = T(f, i, {
80
- productsPerRow: l.mobileCardsInRow,
81
- composition: d
82
- });
83
- o.modifyHtml(s).setInnerHtml(a).apply(new p("Updated mobile product rows"));
71
+ const l = C(), a = x(n, l.recommendationProducts), m = c ?? L(e), S = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${T(a, r, {
72
+ productsPerRow: u.mobileCardsInRow,
73
+ composition: m
74
+ })}</table></td>`;
75
+ o.modifyHtml(s).setInnerHtml(S), o.apply(new p("Updated mobile product rows"));
84
76
  }
85
- function Y(t) {
77
+ function G(t) {
86
78
  const {
87
79
  currentNode: e,
88
80
  documentModifier: o,
89
81
  afterRegenerate: n,
90
- products: r,
82
+ products: i,
91
83
  layout: c,
92
- composition: i
84
+ composition: r
93
85
  } = t;
94
86
  if (!e || !("querySelector" in e))
95
87
  return;
96
- const s = e.querySelector(A) ?? e.querySelector($);
97
- if (!s)
88
+ const u = e.querySelector(q) ?? e.querySelector($);
89
+ if (!u)
98
90
  return;
99
- const u = E(), l = D(r, u.recommendationProducts), { cardsInRow: f } = u.recommendationConfigs, d = i ?? x(e), a = c ?? b(e), C = T(l, a, {
100
- productsPerRow: f,
101
- composition: d
91
+ const s = C(), l = x(i, s.recommendationProducts), { cardsInRow: a } = s.recommendationConfigs, m = r ?? L(e), d = c ?? g(e), S = T(l, d, {
92
+ productsPerRow: a,
93
+ composition: m
102
94
  });
103
- o.modifyHtml(s).setInnerHtml(C).apply(new p("Updated product")), G(t), n == null || n();
95
+ o.modifyHtml(u).setInnerHtml(S).apply(new p("Updated product")), W(t), n == null || n();
104
96
  }
105
- function R(t, e, o, n) {
97
+ function I(t, e, o, n) {
106
98
  const c = `0 ${Math.floor(o / 2)}px`;
107
- let i = !1;
99
+ let r = !1;
108
100
  return n === "grid" ? Array.from(
109
101
  t.querySelectorAll(".attribute-cell")
110
- ).forEach((u) => {
111
- e.modifyHtml(u).setStyle("padding", c), i = !0;
102
+ ).forEach((s) => {
103
+ e.modifyHtml(s).setStyle("padding", c), r = !0;
112
104
  }) : Array.from(
113
105
  t.querySelectorAll(".product-card-wrapper")
114
- ).forEach((u) => {
115
- const l = "parentNode" in u ? u.parentNode : null;
116
- l && v(l) && (e.modifyHtml(l).setStyle("padding", c), i = !0);
117
- }), i;
106
+ ).forEach((s) => {
107
+ const l = "parentNode" in s ? s.parentNode : null;
108
+ l && v(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
109
+ }), r;
118
110
  }
119
- function I(t, e, o) {
120
- const n = `${o}px`, r = Array.from(t.querySelectorAll(".spacer"));
111
+ function O(t, e, o) {
112
+ const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
121
113
  let c = !1;
122
- return r.forEach((i) => {
123
- e.modifyHtml(i).setStyle("height", n), c = !0;
114
+ return i.forEach((r) => {
115
+ e.modifyHtml(r).setStyle("height", n), c = !0;
124
116
  }), c;
125
117
  }
126
- function F(t) {
118
+ function Y(t) {
127
119
  const { currentNode: e, documentModifier: o } = t;
128
120
  if (!e)
129
121
  return;
130
- const n = k.getConfig(e), r = b(e);
122
+ const n = E.getConfig(e), i = g(e);
131
123
  let c = !1;
132
- const i = e.querySelector(A);
133
- if (i) {
134
- c = R(
135
- i,
124
+ const r = e.querySelector(q);
125
+ if (r) {
126
+ c = I(
127
+ r,
136
128
  o,
137
129
  n.columnSpacing,
138
- r
130
+ i
139
131
  );
140
- const l = I(
141
- i,
132
+ const l = O(
133
+ r,
142
134
  o,
143
135
  n.rowSpacing
144
136
  );
145
137
  c = c || l;
146
138
  }
147
- const s = e.querySelector(g);
148
- if (s) {
149
- const u = R(
150
- s,
139
+ const u = e.querySelector(P);
140
+ if (u) {
141
+ const s = I(
142
+ u,
151
143
  o,
152
144
  n.mobileColumnSpacing,
153
- r
145
+ i
154
146
  );
155
- c = c || u;
156
- const l = I(
157
- s,
147
+ c = c || s;
148
+ const l = O(
149
+ u,
158
150
  o,
159
151
  n.mobileRowSpacing
160
152
  );
@@ -162,26 +154,26 @@ function F(t) {
162
154
  }
163
155
  c && o.apply(new p("Reapply spacing after regeneration"));
164
156
  }
165
- function ie(t) {
166
- const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c, composition: i } = t;
167
- e && Y({
157
+ function re(t) {
158
+ const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
159
+ e && G({
168
160
  currentNode: e,
169
161
  documentModifier: o,
170
- products: r,
162
+ products: i,
171
163
  layout: c,
172
- composition: i,
164
+ composition: r,
173
165
  afterRegenerate: () => {
174
166
  setTimeout(() => {
175
- F({ currentNode: e, documentModifier: o });
167
+ Y({ currentNode: e, documentModifier: o });
176
168
  }, 0), n == null || n();
177
169
  }
178
170
  });
179
171
  }
180
- function ce(t, e) {
172
+ function ie(t, e) {
181
173
  return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ..._(e - t.length)];
182
174
  }
183
- function H() {
184
- const t = E(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
175
+ function D() {
176
+ const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
185
177
  return {
186
178
  code: e.value,
187
179
  symbol: e.symbol,
@@ -191,199 +183,201 @@ function H() {
191
183
  thousandSeparator: e.thousandSeparator
192
184
  };
193
185
  }
194
- function q(t, e = "price") {
195
- const o = H(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
186
+ function A(t, e = "price") {
187
+ const o = D(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
196
188
  return B({
197
- price: r,
189
+ price: i,
198
190
  currency: o
199
191
  });
200
192
  }
201
- function K(t) {
202
- var c, i;
203
- const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
204
- return r > 0 ? `-${r}%` : "0%";
193
+ function F(t) {
194
+ var c, r;
195
+ const e = D(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
196
+ return i > 0 ? `-${i}%` : "0%";
205
197
  }
206
- function L(t) {
207
- const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: c, omnibusDiscountEl: i } = t;
208
- let s = !1;
198
+ function H(t) {
199
+ const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
200
+ let u = !1;
209
201
  if (n && "querySelector" in n) {
210
- const u = n.querySelector("strong"), l = q(o, "price");
211
- S(e, u, l) && (s = !0);
202
+ const s = n.querySelector("strong"), l = A(o, "price");
203
+ b(e, s, l) && (u = !0);
212
204
  }
213
- if (r && "querySelector" in r) {
214
- const u = r.querySelector("strong"), l = q(o, "original_price");
215
- S(e, u, l) && (s = !0);
205
+ if (i && "querySelector" in i) {
206
+ const s = i.querySelector("strong"), l = A(o, "original_price");
207
+ b(e, s, l) && (u = !0);
216
208
  }
217
209
  if (c && "querySelector" in c) {
218
- const u = c.querySelector(".omnibus-price-value"), l = q(o, "original_price");
219
- S(e, u, l) && (s = !0);
210
+ const s = c.querySelector(".omnibus-price-value"), l = A(o, "original_price");
211
+ b(e, s, l) && (u = !0);
220
212
  }
221
- if (i && "querySelector" in i) {
222
- const u = i.querySelector(".omnibus-discount-value"), l = K(o);
223
- S(e, u, l) && (s = !0);
213
+ if (r && "querySelector" in r) {
214
+ const s = r.querySelector(".omnibus-discount-value"), l = F(o);
215
+ b(e, s, l) && (u = !0);
224
216
  }
225
- return s;
217
+ return u;
226
218
  }
227
- function z(t) {
219
+ function K(t) {
228
220
  const {
229
221
  documentModifier: e,
230
222
  product: o,
231
223
  imageEl: n,
232
- nameEl: r,
224
+ nameEl: i,
233
225
  priceEl: c,
234
- oldPriceEl: i,
235
- omnibusPriceEl: s,
236
- omnibusDiscountEl: u,
226
+ oldPriceEl: r,
227
+ omnibusPriceEl: u,
228
+ omnibusDiscountEl: s,
237
229
  buttonEl: l
238
230
  } = t;
239
- let f = !1;
231
+ let a = !1;
240
232
  if (n && "querySelector" in n) {
241
- const d = n.querySelector("img");
242
- d && (e.modifyHtml(d).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), f = !0);
243
- const a = n.querySelector("a");
244
- a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
233
+ const m = n.querySelector("img");
234
+ m && (e.modifyHtml(m).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), a = !0);
235
+ const d = n.querySelector("a");
236
+ d && (e.modifyHtml(d).setAttribute("href", o.url), a = !0);
245
237
  }
246
- if (r && "querySelector" in r) {
247
- const d = r.querySelector("strong");
248
- S(e, d, o.name) && (f = !0);
238
+ if (i && "querySelector" in i) {
239
+ const m = i.querySelector("strong");
240
+ b(e, m, o.name) && (a = !0);
249
241
  }
250
- if (L({
242
+ if (H({
251
243
  documentModifier: e,
252
244
  product: o,
253
245
  priceEl: c,
254
- oldPriceEl: i,
255
- omnibusPriceEl: s,
256
- omnibusDiscountEl: u
257
- }) && (f = !0), l && "querySelector" in l) {
258
- const d = l.querySelector("a.es-button") || l.querySelector("a");
259
- d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
246
+ oldPriceEl: r,
247
+ omnibusPriceEl: u,
248
+ omnibusDiscountEl: s
249
+ }) && (a = !0), l && "querySelector" in l) {
250
+ const m = l.querySelector("a.es-button") || l.querySelector("a");
251
+ m && (e.modifyHtml(m).setAttribute("href", o.url), a = !0);
260
252
  }
261
- return f;
253
+ return a;
262
254
  }
263
255
  function U(t) {
264
- return "querySelector" in t ? t.querySelector(A) ?? t : t;
256
+ return "querySelector" in t ? t.querySelector(q) ?? t : t;
265
257
  }
266
258
  function w(t, e, o) {
267
259
  if (!("querySelectorAll" in t))
268
260
  return !1;
269
261
  const n = t.querySelectorAll(
270
- `[esd-extension-block-id="${m.IMAGE}"]`
271
- ), r = t.querySelectorAll(
272
- `[esd-extension-block-id="${m.NAME}"]`
273
- ), c = t.querySelectorAll(
274
- `[esd-extension-block-id="${m.PRICE}"]`
262
+ `[esd-extension-block-id="${f.IMAGE}"]`
275
263
  ), i = t.querySelectorAll(
276
- `[esd-extension-block-id="${m.OLD_PRICE}"]`
277
- ), s = t.querySelectorAll(
278
- `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
264
+ `[esd-extension-block-id="${f.NAME}"]`
265
+ ), c = t.querySelectorAll(
266
+ `[esd-extension-block-id="${f.PRICE}"]`
267
+ ), r = t.querySelectorAll(
268
+ `[esd-extension-block-id="${f.OLD_PRICE}"]`
279
269
  ), u = t.querySelectorAll(
280
- `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
270
+ `[esd-extension-block-id="${f.OMNIBUS_PRICE}"]`
271
+ ), s = t.querySelectorAll(
272
+ `[esd-extension-block-id="${f.OMNIBUS_DISCOUNT}"]`
281
273
  ), l = t.querySelectorAll(
282
- `[esd-extension-block-id="${m.BUTTON}"]`
283
- ), f = Math.min(n.length, o.length);
284
- let d = !1;
285
- for (let a = 0; a < f; a++) {
286
- const C = z({
274
+ `[esd-extension-block-id="${f.BUTTON}"]`
275
+ ), a = Math.min(n.length, o.length);
276
+ let m = !1;
277
+ for (let d = 0; d < a; d++) {
278
+ const S = K({
287
279
  documentModifier: e,
288
- product: o[a],
289
- imageEl: n[a] ?? null,
290
- nameEl: r[a] ?? null,
291
- priceEl: c[a] ?? null,
292
- oldPriceEl: i[a] ?? null,
293
- omnibusPriceEl: s[a] ?? null,
294
- omnibusDiscountEl: u[a] ?? null,
295
- buttonEl: l[a] ?? null
280
+ product: o[d],
281
+ imageEl: n[d] ?? null,
282
+ nameEl: i[d] ?? null,
283
+ priceEl: c[d] ?? null,
284
+ oldPriceEl: r[d] ?? null,
285
+ omnibusPriceEl: u[d] ?? null,
286
+ omnibusDiscountEl: s[d] ?? null,
287
+ buttonEl: l[d] ?? null
296
288
  });
297
- d = d || C;
289
+ m = m || S;
298
290
  }
299
- return d;
291
+ return m;
300
292
  }
301
- function le(t) {
293
+ function ce(t) {
302
294
  const { currentNode: e, documentModifier: o, products: n } = t;
303
295
  if (!e || !("querySelectorAll" in e))
304
296
  return !1;
305
- const r = U(e);
306
- if (!("querySelectorAll" in r) || r.querySelectorAll(
307
- `[esd-extension-block-id="${m.IMAGE}"]`
297
+ const i = U(e);
298
+ if (!("querySelectorAll" in i) || i.querySelectorAll(
299
+ `[esd-extension-block-id="${f.IMAGE}"]`
308
300
  ).length !== n.length)
309
301
  return !1;
310
- let i = w(r, o, n);
311
- if (b(e) !== "list" && "querySelector" in e) {
312
- const u = e.querySelector(g);
313
- if (u) {
314
- const l = w(
315
- u,
302
+ let r = w(i, o, n);
303
+ const u = g(e), s = E.getConfig(e);
304
+ if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
305
+ const l = e.querySelector(P);
306
+ if (l) {
307
+ const a = w(
308
+ l,
316
309
  o,
317
310
  n
318
311
  );
319
- i = i || l;
312
+ r = r || a;
320
313
  }
321
314
  }
322
- return i && o.apply(new p("Updated product content in-place")), !0;
315
+ return r && o.apply(new p("Updated product content in-place")), !0;
323
316
  }
324
- function O(t, e, o) {
317
+ function N(t, e, o) {
325
318
  if (!("querySelectorAll" in t))
326
319
  return !1;
327
320
  const n = t.querySelectorAll(
328
- `[esd-extension-block-id="${m.PRICE}"]`
329
- ), r = t.querySelectorAll(
330
- `[esd-extension-block-id="${m.OLD_PRICE}"]`
331
- ), c = t.querySelectorAll(
332
- `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
321
+ `[esd-extension-block-id="${f.PRICE}"]`
333
322
  ), i = t.querySelectorAll(
334
- `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
335
- ), s = Math.min(n.length, o.length);
336
- let u = !1;
337
- for (let l = 0; l < s; l++)
338
- L({
323
+ `[esd-extension-block-id="${f.OLD_PRICE}"]`
324
+ ), c = t.querySelectorAll(
325
+ `[esd-extension-block-id="${f.OMNIBUS_PRICE}"]`
326
+ ), r = t.querySelectorAll(
327
+ `[esd-extension-block-id="${f.OMNIBUS_DISCOUNT}"]`
328
+ ), u = Math.min(n.length, o.length);
329
+ let s = !1;
330
+ for (let l = 0; l < u; l++)
331
+ H({
339
332
  documentModifier: e,
340
333
  product: o[l],
341
334
  priceEl: n[l] ?? null,
342
- oldPriceEl: r[l] ?? null,
335
+ oldPriceEl: i[l] ?? null,
343
336
  omnibusPriceEl: c[l] ?? null,
344
- omnibusDiscountEl: i[l] ?? null
345
- }) && (u = !0);
346
- return u;
337
+ omnibusDiscountEl: r[l] ?? null
338
+ }) && (s = !0);
339
+ return s;
347
340
  }
348
- function ue(t) {
341
+ function le(t) {
349
342
  const { currentNode: e, documentModifier: o } = t;
350
343
  if (!e || !("querySelectorAll" in e))
351
344
  return !1;
352
- const r = E().recommendationProducts;
353
- if (r.length === 0)
345
+ const i = C().recommendationProducts;
346
+ if (i.length === 0)
354
347
  return !1;
355
348
  const c = U(e);
356
- let i = O(c, o, r);
357
- if (b(e) !== "list" && "querySelector" in e) {
358
- const u = e.querySelector(g);
359
- if (u) {
360
- const l = O(u, o, r);
361
- i = i || l;
349
+ let r = N(c, o, i);
350
+ const u = g(e), s = E.getConfig(e);
351
+ if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
352
+ const l = e.querySelector(P);
353
+ if (l) {
354
+ const a = N(l, o, i);
355
+ r = r || a;
362
356
  }
363
357
  }
364
- return i && o.apply(new p("Updated price formatting in-place")), i;
358
+ return r && o.apply(new p("Updated price formatting in-place")), r;
365
359
  }
366
360
  function se(t) {
367
- const { currentNode: e, documentModifier: o, currency: n } = t, r = P(e);
368
- if (!r)
361
+ const { currentNode: e, documentModifier: o, currency: n } = t, i = M(e);
362
+ if (!i)
369
363
  return;
370
- const c = n.alignment === "before" ? "0" : "1", i = (s, u) => {
371
- o.modifyHtml(r).setAttribute(s, u);
364
+ const c = n.alignment === "before" ? "0" : "1", r = (u, s) => {
365
+ o.modifyHtml(i).setAttribute(u, s);
372
366
  };
373
- i(y.CURRENCY, n.code), i(y.SYMBOL, n.symbol), i(y.ALIGNMENT, c), i(y.THOUSAND_SEPARATOR, n.thousandSeparator), i(y.DECIMAL_SEPARATOR, n.decimalSeparator), i(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
367
+ r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
374
368
  }
375
369
  export {
376
- ce as adjustProductsToSize,
377
- q as formatProductPrice,
378
- P as getBlockElement,
379
- x as getCardComposition,
380
- b as getCurrentLayout,
381
- F as reapplySpacing,
382
- G as regenerateMobileProductRows,
383
- Y as regenerateProductRows,
384
- ie as regenerateProductRowsWithStyles,
370
+ ie as adjustProductsToSize,
371
+ A as formatProductPrice,
372
+ M as getBlockElement,
373
+ L as getCardComposition,
374
+ g as getCurrentLayout,
375
+ Y as reapplySpacing,
376
+ W as regenerateMobileProductRows,
377
+ G as regenerateProductRows,
378
+ re as regenerateProductRowsWithStyles,
385
379
  se as setCurrencyAttributes,
386
- ue as updatePricesInPlace,
387
- le as updateProductContentInPlace,
388
- z as updateSingleProductContent
380
+ le as updatePricesInPlace,
381
+ ce as updateProductContentInPlace,
382
+ K as updateSingleProductContent
389
383
  };
@@ -1,21 +1,38 @@
1
- import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const s = "ins-recommendation-desktop-container", i = "ins-recommendation-mobile-container", o = "ins-recommendation-list-layout", a = `.${i} { display: none; }`, d = `@media only screen and (max-width: 480px) { .${s} { display: none !important; } .${i} { display: table !important; } .${o} .${s} { display: table !important; } .${o} .${i}, .${o} .ins-recommendation-mobile-row { display: none !important; } .${o} .product-image-cell { width: 80px !important; } .${o} .product-image-cell img { max-width: 80px !important; } .${o} .button-cell { width: 80px !important; } .${o} .product-info-cell { padding: 5px 8px !important; } }`, p = `.${i}`;
1
+ import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const r = "ins-recommendation-desktop-container", l = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", u = `.${l} { display: none; }`, m = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${l} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${l}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, d = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${l}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, p = `.${l}`;
3
3
  function c(t, e) {
4
4
  return !!t.querySelector(e);
5
5
  }
6
- function m(t) {
6
+ function f(t) {
7
+ return t.querySelectorAll(`*${r}`).length > 0;
8
+ }
9
+ function y(t) {
7
10
  return t.querySelectorAll(`*${s}`).length > 0;
8
11
  }
9
12
  function S(t) {
10
13
  const e = t.getDocumentRootCssNode();
11
14
  if (!e)
12
15
  return;
16
+ const o = t.getDocumentModifier();
17
+ let n = !1;
18
+ c(e, p) || (o.modifyCss(e).appendRule(u), n = !0), f(e) || (o.modifyCss(e).appendRule(m), n = !0), y(e) || (o.modifyCss(e).appendRule(d), n = !0), n && o.apply(new a("Add mobile layout CSS rules"));
19
+ }
20
+ function C(t) {
21
+ return "hasClass" in t ? t.hasClass(s) : !1;
22
+ }
23
+ function O(t, e, o) {
13
24
  const n = t.getDocumentModifier();
14
- let r = !1;
15
- c(e, p) || (n.modifyCss(e).appendRule(a), r = !0), m(e) || (n.modifyCss(e).appendRule(d), r = !0), r && n.apply(new l("Add mobile layout CSS rules"));
25
+ o ? n.modifyHtml(e).setClass(s) : n.modifyHtml(e).removeClass(s), n.apply(
26
+ new a(
27
+ o ? "Opt out of mobile layout" : "Opt in to mobile layout"
28
+ )
29
+ );
16
30
  }
17
31
  export {
18
- s as CSS_CLASS_DESKTOP_CONTAINER,
19
- i as CSS_CLASS_MOBILE_CONTAINER,
20
- S as ensureMobileCssRulesExist
32
+ r as CSS_CLASS_DESKTOP_CONTAINER,
33
+ l as CSS_CLASS_MOBILE_CONTAINER,
34
+ s as CSS_CLASS_NO_MOBILE_LAYOUT,
35
+ S as ensureMobileCssRulesExist,
36
+ C as hasMobileLayoutOptOut,
37
+ O as setMobileLayoutOptOut
21
38
  };