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