@useinsider/guido 3.9.1-beta.5af6229 → 3.9.1

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,55 +1,56 @@
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 `
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(`
18
19
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
19
20
  align="center"
20
- esd-extension-block-id="${O.IMAGE}"
21
+ esd-extension-block-id="${I.IMAGE}"
21
22
  data-slot-1=""
22
23
  product-attr="imageSrc"
23
- data-type="${s}"
24
- data-number="${e}"
25
- style="${n}font-size: 0px;">
24
+ data-type="${a}"
25
+ data-number="${t}"
26
+ style="${o}font-size: 0px;">
26
27
  <a class="document-node-component ng-star-inserted"
27
28
  target="_blank"
28
29
  href="#!">
29
30
  <img class="adapt-img document-node-component ng-star-inserted"
30
31
  style="object-fit: contain;"
31
- src="${g}"
32
- alt="${L}"
33
- width="${i}"
34
- height="${i}">
32
+ src="${V}"
33
+ alt="${F}"
34
+ width="${n}"
35
+ height="${n}">
35
36
  </a>
36
37
  </td>
37
- `;
38
- }, J = (s, e) => `
39
- <${b.BLOCK_IMAGE}
40
- ${N.BLOCK_IMAGE.src}="${g}"
41
- ${N.BLOCK_IMAGE.alt}="${L}"
38
+ `);
39
+ }, et = (a, t) => `
40
+ <${O.BLOCK_IMAGE}
41
+ ${N.BLOCK_IMAGE.src}="${V}"
42
+ ${N.BLOCK_IMAGE.alt}="${F}"
42
43
  ${N.BLOCK_IMAGE.href}="#!"
43
- ${N.BLOCK_IMAGE.width}="${D.productImageWidth}"
44
- ${N.BLOCK_IMAGE.height}="${D.productImageWidth}"
45
- esd-extension-block-id="${O.IMAGE}"
44
+ ${N.BLOCK_IMAGE.width}="${M.productImageWidth}"
45
+ ${N.BLOCK_IMAGE.height}="${M.productImageWidth}"
46
+ esd-extension-block-id="${I.IMAGE}"
46
47
  data-slot-1
47
48
  product-attr="imageSrc"
48
- data-type="${s}"
49
- data-number="${e}"
49
+ data-type="${a}"
50
+ data-number="${t}"
50
51
  />
51
- `, tt = (s, e, r, a, i) => {
52
- const o = `
52
+ `, at = (a, t, l, s) => {
53
+ const n = `
53
54
  text-decoration:none;
54
55
  font-size: inherit;
55
56
  font-weight: inherit;
@@ -59,50 +60,52 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
59
60
  display: block;
60
61
  word-wrap:break-word;
61
62
  white-space: nowrap;
62
- width: ${r === x.ORIENTATION.HORIZONTAL ? "130px" : "520px"};
63
+ width: 100%;
63
64
  overflow: hidden;
64
65
  text-overflow: ellipsis;
65
66
  `;
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}` : ""
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: ${$}` : ""
71
72
  ].filter(Boolean).join("; ");
72
- let d = v(
73
- v(l, "color", "inherit"),
73
+ let p = G(
74
+ G(i, "color", "inherit"),
74
75
  "font-size",
75
76
  "inherit"
76
77
  );
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
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
80
81
  href="#!"
81
- style="${d}"
82
+ style="${A(p)}"
82
83
  product-attr="name"
83
84
  data-slot-2
84
85
  width="100%">
85
- ${L}
86
+ ${F}
86
87
  </a>`;
87
- return P && (h = `<strong>${h}</strong>`), p && (h = `<em>${h}</em>`), `
88
+ return _ && (d = `<strong>${d}</strong>`), u && (d = `<em>${d}</em>`), x(`
88
89
  <td class="esd-block-text es-p10"
89
- align="${c}"
90
+ align="${o}"
90
91
  width="100%"
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}
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}
96
98
  </p>
97
99
  </td>
98
- `;
100
+ `);
99
101
  }
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}"
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}"
106
109
  >
107
110
  <p contenteditable="false">
108
111
  <a
@@ -114,54 +117,55 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
114
117
  line-height: inherit;
115
118
  font-family: inherit;
116
119
  color: inherit;
117
- display: block;
118
- word-wrap:break-word;
120
+ display: block;
121
+ word-wrap:break-word;
119
122
  white-space: nowrap;
120
- width: 520px;
123
+ width: 100%;
121
124
  overflow: hidden;
122
125
  text-overflow: ellipsis;
123
126
  "
124
127
  product-attr="name"
125
128
  data-slot-2
126
129
  width="100%">
127
- ${L}
130
+ ${F}
128
131
  </a>
129
132
  </p>
