@useinsider/guido 3.4.1-beta.c04b4e7 → 3.4.1-beta.e536d60

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.
@@ -2,126 +2,128 @@ import { useConfig as S } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as g } from "../../../composables/useRecommendation.js";
3
3
  import { CSS_CLASS_RECO_BUTTON as _ } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
4
  import { useRecommendationExtensionStore as q } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- function y(r, c, e, o, s = "") {
6
- const n = `{{${s}${r}_${c}_${e}}}`, t = `{{${s}${r}_${c}_currency}}`;
7
- return o === "before" ? `${t} ${n}` : `${n} ${t}`;
5
+ function y(r, i, e, o, s = "") {
6
+ const c = `{{${s}${r}_${i}_${e}}}`, t = `{{${s}${r}_${i}_currency}}`;
7
+ return o === "before" ? `${t} ${c}` : `${c} ${t}`;
8
8
  }
9
- function f(r, c, e, o, s, n) {
10
- switch (c) {
9
+ function f(r, i, e, o, s, c) {
10
+ switch (i) {
11
11
  case "productImage": {
12
12
  const t = r.querySelector("img");
13
- t && (t.setAttribute("src", `{{${n}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${e}_${o}_name}}`));
14
- const i = r.querySelector("a");
15
- i && (i.setAttribute("href", `{{${n}${e}_${o}_url}}`), i.classList.add(_));
13
+ t && (t.setAttribute("src", `{{${c}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${c}${e}_${o}_name}}`));
14
+ const n = r.querySelector("a");
15
+ n && (n.setAttribute("href", `{{${c}${e}_${o}_url}}`), n.classList.add(_));
16
16
  break;
17
17
  }
18
18
  case "productName": {
19
19
  const t = r.querySelector("p");
20
20
  if (t) {
21
- const i = t.querySelector("strong") || t;
22
- i.textContent = `{{${n}${e}_${o}_name}}`;
21
+ const n = t.querySelector("strong") || t;
22
+ n.textContent = `{{${c}${e}_${o}_name}}`;
23
23
  }
24
24
  break;
25
25
  }
26
26
  case "productPrice": {
27
27
  const t = r.querySelector("p");
28
28
  if (t) {
29
- const i = t.querySelector("strong") || t;
30
- i.textContent = y(e, o, "price", s, n);
29
+ const n = t.querySelector("strong") || t;
30
+ n.textContent = y(e, o, "price", s, c);
31
31
  }
32
32
  break;
33
33
  }
34
34
  case "productOldPrice": {
35
35
  const t = r.querySelector("p");
36
36
  if (t) {
37
- const i = t.querySelector("strong") || t;
38
- i.textContent = y(
37
+ let n = t;
38
+ for (; n.children.length === 1; )
39
+ [n] = n.children;
40
+ n.textContent = y(
39
41
  e,
40
42
  o,
41
43
  "original_price",
42
44
  s,
43
- n
45
+ c
44
46
  ), t.setAttribute("product-attr", "discount");
45
47
  }
46
48
  break;
47
49
  }
48
50
  case "productButton": {
49
51
  const t = r.querySelector("a");
50
- t && t.setAttribute("href", `{{${n}${e}_${o}_url}}`);
52
+ t && t.setAttribute("href", `{{${c}${e}_${o}_url}}`);
51
53
  break;
52
54
  }
53
55
  case "productOmnibusPrice": {
54
56
  const t = r.querySelector(".omnibus-price-value");
55
57
  if (t) {
56
- t.textContent = `{{${n}${e}_${o}_omnibus_price}}`;
57
- const i = t.closest("p");
58
- i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
58
+ t.textContent = `{{${c}${e}_${o}_omnibus_price}}`;
59
+ const n = t.closest("p");
60
+ n && (n.setAttribute("product-attr", "omnibus_price"), n.setAttribute("composition", "true"));
59
61
  }
60
62
  break;
61
63
  }
62
64
  case "productOmnibusDiscount": {
63
65
  const t = r.querySelector(".omnibus-discount-value");
64
66
  if (t) {
65
- t.textContent = `{{${n}${e}_${o}_omnibus_discount}}`;
66
- const i = t.closest("p");
67
- i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
67
+ t.textContent = `{{${c}${e}_${o}_omnibus_discount}}`;
68
+ const n = t.closest("p");
69
+ n && (n.setAttribute("product-attr", "omnibus_discount"), n.setAttribute("composition", "true"));
68
70
  }
69
71
  break;
70
72
  }
71
73
  default: {
72
74
  const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
73
75
  if (t) {
74
- const i = t.getAttribute("product-attr"), a = t.querySelector("p");
76
+ const n = t.getAttribute("product-attr"), a = t.querySelector("p");
75
77
  if (a) {
76
78
  const u = a.querySelector("strong") || a;
77
- u.textContent = `{{${n}${e}_${o}_${i}}}`;
79
+ u.textContent = `{{${c}${e}_${o}_${n}}}`;
78
80
  }
79
81
  }
80
82
  break;
81
83
  }
82
84
  }
83
85
  }
84
- function C(r, c, e, o) {
85
- r.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
86
- n.querySelectorAll("[data-attribute-type]").forEach((a) => {
86
+ function C(r, i, e, o) {
87
+ r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
88
+ c.querySelectorAll("[data-attribute-type]").forEach((a) => {
87
89
  const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
88
90
  p.length > 0 ? p.forEach((l) => {
89
- f(l, u, c, t, e, o);
90
- }) : f(a, u, c, t, e, o);
91
+ f(l, u, i, t, e, o);
92
+ }) : f(a, u, i, t, e, o);
91
93
  });
92
94
  });
93
95
  }
94
- function E(r, c, e, o) {
96
+ function w(r, i, e, o) {
95
97
  const s = r.querySelectorAll(".recommendation-product-row");
96
98
  if (!s.length)
97
99
  return;
98
- const [n] = s, t = n.querySelector("[data-attribute-type]"), i = t ? t.querySelectorAll(".attribute-cell").length : 1;
100
+ const [c] = s, t = c.querySelector("[data-attribute-type]"), n = t ? t.querySelectorAll(".attribute-cell").length : 1;
99
101
  s.forEach((a, u) => {
100
102
  a.querySelectorAll("[data-attribute-type]").forEach((l) => {
101
103
  const d = l.getAttribute("data-attribute-type") || "";
102
104
  l.querySelectorAll(".attribute-cell").forEach((A, h) => {
103
- const $ = u * i + h;
104
- f(A, d, c, $, e, o);
105
+ const $ = u * n + h;
106
+ f(A, d, i, $, e, o);
105
107
  });
106
108
  });
107
109
  });
108
110
  }
109
- function w(r, c, e, o) {
110
- r.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
111
- E(n, c, e, o);
111
+ function E(r, i, e, o) {
112
+ r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
113
+ w(c, i, e, o);
112
114
  });
113
115
  }
114
- function R(r, c, e) {
116
+ function R(r, i, e) {
115
117
  const o = r.getAttribute("data-layout") || "grid", s = r.getAttribute("currency-alignment") || "after";
116
- o === "list" ? C(r, c, s, e) : w(r, c, s, e);
118
+ o === "list" ? C(r, i, s, e) : E(r, i, s, e);
117
119
  }
118
- function b(r, c, e) {
119
- const o = new RegExp(`${c}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
120
+ function b(r, i, e) {
121
+ const o = new RegExp(`${i}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
120
122
  return s ? parseInt(s[1]) : e;
121
123
  }
122
- function P(r, c) {
124
+ function P(r, i) {
123
125
  let e = r.parentElement;
124
- for (; e && e !== c; ) {
126
+ for (; e && e !== i; ) {
125
127
  if (e.tagName === "TD") {
126
128
  const o = e.getAttribute("width");
127
129
  if (o && o.endsWith("%") && parseFloat(o) < 100)
@@ -132,41 +134,42 @@ function P(r, c) {
132
134
  return null;
133
135
  }
134
136
  function T(r) {
135
- const c = r.getAttribute("style") || "", e = b(c, "width", 600), o = b(c, "padding", 0) * 2, s = Math.max(0, e - o);
136
- s !== 0 && r.querySelectorAll("img.adapt-img").forEach((n) => {
137
- if (n.hasAttribute("width"))
137
+ const i = r.getAttribute("style") || "", e = b(i, "width", 600), o = b(i, "padding", 0) * 2, s = Math.max(0, e - o);
138
+ s !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
139
+ if (c.hasAttribute("width"))
138
140
  return;
139
- const t = P(n, r);
141
+ const t = P(c, r);
140
142
  if (!t)
141
143
  return;
142
- const i = t.getAttribute("width"), a = parseFloat(i), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
143
- n.setAttribute("width", String(l));
144
- const d = n.getAttribute("style") || "";
144
+ const n = t.getAttribute("width"), a = parseFloat(n), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
145
+ c.setAttribute("width", String(l));
146
+ const d = c.getAttribute("style") || "";
145
147
  if (!/\bwidth\s*:\s*\d/i.test(d)) {
146
148
  const m = d && !d.trim().endsWith(";") ? "; " : "";
147
- n.setAttribute("style", `${d}${m}width: ${l}px`);
149
+ c.setAttribute("style", `${d}${m}width: ${l}px`);
148
150
  }
149
151
  });
150
152
  }
151
- function v(r, c) {
153
+ function v(r, i) {
152
154
  const e = r.match(/<!DOCTYPE[^>]*>/i);
153
155
  return (e ? `${e[0]}
154
- ` : "") + c.documentElement.outerHTML;
156
+ ` : "") + i.documentElement.outerHTML;
155
157
  }
156
158
  function N(r) {
157
- const c = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(c, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
159
+ const i = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(i, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
158
160
  if (!o.length)
159
161
  return r;
160
- const { buildCampaignUrl: s } = g(), n = q();
161
- n.recommendationCampaignUrls = {};
162
- const { isFeatureEnabled: t } = S(), i = t("liquidSyntax") ? "reco_" : "";
162
+ const { buildCampaignUrl: s } = g(), c = q();
163
+ c.recommendationCampaignUrls = {};
164
+ const { isFeatureEnabled: t } = S(), n = t("liquidSyntax") ? "reco_" : "";
163
165
  return o.forEach((u) => {
164
166
  var l, d;
165
167
  const p = u.getAttribute("recommendation-id");
166
- p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, i), T(u));
167
- }), v(c, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
168
+ p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, n), T(u));
169
+ }), v(i, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
168
170
  }
169
171
  export {
170
172
  y as formatPriceVariable,
171
- N as prepareRecommendationBlocks
173
+ N as prepareRecommendationBlocks,
174
+ f as replaceAttributeContent
172
175
  };
@@ -1,34 +1,31 @@
1
1
  var d = Object.defineProperty;
2
- var _ = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var c = (n, i, e) => _(n, typeof i != "symbol" ? i + "" : i, e);
4
- import { useToaster as L } from "../../../composables/useToaster.js";
5
- import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
6
- import { PAGE_TYPES as b } from "../../../enums/unsubscribe.js";
7
- import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
8
- import { Block as g, BlockCompositionType as v, BlockType as k, ModificationDescription as E } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
- import { getDefaultTemplate as f } from "./template.js";
10
- import { UNSUBSCRIBE_EVENTS as u, DATA_ATTRIBUTES as o } from "./utils/constants.js";
11
- import { parsePageList as h } from "./utils/utils.js";
12
- const T = "unsubscribe-block", p = 'a[data-unsubscribe-link="true"]', B = ".unsubscribe-block-v2", U = "{{ins-unsubscribe-link}}", C = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", A = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", N = {
13
- [b.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
- [b.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
2
+ var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
+ var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
4
+ import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
5
+ import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
6
+ import { Block as _, BlockCompositionType as S, BlockType as L, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ import { getDefaultTemplate as v } from "./template.js";
8
+ import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
9
+ import { parsePageList as p } from "./utils/utils.js";
10
+ const g = "unsubscribe-block", T = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", B = "{{ins-unsubscribe-link}}", C = {
11
+ [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
12
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
13
  };
16
- class x extends g {
14
+ class I extends _ {
17
15
  constructor() {
18
16
  super();
19
- c(this, "selectEventListener", null);
20
- c(this, "cancelEventListener", null);
21
- c(this, "currentNode");
22
- c(this, "hadUnsubscribeLink", !1);
17
+ u(this, "selectEventListener", null);
18
+ u(this, "cancelEventListener", null);
19
+ u(this, "currentNode");
23
20
  }
24
21
  getId() {
25
- return T;
22
+ return g;
26
23
  }
27
24
  getIcon() {
28
25
  return "unsubscribe-icon";
29
26
  }
30
27
  getBlockCompositionType() {
31
- return v.BLOCK;
28
+ return S.BLOCK;
32
29
  }
33
30
  getName() {
34
31
  return this.api.translate("Unsubscribe Block");
@@ -37,63 +34,39 @@ class x extends g {
37
34
  return this.api.translate("Unsubscribe Block Description");
38
35
  }
39
36
  getTemplate() {
40
- return f();
37
+ return v();
41
38
  }
42
39
  onSelect(e) {
43
- this.currentNode = e, this.hadUnsubscribeLink = this._hasUnsubscribeLink(e), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
44
- }
45
- onDocumentChanged(e) {
46
- const t = this._hasUnsubscribeLink(e);
47
- this.hadUnsubscribeLink && !t && this._warnLinkRemoved(), this.hadUnsubscribeLink = t;
40
+ this.currentNode = e, !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
48
41
  }
49
42
  onDelete(e) {
50
- this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState(), this.hadUnsubscribeLink = !1;
43
+ this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
51
44
  }
52
45
  onDestroy() {
53
- this._removeEventListeners(), this.currentNode = void 0, this.hadUnsubscribeLink = !1;
54
- }
55
- _hasUnsubscribeLink(e) {
56
- return "querySelector" in e ? !!e.querySelector(p) : !1;
57
- }
58
- _warnLinkRemoved() {
59
- try {
60
- const { showToaster: e } = L();
61
- e({
62
- type: S.Warning,
63
- message: this.api.translate(A),
64
- actionButton: {
65
- text: this.api.translate("Visit Academy"),
66
- onClick: () => {
67
- window.open(C, "_blank", "noopener,noreferrer");
68
- }
69
- }
70
- });
71
- } catch (e) {
72
- console.error("[UnsubscribeBlock] Failed to show warning toaster:", e);
73
- }
46
+ this._removeEventListeners(), this.currentNode = void 0;
74
47
  }
75
48
  _setupSelectEventListener() {
76
49
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
77
- const t = e, { collectionType: r, selectedPages: s } = t.detail;
78
- this._updateBlock(r, s.join(","));
79
- }, document.addEventListener(u.SELECT, this.selectEventListener);
50
+ const r = e, { collectionType: s, selectedPages: t } = r.detail;
51
+ this._updateBlock(s, t.join(","));
52
+ }, document.addEventListener(a.SELECT, this.selectEventListener);
80
53
  }
81
54
  _removeSelectEventListener() {
82
- this.selectEventListener && (document.removeEventListener(u.SELECT, this.selectEventListener), this.selectEventListener = null);
55
+ this.selectEventListener && (document.removeEventListener(a.SELECT, this.selectEventListener), this.selectEventListener = null);
83
56
  }
84
57
  _setupCancelEventListener() {
85
58
  this._removeCancelEventListener(), this.cancelEventListener = () => {
86
59
  this._handleCancel();
87
- }, document.addEventListener(u.CANCEL, this.cancelEventListener);
60
+ }, document.addEventListener(a.CANCEL, this.cancelEventListener);
88
61
  }
89
62
  _removeCancelEventListener() {
90
- this.cancelEventListener && (document.removeEventListener(u.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
63
+ this.cancelEventListener && (document.removeEventListener(a.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
91
64
  }
92
65
  _handleCancel() {
93
66
  try {
94
67
  if (!this.currentNode)
95
68
  return;
96
- this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${k.EMPTY_CONTAINER}/>`).apply(new E("Removed unsubscribe block due to cancel"));
69
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${L.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
97
70
  } catch (e) {
98
71
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
99
72
  }
@@ -101,35 +74,35 @@ class x extends g {
101
74
  _removeEventListeners() {
102
75
  this._removeSelectEventListener(), this._removeCancelEventListener();
103
76
  }
104
- _updateBlock(e, t) {
77
+ _updateBlock(e, r) {
105
78
  if (!this.currentNode || !("querySelector" in this.currentNode))
106
79
  return;
107
- const r = this.currentNode.querySelector(p);
108
- if (!r)
80
+ const s = this.currentNode.querySelector(T);
81
+ if (!s)
109
82
  return;
110
- const s = this._getMergeTag(e);
111
- this.api.getDocumentModifier().modifyHtml(r).setAttribute("href", s).apply(new E(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, t).apply(new E("Updated unsubscribe block metadata"));
83
+ const t = this._getMergeTag(e);
84
+ this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
112
85
  }
113
86
  _getMergeTag(e) {
114
- return N[e] ?? U;
87
+ return C[e] ?? B;
115
88
  }
116
89
  _openDrawer() {
117
90
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
118
91
  try {
119
- const e = a();
92
+ const e = c();
120
93
  e.typeSelectionDrawerStatus = !0;
121
94
  } catch (e) {
122
95
  console.error("[UnsubscribeBlock] Failed to open drawer:", e);
123
96
  }
124
97
  }
125
98
  _checkExistingBlocks() {
126
- const e = a();
127
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(B).forEach((r) => {
128
- if ("getAttribute" in r) {
129
- const s = r.getAttribute(o.PAGE_TYPE);
130
- if (s) {
131
- const l = Number(s);
132
- l === b.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === b.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
99
+ const e = c();
100
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((s) => {
101
+ if ("getAttribute" in s) {
102
+ const t = s.getAttribute(o.PAGE_TYPE);
103
+ if (t) {
104
+ const l = Number(t);
105
+ l === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
133
106
  }
134
107
  }
135
108
  });
@@ -137,26 +110,26 @@ class x extends g {
137
110
  async _loadBlockState(e) {
138
111
  if (!("getAttribute" in e))
139
112
  return;
140
- const t = e.getAttribute(o.PAGE_TYPE), r = e.getAttribute(o.PAGE_LIST);
141
- if (!t || !r)
113
+ const r = e.getAttribute(o.PAGE_TYPE), s = e.getAttribute(o.PAGE_LIST);
114
+ if (!r || !s)
142
115
  return;
143
- const s = a(), l = Number(t), m = h(r);
144
- await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(l), s.loadSelectedTemplates(m);
116
+ const t = c(), l = Number(r), m = p(s);
117
+ await t.fetchTemplates(), t.setCollectionWithoutAutoSelection(l), t.loadSelectedTemplates(m);
145
118
  }
146
119
  _resetStoreState() {
147
- a().$reset();
120
+ c().$reset();
148
121
  }
149
122
  _removeBlockTemplatesFromStore(e) {
150
123
  if (!("getAttribute" in e))
151
124
  return;
152
- const t = e.getAttribute(o.PAGE_LIST);
153
- if (!t)
125
+ const r = e.getAttribute(o.PAGE_LIST);
126
+ if (!r)
154
127
  return;
155
- const r = a(), s = h(t);
156
- r.removeUnsubscribePages(s);
128
+ const s = c(), t = p(r);
129
+ s.removeUnsubscribePages(t);
157
130
  }
158
131
  }
159
132
  export {
160
- T as UNSUBSCRIBE_BLOCK_ID,
161
- x as UnsubscribeBlock
133
+ g as UNSUBSCRIBE_BLOCK_ID,
134
+ I as UnsubscribeBlock
162
135
  };
@@ -1,22 +1,22 @@
1
- import { BlockType as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const e = "unsubscribe", n = "{{ins-unsubscribe-link}}", t = `
3
- <${s.BLOCK_TEXT}
1
+ import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const s = "unsubscribe", n = "{{ins-unsubscribe-link}}", t = `
3
+ <${e.BLOCK_TEXT}
4
4
  class="unsubscribe-block-v2 esd-block-unsubscribe es-p0"
5
5
  align="center"
6
6
  data-unsubscribe-page-type=""
7
7
  data-unsubscribe-page-list=""
8
8
  >
9
- <p>&nbsp;<strong><a
9
+ <p>You can <strong><a
10
10
  href="${n}"
11
11
  class="unsubscribe-link"
12
12
  target="_blank"
13
13
  data-unsubscribe-link="true"
14
- >${e}</a></strong></p>
15
- </${s.BLOCK_TEXT}>
14
+ >${s}</a></strong> from our emails, if you need to.</p>
15
+ </${e.BLOCK_TEXT}>
16
16
  `;
17
- function u() {
17
+ function r() {
18
18
  return t;
19
19
  }
20
20
  export {
21
- u as getDefaultTemplate
21
+ r as getDefaultTemplate
22
22
  };
@@ -7,6 +7,12 @@
7
7
  * @returns Formatted price string with currency variable in correct position
8
8
  */
9
9
  export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string, prefix?: string): string;
10
+ /**
11
+ * Replaces a single attribute cell's content with the appropriate template variable.
12
+ * Stripo's compiled HTML uses `data-attribute-type` on `<tr>` elements, with
13
+ * individual `.attribute-cell` `<td>` elements for each product in the row.
14
+ */
15
+ export declare function replaceAttributeContent(cell: Element, attributeType: string, campaignId: string, productIndex: number, currencyAlignment: string, prefix: string): void;
10
16
  /**
11
17
  * Transforms recommendation block HTML by replacing product data with
12
18
  * template variables.
@@ -1,11 +1,10 @@
1
- import type { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
1
+ import type { ImmutableHtmlElementNode } from '@stripoinc/ui-editor-extensions';
2
2
  import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
3
3
  export declare const UNSUBSCRIBE_BLOCK_ID = "unsubscribe-block";
4
4
  export declare class UnsubscribeBlock extends Block {
5
5
  private selectEventListener;
6
6
  private cancelEventListener;
7
7
  private currentNode?;
8
- private hadUnsubscribeLink;
9
8
  constructor();
10
9
  getId(): string;
11
10
  getIcon(): string;
@@ -14,11 +13,8 @@ export declare class UnsubscribeBlock extends Block {
14
13
  getDescription(): string;
15
14
  getTemplate(): string;
16
15
  onSelect(node: ImmutableHtmlElementNode): void;
17
- onDocumentChanged(node: ImmutableHtmlNode): void;
18
16
  onDelete(node: ImmutableHtmlElementNode): void;
19
17
  onDestroy(): void;
20
- private _hasUnsubscribeLink;
21
- private _warnLinkRemoved;
22
18
  private _setupSelectEventListener;
23
19
  private _removeSelectEventListener;
24
20
  private _setupCancelEventListener;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.4.1-beta.c04b4e7",
3
+ "version": "3.4.1-beta.e536d60",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",