@useinsider/guido 3.26.0-beta.5292870 → 3.26.0-beta.61e9df0
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/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +46 -45
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +15 -15
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +28 -27
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +42 -27
- package/dist/composables/useCustomInterfaceAppearance.js +50 -50
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/config/migrator/unsubscribeMigrator.js +100 -112
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -40
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -15
- package/dist/extensions/Blocks/Unsubscribe/block.js +96 -104
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -4
- package/dist/extensions/Blocks/common-control.js +19 -19
- package/dist/extensions/DynamicContent/dynamic-content.js +15 -17
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +0 -1
- package/dist/src/stores/onboarding.d.ts +1 -0
- package/dist/src/utils/editorShadowRoot.d.ts +1 -0
- package/dist/stores/onboarding.js +4 -1
- package/dist/utils/editorShadowRoot.js +8 -0
- package/package.json +2 -2
- package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +0 -5
- package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +0 -1
- package/dist/src/extensions/Blocks/_Boilerplate/block.d.ts +0 -11
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +0 -7
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +0 -10
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +0 -16
- package/dist/src/extensions/Blocks/_Boilerplate/control.d.ts +0 -17
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -15
- package/dist/src/extensions/Blocks/_Boilerplate/extension.d.ts +0 -2
- package/dist/src/extensions/Blocks/_Boilerplate/iconsRegistry.d.ts +0 -4
- package/dist/src/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +0 -4
- package/dist/src/extensions/Blocks/_Boilerplate/template.d.ts +0 -6
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
1
|
+
import S from "../static/assets/icons/filled-arrow-rising.svg.js";
|
|
2
|
+
import p from "../static/assets/icons/line-change.svg.js";
|
|
3
|
+
import s from "../static/assets/icons/line-delete.svg.js";
|
|
4
|
+
import f from "../static/assets/icons/line-info.svg.js";
|
|
5
|
+
import a from "../static/assets/icons/line-plus.svg.js";
|
|
6
|
+
import c from "../static/styles/base.css.js";
|
|
7
|
+
import l from "../static/styles/components/accessibility.css.js";
|
|
8
|
+
import C from "../static/styles/components/alert-message.css.js";
|
|
9
|
+
import d from "../static/styles/components/amp-block.css.js";
|
|
10
|
+
import u from "../static/styles/components/base-input.css.js";
|
|
11
|
+
import h from "../static/styles/components/button-group.css.js";
|
|
12
|
+
import I from "../static/styles/components/button.css.js";
|
|
13
|
+
import g from "../static/styles/components/combobox.css.js";
|
|
14
|
+
import w from "../static/styles/components/counter.css.js";
|
|
15
|
+
import y from "../static/styles/components/dropdown-menu.css.js";
|
|
16
|
+
import A from "../static/styles/components/loader.css.js";
|
|
17
|
+
import $ from "../static/styles/components/narrow-panel.css.js";
|
|
18
|
+
import b from "../static/styles/components/popup.css.js";
|
|
19
|
+
import B from "../static/styles/components/recommendation-strategy.css.js";
|
|
20
|
+
import D from "../static/styles/components/skeleton.css.js";
|
|
21
|
+
import R from "../static/styles/components/switcher.css.js";
|
|
22
|
+
import P from "../static/styles/components/tabs.css.js";
|
|
23
|
+
import T from "../static/styles/components/tools.css.js";
|
|
24
|
+
import x from "../static/styles/components/version-history.css.js";
|
|
25
|
+
import E from "../static/styles/components/wide-panel.css.js";
|
|
26
|
+
import M from "../static/styles/variables.css.js";
|
|
27
|
+
import { findEditorShadowRoot as O } from "../utils/editorShadowRoot.js";
|
|
27
28
|
function o(i, r) {
|
|
28
29
|
return `--guido-icon-${i}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
-
${o("line-change",
|
|
32
|
-
${o("line-delete",
|
|
33
|
-
${o("filled-arrow-rising",
|
|
34
|
-
${o("line-info",
|
|
35
|
-
${o("line-plus",
|
|
36
|
-
}`,
|
|
37
|
-
|
|
31
|
+
const V = `:host {
|
|
32
|
+
${o("line-change", p)}
|
|
33
|
+
${o("line-delete", s)}
|
|
34
|
+
${o("filled-arrow-rising", S)}
|
|
35
|
+
${o("line-info", f)}
|
|
36
|
+
${o("line-plus", a)}
|
|
37
|
+
}`, W = [
|
|
38
|
+
M,
|
|
38
39
|
// Must be on top
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
V,
|
|
41
|
+
c,
|
|
41
42
|
// Must be on top
|
|
43
|
+
C,
|
|
42
44
|
d,
|
|
43
45
|
u,
|
|
44
46
|
h,
|
|
@@ -49,34 +51,32 @@ const W = `:host {
|
|
|
49
51
|
A,
|
|
50
52
|
$,
|
|
51
53
|
b,
|
|
52
|
-
|
|
54
|
+
D,
|
|
53
55
|
R,
|
|
54
56
|
P,
|
|
55
57
|
T,
|
|
56
58
|
x,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
C
|
|
59
|
+
E,
|
|
60
|
+
B,
|
|
61
|
+
l
|
|
61
62
|
].join(`
|
|
62
63
|
|
|
63
|
-
`),
|
|
64
|
+
`), _ = 3e4;
|
|
64
65
|
let e = null;
|
|
65
|
-
function
|
|
66
|
-
return e || (e = new CSSStyleSheet(), e.replaceSync(
|
|
66
|
+
function k() {
|
|
67
|
+
return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
|
|
67
68
|
}
|
|
68
|
-
const
|
|
69
|
-
const r =
|
|
70
|
-
|
|
71
|
-
const t = (n = document.querySelector("ui-editor")) == null ? void 0 : n.shadowRoot;
|
|
69
|
+
const ao = () => ({ importCss: () => {
|
|
70
|
+
const r = k(), n = Date.now() + _, m = () => {
|
|
71
|
+
const t = O();
|
|
72
72
|
if (t) {
|
|
73
73
|
t.adoptedStyleSheets.includes(r) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, r]);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
Date.now() <
|
|
76
|
+
Date.now() < n && requestAnimationFrame(m);
|
|
77
77
|
};
|
|
78
78
|
m();
|
|
79
79
|
} });
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
ao as useCustomInterfaceAppearance
|
|
82
82
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { findEditorShadowRoot as i } from "../utils/editorShadowRoot.js";
|
|
1
2
|
import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
|
|
2
|
-
const
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
if (typeof
|
|
3
|
+
const d = () => ({ injectFullStory: () => {
|
|
4
|
+
var n;
|
|
5
|
+
const e = window;
|
|
6
|
+
if (typeof e._fs_org != "string" || !e._fs_org)
|
|
6
7
|
return;
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
8
|
+
const o = (n = i()) == null ? void 0 : n.querySelector("iframe"), t = o == null ? void 0 : o.contentDocument;
|
|
9
|
+
if (!t || t.querySelector('script[data-fullstory-bridge="true"]'))
|
|
9
10
|
return;
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const r = t.createElement("script");
|
|
12
|
+
r.src = s, r.async = !0, r.crossOrigin = "anonymous", r.dataset.fullstoryBridge = "true", t.head.appendChild(r);
|
|
12
13
|
} });
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
d as useFullStoryBridge
|
|
15
16
|
};
|
|
@@ -1,158 +1,146 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { MERGE_TAGS as
|
|
5
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { useUnsubscribeStore as M } from "../../stores/unsubscribe.js";
|
|
9
|
-
import { escapeHtml as A } from "../../utils/htmlEscape.js";
|
|
10
|
-
const S = "unsubscribe", N = "You can ", R = " from our emails, if you need to.", C = "{-{-UNSUBSCRIBE-LINK-}-}";
|
|
11
|
-
class H {
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var B = (c, e, r) => e in c ? x(c, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : c[e] = r;
|
|
3
|
+
var A = (c, e, r) => B(c, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { MERGE_TAGS as f, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
|
|
5
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as h, DATA_ATTRIBUTES as k } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
|
|
7
|
+
class $ {
|
|
12
8
|
constructor() {
|
|
13
|
-
|
|
9
|
+
A(this, "parser");
|
|
14
10
|
this.parser = new DOMParser();
|
|
15
11
|
}
|
|
16
12
|
async migrate(e) {
|
|
17
13
|
try {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
await
|
|
14
|
+
const r = this.parser.parseFromString(e, "text/html"), t = r.querySelectorAll("td.unsubscribe-block");
|
|
15
|
+
if (t.length) {
|
|
16
|
+
const s = C();
|
|
17
|
+
await s.fetchTemplates(), this.migrateLegacyBlocks(t, s);
|
|
22
18
|
}
|
|
23
|
-
const
|
|
24
|
-
return !
|
|
25
|
-
} catch (
|
|
26
|
-
return console.error("UnsubscribeMigrator failed:",
|
|
19
|
+
const n = this.repairUnsubscribeLinks(r);
|
|
20
|
+
return !t.length && !n ? e : r.documentElement.outerHTML;
|
|
21
|
+
} catch (r) {
|
|
22
|
+
return console.error("UnsubscribeMigrator failed:", r), e;
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
migrateLegacyBlocks(e,
|
|
30
|
-
e.forEach((
|
|
31
|
-
const
|
|
25
|
+
migrateLegacyBlocks(e, r) {
|
|
26
|
+
e.forEach((t) => {
|
|
27
|
+
const n = t.getAttribute("id"), s = this.extractPaddingClass(t), l = t.getAttribute("bgcolor") || "", a = this.extractUnsubscribeContent(t), o = this.getCollectionTypeFromMergeTag(a.linkHref), b = r.getSelectedUnsubscribePagesByCollection(o);
|
|
32
28
|
console.debug("[UnsubscribeMigrator]", {
|
|
33
29
|
mergeTag: a.linkHref,
|
|
34
|
-
collectionType:
|
|
35
|
-
pageIds:
|
|
36
|
-
paddingClass:
|
|
37
|
-
bgColor:
|
|
30
|
+
collectionType: o,
|
|
31
|
+
pageIds: b,
|
|
32
|
+
paddingClass: s,
|
|
33
|
+
bgColor: l
|
|
38
34
|
});
|
|
39
|
-
const
|
|
35
|
+
const u = this.buildUnsubscribeBlock(
|
|
40
36
|
a,
|
|
37
|
+
o,
|
|
41
38
|
b,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`<table id="tempDoc"><tbody><tr>${l}</tr></tbody></table>`,
|
|
39
|
+
s,
|
|
40
|
+
l
|
|
41
|
+
), i = this.parser.parseFromString(
|
|
42
|
+
`<table id="tempDoc"><tbody><tr>${u}</tr></tbody></table>`,
|
|
47
43
|
"text/html"
|
|
48
|
-
).querySelector(
|
|
49
|
-
|
|
44
|
+
).querySelector(h);
|
|
45
|
+
i && t.parentNode && (i.setAttribute("id", n || ""), t.parentNode.replaceChild(i, t));
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
|
-
// The compiler resolves a typed tag only through a block that lists pages, so a page-less block carries no tag.
|
|
53
|
-
collectBlockTags(e, t) {
|
|
54
|
-
const r = /* @__PURE__ */ new Set();
|
|
55
|
-
return e.querySelectorAll(y).forEach((s) => {
|
|
56
|
-
var a, b, u;
|
|
57
|
-
if (!P(s.getAttribute(d.PAGE_LIST) || "").length)
|
|
58
|
-
return;
|
|
59
|
-
const i = Number(s.getAttribute(d.PAGE_TYPE)), n = c[i];
|
|
60
|
-
if (n) {
|
|
61
|
-
r.add(n);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const o = (u = (b = (a = this.findLinkCandidates(s).primary) == null ? void 0 : a.getAttribute("href")) == null ? void 0 : b.match(h)) == null ? void 0 : u[0];
|
|
65
|
-
o && r.add(c[this.getCollectionTypeFromMergeTag(o)]);
|
|
66
|
-
}), e.querySelectorAll("td.unsubscribe-block").forEach((s) => {
|
|
67
|
-
const i = this.getCollectionTypeFromMergeTag(this.getLegacyLinkTag(s));
|
|
68
|
-
t.getSelectedUnsubscribePagesByCollection(i).length && r.add(c[i]);
|
|
69
|
-
}), r;
|
|
70
|
-
}
|
|
71
|
-
// Mirrors extractUnsubscribeContent: without a <p> the block migrates on the default tag.
|
|
72
|
-
getLegacyLinkTag(e) {
|
|
73
|
-
var r, s;
|
|
74
|
-
const { primary: t } = this.findLinkCandidates(e);
|
|
75
|
-
return !t || !(t.closest("p") || e.querySelector("p")) ? c.default : ((s = (r = t.getAttribute("href")) == null ? void 0 : r.match(h)) == null ? void 0 : s[0]) ?? c.default;
|
|
76
|
-
}
|
|
77
48
|
// Re-derives the typed merge tag from data-unsubscribe-page-type for any v2
|
|
78
49
|
// block whose anchor href is missing or the legacy default. Returns true when
|
|
79
50
|
// at least one href was rewritten. Typed tags and custom URLs are left intact.
|
|
80
51
|
repairUnsubscribeLinks(e) {
|
|
81
|
-
const
|
|
82
|
-
let
|
|
83
|
-
return
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
52
|
+
const r = e.querySelectorAll(`${h}[${k.PAGE_TYPE}]`);
|
|
53
|
+
let t = !1;
|
|
54
|
+
return r.forEach((n) => {
|
|
55
|
+
const s = n.querySelector('a[data-unsubscribe-link="true"], a.unsubscribe-link');
|
|
56
|
+
if (!s)
|
|
86
57
|
return;
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
58
|
+
const l = s.getAttribute("href") || "";
|
|
59
|
+
if (l && l !== f.default)
|
|
89
60
|
return;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
}),
|
|
61
|
+
const a = Number(n.getAttribute(k.PAGE_TYPE)), o = f[a];
|
|
62
|
+
o && (s.setAttribute("href", o), t = !0);
|
|
63
|
+
}), t;
|
|
93
64
|
}
|
|
94
65
|
extractPaddingClass(e) {
|
|
95
|
-
const
|
|
96
|
-
return
|
|
97
|
-
}
|
|
98
|
-
hasVisibleContent(e) {
|
|
99
|
-
var t;
|
|
100
|
-
return !!((t = e.textContent) != null && t.trim() || e.querySelector("img"));
|
|
101
|
-
}
|
|
102
|
-
findLinkCandidates(e) {
|
|
103
|
-
const t = Array.from(/* @__PURE__ */ new Set([
|
|
104
|
-
...Array.from(e.querySelectorAll("a.unsubscribe-link")),
|
|
105
|
-
...Array.from(e.querySelectorAll('a[href*="unsubscribe"]'))
|
|
106
|
-
])), r = (n) => h.test(n.getAttribute("href") || ""), s = (n) => this.hasVisibleContent(n), i = t.find((n) => s(n) && r(n)) ?? t.find((n) => s(n) && n.classList.contains("unsubscribe-link")) ?? t.find(r) ?? t.find(s) ?? t[0];
|
|
107
|
-
return { candidates: t, primary: i };
|
|
66
|
+
const t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
|
|
67
|
+
return t ? t[0] : "";
|
|
108
68
|
}
|
|
109
|
-
extractUnsubscribeContent(e
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
69
|
+
extractUnsubscribeContent(e) {
|
|
70
|
+
var d;
|
|
71
|
+
const r = e.querySelector("a.unsubscribe-link") || e.querySelector('a[href*="unsubscribe"]'), t = (r == null ? void 0 : r.closest("p")) || e.querySelector("p");
|
|
72
|
+
if (!t)
|
|
73
|
+
return {
|
|
74
|
+
textBefore: "You can ",
|
|
75
|
+
linkText: "unsubscribe",
|
|
76
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
77
|
+
linkStyle: "",
|
|
78
|
+
textAfter: " from our emails, if you need to.",
|
|
79
|
+
isBold: !1,
|
|
80
|
+
isItalic: !1,
|
|
81
|
+
align: "center",
|
|
82
|
+
paragraphStyle: ""
|
|
83
|
+
};
|
|
84
|
+
const n = e.getAttribute("align") || t.getAttribute("align") || "center", s = t.getAttribute("style") || "";
|
|
85
|
+
if (!r)
|
|
86
|
+
return {
|
|
87
|
+
textBefore: "You can ",
|
|
88
|
+
linkText: "unsubscribe",
|
|
89
|
+
linkHref: "{{ins-unsubscribe-link}}",
|
|
90
|
+
linkStyle: "",
|
|
91
|
+
textAfter: " from our emails, if you need to.",
|
|
92
|
+
isBold: !1,
|
|
93
|
+
isItalic: !1,
|
|
94
|
+
align: n,
|
|
95
|
+
paragraphStyle: s
|
|
96
|
+
};
|
|
97
|
+
const l = ((d = r.textContent) == null ? void 0 : d.trim()) || "unsubscribe", a = r.getAttribute("href") || "{{ins-unsubscribe-link}}", o = r.getAttribute("style") || "", b = t.textContent || "", u = b.indexOf(l), g = u >= 0 ? b.substring(0, u).trim() : "You can ", i = u >= 0 ? b.substring(u + l.length).trim() : " from our emails, if you need to.", m = !!t.querySelector("b, strong"), y = !!t.querySelector("i, em");
|
|
98
|
+
return {
|
|
99
|
+
textBefore: g,
|
|
100
|
+
linkText: l,
|
|
101
|
+
linkHref: this.normalizeUnsubscribeHref(a),
|
|
102
|
+
linkStyle: o,
|
|
103
|
+
textAfter: i,
|
|
104
|
+
isBold: m,
|
|
105
|
+
isItalic: y,
|
|
106
|
+
align: n,
|
|
107
|
+
paragraphStyle: s
|
|
117
108
|
};
|
|
118
|
-
if (!o || (a.align = e.getAttribute("align") || o.getAttribute("align") || "center", n || (a.paragraphStyle = o.getAttribute("style") || ""), !i))
|
|
119
|
-
return a;
|
|
120
|
-
a.linkText = this.hasVisibleContent(i) ? i.innerHTML.trim() : S, a.linkHref = this.normalizeUnsubscribeHref(i.getAttribute("href") || c.default), a.linkStyle = i.getAttribute("style") || "";
|
|
121
|
-
const b = this.getCollectionTypeFromMergeTag(a.linkHref), u = c[b];
|
|
122
|
-
return r.querySelectorAll("a[href]").forEach((l) => {
|
|
123
|
-
var m;
|
|
124
|
-
const p = l.getAttribute("href") || "", g = (m = p.match(h)) == null ? void 0 : m[0];
|
|
125
|
-
g && l.setAttribute("href", B(p, t.has(g) ? g : u));
|
|
126
|
-
}), s.filter((l) => l !== i && !this.hasVisibleContent(l)).forEach((l) => l.replaceWith(...Array.from(l.childNodes))), i.replaceWith(r.ownerDocument.createTextNode(C)), a.footerHtml = r.innerHTML.trim(), a;
|
|
127
109
|
}
|
|
128
|
-
buildUnsubscribeBlock(e, t,
|
|
129
|
-
const
|
|
110
|
+
buildUnsubscribeBlock(e, r, t, n, s) {
|
|
111
|
+
const l = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${Object.values(f).includes(e.linkHref) ? f[r] : e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${l}>${e.linkText}</a>`, g = [];
|
|
112
|
+
e.textBefore && g.push(e.textBefore), g.push(u), e.textAfter && g.push(e.textAfter);
|
|
113
|
+
let i = g.join(" ");
|
|
114
|
+
e.isBold && e.isItalic ? i = `<strong path="1,0"><em path="1,0,0">${i}</em></strong>` : e.isBold ? i = `<strong path="1,0">${i}</strong>` : e.isItalic && (i = `<em path="1,0">${i}</em>`);
|
|
115
|
+
const m = e.align ? ` align="${e.align}"` : "", y = s ? ` bgcolor="${s}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", T = t.length > 0 ? ` ${k.PAGE_LIST}="${t.join(",")}"` : "", E = ` ${k.PAGE_TYPE}="${r}"`, S = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
|
|
130
116
|
return `
|
|
131
117
|
<td
|
|
132
118
|
data-migration="true"
|
|
133
119
|
esd-extension-block-id="unsubscribe-block"
|
|
134
|
-
class="${
|
|
135
|
-
${
|
|
120
|
+
class="${n ? `${S} ${n}` : S}"
|
|
121
|
+
${m}${y}${E}${T}
|
|
136
122
|
>
|
|
137
|
-
${
|
|
123
|
+
<p path="1"${d}>
|
|
124
|
+
${i}
|
|
125
|
+
</p>
|
|
138
126
|
</td>
|
|
139
127
|
`;
|
|
140
128
|
}
|
|
141
129
|
getCollectionTypeFromMergeTag(e) {
|
|
142
|
-
return e ===
|
|
130
|
+
return e === f[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === f[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
|
|
143
131
|
}
|
|
144
132
|
normalizeUnsubscribeHref(e) {
|
|
145
|
-
if (Object.values(
|
|
133
|
+
if (Object.values(f).includes(e))
|
|
146
134
|
return e;
|
|
147
|
-
const
|
|
148
|
-
return
|
|
135
|
+
const t = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
|
|
136
|
+
return t ? t[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
|
|
149
137
|
`[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
|
|
150
138
|
), "{{ins-unsubscribe-link}}") : e;
|
|
151
139
|
}
|
|
152
140
|
}
|
|
153
|
-
async function
|
|
154
|
-
return new
|
|
141
|
+
async function M(c) {
|
|
142
|
+
return new $().migrate(c);
|
|
155
143
|
}
|
|
156
144
|
export {
|
|
157
|
-
|
|
145
|
+
M as migrateUnsubscribe
|
|
158
146
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var N = (
|
|
3
|
-
var
|
|
4
|
-
import { useLegacyStrategyConversion as
|
|
5
|
-
import { ACADEMY_LINKS as
|
|
6
|
-
import { useOnboardingStore as
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var N = (g, o, t) => o in g ? A(g, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[o] = t;
|
|
3
|
+
var r = (g, o, t) => N(g, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { useLegacyStrategyConversion as O } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as w } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as $ } from "../../../../../stores/onboarding.js";
|
|
7
7
|
import { CommonControl as R } from "../../../common-control.js";
|
|
8
8
|
import { RRS_CONFIG_VERSION as E } from "../../constants/defaultConfig.js";
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
const
|
|
12
|
-
class
|
|
9
|
+
import { RecommendationConfigService as k } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as I } from "../../store/recommendation.js";
|
|
11
|
+
const q = "recommendation-strategy-control", y = "recommendationLegacyStrategyOnboarding";
|
|
12
|
+
class Y extends R {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
r(this, "store", I());
|
|
16
|
+
r(this, "onboardingStore", $());
|
|
17
|
+
r(this, "legacyConversion", O());
|
|
18
|
+
r(this, "storeUnsubscription", () => {
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
r(this, "listeners", []);
|
|
21
|
+
r(this, "lastPaintedState", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return q;
|
|
25
25
|
}
|
|
26
26
|
getTemplate() {
|
|
27
27
|
const t = this.api.translate(
|
|
28
28
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
29
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"),
|
|
29
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), i = this.api.translate("Legacy Strategy"), s = this.api.translate(
|
|
30
30
|
"Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
|
|
31
|
-
),
|
|
31
|
+
), l = this.api.translate(
|
|
32
32
|
"The recommendation strategy used in the recommendation block is no longer available. You can assign a different strategy to it."
|
|
33
33
|
);
|
|
34
34
|
return `
|
|
@@ -54,7 +54,7 @@ class P extends R {
|
|
|
54
54
|
${t}
|
|
55
55
|
${e}
|
|
56
56
|
<a
|
|
57
|
-
href="${
|
|
57
|
+
href="${w.EMAIL_RECOMMENDATION_BLOCK}"
|
|
58
58
|
target="_blank"
|
|
59
59
|
rel="noopener noreferrer">${a}</a>.
|
|
60
60
|
</p>
|
|
@@ -78,7 +78,7 @@ class P extends R {
|
|
|
78
78
|
<div data-strategy-unavailable-state style="display: none;">
|
|
79
79
|
<div class="strategy-control-notice-row">
|
|
80
80
|
<div class="strategy-control-notice strategy-control-notice--error" role="alert">
|
|
81
|
-
<p class="strategy-control-notice-text">${
|
|
81
|
+
<p class="strategy-control-notice-text">${l}</p>
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
${this._GuTwoColumns([
|
|
@@ -103,7 +103,7 @@ class P extends R {
|
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
<div class="strategy-control-name-band">
|
|
106
|
-
<span class="strategy-control-name">${
|
|
106
|
+
<span class="strategy-control-name">${i}</span>
|
|
107
107
|
${this._strategyAction({
|
|
108
108
|
id: "guido__btn-update-legacy-strategy",
|
|
109
109
|
label: this.api.translate("Update"),
|
|
@@ -170,13 +170,15 @@ class P extends R {
|
|
|
170
170
|
* strategyId) for an assigned block.
|
|
171
171
|
*/
|
|
172
172
|
_isNodeUnassigned() {
|
|
173
|
-
if (!
|
|
173
|
+
if (!k.hasConfig(this.currentNode))
|
|
174
174
|
return !1;
|
|
175
|
-
const t =
|
|
175
|
+
const t = k.getConfig(this.currentNode);
|
|
176
176
|
return !t.strategyId && (t.configVersion ?? 0) >= E;
|
|
177
177
|
}
|
|
178
178
|
onDestroy() {
|
|
179
|
-
this._teardown()
|
|
179
|
+
this._teardown(), requestAnimationFrame(() => {
|
|
180
|
+
this.store.strategyPanelOpen || this._closeLegacyOnboarding();
|
|
181
|
+
});
|
|
180
182
|
}
|
|
181
183
|
_teardown() {
|
|
182
184
|
this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
@@ -186,37 +188,47 @@ class P extends R {
|
|
|
186
188
|
const t = this.getContainer();
|
|
187
189
|
if (!t)
|
|
188
190
|
return;
|
|
189
|
-
const e = (a,
|
|
191
|
+
const e = (a, i) => {
|
|
190
192
|
const s = t.querySelector(a);
|
|
191
|
-
s && (s.addEventListener("click",
|
|
193
|
+
s && (s.addEventListener("click", i), this.listeners.push({ element: s, handler: i }));
|
|
192
194
|
};
|
|
193
195
|
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-assign-unavailable-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-unavailable-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
194
196
|
this.legacyConversion.convertLegacyStrategy();
|
|
195
197
|
});
|
|
196
198
|
}
|
|
199
|
+
_closeLegacyOnboarding() {
|
|
200
|
+
this.onboardingStore.isActive(y) && this.onboardingStore.resetOnboarding(y);
|
|
201
|
+
}
|
|
202
|
+
_syncLegacyOnboarding(t) {
|
|
203
|
+
if (!t) {
|
|
204
|
+
this._closeLegacyOnboarding();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this.onboardingStore.closedThisSession.includes(y) || this.onboardingStore.startOnboarding(y);
|
|
208
|
+
}
|
|
197
209
|
_renderState() {
|
|
198
|
-
var
|
|
199
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
200
|
-
if (
|
|
210
|
+
var L;
|
|
211
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((L = this.store.assignedStrategy) == null ? void 0 : L.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), i = !!t && !e && !a && this.store.strategiesFetched, s = this.store.legacyConversionLoading, l = this.store.isLegacyStrategyBlock, v = [t, e, a, i, s, l].join("\0");
|
|
212
|
+
if (v === this.lastPaintedState)
|
|
201
213
|
return;
|
|
202
214
|
const n = this.getContainer();
|
|
203
215
|
if (!n)
|
|
204
216
|
return;
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
217
|
+
const h = n.querySelector("[data-strategy-empty-state]"), u = n.querySelector("[data-strategy-assigned-state]"), c = n.querySelector("[data-strategy-legacy-state]"), m = n.querySelector("[data-strategy-unavailable-state]"), b = n.querySelector("[data-strategy-loading-state]"), _ = n.querySelector("[data-strategy-content]"), p = n.querySelector("[data-strategy-name]"), S = n.querySelector("[data-strategy-name-skeleton]");
|
|
218
|
+
if (!h || !u || !c || !m)
|
|
207
219
|
return;
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
[
|
|
211
|
-
d.style.display = d ===
|
|
220
|
+
b && (b.style.display = "none"), _ && (_.style.display = "");
|
|
221
|
+
const f = t ? i ? m : u : l ? c : h;
|
|
222
|
+
[h, u, c, m].forEach((d) => {
|
|
223
|
+
d.style.display = d === f ? "" : "none";
|
|
212
224
|
}), c.querySelectorAll("button").forEach((d) => {
|
|
213
225
|
d.disabled = s;
|
|
214
226
|
}), c.classList.toggle("is-converting", s), !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
|
|
215
|
-
const
|
|
216
|
-
|
|
227
|
+
const C = this.store.currentRecommendationId;
|
|
228
|
+
C !== null && this.store.blockStates[C] && this._syncLegacyOnboarding(f === c), p && (p.style.display = a ? "none" : "", t && !a && (p.textContent = e || `#${t}`)), S && (S.style.display = a ? "block" : "none"), this.lastPaintedState = v;
|
|
217
229
|
}
|
|
218
230
|
}
|
|
219
231
|
export {
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
q as STRATEGY_CONTROL_ID,
|
|
233
|
+
Y as StrategyControl
|
|
222
234
|
};
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function f(t) {
|
|
2
|
+
return typeof t != "number" || !Number.isFinite(t) ? 2 : Math.min(Math.max(Math.trunc(t), 0), 20);
|
|
3
|
+
}
|
|
4
|
+
function d(t, n) {
|
|
5
|
+
const { thousandSeparator: c, decimalSeparator: e, decimalCount: r } = n, [u, i = ""] = String(t).split("."), o = i.slice(0, r).padEnd(r, "0"), a = u.replace(
|
|
3
6
|
/\B(?=(\d{3})+(?!\d))/g,
|
|
4
|
-
|
|
7
|
+
c
|
|
5
8
|
);
|
|
6
|
-
return r > 0 &&
|
|
9
|
+
return r > 0 && o ? `${a}${e}${o}` : a;
|
|
7
10
|
}
|
|
8
|
-
function
|
|
9
|
-
const { price:
|
|
11
|
+
function $(t) {
|
|
12
|
+
const { price: n, currency: c } = t, {
|
|
10
13
|
symbol: e,
|
|
11
14
|
alignment: r,
|
|
12
15
|
thousandSeparator: u,
|
|
13
|
-
decimalSeparator:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const s = "0".repeat(n), m = `0${o}${s}`;
|
|
16
|
+
decimalSeparator: i
|
|
17
|
+
} = c, o = f(c.decimalCount);
|
|
18
|
+
if (typeof n != "number" || Number.isNaN(n)) {
|
|
19
|
+
const s = "0".repeat(o), m = `0${i}${s}`;
|
|
18
20
|
return r === "before" ? `${e} ${m}` : `${m} ${e}`;
|
|
19
21
|
}
|
|
20
|
-
const a = d(
|
|
22
|
+
const a = d(n, {
|
|
21
23
|
thousandSeparator: u,
|
|
22
|
-
decimalSeparator:
|
|
23
|
-
decimalCount:
|
|
24
|
+
decimalSeparator: i,
|
|
25
|
+
decimalCount: o
|
|
24
26
|
});
|
|
25
27
|
return r === "before" ? `${e} ${a}` : `${a} ${e}`;
|
|
26
28
|
}
|
|
27
29
|
export {
|
|
28
30
|
d as formatNumber,
|
|
29
|
-
|
|
31
|
+
$ as formatPrice
|
|
30
32
|
};
|