@useinsider/guido 3.26.0-beta.d0b09c0 → 3.26.0-beta.e7ade20

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 +46 -45
  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 +28 -27
  7. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +42 -27
  9. package/dist/composables/useCustomInterfaceAppearance.js +50 -50
  10. package/dist/composables/useFullStoryBridge.js +10 -9
  11. package/dist/config/migrator/unsubscribeMigrator.js +100 -114
  12. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -40
  13. package/dist/extensions/Blocks/Unsubscribe/block.js +96 -104
  14. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -4
  15. package/dist/extensions/Blocks/common-control.js +19 -19
  16. package/dist/extensions/DynamicContent/dynamic-content.js +15 -17
  17. package/dist/guido.css +1 -1
  18. package/dist/package.json.js +4 -4
  19. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  20. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +0 -1
  21. package/dist/src/stores/onboarding.d.ts +1 -0
  22. package/dist/src/utils/editorShadowRoot.d.ts +1 -0
  23. package/dist/stores/onboarding.js +4 -1
  24. package/dist/utils/editorShadowRoot.js +8 -0
  25. package/package.json +1 -1
  26. package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +0 -5
  27. package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +0 -1
@@ -1,44 +1,46 @@
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";
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 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
- }`, _ = [
37
- V,
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
- W,
40
- l,
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
- B,
54
+ D,
53
55
  R,
54
56
  P,
55
57
  T,
56
58
  x,
57
- M,
58
- O,
59
- D,
60
- C
59
+ E,
60
+ B,
61
+ l
61
62
  ].join(`
62
63
 
63
- `), k = 3e4;
64
+ `), _ = 3e4;
64
65
  let e = null;
65
- function q() {
66
- return e || (e = new CSSStyleSheet(), e.replaceSync(_)), e;
66
+ function k() {
67
+ return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
67
68
  }
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;
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() < S && requestAnimationFrame(m);
76
+ Date.now() < n && requestAnimationFrame(m);
77
77
  };
78
78
  m();
79
79
  } });
80
80
  export {
81
- fo as useCustomInterfaceAppearance
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 l = () => ({ injectFullStory: () => {
3
- var c;
4
- const n = window;
5
- if (typeof n._fs_org != "string" || !n._fs_org)
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 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"]'))
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 t = r.createElement("script");
11
- t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
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
- l as useFullStoryBridge
15
+ d as useFullStoryBridge
15
16
  };
@@ -1,160 +1,146 @@
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 {
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
- k(this, "parser");
9
+ A(this, "parser");
14
10
  this.parser = new DOMParser();
15
11
  }
16
12
  async migrate(e) {
17
13
  try {
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));
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 s = this.repairUnsubscribeLinks(t);
24
- return !r.length && !s ? e : t.documentElement.outerHTML;
25
- } catch (t) {
26
- return console.error("UnsubscribeMigrator failed:", t), e;
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, 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);
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: b,
35
- pageIds: u,
36
- paddingClass: n,
37
- bgColor: o
30
+ collectionType: o,
31
+ pageIds: b,
32
+ paddingClass: s,
33
+ bgColor: l
38
34
  });
39
- const l = this.buildUnsubscribeBlock(
35
+ const u = this.buildUnsubscribeBlock(
40
36
  a,
37
+ o,
41
38
  b,
42
- u,
43
- n,
44
- o
45
- ), g = this.parser.parseFromString(
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(y);
49
- g && s.parentNode && (g.setAttribute("id", i || ""), s.parentNode.replaceChild(g, s));
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 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)
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 n = i.getAttribute("href") || "";
88
- if (n && n !== c.default)
58
+ const l = s.getAttribute("href") || "";
59
+ if (l && l !== f.default)
89
60
  return;
90
- const o = Number(s.getAttribute(d.PAGE_TYPE)), a = c[o];
91
- a && (i.setAttribute("href", a), r = !0);
92
- }), r;
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 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"));
66
+ const t = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
67
+ return t ? t[0] : "";
101
68
  }
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 };
108
- }
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: ""
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
- if (a.linkText = this.hasVisibleContent(i) ? i.innerHTML.trim() : S, a.linkHref = this.normalizeUnsubscribeHref(i.getAttribute("href") || c.default), a.linkStyle = i.getAttribute("style") || "", n) {
121
- const b = this.getCollectionTypeFromMergeTag(a.linkHref), u = c[b];
122
- 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();
127
- }
128
- return a;
129
109
  }
130
- buildUnsubscribeBlock(e, t, r, s, i) {
131
- 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";
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";
132
116
  return `
133
117
  <td
134
118
  data-migration="true"
135
119
  esd-extension-block-id="unsubscribe-block"
136
- class="${s ? `${E} ${s}` : E}"
137
- ${g}${m}${U}${L}
120
+ class="${n ? `${S} ${n}` : S}"
121
+ ${m}${y}${E}${T}
138
122
  >
139
- ${p}
123
+ <p path="1"${d}>
124
+ ${i}
125
+ </p>
140
126
  </td>
141
127
  `;
142
128
  }
143
129
  getCollectionTypeFromMergeTag(e) {
144
- return e === c[T.SUBSCRIPTION_PREFERENCE_CENTER] ? T.SUBSCRIPTION_PREFERENCE_CENTER : e === c[T.GLOBAL_UNSUBSCRIBE] ? T.GLOBAL_UNSUBSCRIBE : T.GLOBAL_UNSUBSCRIBE;
130
+ return e === f[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === f[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
145
131
  }
146
132
  normalizeUnsubscribeHref(e) {
147
- if (Object.values(c).includes(e))
133
+ if (Object.values(f).includes(e))
148
134
  return e;
149
- const r = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
150
- return r ? r[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
135
+ const t = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
136
+ return t ? t[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
151
137
  `[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
152
138
  ), "{{ins-unsubscribe-link}}") : e;
153
139
  }
154
140
  }
155
- async function Y(f) {
156
- return new H().migrate(f);
141
+ async function M(c) {
142
+ return new $().migrate(c);
157
143
  }
158
144
  export {
159
- Y as migrateUnsubscribe
145
+ M as migrateUnsubscribe
160
146
  };
@@ -1,34 +1,34 @@
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";
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 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 {
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
- i(this, "store", O());
16
- i(this, "onboardingStore", A());
17
- i(this, "legacyConversion", L());
18
- i(this, "storeUnsubscription", () => {
15
+ r(this, "store", I());
16
+ r(this, "onboardingStore", $());
17
+ r(this, "legacyConversion", O());
18
+ r(this, "storeUnsubscription", () => {
19
19
  });
20
- i(this, "listeners", []);
21
- i(this, "lastPaintedState", null);
20
+ r(this, "listeners", []);
21
+ r(this, "lastPaintedState", null);
22
22
  }
23
23
  getId() {
24
- return I;
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"), r = 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"), 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
- ), g = this.api.translate(
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="${$.EMAIL_RECOMMENDATION_BLOCK}"
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">${g}</p>
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">${r}</span>
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 (!C.hasConfig(this.currentNode))
173
+ if (!k.hasConfig(this.currentNode))
174
174
  return !1;
175
- const t = C.getConfig(this.currentNode);
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, r) => {
191
+ const e = (a, i) => {
190
192
  const s = t.querySelector(a);
191
- s && (s.addEventListener("click", r), this.listeners.push({ element: s, handler: r }));
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 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)
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 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)
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
- 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";
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 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;
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
- I as STRATEGY_CONTROL_ID,
221
- P as StrategyControl
232
+ q as STRATEGY_CONTROL_ID,
233
+ Y as StrategyControl
222
234
  };