@useinsider/guido 3.5.0-beta.70f8c74 → 3.5.0-beta.b7a6d77
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/composables/useRecommendation.js +34 -33
- package/dist/config/migrator/checkboxMigrator.js +69 -20
- package/dist/config/migrator/radioButtonMigrator.js +91 -36
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
- package/dist/static/styles/components/wide-panel.css.js +0 -5
- package/package.json +1 -1
- package/dist/config/migrator/textBlockMigration.js +0 -65
- package/dist/src/config/migrator/textBlockMigration.d.ts +0 -24
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as I, URLS as
|
|
2
|
-
import { MinDeviceViewport as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as I, URLS as R } from "../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommendation.js";
|
|
3
|
+
import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
|
+
import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
5
6
|
import { useConfigStore as x } from "../stores/config.js";
|
|
6
|
-
const
|
|
7
|
+
const A = () => ({
|
|
7
8
|
calculateCardWidth: ({
|
|
8
9
|
mobileLeftPadding: s,
|
|
9
10
|
mobileRightPadding: a,
|
|
10
11
|
cardsInRow: c,
|
|
11
|
-
unresponsive:
|
|
12
|
+
unresponsive: o
|
|
12
13
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
return (
|
|
14
|
+
const n = o ? c : 1, e = s + a + (n - 1) * b;
|
|
15
|
+
return (C - e) / n;
|
|
15
16
|
},
|
|
16
17
|
getRecommendationCampaignData: (s) => {
|
|
17
|
-
const a =
|
|
18
|
-
if (!
|
|
18
|
+
const a = l(), c = Number(s), o = a.blockStates[c];
|
|
19
|
+
if (!o)
|
|
19
20
|
return {
|
|
20
21
|
textTrimming: !1,
|
|
21
22
|
orientation: "vertical",
|
|
@@ -28,14 +29,14 @@ const w = () => ({
|
|
|
28
29
|
discountBeforeTextValue: "",
|
|
29
30
|
discountAfterTextValue: ""
|
|
30
31
|
};
|
|
31
|
-
const { recommendationConfigs:
|
|
32
|
+
const { recommendationConfigs: n } = o, e = n.orientation === "grid" ? "vertical" : "horizontal";
|
|
32
33
|
return {
|
|
33
|
-
textTrimming:
|
|
34
|
+
textTrimming: n.textTrimming,
|
|
34
35
|
orientation: e,
|
|
35
36
|
mobileLeftPadding: 0,
|
|
36
37
|
mobileRightPadding: 0,
|
|
37
|
-
cardsInRow:
|
|
38
|
-
unresponsive:
|
|
38
|
+
cardsInRow: n.cardsInRow,
|
|
39
|
+
unresponsive: n.unresponsive,
|
|
39
40
|
priceBeforeTextValue: "",
|
|
40
41
|
priceAfterTextValue: "",
|
|
41
42
|
discountBeforeTextValue: "",
|
|
@@ -43,38 +44,38 @@ const w = () => ({
|
|
|
43
44
|
};
|
|
44
45
|
},
|
|
45
46
|
buildCampaignUrl: (s, a) => {
|
|
46
|
-
var
|
|
47
|
-
const c =
|
|
47
|
+
var m;
|
|
48
|
+
const c = l(), o = x(), n = Number(s);
|
|
48
49
|
let e;
|
|
49
50
|
if (a)
|
|
50
51
|
e = a;
|
|
51
52
|
else {
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
53
|
+
const r = c.blockStates[n];
|
|
54
|
+
if (!r)
|
|
54
55
|
return "";
|
|
55
|
-
const { recommendationConfigs:
|
|
56
|
+
const { recommendationConfigs: i } = r;
|
|
56
57
|
e = {
|
|
57
|
-
strategy:
|
|
58
|
-
language:
|
|
59
|
-
currencyCode:
|
|
60
|
-
size:
|
|
61
|
-
productIds:
|
|
62
|
-
filters:
|
|
63
|
-
shuffleProducts:
|
|
58
|
+
strategy: i.strategy,
|
|
59
|
+
language: i.language,
|
|
60
|
+
currencyCode: i.currencySettings.value,
|
|
61
|
+
size: i.size,
|
|
62
|
+
productIds: i.productIds,
|
|
63
|
+
filters: i.filters,
|
|
64
|
+
shuffleProducts: i.shuffleProducts
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
const f = ((
|
|
67
|
-
if (t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName",
|
|
68
|
-
const
|
|
69
|
-
t.set("productId", e.productIds.slice(0,
|
|
67
|
+
const f = ((m = I().find((r) => r.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
|
|
68
|
+
if (t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising") {
|
|
69
|
+
const r = parseInt(e.size) || 6;
|
|
70
|
+
t.set("productId", e.productIds.slice(0, r).join(","));
|
|
70
71
|
} else e.strategy === "similarViewed" && t.set("productId", "{itemId}");
|
|
71
72
|
e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
72
|
-
const g = e.filters.filter((
|
|
73
|
-
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true");
|
|
74
|
-
const p = decodeURIComponent(t.toString()), u = `${
|
|
73
|
+
const g = e.filters.filter((r) => r.isValid), d = h(g);
|
|
74
|
+
d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(o.partnerName, e.strategy)).forEach(([r, i]) => t.set(r, i));
|
|
75
|
+
const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
|
|
75
76
|
return c.recommendationCampaignUrls[s] = u, u;
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
export {
|
|
79
|
-
|
|
80
|
+
A as useRecommendation
|
|
80
81
|
};
|
|
@@ -1,36 +1,85 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
class C {
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var y = (s, t, e) => t in s ? x(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var m = (s, t, e) => y(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import b from "../../extensions/Blocks/Checkbox/template.js";
|
|
5
|
+
class f {
|
|
7
6
|
constructor() {
|
|
8
|
-
|
|
7
|
+
m(this, "parser");
|
|
9
8
|
this.parser = new DOMParser();
|
|
10
9
|
}
|
|
11
10
|
migrate(t) {
|
|
12
11
|
try {
|
|
13
|
-
const e = this.parser.parseFromString(t, "text/html"),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let i = !1;
|
|
17
|
-
return n.forEach((o) => {
|
|
18
|
-
if (o.classList.contains("checkbox-block-v2"))
|
|
12
|
+
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
|
|
13
|
+
return i.length === 0 ? t : (i.forEach((r) => {
|
|
14
|
+
if (r.classList.contains("checkbox-block-v2"))
|
|
19
15
|
return;
|
|
20
|
-
const
|
|
21
|
-
`<table id="tempDoc"><tbody><tr>${
|
|
16
|
+
const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
|
|
17
|
+
`<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
|
|
22
18
|
"text/html"
|
|
23
19
|
).querySelector(".checkbox-block-v2");
|
|
24
|
-
|
|
25
|
-
}),
|
|
20
|
+
o && r.parentNode && (o.setAttribute("id", n || ""), r.parentNode.replaceChild(o, r));
|
|
21
|
+
}), e.documentElement.outerHTML);
|
|
26
22
|
} catch (e) {
|
|
27
23
|
return console.error("CheckboxMigrator failed:", e), t;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
26
|
+
extractTextFromElement(t, e) {
|
|
27
|
+
var o, d;
|
|
28
|
+
const i = t.querySelector(`.${e}`);
|
|
29
|
+
if (!i)
|
|
30
|
+
return {
|
|
31
|
+
text: e === "ins-title" ? "Title" : "Description",
|
|
32
|
+
isBold: !1,
|
|
33
|
+
isItalic: !1,
|
|
34
|
+
align: "left",
|
|
35
|
+
styles: ""
|
|
36
|
+
};
|
|
37
|
+
const r = i.querySelector("p");
|
|
38
|
+
if (!r)
|
|
39
|
+
return {
|
|
40
|
+
text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
|
|
41
|
+
isBold: !1,
|
|
42
|
+
isItalic: !1,
|
|
43
|
+
align: i.getAttribute("align") || "left",
|
|
44
|
+
styles: ""
|
|
45
|
+
};
|
|
46
|
+
const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
|
|
47
|
+
return {
|
|
48
|
+
text: n,
|
|
49
|
+
isBold: a,
|
|
50
|
+
isItalic: p,
|
|
51
|
+
align: c,
|
|
52
|
+
styles: u
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
buildTextBlock(t) {
|
|
56
|
+
let e = t.text;
|
|
57
|
+
t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
|
|
58
|
+
const i = t.align ? ` align="${t.align}"` : "", r = t.styles ? ` style="${t.styles}"` : "";
|
|
59
|
+
return `
|
|
60
|
+
<td class="esd-block-text" ${i}>
|
|
61
|
+
<p path="1" ${r}>
|
|
62
|
+
${e}
|
|
63
|
+
</p>
|
|
64
|
+
</td>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
removeStyleProperties(t, e) {
|
|
68
|
+
return t ? e.reduce((r, n) => {
|
|
69
|
+
const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
70
|
+
return r.replace(l, "");
|
|
71
|
+
}, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
72
|
+
}
|
|
73
|
+
convertInlineToBlock(t) {
|
|
74
|
+
if (!t)
|
|
75
|
+
return "";
|
|
76
|
+
let e = t.replace(/display\s*:\s*inline/gi, "display: block");
|
|
77
|
+
return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
78
|
+
}
|
|
30
79
|
}
|
|
31
|
-
function
|
|
32
|
-
return new
|
|
80
|
+
function k(s) {
|
|
81
|
+
return new f().migrate(s);
|
|
33
82
|
}
|
|
34
83
|
export {
|
|
35
|
-
|
|
84
|
+
k as migrateCheckbox
|
|
36
85
|
};
|
|
@@ -1,54 +1,109 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
class R {
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var T = (l, e, t) => e in l ? x(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var b = (l, e, t) => T(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import S from "../../extensions/Blocks/RadioButton/template.js";
|
|
5
|
+
class B {
|
|
7
6
|
constructor() {
|
|
8
|
-
|
|
7
|
+
b(this, "parser");
|
|
9
8
|
this.parser = new DOMParser();
|
|
10
9
|
}
|
|
11
|
-
migrate(
|
|
10
|
+
migrate(e) {
|
|
12
11
|
try {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
16
|
-
let
|
|
17
|
-
return
|
|
12
|
+
const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll("td.radio-button-block"), i = t.querySelectorAll("td.radio-button-v2");
|
|
13
|
+
if (s.length === 0 && i.length === 0)
|
|
14
|
+
return e;
|
|
15
|
+
let o = !1;
|
|
16
|
+
return s.forEach((r) => {
|
|
18
17
|
if (r.classList.contains("radio-button-v2"))
|
|
19
18
|
return;
|
|
20
|
-
const
|
|
21
|
-
`<table id="tempDoc"><tbody><tr>${
|
|
19
|
+
const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"), p = this.buildTextBlock(a), d = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", p).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
|
|
20
|
+
`<table id="tempDoc"><tbody><tr>${h}</tr></tbody></table>`,
|
|
22
21
|
"text/html"
|
|
23
22
|
).querySelector(".radio-button-v2");
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
} catch (
|
|
27
|
-
return console.error("RadioButtonMigrator failed:",
|
|
23
|
+
m && r.parentNode && (m.setAttribute("id", n || ""), r.parentNode.replaceChild(m, r), o = !0);
|
|
24
|
+
}), o = this.healRadioButtonV2(t) || o, o ? t.documentElement.outerHTML : e;
|
|
25
|
+
} catch (t) {
|
|
26
|
+
return console.error("RadioButtonMigrator failed:", t), e;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
healRadioButtonV2(
|
|
31
|
-
let
|
|
32
|
-
return
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
29
|
+
healRadioButtonV2(e) {
|
|
30
|
+
let t = !1;
|
|
31
|
+
return e.querySelectorAll("td.radio-button-v2").forEach((s) => {
|
|
32
|
+
var d;
|
|
33
|
+
s.classList.contains("radio-button-block") || (s.classList.add("radio-button-block"), t = !0);
|
|
34
|
+
const i = s.querySelector("input#radioYes"), o = s.querySelector("input#radioNo");
|
|
35
|
+
if (!i || !o)
|
|
37
36
|
return;
|
|
38
|
-
const r = ((
|
|
39
|
-
if (!r && !
|
|
37
|
+
const r = ((d = i.parentElement) == null ? void 0 : d.querySelector(":scope > p")) || null;
|
|
38
|
+
if (!r && !i.hasAttribute("align"))
|
|
40
39
|
return;
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
40
|
+
const n = i.closest("tr"), a = o.closest("tr");
|
|
41
|
+
if (!n || !a || n === a || !n.parentNode)
|
|
43
42
|
return;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
}),
|
|
43
|
+
const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), p = c.querySelector("p");
|
|
44
|
+
u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), p && (p.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
|
|
45
|
+
}), t;
|
|
46
|
+
}
|
|
47
|
+
extractTextFromElement(e, t) {
|
|
48
|
+
var d, y;
|
|
49
|
+
const s = e.querySelector(`.${t}`);
|
|
50
|
+
if (!s)
|
|
51
|
+
return {
|
|
52
|
+
text: t === "ins-title" ? "Title" : "Description",
|
|
53
|
+
isBold: !1,
|
|
54
|
+
isItalic: !1,
|
|
55
|
+
align: "left",
|
|
56
|
+
styles: "",
|
|
57
|
+
classList: ""
|
|
58
|
+
};
|
|
59
|
+
const i = s.querySelector("p");
|
|
60
|
+
if (!i)
|
|
61
|
+
return {
|
|
62
|
+
text: ((d = s.textContent) == null ? void 0 : d.trim()) || (t === "ins-title" ? "Title" : "Description"),
|
|
63
|
+
isBold: !1,
|
|
64
|
+
isItalic: !1,
|
|
65
|
+
align: s.getAttribute("align") || "left",
|
|
66
|
+
styles: "",
|
|
67
|
+
classList: ""
|
|
68
|
+
};
|
|
69
|
+
const o = ((y = i.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = i.getAttribute("style") || "", n = s.getAttribute("align") || i.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!i.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!i.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), p = s.getAttribute("class") || "";
|
|
70
|
+
return {
|
|
71
|
+
text: o,
|
|
72
|
+
isBold: a,
|
|
73
|
+
isItalic: g,
|
|
74
|
+
align: n,
|
|
75
|
+
styles: u,
|
|
76
|
+
classList: p
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
buildTextBlock(e) {
|
|
80
|
+
let t = e.text;
|
|
81
|
+
e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
|
|
82
|
+
const s = e.align ? ` align="${e.align}"` : "", i = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
|
|
83
|
+
return `
|
|
84
|
+
<td class="esd-block-text ${e.classList}" ${s}>
|
|
85
|
+
<p path="1" ${i}>
|
|
86
|
+
${t}
|
|
87
|
+
</p>
|
|
88
|
+
</td>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
removeStyleProperties(e, t) {
|
|
92
|
+
return e ? t.reduce((i, o) => {
|
|
93
|
+
const r = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
|
|
94
|
+
return i.replace(r, "");
|
|
95
|
+
}, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
96
|
+
}
|
|
97
|
+
convertInlineToBlock(e) {
|
|
98
|
+
if (!e)
|
|
99
|
+
return "";
|
|
100
|
+
let t = e.replace(/display\s*:\s*inline/gi, "display: block");
|
|
101
|
+
return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
47
102
|
}
|
|
48
103
|
}
|
|
49
|
-
function
|
|
50
|
-
return new
|
|
104
|
+
function L(l) {
|
|
105
|
+
return new B().migrate(l);
|
|
51
106
|
}
|
|
52
107
|
export {
|
|
53
|
-
|
|
108
|
+
L as migrateRadioButton
|
|
54
109
|
};
|
|
@@ -6,8 +6,9 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
10
|
+
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
11
|
+
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
11
12
|
const h = y();
|
|
12
13
|
let m = null, u = null, d = null;
|
|
13
14
|
function I() {
|
|
@@ -49,7 +50,7 @@ function k() {
|
|
|
49
50
|
filterSnapshot: null
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
+
const x = () => ({
|
|
53
54
|
recommendationCampaignUrls: {},
|
|
54
55
|
activePredictiveAlgorithms: [],
|
|
55
56
|
languages: {},
|
|
@@ -58,8 +59,8 @@ const N = () => ({
|
|
|
58
59
|
blockStates: {},
|
|
59
60
|
currentRecommendationId: null,
|
|
60
61
|
configVersion: 0
|
|
61
|
-
}),
|
|
62
|
-
state: () =>
|
|
62
|
+
}), T = P("guidoRecommendationExtension", {
|
|
63
|
+
state: () => x(),
|
|
63
64
|
getters: {
|
|
64
65
|
// ====================================================================
|
|
65
66
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -378,7 +379,7 @@ const N = () => ({
|
|
|
378
379
|
const n = [...e.recommendationConfigs.filters];
|
|
379
380
|
n[r] = {
|
|
380
381
|
...t,
|
|
381
|
-
isValid:
|
|
382
|
+
isValid: w(t)
|
|
382
383
|
}, e.recommendationConfigs.filters = n;
|
|
383
384
|
}
|
|
384
385
|
},
|
|
@@ -424,7 +425,7 @@ const N = () => ({
|
|
|
424
425
|
* every block's recommendationConfigs across user edits.
|
|
425
426
|
*/
|
|
426
427
|
hasInvalidBlock() {
|
|
427
|
-
return Object.values(this.blockStates).some((t) => !
|
|
428
|
+
return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
|
|
428
429
|
},
|
|
429
430
|
// ====================================================================
|
|
430
431
|
// Per-Block Product Fetching
|
|
@@ -453,7 +454,10 @@ const N = () => ({
|
|
|
453
454
|
details: !0,
|
|
454
455
|
campaignId: o.variationId
|
|
455
456
|
};
|
|
456
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds.slice(0, s).join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0)
|
|
457
|
+
r.strategy === "manualMerchandising" ? a.productId = r.productIds.slice(0, s).join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
458
|
+
a,
|
|
459
|
+
v(o.partnerName, r.strategy)
|
|
460
|
+
);
|
|
457
461
|
let f;
|
|
458
462
|
try {
|
|
459
463
|
f = await h.fetchRecommendationProducts(i, a);
|
|
@@ -471,5 +475,5 @@ const N = () => ({
|
|
|
471
475
|
}
|
|
472
476
|
});
|
|
473
477
|
export {
|
|
474
|
-
|
|
478
|
+
T as useRecommendationExtensionStore
|
|
475
479
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const i = [
|
|
2
|
+
"ozonebg",
|
|
3
|
+
"ozonehr",
|
|
4
|
+
"ozonero",
|
|
5
|
+
"ozoneinfo",
|
|
6
|
+
"babybg",
|
|
7
|
+
"ozongr",
|
|
8
|
+
"iboodat",
|
|
9
|
+
"iboodbe",
|
|
10
|
+
"iboodde",
|
|
11
|
+
"iboodfr",
|
|
12
|
+
"iboodnl",
|
|
13
|
+
"iboodpl"
|
|
14
|
+
], r = ["interencheres", "interencherespreprod"], d = ["lodenfrey", "lodenfreyuat"], c = "manualMerchandising";
|
|
15
|
+
function s(e, n) {
|
|
16
|
+
const o = {};
|
|
17
|
+
return i.includes(e) && (o.excludePurchaseDay = "30", o.userId = "{user_id}"), r.includes(e) && (o.hp = "1"), d.includes(e) && n === c && (o.includeOutOfStockItems = "true"), o;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
s as getPartnerRecommendationParams
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the extra recommendation feed query params for an account, if any.
|
|
3
|
+
* Accounts without customizations get an empty object.
|
|
4
|
+
* @param partnerName Account subdomain (`config.partner.name`)
|
|
5
|
+
* @param strategy Recommendation strategy key of the block
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPartnerRecommendationParams(partnerName: string, strategy: string): Record<string, string>;
|
|
@@ -11,11 +11,6 @@ ue-description a {
|
|
|
11
11
|
display: none;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
/* Override the rule above for the Gmail Promotions switcher docs link — remove with DT-28355. */
|
|
15
|
-
ue-lock-container.e2e-promotions-switcher ue-description a {
|
|
16
|
-
display: unset;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
14
|
.label {
|
|
20
15
|
font-size: 13px;
|
|
21
16
|
color: var(--guido-color-gray-800);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.b7a6d77",
|
|
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",
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const I = {
|
|
2
|
-
"ins-title": "Title",
|
|
3
|
-
"ins-description": "Description",
|
|
4
|
-
"ins-subscribe": "Yes",
|
|
5
|
-
"ins-unsubscribe": "No"
|
|
6
|
-
}, y = /font-weight\s*:\s*[^;]*;?/gi, S = /font-style\s*:\s*[^;]*;?/gi, u = /;\s*;/g, T = /^;|;$/g, d = /display\s*:\s*inline/gi, m = /display\s*:/i, b = /font-weight\s*:\s*bold/i, A = /font-style\s*:\s*italic/i, R = /^<(?:strong|b)\b/i, $ = /^<(?:em|i)\b/i;
|
|
7
|
-
function L(t) {
|
|
8
|
-
return t ? t.replace(y, "").replace(S, "").replace(u, ";").replace(T, "").trim() : "";
|
|
9
|
-
}
|
|
10
|
-
function O(t) {
|
|
11
|
-
if (!t)
|
|
12
|
-
return "";
|
|
13
|
-
let e = t.replace(d, "display: block");
|
|
14
|
-
return m.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(u, ";").replace(T, "").trim();
|
|
15
|
-
}
|
|
16
|
-
function B(t, e) {
|
|
17
|
-
var c, a;
|
|
18
|
-
const o = I[e], l = t.querySelector(`.${e}`);
|
|
19
|
-
if (!l)
|
|
20
|
-
return {
|
|
21
|
-
paragraphs: [{ innerHtml: o, isBold: !1, isItalic: !1, styles: "" }],
|
|
22
|
-
align: "left",
|
|
23
|
-
containerClass: ""
|
|
24
|
-
};
|
|
25
|
-
const n = Array.from(l.querySelectorAll("p")), p = l.getAttribute("align") || ((c = n[0]) == null ? void 0 : c.getAttribute("align")) || "left", i = l.getAttribute("class") || "";
|
|
26
|
-
return n.length === 0 ? {
|
|
27
|
-
paragraphs: [{
|
|
28
|
-
innerHtml: ((a = l.textContent) == null ? void 0 : a.trim()) || o,
|
|
29
|
-
isBold: !1,
|
|
30
|
-
isItalic: !1,
|
|
31
|
-
styles: ""
|
|
32
|
-
}],
|
|
33
|
-
align: p,
|
|
34
|
-
containerClass: ""
|
|
35
|
-
} : { paragraphs: n.map((r) => {
|
|
36
|
-
const _ = r.getAttribute("style") || "", f = b.test(_) || !!r.querySelector("b, strong"), g = A.test(_) || !!r.querySelector("i, em"), E = L(_);
|
|
37
|
-
return {
|
|
38
|
-
// Legacy parity: empty <p> → fallback placeholder; <p><br></p> is not empty.
|
|
39
|
-
innerHtml: r.innerHTML.trim() || o,
|
|
40
|
-
isBold: f,
|
|
41
|
-
isItalic: g,
|
|
42
|
-
styles: O(E)
|
|
43
|
-
};
|
|
44
|
-
}), align: p, containerClass: i };
|
|
45
|
-
}
|
|
46
|
-
function C(t, e = "") {
|
|
47
|
-
const o = t.align ? ` align="${t.align}"` : "", l = t.paragraphs.map((n, p) => {
|
|
48
|
-
const i = p + 1;
|
|
49
|
-
let s = n.innerHtml;
|
|
50
|
-
const c = n.isBold && !R.test(s), a = n.isItalic && !$.test(s);
|
|
51
|
-
c && a ? s = `<strong path="${i},0"><em path="${i},0,0">${s}</em></strong>` : c ? s = `<strong path="${i},0">${s}</strong>` : a && (s = `<em path="${i},0">${s}</em>`);
|
|
52
|
-
const r = n.styles ? ` style="${n.styles.replaceAll('"', "'")}"` : "";
|
|
53
|
-
return `<p path="${i}"${r}>${s}</p>`;
|
|
54
|
-
}).join(`
|
|
55
|
-
`);
|
|
56
|
-
return `
|
|
57
|
-
<td class="esd-block-text ${e}" ${o}>
|
|
58
|
-
${l}
|
|
59
|
-
</td>
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
export {
|
|
63
|
-
C as buildTextBlock,
|
|
64
|
-
B as extractTextFromElement
|
|
65
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared text-block migration helpers used by both `radioButtonMigrator` and
|
|
3
|
-
* `checkboxMigrator`. Extracts a legacy v1 `.ins-title` / `.ins-description`
|
|
4
|
-
* cell into a paragraph descriptor and rebuilds it as a v2 `esd-block-text`
|
|
5
|
-
* cell — preserving every <p>, every inline tag (<u>, <a>, <br>, <strong>,
|
|
6
|
-
* <em>) and re-encoding bold/italic detection as canonical tags.
|
|
7
|
-
*/
|
|
8
|
-
export type InsCellClass = 'ins-title' | 'ins-description' | 'ins-subscribe' | 'ins-unsubscribe';
|
|
9
|
-
type ParagraphContent = {
|
|
10
|
-
innerHtml: string;
|
|
11
|
-
isBold: boolean;
|
|
12
|
-
isItalic: boolean;
|
|
13
|
-
styles: string;
|
|
14
|
-
};
|
|
15
|
-
export type TextContent = {
|
|
16
|
-
paragraphs: ParagraphContent[];
|
|
17
|
-
align: string;
|
|
18
|
-
};
|
|
19
|
-
export type ExtractedTextContent = TextContent & {
|
|
20
|
-
containerClass: string;
|
|
21
|
-
};
|
|
22
|
-
export declare function extractTextFromElement(parent: Element, className: InsCellClass): ExtractedTextContent;
|
|
23
|
-
export declare function buildTextBlock(content: TextContent, extraClass?: string): string;
|
|
24
|
-
export {};
|