@useinsider/guido 3.8.0-beta.eb4074b → 3.8.1-beta.110be29

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 (51) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
  3. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  4. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
  7. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
  9. package/dist/composables/useHtmlValidator.js +133 -180
  10. package/dist/composables/usePreviewInteractionGuard.js +17 -0
  11. package/dist/composables/useSave.js +14 -14
  12. package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
  13. package/dist/config/compiler/utils/recommendationCompilerUtils.js +57 -58
  14. package/dist/config/migrator/recommendation/extractors.js +22 -44
  15. package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
  16. package/dist/config/migrator/recommendationMigrator.js +31 -30
  17. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +20 -26
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +41 -55
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +57 -58
  20. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +31 -43
  21. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
  22. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +45 -55
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +56 -63
  24. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
  25. package/dist/extensions/Blocks/Recommendation/extension.js +2 -3
  26. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
  27. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
  28. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +12 -13
  29. package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -7
  30. package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
  31. package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
  32. package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
  33. package/dist/guido.css +1 -1
  34. package/dist/src/composables/useHtmlValidator.d.ts +0 -27
  35. package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
  36. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
  37. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
  38. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
  39. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  40. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
  45. package/dist/src/stores/unsubscribe.d.ts +11 -1
  46. package/dist/stores/unsubscribe.js +8 -7
  47. package/package.json +1 -1
  48. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
  49. package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
  50. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
  51. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
@@ -2,62 +2,61 @@ import { useConfig as _ } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as g } from "../../../composables/useRecommendation.js";
3
3
  import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
4
  import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
