@useinsider/guido 3.10.0-beta.f8b4dbb → 3.10.1-beta.e36dd40

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.
@@ -1,30 +1,30 @@
1
- import { useConfig as _ } from "../../../composables/useConfig.js";
2
- import { useRecommendation as q } from "../../../composables/useRecommendation.js";
3
- import { CSS_CLASS_RECO_BUTTON as C } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useRecommendationExtensionStore as E } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
6
- function P(t, r, e, n, s = "") {
7
- const c = `{{${s}${t}_${r}_${e}}}`, o = `{{${s}${t}_${r}_currency}}`;
8
- return n === "before" ? `${o} ${c}` : `${c} ${o}`;
9
- }
10
- function m(t) {
1
+ import { useConfig as C } from "../../../composables/useConfig.js";
2
+ import { useRecommendation as E } from "../../../composables/useRecommendation.js";
3
+ import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useRecommendationExtensionStore as w } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
6
+ function R(t, r, e, o, s = "") {
7
+ const i = `{{${s}${t}_${r}_${e}}}`, n = `{{${s}${t}_${r}_currency}}`;
8
+ return o === "before" ? `${n} ${i}` : `${i} ${n}`;
9
+ }
10
+ function y(t) {
11
11
  let r = t;
12
12
  for (; r.children.length === 1; )
13
13
  [r] = r.children;
14
14
  return r;
15
15
  }
