@useinsider/guido 3.23.0-beta.9f6bfbf → 3.23.0-beta.a35efcf

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 (55) hide show
  1. package/README.md +9 -1
  2. package/dist/@types/config/schemas.js +26 -26
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +88 -86
  5. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useModuleRepair.js +30 -23
  8. package/dist/config/migrator/index.js +16 -16
  9. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  10. package/dist/enums/academy.js +2 -1
  11. package/dist/extensions/Blocks/Items/block.js +77 -115
  12. package/dist/extensions/Blocks/Items/constants/currency.js +14 -59
  13. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +22 -33
  14. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +51 -62
  15. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +17 -18
  16. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +31 -42
  17. package/dist/extensions/Blocks/Items/controls/settingsControl.js +120 -141
  18. package/dist/extensions/Blocks/Items/enums/controlEnums.js +1 -1
  19. package/dist/extensions/Blocks/Items/extension.js +8 -9
  20. package/dist/extensions/Blocks/Items/items.css.js +0 -19
  21. package/dist/extensions/Blocks/Items/settingsPanel.js +25 -34
  22. package/dist/extensions/Blocks/Items/template.js +212 -250
  23. package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -1
  24. package/dist/guido.css +1 -1
  25. package/dist/package.json.js +2 -2
  26. package/dist/src/@types/config/schemas.d.ts +4 -4
  27. package/dist/src/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts +2 -0
  28. package/dist/src/composables/useConfig.d.ts +2 -2
  29. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  30. package/dist/src/config/migrator/index.d.ts +1 -4
  31. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  32. package/dist/src/enums/academy.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/Items/block.d.ts +9 -6
  34. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +0 -32
  35. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -1
  36. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  37. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -4
  38. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +0 -3
  39. package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -12
  40. package/dist/src/stores/config.d.ts +20 -20
  41. package/dist/src/stores/editor.d.ts +25 -0
  42. package/dist/src/utils/itemsCurrencyRepair.d.ts +1 -5
  43. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  44. package/dist/static/stripo-runtime-manifest.json.js +1 -1
  45. package/dist/stores/editor.js +15 -14
  46. package/dist/utils/itemsCurrencyRepair.js +24 -29
  47. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  48. package/dist/utils/pairProductVariables.js +99 -119
  49. package/package.json +2 -2
  50. package/dist/config/migrator/itemsPriceFormatMigrator.js +0 -20
  51. package/dist/extensions/Blocks/Items/controls/priceFormat.js +0 -145
  52. package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +0 -185
  53. package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +0 -1
  54. package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +0 -23
  55. package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +0 -61
