@useinsider/guido 3.18.2-beta.fc246a7 → 3.18.2-beta.ff43aaa

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