@useinsider/guido 3.7.2-beta.6f556cb → 3.7.2-beta.a114aa7
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/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +45 -47
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +43 -42
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +44 -33
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +59 -49
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +89 -82
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
- package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
- package/dist/guido.css +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { useConfig as g } from "../../../composables/useConfig.js";
|
|
|
2
2
|
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
5
6
|
function y(r, n, e, o, i = "") {
|
|
6
7
|
const c = `{{${i}${r}_${n}_${e}}}`, t = `{{${i}${r}_${n}_currency}}`;
|
|
7
8
|
return o === "before" ? `${t} ${c}` : `${c} ${t}`;
|
|
@@ -12,7 +13,7 @@ function A(r) {
|
|
|
12
13
|
[n] = n.children;
|
|
13
14
|
return n;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function b(r, n, e, o, i, c) {
|
|
16
17
|
switch (n) {
|
|
17
18
|
case "productImage": {
|
|
18
19
|
const t = r.querySelector("img");
|
|
@@ -87,45 +88,45 @@ function f(r, n, e, o, i, c) {
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function E(r, n, e, o) {
|
|
91
92
|
r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
|
|
92
93
|
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
93
94
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
94
95
|
p.length > 0 ? p.forEach((l) => {
|
|
95
|
-
|
|
96
|
-
}) :
|
|
96
|
+
b(l, u, n, t, e, o);
|
|
97
|
+
}) : b(a, u, n, t, e, o);
|
|
97
98
|
});
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function R(r, n, e, o) {
|
|
101
102
|
const i = r.querySelectorAll(".recommendation-product-row");
|
|
102
103
|
if (!i.length)
|
|
103
104
|
return;
|
|
104
105
|
const [c] = i, t = c.querySelector("[data-attribute-type]"), s = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
105
106
|
i.forEach((a, u) => {
|
|
106
107
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
107
|
-
const
|
|
108
|
+
const m = l.getAttribute("data-attribute-type") || "";
|
|
108
109
|
l.querySelectorAll(".attribute-cell").forEach((h, $) => {
|
|
109
110
|
const S = u * s + $;
|
|
110
|
-
|
|
111
|
+
b(h, m, n, S, e, o);
|
|
111
112
|
});
|
|
112
113
|
});
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function P(r, n, e, o) {
|
|
116
117
|
r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
117
|
-
|
|
118
|
+
R(c, n, e, o);
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function T(r, n, e) {
|
|
121
122
|
const o = r.getAttribute("data-layout") || "grid", i = r.getAttribute("currency-alignment") || "after";
|
|
122
|
-
o === "list" ?
|
|
123
|
+
o === "list" ? E(r, n, i, e) : P(r, n, i, e);
|
|
123
124
|
}
|
|
124
|
-
function
|
|
125
|
+
function f(r, n, e) {
|
|
125
126
|
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), i = r.match(o);
|
|
126
127
|
return i ? parseInt(i[1]) : e;
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function v(r, n) {
|
|
129
130
|
let e = r.parentElement;
|
|
130
131
|
for (; e && e !== n; ) {
|
|
131
132
|
if (e.tagName === "TD") {
|
|
@@ -137,29 +138,29 @@ function T(r, n) {
|
|
|
137
138
|
}
|
|
138
139
|
return null;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
const n = r.getAttribute("style") || "", e =
|
|
141
|
+
function O(r) {
|
|
142
|
+
const n = r.getAttribute("style") || "", e = f(n, "width", 600), o = f(n, "padding", 0) * 2, i = Math.max(0, e - o);
|
|
142
143
|
i !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
143
144
|
if (c.hasAttribute("width"))
|
|
144
145
|
return;
|
|
145
|
-
const t =
|
|
146
|
+
const t = v(c, r);
|
|
146
147
|
if (!t)
|
|
147
148
|
return;
|
|
148
|
-
const s = t.getAttribute("width"), a = parseFloat(s), u =
|
|
149
|
+
const s = t.getAttribute("width"), a = parseFloat(s), u = f(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(i * a / 100), l = Math.max(1, p - u);
|
|
149
150
|
c.setAttribute("width", String(l));
|
|
150
|
-
const
|
|
151
|
-
if (!/\bwidth\s*:\s*\d/i.test(
|
|
152
|
-
const
|
|
153
|
-
c.setAttribute("style", `${
|
|
151
|
+
const m = c.getAttribute("style") || "";
|
|
152
|
+
if (!/\bwidth\s*:\s*\d/i.test(m)) {
|
|
153
|
+
const d = m && !m.trim().endsWith(";") ? "; " : "";
|
|
154
|
+
c.setAttribute("style", `${m}${d}width: ${l}px`);
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
+
function W(r, n) {
|
|
158
159
|
const e = r.match(/<!DOCTYPE[^>]*>/i);
|
|
159
160
|
return (e ? `${e[0]}
|
|
160
161
|
` : "") + n.documentElement.outerHTML;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
+
function F(r) {
|
|
163
164
|
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
164
165
|
if (!o.length)
|
|
165
166
|
return r;
|
|
@@ -167,12 +168,12 @@ function N(r) {
|
|
|
167
168
|
c.recommendationCampaignUrls = {};
|
|
168
169
|
const { isFeatureEnabled: t } = g(), s = t("liquidSyntax") ? "reco_" : "";
|
|
169
170
|
return o.forEach((u) => {
|
|
170
|
-
var l,
|
|
171
|
+
var l, m;
|
|
171
172
|
const p = u.getAttribute("recommendation-id");
|
|
172
|
-
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (
|
|
173
|
-
}),
|
|
173
|
+
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (m = u.parentNode) == null || m.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((d) => d.remove()), i(p), w(u) || T(u, p, s), O(u));
|
|
174
|
+
}), W(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
174
175
|
}
|
|
175
176
|
export {
|
|
176
177
|
y as formatPriceVariable,
|
|
177
|
-
|
|
178
|
+
F as prepareRecommendationBlocks
|
|
178
179
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSS_CLASS_SKIP_COMPILE as n, BLOCK_ROOT_SELECTOR as i } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
+
function m(o) {
|
|
3
|
+
return o.classList.contains(n);
|
|
4
|
+
}
|
|
5
|
+
function a(o) {
|
|
6
|
+
const r = new DOMParser().parseFromString(o, "text/html").querySelectorAll(`${i}.${n}`), t = /* @__PURE__ */ new Set();
|
|
7
|
+
return r.forEach((c) => {
|
|
8
|
+
const e = c.getAttribute("recommendation-id");
|
|
9
|
+
e && t.add(e);
|
|
10
|
+
}), t;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
a as getIgnoredRecommendationBlockIds,
|
|
14
|
+
m as isIgnoredRecommendationBlock
|
|
15
|
+
};
|
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { CURRENCY_ATTR as n, CSS_CLASS_SKIP_COMPILE as c } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
+
const a = "You May Also Like!";
|
|
3
|
+
function l(t) {
|
|
4
|
+
var o;
|
|
5
|
+
const r = t.querySelector(".ext-recommendation-title");
|
|
6
|
+
if (!r)
|
|
7
|
+
return a;
|
|
8
|
+
const e = (o = r.textContent) == null ? void 0 : o.trim();
|
|
9
|
+
return e && e.length > 0 ? e : a;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
...Array.from(
|
|
11
|
+
function m(t) {
|
|
12
|
+
const r = [
|
|
13
|
+
t,
|
|
14
|
+
...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
14
15
|
];
|
|
15
|
-
let
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}),
|
|
16
|
+
let e = "";
|
|
17
|
+
return r.some((o) => {
|
|
18
|
+
const i = o.getAttribute("bgcolor");
|
|
19
|
+
if (i && i.trim())
|
|
20
|
+
return e = i.trim(), !0;
|
|
21
|
+
const u = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
|
|
22
|
+
return u && u[1] ? (e = u[1].trim(), !0) : !1;
|
|
23
|
+
}), e;
|
|
24
|
+
}
|
|
25
|
+
function C(t) {
|
|
26
|
+
const r = t.getAttribute(n.CURRENCY);
|
|
27
|
+
if (!r)
|
|
28
|
+
return;
|
|
29
|
+
const e = t.getAttribute(n.SYMBOL);
|
|
30
|
+
return {
|
|
31
|
+
value: r,
|
|
32
|
+
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
33
|
+
// the currency code as the symbol.
|
|
34
|
+
...e ? { symbol: e } : {},
|
|
35
|
+
alignment: t.getAttribute(n.ALIGNMENT) ?? "",
|
|
36
|
+
decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
|
|
37
|
+
decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
|
|
38
|
+
thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function d(t) {
|
|
42
|
+
return t.classList.contains(c);
|
|
23
43
|
}
|
|
24
44
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
m as extractCardBgColor,
|
|
46
|
+
C as extractCurrencyFromBlock,
|
|
47
|
+
l as extractTitleText,
|
|
48
|
+
d as isPartnerManagedBlock
|
|
27
49
|
};
|