@useinsider/guido 3.14.0 → 3.15.0

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