@useinsider/guido 3.15.0-beta.e9014b0 → 3.15.0-beta.f5247a0
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/dist/extensions/Blocks/Items/block.js +42 -44
- package/dist/extensions/Blocks/Items/template.js +86 -86
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +5 -9
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +98 -113
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -0
- package/dist/utils/pairProductVariables.js +93 -111
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BlockId as
|
|
2
|
-
import { useOnboardingStore as
|
|
3
|
-
import { getMigrationBannerHtml as
|
|
4
|
-
import { Block as
|
|
5
|
-
import { SETTINGS_ENUMS as
|
|
6
|
-
import { getDefaultTemplate as
|
|
7
|
-
import { getItemsBlockContainer as
|
|
8
|
-
const p =
|
|
9
|
-
class
|
|
1
|
+
import { BlockId as f } from "../../../enums/block.js";
|
|
2
|
+
import { useOnboardingStore as g } from "../../../stores/onboarding.js";
|
|
3
|
+
import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
|
|
4
|
+
import { Block as I, BlockCompositionType as C, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { SETTINGS_ENUMS as d, DefaultConfigValues as m } from "./enums/settingsEnums.js";
|
|
6
|
+
import { getDefaultTemplate as b } from "./template.js";
|
|
7
|
+
import { getItemsBlockContainer as l, getItemsBlockConfig as u, deriveItemNumber as h, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
|
|
8
|
+
const p = f.Items;
|
|
9
|
+
class O extends I {
|
|
10
10
|
getId() {
|
|
11
11
|
return p;
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ class E extends C {
|
|
|
14
14
|
return "items-icon";
|
|
15
15
|
}
|
|
16
16
|
getBlockCompositionType() {
|
|
17
|
-
return
|
|
17
|
+
return C.CONTAINER;
|
|
18
18
|
}
|
|
19
19
|
getName() {
|
|
20
20
|
return this.api.translate("Items");
|
|
@@ -23,20 +23,20 @@ class E extends C {
|
|
|
23
23
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
24
24
|
}
|
|
25
25
|
getSettingsPanelTitleHtml() {
|
|
26
|
-
return
|
|
26
|
+
return y(
|
|
27
27
|
p,
|
|
28
28
|
this.api.translate("Items"),
|
|
29
29
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
getTemplate() {
|
|
33
|
-
return
|
|
34
|
-
orientation:
|
|
35
|
-
itemsType:
|
|
33
|
+
return b({
|
|
34
|
+
orientation: d.ORIENTATION.VERTICAL,
|
|
35
|
+
itemsType: d.ITEMS_TYPE.CART_ITEMS,
|
|
36
36
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
37
|
-
currencySymbol:
|
|
38
|
-
currencyLocation:
|
|
39
|
-
formattedPrice:
|
|
37
|
+
currencySymbol: m.productPriceCurrencySymbolControlValue,
|
|
38
|
+
currencyLocation: m.productPriceCurrencyLocationControlValue,
|
|
39
|
+
formattedPrice: m.productPriceFormattedControlValue === "1"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
allowInnerBlocksDND() {
|
|
@@ -45,23 +45,23 @@ class E extends C {
|
|
|
45
45
|
canBeSavedAsModule() {
|
|
46
46
|
return !0;
|
|
47
47
|
}
|
|
48
|
-
onCreated(
|
|
49
|
-
const t = this.api.getDocumentModifier(),
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
48
|
+
onCreated(e) {
|
|
49
|
+
const t = this.api.getDocumentModifier(), o = this.api.getDocumentRootCssNode();
|
|
50
|
+
o.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(o).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
51
|
+
const i = l(e);
|
|
52
|
+
if (!i)
|
|
53
53
|
return;
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
|
|
54
|
+
const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, n = u(e);
|
|
55
|
+
if (n != null && n.initialized)
|
|
56
|
+
if (s)
|
|
57
|
+
n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(i).setNodeConfig({ ...n, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
|
|
58
58
|
else {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const a = this.api.getDocumentModifier();
|
|
60
|
+
a.modifyHtml(i).setNodeConfig(n), this._stampProductTdDomAttributes(i, n, a), a.apply(new c("Migrate legacy config to nodeConfig"));
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const a = N();
|
|
64
|
+
this.api.getDocumentModifier().modifyHtml(i).setNodeConfig(a).apply(new c("Initialize Items block with default configuration")), g().startOnboarding("itemsOnboarding");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -70,18 +70,18 @@ class E extends C {
|
|
|
70
70
|
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
71
71
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
72
72
|
*/
|
|
73
|
-
onDocumentChanged(
|
|
74
|
-
const t =
|
|
73
|
+
onDocumentChanged(e) {
|
|
74
|
+
const t = l(e);
|
|
75
75
|
if (!t)
|
|
76
76
|
return;
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
77
|
+
const o = t.getNodeConfig();
|
|
78
|
+
if (o && Object.keys(o).length > 0)
|
|
79
79
|
return;
|
|
80
|
-
const
|
|
81
|
-
if (!(
|
|
80
|
+
const r = u(e);
|
|
81
|
+
if (!(r != null && r.initialized))
|
|
82
82
|
return;
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const s = this.api.getDocumentModifier();
|
|
84
|
+
s.modifyHtml(t).setNodeConfig(r), this._stampProductTdDomAttributes(t, r, s), s.apply(new c("Recover Items block config from saved module"));
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
|
|
@@ -91,14 +91,12 @@ class E extends C {
|
|
|
91
91
|
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
92
92
|
* relies on this td-level fallback in pairProductVariables.
|
|
93
93
|
*/
|
|
94
|
-
_stampProductTdDomAttributes(
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
r("data-type", t.type), r("data-number", o), r("data-nodup", String(t.priceHideDiscount));
|
|
94
|
+
_stampProductTdDomAttributes(e, t, o) {
|
|
95
|
+
const i = h(t.itemsSelectValue, t.type);
|
|
96
|
+
o.modifyHtml(e).setAttribute("data-type", t.type), o.modifyHtml(e).setAttribute("data-number", i), o.modifyHtml(e).setAttribute("data-nodup", String(t.priceHideDiscount));
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
99
|
export {
|
|
102
100
|
p as BLOCK_ID,
|
|
103
|
-
|
|
101
|
+
O as ItemsBlock
|
|
104
102
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { escapeHtml as m } from "../../../utils/htmlEscape.js";
|
|
2
2
|
import { BlockType as R, BlockAttr as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
3
|
import { ItemsBlockId as O } from "./enums/controlEnums.js";
|
|
4
|
-
import { productPairs as h, templateFirstLine as
|
|
5
|
-
import { ItemInCartOptions as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { deriveItemNumber as
|
|
9
|
-
let [
|
|
10
|
-
const
|
|
11
|
-
const
|
|
4
|
+
import { productPairs as h, templateFirstLine as Y } from "./enums/productEnums.js";
|
|
5
|
+
import { ItemInCartOptions as q, SETTINGS_ENUMS as N, DefaultConfigValues as k } from "./enums/settingsEnums.js";
|
|
6
|
+
import j from "./layouts/horizontal.html.js";
|
|
7
|
+
import f from "./layouts/vertical.html.js";
|
|
8
|
+
import { deriveItemNumber as J, escapeReplacement as G } from "./utils/nodeConfigUtils.js";
|
|
9
|
+
let [X] = h.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [F] = h.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [x] = h.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [L] = h.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [V] = h.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
|
|
10
|
+
const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), U = (s) => D(s, "text-align"), y = (s, e) => {
|
|
11
|
+
const l = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = s.match(l);
|
|
12
12
|
return a ? a[1].trim() : null;
|
|
13
|
-
}, w = (s) => `<tr>${s}</tr>`,
|
|
14
|
-
const i =
|
|
13
|
+
}, w = (s) => `<tr>${s}</tr>`, Z = (s, e, l, a) => {
|
|
14
|
+
const i = l || k.productImageHeight, d = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
|
|
15
15
|
return w(`
|
|
16
16
|
<td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
|
|
17
17
|
align="center"
|
|
@@ -26,7 +26,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
26
26
|
href="#!">
|
|
27
27
|
<img class="adapt-img document-node-component ng-star-inserted"
|
|
28
28
|
style="object-fit: contain;"
|
|
29
|
-
src="${
|
|
29
|
+
src="${X}"
|
|
30
30
|
alt="${F}"
|
|
31
31
|
width="${i}"
|
|
32
32
|
height="${i}">
|
|
@@ -35,18 +35,18 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
35
35
|
`);
|
|
36
36
|
}, tt = (s, e) => `
|
|
37
37
|
<${R.BLOCK_IMAGE}
|
|
38
|
-
${S.BLOCK_IMAGE.src}="${
|
|
38
|
+
${S.BLOCK_IMAGE.src}="${X}"
|
|
39
39
|
${S.BLOCK_IMAGE.alt}="${F}"
|
|
40
40
|
${S.BLOCK_IMAGE.href}="#!"
|
|
41
|
-
${S.BLOCK_IMAGE.width}="${
|
|
42
|
-
${S.BLOCK_IMAGE.height}="${
|
|
41
|
+
${S.BLOCK_IMAGE.width}="${k.productImageWidth}"
|
|
42
|
+
${S.BLOCK_IMAGE.height}="${k.productImageWidth}"
|
|
43
43
|
esd-extension-block-id="${O.IMAGE}"
|
|
44
44
|
data-slot-1
|
|
45
45
|
product-attr="imageSrc"
|
|
46
46
|
data-type="${s}"
|
|
47
47
|
data-number="${e}"
|
|
48
48
|
/>
|
|
49
|
-
`, et = (s, e,
|
|
49
|
+
`, et = (s, e, l, a) => {
|
|
50
50
|
const i = `
|
|
51
51
|
word-wrap: break-word;
|
|
52
52
|
white-space: nowrap;
|
|
@@ -56,15 +56,15 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
56
56
|
max-width: 100%;
|
|
57
57
|
`;
|
|
58
58
|
if (e) {
|
|
59
|
-
const d = y(
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const d = y(l || "", "text-align") || "center", n = U(l || i), c = y(n, "font-weight"), r = y(n, "font-style"), p = c === "bold" || c === "700", t = r === "italic", o = D(
|
|
60
|
+
D(
|
|
61
|
+
D(n, "font-weight"),
|
|
62
62
|
"font-style"
|
|
63
63
|
),
|
|
64
64
|
"text-decoration"
|
|
65
|
-
), T = (a == null ? void 0 : a.nameVisible) === !1 ? "display: none;" : "display: table-cell;", _ =
|
|
66
|
-
let
|
|
67
|
-
return
|
|
65
|
+
), T = (a == null ? void 0 : a.nameVisible) === !1 ? "display: none;" : "display: table-cell;", _ = o ? ` style="${m(o)}"` : "";
|
|
66
|
+
let $ = F;
|
|
67
|
+
return p && ($ = `<strong>${$}</strong>`), t && ($ = `<em>${$}</em>`), w(`
|
|
68
68
|
<td class="esd-block-text es-p10"
|
|
69
69
|
align="${d}"
|
|
70
70
|
width="100%"
|
|
@@ -76,7 +76,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
76
76
|
path="1"
|
|
77
77
|
product-attr="name"
|
|
78
78
|
data-slot-2${_}>
|
|
79
|
-
${
|
|
79
|
+
${$}
|
|
80
80
|
</p>
|
|
81
81
|
</td>
|
|
82
82
|
`);
|
|
@@ -97,15 +97,15 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
97
97
|
</p>
|
|
98
98
|
</${R.BLOCK_TEXT}>
|
|
99
99
|
`;
|
|
100
|
-
}, at = (s, e,
|
|
100
|
+
}, at = (s, e, l, a, i, d, n, c, r, p) => {
|
|
101
101
|
let t = x;
|
|
102
102
|
if (a && a.trim()) {
|
|
103
|
-
const
|
|
104
|
-
t = (i || "0") === "1" ? `${x} ${
|
|
103
|
+
const E = `${a.trim()}`;
|
|
104
|
+
t = (i || "0") === "1" ? `${x} ${E}` : `${E} ${x}`;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
106
|
+
const o = i === "1" ? "after" : "before", T = `data-formated="${l ? "true" : "false"}"`, _ = `data-curency="${o}"`, $ = a ? `data-currency_symbol="${a}"` : "", u = `data-single_price="${c ? "true" : "false"}"`, I = r === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
|
|
107
107
|
if (d) {
|
|
108
|
-
const b =
|
|
108
|
+
const b = U(n || "color: #060606; white-space: nowrap; font-size: 20px;"), A = p ? "" : ' style="display: none;"';
|
|
109
109
|
return w(`
|
|
110
110
|
<td class="esd-block-text items-block-price${I}"
|
|
111
111
|
align="center"
|
|
@@ -119,7 +119,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
119
119
|
data-number="${e}"
|
|
120
120
|
${T}
|
|
121
121
|
${_}
|
|
122
|
-
${
|
|
122
|
+
${$}
|
|
123
123
|
${u}
|
|
124
124
|
style="${m(b)}">
|
|
125
125
|
${t}
|
|
@@ -149,20 +149,20 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
149
149
|
</p>
|
|
150
150
|
</${R.BLOCK_TEXT}>
|
|
151
151
|
`;
|
|
152
|
-
}, st = (s, e,
|
|
152
|
+
}, st = (s, e, l, a, i, d, n = !0, c, r, p) => {
|
|
153
153
|
let t = L;
|
|
154
154
|
if (a && a.trim()) {
|
|
155
|
-
const
|
|
156
|
-
t = (i || "0") === "1" ? `${L} ${
|
|
155
|
+
const E = `${a.trim()}`;
|
|
156
|
+
t = (i || "0") === "1" ? `${L} ${E}` : `${E} ${L}`;
|
|
157
157
|
}
|
|
158
|
-
const
|
|
158
|
+
const o = i === "1" ? "after" : "before", T = `data-formated="${l ? "true" : "false"}"`, _ = `data-curency="${o}"`, $ = n ? "" : ' style="display: none;"', u = `data-single_price="${r ? "true" : "false"}"`, I = p === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
|
|
159
159
|
if (d) {
|
|
160
|
-
const b =
|
|
160
|
+
const b = U(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
|
|
161
161
|
return w(`
|
|
162
162
|
<td class="esd-block-text items-block-price${I}"
|
|
163
163
|
esd-extension-block-id="${O.ORIGINAL_PRICE}"
|
|
164
164
|
width="100%"
|
|
165
|
-
align="center"${
|
|
165
|
+
align="center"${$}>
|
|
166
166
|
<p
|
|
167
167
|
product-attr="originalPrice"
|
|
168
168
|
contenteditable="false"
|
|
@@ -203,10 +203,10 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
203
203
|
</p>
|
|
204
204
|
</${R.BLOCK_TEXT}>
|
|
205
205
|
`;
|
|
206
|
-
}, lt = (s = !0, e,
|
|
206
|
+
}, lt = (s = !0, e, l) => {
|
|
207
207
|
const a = s ? "" : 'style="display: none;"';
|
|
208
208
|
if (e) {
|
|
209
|
-
const i = "font-size: 14px;", d = y(
|
|
209
|
+
const i = "font-size: 14px;", d = y(l || "", "text-align") || "center", n = U(l || i);
|
|
210
210
|
return w(`
|
|
211
211
|
<td class="esd-block-text es-p10 document-node-component default-block-component selectable"
|
|
212
212
|
width="100%" align="${d}"
|
|
@@ -218,7 +218,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
218
218
|
width="100%"
|
|
219
219
|
path="1"
|
|
220
220
|
style="${m(n)}">
|
|
221
|
-
${
|
|
221
|
+
${V}
|
|
222
222
|
</p>
|
|
223
223
|
</td>
|
|
224
224
|
`);
|
|
@@ -236,26 +236,26 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
236
236
|
data-slot-3
|
|
237
237
|
contenteditable="false"
|
|
238
238
|
width="100%">
|
|
239
|
-
${
|
|
239
|
+
${V}
|
|
240
240
|
</p>
|
|
241
241
|
</${R.BLOCK_TEXT}>
|
|
242
242
|
`;
|
|
243
|
-
}, rt = (s, e,
|
|
243
|
+
}, rt = (s, e, l = "Buy", a, i, d = !0, n = !0) => {
|
|
244
244
|
if (a) {
|
|
245
|
-
const c = y(i || "", "background") || y(i || "", "background-color"),
|
|
245
|
+
const c = y(i || "", "background") || y(i || "", "background-color"), r = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", p = d ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
|
|
246
246
|
return w(`
|
|
247
247
|
<td class="esd-block-button ins-button default-block-component selectable"
|
|
248
|
-
align="center" width="100%" name="buy-button" caption="${
|
|
248
|
+
align="center" width="100%" name="buy-button" caption="${l}"
|
|
249
249
|
esd-extension-block-id="${O.BUTTON}"
|
|
250
250
|
product-attr="button" data-slot-6="" data-type="${s}" data-number="${e}"
|
|
251
251
|
${n ? "" : ' style="display: none;"'}>
|
|
252
|
-
<span class="es-button-border ${
|
|
252
|
+
<span class="es-button-border ${p}" style="${m(r)}">
|
|
253
253
|
<a
|
|
254
254
|
class="es-button"
|
|
255
255
|
href="#!"
|
|
256
256
|
target="_blank"
|
|
257
257
|
style="${m(t)} padding: 5px 12px;">
|
|
258
|
-
${
|
|
258
|
+
${l}
|
|
259
259
|
</a>
|
|
260
260
|
</span>
|
|
261
261
|
</td>
|
|
@@ -266,27 +266,27 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
266
266
|
width="100%"
|
|
267
267
|
class="ins-button"
|
|
268
268
|
name="buy-button"
|
|
269
|
-
caption="${
|
|
269
|
+
caption="${l}"
|
|
270
270
|
align="center"
|
|
271
271
|
esd-extension-block-id="${O.BUTTON}"
|
|
272
272
|
product-attr="button"
|
|
273
273
|
data-slot-6
|
|
274
274
|
data-type="${s}"
|
|
275
275
|
data-number="${e}"
|
|
276
|
-
>${
|
|
276
|
+
>${l}
|
|
277
277
|
</${R.BLOCK_BUTTON}>
|
|
278
278
|
`;
|
|
279
|
-
}, ct = (s, e,
|
|
280
|
-
const d = e === N.ORIENTATION.VERTICAL, n =
|
|
279
|
+
}, ct = (s, e, l, a = !0, i = !0) => {
|
|
280
|
+
const d = e === N.ORIENTATION.VERTICAL, n = l === "horizontal";
|
|
281
281
|
if (d) {
|
|
282
|
-
const c = !n,
|
|
282
|
+
const c = !n, r = c || !i ? "100%" : "50%", p = c || !a ? "100%" : "50%";
|
|
283
283
|
let t = s.replace(
|
|
284
284
|
/<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
|
|
285
|
-
(
|
|
285
|
+
(o) => o.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
|
|
286
286
|
);
|
|
287
287
|
return t = t.replace(
|
|
288
288
|
/<td\s+[^>]*class="([^"]*product-original-price-class[^"]*)"[^>]*>/gi,
|
|
289
|
-
(
|
|
289
|
+
(o) => o.replace(/width="[^"]*"/gi, `width="${p}"`).replace(/width:\s*[^;]+;/gi, `width: ${p};`)
|
|
290
290
|
), t;
|
|
291
291
|
}
|
|
292
292
|
return n ? s : s.replace(
|
|
@@ -298,74 +298,74 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
|
|
|
298
298
|
);
|
|
299
299
|
}, it = (s) => s ? `<td align="center"
|
|
300
300
|
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
|
|
301
|
+
class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : Y, K = (s, e, l, a, i, d, n, c, r, p, t, o, T, _ = "horizontal", $, u, P, I) => {
|
|
302
|
+
const A = `${`data-type="${e}" data-number="${l}"`} data-orientation="${a}"`, M = r == null ? void 0 : r["data-product_image_control_image-height"], B = d ? Z(e, l, M, t) : tt(e, l), W = (t == null ? void 0 : t.buttonLabel) || "Buy", z = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, Q = e === N.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, H = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (r == null ? void 0 : r["data-product_button_control_enabled"]) !== "false", g = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (r == null ? void 0 : r["data-product_price_control_enabled"]) !== "false", v = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (r == null ? void 0 : r["data-product_original_price_control_enabled"]) !== "false", C = s.replace("{-{-TEMPLATE_FIRST_LINE-}-}", it(d)).replace("{-{-PRODUCT_IMAGE-}-}", B).replace("{-{-PRODUCT_NAME-}-}", et(e, d, o, t)).replaceAll(
|
|
303
303
|
"{-{-PRODUCT_PRICE-}-}",
|
|
304
|
-
|
|
304
|
+
G(at(
|
|
305
305
|
e,
|
|
306
|
-
|
|
306
|
+
l,
|
|
307
307
|
i,
|
|
308
308
|
n,
|
|
309
309
|
c,
|
|
310
310
|
d,
|
|
311
|
-
|
|
311
|
+
$,
|
|
312
312
|
I,
|
|
313
313
|
a,
|
|
314
|
-
|
|
314
|
+
g
|
|
315
315
|
))
|
|
316
316
|
).replaceAll(
|
|
317
317
|
"{-{-PRODUCT_ORIGINAL_PRICE-}-}",
|
|
318
|
-
|
|
318
|
+
G(st(
|
|
319
319
|
e,
|
|
320
|
-
|
|
320
|
+
l,
|
|
321
321
|
i,
|
|
322
322
|
n,
|
|
323
323
|
c,
|
|
324
324
|
d,
|
|
325
|
-
|
|
325
|
+
v,
|
|
326
326
|
u,
|
|
327
327
|
I,
|
|
328
328
|
a
|
|
329
329
|
))
|
|
330
|
-
).replace("{-{-PRODUCT_QUANTITY-}-}", lt(
|
|
330
|
+
).replace("{-{-PRODUCT_QUANTITY-}-}", lt(Q, d, P)).replace(
|
|
331
331
|
"{-{-PRODUCT_BUTTON-}-}",
|
|
332
|
-
rt(e,
|
|
332
|
+
rt(e, l, W, d, T, z, H)
|
|
333
333
|
).replace(
|
|
334
334
|
/<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
|
|
335
335
|
`<td$1 ${A}>`
|
|
336
336
|
);
|
|
337
337
|
return ct(
|
|
338
|
-
|
|
338
|
+
C,
|
|
339
339
|
a,
|
|
340
340
|
_,
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
g,
|
|
342
|
+
v
|
|
343
343
|
);
|
|
344
344
|
};
|
|
345
345
|
function It({
|
|
346
346
|
orientation: s,
|
|
347
347
|
itemsType: e = N.ITEMS_TYPE.CART_ITEMS,
|
|
348
|
-
itemId:
|
|
348
|
+
itemId: l,
|
|
349
349
|
currencySymbol: a,
|
|
350
350
|
currencyLocation: i,
|
|
351
351
|
migrate: d = !1,
|
|
352
352
|
formattedPrice: n = !0,
|
|
353
353
|
configBlockAttributes: c,
|
|
354
|
-
nodeConfig:
|
|
355
|
-
nameStyles:
|
|
354
|
+
nodeConfig: r,
|
|
355
|
+
nameStyles: p,
|
|
356
356
|
buttonStyles: t,
|
|
357
|
-
priceStyles:
|
|
357
|
+
priceStyles: o,
|
|
358
358
|
originalPriceStyles: T,
|
|
359
359
|
quantityStyles: _,
|
|
360
|
-
priceOrientation:
|
|
360
|
+
priceOrientation: $
|
|
361
361
|
}) {
|
|
362
|
-
const u =
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
I ? (x = n ?
|
|
366
|
-
const A =
|
|
367
|
-
return s === N.ORIENTATION.VERTICAL ?
|
|
368
|
-
|
|
362
|
+
const u = q[e].findIndex((M) => M.value === l), P = J(l, e), I = (r == null ? void 0 : r.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
|
|
363
|
+
X = h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[u >= 0 ? u : 0], F = h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[u >= 0 ? u : 0];
|
|
364
|
+
const E = h.PAIRS_FOR_EXTENSION.price[e], b = h.PAIRS_FOR_EXTENSION.originalPrice[e];
|
|
365
|
+
I ? (x = n ? E.DEFAULT_SINGLE_PRICE_FORMATTED : E.DEFAULT_SINGLE_PRICE, L = n ? b.DEFAULT_SINGLE_PRICE_FORMATTED : b.DEFAULT_SINGLE_PRICE) : (x = n ? E.DEFAULT_PRICE_FORMATTED : E.DEFAULT_PRICE, L = n ? b.DEFAULT_PRICE_FORMATTED : b.DEFAULT_PRICE), V = h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
|
|
366
|
+
const A = $ || (r == null ? void 0 : r.priceOrientation) || "horizontal";
|
|
367
|
+
return s === N.ORIENTATION.VERTICAL ? K(
|
|
368
|
+
f,
|
|
369
369
|
e,
|
|
370
370
|
P,
|
|
371
371
|
s,
|
|
@@ -374,18 +374,18 @@ function It({
|
|
|
374
374
|
a,
|
|
375
375
|
i,
|
|
376
376
|
c,
|
|
377
|
-
|
|
377
|
+
void 0,
|
|
378
378
|
// nodup
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
r,
|
|
380
|
+
p,
|
|
381
381
|
t,
|
|
382
382
|
A,
|
|
383
|
-
|
|
383
|
+
o,
|
|
384
384
|
T,
|
|
385
385
|
_,
|
|
386
386
|
I
|
|
387
|
-
) :
|
|
388
|
-
|
|
387
|
+
) : K(
|
|
388
|
+
j,
|
|
389
389
|
e,
|
|
390
390
|
P,
|
|
391
391
|
s,
|
|
@@ -394,13 +394,13 @@ function It({
|
|
|
394
394
|
a,
|
|
395
395
|
i,
|
|
396
396
|
c,
|
|
397
|
-
|
|
397
|
+
void 0,
|
|
398
398
|
// nodup
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
r,
|
|
400
|
+
p,
|
|
401
401
|
t,
|
|
402
402
|
A,
|
|
403
|
-
|
|
403
|
+
o,
|
|
404
404
|
T,
|
|
405
405
|
_,
|
|
406
406
|
I
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModificationDescription as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CommonControl as s } from "../../../common-control.js";
|
|
3
3
|
import { getCurrentLayout as l } from "../main/utils.js";
|
|
4
|
-
const
|
|
4
|
+
const u = "recommendation-card-background-color-control", e = {
|
|
5
5
|
CARD_BACKGROUND_COLOR: "cardBackgroundColor"
|
|
6
6
|
}, a = {
|
|
7
7
|
GRID: ".product-card-segment",
|
|
@@ -9,17 +9,13 @@ const i = "recommendation-card-background-color-control", e = {
|
|
|
9
9
|
};
|
|
10
10
|
class _ extends s {
|
|
11
11
|
getId() {
|
|
12
|
-
return
|
|
12
|
+
return u;
|
|
13
13
|
}
|
|
14
14
|
getTemplate() {
|
|
15
|
-
return
|
|
16
|
-
<div class="card-bg-control-container">
|
|
17
|
-
${this._GuTwoColumns([
|
|
15
|
+
return this._GuTwoColumns([
|
|
18
16
|
this._GuLabel({ text: this.api.translate("Card Background Color") }),
|
|
19
17
|
this._GuColorPicker(e.CARD_BACKGROUND_COLOR)
|
|
20
|
-
])
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
18
|
+
]);
|
|
23
19
|
}
|
|
24
20
|
onRender() {
|
|
25
21
|
this._setFormValues(), this._listenToFormUpdates();
|
|
@@ -75,6 +71,6 @@ class _ extends s {
|
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
export {
|
|
78
|
-
|
|
74
|
+
u as CARD_BACKGROUND_COLOR_CONTROL_ID,
|
|
79
75
|
_ as CardBackgroundColorControl
|
|
80
76
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var M = (u, s, t) => s in u ? y(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
|
|
3
|
+
var g = (u, s, t) => M(u, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as E } from "../../../common-control.js";
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as L } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as P, MAX_SPACING as G, MIN_SPACING as R, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as I } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as p } from "../../services/configService.js";
|
|
9
9
|
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
12
|
-
import { useDebounceFn as
|
|
13
|
-
const
|
|
10
|
+
import { safeGetStyle as f, safeGetParent as B } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as _, getBlockElement as U } from "../main/utils.js";
|
|
12
|
+
import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
|
+
const V = "recommendation-spacing-control", o = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
15
15
|
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
16
16
|
ROW_SPACING: "rowSpacing",
|
|
@@ -19,97 +19,67 @@ const U = "recommendation-spacing-control", n = {
|
|
|
19
19
|
MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
|
|
20
20
|
MOBILE_ROW_SPACING: "mobileRowSpacing",
|
|
21
21
|
MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
|
|
22
|
-
},
|
|
22
|
+
}, b = {
|
|
23
23
|
COLUMN_SPACING: "data-column-spacing",
|
|
24
24
|
ROW_SPACING: "data-row-spacing",
|
|
25
25
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
26
26
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function O(u, s) {
|
|
29
29
|
if (!u)
|
|
30
30
|
return s;
|
|
31
31
|
const t = parseFloat(u);
|
|
32
32
|
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
|
-
class j extends
|
|
34
|
+
class j extends E {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
g(this, "store", w());
|
|
38
|
+
g(this, "unsubscribeOrientation", null);
|
|
39
39
|
/**
|
|
40
40
|
* Debounced version of _onColumnSpacingChange
|
|
41
41
|
* Prevents excessive DOM updates when user rapidly adjusts the counter
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
g(this, "_debouncedOnColumnSpacingChange", N((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
g(this, "_debouncedOnRowSpacingChange", N((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
g(this, "_debouncedOnMobileColumnSpacingChange", N((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
g(this, "_debouncedOnMobileRowSpacingChange", N((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
65
65
|
getId() {
|
|
66
|
-
return
|
|
66
|
+
return V;
|
|
67
67
|
}
|
|
68
68
|
getTemplate() {
|
|
69
69
|
return `
|
|
70
70
|
<div class="spacing-control-container">
|
|
71
|
-
${this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
text: this.api.translate("Row Spacing (px)"),
|
|
84
|
-
name: n.ROW_SPACING_LABEL
|
|
85
|
-
}),
|
|
86
|
-
this._GuCounter({
|
|
87
|
-
name: n.ROW_SPACING,
|
|
88
|
-
minValue: b,
|
|
89
|
-
maxValue: N,
|
|
90
|
-
step: _
|
|
91
|
-
}),
|
|
92
|
-
this._GuLabel({
|
|
93
|
-
text: this.api.translate("Column Spacing on Mobile (px)"),
|
|
94
|
-
name: n.MOBILE_COLUMN_SPACING_LABEL
|
|
95
|
-
}),
|
|
96
|
-
this._GuCounter({
|
|
97
|
-
name: n.MOBILE_COLUMN_SPACING,
|
|
98
|
-
minValue: b,
|
|
99
|
-
maxValue: N,
|
|
100
|
-
step: _
|
|
101
|
-
}),
|
|
102
|
-
this._GuLabel({
|
|
103
|
-
text: this.api.translate("Row Spacing on Mobile (px)"),
|
|
104
|
-
name: n.MOBILE_ROW_SPACING_LABEL
|
|
105
|
-
}),
|
|
106
|
-
this._GuCounter({
|
|
107
|
-
name: n.MOBILE_ROW_SPACING,
|
|
108
|
-
minValue: b,
|
|
109
|
-
maxValue: N,
|
|
110
|
-
step: _
|
|
111
|
-
})
|
|
112
|
-
])}
|
|
71
|
+
${this._spacingRow("Column Spacing (px)", o.COLUMN_SPACING_LABEL, o.COLUMN_SPACING)}
|
|
72
|
+
${this._spacingRow("Row Spacing (px)", o.ROW_SPACING_LABEL, o.ROW_SPACING)}
|
|
73
|
+
${this._spacingRow(
|
|
74
|
+
"Column Spacing on Mobile (px)",
|
|
75
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
76
|
+
o.MOBILE_COLUMN_SPACING
|
|
77
|
+
)}
|
|
78
|
+
${this._spacingRow(
|
|
79
|
+
"Row Spacing on Mobile (px)",
|
|
80
|
+
o.MOBILE_ROW_SPACING_LABEL,
|
|
81
|
+
o.MOBILE_ROW_SPACING
|
|
82
|
+
)}
|
|
113
83
|
</div>
|
|
114
84
|
`;
|
|
115
85
|
}
|
|
@@ -122,6 +92,21 @@ class j extends R {
|
|
|
122
92
|
onDestroy() {
|
|
123
93
|
this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
|
|
124
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* One label + counter per two-column row, so every spacing field gets the same
|
|
97
|
+
* 16px-padded row the color controls already render instead of sharing one grid.
|
|
98
|
+
*/
|
|
99
|
+
_spacingRow(t, e, n) {
|
|
100
|
+
return this._GuTwoColumns([
|
|
101
|
+
this._GuLabel({ text: this.api.translate(t), name: e }),
|
|
102
|
+
this._GuCounter({
|
|
103
|
+
name: n,
|
|
104
|
+
minValue: R,
|
|
105
|
+
maxValue: G,
|
|
106
|
+
step: P
|
|
107
|
+
})
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
125
110
|
/**
|
|
126
111
|
* Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
|
|
127
112
|
* - List layout: hide column spacing (products are full-width), hide ALL mobile
|
|
@@ -132,14 +117,14 @@ class j extends R {
|
|
|
132
117
|
_updateSpacingVisibility() {
|
|
133
118
|
if (!this.api)
|
|
134
119
|
return;
|
|
135
|
-
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e ||
|
|
136
|
-
this.api.setVisibility(
|
|
137
|
-
|
|
120
|
+
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || _(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, c = t.mobileCardsInRow > 1;
|
|
121
|
+
this.api.setVisibility(o.COLUMN_SPACING, i && r), this.api.setVisibility(o.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(o.ROW_SPACING, !0), this.api.setVisibility(o.ROW_SPACING_LABEL, !0), this.api.setVisibility(
|
|
122
|
+
o.MOBILE_COLUMN_SPACING,
|
|
138
123
|
i && a && c
|
|
139
124
|
), this.api.setVisibility(
|
|
140
|
-
|
|
125
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
141
126
|
i && a && c
|
|
142
|
-
), this.api.setVisibility(
|
|
127
|
+
), this.api.setVisibility(o.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(o.MOBILE_ROW_SPACING_LABEL, i && a);
|
|
143
128
|
}
|
|
144
129
|
/**
|
|
145
130
|
* Reads spacing values from node config first, falls back to DOM styles.
|
|
@@ -148,12 +133,12 @@ class j extends R {
|
|
|
148
133
|
_setFormValues() {
|
|
149
134
|
if (!this.api)
|
|
150
135
|
return;
|
|
151
|
-
const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode),
|
|
136
|
+
const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
|
|
152
137
|
this.api.updateValues({
|
|
153
|
-
[
|
|
154
|
-
[
|
|
155
|
-
[
|
|
156
|
-
[
|
|
138
|
+
[o.COLUMN_SPACING]: n,
|
|
139
|
+
[o.ROW_SPACING]: i,
|
|
140
|
+
[o.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
|
|
141
|
+
[o.MOBILE_ROW_SPACING]: e.mobileRowSpacing
|
|
157
142
|
});
|
|
158
143
|
}
|
|
159
144
|
/**
|
|
@@ -165,20 +150,20 @@ class j extends R {
|
|
|
165
150
|
*/
|
|
166
151
|
_getStoredColumnSpacing() {
|
|
167
152
|
if (!this.currentNode)
|
|
168
|
-
return
|
|
169
|
-
const t = this.currentNode.querySelector(
|
|
170
|
-
if (
|
|
171
|
-
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d =
|
|
153
|
+
return C;
|
|
154
|
+
const t = this.currentNode.querySelector(m) ?? this.currentNode;
|
|
155
|
+
if (_(this.currentNode) === "grid") {
|
|
156
|
+
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = f(l, "padding");
|
|
172
157
|
if (!d)
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
return
|
|
158
|
+
return C;
|
|
159
|
+
const A = d.trim().split(/\s+/);
|
|
160
|
+
return A.length < 2 ? C : O(A[1], C / 2) * 2;
|
|
176
161
|
}
|
|
177
|
-
const
|
|
162
|
+
const n = t.querySelector(".product-card-wrapper") ?? null, i = B(n), a = f(i, "padding");
|
|
178
163
|
if (!a)
|
|
179
|
-
return
|
|
164
|
+
return C;
|
|
180
165
|
const r = a.trim().split(/\s+/);
|
|
181
|
-
return r.length < 2 ?
|
|
166
|
+
return r.length < 2 ? C : O(r[1], C / 2) * 2;
|
|
182
167
|
}
|
|
183
168
|
/**
|
|
184
169
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -186,9 +171,9 @@ class j extends R {
|
|
|
186
171
|
*/
|
|
187
172
|
_getStoredRowSpacing() {
|
|
188
173
|
if (!this.currentNode)
|
|
189
|
-
return
|
|
190
|
-
const e = (this.currentNode.querySelector(
|
|
191
|
-
return
|
|
174
|
+
return I;
|
|
175
|
+
const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer") ?? null, n = f(e, "height");
|
|
176
|
+
return O(n, I);
|
|
192
177
|
}
|
|
193
178
|
// ========================================================================
|
|
194
179
|
// Desktop Spacing Handlers
|
|
@@ -205,9 +190,9 @@ class j extends R {
|
|
|
205
190
|
this.currentNode,
|
|
206
191
|
{ columnSpacing: t },
|
|
207
192
|
`Changed column spacing to ${t}px`
|
|
208
|
-
), this._storeDataAttribute(
|
|
209
|
-
const
|
|
210
|
-
c && (
|
|
193
|
+
), this._storeDataAttribute(b.COLUMN_SPACING, t);
|
|
194
|
+
const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(m);
|
|
195
|
+
c && (n === "grid" ? Array.from(
|
|
211
196
|
c.querySelectorAll(".attribute-cell")
|
|
212
197
|
).forEach((l) => {
|
|
213
198
|
i.modifyHtml(l).setStyle("padding", r);
|
|
@@ -216,7 +201,7 @@ class j extends R {
|
|
|
216
201
|
).forEach((l) => {
|
|
217
202
|
const d = "parent" in l ? l.parent() : void 0;
|
|
218
203
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
219
|
-
}), i.apply(new
|
|
204
|
+
}), i.apply(new S(`Update column spacing to ${t}px`)));
|
|
220
205
|
}
|
|
221
206
|
/**
|
|
222
207
|
* Handles row spacing changes for desktop.
|
|
@@ -230,19 +215,19 @@ class j extends R {
|
|
|
230
215
|
this.currentNode,
|
|
231
216
|
{ rowSpacing: t },
|
|
232
217
|
`Changed row spacing to ${t}px`
|
|
233
|
-
), this._storeDataAttribute(
|
|
234
|
-
const e = this.currentNode.querySelector(
|
|
218
|
+
), this._storeDataAttribute(b.ROW_SPACING, t);
|
|
219
|
+
const e = this.currentNode.querySelector(m);
|
|
235
220
|
if (!e)
|
|
236
221
|
return;
|
|
237
|
-
const
|
|
222
|
+
const n = Array.from(
|
|
238
223
|
e.querySelectorAll(".spacer")
|
|
239
224
|
);
|
|
240
|
-
if (!
|
|
225
|
+
if (!n.length)
|
|
241
226
|
return;
|
|
242
227
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
243
|
-
|
|
228
|
+
n.forEach((r) => {
|
|
244
229
|
i.modifyHtml(r).setStyle("height", a);
|
|
245
|
-
}), i.apply(new
|
|
230
|
+
}), i.apply(new S(`Update row spacing to ${t}px`));
|
|
246
231
|
}
|
|
247
232
|
// ========================================================================
|
|
248
233
|
// Mobile Spacing Handlers
|
|
@@ -259,9 +244,9 @@ class j extends R {
|
|
|
259
244
|
this.currentNode,
|
|
260
245
|
{ mobileColumnSpacing: t },
|
|
261
246
|
`Changed mobile column spacing to ${t}px`
|
|
262
|
-
), this._storeDataAttribute(
|
|
263
|
-
const
|
|
264
|
-
c && (
|
|
247
|
+
), this._storeDataAttribute(b.MOBILE_COLUMN_SPACING, t);
|
|
248
|
+
const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(L);
|
|
249
|
+
c && (n === "grid" ? Array.from(
|
|
265
250
|
c.querySelectorAll(".attribute-cell")
|
|
266
251
|
).forEach((l) => {
|
|
267
252
|
i.modifyHtml(l).setStyle("padding", r);
|
|
@@ -270,7 +255,7 @@ class j extends R {
|
|
|
270
255
|
).forEach((l) => {
|
|
271
256
|
const d = "parent" in l ? l.parent() : void 0;
|
|
272
257
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
273
|
-
}), i.apply(new
|
|
258
|
+
}), i.apply(new S(`Update mobile column spacing to ${t}px`)));
|
|
274
259
|
}
|
|
275
260
|
/**
|
|
276
261
|
* Handles row spacing changes for mobile.
|
|
@@ -284,19 +269,19 @@ class j extends R {
|
|
|
284
269
|
this.currentNode,
|
|
285
270
|
{ mobileRowSpacing: t },
|
|
286
271
|
`Changed mobile row spacing to ${t}px`
|
|
287
|
-
), this._storeDataAttribute(
|
|
288
|
-
const e = this.currentNode.querySelector(
|
|
272
|
+
), this._storeDataAttribute(b.MOBILE_ROW_SPACING, t);
|
|
273
|
+
const e = this.currentNode.querySelector(L);
|
|
289
274
|
if (!e)
|
|
290
275
|
return;
|
|
291
|
-
const
|
|
276
|
+
const n = Array.from(
|
|
292
277
|
e.querySelectorAll(".spacer")
|
|
293
278
|
);
|
|
294
|
-
if (!
|
|
279
|
+
if (!n.length)
|
|
295
280
|
return;
|
|
296
281
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
297
|
-
|
|
282
|
+
n.forEach((r) => {
|
|
298
283
|
i.modifyHtml(r).setStyle("height", a);
|
|
299
|
-
}), i.apply(new
|
|
284
|
+
}), i.apply(new S(`Update mobile row spacing to ${t}px`));
|
|
300
285
|
}
|
|
301
286
|
// ========================================================================
|
|
302
287
|
// Data Attribute Storage
|
|
@@ -305,23 +290,23 @@ class j extends R {
|
|
|
305
290
|
* Stores a spacing value as a data attribute on the block root element
|
|
306
291
|
*/
|
|
307
292
|
_storeDataAttribute(t, e) {
|
|
308
|
-
const
|
|
309
|
-
|
|
293
|
+
const n = U(this.currentNode);
|
|
294
|
+
n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new S(`Store ${t}`));
|
|
310
295
|
}
|
|
311
296
|
// ========================================================================
|
|
312
297
|
// Event Listeners
|
|
313
298
|
// ========================================================================
|
|
314
299
|
_listenToFormUpdates() {
|
|
315
|
-
this.api.onValueChanged(
|
|
300
|
+
this.api.onValueChanged(o.COLUMN_SPACING, (t) => {
|
|
316
301
|
const e = parseInt(t);
|
|
317
302
|
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
318
|
-
}), this.api.onValueChanged(
|
|
303
|
+
}), this.api.onValueChanged(o.ROW_SPACING, (t) => {
|
|
319
304
|
const e = parseInt(t);
|
|
320
305
|
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
321
|
-
}), this.api.onValueChanged(
|
|
306
|
+
}), this.api.onValueChanged(o.MOBILE_COLUMN_SPACING, (t) => {
|
|
322
307
|
const e = parseInt(t);
|
|
323
308
|
Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
|
|
324
|
-
}), this.api.onValueChanged(
|
|
309
|
+
}), this.api.onValueChanged(o.MOBILE_ROW_SPACING, (t) => {
|
|
325
310
|
const e = parseInt(t);
|
|
326
311
|
Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
|
|
327
312
|
});
|
|
@@ -337,6 +322,6 @@ class j extends R {
|
|
|
337
322
|
}
|
|
338
323
|
}
|
|
339
324
|
export {
|
|
340
|
-
|
|
325
|
+
V as SPACING_CONTROL_ID,
|
|
341
326
|
j as SpacingControl
|
|
342
327
|
};
|
|
@@ -25,6 +25,27 @@ const n = `/* Utils */
|
|
|
25
25
|
border-top: none;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* The editor's row-separator rule only reaches \`.container\`s that are direct
|
|
29
|
+
children of \`.container-wrapper\`; the spacing rows sit one level deeper, so the
|
|
30
|
+
first one loses its line. Restore it with the editor's own border token. */
|
|
31
|
+
.spacing-control-container > .container {
|
|
32
|
+
border-top: var(--ue-border-width-1, 1px) solid var(--ue-panels-border-color, rgba(0, 0, 0, 0.07));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* A spacing field that doesn't apply (mobile rows, column spacing in list layout) is
|
|
36
|
+
removed from its row and leaves the wrapper behind — collapse it so it can't
|
|
37
|
+
render as an empty separator-topped strip. */
|
|
38
|
+
.spacing-control-container > .container:not(:has(ue-counter)) {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* The block background row stacks the editor's "inherits background color" banner
|
|
43
|
+
above its field, separated by the editor's default 10px gap — match the tab's 16px.
|
|
44
|
+
Scoped via the spacing control so other blocks keep the default. */
|
|
45
|
+
.ue-scrollable-content:has(.spacing-control-container) .e2e-block-bg-color {
|
|
46
|
+
row-gap: 16px;
|
|
47
|
+
}
|
|
48
|
+
|
|
28
49
|
/* Right-align the mobile layout toggle within the two-column grid */
|
|
29
50
|
.product-layout-control-container ue-switcher {
|
|
30
51
|
justify-self: end;
|
|
@@ -30,6 +30,11 @@ export declare class SpacingControl extends CommonControl {
|
|
|
30
30
|
onRender(): void;
|
|
31
31
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
32
32
|
onDestroy(): void;
|
|
33
|
+
/**
|
|
34
|
+
* One label + counter per two-column row, so every spacing field gets the same
|
|
35
|
+
* 16px-padded row the color controls already render instead of sharing one grid.
|
|
36
|
+
*/
|
|
37
|
+
_spacingRow(label: string, labelName: string, counterName: string): string;
|
|
33
38
|
/**
|
|
34
39
|
* Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
|
|
35
40
|
* - List layout: hide column spacing (products are full-width), hide ALL mobile
|
|
@@ -1,108 +1,88 @@
|
|
|
1
|
-
import { productPairs as
|
|
2
|
-
import { DefaultConfigValues as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let b = E;
|
|
17
|
-
for (; b > 0 && /\s/.test(h[b - 1]); )
|
|
18
|
-
b -= 1;
|
|
19
|
-
if (!_.some((P) => h.endsWith(P, b)))
|
|
20
|
-
return !1;
|
|
21
|
-
E = h.indexOf(g, E + g.length);
|
|
22
|
-
}
|
|
23
|
-
return !0;
|
|
24
|
-
}
|
|
25
|
-
function J(h) {
|
|
26
|
-
const g = q(h), _ = new DOMParser().parseFromString(g, "text/html");
|
|
27
|
-
v(_);
|
|
28
|
-
const E = w.PAIRS_FOR_EXTENSION;
|
|
29
|
-
Object.entries(E).forEach(([r, l]) => {
|
|
30
|
-
_.querySelectorAll(".ins-product-td").forEach((f) => {
|
|
31
|
-
const p = f.getAttribute("data-number") || "1", R = f.getAttribute("data-type") || "CART_ITEMS";
|
|
32
|
-
f.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
33
|
-
var k, D, x;
|
|
34
|
-
const S = t.getAttribute("data-type") || R, u = t.getAttribute("data-number") || p, A = l[S];
|
|
35
|
-
if (A)
|
|
1
|
+
import { productPairs as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
+
import { DefaultConfigValues as O } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
3
|
+
import { preserveTextStyles as C } from "./preserveTextStyles.js";
|
|
4
|
+
import { unwrapProductNameLinks as U } from "./unwrapProductNameLink.js";
|
|
5
|
+
function Y(L) {
|
|
6
|
+
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), b = new DOMParser().parseFromString(H, "text/html");
|
|
7
|
+
U(b);
|
|
8
|
+
const R = q.PAIRS_FOR_EXTENSION;
|
|
9
|
+
Object.entries(R).forEach(([r, u]) => {
|
|
10
|
+
b.querySelectorAll(".ins-product-td").forEach((l) => {
|
|
11
|
+
const h = l.getAttribute("data-number") || "1", $ = l.getAttribute("data-type") || "CART_ITEMS";
|
|
12
|
+
l.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
13
|
+
var F, I, w;
|
|
14
|
+
const T = t.getAttribute("data-type") || $, f = t.getAttribute("data-number") || h, d = u[T];
|
|
15
|
+
if (d)
|
|
36
16
|
switch (r) {
|
|
37
17
|
case "imageSrc": {
|
|
38
18
|
let e = null, c = null;
|
|
39
19
|
if (t.tagName === "IMG" ? (e = t, c = e.closest("a")) : (e = t.querySelector("img"), c = t.querySelector("a") || t.closest("a")), !e)
|
|
40
20
|
break;
|
|
41
|
-
const i =
|
|
21
|
+
const i = d.DEFAULT, a = d.ATTR;
|
|
42
22
|
if (i && e.src) {
|
|
43
23
|
const o = e.src;
|
|
44
|
-
i.some((
|
|
45
|
-
const
|
|
46
|
-
return o.includes(
|
|
47
|
-
}) && (e.src = `{{${
|
|
24
|
+
i.some((E) => {
|
|
25
|
+
const s = E.split("/").pop() || "", g = o.split("/").pop() || "";
|
|
26
|
+
return o.includes(E) || o.includes(s) || g === s;
|
|
27
|
+
}) && (e.src = `{{${a}_${f}}}`);
|
|
48
28
|
}
|
|
49
|
-
const n = (
|
|
50
|
-
if (n && e.setAttribute("alt", `{{${n}_${
|
|
51
|
-
const o = (
|
|
29
|
+
const n = (I = (F = R.name) == null ? void 0 : F[T]) == null ? void 0 : I.ATTR;
|
|
30
|
+
if (n && e.setAttribute("alt", `{{${n}_${f}}}`), c) {
|
|
31
|
+
const o = (w = R.itemLink) == null ? void 0 : w[T];
|
|
52
32
|
if (o) {
|
|
53
|
-
const
|
|
54
|
-
(
|
|
33
|
+
const A = o.HREF, E = o.DEFAULT_HREF || "#!", s = c.href;
|
|
34
|
+
(s === "#" || s === "" || s.endsWith("#!") || s.endsWith(E) || s === `${window.location.href}${E}` || !s || s === window.location.href) && (c.href = `{{${A}_${f}}}`);
|
|
55
35
|
}
|
|
56
36
|
}
|
|
57
37
|
break;
|
|
58
38
|
}
|
|
59
39
|
case "name": {
|
|
60
|
-
const e =
|
|
61
|
-
t.textContent && (t.innerHTML =
|
|
40
|
+
const e = d, c = e.ATTR, i = e.DEFAULT_HREF || "#!", a = e.HREF;
|
|
41
|
+
t.textContent && (t.innerHTML = C(t, `{{${c}_${f}}}`));
|
|
62
42
|
const n = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
63
|
-
if (n &&
|
|
64
|
-
const o = n.href,
|
|
65
|
-
(o ===
|
|
43
|
+
if (n && a) {
|
|
44
|
+
const o = n.href, A = `${window.location.href}${i}`;
|
|
45
|
+
(o === A || o.endsWith(i)) && (n.href = `{{${a}_${f}}}`);
|
|
66
46
|
}
|
|
67
47
|
break;
|
|
68
48
|
}
|
|
69
49
|
case "price":
|
|
70
50
|
case "originalPrice": {
|
|
71
|
-
const e =
|
|
72
|
-
let
|
|
73
|
-
n ?
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
|
|
51
|
+
const e = d, c = t.getAttribute("data-formated"), i = t.getAttribute("data-single_price"), a = c === "true", n = i === "true", o = t.getAttribute("data-curency") || "before";
|
|
52
|
+
let A;
|
|
53
|
+
n ? A = a ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : A = a ? e.PRICE_FORMATTED : e.PRICE;
|
|
54
|
+
const E = e.CURRENCY;
|
|
55
|
+
let s = `{{${A}_${f}}}`;
|
|
56
|
+
const g = (t.getAttribute("data-currency_symbol") || "").trim(), N = g !== "" && g !== O.productPriceCurrencySymbolControlValue;
|
|
57
|
+
let m = "";
|
|
58
|
+
N ? m = g : E && (m = `{{${E}_${f}}}`), m && (s = o === "after" ? `${s} ${m}` : `${m} ${s}`), t.innerHTML = C(t, s);
|
|
79
59
|
break;
|
|
80
60
|
}
|
|
81
61
|
case "quantity": {
|
|
82
|
-
const e =
|
|
83
|
-
t.textContent && t.textContent.trim() === i && (t.innerHTML =
|
|
62
|
+
const e = d, c = e.ATTR, i = e.DEFAULT;
|
|
63
|
+
t.textContent && t.textContent.trim() === i && (t.innerHTML = C(t, `{{${c}_${f}}}`));
|
|
84
64
|
break;
|
|
85
65
|
}
|
|
86
66
|
case "button": {
|
|
87
|
-
const e =
|
|
88
|
-
if (
|
|
89
|
-
const n =
|
|
90
|
-
(n === "" || n === "#" || n === o || n.endsWith(i) || n.endsWith("#!") || n === window.location.href) && (
|
|
67
|
+
const e = d, c = e.HREF, i = e.DEFAULT_HREF || "#!", a = t.tagName === "A" ? t : t.querySelector("a");
|
|
68
|
+
if (a) {
|
|
69
|
+
const n = a.href || "", o = `${window.location.href}${i}`;
|
|
70
|
+
(n === "" || n === "#" || n === o || n.endsWith(i) || n.endsWith("#!") || n === window.location.href) && (a.href = `{{${c}_${f}}}`);
|
|
91
71
|
}
|
|
92
72
|
break;
|
|
93
73
|
}
|
|
94
74
|
case "itemLink": {
|
|
95
|
-
const e =
|
|
96
|
-
if (
|
|
97
|
-
const n =
|
|
98
|
-
(n === o || n.endsWith(i)) && (
|
|
75
|
+
const e = d, c = e.HREF, i = e.DEFAULT_HREF || "#!", a = t;
|
|
76
|
+
if (a.href) {
|
|
77
|
+
const n = a.href, o = `${window.location.href}${i}`;
|
|
78
|
+
(n === o || n.endsWith(i)) && (a.href = `{{${c}_${f}}}`);
|
|
99
79
|
}
|
|
100
80
|
break;
|
|
101
81
|
}
|
|
102
82
|
default: {
|
|
103
|
-
if ("ATTR" in
|
|
104
|
-
const e =
|
|
105
|
-
t.textContent && (t.innerHTML =
|
|
83
|
+
if ("ATTR" in d) {
|
|
84
|
+
const e = d.ATTR;
|
|
85
|
+
t.textContent && (t.innerHTML = C(t, `{{${e}_${f}}}`));
|
|
106
86
|
}
|
|
107
87
|
break;
|
|
108
88
|
}
|
|
@@ -110,53 +90,55 @@ function J(h) {
|
|
|
110
90
|
});
|
|
111
91
|
});
|
|
112
92
|
});
|
|
113
|
-
const
|
|
114
|
-
` : "",
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
93
|
+
const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
|
|
94
|
+
` : "", D = b.querySelectorAll(".ins-product-td"), M = [];
|
|
95
|
+
D.forEach((r) => {
|
|
96
|
+
const u = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", l = r.outerHTML;
|
|
97
|
+
M.push({
|
|
118
98
|
element: r,
|
|
119
|
-
outerHtml:
|
|
120
|
-
type:
|
|
121
|
-
number:
|
|
99
|
+
outerHtml: l,
|
|
100
|
+
type: u,
|
|
101
|
+
number: p
|
|
122
102
|
});
|
|
123
103
|
});
|
|
124
|
-
let
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
104
|
+
let _ = P + b.documentElement.outerHTML;
|
|
105
|
+
M.reverse().forEach(({ outerHtml: r, type: u, number: p }) => {
|
|
106
|
+
let l = "";
|
|
107
|
+
switch (u) {
|
|
108
|
+
case "CART_ITEMS":
|
|
109
|
+
l = "ins_apr_total_product_kind";
|
|
110
|
+
break;
|
|
111
|
+
case "BROWSED_ITEMS":
|
|
112
|
+
l = "browsed_item_total_product_kind";
|
|
113
|
+
break;
|
|
114
|
+
case "PURCHASED_ITEMS":
|
|
115
|
+
l = "purchased_item_total_product_kind";
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (l) {
|
|
119
|
+
const $ = parseInt(p) - 1, T = `${`{% if ${l} > ${$} %}`}${r}{% endif %}`;
|
|
120
|
+
_ = _.replace(r, T);
|
|
130
121
|
}
|
|
131
122
|
});
|
|
132
|
-
const
|
|
133
|
-
return
|
|
134
|
-
var
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
137
|
-
return;
|
|
138
|
-
const f = r.closest(".product-original-price-class");
|
|
139
|
-
if (!f)
|
|
140
|
-
return;
|
|
141
|
-
const p = f.outerHTML;
|
|
142
|
-
if (((t = r.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup")) === "false") {
|
|
143
|
-
M.add(p);
|
|
123
|
+
const x = b.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), S = [];
|
|
124
|
+
return x.forEach((r) => {
|
|
125
|
+
var $;
|
|
126
|
+
const u = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
127
|
+
if (!u || p !== "CART_ITEMS" || (($ = r.closest(".ins-product-td")) == null ? void 0 : $.getAttribute("data-nodup")) === "false")
|
|
144
128
|
return;
|
|
129
|
+
const h = r.closest(".product-original-price-class");
|
|
130
|
+
if (h) {
|
|
131
|
+
const y = h.outerHTML;
|
|
132
|
+
S.some((T) => T.tdOuterHtml === y) || S.push({ tdOuterHtml: y, number: u });
|
|
145
133
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
]);
|
|
154
|
-
r.includes("{% if") || m || (y = y.replaceAll(
|
|
155
|
-
r,
|
|
156
|
-
N(`${R}${r}{% endif %}`)
|
|
157
|
-
));
|
|
158
|
-
}), y.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
134
|
+
}), S.reverse().forEach(({ tdOuterHtml: r, number: u }) => {
|
|
135
|
+
const p = `{% if ins_apr_price_${u} != ins_apr_originalprice_${u} %}`;
|
|
136
|
+
if (!_.includes(p) && !r.includes("{% if")) {
|
|
137
|
+
const h = `${p}${r}{% endif %}`;
|
|
138
|
+
_ = _.replace(r, h);
|
|
139
|
+
}
|
|
140
|
+
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
159
141
|
}
|
|
160
142
|
export {
|
|
161
|
-
|
|
143
|
+
Y as pairProductVariables
|
|
162
144
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.15.0-beta.
|
|
3
|
+
"version": "3.15.0-beta.f5247a0",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|