@useinsider/guido 3.23.0-beta.31d0f5f → 3.23.0-beta.9f6bfbf

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