@useinsider/guido 3.18.0 → 3.18.1-beta.74a13e4

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