130
- </${b.BLOCK_TEXT}>
133
+ </${O.BLOCK_TEXT}>
131
134
  `;
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}`;
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}`;
137
140
  }
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}"
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}"
143
146
  align="center"
144
- esd-extension-block-id="${O.PRICE}"
147
+ esd-extension-block-id="${I.PRICE}"
145
148
  width="100%"
146
- ${h}>
149
+ ${y}>
147
150
  <p product-attr="price"
148
151
  contenteditable="false"
149
152
  data-slot-4
150
- data-type="${s}"
151
- data-number="${e}"
153
+ data-type="${a}"
154
+ data-number="${t}"
152
155
  ${_}
153
156
  ${u}
154
- ${P}
157
+ ${b}
155
158
  ${p}
156
- style="${I}">
157
- ${t}
159
+ style="${A(h)}">
160
+ ${e}
158
161
  </p>
159
- </td>`;
162
+ </td>
163
+ `);
160
164
  }
161
165
  return `
162
- <${b.BLOCK_TEXT}
163
- esd-extension-block-id="${O.PRICE}"
164
- class="items-block-price ${d}"
166
+ <${O.BLOCK_TEXT}
167
+ esd-extension-block-id="${I.PRICE}"
168
+ class="items-block-price ${T}"
165
169
  width="100%"
166
170
  align="center"
167
171
  >
@@ -169,281 +173,275 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
169
173
  product-attr="price"
170
174
  contenteditable="false"
171
175
  data-slot-4
172
- data-type="${s}"
173
- data-number="${e}"
176
+ data-type="${a}"
177
+ data-number="${t}"
174
178
  ${_}
175
179
  ${u}
176
- ${a ? `data-currency_symbol="${a}"` : ""}
180
+ ${s ? `data-currency_symbol="${s}"` : ""}
177
181
  ${p}
178
182
  >
179
- ${t}
183
+ ${e}
180
184
  </p>
181
- </${b.BLOCK_TEXT}>
185
+ </${O.BLOCK_TEXT}>
182
186
  `;
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}`;
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}`;
188
192
  }
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}"
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}"
195
199
  width="100%"
196
- align="center"${P}>
200
+ align="center"${b}>
197
201
  <p
198
202
  product-attr="originalPrice"
199
203
  contenteditable="false"
200
204
  data-slot-5
201
- data-type="${s}"
202
- data-number="${e}"
205
+ data-type="${a}"
206
+ data-number="${t}"
203
207
  ${_}
204
208
  ${u}
205
- ${a ? `data-currency_symbol="${a}"` : ""}
209
+ ${s ? `data-currency_symbol="${s}"` : ""}
206
210
  ${p}
207
- style="${I}">
208
- <s>${t}</s>
211
+ style="${A(h)}">
212
+ <s>${e}</s>
209
213
  </p>
210
214
  </td>
211
- `;
215
+ `);
212
216
  }
213
217
  return `
214
- <${b.BLOCK_TEXT}
215
- class="items-block-price ${d}"
216
- 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}"
217
221
  width="100%"
218
222
  align="center"
219
- ${o ? "" : 'style="display: none;"'}
223
+ ${i ? "" : 'style="display: none;"'}
220
224
  >
221
225
  <p
222
226
  product-attr="originalPrice"
223
227
  contenteditable="false"
224
228
  data-slot-5
225
229
  style="color: #cc0000"
226
- data-type="${s}"
227
- data-number="${e}"
230
+ data-type="${a}"
231
+ data-number="${t}"
228
232
  ${_}
229
233
  ${u}
230
- ${a ? `data-currency_symbol="${a}"` : ""}
234
+ ${s ? `data-currency_symbol="${s}"` : ""}
231
235
  ${p}
232
236
  >
233
- <s>${t}</s>
237
+ <s>${e}</s>
234
238
  </p>
