@useinsider/guido 3.2.0-beta.a49c53c → 3.2.0-beta.a961c72
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/@types/config/schemas.js +150 -94
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +88 -87
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useStripo.js +39 -37
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +478 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +78 -0
- package/dist/config/migrator/recommendation/themeMapper.js +89 -0
- package/dist/config/migrator/recommendationMigrator.js +60 -290
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +7 -0
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +213 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +56 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +18 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +23 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +31 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +28 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +29 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +28 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +209 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +28 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/stores/config.d.ts +504 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/static/templates/empty/style.css.js +1 -0
- package/dist/stores/onboarding.js +4 -0
- package/package.json +6 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function t(o, r, n) {
|
|
2
|
+
n != null && n !== "" && o.push(`${r}: ${n}`);
|
|
3
|
+
}
|
|
4
|
+
function $(o) {
|
|
5
|
+
if (!o)
|
|
6
|
+
return null;
|
|
7
|
+
const r = o.top ?? o.all ?? 0, n = o.right ?? o.all ?? 0, l = o.bottom ?? o.all ?? 0, f = o.left ?? o.all ?? 0;
|
|
8
|
+
return r === 0 && n === 0 && l === 0 && f === 0 ? null : `${r}px ${n}px ${l}px ${f}px`;
|
|
9
|
+
}
|
|
10
|
+
function S(o) {
|
|
11
|
+
if (!o)
|
|
12
|
+
return null;
|
|
13
|
+
const { top: r, right: n, bottom: l, left: f } = o;
|
|
14
|
+
return r === void 0 ? null : r === n && r === l && r === f ? r : null;
|
|
15
|
+
}
|
|
16
|
+
function F(o) {
|
|
17
|
+
var r, n;
|
|
18
|
+
return ((r = o.textLineSpacing) == null ? void 0 : r.lineSpacing) ?? ((n = o.textLineSpacing) == null ? void 0 : n["font-lineSpacing"]);
|
|
19
|
+
}
|
|
20
|
+
function W(o) {
|
|
21
|
+
var u, d, a, s, p, b, g, y;
|
|
22
|
+
const r = [], n = [], l = (u = o == null ? void 0 : o.textAlign) == null ? void 0 : u.align, f = $((d = o == null ? void 0 : o.textPadding) == null ? void 0 : d.desktop), x = (a = o == null ? void 0 : o.textStyle) == null ? void 0 : a["font-weight"], i = (s = o == null ? void 0 : o.textStyle) == null ? void 0 : s["font-style"];
|
|
23
|
+
return t(r, "background-color", (p = o == null ? void 0 : o.textBackgroundColor) == null ? void 0 : p.color), t(r, "padding", f), t(n, "font-family", (b = o == null ? void 0 : o.textStyle) == null ? void 0 : b["font-family"]), t(n, "font-size", (g = o == null ? void 0 : o.textStyle) == null ? void 0 : g["font-size"]), t(n, "font-weight", x), t(n, "font-style", i), t(n, "color", (y = o == null ? void 0 : o.textColor) == null ? void 0 : y.color), t(n, "line-height", F(o ?? {})), t(n, "text-align", l), {
|
|
24
|
+
tdStyle: r.join("; "),
|
|
25
|
+
pStyle: n.join("; "),
|
|
26
|
+
align: l || void 0,
|
|
27
|
+
wrapBold: x === "bold",
|
|
28
|
+
wrapItalic: i === "italic",
|
|
29
|
+
textTrimming: (o == null ? void 0 : o.textTrimming) === !0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function D(o) {
|
|
33
|
+
var p, b, g, y, w, k, P, z, T, B, j, C;
|
|
34
|
+
const r = [], n = [], l = [];
|
|
35
|
+
t(r, "padding", $((p = o == null ? void 0 : o.buttonExternalPadding) == null ? void 0 : p.desktop)), t(l, "padding", $((b = o == null ? void 0 : o.buttonInternalPadding) == null ? void 0 : b.desktop)), t(l, "font-family", (g = o == null ? void 0 : o.buttonStyle) == null ? void 0 : g["font-family"]), t(l, "font-size", (y = o == null ? void 0 : o.buttonStyle) == null ? void 0 : y["font-size"]), t(l, "font-weight", (w = o == null ? void 0 : o.buttonStyle) == null ? void 0 : w["font-weight"]), t(l, "font-style", (k = o == null ? void 0 : o.buttonStyle) == null ? void 0 : k["font-style"]);
|
|
36
|
+
const f = (P = o == null ? void 0 : o.buttonColor) == null ? void 0 : P.color, x = (z = o == null ? void 0 : o.textButtonColor) == null ? void 0 : z.color;
|
|
37
|
+
t(n, "background", f), t(l, "background", f), t(l, "color", x);
|
|
38
|
+
const i = o == null ? void 0 : o.buttonBorder, u = S(i == null ? void 0 : i.width), d = S(i == null ? void 0 : i.style), a = S(i == null ? void 0 : i.color);
|
|
39
|
+
if (u !== null)
|
|
40
|
+
t(n, "border-width", `${u}px`);
|
|
41
|
+
else if (i != null && i.width) {
|
|
42
|
+
const c = i.width;
|
|
43
|
+
t(n, "border-top-width", c.top !== void 0 ? `${c.top}px` : null), t(n, "border-right-width", c.right !== void 0 ? `${c.right}px` : null), t(n, "border-bottom-width", c.bottom !== void 0 ? `${c.bottom}px` : null), t(n, "border-left-width", c.left !== void 0 ? `${c.left}px` : null);
|
|
44
|
+
}
|
|
45
|
+
d !== null ? t(n, "border-style", d) : i != null && i.style && (t(n, "border-top-style", i.style.top), t(n, "border-right-style", i.style.right), t(n, "border-bottom-style", i.style.bottom), t(n, "border-left-style", i.style.left)), a !== null ? t(n, "border-color", a) : i != null && i.color && (t(n, "border-top-color", i.color.top), t(n, "border-right-color", i.color.right), t(n, "border-bottom-color", i.color.bottom), t(n, "border-left-color", i.color.left));
|
|
46
|
+
const s = o == null ? void 0 : o.buttonBorderRadius;
|
|
47
|
+
if (s) {
|
|
48
|
+
if (typeof s.radius == "number") {
|
|
49
|
+
const c = `${s.radius}px`;
|
|
50
|
+
t(n, "border-radius", c), t(l, "border-radius", c);
|
|
51
|
+
} else if (typeof s.lt == "number" || typeof s.rt == "number" || typeof s.rb == "number" || typeof s.lb == "number") {
|
|
52
|
+
const c = s.lt ?? 0, N = s.rt ?? 0, v = s.rb ?? 0, A = s.lb ?? 0, I = `${c}px ${N}px ${v}px ${A}px`;
|
|
53
|
+
t(n, "border-radius", I), t(l, "border-radius", I);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return ((T = o == null ? void 0 : o.buttonStretch) == null ? void 0 : T.stretched) === !1 ? (t(n, "display", "inline-block"), t(l, "display", "inline-block")) : ((B = o == null ? void 0 : o.buttonStretch) == null ? void 0 : B.stretched) === !0 && (t(n, "display", "block"), t(l, "display", "block")), {
|
|
57
|
+
tdStyle: r.join("; "),
|
|
58
|
+
align: ((j = o == null ? void 0 : o.buttonAlign) == null ? void 0 : j.align) || void 0,
|
|
59
|
+
spanStyle: n.join("; "),
|
|
60
|
+
aStyle: l.join("; "),
|
|
61
|
+
text: (C = o == null ? void 0 : o.buttonText) == null ? void 0 : C.text
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function L(o) {
|
|
65
|
+
if (typeof o == "number" && Number.isFinite(o) && o >= 0)
|
|
66
|
+
return Math.trunc(o);
|
|
67
|
+
if (typeof o == "string" && /^\d+$/.test(o.trim())) {
|
|
68
|
+
const r = Number(o.trim());
|
|
69
|
+
if (Number.isFinite(r) && r >= 0)
|
|
70
|
+
return r;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function E(o) {
|
|
74
|
+
var r, n;
|
|
75
|
+
return {
|
|
76
|
+
width: L((r = o == null ? void 0 : o.imageSize) == null ? void 0 : r.width),
|
|
77
|
+
height: L((n = o == null ? void 0 : o.imageSize) == null ? void 0 : n.height)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function M(o, r) {
|
|
81
|
+
const n = (o ?? "").trim().replace(/;$/, "").trim(), l = (r ?? "").trim().replace(/;$/, "").trim();
|
|
82
|
+
return n ? l ? `${n}; ${l}` : n : l;
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
M as appendStyle,
|
|
86
|
+
D as mapButtonTheme,
|
|
87
|
+
E as mapImageTheme,
|
|
88
|
+
W as mapTextTheme
|
|
89
|
+
};
|
|
@@ -1,297 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @returns The background color value or empty string
|
|
52
|
-
*/
|
|
53
|
-
extractCardBgColor(e) {
|
|
54
|
-
const t = e.getAttribute("bgcolor");
|
|
55
|
-
if (t)
|
|
56
|
-
return t.trim();
|
|
57
|
-
const s = e.getAttribute("style");
|
|
58
|
-
if (s) {
|
|
59
|
-
const o = s.match(/background-color\s*:\s*([^;]+)/i);
|
|
60
|
-
if (o && o[1])
|
|
61
|
-
return o[1].trim();
|
|
62
|
-
}
|
|
63
|
-
return "";
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Extracts title from old block and converts to new structure
|
|
67
|
-
* @param block - The old recommendation block element
|
|
68
|
-
* @returns HTML string for the title block
|
|
69
|
-
*/
|
|
70
|
-
extractTitle(e) {
|
|
71
|
-
var g, a;
|
|
72
|
-
const t = e.querySelector(".ext-recommendation-title");
|
|
73
|
-
if (!t)
|
|
74
|
-
return this.buildTitleBlock({
|
|
75
|
-
text: "You May Also Like!",
|
|
76
|
-
isBold: !0,
|
|
77
|
-
isItalic: !1,
|
|
78
|
-
align: "center",
|
|
79
|
-
styles: "font-size: 28px; color: #333333;"
|
|
80
|
-
});
|
|
81
|
-
const s = t.querySelector("p");
|
|
82
|
-
if (!s) {
|
|
83
|
-
const p = ((g = t.textContent) == null ? void 0 : g.trim()) || "You May Also Like!", b = t.getAttribute("align") || "center";
|
|
84
|
-
return this.buildTitleBlock({
|
|
85
|
-
text: p,
|
|
86
|
-
isBold: !0,
|
|
87
|
-
isItalic: !1,
|
|
88
|
-
align: b,
|
|
89
|
-
styles: "font-size: 28px; color: #333333;"
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const o = ((a = s.textContent) == null ? void 0 : a.trim()) || "You May Also Like!", i = t.getAttribute("align") || s.getAttribute("align") || "center", r = s.getAttribute("style") || "", n = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), l = this.convertInlineToBlock(c);
|
|
93
|
-
return this.buildTitleBlock({
|
|
94
|
-
text: o,
|
|
95
|
-
isBold: n,
|
|
96
|
-
isItalic: u,
|
|
97
|
-
align: i,
|
|
98
|
-
styles: l
|
|
1
|
+
import { BlockId as f } from "../../enums/block.js";
|
|
2
|
+
import { useTemplateStore as u } from "../../stores/template.js";
|
|
3
|
+
import { mapComposition as b } from "./recommendation/compositionMapper.js";
|
|
4
|
+
import { extractTitleText as y, extractCardBgColor as v } from "./recommendation/extractors.js";
|
|
5
|
+
import { buildBlockHtml as C } from "./recommendation/htmlBuilder.js";
|
|
6
|
+
import { parseRecommendationId as R, parseLegacyConfig as S } from "./recommendation/parseLegacyConfig.js";
|
|
7
|
+
import { mapSettings as w } from "./recommendation/settingsMapper.js";
|
|
8
|
+
const x = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
|
|
9
|
+
function M(i, o, c) {
|
|
10
|
+
var s;
|
|
11
|
+
const t = R(o);
|
|
12
|
+
if (t === null)
|
|
13
|
+
return console.warn(
|
|
14
|
+
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
15
|
+
), !1;
|
|
16
|
+
const r = S(o);
|
|
17
|
+
if (!r)
|
|
18
|
+
return console.warn(
|
|
19
|
+
`[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
20
|
+
), !1;
|
|
21
|
+
const n = c[String(t)];
|
|
22
|
+
if (!n)
|
|
23
|
+
return console.warn(
|
|
24
|
+
`[RecommendationMigrator] Aborting block id=${t} — recommendationConfigs entry missing in Guido Config`
|
|
25
|
+
), !1;
|
|
26
|
+
const m = w(n, r, t), e = b((s = r.composition) == null ? void 0 : s.variables), d = y(o), l = v(o), g = {
|
|
27
|
+
...m,
|
|
28
|
+
composition: e.composition,
|
|
29
|
+
visibility: e.visibility,
|
|
30
|
+
textTrimming: e.anyTextTrimming
|
|
31
|
+
}, p = C({
|
|
32
|
+
nodeConfig: g,
|
|
33
|
+
composition: e,
|
|
34
|
+
cardBg: l,
|
|
35
|
+
titleText: d,
|
|
36
|
+
legacyId: o.getAttribute("id") ?? void 0,
|
|
37
|
+
legacyBgColor: o.getAttribute("bgcolor") ?? void 0
|
|
38
|
+
}), a = i.parseFromString(`<table><tbody><tr>${p}</tr></tbody></table>`, "text/html").querySelector(".recommendation-block-v2");
|
|
39
|
+
return !a || !o.parentNode ? (console.warn(
|
|
40
|
+
`[RecommendationMigrator] Aborting block id=${t} — failed to construct new HTML element`
|
|
41
|
+
), !1) : (o.parentNode.replaceChild(a, o), !0);
|
|
42
|
+
}
|
|
43
|
+
function H(i, o = {}) {
|
|
44
|
+
const c = new DOMParser(), t = c.parseFromString(i, "text/html"), r = Array.from(t.querySelectorAll(x));
|
|
45
|
+
try {
|
|
46
|
+
u().$patch((e) => {
|
|
47
|
+
e.migrations = {
|
|
48
|
+
...e.migrations,
|
|
49
|
+
[f.Recommendation]: r.length
|
|
50
|
+
};
|
|
99
51
|
});
|
|
52
|
+
} catch {
|
|
100
53
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*/
|
|
106
|
-
extractProductRows(e) {
|
|
107
|
-
const t = this.extractProductConfig(e);
|
|
108
|
-
if (!t)
|
|
109
|
-
return console.warn("[RecommendationMigrator] No product config found, using defaults"), this.generateProductRows(6, 3, {});
|
|
110
|
-
const { totalCount: s, productsPerRow: o } = t, i = this.extractProductStyles(e);
|
|
111
|
-
return this.generateProductRows(s, o, i);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Extracts Stripo padding/margin utility classes from a class string
|
|
115
|
-
* @param classString - Space-separated class string from element
|
|
116
|
-
* @returns Filtered Stripo utility classes as a space-separated string
|
|
117
|
-
*/
|
|
118
|
-
extractStripoClasses(e) {
|
|
119
|
-
return e ? e.split(/\s+/).filter((o) => /^es-(p\d+|m[-\d])/.test(o)).join(" ") : "";
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Extracts product configuration from old block
|
|
123
|
-
* @param block - The old recommendation block element
|
|
124
|
-
* @returns Object with totalCount and productsPerRow, or null if parsing fails
|
|
125
|
-
*/
|
|
126
|
-
extractProductConfig(e) {
|
|
127
|
-
const t = e.getAttribute("esd-dev-product-config");
|
|
128
|
-
if (!t)
|
|
129
|
-
return null;
|
|
54
|
+
if (r.length === 0)
|
|
55
|
+
return i;
|
|
56
|
+
let n = 0;
|
|
57
|
+
return r.forEach((m) => {
|
|
130
58
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
productsPerRow: o.rowCount ?? 3
|
|
135
|
-
};
|
|
136
|
-
} catch (s) {
|
|
137
|
-
return console.error("[RecommendationMigrator] Failed to parse product config:", s), console.error(
|
|
138
|
-
"[RecommendationMigrator] Error details:",
|
|
139
|
-
s instanceof Error ? s.message : String(s)
|
|
140
|
-
), null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Decodes HTML entities from JSON string
|
|
145
|
-
* @param text - The encoded string
|
|
146
|
-
* @returns Decoded string
|
|
147
|
-
*/
|
|
148
|
-
unescapeJsonString(e) {
|
|
149
|
-
return e.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/'/g, "'").replace(/"/g, '"').replace(/\\\\"/g, "'");
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Generates product rows using prepareProductRows with default product data
|
|
153
|
-
* @param totalCount - Total number of products to display
|
|
154
|
-
* @param productsPerRow - Number of products in each row
|
|
155
|
-
* @param extractedStyles - Styles extracted from old product elements
|
|
156
|
-
* @returns HTML string for product rows with applied styles
|
|
157
|
-
*/
|
|
158
|
-
generateProductRows(e, t, s) {
|
|
159
|
-
const o = $(), i = [];
|
|
160
|
-
for (let n = 0; n < e; n++) {
|
|
161
|
-
const u = o[n % o.length];
|
|
162
|
-
i.push({ ...u });
|
|
163
|
-
}
|
|
164
|
-
let r = q(i, t);
|
|
165
|
-
return r = this.applyExtractedStyles(r, s), r;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Extracts styles from old product elements
|
|
169
|
-
* @param block - The old recommendation block element
|
|
170
|
-
* @returns Object with extracted styles for each element type
|
|
171
|
-
*/
|
|
172
|
-
extractProductStyles(e) {
|
|
173
|
-
const t = {}, s = e.querySelector(".product-card");
|
|
174
|
-
if (!s)
|
|
175
|
-
return console.warn("[RecommendationMigrator] No product card found, using default styles"), t;
|
|
176
|
-
const o = this.extractCardBgColor(s);
|
|
177
|
-
o && (t.cardBgColor = o);
|
|
178
|
-
const i = s.querySelector(".ext-product-image");
|
|
179
|
-
if (i) {
|
|
180
|
-
const l = i.querySelector("img"), g = l == null ? void 0 : l.getAttribute("width"), a = i.getAttribute("style") || "", p = i.getAttribute("align") || "center", b = i.getAttribute("class") || "", m = this.extractStripoClasses(b);
|
|
181
|
-
t.imageWidth = g || "120", t.imageAlign = p, t.imageTdStyle = a, t.imageClasses = m;
|
|
182
|
-
}
|
|
183
|
-
const r = s.querySelector(".ext-product-name");
|
|
184
|
-
if (r) {
|
|
185
|
-
const l = r.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = r.getAttribute("align") || "center", p = r.getAttribute("style") || "", b = r.getAttribute("class") || "", m = this.extractStripoClasses(b);
|
|
186
|
-
t.nameStyle = g, t.nameAlign = a, t.nameTdStyle = p, t.nameClasses = m;
|
|
187
|
-
}
|
|
188
|
-
const n = s.querySelector(".ext-product-price");
|
|
189
|
-
if (n) {
|
|
190
|
-
const l = n.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = n.getAttribute("align") || "center", p = n.getAttribute("style") || "", b = n.getAttribute("class") || "", m = this.extractStripoClasses(b);
|
|
191
|
-
t.priceStyle = g, t.priceAlign = a, t.priceTdStyle = p, t.priceClasses = m;
|
|
192
|
-
}
|
|
193
|
-
const u = s.querySelector(".ext-product-original-price");
|
|
194
|
-
if (u) {
|
|
195
|
-
const l = u.querySelector("p"), g = (l == null ? void 0 : l.getAttribute("style")) || "", a = u.getAttribute("align") || "center", p = u.getAttribute("style") || "", b = u.getAttribute("class") || "", m = this.extractStripoClasses(b);
|
|
196
|
-
t.oldPriceStyle = g, t.oldPriceAlign = a, t.oldPriceTdStyle = p, t.oldPriceClasses = m;
|
|
197
|
-
}
|
|
198
|
-
const c = s.querySelector(".ext-product-button");
|
|
199
|
-
if (c) {
|
|
200
|
-
const l = c.querySelector(".es-button-border"), g = c.querySelector("a.es-button"), a = (l == null ? void 0 : l.getAttribute("style")) || "", p = (g == null ? void 0 : g.getAttribute("style")) || "", b = c.getAttribute("align") || "center", m = c.getAttribute("style") || "", f = c.getAttribute("class") || "", C = this.extractStripoClasses(f), y = ((c == null ? void 0 : c.textContent) || "").trim();
|
|
201
|
-
t.buttonBorderStyle = a, t.buttonLinkStyle = p, t.buttonAlign = b, t.buttonTdStyle = m, t.buttonClasses = C, t.buttonText = y;
|
|
59
|
+
M(c, m, o) && (n += 1);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
|
|
202
62
|
}
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Applies extracted styles to the generated HTML
|
|
207
|
-
* @param html - The generated HTML from prepareProductRows
|
|
208
|
-
* @param extractedStyles - Styles extracted from old product elements
|
|
209
|
-
* @returns HTML with applied styles
|
|
210
|
-
*/
|
|
211
|
-
applyExtractedStyles(e, t) {
|
|
212
|
-
if (!t || Object.keys(t).length === 0)
|
|
213
|
-
return e;
|
|
214
|
-
const s = this.parser.parseFromString(`<table>${e}</table>`, "text/html");
|
|
215
|
-
t.cardBgColor && s.querySelectorAll(".product-attribute-cell").forEach((r) => {
|
|
216
|
-
r.setAttribute("bgcolor", t.cardBgColor);
|
|
217
|
-
}), (t.imageWidth || t.imageAlign || t.imageTdStyle || t.imageClasses) && s.querySelectorAll(".product-image").forEach((r) => {
|
|
218
|
-
if (t.imageAlign && r.setAttribute("align", t.imageAlign), t.imageTdStyle && r.setAttribute("style", t.imageTdStyle), t.imageClasses) {
|
|
219
|
-
const c = `${r.getAttribute("class") || ""} ${t.imageClasses}`.trim();
|
|
220
|
-
r.setAttribute("class", c);
|
|
221
|
-
}
|
|
222
|
-
const n = r.querySelector("img");
|
|
223
|
-
n && t.imageWidth && n.setAttribute("width", t.imageWidth);
|
|
224
|
-
}), (t.nameStyle || t.nameAlign || t.nameTdStyle || t.nameClasses) && s.querySelectorAll(".product-name").forEach((r) => {
|
|
225
|
-
if (t.nameAlign && r.setAttribute("align", t.nameAlign), t.nameTdStyle && r.setAttribute("style", t.nameTdStyle), t.nameClasses) {
|
|
226
|
-
const c = `${r.getAttribute("class") || ""} ${t.nameClasses}`.trim();
|
|
227
|
-
r.setAttribute("class", c);
|
|
228
|
-
}
|
|
229
|
-
const n = r.querySelector("p");
|
|
230
|
-
n && t.nameStyle && n.setAttribute("style", t.nameStyle);
|
|
231
|
-
}), (t.priceStyle || t.priceAlign || t.priceTdStyle || t.priceClasses) && s.querySelectorAll(".product-price").forEach((r) => {
|
|
232
|
-
if (t.priceAlign && r.setAttribute("align", t.priceAlign), t.priceTdStyle && r.setAttribute("style", t.priceTdStyle), t.priceClasses) {
|
|
233
|
-
const c = `${r.getAttribute("class") || ""} ${t.priceClasses}`.trim();
|
|
234
|
-
r.setAttribute("class", c);
|
|
235
|
-
}
|
|
236
|
-
const n = r.querySelector("p");
|
|
237
|
-
n && t.priceStyle && n.setAttribute("style", t.priceStyle);
|
|
238
|
-
}), (t.oldPriceStyle || t.oldPriceAlign || t.oldPriceTdStyle || t.oldPriceClasses) && s.querySelectorAll(".product-old-price").forEach((r) => {
|
|
239
|
-
if (t.oldPriceAlign && r.setAttribute("align", t.oldPriceAlign), t.oldPriceTdStyle && r.setAttribute("style", t.oldPriceTdStyle), t.oldPriceClasses) {
|
|
240
|
-
const c = `${r.getAttribute("class") || ""} ${t.oldPriceClasses}`.trim();
|
|
241
|
-
r.setAttribute("class", c);
|
|
242
|
-
}
|
|
243
|
-
const n = r.querySelector("p");
|
|
244
|
-
n && t.oldPriceStyle && n.setAttribute("style", t.oldPriceStyle);
|
|
245
|
-
}), (t.buttonBorderStyle || t.buttonLinkStyle || t.buttonAlign || t.buttonTdStyle || t.buttonClasses) && s.querySelectorAll(".product-button").forEach((r) => {
|
|
246
|
-
if (t.buttonAlign && r.setAttribute("align", t.buttonAlign), t.buttonTdStyle && r.setAttribute("style", t.buttonTdStyle), t.buttonClasses) {
|
|
247
|
-
const l = `${r.getAttribute("class") || ""} ${t.buttonClasses}`.trim();
|
|
248
|
-
r.setAttribute("class", l);
|
|
249
|
-
}
|
|
250
|
-
const n = r.querySelector(".es-button-border");
|
|
251
|
-
n && t.buttonBorderStyle && n.setAttribute("style", t.buttonBorderStyle);
|
|
252
|
-
const u = r.querySelector("a.es-button");
|
|
253
|
-
u && (t.buttonLinkStyle && u.setAttribute("style", t.buttonLinkStyle), t.buttonText && (u.textContent = t.buttonText));
|
|
254
|
-
});
|
|
255
|
-
const o = s.querySelector("table");
|
|
256
|
-
return (o == null ? void 0 : o.innerHTML) || e;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Builds title block with proper structure
|
|
260
|
-
*/
|
|
261
|
-
buildTitleBlock(e) {
|
|
262
|
-
let t = e.text;
|
|
263
|
-
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>`);
|
|
264
|
-
const s = e.align ? ` align="${e.align}"` : "", o = e.styles ? ` style="${e.styles}"` : "";
|
|
265
|
-
return `
|
|
266
|
-
<td class="esd-block-text es-p10t es-p10b es-p20l es-p20r"${s}>
|
|
267
|
-
<p path="1"${o}>
|
|
268
|
-
${t}
|
|
269
|
-
</p>
|
|
270
|
-
</td>
|
|
271
|
-
`;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Removes specified style properties from a style string
|
|
275
|
-
*/
|
|
276
|
-
removeStyleProperties(e, t) {
|
|
277
|
-
return e ? t.reduce((o, i) => {
|
|
278
|
-
const r = new RegExp(`${i}\\s*:\\s*[^;]*;?`, "gi");
|
|
279
|
-
return o.replace(r, "");
|
|
280
|
-
}, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Converts inline display to block display
|
|
284
|
-
*/
|
|
285
|
-
convertInlineToBlock(e) {
|
|
286
|
-
if (!e)
|
|
287
|
-
return "";
|
|
288
|
-
let t = e.replace(/display\s*:\s*inline/gi, "display: block");
|
|
289
|
-
return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").replace(/"/g, "'").trim();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function v(d) {
|
|
293
|
-
return new B().migrate(d);
|
|
63
|
+
}), n > 0 && console.info(`[RecommendationMigrator] Migrated ${n} legacy Recommendation block(s)`), t.documentElement.outerHTML;
|
|
294
64
|
}
|
|
295
65
|
export {
|
|
296
|
-
|
|
66
|
+
H as migrateRecommendation
|
|
297
67
|
};
|
|
@@ -18,7 +18,8 @@ const s = {
|
|
|
18
18
|
{ text: "after the amount", value: "1" }
|
|
19
19
|
], d = [
|
|
20
20
|
{ text: "dot(.)", value: "." },
|
|
21
|
-
{ text: "comma(,)", value: "," }
|
|
21
|
+
{ text: "comma(,)", value: "," },
|
|
22
|
+
{ text: "space( )", value: " " }
|
|
22
23
|
], p = [
|
|
23
24
|
{ text: "0", value: "0" },
|
|
24
25
|
{ text: "1", value: "1" },
|
package/dist/enums/onboarding.js
CHANGED
|
@@ -2,10 +2,15 @@ const e = [
|
|
|
2
2
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-0.ng-star-inserted",
|
|
3
3
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-1.ng-star-inserted",
|
|
4
4
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-2.ng-star-inserted"
|
|
5
|
-
], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]',
|
|
5
|
+
], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', E = ".in-ribbons-wrapper", o = ".guido__amp-toggle-html", a = ".in-segments-wrapper", O = '[data-testid="guido-header"]', _ = 158, i = 10;
|
|
6
6
|
export {
|
|
7
|
+
o as AMP_TOGGLE_BUTTON_SELECTOR,
|
|
8
|
+
a as AMP_TOGGLE_WRAPPER_SELECTOR,
|
|
7
9
|
n as CARD_COMPOSITION_TAB_SELECTOR,
|
|
8
|
-
|
|
10
|
+
O as HEADER_SELECTOR,
|
|
11
|
+
_ as POPOVER_LEFT_OFFSET,
|
|
12
|
+
i as POPOVER_TOP_GAP,
|
|
13
|
+
E as RIBBON_SELECTOR,
|
|
9
14
|
e as SERVICE_HOVER_SELECTORS,
|
|
10
15
|
s as SETTINGS_TAB_SELECTOR,
|
|
11
16
|
t as UI_EDITOR_SELECTOR
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { useTranslations as R } from "../composables/useTranslations.js";
|
|
2
|
+
import { ProductType as s } from "../@types/config/schemas.js";
|
|
3
|
+
import "../@types/config/defaults.js";
|
|
4
|
+
import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
|
|
5
|
+
const B = {
|
|
4
6
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
7
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
8
|
+
}, i = {
|
|
7
9
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
10
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
11
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
12
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
}, n =
|
|
13
|
+
}, n = S(), C = {
|
|
12
14
|
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
15
|
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
-
},
|
|
16
|
+
}, U = {
|
|
17
|
+
[s.EMAIL]: "email",
|
|
18
|
+
[s.ARCHITECT]: "journey",
|
|
19
|
+
[s.UNSUBSCRIBE_PAGES]: "email"
|
|
20
|
+
}, t = "iid", o = {
|
|
15
21
|
name: "Global Unsubscribe",
|
|
16
22
|
sendGridId: "G"
|
|
17
|
-
},
|
|
23
|
+
}, c = "/email/unsubscribe-pages", E = {
|
|
18
24
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
19
25
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
20
26
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
27
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
28
|
RESUBSCRIBE: 5
|
|
23
|
-
},
|
|
29
|
+
}, u = {
|
|
24
30
|
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
31
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
26
|
-
},
|
|
32
|
+
}, T = {
|
|
27
33
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
28
34
|
E.GLOBAL_UNSUBSCRIBE,
|
|
29
35
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -33,30 +39,31 @@ const _ = {
|
|
|
33
39
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
34
40
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
35
41
|
]
|
|
36
|
-
},
|
|
37
|
-
const
|
|
42
|
+
}, b = () => {
|
|
43
|
+
const e = R();
|
|
38
44
|
return {
|
|
39
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
40
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
41
|
-
[E.RESUBSCRIBE]:
|
|
42
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
43
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
45
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
46
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
47
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
48
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
49
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
44
50
|
};
|
|
45
|
-
},
|
|
51
|
+
}, P = {
|
|
46
52
|
default: "{{ins-unsubscribe-link}}",
|
|
47
53
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
48
54
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
49
55
|
};
|
|
50
56
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
o as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
58
|
+
t as INSIDER_ID,
|
|
59
|
+
i as LINK_REGEXES,
|
|
60
|
+
B as LINK_TYPES,
|
|
61
|
+
P as MERGE_TAGS,
|
|
56
62
|
E as PAGE_TYPES,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
U as PRODUCT_TYPE_URL_SEGMENTS,
|
|
64
|
+
T as TYPE_COLLECTIONS,
|
|
65
|
+
c as UNSUBSCRIBE_PAGES_LINK,
|
|
66
|
+
u as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
67
|
+
C as URLS,
|
|
68
|
+
b as getTypeTranslations
|
|
62
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as U, DEFAULT_MOBILE_ROW_SPACING as i, DEFAULT_MOBILE_COLUMN_SPACING as s, DEFAULT_MOBILE_CARDS_IN_ROW as o, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
|
|
2
2
|
import { ATTR_PRODUCT_IMAGE as _, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as t, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as n } from "./selectors.js";
|
|
3
3
|
const O = {
|
|
4
4
|
code: "USD",
|
|
@@ -44,10 +44,10 @@ const O = {
|
|
|
44
44
|
mobileCardsInRow: o,
|
|
45
45
|
mobileLayoutEnabled: !1,
|
|
46
46
|
previousMobileCardsInRow: o,
|
|
47
|
-
columnSpacing:
|
|
48
|
-
rowSpacing:
|
|
49
|
-
mobileColumnSpacing:
|
|
50
|
-
mobileRowSpacing:
|
|
47
|
+
columnSpacing: R,
|
|
48
|
+
rowSpacing: U,
|
|
49
|
+
mobileColumnSpacing: s,
|
|
50
|
+
mobileRowSpacing: i,
|
|
51
51
|
// Composition
|
|
52
52
|
composition: a,
|
|
53
53
|
visibility: E,
|