@useinsider/guido 3.9.0-beta.c84fcd0 → 3.9.0-beta.dd40fcd

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