6
- function h(r, n, e, o, c = "") {
7
- const i = `{{${c}${r}_${n}_${e}}}`, t = `{{${c}${r}_${n}_currency}}`;
8
- return o === "before" ? `${t} ${i}` : `${i} ${t}`;
5
+ function h(r, n, e, o, i = "") {
6
+ const c = `{{${i}${r}_${n}_${e}}}`, t = `{{${i}${r}_${n}_currency}}`;
7
+ return o === "before" ? `${t} ${c}` : `${c} ${t}`;
9
8
  }
10
- function f(r) {
9
+ function b(r) {
11
10
  let n = r;
12
11
  for (; n.children.length === 1; )
13
12
  [n] = n.children;
14
13
  return n;
15
14
  }
16
- function A(r, n, e, o, c, i) {
15
+ function A(r, n, e, o, i, c) {
17
16
  switch (n) {
18
17
  case "productImage": {
19
18
  const t = r.querySelector("img");
20
- t && (t.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
19
+ t && (t.setAttribute("src", `{{${c}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${c}${e}_${o}_name}}`));
21
20
  const s = r.querySelector("a");
22
- s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(q));
21
+ s && (s.setAttribute("href", `{{${c}${e}_${o}_url}}`), s.classList.add(q));
23
22
  break;
24
23
  }
25
24
  case "productName": {
26
25
  const t = r.querySelector("p");
27
- t && (f(t).textContent = `{{${i}${e}_${o}_name}}`);
26
+ t && (b(t).textContent = `{{${c}${e}_${o}_name}}`);
28
27
  break;
29
28
  }
30
29
  case "productPrice": {
31
30
  const t = r.querySelector("p");
32
- t && (f(t).textContent = h(
31
+ t && (b(t).textContent = h(
33
32
  e,
34
33
  o,
35
34
  "price",
36
- c,
37
- i
35
+ i,
36
+ c
38
37
  ));
39
38
  break;
40
39
  }
41
40
  case "productOldPrice": {
42
41
  const t = r.querySelector("p");
43
- t && (f(t).textContent = h(
42
+ t && (b(t).textContent = h(
44
43
  e,
45
44
  o,
46
45
  "original_price",
47
- c,
48
- i
46
+ i,
47
+ c
49
48
  ), t.setAttribute("product-attr", "discount"));
50
49
  break;
51
50
  }
52
51
  case "productButton": {
53
52
  const t = r.querySelector("a");
54
- t && t.setAttribute("href", `{{${i}${e}_${o}_url}}`);
53
+ t && t.setAttribute("href", `{{${c}${e}_${o}_url}}`);
55
54
  break;
56
55
  }
57
56
  case "productOmnibusPrice": {
58
57
  const t = r.querySelector(".omnibus-price-value");
59
58
  if (t) {
60
- t.textContent = `{{${i}${e}_${o}_omnibus_price}}`;
59
+ t.textContent = `{{${c}${e}_${o}_omnibus_price}}`;
61
60
  const s = t.closest("p");
62
61
  s && (s.setAttribute("product-attr", "omnibus_price"), s.setAttribute("composition", "true"));
63
62
  }
@@ -66,7 +65,7 @@ function A(r, n, e, o, c, i) {
66
65
  case "productOmnibusDiscount": {
67
66
  const t = r.querySelector(".omnibus-discount-value");
68
67
  if (t) {
69
- t.textContent = `{{${i}${e}_${o}_omnibus_discount}}`;
68
+ t.textContent = `{{${c}${e}_${o}_omnibus_discount}}`;
70
69
  const s = t.closest("p");
71
70
  s && (s.setAttribute("product-attr", "omnibus_discount"), s.setAttribute("composition", "true"));
72
71
  }
@@ -76,15 +75,15 @@ function A(r, n, e, o, c, i) {
76
75
  const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
77
76
  if (t) {
78
77
  const s = t.getAttribute("product-attr"), a = t.querySelector("p");
79
- a && (f(a).textContent = `{{${i}${e}_${o}_${s}}}`);
78
+ a && (b(a).textContent = `{{${c}${e}_${o}_${s}}}`);
80
79
  }
81
80
  break;
82
81
  }
83
82
  }
84
83
  }
85
- function E(r, n, e, o) {
86
- r.querySelectorAll(".recommendation-product-row").forEach((i, t) => {
87
- i.querySelectorAll("[data-attribute-type]").forEach((a) => {
84
+ function w(r, n, e, o) {
85
+ r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
86
+ c.querySelectorAll("[data-attribute-type]").forEach((a) => {
88
87
  const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
89
88
  p.length > 0 ? p.forEach((l) => {
90
89
  A(l, u, n, t, e, o);
@@ -92,35 +91,35 @@ function E(r, n, e, o) {
92
91
  });
93
92
  });
94
93
  }
95
- function R(r, n, e, o) {
96
- const c = r.querySelectorAll(".recommendation-product-row");
97
- if (!c.length)
94
+ function E(r, n, e, o) {
95
+ const i = r.querySelectorAll(".recommendation-product-row");
96
+ if (!i.length)
98
97
  return;
99
- const [i] = c, t = i.querySelector("[data-attribute-type]"), s = t ? t.querySelectorAll(".attribute-cell").length : 1;
100
- c.forEach((a, u) => {
98
+ const [c] = i, t = c.querySelector("[data-attribute-type]"), s = t ? t.querySelectorAll(".attribute-cell").length : 1;
99
+ i.forEach((a, u) => {
101
100
  a.querySelectorAll("[data-attribute-type]").forEach((l) => {
102
- const m = l.getAttribute("data-attribute-type") || "";
101
+ const d = l.getAttribute("data-attribute-type") || "";
103
102
  l.querySelectorAll(".attribute-cell").forEach((y, $) => {
104
103
  const S = u * s + $;
105
- A(y, m, n, S, e, o);
104
+ A(y, d, n, S, e, o);
106
105
  });
107
106
  });
108
107
  });
109
108
  }
110
- function P(r, n, e, o) {
111
- r.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
112
- R(i, n, e, o);
109
+ function R(r, n, e, o) {
110
+ r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
111
+ E(c, n, e, o);
113
112
  });
114
113
  }
115
- function T(r, n, e) {
116
- const o = r.getAttribute("data-layout") || "grid", c = r.getAttribute("currency-alignment") || "after";
117
- o === "list" ? E(r, n, c, e) : P(r, n, c, e);
114
+ function P(r, n, e) {
115
+ const o = r.getAttribute("data-layout") || "grid", i = r.getAttribute("currency-alignment") || "after";
116
+ o === "list" ? w(r, n, i, e) : R(r, n, i, e);
118
117
  }
119
- function b(r, n, e) {
120
- const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c = r.match(o);
121
- return c ? parseInt(c[1]) : e;
118
+ function f(r, n, e) {
119
+ const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), i = r.match(o);
120
+ return i ? parseInt(i[1]) : e;
122
121
  }
123
- function v(r, n) {
122
+ function T(r, n) {
124
123
  let e = r.parentElement;
125
124
  for (; e && e !== n; ) {
126
125
  if (e.tagName === "TD") {
@@ -132,42 +131,42 @@ function v(r, n) {
132
131
  }
133
132
  return null;
134
133
  }
135
- function O(r) {
136
- const n = r.getAttribute("style") || "", e = b(n, "width", 600), o = b(n, "padding", 0) * 2, c = Math.max(0, e - o);
137
- c !== 0 && r.querySelectorAll("img.adapt-img").forEach((i) => {
138
- if (i.hasAttribute("width"))
134
+ function v(r) {
135
+ const n = r.getAttribute("style") || "", e = f(n, "width", 600), o = f(n, "padding", 0) * 2, i = Math.max(0, e - o);
136
+ i !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
137
+ if (c.hasAttribute("width"))
139
138
  return;
140
- const t = v(i, r);
139
+ const t = T(c, r);
141
140
  if (!t)
142
141
  return;
143
- const s = t.getAttribute("width"), a = parseFloat(s), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(c * a / 100), l = Math.max(1, p - u);
144
- i.setAttribute("width", String(l));
145
- const m = i.getAttribute("style") || "";
146
- if (!/\bwidth\s*:\s*\d/i.test(m)) {
147
- const d = m && !m.trim().endsWith(";") ? "; " : "";
148
- i.setAttribute("style", `${m}${d}width: ${l}px`);
142
+ const s = t.getAttribute("width"), a = parseFloat(s), u = f(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(i * a / 100), l = Math.max(1, p - u);
143
+ c.setAttribute("width", String(l));
144
+ const d = c.getAttribute("style") || "";
145
+ if (!/\bwidth\s*:\s*\d/i.test(d)) {
146
+ const m = d && !d.trim().endsWith(";") ? "; " : "";
147
+ c.setAttribute("style", `${d}${m}width: ${l}px`);
149
148
  }
150
149
  });
151
150
  }
152
- function W(r, n) {
151
+ function O(r, n) {
153
152
  const e = r.match(/<!DOCTYPE[^>]*>/i);
154
153
  return (e ? `${e[0]}
155
154
  ` : "") + n.documentElement.outerHTML;
156
155
  }
157
- function F(r) {
156
+ function N(r) {
158
157
  const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
159
158
  if (!o.length)
160
159
  return r;
161
- const { buildCampaignUrl: c } = g(), i = C();
162
- i.recommendationCampaignUrls = {};
160
+ const { buildCampaignUrl: i } = g(), c = C();
161
+ c.recommendationCampaignUrls = {};
163
162
  const { isFeatureEnabled: t } = _(), s = t("liquidSyntax") ? "reco_" : "";
164
163
  return o.forEach((u) => {
165
- var l, m;
164
+ var l, d;
166
165
  const p = u.getAttribute("recommendation-id");
167
- p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (m = u.parentNode) == null || m.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((d) => d.remove()), c(p), w(u) || T(u, p, s), O(u));
168
- }), W(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
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()), i(p), P(u, p, s), v(u));
167
+ }), O(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
169
168
  }
170
169
  export {
171
170
  h as formatPriceVariable,
172
- F as prepareRecommendationBlocks
171
+ N as prepareRecommendationBlocks
173
172
  };
@@ -1,49 +1,27 @@
1
- import { CURRENCY_ATTR as n, CSS_CLASS_SKIP_COMPILE as c } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- const a = "You May Also Like!";
3
- function l(t) {
4
- var o;
5
- const r = t.querySelector(".ext-recommendation-title");
6
- if (!r)
7
- return a;
8
- const e = (o = r.textContent) == null ? void 0 : o.trim();
9
- return e && e.length > 0 ? e : a;
1
+ const i = "You May Also Like!";
2
+ function s(r) {
3
+ var e;
4
+ const o = r.querySelector(".ext-recommendation-title");
5
+ if (!o)
6
+ return i;
7
+ const t = (e = o.textContent) == null ? void 0 : e.trim();
8
+ return t && t.length > 0 ? t : i;
10
9
  }
11
- function m(t) {
12
- const r = [
13
- t,
14
- ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
10
+ function u(r) {
11
+ const o = [
12
+ r,
13
+ ...Array.from(r.querySelectorAll(".product-card, .ext-recommendation-card"))
15
14
  ];
16
- let e = "";
17
- return r.some((o) => {
18
- const i = o.getAttribute("bgcolor");
19
- if (i && i.trim())
20
- return e = i.trim(), !0;
21
- const u = (o.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
22
- return u && u[1] ? (e = u[1].trim(), !0) : !1;
23
- }), e;
24
- }
25
- function C(t) {
26
- const r = t.getAttribute(n.CURRENCY);
27
- if (!r)
28
- return;
29
- const e = t.getAttribute(n.SYMBOL);
30
- return {
31
- value: r,
32
- // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
33
- // the currency code as the symbol.
34
- ...e ? { symbol: e } : {},
35
- alignment: t.getAttribute(n.ALIGNMENT) ?? "",
36
- decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
37
- decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
38
- thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
39
- };
40
- }
41
- function d(t) {
42
- return t.classList.contains(c);
15
+ let t = "";
16
+ return o.some((e) => {
17
+ const n = e.getAttribute("bgcolor");
18
+ if (n && n.trim())
19
+ return t = n.trim(), !0;
20
+ const c = (e.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
21
+ return c && c[1] ? (t = c[1].trim(), !0) : !1;
22
+ }), t;
43
23
  }
44
24
  export {
45
- m as extractCardBgColor,
46
- C as extractCurrencyFromBlock,
47
- l as extractTitleText,
48
- d as isPartnerManagedBlock
25
+ u as extractCardBgColor,
26
+ s as extractTitleText
49
27
  };