@useinsider/guido 3.9.0-beta.416925b → 3.9.0-beta.4cb7fb8
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,45 +1,45 @@
|
|
|
1
1
|
import { useConfig as q } from "../../../composables/useConfig.js";
|
|
2
|
-
import { useRecommendation as
|
|
3
|
-
import { CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
2
|
+
import { useRecommendation as E } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as w } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as R } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
|
|
6
|
-
function
|
|
7
|
-
const i = `{{${s}${t}_${
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
for (;
|
|
13
|
-
[
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
function
|
|
17
|
-
switch (
|
|
6
|
+
function $(t, r, e, o, s = "") {
|
|
7
|
+
const i = `{{${s}${t}_${r}_${e}}}`, n = `{{${s}${t}_${r}_currency}}`;
|
|
8
|
+
return o === "before" ? `${n} ${i}` : `${i} ${n}`;
|
|
9
|
+
}
|
|
10
|
+
function b(t) {
|
|
11
|
+
let r = t;
|
|
12
|
+
for (; r.children.length === 1; )
|
|
13
|
+
[r] = r.children;
|
|
14
|
+
return r;
|
|
15
|
+
}
|
|
16
|
+
function S(t, r, e, o, s, i) {
|
|
17
|
+
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const n = t.querySelector("img");
|
|
20
|
+
n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
|
|
21
21
|
const c = t.querySelector("a");
|
|
22
|
-
c && (c.setAttribute("href", `{{${i}${e}_${
|
|
22
|
+
c && (c.setAttribute("href", `{{${i}${e}_${o}_url}}`), c.classList.add(w));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const n = t.querySelector("p");
|
|
27
|
+
n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "productPrice": {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const n = t.querySelector(".product-price p") ?? t.querySelector("p");
|
|
32
|
+
n && (b(n).textContent = $(
|
|
33
33
|
e,
|
|
34
|
-
|
|
34
|
+
o,
|
|
35
35
|
"price",
|
|
36
36
|
s,
|
|
37
37
|
i
|
|
38
38
|
));
|
|
39
39
|
const c = t.querySelector(".product-old-price p");
|
|
40
|
-
c && (
|
|
40
|
+
c && (b(c).textContent = $(
|
|
41
41
|
e,
|
|
42
|
-
|
|
42
|
+
o,
|
|
43
43
|
"original_price",
|
|
44
44
|
s,
|
|
45
45
|
i
|
|
@@ -47,10 +47,10 @@ function h(t, o, e, n, s, i) {
|
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case "productOldPrice": {
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const n = t.querySelector("p");
|
|
51
|
+
n && (b(n).textContent = $(
|
|
52
52
|
e,
|
|
53
|
-
|
|
53
|
+
o,
|
|
54
54
|
"original_price",
|
|
55
55
|
s,
|
|
56
56
|
i
|
|
@@ -58,105 +58,129 @@ function h(t, o, e, n, s, i) {
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
case "productButton": {
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const n = t.querySelector("a");
|
|
62
|
+
n && n.setAttribute("href", `{{${i}${e}_${o}_url}}`);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
case "productOmnibusPrice": {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
const c =
|
|
66
|
+
const n = t.querySelector(".omnibus-price-value");
|
|
67
|
+
if (n) {
|
|
68
|
+
n.textContent = `{{${i}${e}_${o}_omnibus_price}}`;
|
|
69
|
+
const c = n.closest("p");
|
|
70
70
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
case "productOmnibusDiscount": {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
const c =
|
|
75
|
+
const n = t.querySelector(".omnibus-discount-value");
|
|
76
|
+
if (n) {
|
|
77
|
+
n.textContent = `{{${i}${e}_${o}_omnibus_discount}}`;
|
|
78
|
+
const c = n.closest("p");
|
|
79
79
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
80
80
|
}
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
default: {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const c =
|
|
87
|
-
l && (
|
|
84
|
+
const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
85
|
+
if (n) {
|
|
86
|
+
const c = n.getAttribute("product-attr"), l = n.querySelector("p");
|
|
87
|
+
l && (b(l).textContent = `{{${i}${e}_${o}_${c}}}`);
|
|
88
88
|
}
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const T = "name";
|
|
94
|
+
function _(t, r, e, o) {
|
|
95
|
+
const s = `${o}${r}_${e}_${T}`;
|
|
96
|
+
return {
|
|
97
|
+
open: t.createComment(`{% if ${s} and ${s} != "" %}`),
|
|
98
|
+
close: t.createComment("{% endif %}")
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function B(t, r, e) {
|
|
102
|
+
return _(t, r, 0, e);
|
|
103
|
+
}
|
|
104
|
+
function L(t, r, e, o) {
|
|
105
|
+
if (!t.innerHTML.includes("{{"))
|
|
106
|
+
return;
|
|
107
|
+
const { open: s, close: i } = _(t.ownerDocument, r, e, o);
|
|
108
|
+
t.insertBefore(s, t.firstChild), t.appendChild(i);
|
|
109
|
+
}
|
|
110
|
+
function N(t, r, e, o) {
|
|
111
|
+
var n, c;
|
|
112
|
+
if (!t.innerHTML.includes("{{"))
|
|
113
|
+
return;
|
|
114
|
+
const { open: s, close: i } = _(t.ownerDocument, r, e, o);
|
|
115
|
+
(n = t.parentNode) == null || n.insertBefore(s, t), (c = t.parentNode) == null || c.insertBefore(i, t.nextSibling);
|
|
116
|
+
}
|
|
117
|
+
function v(t, r, e, o) {
|
|
118
|
+
t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
|
|
95
119
|
i.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
96
120
|
const u = l.getAttribute("data-attribute-type") || "", p = l.querySelectorAll(".attribute-cell");
|
|
97
121
|
p.length > 0 ? p.forEach((a) => {
|
|
98
|
-
|
|
99
|
-
}) :
|
|
100
|
-
});
|
|
122
|
+
S(a, u, r, n, e, o);
|
|
123
|
+
}) : S(l, u, r, n, e, o);
|
|
124
|
+
}), N(i, r, n, o);
|
|
101
125
|
});
|
|
102
126
|
}
|
|
103
|
-
function
|
|
127
|
+
function O(t, r, e, o) {
|
|
104
128
|
const s = t.querySelectorAll(".recommendation-product-row");
|
|
105
129
|
if (!s.length)
|
|
106
130
|
return;
|
|
107
|
-
const [i] = s,
|
|
131
|
+
const [i] = s, n = i.querySelector("[data-attribute-type]"), c = n ? n.querySelectorAll(".attribute-cell").length : 1;
|
|
108
132
|
s.forEach((l, u) => {
|
|
109
133
|
l.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
110
134
|
const d = a.getAttribute("data-attribute-type") || "";
|
|
111
|
-
a.querySelectorAll(".attribute-cell").forEach((
|
|
112
|
-
const
|
|
113
|
-
|
|
135
|
+
a.querySelectorAll(".attribute-cell").forEach((m, f) => {
|
|
136
|
+
const h = u * c + f;
|
|
137
|
+
S(m, d, r, h, e, o), L(m, r, h, o);
|
|
114
138
|
});
|
|
115
139
|
});
|
|
116
140
|
});
|
|
117
141
|
}
|
|
118
|
-
function
|
|
142
|
+
function W(t, r, e, o) {
|
|
119
143
|
t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
120
|
-
|
|
144
|
+
O(i, r, e, o);
|
|
121
145
|
});
|
|
122
146
|
}
|
|
123
|
-
function
|
|
124
|
-
const
|
|
125
|
-
|
|
147
|
+
function D(t, r, e) {
|
|
148
|
+
const o = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
|
|
149
|
+
o === "list" ? v(t, r, s, e) : W(t, r, s, e);
|
|
126
150
|
}
|
|
127
|
-
function
|
|
128
|
-
const
|
|
151
|
+
function A(t, r, e) {
|
|
152
|
+
const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(o);
|
|
129
153
|
return s ? parseInt(s[1]) : e;
|
|
130
154
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
return
|
|
155
|
+
function C(t) {
|
|
156
|
+
const r = t.trim();
|
|
157
|
+
return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
|
|
134
158
|
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
159
|
+
function g(t) {
|
|
160
|
+
const r = t.getAttribute("width");
|
|
161
|
+
if (r && C(r))
|
|
162
|
+
return r.trim();
|
|
139
163
|
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
140
|
-
return e &&
|
|
164
|
+
return e && C(e[1]) ? e[1] : null;
|
|
141
165
|
}
|
|
142
|
-
function
|
|
166
|
+
function M(t, r) {
|
|
143
167
|
let e = t.parentElement;
|
|
144
|
-
for (; e && e !==
|
|
145
|
-
if (e.tagName === "TD" &&
|
|
168
|
+
for (; e && e !== r; ) {
|
|
169
|
+
if (e.tagName === "TD" && g(e))
|
|
146
170
|
return e;
|
|
147
171
|
e = e.parentElement;
|
|
148
172
|
}
|
|
149
173
|
return null;
|
|
150
174
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
175
|
+
function G(t) {
|
|
176
|
+
const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, s = Math.max(0, e - o);
|
|
153
177
|
s !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
154
178
|
if (i.hasAttribute("width"))
|
|
155
179
|
return;
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
180
|
+
const n = M(i, t);
|
|
181
|
+
if (!n)
|
|
158
182
|
return;
|
|
159
|
-
const c =
|
|
183
|
+
const c = g(n), l = A(n.getAttribute("style") || "", "padding", 0) * 2, u = c.endsWith("%") ? Math.floor(s * parseFloat(c) / 100) : parseInt(c), p = Math.max(1, u - l);
|
|
160
184
|
i.setAttribute("width", String(p));
|
|
161
185
|
const a = i.getAttribute("style") || "";
|
|
162
186
|
if (!/\bwidth\s*:\s*\d/i.test(a)) {
|
|
@@ -165,25 +189,32 @@ function M(t) {
|
|
|
165
189
|
}
|
|
166
190
|
});
|
|
167
191
|
}
|
|
168
|
-
function
|
|
192
|
+
function H(t, r) {
|
|
169
193
|
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
170
194
|
return (e ? `${e[0]}
|
|
171
|
-
` : "") +
|
|
195
|
+
` : "") + r.documentElement.outerHTML;
|
|
172
196
|
}
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
197
|
+
function Y(t) {
|
|
198
|
+
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
199
|
+
if (!o.length)
|
|
176
200
|
return t;
|
|
177
|
-
const { buildCampaignUrl: s } =
|
|
201
|
+
const { buildCampaignUrl: s } = E(), i = R();
|
|
178
202
|
i.recommendationCampaignUrls = {};
|
|
179
|
-
const { isFeatureEnabled:
|
|
180
|
-
return
|
|
181
|
-
var a, d;
|
|
203
|
+
const { isFeatureEnabled: n } = q(), c = n("liquidSyntax") ? "reco_" : "";
|
|
204
|
+
return o.forEach((u) => {
|
|
205
|
+
var a, d, y, m;
|
|
182
206
|
const p = u.getAttribute("recommendation-id");
|
|
183
|
-
|
|
184
|
-
|
|
207
|
+
if (p) {
|
|
208
|
+
if ((a = u.parentNode) == null || a.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((f) => f.remove()), s(p), !P(u)) {
|
|
209
|
+
D(u, p, c);
|
|
210
|
+
const { open: f, close: h } = B(e, p, c);
|
|
211
|
+
(y = u.parentNode) == null || y.insertBefore(f, u), (m = u.parentNode) == null || m.insertBefore(h, u.nextSibling);
|
|
212
|
+
}
|
|
213
|
+
G(u);
|
|
214
|
+
}
|
|
215
|
+
}), H(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
185
216
|
}
|
|
186
217
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
218
|
+
$ as formatPriceVariable,
|
|
219
|
+
Y as prepareRecommendationBlocks
|
|
189
220
|
};
|
|
@@ -53,7 +53,7 @@ class P extends E {
|
|
|
53
53
|
if (!m)
|
|
54
54
|
return;
|
|
55
55
|
const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
|
|
56
|
-
i.modifyHtml(m).setInnerHtml(b)
|
|
56
|
+
i.modifyHtml(m).setInnerHtml(b);
|
|
57
57
|
}), i.apply(new B(
|
|
58
58
|
`Updated currency symbol to ${n || "removed"}`
|
|
59
59
|
));
|
|
@@ -1,84 +1,85 @@
|
|
|
1
|
-
import { productPairs as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (d)
|
|
1
|
+
import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
+
function q(w) {
|
|
3
|
+
const y = w.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(y, "text/html"), C = L.PAIRS_FOR_EXTENSION;
|
|
4
|
+
Object.entries(C).forEach(([r, f]) => {
|
|
5
|
+
T.querySelectorAll(".ins-product-td").forEach((o) => {
|
|
6
|
+
const A = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
|
|
7
|
+
o.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
|
|
8
|
+
var k, F, I;
|
|
9
|
+
const $ = e.getAttribute("data-type") || b, d = e.getAttribute("data-number") || A, u = f[$];
|
|
10
|
+
if (u)
|
|
12
11
|
switch (r) {
|
|
13
12
|
case "imageSrc": {
|
|
14
13
|
let t = null, i = null;
|
|
15
14
|
if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
|
|
16
15
|
break;
|
|
17
|
-
const a =
|
|
16
|
+
const a = u.DEFAULT, s = u.ATTR;
|
|
18
17
|
if (a && t.src) {
|
|
19
|
-
const
|
|
18
|
+
const c = t.src;
|
|
20
19
|
a.some((h) => {
|
|
21
|
-
const l = h.split("/").pop() || "",
|
|
22
|
-
return
|
|
23
|
-
}) && (t.src = `{{${s}_${
|
|
20
|
+
const l = h.split("/").pop() || "", g = c.split("/").pop() || "";
|
|
21
|
+
return c.includes(h) || c.includes(l) || g === l;
|
|
22
|
+
}) && (t.src = `{{${s}_${d}}}`);
|
|
24
23
|
}
|
|
25
|
-
const n = (
|
|
26
|
-
if (n && t.setAttribute("alt", `{{${n}_${
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const E =
|
|
30
|
-
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${
|
|
24
|
+
const n = (F = (k = C.name) == null ? void 0 : k[$]) == null ? void 0 : F.ATTR;
|
|
25
|
+
if (n && t.setAttribute("alt", `{{${n}_${d}}}`), i) {
|
|
26
|
+
const c = (I = C.itemLink) == null ? void 0 : I[$];
|
|
27
|
+
if (c) {
|
|
28
|
+
const E = c.HREF, h = c.DEFAULT_HREF || "#!", l = i.href;
|
|
29
|
+
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${d}}}`);
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
break;
|
|
34
33
|
}
|
|
35
34
|
case "name": {
|
|
36
|
-
const t =
|
|
37
|
-
e.textContent && (e.textContent = `{{${i}_${
|
|
35
|
+
const t = u, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
|
|
36
|
+
e.textContent && (e.textContent = `{{${i}_${d}}}`);
|
|
38
37
|
const n = e.closest("a") || (e.tagName === "A" ? e : null);
|
|
39
38
|
if (n && s) {
|
|
40
|
-
const
|
|
41
|
-
(
|
|
39
|
+
const c = n.href, E = `${window.location.href}${a}`;
|
|
40
|
+
(c === E || c.endsWith(a)) && (n.href = `{{${s}_${d}}}`);
|
|
42
41
|
}
|
|
43
42
|
break;
|
|
44
43
|
}
|
|
45
44
|
case "price":
|
|
46
45
|
case "originalPrice": {
|
|
47
|
-
const t =
|
|
46
|
+
const t = u, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", c = e.getAttribute("data-curency") || "before";
|
|
48
47
|
let E;
|
|
49
48
|
n ? E = s ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : E = s ? t.PRICE_FORMATTED : t.PRICE;
|
|
50
49
|
const h = t.CURRENCY;
|
|
51
|
-
let l = `{{${E}_${
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
let l = `{{${E}_${d}}}`;
|
|
51
|
+
if (h) {
|
|
52
|
+
const g = `{{${h}_${d}}}`;
|
|
53
|
+
l = c === "after" ? `${l} ${g}` : `${g} ${l}`;
|
|
54
|
+
}
|
|
55
|
+
e.textContent = l;
|
|
55
56
|
break;
|
|
56
57
|
}
|
|
57
58
|
case "quantity": {
|
|
58
|
-
const t =
|
|
59
|
-
e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${
|
|
59
|
+
const t = u, i = t.ATTR, a = t.DEFAULT;
|
|
60
|
+
e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${d}}}`);
|
|
60
61
|
break;
|
|
61
62
|
}
|
|
62
63
|
case "button": {
|
|
63
|
-
const t =
|
|
64
|
+
const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
|
|
64
65
|
if (s) {
|
|
65
|
-
const n = s.href || "",
|
|
66
|
-
(n === "" || n === "#" || n ===
|
|
66
|
+
const n = s.href || "", c = `${window.location.href}${a}`;
|
|
67
|
+
(n === "" || n === "#" || n === c || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${d}}}`);
|
|
67
68
|
}
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
70
71
|
case "itemLink": {
|
|
71
|
-
const t =
|
|
72
|
+
const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
|
|
72
73
|
if (s.href) {
|
|
73
|
-
const n = s.href,
|
|
74
|
-
(n ===
|
|
74
|
+
const n = s.href, c = `${window.location.href}${a}`;
|
|
75
|
+
(n === c || n.endsWith(a)) && (s.href = `{{${i}_${d}}}`);
|
|
75
76
|
}
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
default: {
|
|
79
|
-
if ("ATTR" in
|
|
80
|
-
const t =
|
|
81
|
-
e.textContent && (e.textContent = `{{${t}_${
|
|
80
|
+
if ("ATTR" in u) {
|
|
81
|
+
const t = u.ATTR;
|
|
82
|
+
e.textContent && (e.textContent = `{{${t}_${d}}}`);
|
|
82
83
|
}
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
@@ -86,48 +87,48 @@ function W(M) {
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
|
-
const
|
|
90
|
-
` : "",
|
|
91
|
-
|
|
92
|
-
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1",
|
|
93
|
-
|
|
90
|
+
const S = y.match(/<!DOCTYPE[^>]*>/i), M = S ? `${S[0]}
|
|
91
|
+
` : "", P = T.querySelectorAll(".ins-product-td"), H = [];
|
|
92
|
+
P.forEach((r) => {
|
|
93
|
+
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", o = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
94
|
+
H.push({
|
|
94
95
|
element: r,
|
|
95
96
|
outerHtml: A,
|
|
96
97
|
type: f,
|
|
97
98
|
number: p,
|
|
98
|
-
nodup:
|
|
99
|
+
nodup: o || void 0
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
|
-
let _ =
|
|
102
|
-
|
|
103
|
-
let
|
|
102
|
+
let _ = M + T.documentElement.outerHTML;
|
|
103
|
+
H.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
104
|
+
let o = "";
|
|
104
105
|
switch (f) {
|
|
105
106
|
case "CART_ITEMS":
|
|
106
|
-
|
|
107
|
+
o = "ins_apr_total_product_kind";
|
|
107
108
|
break;
|
|
108
109
|
case "BROWSED_ITEMS":
|
|
109
|
-
|
|
110
|
+
o = "browsed_item_total_product_kind";
|
|
110
111
|
break;
|
|
111
112
|
case "PURCHASED_ITEMS":
|
|
112
|
-
|
|
113
|
+
o = "purchased_item_total_product_kind";
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
116
|
+
if (o) {
|
|
117
|
+
const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
|
|
117
118
|
_ = _.replace(r, $);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const
|
|
121
|
-
return
|
|
121
|
+
const D = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
122
|
+
return D.forEach((r) => {
|
|
122
123
|
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
123
124
|
if (!f || p !== "CART_ITEMS")
|
|
124
125
|
return;
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
const A =
|
|
128
|
-
|
|
126
|
+
const o = r.closest(".product-original-price-class");
|
|
127
|
+
if (o) {
|
|
128
|
+
const A = o.outerHTML;
|
|
129
|
+
R.some((m) => m.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
|
|
129
130
|
}
|
|
130
|
-
}),
|
|
131
|
+
}), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
|
|
131
132
|
const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
|
|
132
133
|
if (!_.includes(p) && !r.includes("{% if")) {
|
|
133
134
|
const A = `${p}${r}{% endif %}`;
|
|
@@ -136,5 +137,5 @@ function W(M) {
|
|
|
136
137
|
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
137
138
|
}
|
|
138
139
|
export {
|
|
139
|
-
|
|
140
|
+
q as pairProductVariables
|
|
140
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.4cb7fb8",
|
|
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",
|