16
- function b(t, r, e, n, s, c) {
16
+ function A(t, r, e, o, s, i) {
17
17
  switch (r) {
18
18
  case "productImage": {
19
- const o = t.querySelector("img");
20
- o && (o.setAttribute("src", `{{${c}${e}_${n}_image_url}}`), o.setAttribute("alt", `{{${c}${e}_${n}_name}}`));
21
- const i = t.querySelector("a");
22
- i && (i.setAttribute("href", `{{${c}${e}_${n}_url}}`), i.classList.add(C));
19
+ const n = t.querySelector("img");
20
+ n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
21
+ const c = t.querySelector("a");
22
+ c && (c.setAttribute("href", `{{${i}${e}_${o}_url}}`), c.classList.add(q));
23
23
  break;
24
24
  }
25
25
  case "productName": {
26
- const o = t.querySelector("p");
27
- o && (m(o).textContent = `{{${c}${e}_${n}_name}}`);
26
+ const n = t.querySelector("p");
27
+ n && (y(n).textContent = `{{${i}${e}_${o}_name}}`);
28
28
  break;
29
29
  }
30
30
  // Inline mode ("Move to next line" OFF) merges BOTH prices into one row
@@ -32,145 +32,176 @@ function b(t, r, e, n, s, c) {
32
32
  // substitute by cell content, not by the row's anchor (SD-145161).
33
33
  case "productPrice":
34
34
  case "productOldPrice": {
35
- const o = (d, l) => {
36
- d && (m(d).textContent = P(
35
+ const n = (l, d) => {
36
+ l && (y(l).textContent = R(
37
37
  e,
38
- n,
39
- l,
38
+ o,
39
+ d,
40
40
  s,
41
- c
41
+ i
42
42
  ));
43
- }, i = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !i && !a ? t.querySelector("p") : null;
44
- o(i ?? (r === "productPrice" ? u : null), "price"), o(a ?? (r === "productOldPrice" ? u : null), "original_price");
43
+ }, c = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !c && !a ? t.querySelector("p") : null;
44
+ n(c ?? (r === "productPrice" ? u : null), "price"), n(a ?? (r === "productOldPrice" ? u : null), "original_price");
45
45
  break;
46
46
  }
47
47
  case "productButton": {
48
- const o = t.querySelector("a");
49
- o && o.setAttribute("href", `{{${c}${e}_${n}_url}}`);
48
+ const n = t.querySelector("a");
49
+ n && n.setAttribute("href", `{{${i}${e}_${o}_url}}`);
50
50
  break;
51
51
  }
52
52
  case "productOmnibusPrice": {
53
- const o = t.querySelector(".omnibus-price-value");
54
- if (o) {
55
- o.textContent = `{{${c}${e}_${n}_omnibus_price}}`;
56
- const i = o.closest("p");
57
- i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
53
+ const n = t.querySelector(".omnibus-price-value");
54
+ if (n) {
55
+ n.textContent = `{{${i}${e}_${o}_omnibus_price}}`;
56
+ const c = n.closest("p");
57
+ c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
58
58
  }
59
59
  break;
60
60
  }
61
61
  case "productOmnibusDiscount": {
62
- const o = t.querySelector(".omnibus-discount-value");
63
- if (o) {
64
- o.textContent = `{{${c}${e}_${n}_omnibus_discount}}`;
65
- const i = o.closest("p");
66
- i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
62
+ const n = t.querySelector(".omnibus-discount-value");
63
+ if (n) {
64
+ n.textContent = `{{${i}${e}_${o}_omnibus_discount}}`;
65
+ const c = n.closest("p");
66
+ c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
67
67
  }
68
68
  break;
69
69
  }
70
70
  default: {
71
- const o = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
72
- if (o) {
73
- const i = o.getAttribute("product-attr"), a = o.querySelector("p");
74
- a && (m(a).textContent = `{{${c}${e}_${n}_${i}}}`);
71
+ const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
72
+ if (n) {
73
+ const c = n.getAttribute("product-attr"), a = n.querySelector("p");
74
+ a && (y(a).textContent = `{{${i}${e}_${o}_${c}}}`);
75
75
  }
76
76
  break;
77
77
  }
78
78
  }
79
79
  }
80
- function R(t, r, e, n) {
81
- t.querySelectorAll(".recommendation-product-row").forEach((c, o) => {
82
- c.querySelectorAll("[data-attribute-type]").forEach((a) => {
83
- const u = a.getAttribute("data-attribute-type") || "", d = a.querySelectorAll(".attribute-cell");
84
- d.length > 0 ? d.forEach((l) => {
85
- b(l, u, r, o, e, n);
86
- }) : b(a, u, r, o, e, n);
87
- });
80
+ const B = "name";
81
+ function S(t, r, e, o) {
82
+ const s = `${o}${r}_${e}_${B}`;
83
+ return {
84
+ open: t.createComment(`{% if ${s} and ${s} != "" %}`),
85
+ close: t.createComment("{% endif %}")
86
+ };
87
+ }
88
+ function L(t, r, e) {
89
+ return S(t, r, 0, e);
90
+ }
91
+ function N(t, r, e, o) {
92
+ if (!t.innerHTML.includes("{{"))
93
+ return;
94
+ const { open: s, close: i } = S(t.ownerDocument, r, e, o);
95
+ t.insertBefore(s, t.firstChild), t.appendChild(i);
96
+ }
97
+ function T(t, r, e, o) {
98
+ var n, c;
99
+ if (!t.innerHTML.includes("{{"))
100
+ return;
101
+ const { open: s, close: i } = S(t.ownerDocument, r, e, o);
102
+ (n = t.parentNode) == null || n.insertBefore(s, t), (c = t.parentNode) == null || c.insertBefore(i, t.nextSibling);
103
+ }
104
+ function v(t, r, e, o) {
105
+ t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
106
+ i.querySelectorAll("[data-attribute-type]").forEach((a) => {
107
+ const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
108
+ l.length > 0 ? l.forEach((d) => {
109
+ A(d, u, r, n, e, o);
110
+ }) : A(a, u, r, n, e, o);
111
+ }), T(i, r, n, o);
88
112
  });
89
113
  }
90
- function W(t, r, e, n) {
114
+ function O(t, r, e, o) {
91
115
  const s = t.querySelectorAll(".recommendation-product-row");
92
116
  if (!s.length)
93
117
  return;
94
- const [c] = s, o = c.querySelector("[data-attribute-type]"), i = o ? o.querySelectorAll(".attribute-cell").length : 1;
118
+ const [i] = s, n = i.querySelector("[data-attribute-type]"), c = n ? n.querySelectorAll(".attribute-cell").length : 1;
95
119
  s.forEach((a, u) => {
96
- a.querySelectorAll("[data-attribute-type]").forEach((l) => {
97
- const p = l.getAttribute("data-attribute-type") || "";
98
- l.querySelectorAll(".attribute-cell").forEach(($, S) => {
99
- const g = u * i + S;
100
- b($, p, r, g, e, n);
120
+ a.querySelectorAll("[data-attribute-type]").forEach((d) => {
121
+ const p = d.getAttribute("data-attribute-type") || "";
122
+ d.querySelectorAll(".attribute-cell").forEach((m, f) => {
123
+ const h = u * c + f;
124
+ A(m, p, r, h, e, o), N(m, r, h, o);
101
125
  });
102
126
  });
103
127
  });
104
128
  }
105
- function v(t, r, e, n) {
106
- t.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
107
- W(c, r, e, n);
129
+ function W(t, r, e, o) {
130
+ t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
131
+ O(i, r, e, o);
108
132
  });
109
133
  }
110
- function O(t, r, e) {
111
- const n = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
112
- n === "list" ? R(t, r, s, e) : v(t, r, s, e);
134
+ function D(t, r, e) {
135
+ const o = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
136
+ o === "list" ? v(t, r, s, e) : W(t, r, s, e);
113
137
  }
114
- function f(t, r, e) {
115
- const n = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(n);
138
+ function $(t, r, e) {
139
+ const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(o);
116
140
  return s ? parseInt(s[1]) : e;
117
141
  }
118
- function y(t) {
142
+ function _(t) {
119
143
  const r = t.trim();
120
144
  return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
121
145
  }
122
- function A(t) {
146
+ function g(t) {
123
147
  const r = t.getAttribute("width");
124
- if (r && y(r))
148
+ if (r && _(r))
125
149
  return r.trim();
126
150
  const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
127
- return e && y(e[1]) ? e[1] : null;
151
+ return e && _(e[1]) ? e[1] : null;
128
152
  }
129
153
  function M(t, r) {
130
154
  let e = t.parentElement;
131
155
  for (; e && e !== r; ) {
132
- if (e.tagName === "TD" && A(e))
156
+ if (e.tagName === "TD" && g(e))
133
157
  return e;
134
158
  e = e.parentElement;
135
159
  }
136
160
  return null;
137
161
  }
138
- function T(t) {
139
- const r = t.getAttribute("style") || "", e = f(r, "width", 600), n = f(r, "padding", 0) * 2, s = Math.max(0, e - n);
140
- s !== 0 && t.querySelectorAll("img.adapt-img").forEach((c) => {
141
- if (c.hasAttribute("width"))
162
+ function G(t) {
163
+ const r = t.getAttribute("style") || "", e = $(r, "width", 600), o = $(r, "padding", 0) * 2, s = Math.max(0, e - o);
164
+ s !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
165
+ if (i.hasAttribute("width"))
142
166
  return;
143
- const o = M(c, t);
144
- if (!o)
167
+ const n = M(i, t);
168
+ if (!n)
145
169
  return;
146
- const i = A(o), a = f(o.getAttribute("style") || "", "padding", 0) * 2, u = i.endsWith("%") ? Math.floor(s * parseFloat(i) / 100) : parseInt(i), d = Math.max(1, u - a);
147
- c.setAttribute("width", String(d));
148
- const l = c.getAttribute("style") || "";
149
- if (!/\bwidth\s*:\s*\d/i.test(l)) {
150
- const p = l && !l.trim().endsWith(";") ? "; " : "";
151
- c.setAttribute("style", `${l}${p}width: ${d}px`);
170
+ const c = g(n), a = $(n.getAttribute("style") || "", "padding", 0) * 2, u = c.endsWith("%") ? Math.floor(s * parseFloat(c) / 100) : parseInt(c), l = Math.max(1, u - a);
171
+ i.setAttribute("width", String(l));
172
+ const d = i.getAttribute("style") || "";
173
+ if (!/\bwidth\s*:\s*\d/i.test(d)) {
174
+ const p = d && !d.trim().endsWith(";") ? "; " : "";
175
+ i.setAttribute("style", `${d}${p}width: ${l}px`);
152
176
  }
153
177
  });
154
178
  }
155
- function B(t, r) {
179
+ function H(t, r) {
156
180
  const e = t.match(/<!DOCTYPE[^>]*>/i);
157
181
  return (e ? `${e[0]}
158
182
  ` : "") + r.documentElement.outerHTML;
159
183
  }
160
- function G(t) {
161
- const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), n = e.querySelectorAll(".recommendation-block-v2");
162
- if (!n.length)
184
+ function Y(t) {
185
+ const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
186
+ if (!o.length)
163
187
  return t;
164
- const { buildCampaignUrl: s } = q(), c = E();
165
- c.recommendationCampaignUrls = {};
166
- const { isFeatureEnabled: o } = _(), i = o("liquidSyntax") ? "reco_" : "";
167
- return n.forEach((u) => {
168
- var l, p;
169
- const d = u.getAttribute("recommendation-id");
170
- d && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), s(d), w(u) || O(u, d, i), T(u));
171
- }), B(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
188
+ const { buildCampaignUrl: s } = E(), i = w();
189
+ i.recommendationCampaignUrls = {};
190
+ const { isFeatureEnabled: n } = C(), c = n("liquidSyntax") ? "reco_" : "";
191
+ return o.forEach((u) => {
192
+ var d, p, b, m;
193
+ const l = u.getAttribute("recommendation-id");
194
+ if (l) {
195
+ if ((d = u.parentNode) == null || d.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((f) => f.remove()), s(l), !P(u)) {
196
+ D(u, l, c);
197
+ const { open: f, close: h } = L(e, l, c);
198
+ (b = u.parentNode) == null || b.insertBefore(f, u), (m = u.parentNode) == null || m.insertBefore(h, u.nextSibling);
199
+ }
200
+ G(u);
201
+ }
202
+ }), H(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
172
203
  }
173
204
  export {
174
- P as formatPriceVariable,
175
- G as prepareRecommendationBlocks
205
+ R as formatPriceVariable,
206
+ Y as prepareRecommendationBlocks
176
207
  };
@@ -4,10 +4,7 @@ const e = "Items", o = {
4
4
  "Recommendation Block": "Recommendation",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
- "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
- "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
- "OPT-IN SELECTION": "OPT-IN SELECTION",
10
- "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
7
+ "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
11
8
  };
12
9
  export {
13
10
  e as Items,
@@ -1,38 +1,35 @@
1
1
  import { useTranslations as R } from "../composables/useTranslations.js";
2
- import { ProductType as s } from "../@types/config/schemas.js";
2
+ import { ProductType as n } from "../@types/config/schemas.js";
3
3
  import "../@types/config/defaults.js";
4
- import { getEnvironmentPrefix as _ } from "../utils/environmentUtil.js";
5
- const B = {
4
+ import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
5
+ const i = {
6
6
  UNSUBSCRIBE_LINK_TYPE: 1,
7
7
  PREFERENCES_LINK_TYPE: 3
8
- }, C = {
8
+ }, B = {
9
9
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
10
10
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
11
11
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
12
12
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
13
- }, e = _(), U = {
14
- UNSUBSCRIBE_URL: `https://mail.${e}.com/user/v1/unsub`,
15
- PREFERENCES_URL: `https://mail.${e}.com/user/v1/prefs`
16
- }, o = {
17
- [s.EMAIL]: "email",
18
- [s.ARCHITECT]: "journey",
19
- [s.UNSUBSCRIBE_PAGES]: "email"
20
- }, c = "iid", S = "G", N = "P", u = [
21
- S,
22
- N
23
- ], T = () => ({
13
+ }, s = S(), C = {
14
+ UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
15
+ PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
16
+ }, U = {
17
+ [n.EMAIL]: "email",
18
+ [n.ARCHITECT]: "journey",
19
+ [n.UNSUBSCRIBE_PAGES]: "email"
20
+ }, o = "iid", r = "G", c = () => ({
24
21
  name: R()("onboarding-center.email-subscribers-global-unsub-card-title"),
25
- sendGridId: S
26
- }), b = "/email/unsubscribe-pages", E = {
22
+ sendGridId: r
23
+ }), u = "/email/unsubscribe-pages", E = {
27
24
  GLOBAL_UNSUBSCRIBE: 1,
28
25
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
29
26
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
30
27
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
31
28
  RESUBSCRIBE: 5
32
- }, P = {
29
+ }, b = {
33
30
  [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
34
31
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
35
- }, L = {
32
+ }, T = {
36
33
  [E.GLOBAL_UNSUBSCRIBE]: [
37
34
  E.GLOBAL_UNSUBSCRIBE,
38
35
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -42,34 +39,32 @@ const B = {
42
39
  E.SUBSCRIPTION_PREFERENCE_CENTER,
43
40
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
44
41
  ]
45
- }, O = () => {
46
- const n = R();
42
+ }, P = () => {
43
+ const e = R();
47
44
  return {
48
- [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
49
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
50
- [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
51
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
52
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
45
+ [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
46
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
47
+ [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
48
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
49
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
53
50
  };
54
- }, p = {
51
+ }, O = {
55
52
  default: "{{ins-unsubscribe-link}}",
56
53
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
57
54
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
58
55
  };
59
56
  export {
60
- S as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
61
- c as INSIDER_ID,
62
- C as LINK_REGEXES,
63
- B as LINK_TYPES,
64
- p as MERGE_TAGS,
57
+ r as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
58
+ o as INSIDER_ID,
59
+ B as LINK_REGEXES,
60
+ i as LINK_TYPES,
61
+ O as MERGE_TAGS,
65
62
  E as PAGE_TYPES,
66
- N as PIXEL_TRACKING_SEND_GRID_ID,
67
- o as PRODUCT_TYPE_URL_SEGMENTS,
68
- L as TYPE_COLLECTIONS,
69
- b as UNSUBSCRIBE_PAGES_LINK,
70
- u as UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS,
71
- P as UNSUBSCRIBE_SYNC_MODULE_TYPES,
72
- U as URLS,
73
- T as getDefaultUnsubscribeGroup,
74
- O as getTypeTranslations
63
+ U as PRODUCT_TYPE_URL_SEGMENTS,
64
+ T as TYPE_COLLECTIONS,
65
+ u as UNSUBSCRIBE_PAGES_LINK,
66
+ b as UNSUBSCRIBE_SYNC_MODULE_TYPES,
67
+ C as URLS,
68
+ c as getDefaultUnsubscribeGroup,
69
+ P as getTypeTranslations
75
70
  };
@@ -1,7 +1,7 @@
1
1
  import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "checkbox-block";
4
- class l extends e {
4
+ class s extends e {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -18,9 +18,7 @@ class l extends e {
18
18
  return this.api.translate("Checkbox Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate(
22
- "Checkbox lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
- );
21
+ return this.api.translate("Checkbox Block Description");
24
22
  }
25
23
  getTemplate() {
26
24
  return o();
@@ -31,5 +29,5 @@ class l extends e {
31
29
  }
32
30
  export {
33
31
  r as CHECKBOX_BLOCK_ID,
34
- l as CheckboxBlock
32
+ s as CheckboxBlock
35
33
  };
@@ -1,16 +1,16 @@
1
- var p = Object.defineProperty;
2
- var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as h } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as T, PIXEL_TRACKING_SEND_GRID_ID as C, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as I } from "../../../enums/unsubscribe.js";
6
- import { Control as m, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-checkbox", E = "select", { get: _ } = h();
8
- class G extends m {
1
+ var E = Object.defineProperty;
2
+ var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
6
+ import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-checkbox", u = "select", { get: C } = l();
8
+ class I extends p {
9
9
  constructor() {
10
10
  super(...arguments);
11
- a(this, "currentNode");
12
- a(this, "selectedUnsubGroup");
13
- a(this, "unsubList", []);
11
+ o(this, "currentNode");
12
+ o(this, "selectedUnsubGroup");
13
+ o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
@@ -19,12 +19,12 @@ class G extends m {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = I.includes(e) ? e : Number(e);
22
+ const s = e === h ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [E]: this.selectedUnsubGroup
27
+ [u]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
30
  _getLabel(e, s = `${Math.random()}`) {
@@ -46,19 +46,17 @@ class G extends m {
46
46
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
- const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
50
49
  return `
51
50
  <div class="checkbox-controls-container">
52
- <div class="checkbox-select-container container one-column stretch">
51
+ <div class="checkbox-select-container container two-columns stretch">
53
52
  <${r.LABEL}
54
- ${t.LABEL.text}="${e}"
53
+ ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
55
54
  ${t.LABEL.name}="${Math.random()}">
56
55
  </${r.LABEL}>
57
56
 
58
57
  <${r.SELECTPICKER}
59
- ${t.SELECTPICKER.name}="${E}"
60
- ${t.SELECTPICKER.searchable}="true"
61
- ${t.SELECTPICKER.placeholder}="${s}">
58
+ ${t.SELECTPICKER.name}="${u}"
59
+ ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
62
60
  ${this._getSelect()}
63
61
  </${r.SELECTPICKER}>
64
62
  </div>
@@ -66,42 +64,30 @@ class G extends m {
66
64
  `;
67
65
  }
68
66
  _onSelectChange(e) {
69
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new m(`Updated text to ${e}`));
70
68
  }
71
69
  _listenToFormUpdates() {
72
- this.api.onValueChanged(E, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (e) => this._onSelectChange(e));
73
71
  }
74
72
  onTemplateNodeUpdated(e) {
75
73
  this.currentNode = e, this._setFormValues();
76
74
  }
77
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
78
76
  async onRender() {
79
- const e = await _(
77
+ const e = await C(
80
78
  "/unsubscribe-groups/unsubscribe-list"
81
- ), s = {
82
- name: this.api.translate("Pixel Tracking Opt-in"),
83
- sendGridId: C
84
- }, c = [T(), ...e.data], u = (o) => ({
85
- [t.SELECT_ITEM.text]: o.name,
86
- [t.SELECT_ITEM.value]: o.sendGridId
87
- }), l = (o) => ({
88
- [t.SELECT_ITEM.text]: o,
89
- [t.SELECT_ITEM.value]: `header:${o}`,
90
- [t.SELECT_ITEM.disabled]: !0
91
- }), d = [
92
- l(this.api.translate("OPT-IN SELECTION")),
93
- u(s),
94
- l(this.api.translate("UNSUBSCRIBE GROUPS")),
95
- ...c.map(u)
96
- ];
97
- this.unsubList = [s, ...c], this.api.setUIEAttribute(
98
- E,
79
+ ), s = [L(), ...e.data], c = s.map((a) => ({
80
+ [t.SELECT_ITEM.text]: a.name,
81
+ [t.SELECT_ITEM.value]: a.sendGridId
82
+ }));
83
+ this.unsubList = s, this.api.setUIEAttribute(
84
+ u,
99
85
  t.SELECTPICKER.items,
100
- d
86
+ c
101
87
  ), this._setFormValues(), this._listenToFormUpdates();
102
88
  }
103
89
  }
104
90
  export {
105
91
  b as CHECKBOX_CONTROL_BLOCK_ID,
106
- G as CheckboxControl
92
+ I as CheckboxControl
107
93
  };
@@ -1,7 +1,7 @@
1
- import { Block as t, BlockCompositionType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { getDefaultTemplate as o } from "./template.js";
1
+ import { Block as t, BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { getDefaultTemplate as e } from "./template.js";
3
3
  const r = "radio-button-block";
4
- class i extends t {
4
+ class l extends t {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -12,18 +12,16 @@ class i extends t {
12
12
  return "radio-button-icon";
13
13
  }
14
14
  getBlockCompositionType() {
15
- return e.CONTAINER;
15
+ return o.CONTAINER;
16
16
  }
17
17
  getName() {
18
18
  return this.api.translate("Radio Button Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate(
22
- "Radio button lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
- );
21
+ return this.api.translate("Radio Button Block Description");
24
22
  }
25
23
  getTemplate() {
26
- return o();
24
+ return e();
27
25
  }
28
26
  allowInnerBlocksDND() {
29
27
  return !1;
@@ -31,5 +29,5 @@ class i extends t {
31
29
  }
32
30
  export {
33
31
  r as BLOCK_ID,
34
- i as RadioButtonCustomBlock
32
+ l as RadioButtonCustomBlock
35
33
  };
@@ -1,107 +1,93 @@
1
- var p = Object.defineProperty;
2
- var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as T } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as h, PIXEL_TRACKING_SEND_GRID_ID as I, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as m } from "../../../enums/unsubscribe.js";
6
- import { Control as C, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-radio-button", E = "select", { get: _ } = T();
8
- class G extends C {
1
+ var E = Object.defineProperty;
2
+ var d = (r, n, t) => n in r ? E(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var o = (r, n, t) => d(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as p } from "../../../enums/unsubscribe.js";
6
+ import { Control as h, UIElementType as i, UEAttr as e, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-radio-button", u = "select", { get: $ } = l();
8
+ class I extends h {
9
9
  constructor() {
10
10
  super(...arguments);
11
- a(this, "currentNode");
12
- a(this, "selectedUnsubGroup");
13
- a(this, "unsubList", []);
11
+ o(this, "currentNode");
12
+ o(this, "selectedUnsubGroup");
13
+ o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
17
17
  }
18
18
  _setFormValues() {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
- const e = this.currentNode.getAttribute("id");
21
- if (e) {
22
- const s = m.includes(e) ? e : Number(e);
20
+ const t = this.currentNode.getAttribute("id");
21
+ if (t) {
22
+ const s = t === p ? t : Number(t);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [E]: this.selectedUnsubGroup
27
+ [u]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
- _getLabel(e, s = `${Math.random()}`) {
30
+ _getLabel(t, s = `${Math.random()}`) {
31
31
  return `
32
- <${r.LABEL}
33
- ${t.LABEL.text}="${e}"
34
- ${t.LABEL.name}="${s}">
35
- </${r.LABEL}>
32
+ <${i.LABEL}
33
+ ${e.LABEL.text}="${t}"
34
+ ${e.LABEL.name}="${s}">
35
+ </${i.LABEL}>
36
36
  `;
37
37
  }
38
- _getSelectItem(e, s) {
38
+ _getSelectItem(t, s) {
39
39
  return `
40
- <${r.SELECT_ITEM}
41
- ${t.SELECT_ITEM.text}="${e}"
42
- ${t.SELECT_ITEM.value}="${s}">
43
- </${r.SELECT_ITEM}>`;
40
+ <${i.SELECT_ITEM}
41
+ ${e.SELECT_ITEM.text}="${t}"
42
+ ${e.SELECT_ITEM.value}="${s}">
43
+ </${i.SELECT_ITEM}>`;
44
44
  }
45
45
  _getSelect() {
46
- return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
46
+ return this.unsubList.map((t) => this._getSelectItem(t.name, t.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
- const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
50
49
  return `
51
50
  <div class="checkbox-controls-container">
52
- <div class="checkbox-select-container container one-column stretch">
53
- <${r.LABEL}
54
- ${t.LABEL.text}="${e}"
55
- ${t.LABEL.name}="${Math.random()}">
56
- </${r.LABEL}>
51
+ <div class="checkbox-select-container container two-columns stretch">
52
+ <${i.LABEL}
53
+ ${e.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
+ ${e.LABEL.name}="${Math.random()}">
55
+ </${i.LABEL}>
57
56
 
58
- <${r.SELECTPICKER}
59
- ${t.SELECTPICKER.name}="${E}"
60
- ${t.SELECTPICKER.searchable}="true"
61
- ${t.SELECTPICKER.placeholder}="${s}">
57
+ <${i.SELECTPICKER}
58
+ ${e.SELECTPICKER.name}="${u}"
59
+ ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
62
60
  ${this._getSelect()}
63
- </${r.SELECTPICKER}>
61
+ </${i.SELECTPICKER}>
64
62
  </div>
65
63
  </div>
66
64
  `;
67
65
  }
68
- _onSelectChange(e) {
69
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
66
+ _onSelectChange(t) {
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new m(`Updated text to ${t}`));
70
68
  }
71
69
  _listenToFormUpdates() {
72
- this.api.onValueChanged(E, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (t) => this._onSelectChange(t));
73
71
  }
74
- onTemplateNodeUpdated(e) {
75
- this.currentNode = e, this._setFormValues();
72
+ onTemplateNodeUpdated(t) {
73
+ this.currentNode = t, this._setFormValues();
76
74
  }
77
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
78
76
  async onRender() {
79
- const e = await _(
77
+ const t = await $(
80
78
  "/unsubscribe-groups/unsubscribe-list"
81
- ), s = {
82
- name: this.api.translate("Pixel Tracking Opt-in"),
83
- sendGridId: I
84
- }, u = [h(), ...e.data], c = (o) => ({
85
- [t.SELECT_ITEM.text]: o.name,
86
- [t.SELECT_ITEM.value]: o.sendGridId
87
- }), d = (o) => ({
88
- [t.SELECT_ITEM.text]: o,
89
- [t.SELECT_ITEM.value]: `header:${o}`,
90
- [t.SELECT_ITEM.disabled]: !0
91
- }), l = [
92
- d(this.api.translate("OPT-IN SELECTION")),
93
- c(s),
94
- d(this.api.translate("UNSUBSCRIBE GROUPS")),
95
- ...u.map(c)
96
- ];
97
- this.unsubList = [s, ...u], this.api.setUIEAttribute(
98
- E,
99
- t.SELECTPICKER.items,
100
- l
79
+ ), s = [L(), ...t.data], c = s.map((a) => ({
80
+ [e.SELECT_ITEM.text]: a.name,
81
+ [e.SELECT_ITEM.value]: a.sendGridId
82
+ }));
83
+ this.unsubList = s, this.api.setUIEAttribute(
84
+ u,
85
+ e.SELECTPICKER.items,
86
+ c
101
87
  ), this._setFormValues(), this._listenToFormUpdates();
102
88
  }
103
89
  }
104
90
  export {
105
91
  b as CONTROL_BLOCK_ID,
106
- G as RadioButtonControl
92
+ I as RadioButtonControl
107
93
  };
@@ -19,8 +19,6 @@ export declare const PRODUCT_TYPE_URL_SEGMENTS: {
19
19
  };
20
20
  export declare const INSIDER_ID = "iid";
21
21
  export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
22
- export declare const PIXEL_TRACKING_SEND_GRID_ID = "P";
23
- export declare const UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS: string[];
24
22
  /**
25
23
  * Get the default unsubscribe group lazily so the translated name resolves at access time.
26
24
  * Must be called within a Vue component context or after Pinia is initialized.
@@ -39,18 +39,6 @@ ue-dropdown .service-element.padding-t-3 {
39
39
  color: var(--guido-color-primary-500);
40
40
  }
41
41
 
42
- /*
43
- * SD-145233: the pixel-tracking preference dropdown has no native option groups,
44
- * so its section titles are rendered as disabled items. Present them as
45
- * non-interactive group headers instead of options: no hover/cursor affordance
46
- * and a little extra vertical spacing.
47
- */
48
- .dropdown__menu .dropdown__item.disabled {
49
- padding-top: 14px;
50
- padding-bottom: 8px;
51
- pointer-events: none;
52
- }
53
-
54
42
  .menu {
55
43
  padding: 8px 0px;
56
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.10.0-beta.f8b4dbb",
3
+ "version": "3.10.1-beta.e36dd40",
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",