@useinsider/guido 2.1.0-beta.f869a80 → 2.1.0-beta.f9ab899

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 (75) hide show
  1. package/dist/@types/config/schemas.js +1 -1
  2. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  3. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  4. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +13 -11
  7. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +23 -54
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +5 -7
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +21 -34
  10. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +36 -48
  12. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +9 -11
  13. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  14. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  15. package/dist/composables/useRecommendation.js +9 -9
  16. package/dist/composables/useStripo.js +25 -23
  17. package/dist/composables/useVersionHistoryApi.js +1 -1
  18. package/dist/config/i18n/en/index.js +11 -0
  19. package/dist/config/i18n/en/labels.json.js +7 -0
  20. package/dist/config/i18n/en/toasters.json.js +56 -0
  21. package/dist/config/i18n/en/tooltips.json.js +82 -0
  22. package/dist/config/i18n/index.js +7 -0
  23. package/dist/config/migrator/itemsBlockMigrator.js +65 -64
  24. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
  25. package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
  26. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +13 -12
  27. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
  28. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
  29. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +37 -27
  30. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
  31. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
  32. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +177 -125
  33. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
  34. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
  35. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
  36. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +269 -215
  37. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
  38. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  39. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
  40. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
  41. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
  42. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
  43. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
  44. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +3 -3
  46. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
  47. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +225 -102
  48. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -128
  49. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
  50. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  51. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  52. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  53. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  54. package/dist/guido.css +1 -1
  55. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +0 -1
  56. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +1 -17
  57. package/dist/src/config/i18n/en/index.d.ts +1 -0
  58. package/dist/src/config/i18n/index.d.ts +16 -0
  59. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
  60. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
  61. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
  62. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -1
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +33 -15
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +24 -14
  65. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +49 -17
  66. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +3 -18
  67. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
  68. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  69. package/dist/static/styles/components/notification.css.js +18 -0
  70. package/dist/static/styles/components/tools.css.js +6 -2
  71. package/dist/static/styles/variables.css.js +2 -0
  72. package/dist/stores/unsubscribe.js +37 -34
  73. package/package.json +1 -1
  74. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +0 -29
  75. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +0 -15
@@ -1,14 +1,14 @@
1
1
  var r = Object.defineProperty;
