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

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 (31) hide show
  1. package/README.md +10 -5
  2. package/dist/components/Guido.vue.js +7 -7
  3. package/dist/components/Guido.vue2.js +82 -79
  4. package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js +22 -0
  5. package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue2.js +54 -0
  6. package/dist/composables/useAmbiguousDynamicContent.js +62 -0
  7. package/dist/composables/useHtmlCompiler.js +9 -8
  8. package/dist/composables/useModuleRepair.js +55 -31
  9. package/dist/config/compiler/htmlCompilerRules.js +16 -6
  10. package/dist/config/migrator/unsubscribeMigrator.js +100 -114
  11. package/dist/enums/dynamic-content.js +4 -0
  12. package/dist/extensions/Blocks/Unsubscribe/block.js +96 -104
  13. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -4
  14. package/dist/guido.css +1 -1
  15. package/dist/package.json.js +4 -4
  16. package/dist/src/@types/generic.d.ts +7 -0
  17. package/dist/src/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.d.ts +2 -0
  18. package/dist/src/composables/useAmbiguousDynamicContent.d.ts +6 -0
  19. package/dist/src/enums/dynamic-content.d.ts +3 -0
  20. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +0 -1
  21. package/dist/src/stores/module-dynamic-content.d.ts +30 -0
  22. package/dist/src/utils/dynamicContentConverter.d.ts +20 -18
  23. package/dist/src/utils/dynamicContentPendingMarker.d.ts +2 -0
  24. package/dist/src/utils/genericUtil.d.ts +4 -8
  25. package/dist/stores/module-dynamic-content.js +20 -0
  26. package/dist/utils/dynamicContentConverter.js +41 -27
  27. package/dist/utils/dynamicContentPendingMarker.js +6 -0
  28. package/dist/utils/genericUtil.js +39 -39
  29. package/package.json +1 -1
  30. package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +0 -5
  31. package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +0 -1
