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

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