235
- </${b.BLOCK_TEXT}>
239
+ </${O.BLOCK_TEXT}>
236
240
  `;
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 `
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(`
242
246
  <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
243
- width="100%" align="${n}"
244
- esd-extension-block-id="${O.QUANTITY}"
245
- ${a}>
247
+ width="100%" align="${o}"
248
+ esd-extension-block-id="${I.QUANTITY}"
249
+ ${s}>
246
250
  <p product-attr="quantity"
247
251
  data-slot-3=""
248
252
  contenteditable="false"
249
253
  width="100%"
250
254
  path="1"
251
- style="${o}">
252
- ${M}
255
+ style="${A(i)}">
256
+ ${g}
253
257
  </p>
254
- </td>`;
258
+ </td>
259
+ `);
255
260
  }
256
261
  return `
257
- <${b.BLOCK_TEXT}
262
+ <${O.BLOCK_TEXT}
258
263
  width="100%"
259
264
  align="center"
260
265
  class="es-p10"
261
- esd-extension-block-id="${O.QUANTITY}"
262
- ${s ? "" : 'style="display: none;"'}
266
+ esd-extension-block-id="${I.QUANTITY}"
267
+ ${a ? "" : 'style="display: none;"'}
263
268
  >
264
269
  <p
265
270
  product-attr="quantity"
266
271
  data-slot-3
267
272
  contenteditable="false"
268
273
  width="100%">
269
- ${M}
274
+ ${g}
270
275
  </p>
271
- </${b.BLOCK_TEXT}>
276
+ </${O.BLOCK_TEXT}>
272
277
  `;
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 `
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(`
277
282
  <td class="esd-block-button ins-button default-block-component selectable"
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}
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}
289
294
  </a>
290
295
  </span>
291
- </td>`;
296
+ </td>
297
+ `);
292
298
  }
293
299
  return `
294
- <${b.BLOCK_BUTTON}
300
+ <${O.BLOCK_BUTTON}
295
301
  width="100%"
296
302
  class="ins-button"
297
303
  name="buy-button"
298
- caption="${r}"
304
+ caption="${l}"
299
305
  align="center"
300
- esd-extension-block-id="${O.BUTTON}"
306
+ esd-extension-block-id="${I.BUTTON}"
301
307
  product-attr="button"
302
308
  data-slot-6
303
- data-type="${s}"
304
- data-number="${e}"
305
- >${r}
306
- </${b.BLOCK_BUTTON}>
309
+ data-type="${a}"
310
+ data-number="${t}"
311
+ >${l}
312
+ </${O.BLOCK_BUTTON}>
307
313
  `;
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(
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(
313
319
  /<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
314
- (E) => E.replace(/width="[^"]*"/gi, `width="${l}"`).replace(/width:\s*[^;]+;/gi, `width: ${l};`)
320
+ (E) => E.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
315
321
  );
316
- return t = t.replace(
322
+ return e = e.replace(
317
323
  /<td\s+[^>]*class="([^"]*product-original-price-class[^"]*)"[^>]*>/gi,
318
324
  (E) => E.replace(/width="[^"]*"/gi, `width="${$}"`).replace(/width:\s*[^;]+;/gi, `width: ${$};`)
319
- ), t;
325
+ ), e;
320
326
  }
321
- return o ? s : s.replace(
327
+ return i ? a : a.replace(
322
328
  /<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
323
329
  (c) => /style\s*=\s*"/i.test(c) ? c.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : c.replace(/>$/, ' style="display: none;">')
324
330
  ).replace(
325
331
  /<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
326
332
  (c) => c.replace(/display:\s*none;?/gi, "display: table-cell;")
327
333
  );
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(
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(
336
338
  "{-{-PRODUCT_PRICE-}-}",
337
- V(et(
338
- e,
339
- r,
339
+ X(st(
340
+ t,
341
+ l,
342
+ n,
340
343
  i,
341
- o,
342
344
  c,
343
- n,
344
- P,
345
- d,
346
- a,
347
- k
345
+ o,
346
+ b,
347
+ T,
348
+ s,
349
+ f
348
350
  ))
349
351
  ).replaceAll(
350
352
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
351
- V(at(
352
- e,
353
- r,
353
+ X(lt(
354
+ t,
355
+ l,
356
+ n,
354
357
  i,
355
- o,
356
358
  c,
357
- n,
358
- f,
359
+ o,
360
+ v,
359
361
  p,
360
- d,
361
- a
362
+ T,
363
+ s
362
364
  ))
363
- ).replace("{-{-PRODUCT_QUANTITY-}-}", st(W, n, R)).replace(
365
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", rt(Q, o, P)).replace(
364
366
  "{-{-PRODUCT_BUTTON-}-}",
365
- lt(e, r, K, n, _, B, Q)
367
+ it(t, l, B, o, _, W, C)
368
+ ).replace(
369
+ /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
370
+ `<td$1 ${y}>`
366
371
  );
367
- return rt(
372
+ return ct(
368
373
  H,
369
- a,
374
+ s,
370
375
  u,
371
- k,
372
- f
376
+ f,
377
+ v
373
378
  );
374
379
  };
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,
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,
383
388
  configBlockAttributes: c,
384
- nodeConfig: l,
389
+ nodeConfig: r,
385
390
  nameStyles: $,
386
- buttonStyles: t,
391
+ buttonStyles: e,
387
392
  priceStyles: E,
388
393
  originalPriceStyles: _,
389
394
  quantityStyles: u,
390
- priceOrientation: P
395
+ priceOrientation: b
391
396
  }) {
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
- s,
410
- o,
411
- n,
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,
412
406
  a,
413
407
  i,
408
+ o,
409
+ s,
410
+ n,
414
411
  c,
415
412
  void 0,
416
413
  // nodup
417
- l,
414
+ r,
418
415
  $,
419
- t,
420
- h,
416
+ e,
417
+ y,
421
418
  E,
422
419
  _,
423
420
  u,
424
- d
421
+ T
425
422
  ) : z(
426
- j,
427
- e,
428
- R,
429
- s,
430
- o,
431
- n,
423
+ q,
424
+ t,
425
+ P,
432
426
  a,
433
427
  i,
428
+ o,
429
+ s,
430
+ n,
434
431
  c,
435
432
  void 0,
436
433
  // nodup
437
- l,
434
+ r,
438
435
  $,
439
- t,
440
- h,
436
+ e,
437
+ y,
441
438
  E,
442
439
  _,
443
440
  u,
444
- d
441
+ T
445
442
  );
446
443
  }
447
444
  export {
448
- Tt as getDefaultTemplate
445
+ ht as getDefaultTemplate,
446
+ x as wrapInTableRow
449
447
  };