@@ -1,37 +1,61 @@
1
- import { useConfig as f } from "./useConfig.js";
2
- import { useToaster as d } from "./useToaster.js";
3
- import { useTranslations as C } from "./useTranslations.js";
4
- import { ToasterTypeOptions as T } from "../enums/toaster.js";
5
- import { useEditorStore as h } from "../stores/editor.js";
6
- import { buildDynamicContentLookup as v, convertModuleDynamicContent as D } from "../utils/dynamicContentConverter.js";
7
- import { flattenDynamicContentList as L } from "../utils/genericUtil.js";
8
- import { repairItemsCurrencyAttributes as M } from "../utils/itemsCurrencyRepair.js";
9
- import { convertLegacyUnsubscribeInModuleHtml as O } from "../utils/legacyUnsubscribeConversion.js";
10
- const E = "dynamic-content.unresolved-attributes-on-drop", S = () => {
11
- const { template: p, isFeatureEnabled: n } = f(), { showToaster: y } = d(), b = C();
12
- return { handleModuleAdd: (t, r) => {
13
- var c, i, l;
1
+ import { useConfig as A } from "./useConfig.js";
2
+ import { useToaster as v } from "./useToaster.js";
3
+ import { useTranslations as O } from "./useTranslations.js";
4
+ import { ModuleDynamicContentAttribute as E } from "../enums/dynamic-content.js";
5
+ import { ToasterTypeOptions as L } from "../enums/toaster.js";
6
+ import { itemsBlockDynamicVariables as S } from "../extensions/Blocks/Items/enums/productEnums.js";
7
+ import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
8
+ import { useEditorStore as _ } from "../stores/editor.js";
9
+ import { useModuleDynamicContentStore as F } from "../stores/module-dynamic-content.js";
10
+ import { buildDynamicContentLookup as P, convertModuleDynamicContent as q } from "../utils/dynamicContentConverter.js";
11
+ import { stripPendingMarker as N } from "../utils/dynamicContentPendingMarker.js";
12
+ import { flattenDynamicContentCandidates as R } from "../utils/genericUtil.js";
13
+ import { repairItemsCurrencyAttributes as k } from "../utils/itemsCurrencyRepair.js";
14
+ import { convertLegacyUnsubscribeInModuleHtml as $ } from "../utils/legacyUnsubscribeConversion.js";
15
+ import { extractUsedDynamicContent as x } from "../utils/registerUsedDynamicContent.js";
16
+ const H = "dynamic-content.unresolved-attributes-on-drop", I = /^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/;
17
+ let M = 0;
18
+ const z = (o) => {
19
+ M += 1;
20
+ const r = `${Date.now().toString(36)}-${M}`;
21
+ return { html: o.replace(I, `$1 ${E.Pending}="${r}"`), id: r };
22
+ }, Y = (o, r) => {
23
+ try {
24
+ const n = x(o, r.map(({ text: c, value: a }) => ({ text: c, value: a })));
25
+ n.length > 0 && U().registerDynamicContent(n);
26
+ } catch (n) {
27
+ console.error("Failed to register module dynamic content:", n);
28
+ }
29
+ }, ne = () => {
30
+ const { template: o, isFeatureEnabled: r } = A(), { showToaster: n } = v(), c = O();
31
+ return { handleModuleAdd: (i, s) => {
32
+ var d, p, y, g;
14
33
  try {
15
- if ((t == null ? void 0 : t.action) !== "ADD" && (t == null ? void 0 : t.action) !== "COPY")
34
+ if ((i == null ? void 0 : i.action) !== "ADD" && (i == null ? void 0 : i.action) !== "COPY")
16
35
  return;
17
- const e = (c = r == null ? void 0 : r.getTargetNode) == null ? void 0 : c.call(r), s = (i = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : i.call(e);
18
- if (!e || typeof s != "string")
36
+ const e = (d = s == null ? void 0 : s.getTargetNode) == null ? void 0 : d.call(s), u = (p = e == null ? void 0 : e.getOuterHTML) == null ? void 0 : p.call(e);
37
+ if (!e || typeof u != "string")
19
38
  return;
20
- let o = M(s, {
21
- convertToPriceFormat: n("itemsPriceFormatting")
22
- }), u = !1;
23
- n("legacyUnsubscribeConversion") && ({ html: o, converted: u } = O(o));
24
- const m = v(L((l = p.value) == null ? void 0 : l.dynamicContentList));
25
- let a = [];
26
- if (m.size > 0 && ({ html: o, unresolved: a } = D(o, m, n("liquidSyntax"))), o !== s && r.modifyHtml(e).replaceWith(o), u)
39
+ let t = N(k(u, {
40
+ convertToPriceFormat: r("itemsPriceFormatting")
41
+ })), f = !1;
42
+ r("legacyUnsubscribeConversion") && ({ html: t, converted: f } = $(t));
43
+ const b = r("liquidSyntax"), C = b ? [] : R((y = o.value) == null ? void 0 : y.dynamicContentList), D = P(C);
44
+ let h = [], l = [], m = null;
45
+ if (D.size > 0 && ({ html: t, unresolved: h, ambiguous: l } = q(
46
+ t,
47
+ D,
48
+ b,
49
+ [...((g = o.value) == null ? void 0 : g.customFieldAttributes) ?? [], ...S]
50
+ )), l.length > 0 && ({ html: t, id: m } = z(t)), t !== u && s.modifyHtml(e).replaceWith(t), Y(t, C), f)
27
51
  try {
28
- h().isLegacyUnsubscribeModalRequested = !0;
29
- } catch (g) {
30
- console.error("Failed to request the legacy unsubscribe modal:", g);
52
+ _().isLegacyUnsubscribeModalRequested = !0;
53
+ } catch (T) {
54
+ console.error("Failed to request the legacy unsubscribe modal:", T);
31
55
  }
32
- a.length > 0 && y({
33
- type: T.Warning,
34
- message: b(E)
56
+ m && F().enqueue({ id: m, items: l }), h.length > 0 && n({
57
+ type: L.Warning,
58
+ message: c(H)
35
59
  });
36
60
  } catch (e) {
37
61
  console.error("Failed to repair module on add:", e);
@@ -39,6 +63,6 @@ const E = "dynamic-content.unresolved-attributes-on-drop", S = () => {
39
63
  } };
40
64
  };
41
65
  export {
42
- E as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
43
- S as useModuleRepair
66
+ H as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
67
+ ne as useModuleRepair
44
68
  };
@@ -1,6 +1,7 @@
1
- import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
- import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
- const f = [
1
+ import { PENDING_MARKER_PATTERN as c } from "../../utils/dynamicContentPendingMarker.js";
2
+ import { stripFontTags as l } from "../../utils/stripFontTags.js";
3
+ import { trimHrefWhitespace as d } from "../../utils/trimHrefWhitespace.js";
4
+ const y = [
4
5
  {
5
6
  id: "fix-url-encoding-start",
6
7
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -59,14 +60,14 @@ const f = [
59
60
  id: "strip-font-tags",
60
61
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
61
62
  type: "custom",
62
- processor: (e) => c(e),
63
+ processor: (e) => l(e),
63
64
  priority: 15
64
65
  },
65
66
  {
66
67
  id: "trim-href-whitespace",
67
68
  description: "Trim leading/trailing whitespace and &nbsp; from every href value",
68
69
  type: "custom",
69
- processor: (e) => l(e),
70
+ processor: (e) => d(e),
70
71
  priority: 16
71
72
  },
72
73
  {
@@ -183,6 +184,15 @@ const f = [
183
184
  flags: "g",
184
185
  priority: 45
185
186
  },
187
+ {
188
+ id: "remove-dc-pending-marker",
189
+ description: "Strip the editor-only pending dynamic-content choice marker from compiled output",
190
+ type: "regex",
191
+ pattern: c,
192
+ replacement: "",
193
+ flags: "g",
194
+ priority: 46
195
+ },
186
196
  {
187
197
  id: "remove-script-tags",
188
198
  // SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <script> from
@@ -208,5 +218,5 @@ const f = [
208
218
  }
209
219
  ];
210
220
  export {
211
- f as defaultHtmlCompilerRules
221
+ y as defaultHtmlCompilerRules
212
222
  };
@@ -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
  };
@@ -0,0 +1,4 @@
1
+ var n = /* @__PURE__ */ ((d) => (d.Pending = "data-guido-dc-pending", d))(n || {});
2
+ export {
3
+ n as ModuleDynamicContentAttribute
4
+ };