@@ -1,177 +1,147 @@
1
- import { escapeHtml as O } from "../../../utils/htmlEscape.js";
2
- import { BlockType as P, BlockAttr as x } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { blockCellPadMarker as k, NAME_VERTICAL_MAX_WIDTH as st, nameMaxWidthFor as lt, blockCellPaddingFor as Y } from "./constants/cardLayout.js";
4
- import { ITEMS_PRICE_FORMAT_ATTR as w, ITEMS_CURRENCY_ATTR as f, currencyPositionFromLocation as rt } from "./constants/currency.js";
5
- import { ItemsBlockId as A } from "./enums/controlEnums.js";
6
- import { productPairs as b, templateFirstLine as ct } from "./enums/productEnums.js";
7
- import { ItemInCartOptions as it, SETTINGS_ENUMS as N, DefaultConfigValues as S } from "./enums/settingsEnums.js";
8
- import nt from "./layouts/horizontal.html.js";
9
- import ot from "./layouts/vertical.html.js";
10
- import { deriveItemNumber as dt, escapeReplacement as X } from "./utils/nodeConfigUtils.js";
11
- import { formatItemsDummyPrice as pt } from "./utils/priceFormatOps.js";
12
- let [W] = b.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [M] = b.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [C] = b.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [B] = b.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [K] = b.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
13
- const F = (e, t) => e.split(";").map((a) => a.trim()).filter((a) => !a.toLowerCase().startsWith(t.toLowerCase())).join("; ").replace(/;\s*$/, ""), V = (e) => F(e, "text-align"), D = (e, t) => {
14
- const a = new RegExp(`${t}\\s*:\\s*([^;]+)`, "i"), s = e.match(a);
1
+ import { escapeHtml as b } from "../../../utils/htmlEscape.js";
2
+ import { BlockType as R, BlockAttr as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { blockCellPadMarker as U, NAME_VERTICAL_MAX_WIDTH as Z, nameMaxWidthFor as tt, blockCellPaddingFor as Q } from "./constants/cardLayout.js";
4
+ import { ITEMS_CURRENCY_ATTR as k, currencyPositionFromLocation as Y } from "./constants/currency.js";
5
+ import { ItemsBlockId as m } from "./enums/controlEnums.js";
6
+ import { productPairs as P, templateFirstLine as et } from "./enums/productEnums.js";
7
+ import { ItemInCartOptions as at, SETTINGS_ENUMS as S, DefaultConfigValues as g } from "./enums/settingsEnums.js";
8
+ import st from "./layouts/horizontal.html.js";
9
+ import lt from "./layouts/vertical.html.js";
10
+ import { deriveItemNumber as rt, escapeReplacement as z } from "./utils/nodeConfigUtils.js";
11
+ let [B] = P.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [M] = P.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [F] = P.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [x] = P.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [G] = P.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
12
+ const L = (a, t) => a.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCase().startsWith(t.toLowerCase())).join("; ").replace(/;\s*$/, ""), v = (a) => L(a, "text-align"), D = (a, t) => {
13
+ const l = new RegExp(`${t}\\s*:\\s*([^;]+)`, "i"), s = a.match(l);
15
14
  return s ? s[1].trim() : null;
16
- }, v = (e) => {
17
- var a;
18
- const t = (a = D(e || "", "text-align")) == null ? void 0 : a.toLowerCase();
15
+ }, V = (a) => {
16
+ var l;
17
+ const t = (l = D(a || "", "text-align")) == null ? void 0 : l.toLowerCase();
19
18
  return t && ["left", "center", "right", "justify"].includes(t) ? t : "center";
20
- }, $t = (e, t, a = st) => {
21
- const s = ["white-space", "overflow", "text-overflow", "max-width"].reduce((i, o) => F(i, o), e), c = t ? `white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${a}` : `max-width: ${a}`;
22
- return [s, c].map((i) => i.trim().replace(/;\s*$/, "")).filter(Boolean).join("; ");
23
- }, L = (e) => `<tr>${e}</tr>`, j = (e, t, a, s, c) => c ? { formatedAttr: "", curencyAttr: "", currencySymbolAttr: "", singlePriceAttr: "" } : {
24
- formatedAttr: `data-formated="${e ? "true" : "false"}"`,
25
- curencyAttr: `${f.POSITION}="${rt(a)}"`,
26
- currencySymbolAttr: t ? `${f.SYMBOL}="${t}"` : "",
27
- singlePriceAttr: `data-single_price="${s ? "true" : "false"}"`
28
- }, q = (e, t, a, s) => {
29
- if (s)
30
- return pt({
31
- amount: e,
32
- format: s,
33
- symbol: t ?? S.productPriceCurrencySymbolControlValue,
34
- alignment: a ?? S.productPriceCurrencyLocationControlValue
35
- });
36
- if (t && t.trim()) {
37
- const c = `${t.trim()}`;
38
- return (a || "0") === "1" ? `${e}&nbsp;${c}` : `${c}&nbsp;${e}`;
39
- }
40
- return e;
41
- }, ut = (e, t, a, s) => {
42
- const c = t ?? S.productPriceCurrencySymbolControlValue, i = a ?? S.productPriceCurrencyLocationControlValue;
43
- return [
44
- [w.SINGLE_PRICE, s ? "true" : "false"],
45
- [w.SYMBOL, c],
46
- [w.ALIGNMENT, i],
47
- [w.THOUSAND_SEPARATOR, e.thousandSeparator],
48
- [w.DECIMAL_SEPARATOR, e.decimalSeparator],
49
- [w.DECIMAL_COUNT, String(e.decimalCount)]
50
- ].map(([o, n]) => `${o}="${O(n)}"`).join(" ");
51
- }, Et = (e, t, a, s) => {
52
- const c = a || S.productImageHeight, i = (s == null ? void 0 : s.imageVisible) === !1 ? "display: none; " : "";
53
- return L(`
19
+ }, ct = (a, t, l = Z) => {
20
+ const s = ["white-space", "overflow", "text-overflow", "max-width"].reduce((c, i) => L(c, i), a), o = t ? `white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${l}` : `max-width: ${l}`;
21
+ return [s, o].map((c) => c.trim().replace(/;\s*$/, "")).filter(Boolean).join("; ");
22
+ }, w = (a) => `<tr>${a}</tr>`, it = (a, t, l, s) => {
23
+ const o = l || g.productImageHeight, c = (s == null ? void 0 : s.imageVisible) === !1 ? "display: none; " : "";
24
+ return w(`
54
25
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
55
26
  align="center"
56
- esd-extension-block-id="${A.IMAGE}"
27
+ esd-extension-block-id="${m.IMAGE}"
57
28
  data-slot-1=""
58
29
  product-attr="imageSrc"
59
- data-type="${e}"
30
+ data-type="${a}"
60
31
  data-number="${t}"
61
- style="${i}font-size: 0px;">
32
+ style="${c}font-size: 0px;">
62
33
  <a class="document-node-component ng-star-inserted"
63
34
  target="_blank"
64
35
  href="#!">
65
36
  <img class="adapt-img document-node-component ng-star-inserted"
66
37
  style="object-fit: contain;"
67
- src="${W}"
38
+ src="${B}"
68
39
  alt="${M}"
69
- width="${c}"
70
- height="${c}">
40
+ width="${o}"
41
+ height="${o}">
71
42
  </a>
72
43
  </td>
73
44
  `);
74
- }, Tt = (e, t) => `
75
- <${P.BLOCK_IMAGE}
76
- ${x.BLOCK_IMAGE.src}="${W}"
77
- ${x.BLOCK_IMAGE.alt}="${M}"
78
- ${x.BLOCK_IMAGE.href}="#!"
79
- ${x.BLOCK_IMAGE.width}="${S.productImageWidth}"
80
- ${x.BLOCK_IMAGE.height}="${S.productImageWidth}"
81
- esd-extension-block-id="${A.IMAGE}"
45
+ }, nt = (a, t) => `
46
+ <${R.BLOCK_IMAGE}
47
+ ${N.BLOCK_IMAGE.src}="${B}"
48
+ ${N.BLOCK_IMAGE.alt}="${M}"
49
+ ${N.BLOCK_IMAGE.href}="#!"
50
+ ${N.BLOCK_IMAGE.width}="${g.productImageWidth}"
51
+ ${N.BLOCK_IMAGE.height}="${g.productImageWidth}"
52
+ esd-extension-block-id="${m.IMAGE}"
82
53
  data-slot-1
83
54
  product-attr="imageSrc"
84
- data-type="${e}"
55
+ data-type="${a}"
85
56
  data-number="${t}"
86
57
  />
87
- `, _t = (e, t, a, s, c) => {
88
- const i = lt(c), o = `
58
+ `, ot = (a, t, l, s, o) => {
59
+ const c = tt(o), i = `
89
60
  word-wrap: break-word;
90
61
  white-space: nowrap;
91
62
  overflow: hidden;
92
63
  text-overflow: ellipsis;
93
64
  width: 100%;
94
- max-width: ${i};
65
+ max-width: ${c};
95
66
  `;
96
67
  if (t) {
97
- const n = v(a), r = V(a || o), p = D(r, "font-weight"), l = D(r, "font-style"), $ = p === "bold" || p === "700", T = l === "italic", _ = F(
98
- F(
99
- F(r, "font-weight"),
68
+ const n = V(l), r = v(l || i), p = D(r, "font-weight"), e = D(r, "font-style"), E = p === "bold" || p === "700", u = e === "italic", _ = L(
69
+ L(
70
+ L(r, "font-weight"),
100
71
  "font-style"
101
72
  ),
102
73
  "text-decoration"
103
- ), I = (s == null ? void 0 : s.nameVisible) === !1 ? "display: none;" : "display: table-cell;", u = $t(_, (s == null ? void 0 : s.nameTrimming) ?? !0, i), E = ` style="${O(u)}"`;
74
+ ), I = (s == null ? void 0 : s.nameVisible) === !1 ? "display: none;" : "display: table-cell;", $ = ct(_, (s == null ? void 0 : s.nameTrimming) ?? !0, c), T = ` style="${b($)}"`;
104
75
  let d = M;
105
- return $ && (d = `<strong>${d}</strong>`), T && (d = `<em>${d}</em>`), L(`
76
+ return E && (d = `<strong>${d}</strong>`), u && (d = `<em>${d}</em>`), w(`
106
77
  <td class="esd-block-text es-p5"
107
78
  align="${n}"
108
79
  width="100%"
109
80
  colspan="2"
110
- data-type="${e}"
111
- esd-extension-block-id="${A.NAME}"
81
+ data-type="${a}"
82
+ esd-extension-block-id="${m.NAME}"
112
83
  style="${I}">
113
84
  <p contenteditable="false"
114
85
  path="1"
115
86
  product-attr="name"
116
- data-slot-2${E}>
87
+ data-slot-2${T}>
117
88
  ${d}
118
89
  </p>
119
90
  </td>
120
91
  `);
121
92
  }
122
- return `<${P.BLOCK_TEXT}
93
+ return `<${R.BLOCK_TEXT}
123
94
  width="100%"
124
95
  align="center"
125
96
  colspan="2"
126
97
  class="es-p5"
127
- data-type="${e}"
128
- esd-extension-block-id="${A.NAME}"
98
+ data-type="${a}"
99
+ esd-extension-block-id="${m.NAME}"
129
100
  >
130
101
  <p contenteditable="false"
131
102
  product-attr="name"
132
103
  data-slot-2
133
- style="${o}">
104
+ style="${i}">
134
105
  ${M}
135
106
  </p>
136
- </${P.BLOCK_TEXT}>
107
+ </${R.BLOCK_TEXT}>
137
108
  `;
138
- }, It = (e, t, a, s, c, i, o, n, r, p, l) => {
139
- const $ = q(C, s, c, l), { formatedAttr: T, curencyAttr: _, currencySymbolAttr: I, singlePriceAttr: u } = j(
140
- a,
141
- s,
142
- c,
143
- n,
144
- l
145
- ), E = r === N.ORIENTATION.VERTICAL, d = Y(E);
146
- if (i) {
147
- const y = V(o || "color: #060606; white-space: nowrap; font-size: 20px;"), h = v(o), R = p ? "" : ' style="display: none;"';
148
- return L(`
109
+ }, dt = (a, t, l, s, o, c, i, n, r, p) => {
110
+ let e = F;
111
+ if (s && s.trim()) {
112
+ const O = `${s.trim()}`;
113
+ e = (o || "0") === "1" ? `${F}&nbsp;${O}` : `${O}&nbsp;${F}`;
114
+ }
115
+ const E = Y(o), u = `data-formated="${l ? "true" : "false"}"`, _ = `${k.POSITION}="${E}"`, I = s ? `${k.SYMBOL}="${s}"` : "", $ = `data-single_price="${n ? "true" : "false"}"`, T = r === S.ORIENTATION.VERTICAL, d = Q(T);
116
+ if (c) {
117
+ const h = v(i || "color: #060606; white-space: nowrap; font-size: 20px;"), A = V(i), y = p ? "" : ' style="display: none;"';
118
+ return w(`
149
119
  <td class="esd-block-text items-block-price${d}"
150
- align="${h}"
151
- esd-extension-block-id="${A.PRICE}"
152
- ${k(E)}
120
+ align="${A}"
121
+ esd-extension-block-id="${m.PRICE}"
122
+ ${U(T)}
153
123
  width="100%"
154
- ${R}>
124
+ ${y}>
155
125
  <p product-attr="price"
156
126
  contenteditable="false"
157
127
  data-slot-4
158
- data-type="${e}"
128
+ data-type="${a}"
159
129
  data-number="${t}"
160
- ${T}
130
+ ${u}
161
131
  ${_}
162
132
  ${I}
163
- ${u}
164
- style="${O(y)}">
165
133
  ${$}
134
+ style="${b(h)}">
135
+ ${e}
166
136
  </p>
167
137
  </td>
168
138
  `);
169
139
  }
170
140
  return `
171
- <${P.BLOCK_TEXT}
172
- esd-extension-block-id="${A.PRICE}"
141
+ <${R.BLOCK_TEXT}
142
+ esd-extension-block-id="${m.PRICE}"
173
143
  class="items-block-price ${d}"
174
- ${k(E)}
144
+ ${U(T)}
175
145
  width="100%"
176
146
  align="center"
177
147
  >
@@ -179,128 +149,127 @@ const F = (e, t) => e.split(";").map((a) => a.trim()).filter((a) => !a.toLowerCa
179
149
  product-attr="price"
180
150
  contenteditable="false"
181
151
  data-slot-4
182
- data-type="${e}"
152
+ data-type="${a}"
183
153
  data-number="${t}"
184
- ${T}
154
+ ${u}
185
155
  ${_}
186
156
  ${I}
187
- ${u}
188
- >
189
157
  ${$}
158
+ >
159
+ ${e}
190
160
  </p>
191
- </${P.BLOCK_TEXT}>
161
+ </${R.BLOCK_TEXT}>
192
162
  `;
193
- }, mt = (e, t, a, s, c, i, o = !0, n, r, p, l) => {
194
- const $ = q(B, s, c, l), { formatedAttr: T, curencyAttr: _, currencySymbolAttr: I, singlePriceAttr: u } = j(
195
- a,
196
- s,
197
- c,
198
- r,
199
- l
200
- ), E = o ? "" : ' style="display: none;"', d = p === N.ORIENTATION.VERTICAL, m = Y(d);
201
- if (i) {
202
- const h = V(n || "color: #cc0000; white-space: nowrap; font-size: 19px;"), R = v(n);
203
- return L(`
204
- <td class="esd-block-text items-block-price${m}"
205
- esd-extension-block-id="${A.ORIGINAL_PRICE}"
206
- ${k(d)}
163
+ }, pt = (a, t, l, s, o, c, i = !0, n, r, p) => {
164
+ let e = x;
165
+ if (s && s.trim()) {
166
+ const h = `${s.trim()}`;
167
+ e = (o || "0") === "1" ? `${x}&nbsp;${h}` : `${h}&nbsp;${x}`;
168
+ }
169
+ const E = Y(o), u = `data-formated="${l ? "true" : "false"}"`, _ = `${k.POSITION}="${E}"`, I = s ? `${k.SYMBOL}="${s}"` : "", $ = i ? "" : ' style="display: none;"', T = `data-single_price="${r ? "true" : "false"}"`, d = p === S.ORIENTATION.VERTICAL, O = Q(d);
170
+ if (c) {
171
+ const A = v(n || "color: #cc0000; white-space: nowrap; font-size: 19px;"), y = V(n);
172
+ return w(`
173
+ <td class="esd-block-text items-block-price${O}"
174
+ esd-extension-block-id="${m.ORIGINAL_PRICE}"
175
+ ${U(d)}
207
176
  width="100%"
208
- align="${R}"${E}>
177
+ align="${y}"${$}>
209
178
  <p
210
179
  product-attr="originalPrice"
211
180
  contenteditable="false"
212
181
  data-slot-5
213
- data-type="${e}"
182
+ data-type="${a}"
214
183
  data-number="${t}"
215
- ${T}
184
+ ${u}
216
185
  ${_}
217
186
  ${I}
218
- ${u}
219
- style="${O(h)}">
220
- <s>${$}</s>
187
+ ${T}
188
+ style="${b(A)}">
189
+ <s>${e}</s>
221
190
  </p>
222
191
  </td>
223
192
  `);
224
193
  }
225
194
  return `
226
- <${P.BLOCK_TEXT}
227
- class="items-block-price ${m}"
228
- esd-extension-block-id="${A.ORIGINAL_PRICE}"
229
- ${k(d)}
195
+ <${R.BLOCK_TEXT}
196
+ class="items-block-price ${O}"
197
+ esd-extension-block-id="${m.ORIGINAL_PRICE}"
198
+ ${U(d)}
230
199
  width="100%"
231
200
  align="center"
232
- ${o ? "" : 'style="display: none;"'}
201
+ ${i ? "" : 'style="display: none;"'}
233
202
  >
234
203
  <p
235
204
  product-attr="originalPrice"
236
205
  contenteditable="false"
237
206
  data-slot-5
238
207
  style="color: #cc0000"
239
- data-type="${e}"
208
+ data-type="${a}"
240
209
  data-number="${t}"
241
- ${T}
210
+ ${u}
242
211
  ${_}
243
212
  ${I}
244
- ${u}
213
+ ${T}
245
214
  >
246
- <s>${$}</s>
215
+ <s>${e}</s>
247
216
  </p>
248
- </${P.BLOCK_TEXT}>
217
+ </${R.BLOCK_TEXT}>
249
218
  `;
250
- }, At = (e = !0, t, a) => {
251
- const s = e ? "" : 'style="display: none;"';
219
+ }, $t = (a = !0, t, l) => {
220
+ const s = a ? "" : 'style="display: none;"';
252
221
  if (t) {
253
- const c = "font-size: 14px;", i = v(a), o = V(a || c);
254
- return L(`
222
+ const o = "font-size: 14px;", c = V(l), i = v(l || o);
223
+ return w(`
255
224
  <td class="esd-block-text es-p5 document-node-component default-block-component selectable"
256
- width="100%" align="${i}"
257
- esd-extension-block-id="${A.QUANTITY}"
225
+ width="100%" align="${c}"
226
+ esd-extension-block-id="${m.QUANTITY}"
258
227
  ${s}>
259
228
  <p product-attr="quantity"
260
229
  data-slot-3=""
261
230
  contenteditable="false"
262
231
  width="100%"
263
232
  path="1"
264
- style="${O(o)}">
265
- ${K}
233
+ style="${b(i)}">
234
+ ${G}
266
235
  </p>
267
236
  </td>
268
237
  `);
269
238
  }
270
239
  return `
271
- <${P.BLOCK_TEXT}
240
+ <${R.BLOCK_TEXT}
272
241
  width="100%"
273
242
  align="center"
274
243
  class="es-p5"
275
- esd-extension-block-id="${A.QUANTITY}"
276
- ${e ? "" : 'style="display: none;"'}
244
+ esd-extension-block-id="${m.QUANTITY}"
245
+ ${a ? "" : 'style="display: none;"'}
277
246
  >
278
247
  <p
279
248
  product-attr="quantity"
280
249
  data-slot-3
281
250
  contenteditable="false"
282
251
  width="100%">
283
- ${K}
252
+ ${G}
284
253
  </p>
285
- </${P.BLOCK_TEXT}>
254
+ </${R.BLOCK_TEXT}>
286
255
  `;
287
- }, Ot = (e, t, a = "Buy", s, c, i = !0, o = !0) => {
256
+ }, Et = (a, t, l = "Buy", s, o, c = !0, i = !0) => {
288
257
  if (s) {
289
- const n = D(c || "", "background") || D(c || "", "background-color"), r = n ? `border-width: 0px; background: ${n};` : "border-width: 0px;", p = i ? "es-fw" : "es-il", l = (c || "").replace("border-width: 0;", ""), T = /(?:^|;)\s*padding(?:-(?:top|right|bottom|left))?\s*:/.test(l) ? "" : " padding: 5px 12px;", I = /(?:^|;)\s*font-family\s*:/.test(l) ? "" : " font-family: inherit;", u = l.trim(), E = u && !u.endsWith(";") ? ";" : "";
290
- return L(`
258
+ const n = D(o || "", "background") || D(o || "", "background-color"), r = n ? `border-width: 0px; background: ${n};` : "border-width: 0px;", p = c ? "es-fw" : "es-il", e = (o || "").replace("border-width: 0;", ""), u = /(?:^|;)\s*padding(?:-(?:top|right|bottom|left))?\s*:/.test(e) ? "" : " padding: 5px 12px;", I = /(?:^|;)\s*font-family\s*:/.test(e) ? "" : " font-family: inherit;", $ = e.trim(), T = $ && !$.endsWith(";") ? ";" : "";
259
+ return w(`
291
260
  <td class="esd-block-button ins-button default-block-component selectable"
292
- align="center" width="100%" name="buy-button" caption="${O(a)}"
293
- esd-extension-block-id="${A.BUTTON}"
294
- product-attr="button" data-slot-6="" data-type="${e}" data-number="${t}"
295
- ${o ? "" : ' style="display: none;"'}>
261
+ align="center" width="100%" name="buy-button" caption="${b(l)}"
262
+ esd-extension-block-id="${m.BUTTON}"
263
+ product-attr="button" data-slot-6="" data-type="${a}" data-number="${t}"
264
+ ${i ? "" : ' style="display: none;"'}>
296
265
  <p style="margin: 0; line-height: unset;">
297
- <span class="es-button-border ${p}" style="${O(r)}">
266
+ <span class="es-button-border ${p}" style="${b(r)}">
298
267
  <a
299
268
  class="es-button"
300
269
  href="#!"
301
270
  target="_blank"
302
- style="${O(u)}${E}${T}${I}">
303
- ${O(a)}
271
+ style="${b($)}${T}${u}${I}">
272
+ ${b(l)}
304
273
  </a>
305
274
  </span>
306
275
  </p>
@@ -308,159 +277,152 @@ const F = (e, t) => e.split(";").map((a) => a.trim()).filter((a) => !a.toLowerCa
308
277
  `);
309
278
  }
310
279
  return `
311
- <${P.BLOCK_BUTTON}
280
+ <${R.BLOCK_BUTTON}
312
281
  width="100%"
313
282
  class="ins-button"
314
283
  name="buy-button"
315
- caption="${O(a)}"
284
+ caption="${b(l)}"
316
285
  align="center"
317
- esd-extension-block-id="${A.BUTTON}"
286
+ esd-extension-block-id="${m.BUTTON}"
318
287
  product-attr="button"
319
288
  data-slot-6
320
- data-type="${e}"
289
+ data-type="${a}"
321
290
  data-number="${t}"
322
- >${O(a)}
323
- </${P.BLOCK_BUTTON}>
291
+ >${b(l)}
292
+ </${R.BLOCK_BUTTON}>
324
293
  `;
325
- }, Pt = (e, t, a, s = !0, c = !0) => {
326
- const i = t === N.ORIENTATION.VERTICAL, o = a === "horizontal";
327
- if (i) {
328
- const n = !o, r = n || !c ? "100%" : "50%", p = n || !s ? "100%" : "50%";
329
- let l = e.replace(
294
+ }, Tt = (a, t, l, s = !0, o = !0) => {
295
+ const c = t === S.ORIENTATION.VERTICAL, i = l === "horizontal";
296
+ if (c) {
297
+ const n = !i, r = n || !o ? "100%" : "50%", p = n || !s ? "100%" : "50%";
298
+ let e = a.replace(
330
299
  /<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
331
- ($) => $.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
300
+ (E) => E.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
332
301
  );
333
- return l = l.replace(
302
+ return e = e.replace(
334
303
  /<td\s+[^>]*class="([^"]*product-original-price-class[^"]*)"[^>]*>/gi,
335
- ($) => $.replace(/width="[^"]*"/gi, `width="${p}"`).replace(/width:\s*[^;]+;/gi, `width: ${p};`)
336
- ), l;
304
+ (E) => E.replace(/width="[^"]*"/gi, `width="${p}"`).replace(/width:\s*[^;]+;/gi, `width: ${p};`)
305
+ ), e;
337
306
  }
338
- return o ? e : e.replace(
307
+ return i ? a : a.replace(
339
308
  /<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
340
309
  (n) => /style\s*=\s*"/i.test(n) ? n.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : n.replace(/>$/, ' style="display: none;">')
341
310
  ).replace(
342
311
  /<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
343
312
  (n) => n.replace(/display:\s*none;?/gi, "display: table-cell;")
344
313
  );
345
- }, ht = (e) => e ? `<td align="center"
314
+ }, ut = (a) => a ? `<td align="center"
346
315
  esd-extension-block-id="items-block"
347
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block">` : ct, Q = (e, t, a, s, c, i, o, n, r, p, l, $, T, _ = "horizontal", I, u, E, d, m) => {
348
- const y = p !== void 0 ? ` data-nodup="${p}"` : "", h = `data-type="${t}" data-number="${a}"`, R = m ? ` ${X(
349
- ut(m, o, n, d)
350
- )}` : "", U = `${h} data-orientation="${s}"${y}${R}`, g = r == null ? void 0 : r["data-product_image_control_image-height"], G = i ? Et(t, a, g, l) : Tt(t, a), J = (l == null ? void 0 : l.buttonLabel) || "Buy", Z = (l == null ? void 0 : l.buttonFullWidth) !== void 0 ? l.buttonFullWidth : !0, tt = t === N.ITEMS_TYPE.BROWSED_ITEMS ? !1 : l == null ? void 0 : l.quantityControlEnabled, et = (l == null ? void 0 : l.buttonVisible) !== void 0 ? l.buttonVisible : (r == null ? void 0 : r["data-product_button_control_enabled"]) !== "false", H = (l == null ? void 0 : l.priceVisible) !== void 0 ? l.priceVisible : (r == null ? void 0 : r["data-product_price_control_enabled"]) !== "false", z = (l == null ? void 0 : l.originalPriceVisible) !== void 0 ? l.originalPriceVisible : (r == null ? void 0 : r["data-product_original_price_control_enabled"]) !== "false", at = e.replace("{-{-TEMPLATE_FIRST_LINE-}-}", ht(i)).replace("{-{-PRODUCT_IMAGE-}-}", G).replace("{-{-PRODUCT_NAME-}-}", _t(t, i, $, l, s)).replaceAll(
316
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block">` : et, H = (a, t, l, s, o, c, i, n, r, p, e, E, u, _ = "horizontal", I, $, T, d) => {
317
+ const O = p !== void 0 ? ` data-nodup="${p}"` : "", A = `${`data-type="${t}" data-number="${l}"`} data-orientation="${s}"${O}`, y = r == null ? void 0 : r["data-product_image_control_image-height"], X = c ? it(t, l, y, e) : nt(t, l), j = (e == null ? void 0 : e.buttonLabel) || "Buy", q = (e == null ? void 0 : e.buttonFullWidth) !== void 0 ? e.buttonFullWidth : !0, C = t === S.ITEMS_TYPE.BROWSED_ITEMS ? !1 : e == null ? void 0 : e.quantityControlEnabled, f = (e == null ? void 0 : e.buttonVisible) !== void 0 ? e.buttonVisible : (r == null ? void 0 : r["data-product_button_control_enabled"]) !== "false", K = (e == null ? void 0 : e.priceVisible) !== void 0 ? e.priceVisible : (r == null ? void 0 : r["data-product_price_control_enabled"]) !== "false", W = (e == null ? void 0 : e.originalPriceVisible) !== void 0 ? e.originalPriceVisible : (r == null ? void 0 : r["data-product_original_price_control_enabled"]) !== "false", J = a.replace("{-{-TEMPLATE_FIRST_LINE-}-}", ut(c)).replace("{-{-PRODUCT_IMAGE-}-}", X).replace("{-{-PRODUCT_NAME-}-}", ot(t, c, E, e, s)).replaceAll(
351
318
  "{-{-PRODUCT_PRICE-}-}",
352
- X(It(
319
+ z(dt(
353
320
  t,
354
- a,
355
- c,
321
+ l,
356
322
  o,
357
- n,
358
323
  i,
324
+ n,
325
+ c,
359
326
  I,
360
327
  d,
361
328
  s,
362
- H,
363
- m
329
+ K
364
330
  ))
365
331
  ).replaceAll(
366
332
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
367
- X(mt(
333
+ z(pt(
368
334
  t,
369
- a,
370
- c,
335
+ l,
371
336
  o,
372
- n,
373
337
  i,
374
- z,
375
- u,
338
+ n,
339
+ c,
340
+ W,
341
+ $,
376
342
  d,
377
- s,
378
- m
343
+ s
379
344
  ))
380
- ).replace("{-{-PRODUCT_QUANTITY-}-}", At(tt, i, E)).replace(
345
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", $t(C, c, T)).replace(
381
346
  "{-{-PRODUCT_BUTTON-}-}",
382
- Ot(t, a, J, i, T, Z, et)
347
+ Et(t, l, j, c, u, q, f)
383
348
  ).replace(
384
349
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
385
- `<td$1 ${U}>`
350
+ `<td$1 ${A}>`
386
351
  );
387
- return Pt(
388
- at,
352
+ return Tt(
353
+ J,
389
354
  s,
390
355
  _,
391
- H,
392
- z
356
+ K,
357
+ W
393
358
  );
394
359
  };
395
- function gt({
396
- orientation: e,
397
- itemsType: t = N.ITEMS_TYPE.CART_ITEMS,
398
- itemId: a,
360
+ function wt({
361
+ orientation: a,
362
+ itemsType: t = S.ITEMS_TYPE.CART_ITEMS,
363
+ itemId: l,
399
364
  currencySymbol: s,
400
- currencyLocation: c,
401
- migrate: i = !1,
402
- formattedPrice: o = !0,
365
+ currencyLocation: o,
366
+ migrate: c = !1,
367
+ formattedPrice: i = !0,
403
368
  configBlockAttributes: n,
404
369
  nodeConfig: r,
405
370
  nameStyles: p,
406
- buttonStyles: l,
407
- priceStyles: $,
408
- originalPriceStyles: T,
371
+ buttonStyles: e,
372
+ priceStyles: E,
373
+ originalPriceStyles: u,
409
374
  quantityStyles: _,
410
- priceOrientation: I,
411
- priceFormat: u
375
+ priceOrientation: I
412
376
  }) {
413
- const E = it[t].findIndex((G) => G.value === a), d = dt(a, t), m = (r == null ? void 0 : r.priceSinglePrice) ?? (n == null ? void 0 : n["data-product_price_control_single_price"]) === "1" ?? !1;
414
- W = b.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[E >= 0 ? E : 0], M = b.PAIRS_FOR_EXTENSION.name[t].DEFAULT[E >= 0 ? E : 0];
415
- const y = b.PAIRS_FOR_EXTENSION.price[t], h = b.PAIRS_FOR_EXTENSION.originalPrice[t], R = o && !u;
416
- m ? (C = R ? y.DEFAULT_SINGLE_PRICE_FORMATTED : y.DEFAULT_SINGLE_PRICE, B = R ? h.DEFAULT_SINGLE_PRICE_FORMATTED : h.DEFAULT_SINGLE_PRICE) : (C = R ? y.DEFAULT_PRICE_FORMATTED : y.DEFAULT_PRICE, B = R ? h.DEFAULT_PRICE_FORMATTED : h.DEFAULT_PRICE), K = b.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT;
417
- const U = I || (r == null ? void 0 : r.priceOrientation) || "horizontal", g = (r == null ? void 0 : r.priceHideDiscount) ?? S.productPriceHideDiscountControlValue === "1";
418
- return e === N.ORIENTATION.VERTICAL ? Q(
419
- ot,
377
+ const $ = at[t].findIndex((X) => X.value === l), T = rt(l, t), d = (r == null ? void 0 : r.priceSinglePrice) ?? (n == null ? void 0 : n["data-product_price_control_single_price"]) === "1" ?? !1;
378
+ B = P.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[$ >= 0 ? $ : 0], M = P.PAIRS_FOR_EXTENSION.name[t].DEFAULT[$ >= 0 ? $ : 0];
379
+ const O = P.PAIRS_FOR_EXTENSION.price[t], h = P.PAIRS_FOR_EXTENSION.originalPrice[t];
380
+ d ? (F = i ? O.DEFAULT_SINGLE_PRICE_FORMATTED : O.DEFAULT_SINGLE_PRICE, x = i ? h.DEFAULT_SINGLE_PRICE_FORMATTED : h.DEFAULT_SINGLE_PRICE) : (F = i ? O.DEFAULT_PRICE_FORMATTED : O.DEFAULT_PRICE, x = i ? h.DEFAULT_PRICE_FORMATTED : h.DEFAULT_PRICE), G = P.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT;
381
+ const A = I || (r == null ? void 0 : r.priceOrientation) || "horizontal", y = (r == null ? void 0 : r.priceHideDiscount) ?? g.productPriceHideDiscountControlValue === "1";
382
+ return a === S.ORIENTATION.VERTICAL ? H(
383
+ lt,
420
384
  t,
421
- d,
422
- e,
423
- o,
385
+ T,
386
+ a,
424
387
  i,
425
- s,
426
388
  c,
389
+ s,
390
+ o,
427
391
  n,
428
- String(g),
392
+ String(y),
429
393
  // nodup
430
394
  r,
431
395
  p,
432
- l,
433
- U,
434
- $,
435
- T,
396
+ e,
397
+ A,
398
+ E,
399
+ u,
436
400
  _,
437
- m,
438
- u
439
- ) : Q(
440
- nt,
401
+ d
402
+ ) : H(
403
+ st,
441
404
  t,
442
- d,
443
- e,
444
- o,
405
+ T,
406
+ a,
445
407
  i,
446
- s,
447
408
  c,
409
+ s,
410
+ o,
448
411
  n,
449
- String(g),
412
+ String(y),
450
413
  // nodup
451
414
  r,
452
415
  p,
453
- l,
454
- U,
455
- $,
456
- T,
416
+ e,
417
+ A,
418
+ E,
419
+ u,
457
420
  _,
458
- m,
459
- u
421
+ d
460
422
  );
461
423
  }
462
424
  export {
463
- Pt as applyPriceOrientationStyles,
464
- gt as getDefaultTemplate,
465
- L as wrapInTableRow
425
+ Tt as applyPriceOrientationStyles,
426
+ wt as getDefaultTemplate,
427
+ w as wrapInTableRow
466
428
  };