@useinsider/guido 3.0.0 → 3.1.0

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