@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.
Files changed (27) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +45 -46
  3. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +5 -5
  4. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +15 -15
  5. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
  6. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +27 -28
  7. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +3 -3
  8. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +27 -42
  9. package/dist/composables/useCustomInterfaceAppearance.js +50 -50
  10. package/dist/composables/useFullStoryBridge.js +9 -10
  11. package/dist/config/migrator/unsubscribeMigrator.js +112 -100
  12. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +40 -52
  13. package/dist/extensions/Blocks/Unsubscribe/block.js +104 -96
  14. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
  15. package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +5 -0
  16. package/dist/extensions/Blocks/common-control.js +19 -19
  17. package/dist/extensions/DynamicContent/dynamic-content.js +17 -15
  18. package/dist/guido.css +1 -1
  19. package/dist/package.json.js +1 -1
  20. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
  21. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  22. package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +1 -0
  23. package/dist/src/stores/onboarding.d.ts +0 -1
  24. package/dist/stores/onboarding.js +1 -4
  25. package/package.json +1 -1
  26. package/dist/src/utils/editorShadowRoot.d.ts +0 -1
  27. package/dist/utils/editorShadowRoot.js +0 -8
@@ -1,46 +1,44 @@
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";
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 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,
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
- C,
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
- D,
52
+ B,
55
53
  R,
56
54
  P,
57
55
  T,
58
56
  x,
59
- E,
60
- B,
61
- l
57
+ M,
58
+ O,
59
+ D,
60
+ C
62
61
  ].join(`
63
62
 
64
- `), _ = 3e4;
63
+ `), k = 3e4;
65
64
  let e = null;
66
- function k() {
67
- return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
65
+ function q() {
66
+ return e || (e = new CSSStyleSheet(), e.replaceSync(_)), e;
68
67
  }
69
- const ao = () => ({ importCss: () => {
70
- const r = k(), n = Date.now() + _, m = () => {
71
- const t = O();
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() < n && requestAnimationFrame(m);
76
+ Date.now() < S && requestAnimationFrame(m);
77
77
  };
78
78
  m();
79
79
  } });
80
80
  export {
81
- ao as useCustomInterfaceAppearance
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 d = () => ({ injectFullStory: () => {
4
- var n;
5
- const e = window;
6
- if (typeof e._fs_org != "string" || !e._fs_org)
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 = (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"]'))
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 r = t.createElement("script");
12
- r.src = s, r.async = !0, r.crossOrigin = "anonymous", r.dataset.fullstoryBridge = "true", t.head.appendChild(r);
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
- d as useFullStoryBridge
14
+ l as useFullStoryBridge
16
15
  };
@@ -1,146 +1,158 @@
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 $ {
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
- A(this, "parser");
13
+ k(this, "parser");
10
14
  this.parser = new DOMParser();
11
15
  }
12
16
  async migrate(e) {
13
17
  try {
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);
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 n = this.repairUnsubscribeLinks(r);
20
- return !t.length && !n ? e : r.documentElement.outerHTML;
21
- } catch (r) {
22
- return console.error("UnsubscribeMigrator failed:", r), e;
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((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);
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: o,
31
- pageIds: b,
32
- paddingClass: s,
33
- bgColor: l
34
+ collectionType: b,
35
+ pageIds: u,
36
+ paddingClass: n,
37
+ bgColor: o
34
38
  });
35
- const u = this.buildUnsubscribeBlock(
39
+ const l = this.buildUnsubscribeBlock(
36
40
  a,
37
- o,
38
41
  b,
39
- s,
40
- l
41
- ), i = this.parser.parseFromString(
42
- `<table id="tempDoc"><tbody><tr>${u}</tr></tbody></table>`,
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(h);
45
- i && t.parentNode && (i.setAttribute("id", n || ""), t.parentNode.replaceChild(i, t));
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 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)
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 l = s.getAttribute("href") || "";
59
- if (l && l !== f.default)
87
+ const n = i.getAttribute("href") || "";
88
+ if (n && n !== c.default)
60
89
  return;
61
- const a = Number(n.getAttribute(k.PAGE_TYPE)), o = f[a];
62
- o && (s.setAttribute("href", o), t = !0);
63
- }), t;
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 t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
67
- return t ? t[0] : "";
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
- 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
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, 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";
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="${n ? `${S} ${n}` : S}"
121
- ${m}${y}${E}${T}
134
+ class="${s ? `${E} ${s}` : E}"
135
+ ${g}${m}${U}${L}
122
136
  >
123
- <p path="1"${d}>
124
- ${i}
125
- </p>
137
+ ${p}
126
138
  </td>
127
139
  `;
128
140
  }
129
141
  getCollectionTypeFromMergeTag(e) {
130
- return e === f[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === f[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
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(f).includes(e))
145
+ if (Object.values(c).includes(e))
134
146
  return e;
135
- const t = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
136
- return t ? t[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
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 M(c) {
142
- return new $().migrate(c);
153
+ async function Y(f) {
154
+ return new H().migrate(f);
143
155
  }
144
156
  export {
145
- M as migrateUnsubscribe
157
+ Y as migrateUnsubscribe
146
158
  };
@@ -1,34 +1,34 @@
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";
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 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 {
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
- r(this, "store", I());
16
- r(this, "onboardingStore", $());
17
- r(this, "legacyConversion", O());
18
- r(this, "storeUnsubscription", () => {
15
+ i(this, "store", O());
16
+ i(this, "onboardingStore", A());
17
+ i(this, "legacyConversion", L());
18
+ i(this, "storeUnsubscription", () => {
19
19
  });
20
- r(this, "listeners", []);
21
- r(this, "lastPaintedState", null);
20
+ i(this, "listeners", []);
21
+ i(this, "lastPaintedState", null);
22
22
  }
23
23
  getId() {
24
- return q;
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"), i = this.api.translate("Legacy Strategy"), s = this.api.translate(
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
- ), l = this.api.translate(
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="${w.EMAIL_RECOMMENDATION_BLOCK}"
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">${l}</p>
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">${i}</span>
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 (!k.hasConfig(this.currentNode))
173
+ if (!C.hasConfig(this.currentNode))
174
174
  return !1;
175
- const t = k.getConfig(this.currentNode);
175
+ const t = C.getConfig(this.currentNode);
176
176
  return !t.strategyId && (t.configVersion ?? 0) >= E;
177
177
  }
178
178
  onDestroy() {
179
- this._teardown(), requestAnimationFrame(() => {
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, i) => {
189
+ const e = (a, r) => {
192
190
  const s = t.querySelector(a);
193
- s && (s.addEventListener("click", i), this.listeners.push({ element: s, handler: i }));
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 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)
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 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)
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
- 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";
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 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;
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
- q as STRATEGY_CONTROL_ID,
233
- Y as StrategyControl
220
+ I as STRATEGY_CONTROL_ID,
221
+ P as StrategyControl
234
222
  };