@useinsider/guido 3.17.0-beta.3a4c221 → 3.17.0-beta.3deafbf
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.
- package/README.md +5 -5
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/utils/genericUtil.js +54 -45
- package/dist/utils/pairProductVariables.js +60 -59
- package/package.json +2 -2
- package/dist/src/utils/dynamicContentFormat.d.ts +0 -26
- package/dist/utils/dynamicContentFormat.js +0 -37
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { escapeHtml as m } from "../../../utils/htmlEscape.js";
|
|
2
|
-
import { BlockType as R, BlockAttr as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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(`
|
|
16
17
|
<td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
|
|
17
18
|
align="center"
|
|
18
|
-
esd-extension-block-id="${
|
|
19
|
+
esd-extension-block-id="${_.IMAGE}"
|
|
19
20
|
data-slot-1=""
|
|
20
21
|
product-attr="imageSrc"
|
|
21
|
-
data-type="${
|
|
22
|
+
data-type="${a}"
|
|
22
23
|
data-number="${e}"
|
|
23
24
|
style="${d}font-size: 0px;">
|
|
24
25
|
<a class="document-node-component ng-star-inserted"
|
|
@@ -26,27 +27,27 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
26
27
|
href="#!">
|
|
27
28
|
<img class="adapt-img document-node-component ng-star-inserted"
|
|
28
29
|
style="object-fit: contain;"
|
|
29
|
-
src="${
|
|
30
|
+
src="${G}"
|
|
30
31
|
alt="${F}"
|
|
31
32
|
width="${i}"
|
|
32
33
|
height="${i}">
|
|
33
34
|
</a>
|
|
34
35
|
</td>
|
|
35
36
|
`);
|
|
36
|
-
},
|
|
37
|
+
}, at = (a, e) => `
|
|
37
38
|
<${R.BLOCK_IMAGE}
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
${
|
|
41
|
-
${
|
|
42
|
-
${
|
|
43
|
-
esd-extension-block-id="${
|
|
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}"
|
|
44
45
|
data-slot-1
|
|
45
46
|
product-attr="imageSrc"
|
|
46
|
-
data-type="${
|
|
47
|
+
data-type="${a}"
|
|
47
48
|
data-number="${e}"
|
|
48
49
|
/>
|
|
49
|
-
`,
|
|
50
|
+
`, st = (a, e, r, s) => {
|
|
50
51
|
const i = `
|
|
51
52
|
word-wrap: break-word;
|
|
52
53
|
white-space: nowrap;
|
|
@@ -56,27 +57,27 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
56
57
|
max-width: 100%;
|
|
57
58
|
`;
|
|
58
59
|
if (e) {
|
|
59
|
-
const d =
|
|
60
|
-
|
|
61
|
-
|
|
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
63
|
"font-style"
|
|
63
64
|
),
|
|
64
65
|
"text-decoration"
|
|
65
|
-
), T = (
|
|
66
|
-
let
|
|
67
|
-
return o && (
|
|
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(`
|
|
68
69
|
<td class="esd-block-text es-p10"
|
|
69
70
|
align="${d}"
|
|
70
71
|
width="100%"
|
|
71
72
|
colspan="2"
|
|
72
|
-
data-type="${
|
|
73
|
-
esd-extension-block-id="${
|
|
73
|
+
data-type="${a}"
|
|
74
|
+
esd-extension-block-id="${_.NAME}"
|
|
74
75
|
style="${T}">
|
|
75
76
|
<p contenteditable="false"
|
|
76
77
|
path="1"
|
|
77
78
|
product-attr="name"
|
|
78
|
-
data-slot-2${
|
|
79
|
-
${
|
|
79
|
+
data-slot-2${u}>
|
|
80
|
+
${$}
|
|
80
81
|
</p>
|
|
81
82
|
</td>
|
|
82
83
|
`);
|
|
@@ -86,8 +87,8 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
86
87
|
align="center"
|
|
87
88
|
colspan="2"
|
|
88
89
|
class="es-p10"
|
|
89
|
-
data-type="${
|
|
90
|
-
esd-extension-block-id="${
|
|
90
|
+
data-type="${a}"
|
|
91
|
+
esd-extension-block-id="${_.NAME}"
|
|
91
92
|
>
|
|
92
93
|
<p contenteditable="false"
|
|
93
94
|
product-attr="name"
|
|
@@ -97,31 +98,31 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
97
98
|
</p>
|
|
98
99
|
</${R.BLOCK_TEXT}>
|
|
99
100
|
`;
|
|
100
|
-
},
|
|
101
|
-
let t =
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
t = (i || "0") === "1" ? `${
|
|
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} ${E}` : `${E} ${L}`;
|
|
105
106
|
}
|
|
106
|
-
const p = i
|
|
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" : "";
|
|
107
108
|
if (d) {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
<td class="esd-block-text items-block-price${
|
|
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
112
|
align="center"
|
|
112
|
-
esd-extension-block-id="${
|
|
113
|
+
esd-extension-block-id="${_.PRICE}"
|
|
113
114
|
width="100%"
|
|
114
|
-
${
|
|
115
|
+
${P}>
|
|
115
116
|
<p product-attr="price"
|
|
116
117
|
contenteditable="false"
|
|
117
118
|
data-slot-4
|
|
118
|
-
data-type="${
|
|
119
|
+
data-type="${a}"
|
|
119
120
|
data-number="${e}"
|
|
120
121
|
${T}
|
|
121
|
-
${_}
|
|
122
|
-
${E}
|
|
123
122
|
${u}
|
|
124
|
-
|
|
123
|
+
${$}
|
|
124
|
+
${O}
|
|
125
|
+
style="${m(I)}">
|
|
125
126
|
${t}
|
|
126
127
|
</p>
|
|
127
128
|
</td>
|
|
@@ -129,8 +130,8 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
129
130
|
}
|
|
130
131
|
return `
|
|
131
132
|
<${R.BLOCK_TEXT}
|
|
132
|
-
esd-extension-block-id="${
|
|
133
|
-
class="items-block-price ${
|
|
133
|
+
esd-extension-block-id="${_.PRICE}"
|
|
134
|
+
class="items-block-price ${b}"
|
|
134
135
|
width="100%"
|
|
135
136
|
align="center"
|
|
136
137
|
>
|
|
@@ -138,42 +139,42 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
138
139
|
product-attr="price"
|
|
139
140
|
contenteditable="false"
|
|
140
141
|
data-slot-4
|
|
141
|
-
data-type="${
|
|
142
|
+
data-type="${a}"
|
|
142
143
|
data-number="${e}"
|
|
143
144
|
${T}
|
|
144
|
-
${_}
|
|
145
|
-
${a ? `data-currency_symbol="${a}"` : ""}
|
|
146
145
|
${u}
|
|
146
|
+
${$}
|
|
147
|
+
${O}
|
|
147
148
|
>
|
|
148
149
|
${t}
|
|
149
150
|
</p>
|
|
150
151
|
</${R.BLOCK_TEXT}>
|
|
151
152
|
`;
|
|
152
|
-
},
|
|
153
|
-
let t =
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
t = (i || "0") === "1" ? `${
|
|
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} ${I}` : `${I} ${x}`;
|
|
157
158
|
}
|
|
158
|
-
const p = i
|
|
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" : "";
|
|
159
160
|
if (d) {
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
<td class="esd-block-text items-block-price${
|
|
163
|
-
esd-extension-block-id="${
|
|
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
165
|
width="100%"
|
|
165
|
-
align="center"${
|
|
166
|
+
align="center"${O}>
|
|
166
167
|
<p
|
|
167
168
|
product-attr="originalPrice"
|
|
168
169
|
contenteditable="false"
|
|
169
170
|
data-slot-5
|
|
170
|
-
data-type="${
|
|
171
|
+
data-type="${a}"
|
|
171
172
|
data-number="${e}"
|
|
172
173
|
${T}
|
|
173
|
-
${_}
|
|
174
|
-
${a ? `data-currency_symbol="${a}"` : ""}
|
|
175
174
|
${u}
|
|
176
|
-
|
|
175
|
+
${$}
|
|
176
|
+
${A}
|
|
177
|
+
style="${m(P)}">
|
|
177
178
|
<s>${t}</s>
|
|
178
179
|
</p>
|
|
179
180
|
</td>
|
|
@@ -181,8 +182,8 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
181
182
|
}
|
|
182
183
|
return `
|
|
183
184
|
<${R.BLOCK_TEXT}
|
|
184
|
-
class="items-block-price ${
|
|
185
|
-
esd-extension-block-id="${
|
|
185
|
+
class="items-block-price ${E}"
|
|
186
|
+
esd-extension-block-id="${_.ORIGINAL_PRICE}"
|
|
186
187
|
width="100%"
|
|
187
188
|
align="center"
|
|
188
189
|
${n ? "" : 'style="display: none;"'}
|
|
@@ -192,33 +193,33 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
192
193
|
contenteditable="false"
|
|
193
194
|
data-slot-5
|
|
194
195
|
style="color: #cc0000"
|
|
195
|
-
data-type="${
|
|
196
|
+
data-type="${a}"
|
|
196
197
|
data-number="${e}"
|
|
197
198
|
${T}
|
|
198
|
-
${_}
|
|
199
|
-
${a ? `data-currency_symbol="${a}"` : ""}
|
|
200
199
|
${u}
|
|
200
|
+
${$}
|
|
201
|
+
${A}
|
|
201
202
|
>
|
|
202
203
|
<s>${t}</s>
|
|
203
204
|
</p>
|
|
204
205
|
</${R.BLOCK_TEXT}>
|
|
205
206
|
`;
|
|
206
|
-
},
|
|
207
|
-
const
|
|
207
|
+
}, ct = (a = !0, e, r) => {
|
|
208
|
+
const s = a ? "" : 'style="display: none;"';
|
|
208
209
|
if (e) {
|
|
209
|
-
const i = "font-size: 14px;", d =
|
|
210
|
-
return
|
|
210
|
+
const i = "font-size: 14px;", d = S(r || "", "text-align") || "center", n = V(r || i);
|
|
211
|
+
return N(`
|
|
211
212
|
<td class="esd-block-text es-p10 document-node-component default-block-component selectable"
|
|
212
213
|
width="100%" align="${d}"
|
|
213
|
-
esd-extension-block-id="${
|
|
214
|
-
${
|
|
214
|
+
esd-extension-block-id="${_.QUANTITY}"
|
|
215
|
+
${s}>
|
|
215
216
|
<p product-attr="quantity"
|
|
216
217
|
data-slot-3=""
|
|
217
218
|
contenteditable="false"
|
|
218
219
|
width="100%"
|
|
219
220
|
path="1"
|
|
220
221
|
style="${m(n)}">
|
|
221
|
-
${
|
|
222
|
+
${v}
|
|
222
223
|
</p>
|
|
223
224
|
</td>
|
|
224
225
|
`);
|
|
@@ -228,26 +229,26 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
228
229
|
width="100%"
|
|
229
230
|
align="center"
|
|
230
231
|
class="es-p10"
|
|
231
|
-
esd-extension-block-id="${
|
|
232
|
-
${
|
|
232
|
+
esd-extension-block-id="${_.QUANTITY}"
|
|
233
|
+
${a ? "" : 'style="display: none;"'}
|
|
233
234
|
>
|
|
234
235
|
<p
|
|
235
236
|
product-attr="quantity"
|
|
236
237
|
data-slot-3
|
|
237
238
|
contenteditable="false"
|
|
238
239
|
width="100%">
|
|
239
|
-
${
|
|
240
|
+
${v}
|
|
240
241
|
</p>
|
|
241
242
|
</${R.BLOCK_TEXT}>
|
|
242
243
|
`;
|
|
243
|
-
},
|
|
244
|
-
if (
|
|
245
|
-
const c =
|
|
246
|
-
return
|
|
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(`
|
|
247
248
|
<td class="esd-block-button ins-button default-block-component selectable"
|
|
248
249
|
align="center" width="100%" name="buy-button" caption="${r}"
|
|
249
|
-
esd-extension-block-id="${
|
|
250
|
-
product-attr="button" data-slot-6="" data-type="${
|
|
250
|
+
esd-extension-block-id="${_.BUTTON}"
|
|
251
|
+
product-attr="button" data-slot-6="" data-type="${a}" data-number="${e}"
|
|
251
252
|
${n ? "" : ' style="display: none;"'}>
|
|
252
253
|
<span class="es-button-border ${o}" style="${m(l)}">
|
|
253
254
|
<a
|
|
@@ -268,19 +269,19 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
268
269
|
name="buy-button"
|
|
269
270
|
caption="${r}"
|
|
270
271
|
align="center"
|
|
271
|
-
esd-extension-block-id="${
|
|
272
|
+
esd-extension-block-id="${_.BUTTON}"
|
|
272
273
|
product-attr="button"
|
|
273
274
|
data-slot-6
|
|
274
|
-
data-type="${
|
|
275
|
+
data-type="${a}"
|
|
275
276
|
data-number="${e}"
|
|
276
277
|
>${r}
|
|
277
278
|
</${R.BLOCK_BUTTON}>
|
|
278
279
|
`;
|
|
279
|
-
},
|
|
280
|
-
const d = e ===
|
|
280
|
+
}, nt = (a, e, r, s = !0, i = !0) => {
|
|
281
|
+
const d = e === y.ORIENTATION.VERTICAL, n = r === "horizontal";
|
|
281
282
|
if (d) {
|
|
282
|
-
const c = !n, l = c || !i ? "100%" : "50%", o = c || !
|
|
283
|
-
let t =
|
|
283
|
+
const c = !n, l = c || !i ? "100%" : "50%", o = c || !s ? "100%" : "50%";
|
|
284
|
+
let t = a.replace(
|
|
284
285
|
/<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
|
|
285
286
|
(p) => p.replace(/width="[^"]*"/gi, `width="${l}"`).replace(/width:\s*[^;]+;/gi, `width: ${l};`)
|
|
286
287
|
);
|
|
@@ -289,64 +290,64 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
289
290
|
(p) => p.replace(/width="[^"]*"/gi, `width="${o}"`).replace(/width:\s*[^;]+;/gi, `width: ${o};`)
|
|
290
291
|
), t;
|
|
291
292
|
}
|
|
292
|
-
return n ?
|
|
293
|
+
return n ? a : a.replace(
|
|
293
294
|
/<td\s+[^>]*class="[^"]*horizontal-price[^"]*"[^>]*>/gi,
|
|
294
295
|
(c) => /style\s*=\s*"/i.test(c) ? c.replace(/style\s*=\s*"([^"]*)"/i, 'style="display: none; $1"') : c.replace(/>$/, ' style="display: none;">')
|
|
295
296
|
).replace(
|
|
296
297
|
/<td\s+[^>]*class="[^"]*vertical-price[^"]*"[^>]*>/gi,
|
|
297
298
|
(c) => c.replace(/display:\s*none;?/gi, "display: table-cell;")
|
|
298
299
|
);
|
|
299
|
-
},
|
|
300
|
+
}, dt = (a) => a ? `<td align="center"
|
|
300
301
|
esd-extension-block-id="items-block"
|
|
301
|
-
class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` :
|
|
302
|
-
const
|
|
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(
|
|
303
304
|
"{-{-PRODUCT_PRICE-}-}",
|
|
304
|
-
g(
|
|
305
|
+
g(lt(
|
|
305
306
|
e,
|
|
306
307
|
r,
|
|
307
308
|
i,
|
|
308
309
|
n,
|
|
309
310
|
c,
|
|
310
311
|
d,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
$,
|
|
313
|
+
b,
|
|
314
|
+
s,
|
|
315
|
+
K
|
|
315
316
|
))
|
|
316
317
|
).replaceAll(
|
|
317
318
|
"{-{-PRODUCT_ORIGINAL_PRICE-}-}",
|
|
318
|
-
g(
|
|
319
|
+
g(rt(
|
|
319
320
|
e,
|
|
320
321
|
r,
|
|
321
322
|
i,
|
|
322
323
|
n,
|
|
323
324
|
c,
|
|
324
325
|
d,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
B,
|
|
327
|
+
O,
|
|
328
|
+
b,
|
|
329
|
+
s
|
|
329
330
|
))
|
|
330
|
-
).replace("{-{-PRODUCT_QUANTITY-}-}",
|
|
331
|
+
).replace("{-{-PRODUCT_QUANTITY-}-}", ct(Y, d, A)).replace(
|
|
331
332
|
"{-{-PRODUCT_BUTTON-}-}",
|
|
332
|
-
|
|
333
|
+
it(e, r, H, d, T, Q, q)
|
|
333
334
|
).replace(
|
|
334
335
|
/<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
|
|
335
|
-
`<td$1 ${
|
|
336
|
+
`<td$1 ${P}>`
|
|
336
337
|
);
|
|
337
|
-
return
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
return nt(
|
|
339
|
+
C,
|
|
340
|
+
s,
|
|
341
|
+
u,
|
|
342
|
+
K,
|
|
343
|
+
B
|
|
343
344
|
);
|
|
344
345
|
};
|
|
345
|
-
function
|
|
346
|
-
orientation:
|
|
347
|
-
itemsType: e =
|
|
346
|
+
function bt({
|
|
347
|
+
orientation: a,
|
|
348
|
+
itemsType: e = y.ITEMS_TYPE.CART_ITEMS,
|
|
348
349
|
itemId: r,
|
|
349
|
-
currencySymbol:
|
|
350
|
+
currencySymbol: s,
|
|
350
351
|
currencyLocation: i,
|
|
351
352
|
migrate: d = !1,
|
|
352
353
|
formattedPrice: n = !0,
|
|
@@ -356,22 +357,22 @@ function It({
|
|
|
356
357
|
buttonStyles: t,
|
|
357
358
|
priceStyles: p,
|
|
358
359
|
originalPriceStyles: T,
|
|
359
|
-
quantityStyles:
|
|
360
|
-
priceOrientation:
|
|
360
|
+
quantityStyles: u,
|
|
361
|
+
priceOrientation: $
|
|
361
362
|
}) {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
return
|
|
368
|
-
|
|
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,
|
|
369
370
|
e,
|
|
370
|
-
|
|
371
|
-
|
|
371
|
+
A,
|
|
372
|
+
a,
|
|
372
373
|
n,
|
|
373
374
|
d,
|
|
374
|
-
|
|
375
|
+
s,
|
|
375
376
|
i,
|
|
376
377
|
c,
|
|
377
378
|
String(D),
|
|
@@ -379,19 +380,19 @@ function It({
|
|
|
379
380
|
l,
|
|
380
381
|
o,
|
|
381
382
|
t,
|
|
382
|
-
|
|
383
|
+
P,
|
|
383
384
|
p,
|
|
384
385
|
T,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
) :
|
|
388
|
-
|
|
386
|
+
u,
|
|
387
|
+
b
|
|
388
|
+
) : W(
|
|
389
|
+
Z,
|
|
389
390
|
e,
|
|
390
|
-
|
|
391
|
-
|
|
391
|
+
A,
|
|
392
|
+
a,
|
|
392
393
|
n,
|
|
393
394
|
d,
|
|
394
|
-
|
|
395
|
+
s,
|
|
395
396
|
i,
|
|
396
397
|
c,
|
|
397
398
|
String(D),
|
|
@@ -399,14 +400,14 @@ function It({
|
|
|
399
400
|
l,
|
|
400
401
|
o,
|
|
401
402
|
t,
|
|
402
|
-
|
|
403
|
+
P,
|
|
403
404
|
p,
|
|
404
405
|
T,
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
u,
|
|
407
|
+
b
|
|
407
408
|
);
|
|
408
409
|
}
|
|
409
410
|
export {
|
|
410
|
-
|
|
411
|
-
|
|
411
|
+
bt as getDefaultTemplate,
|
|
412
|
+
N as wrapInTableRow
|
|
412
413
|
};
|
|
@@ -16,6 +16,8 @@ export declare const BLOCK_ID: BlockId;
|
|
|
16
16
|
* - Onboarding support
|
|
17
17
|
*/
|
|
18
18
|
export declare class ItemsBlock extends Block {
|
|
19
|
+
/** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
|
|
20
|
+
private _currencyHealed;
|
|
19
21
|
getId(): string;
|
|
20
22
|
getIcon(): string;
|
|
21
23
|
getBlockCompositionType(): BlockCompositionType;
|
|
@@ -42,4 +44,23 @@ export declare class ItemsBlock extends Block {
|
|
|
42
44
|
* relies on this td-level fallback in pairProductVariables.
|
|
43
45
|
*/
|
|
44
46
|
private _stampProductTdDomAttributes;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the currency self-heal should run for this block. Two guards (SD-147588):
|
|
49
|
+
* 1. Config is only authoritative when the symbol was actually customized — a symbol still at
|
|
50
|
+
* the 'USD' sentinel may be a migrator default, so we trust the DOM's real value over a
|
|
51
|
+
* defaulted config and never overwrite it.
|
|
52
|
+
* 2. Heal each instance at most once per session, so the auto-fix can't fight undo (undo
|
|
53
|
+
* re-drifts the attr, which would otherwise re-trigger the heal forever).
|
|
54
|
+
*/
|
|
55
|
+
private _shouldReconcileCurrency;
|
|
56
|
+
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
57
|
+
private _markCurrencyHealed;
|
|
58
|
+
/**
|
|
59
|
+
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
60
|
+
* attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
|
|
61
|
+
* Config is the source of truth — never derive from visible text. Callers gate this with
|
|
62
|
+
* `_shouldReconcileCurrency`. Returns true only when an attr actually changed, so the caller can
|
|
63
|
+
* skip an empty apply that would otherwise re-trigger onDocumentChanged and loop (SD-147588).
|
|
64
|
+
*/
|
|
65
|
+
private _reconcileCurrencyDomAttributes;
|
|
45
66
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner for the Items price currency export contract (SD-147588).
|
|
3
|
+
*
|
|
4
|
+
* `data-curency` is deliberately misspelled (one `r`) — it is the attribute the
|
|
5
|
+
* server-side export transform (pairProductVariables) actually reads, so every
|
|
6
|
+
* layer that writes it and the live reader (template, controls, block self-heal,
|
|
7
|
+
* pairProductVariables) MUST go through these constants. A typo fix or mapping change
|
|
8
|
+
* in one of them would otherwise silently break sync with the others and ship the wrong
|
|
9
|
+
* currency position/token to the inbox. Mirrors the Recommendation block's `CURRENCY_ATTR`.
|
|
10
|
+
*
|
|
11
|
+
* Exception: the legacy migrator reads the raw misspelled string on purpose — it parses
|
|
12
|
+
* old templates frozen with that exact attr name, so it must NOT follow a future rename here.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ITEMS_CURRENCY_ATTR: {
|
|
15
|
+
readonly POSITION: "data-curency";
|
|
16
|
+
readonly SYMBOL: "data-currency_symbol";
|
|
17
|
+
};
|
|
18
|
+
/** Currency location select value `'1'` = after (price then symbol), anything else = before. */
|
|
19
|
+
export declare function currencyPositionFromLocation(location: string | undefined): 'after' | 'before';
|