2
- var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as f } from "../../../common-control.js";
6
- import { RecommendationConfigService as i } from "../../services/configService.js";
2
+ var f = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var n = (o, t, e) => f(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as l } from "../../../common-control.js";
6
+ import { RecommendationConfigService as s } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
- const h = "recommendation-shuffle-control", s = {
8
+ const h = "recommendation-shuffle-control", i = {
9
9
  SHUFFLE_PRODUCTS: "shuffleProducts"
10
10
  };
11
- class g extends f {
11
+ class S extends l {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  // Store is used for backward compatibility with product fetching
@@ -22,7 +22,7 @@ class g extends f {
22
22
  <div class="shuffle-control-container">
23
23
  ${this._GuTwoColumns([
24
24
  this._GuLabel({ text: "Shuffle Recommended Products" }),
25
- this._GuToggle(s.SHUFFLE_PRODUCTS)
25
+ this._GuToggle(i.SHUFFLE_PRODUCTS)
26
26
  ])}
27
27
  </div>
28
28
  `;
@@ -34,21 +34,21 @@ class g extends f {
34
34
  super.onTemplateNodeUpdated(e), this._setFormValues();
35
35
  }
36
36
  _setFormValues() {
37
- const e = i.getConfig(this.currentNode);
37
+ const e = s.getConfig(this.currentNode);
38
38
  this.api.updateValues({
39
- [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
39
+ [i.SHUFFLE_PRODUCTS]: e.shuffleProducts
40
40
  });
41
41
  }
42
42
  _initializeToggle() {
43
- const e = i.getConfig(this.currentNode);
43
+ const e = s.getConfig(this.currentNode);
44
44
  this.api.setUIEAttribute(
45
- s.SHUFFLE_PRODUCTS,
46
- l.SELECTPICKER.items,
45
+ i.SHUFFLE_PRODUCTS,
46
+ u.SELECTPICKER.items,
47
47
  e.shuffleProducts
48
48
  );
49
49
  }
50
50
  _onShuffleChange(e) {
51
- this.currentNode && (i.updateConfig(
51
+ !this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
52
52
  this.api,
53
53
  this.currentNode,
54
54
  { shuffleProducts: e },
@@ -56,12 +56,12 @@ class g extends f {
56
56
  ), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
57
57
  }
58
58
  _listenToFormUpdates() {
59
- this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
59
+ this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
60
60
  this._onShuffleChange(!!e);
61
61
  });
62
62
  }
63
63
  }
64
64
  export {
65
65
  h as SHUFFLE_CONTROL_ID,
66
- g as ShuffleControl
66
+ S as ShuffleControl
67
67
  };
@@ -1,307 +1,361 @@
1
- import { ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as y } 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 y, MOBILE_CONTAINER_SELECTOR as T, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as _ } from "../../constants/selectors.js";
3
+ import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as p, DESKTOP_CONTAINER_SELECTOR as C, CONTAINER_SELECTOR as $ } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as k } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as b } from "../../store/recommendation.js";
6
- import { prepareProductRows as R } from "../../templates/index.js";
7
- import { formatPrice as D } from "../../utils/priceFormatter.js";
8
- import { isTdNode as L } from "../../utils/tagName.js";
9
- import { sanitizeImageUrl as U, getDefaultProducts as H, DEFAULT_CARD_COMPOSITION as C } from "../../templates/utils.js";
10
- const q = "ins-recommendation-v3-block-v2";
11
- function E(o) {
12
- if (!o)
6
+ import { prepareProductRows as N } from "../../templates/index.js";
7
+ import { formatPrice as H } from "../../utils/priceFormatter.js";
8
+ import { isTdNode as B } from "../../utils/tagName.js";
9
+ import { getDefaultProducts as T, DEFAULT_CARD_COMPOSITION as q, sanitizeImageUrl as v } from "../../templates/utils.js";
10
+ const M = "ins-recommendation-v3-block-v2";
11
+ function A(t) {
12
+ if (!t)
13
13
  return null;
14
- if ("getAttribute" in o) {
15
- const e = o.getAttribute("class");
16
- if (e && e.includes(q))
17
- return o;
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 o ? o.querySelector(`.${q}`) : null;
19
+ return "querySelector" in t ? t.querySelector(`.${M}`) : null;
20
20
  }
21
- function P(o) {
22
- const e = E(o);
21
+ function P(t) {
22
+ const e = A(t);
23
23
  if (!e || !("getAttribute" in e))
24
24
  return "grid";
25
- const t = e.getAttribute("data-layout");
26
- return t === "list" || t === "horizontal" ? "list" : "grid";
25
+ const o = e.getAttribute("data-layout");
26
+ return o === "list" || o === "horizontal" ? "list" : "grid";
27
27
  }
28
- function N(o) {
29
- const e = E(o);
28
+ function w(t) {
29
+ const e = A(t);
30
30
  if (!e || !("getAttribute" in e))
31
- return C;
32
- const t = e.getAttribute("data-card-composition");
33
- return t ? t.split(",").filter(Boolean) : C;
31
+ return q;
32
+ const o = e.getAttribute("data-card-composition");
33
+ return o ? o.split(",").filter(Boolean) : q;
34
34
  }
35
- function g(o, e, t) {
35
+ function S(t, e, o) {
36
36
  if (!e || !("childNodes" in e))
37
37
  return !1;
38
- const n = e.childNodes().find(
39
- (i) => "getType" in i && i.getType() === "text"
38
+ const i = e.childNodes().find(
39
+ (c) => "getType" in c && c.getType() === "text"
40
40
  );
41
- return n ? (o.modifyHtml(n).setText(t), !0) : !1;
41
+ return i ? (t.modifyHtml(i).setText(o), !0) : !1;
42
42
  }
43
- function h(o, e) {
44
- return o && o.length > 0 ? o : e.length > 0 ? e : H();
43
+ function _(t, e) {
44
+ return t && t.length > 0 ? t : e.length > 0 ? e : T();
45
45
  }
46
- function $(o) {
47
- const { currentNode: e, documentModifier: t, products: r, layout: n } = o;
46
+ function j(t) {
47
+ const { currentNode: e, documentModifier: o, products: n, layout: i } = t;
48
48
  if (!e || !("querySelector" in e))
49
49
  return;
50
- const i = e.querySelector(T);
51
- if (!i)
50
+ const c = e.querySelector(g);
51
+ if (!c)
52
52
  return;
53
- const c = b(), u = k.getConfig(e), l = h(r, c.recommendationProducts), s = N(e), d = n ?? P(e), a = R(l, d, {
54
- productsPerRow: u.mobileCardsInRow,
55
- composition: s
53
+ const r = b(), s = k.getConfig(e), u = _(n, r.recommendationProducts), l = w(e), f = i ?? P(e), a = N(u, f, {
54
+ productsPerRow: s.mobileCardsInRow,
55
+ composition: l
56
56
  });
57
- t.modifyHtml(i).setInnerHtml(a).apply(new S("Updated mobile product rows"));
57
+ o.modifyHtml(c).setInnerHtml(a).apply(new y("Updated mobile product rows"));
58
58
  }
59
- function x(o) {
59
+ function V(t) {
60
60
  const {
61
61
  currentNode: e,
62
- documentModifier: t,
63
- afterRegenerate: r,
64
- products: n,
65
- layout: i
66
- } = o;
62
+ documentModifier: o,
63
+ afterRegenerate: n,
64
+ products: i,
65
+ layout: c
66
+ } = t;
67
67
  if (!e || !("querySelector" in e))
68
68
  return;
69
- const c = e.querySelector(w) ?? e.querySelector(_);
70
- if (!c)
69
+ const r = e.querySelector(C) ?? e.querySelector($);
70
+ if (!r)
71
71
  return;
72
- const u = b(), l = h(n, u.recommendationProducts), { cardsInRow: s } = u.recommendationConfigs, d = N(e), a = i ?? P(e), p = R(l, a, {
73
- productsPerRow: s,
74
- composition: d
72
+ const s = b(), u = _(i, s.recommendationProducts), { cardsInRow: l } = s.recommendationConfigs, f = w(e), a = c ?? P(e), d = N(u, a, {
73
+ productsPerRow: l,
74
+ composition: f
75
75
  });
76
- t.modifyHtml(c).setInnerHtml(p).apply(new S("Updated product")), $(o), r == null || r();
76
+ o.modifyHtml(r).setInnerHtml(d).apply(new y("Updated product")), j(t), n == null || n();
77
77
  }
78
- function B(o, e, t, r) {
79
- const i = `0 ${Math.floor(t / 2)}px`;
80
- let c = !1;
81
- return r === "grid" ? Array.from(
82
- o.querySelectorAll(".attribute-cell")
83
- ).forEach((l) => {
84
- e.modifyHtml(l).setStyle("padding", i), c = !0;
78
+ function h(t, e, o, n) {
79
+ const c = `0 ${Math.floor(o / 2)}px`;
80
+ let r = !1;
81
+ return n === "grid" ? Array.from(
82
+ t.querySelectorAll(".attribute-cell")
83
+ ).forEach((u) => {
84
+ e.modifyHtml(u).setStyle("padding", c), r = !0;
85
85
  }) : Array.from(
86
- o.querySelectorAll(".product-card-wrapper")
87
- ).forEach((l) => {
88
- const s = "parentNode" in l ? l.parentNode : null;
89
- s && L(s) && (e.modifyHtml(s).setStyle("padding", i), c = !0);
90
- }), c;
86
+ t.querySelectorAll(".product-card-wrapper")
87
+ ).forEach((u) => {
88
+ const l = "parentNode" in u ? u.parentNode : null;
89
+ l && B(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
90
+ }), r;
91
91
  }
92
- function v(o, e, t) {
93
- const r = `${t}px`, n = Array.from(o.querySelectorAll(".spacer"));
94
- let i = !1;
95
- return n.forEach((c) => {
96
- e.modifyHtml(c).setStyle("height", r), i = !0;
97
- }), i;
92
+ function R(t, e, o) {
93
+ const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
94
+ let c = !1;
95
+ return i.forEach((r) => {
96
+ e.modifyHtml(r).setStyle("height", n), c = !0;
97
+ }), c;
98
98
  }
99
- function V(o) {
100
- const { currentNode: e, documentModifier: t } = o;
99
+ function G(t) {
100
+ const { currentNode: e, documentModifier: o } = t;
101
101
  if (!e)
102
102
  return;
103
- const r = E(e);
104
- if (!r || !("getAttribute" in r))
105
- return;
106
- const n = r.getAttribute("data-column-spacing"), i = r.getAttribute("data-row-spacing"), c = P(e);
107
- let u = !1;
108
- if (n) {
109
- const l = parseInt(n);
110
- Number.isNaN(l) || (u = B(
111
- e,
112
- t,
113
- l,
114
- c
115
- ));
103
+ const n = k.getConfig(e), i = P(e);
104
+ let c = !1;
105
+ const r = e.querySelector(C);
106
+ if (r) {
107
+ c = h(
108
+ r,
109
+ o,
110
+ n.columnSpacing,
111
+ i
112
+ );
113
+ const l = R(
114
+ r,
115
+ o,
116
+ n.rowSpacing
117
+ );
118
+ c = c || l;
116
119
  }
117
- if (i) {
118
- const l = parseInt(i);
119
- if (!Number.isNaN(l)) {
120
- const s = v(e, t, l);
121
- u = u || s;
122
- }
120
+ const s = e.querySelector(g);
121
+ if (s) {
122
+ const u = h(
123
+ s,
124
+ o,
125
+ n.mobileColumnSpacing,
126
+ i
127
+ );
128
+ c = c || u;
129
+ const l = R(
130
+ s,
131
+ o,
132
+ n.mobileRowSpacing
133
+ );
134
+ c = c || l;
123
135
  }
124
- u && t.apply(new S("Reapply spacing after regeneration"));
136
+ c && o.apply(new y("Reapply spacing after regeneration"));
125
137
  }
126
- function ee(o) {
127
- const { currentNode: e, documentModifier: t, afterRegenerate: r, products: n, layout: i } = o;
128
- e && x({
138
+ function oe(t) {
139
+ const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c } = t;
140
+ e && V({
129
141
  currentNode: e,
130
- documentModifier: t,
131
- products: n,
132
- layout: i,
142
+ documentModifier: o,
143
+ products: i,
144
+ layout: c,
133
145
  afterRegenerate: () => {
134
146
  setTimeout(() => {
135
- V({ currentNode: e, documentModifier: t });
136
- }, 0), r == null || r();
147
+ G({ currentNode: e, documentModifier: o });
148
+ }, 0), n == null || n();
137
149
  }
138
150
  });
139
151
  }
140
- function M() {
141
- const o = b(), { currencySettings: e } = o.recommendationConfigs;
152
+ function ne(t, e) {
153
+ return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...T(e - t.length)];
154
+ }
155
+ function x() {
156
+ const t = b(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
142
157
  return {
143
158
  code: e.value,
144
159
  symbol: e.symbol,
145
160
  alignment: e.alignment === "0" ? "before" : "after",
146
- decimalCount: parseInt(e.decimalCount) || 2,
161
+ decimalCount: Number.isNaN(o) ? 2 : o,
147
162
  decimalSeparator: e.decimalSeparator,
148
163
  thousandSeparator: e.thousandSeparator
149
164
  };
150
165
  }
151
- function A(o, e = "price") {
152
- const t = M(), r = o[e], n = (r == null ? void 0 : r[t.code]) ?? Object.values(r ?? {})[0] ?? 0;
153
- return D({
154
- price: n,
155
- currency: t
166
+ function E(t, e = "price") {
167
+ const o = x(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
168
+ return H({
169
+ price: i,
170
+ currency: o
156
171
  });
157
172
  }
158
- function j(o) {
159
- var i, c;
160
- const e = M(), t = ((i = o.original_price) == null ? void 0 : i[e.code]) ?? Object.values(o.original_price ?? {})[0] ?? 0, r = ((c = o.price) == null ? void 0 : c[e.code]) ?? Object.values(o.price ?? {})[0] ?? 0, n = t > 0 ? Math.round((t - r) / t * 100) : 0;
161
- return n > 0 ? `-${n}%` : "0%";
173
+ function W(t) {
174
+ var c, r;
175
+ const e = x(), 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;
176
+ return i > 0 ? `-${i}%` : "0%";
162
177
  }
163
- function I(o) {
164
- const { documentModifier: e, product: t, priceEl: r, oldPriceEl: n, omnibusPriceEl: i, omnibusDiscountEl: c } = o;
165
- let u = !1;
166
- if (r && "querySelector" in r) {
167
- const l = r.querySelector("strong"), s = A(t, "price");
168
- g(e, l, s) && (u = !0);
169
- }
178
+ function D(t) {
179
+ const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
180
+ let s = !1;
170
181
  if (n && "querySelector" in n) {
171
- const l = n.querySelector("strong"), s = A(t, "original_price");
172
- g(e, l, s) && (u = !0);
182
+ const u = n.querySelector("strong"), l = E(o, "price");
183
+ S(e, u, l) && (s = !0);
173
184
  }
174
185
  if (i && "querySelector" in i) {
175
- const l = i.querySelector(".omnibus-price-value"), s = A(t, "original_price");
176
- g(e, l, s) && (u = !0);
186
+ const u = i.querySelector("strong"), l = E(o, "original_price");
187
+ S(e, u, l) && (s = !0);
177
188
  }
178
189
  if (c && "querySelector" in c) {
179
- const l = c.querySelector(".omnibus-discount-value"), s = j(t);
180
- g(e, l, s) && (u = !0);
190
+ const u = c.querySelector(".omnibus-price-value"), l = E(o, "original_price");
191
+ S(e, u, l) && (s = !0);
181
192
  }
182
- return u;
193
+ if (r && "querySelector" in r) {
194
+ const u = r.querySelector(".omnibus-discount-value"), l = W(o);
195
+ S(e, u, l) && (s = !0);
196
+ }
197
+ return s;
183
198
  }
184
- function W(o) {
199
+ function Y(t) {
185
200
  const {
186
201
  documentModifier: e,
187
- product: t,
188
- imageEl: r,
189
- nameEl: n,
190
- priceEl: i,
191
- oldPriceEl: c,
192
- omnibusPriceEl: u,
193
- omnibusDiscountEl: l,
194
- buttonEl: s
195
- } = o;
196
- let d = !1;
197
- if (r && "querySelector" in r) {
198
- const a = r.querySelector("img");
199
- a && (e.modifyHtml(a).setAttribute("src", U(t.image_url)).setAttribute("alt", t.name), d = !0);
200
- const p = r.querySelector("a");
201
- p && (e.modifyHtml(p).setAttribute("href", t.url), d = !0);
202
- }
202
+ product: o,
203
+ imageEl: n,
204
+ nameEl: i,
205
+ priceEl: c,
206
+ oldPriceEl: r,
207
+ omnibusPriceEl: s,
208
+ omnibusDiscountEl: u,
209
+ buttonEl: l
210
+ } = t;
211
+ let f = !1;
203
212
  if (n && "querySelector" in n) {
204
- const a = n.querySelector("strong");
205
- g(e, a, t.name) && (d = !0);
213
+ const a = n.querySelector("img");
214
+ a && (e.modifyHtml(a).setAttribute("src", v(o.image_url)).setAttribute("alt", o.name), f = !0);
215
+ const d = n.querySelector("a");
216
+ d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
217
+ }
218
+ if (i && "querySelector" in i) {
219
+ const a = i.querySelector("strong");
220
+ S(e, a, o.name) && (f = !0);
206
221
  }
207
- if (I({
222
+ if (D({
208
223
  documentModifier: e,
209
- product: t,
210
- priceEl: i,
211
- oldPriceEl: c,
212
- omnibusPriceEl: u,
213
- omnibusDiscountEl: l
214
- }) && (d = !0), s && "querySelector" in s) {
215
- const a = s.querySelector("a.es-button") || s.querySelector("a");
216
- a && (e.modifyHtml(a).setAttribute("href", t.url), d = !0);
224
+ product: o,
225
+ priceEl: c,
226
+ oldPriceEl: r,
227
+ omnibusPriceEl: s,
228
+ omnibusDiscountEl: u
229
+ }) && (f = !0), l && "querySelector" in l) {
230
+ const a = l.querySelector("a.es-button") || l.querySelector("a");
231
+ a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
217
232
  }
218
- return d;
233
+ return f;
219
234
  }
220
- function te(o) {
221
- const { currentNode: e, documentModifier: t, products: r } = o;
222
- if (!e || !("querySelectorAll" in e))
235
+ function L(t) {
236
+ return "querySelector" in t ? t.querySelector(C) ?? t : t;
237
+ }
238
+ function I(t, e, o) {
239
+ if (!("querySelectorAll" in t))
223
240
  return !1;
224
- const n = e.querySelectorAll(
241
+ const n = t.querySelectorAll(
225
242
  `[esd-extension-block-id="${m.IMAGE}"]`
226
- ), i = e.querySelectorAll(
243
+ ), i = t.querySelectorAll(
227
244
  `[esd-extension-block-id="${m.NAME}"]`
228
- ), c = e.querySelectorAll(
245
+ ), c = t.querySelectorAll(
229
246
  `[esd-extension-block-id="${m.PRICE}"]`
230
- ), u = e.querySelectorAll(
247
+ ), r = t.querySelectorAll(
231
248
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
232
- ), l = e.querySelectorAll(
249
+ ), s = t.querySelectorAll(
233
250
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
234
- ), s = e.querySelectorAll(
251
+ ), u = t.querySelectorAll(
235
252
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
236
- ), d = e.querySelectorAll(
253
+ ), l = t.querySelectorAll(
237
254
  `[esd-extension-block-id="${m.BUTTON}"]`
238
- );
239
- if (n.length !== r.length)
240
- return !1;
255
+ ), f = Math.min(n.length, o.length);
241
256
  let a = !1;
242
- return r.forEach((p, f) => {
243
- const O = W({
244
- documentModifier: t,
245
- product: p,
246
- imageEl: n[f] ?? null,
247
- nameEl: i[f] ?? null,
248
- priceEl: c[f] ?? null,
249
- oldPriceEl: u[f] ?? null,
250
- omnibusPriceEl: l[f] ?? null,
251
- omnibusDiscountEl: s[f] ?? null,
252
- buttonEl: d[f] ?? null
257
+ for (let d = 0; d < f; d++) {
258
+ const U = Y({
259
+ documentModifier: e,
260
+ product: o[d],
261
+ imageEl: n[d] ?? null,
262
+ nameEl: i[d] ?? null,
263
+ priceEl: c[d] ?? null,
264
+ oldPriceEl: r[d] ?? null,
265
+ omnibusPriceEl: s[d] ?? null,
266
+ omnibusDiscountEl: u[d] ?? null,
267
+ buttonEl: l[d] ?? null
253
268
  });
254
- a = a || O;
255
- }), a && t.apply(new S("Updated product content in-place")), !0;
269
+ a = a || U;
270
+ }
271
+ return a;
256
272
  }
257
- function oe(o) {
258
- const { currentNode: e, documentModifier: t } = o;
273
+ function re(t) {
274
+ const { currentNode: e, documentModifier: o, products: n } = t;
259
275
  if (!e || !("querySelectorAll" in e))
260
276
  return !1;
261
- const n = b().recommendationProducts;
262
- if (n.length === 0)
277
+ const i = L(e);
278
+ if (!("querySelectorAll" in i) || i.querySelectorAll(
279
+ `[esd-extension-block-id="${m.IMAGE}"]`
280
+ ).length !== n.length)
281
+ return !1;
282
+ let r = I(i, o, n);
283
+ if ("querySelector" in e) {
284
+ const s = e.querySelector(g);
285
+ if (s) {
286
+ const u = I(
287
+ s,
288
+ o,
289
+ n
290
+ );
291
+ r = r || u;
292
+ }
293
+ }
294
+ return r && o.apply(new y("Updated product content in-place")), !0;
295
+ }
296
+ function O(t, e, o) {
297
+ if (!("querySelectorAll" in t))
263
298
  return !1;
264
- const i = e.querySelectorAll(
299
+ const n = t.querySelectorAll(
265
300
  `[esd-extension-block-id="${m.PRICE}"]`
266
- ), c = e.querySelectorAll(
301
+ ), i = t.querySelectorAll(
267
302
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
268
- ), u = e.querySelectorAll(
303
+ ), c = t.querySelectorAll(
269
304
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
270
- ), l = e.querySelectorAll(
305
+ ), r = t.querySelectorAll(
271
306
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
272
- );
273
- let s = !1;
274
- return n.forEach((d, a) => {
275
- I({
276
- documentModifier: t,
277
- product: d,
278
- priceEl: i[a] ?? null,
279
- oldPriceEl: c[a] ?? null,
280
- omnibusPriceEl: u[a] ?? null,
281
- omnibusDiscountEl: l[a] ?? null
282
- }) && (s = !0);
283
- }), s && t.apply(new S("Updated price formatting in-place")), s;
307
+ ), s = Math.min(n.length, o.length);
308
+ let u = !1;
309
+ for (let l = 0; l < s; l++)
310
+ D({
311
+ documentModifier: e,
312
+ product: o[l],
313
+ priceEl: n[l] ?? null,
314
+ oldPriceEl: i[l] ?? null,
315
+ omnibusPriceEl: c[l] ?? null,
316
+ omnibusDiscountEl: r[l] ?? null
317
+ }) && (u = !0);
318
+ return u;
284
319
  }
285
- function re(o) {
286
- const { currentNode: e, documentModifier: t, currency: r } = o, n = E(e);
287
- if (!n)
320
+ function ie(t) {
321
+ const { currentNode: e, documentModifier: o } = t;
322
+ if (!e || !("querySelectorAll" in e))
323
+ return !1;
324
+ const i = b().recommendationProducts;
325
+ if (i.length === 0)
326
+ return !1;
327
+ const c = L(e);
328
+ let r = O(c, o, i);
329
+ if ("querySelector" in e) {
330
+ const s = e.querySelector(g);
331
+ if (s) {
332
+ const u = O(s, o, i);
333
+ r = r || u;
334
+ }
335
+ }
336
+ return r && o.apply(new y("Updated price formatting in-place")), r;
337
+ }
338
+ function ce(t) {
339
+ const { currentNode: e, documentModifier: o, currency: n } = t, i = A(e);
340
+ if (!i)
288
341
  return;
289
- const i = r.alignment === "before" ? "0" : "1", c = (u, l) => {
290
- t.modifyHtml(n).setAttribute(u, l);
342
+ const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
343
+ o.modifyHtml(i).setAttribute(s, u);
291
344
  };
292
- c(y.CURRENCY, r.code), c(y.SYMBOL, r.symbol), c(y.ALIGNMENT, i), c(y.THOUSAND_SEPARATOR, r.thousandSeparator), c(y.DECIMAL_SEPARATOR, r.decimalSeparator), c(y.DECIMAL_COUNT, r.decimalCount.toString()), t.apply(new S("Update currency attributes"));
345
+ r(p.CURRENCY, n.code), r(p.SYMBOL, n.symbol), r(p.ALIGNMENT, c), r(p.THOUSAND_SEPARATOR, n.thousandSeparator), r(p.DECIMAL_SEPARATOR, n.decimalSeparator), r(p.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new y("Update currency attributes"));
293
346
  }
294
347
  export {
295
- A as formatProductPrice,
296
- E as getBlockElement,
297
- N as getCardComposition,
348
+ ne as adjustProductsToSize,
349
+ E as formatProductPrice,
350
+ A as getBlockElement,
351
+ w as getCardComposition,
298
352
  P as getCurrentLayout,
299
- V as reapplySpacing,
300
- $ as regenerateMobileProductRows,
301
- x as regenerateProductRows,
302
- ee as regenerateProductRowsWithStyles,
303
- re as setCurrencyAttributes,
304
- oe as updatePricesInPlace,
305
- te as updateProductContentInPlace,
306
- W as updateSingleProductContent
353
+ G as reapplySpacing,
354
+ j as regenerateMobileProductRows,
355
+ V as regenerateProductRows,
356
+ oe as regenerateProductRowsWithStyles,
357
+ ce as setCurrencyAttributes,
358
+ ie as updatePricesInPlace,
359
+ re as updateProductContentInPlace,
360
+ Y as updateSingleProductContent
307
361
  };