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