@useinsider/guido 3.17.0-beta.bc6e089 → 3.17.0-beta.c93afa9

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