@useinsider/guido 3.13.1-beta.695671e → 3.13.1-beta.98d403f

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