@useinsider/guido 3.23.0-beta.ff29317 → 3.24.0-beta.0abeefe

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 (72) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +39 -37
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +4 -4
  5. package/dist/components/Guido.vue2.js +98 -92
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
  14. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  15. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  16. package/dist/composables/useBlocksConfig.js +31 -20
  17. package/dist/composables/useDisplayConditions.js +117 -0
  18. package/dist/composables/useTranslations.js +2 -1
  19. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  20. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  21. package/dist/enums/academy.js +1 -0
  22. package/dist/enums/display-condition.js +12 -0
  23. package/dist/extensions/DisplayConditions/bridge.js +25 -0
  24. package/dist/extensions/DisplayConditions/constants.js +26 -0
  25. package/dist/extensions/DisplayConditions/control.js +215 -0
  26. package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
  27. package/dist/extensions/DisplayConditions/extension.js +28 -0
  28. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  29. package/dist/extensions/DisplayConditions/library.js +30 -0
  30. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  31. package/dist/extensions/LinkTracking/extension.js +17 -0
  32. package/dist/extensions/LinkTracking/writer.js +41 -0
  33. package/dist/guido.css +1 -1
  34. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  35. package/dist/node_modules/valibot/dist/index.js +297 -261
  36. package/dist/package.json.js +6 -6
  37. package/dist/services/displayConditionApi.js +39 -0
  38. package/dist/src/@types/config/schemas.d.ts +4 -0
  39. package/dist/src/@types/display-condition.d.ts +60 -0
  40. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  41. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
  42. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
  43. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  44. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  45. package/dist/src/composables/useConfig.d.ts +2 -0
  46. package/dist/src/composables/useDisplayConditions.d.ts +18 -0
  47. package/dist/src/enums/academy.d.ts +1 -0
  48. package/dist/src/enums/display-condition.d.ts +15 -0
  49. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  50. package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
  51. package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
  52. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  53. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  54. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  55. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  56. package/dist/src/extensions/LinkTracking/extension.d.ts +2 -0
  57. package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
  58. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  59. package/dist/src/services/displayConditionApi.d.ts +8 -0
  60. package/dist/src/stores/config.d.ts +167 -0
  61. package/dist/src/stores/display-condition.d.ts +84 -0
  62. package/dist/src/utils/displayCondition.d.ts +11 -0
  63. package/dist/src/utils/linkTrackingIds.d.ts +22 -5
  64. package/dist/src/utils/protectTableText.d.ts +2 -0
  65. package/dist/stores/config.js +13 -6
  66. package/dist/stores/display-condition.js +29 -0
  67. package/dist/utils/displayCondition.js +26 -0
  68. package/dist/utils/linkTrackingIds.js +82 -48
  69. package/dist/utils/pairProductVariables.js +30 -29
  70. package/dist/utils/protectTableText.js +22 -0
  71. package/dist/utils/templatePreparation.js +67 -57
  72. package/package.json +1 -1
@@ -1,75 +1,76 @@
1
- import { PRODUCT_WRAPPER_SELECTOR as h, hasZeroWidthDeclaration as E, isZeroWidthValue as f, withWidthPin as T, PRODUCT_TD_SELECTOR as _, withoutZeroWidth as y } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
- import { DefaultConfigValues as D } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { protectLiquid as p, restoreLiquid as A } from "../../../utils/liquidProtection.js";
4
- const m = "MSO_ITEMS_HIDE_START", S = "MSO_ITEMS_HIDE_END", M = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", I = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", O = ".ins-product-td td.product-image-class img[width]", g = Number(D.productImageWidth);
5
- function C(t) {
1
+ import { PRODUCT_WRAPPER_SELECTOR as _, hasZeroWidthDeclaration as p, isZeroWidthValue as f, withWidthPin as y, PRODUCT_TD_SELECTOR as D, withoutZeroWidth as S } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
+ import { DefaultConfigValues as M } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { protectLiquid as h, restoreLiquid as T } from "../../../utils/liquidProtection.js";
4
+ import { protectTableText as E, restoreTableText as m } from "../../../utils/protectTableText.js";
5
+ const A = "MSO_ITEMS_HIDE_START", b = "MSO_ITEMS_HIDE_END", I = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", O = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", g = ".ins-product-td td.product-image-class img[width]", H = Number(M.productImageWidth);
6
+ function P(t) {
6
7
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
7
8
  return t;
8
- const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
+ const s = E(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
9
10
  let n = !1;
10
- if (o.querySelectorAll(I).forEach((e) => {
11
+ if (o.querySelectorAll(O).forEach((e) => {
11
12
  var d, u;
12
- const r = e.getAttribute("style") || "";
13
- if (!/display\s*:\s*none/i.test(r))
13
+ const i = e.getAttribute("style") || "";
14
+ if (!/display\s*:\s*none/i.test(i))
14
15
  return;
15
16
  const l = e.previousSibling;
16
- if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== m) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(m), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(S), e.nextSibling)), !/mso-hide/i.test(r)) {
17
- const a = r.trim().endsWith(";") ? " " : "; ";
18
- e.setAttribute("style", `${r}${a}${M}`);
17
+ if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== A) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(A), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(b), e.nextSibling)), !/mso-hide/i.test(i)) {
18
+ const a = i.trim().endsWith(";") ? " " : "; ";
19
+ e.setAttribute("style", `${i}${a}${I}`);
19
20
  }
20
21
  n = !0;
21
22
  }), !n)
22
23
  return t;
23
- const c = s.match(/<!DOCTYPE[^>]*>/i);
24
- return ((c ? `${c[0]}
25
- ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
24
+ const c = s.match(/<!DOCTYPE[^>]*>/i), r = c ? `${c[0]}
25
+ ` : "";
26
+ return m((r + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
26
27
  }
27
- function N(t) {
28
+ function R(t) {
28
29
  if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
29
30
  return t;
30
- const s = new DOMParser().parseFromString(p(t), "text/html");
31
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
31
32
  let o = !1;
32
- if (s.querySelectorAll(h).forEach((i) => {
33
- const e = i.getAttribute("style") || "";
34
- if (!E(e) && !f(i.getAttribute("width")))
33
+ if (s.querySelectorAll(_).forEach((r) => {
34
+ const e = r.getAttribute("style") || "";
35
+ if (!p(e) && !f(r.getAttribute("width")))
35
36
  return;
36
- const r = T(e);
37
- r !== e && (i.setAttribute("style", r), o = !0), f(i.getAttribute("width")) && (i.setAttribute("width", "100%"), o = !0);
38
- }), s.querySelectorAll(_).forEach((i) => {
39
- const e = i.getAttribute("style") || "";
40
- if (E(e)) {
41
- const r = y(e);
42
- r ? i.setAttribute("style", r) : i.removeAttribute("style"), o = !0;
37
+ const i = y(e);
38
+ i !== e && (r.setAttribute("style", i), o = !0), f(r.getAttribute("width")) && (r.setAttribute("width", "100%"), o = !0);
39
+ }), s.querySelectorAll(D).forEach((r) => {
40
+ const e = r.getAttribute("style") || "";
41
+ if (p(e)) {
42
+ const i = S(e);
43
+ i ? r.setAttribute("style", i) : r.removeAttribute("style"), o = !0;
43
44
  }
44
- f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
45
+ f(r.getAttribute("width")) && (r.removeAttribute("width"), o = !0);
45
46
  }), !o)
46
47
  return t;
47
48
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
48
49
  ` : "";
49
- return A(c + s.documentElement.outerHTML);
50
+ return m(T(c + s.documentElement.outerHTML));
50
51
  }
51
- function L(t) {
52
+ function x(t) {
52
53
  if (!t.includes("product-image-class"))
53
54
  return t;
54
- const s = new DOMParser().parseFromString(p(t), "text/html");
55
+ const s = new DOMParser().parseFromString(h(E(t)), "text/html");
55
56
  let o = !1;
56
- if (s.querySelectorAll(O).forEach((i) => {
57
+ if (s.querySelectorAll(g).forEach((r) => {
57
58
  var u, a;
58
- const e = ((u = i.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", r = ((a = i.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
59
- if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(r))
59
+ const e = ((u = r.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", i = ((a = r.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
60
+ if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(i))
60
61
  return;
61
- const l = r && !r.endsWith(";") ? ";" : "", d = Math.min(Number(e), g);
62
- i.setAttribute("style", `${r}${l}min-width:${d}px;max-width:${e}px`), o = !0;
62
+ const l = i && !i.endsWith(";") ? ";" : "", d = Math.min(Number(e), H);
63
+ r.setAttribute("style", `${i}${l}min-width:${d}px;max-width:${e}px`), o = !0;
63
64
  }), !o)
64
65
  return t;
65
66
  const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
66
67
  ` : "";
67
- return A(c + s.documentElement.outerHTML);
68
+ return m(T(c + s.documentElement.outerHTML));
68
69
  }
69
70
  export {
70
- S as MSO_ITEMS_HIDE_END,
71
- m as MSO_ITEMS_HIDE_START,
72
- L as lockHorizontalItemImageWidths,
73
- N as normalizeItemsBlockWidths,
74
- C as wrapHiddenPriceTdsForOutlook
71
+ b as MSO_ITEMS_HIDE_END,
72
+ A as MSO_ITEMS_HIDE_START,
73
+ x as lockHorizontalItemImageWidths,
74
+ R as normalizeItemsBlockWidths,
75
+ P as wrapHiddenPriceTdsForOutlook
75
76
  };
@@ -1,13 +1,14 @@
1
1
  import { useConfig as C } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as O } from "../../../composables/useRecommendation.js";
3
- import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as B } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useRecommendationExtensionStore as N } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { isIgnoredRecommendationBlock as T } from "./recommendationIgnoreUtils.js";
6
- function L(t, r, e, o, c = "") {
3
+ import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as T } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useRecommendationExtensionStore as B } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { protectTableText as N, restoreTableText as L } from "../../../utils/protectTableText.js";
6
+ import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
7
+ function R(t, r, e, o, c = "") {
7
8
  const i = `{{${c}${t}_${r}_${e}}}`, n = `{{${c}${t}_${r}_currency}}`;
8
9
  return o === "before" ? `${n} ${i}` : `${i} ${n}`;
9
10
  }
10
- function A(t) {
11
+ function b(t) {
11
12
  let r = t;
12
13
  for (; r.children.length === 1; )
13
14
  [r] = r.children;
@@ -19,12 +20,12 @@ function _(t, r, e, o, c, i) {
19
20
  const n = t.querySelector("img");
20
21
  n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
21
22
  const s = t.querySelector("a");
22
- s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(B));
23
+ s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(T));
23
24
  break;
24
25
  }
25
26
  case "productName": {
26
27
  const n = t.querySelector("p");
27
- n && (A(n).textContent = `{{${i}${e}_${o}_name}}`);
28
+ n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
28
29
  break;
29
30
  }
30
31
  // Inline mode ("Move to next line" OFF) merges BOTH prices into one row
@@ -32,16 +33,16 @@ function _(t, r, e, o, c, i) {
32
33
  // substitute by cell content, not by the row's anchor (SD-145161).
33
34
  case "productPrice":
34
35
  case "productOldPrice": {
35
- const n = (a, l) => {
36
- a && (A(a).textContent = L(
36
+ const n = (l, d) => {
37
+ l && (b(l).textContent = R(
37
38
  e,
38
39
  o,
39
- l,
40
+ d,
40
41
  c,
41
42
  i
42
43
  ));
43
- }, s = t.querySelector(".product-price p"), d = t.querySelector(".product-old-price p"), u = !s && !d ? t.querySelector("p") : null;
44
- n(s ?? (r === "productPrice" ? u : null), "price"), n(d ?? (r === "productOldPrice" ? u : null), "original_price");
44
+ }, s = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !s && !a ? t.querySelector("p") : null;
45
+ n(s ?? (r === "productPrice" ? u : null), "price"), n(a ?? (r === "productOldPrice" ? u : null), "original_price");
45
46
  break;
46
47
  }
47
48
  case "productButton": {
@@ -70,72 +71,72 @@ function _(t, r, e, o, c, i) {
70
71
  default: {
71
72
  const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
72
73
  if (n) {
73
- const s = n.getAttribute("product-attr"), d = n.querySelector("p");
74
- d && (A(d).textContent = `{{${i}${e}_${o}_${s}}}`);
74
+ const s = n.getAttribute("product-attr"), a = n.querySelector("p");
75
+ a && (b(a).textContent = `{{${i}${e}_${o}_${s}}}`);
75
76
  }
76
77
  break;
77
78
  }
78
79
  }
79
80
  }
80
- const P = "name";
81
+ const w = "name";
81
82
  function y(t, r, e, o) {
82
- const c = `${o}${r}_${e}_${P}`;
83
+ const c = `${o}${r}_${e}_${w}`;
83
84
  return {
84
85
  open: t.createComment(`{% if ${c} and ${c} != "" %}`),
85
86
  close: t.createComment("{% endif %}")
86
87
  };
87
88
  }
88
- function R(t, r, e) {
89
+ function D(t, r, e) {
89
90
  return y(t, r, 0, e);
90
91
  }
91
- function w(t, r, e, o) {
92
+ function v(t, r, e, o) {
92
93
  if (!t.innerHTML.includes("{{"))
93
94
  return;
94
95
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
95
96
  t.insertBefore(c, t.firstChild), t.appendChild(i);
96
97
  }
97
- function D(t, r, e, o) {
98
+ function W(t, r, e, o) {
98
99
  var n, s;
99
100
  if (!t.innerHTML.includes("{{"))
100
101
  return;
101
102
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
102
103
  (n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
103
104
  }
104
- function v(t, r, e, o) {
105
+ function H(t, r, e, o) {
105
106
  t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
106
- i.querySelectorAll("[data-attribute-type]").forEach((d) => {
107
- const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
108
- a.length > 0 ? a.forEach((l) => {
109
- _(l, u, r, n, e, o);
110
- }) : _(d, u, r, n, e, o);
111
- }), D(i, r, n, o);
107
+ i.querySelectorAll("[data-attribute-type]").forEach((a) => {
108
+ const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
109
+ l.length > 0 ? l.forEach((d) => {
110
+ _(d, u, r, n, e, o);
111
+ }) : _(a, u, r, n, e, o);
112
+ }), W(i, r, n, o);
112
113
  });
113
114
  }
114
- function H(t, r, e, o) {
115
+ function x(t, r, e, o) {
115
116
  const c = t.querySelectorAll(".recommendation-product-row");
116
117
  if (!c.length)
117
118
  return;
118
119
  const [i] = c, n = i.querySelector("[data-attribute-type]"), s = n ? n.querySelectorAll(".attribute-cell").length : 1;
119
- c.forEach((d, u) => {
120
- d.querySelectorAll("[data-attribute-type]").forEach((l) => {
121
- const p = l.getAttribute("data-attribute-type") || "";
122
- l.querySelectorAll(".attribute-cell").forEach((m, h) => {
120
+ c.forEach((a, u) => {
121
+ a.querySelectorAll("[data-attribute-type]").forEach((d) => {
122
+ const p = d.getAttribute("data-attribute-type") || "";
123
+ d.querySelectorAll(".attribute-cell").forEach((m, h) => {
123
124
  const S = u * s + h;
124
- _(m, p, r, S, e, o), w(m, r, S, o);
125
+ _(m, p, r, S, e, o), v(m, r, S, o);
125
126
  });
126
127
  });
127
128
  });
128
129
  }
129
- function W(t, r, e, o) {
130
+ function F(t, r, e, o) {
130
131
  t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
131
- H(i, r, e, o);
132
+ x(i, r, e, o);
132
133
  });
133
134
  }
134
- function F(t, r, e) {
135
+ function G(t, r, e) {
135
136
  const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
136
- o === "list" ? v(t, r, i, e) : W(t, r, i, e);
137
+ o === "list" ? H(t, r, i, e) : F(t, r, i, e);
137
138
  }
138
- function b(t, r, e) {
139
+ function A(t, r, e) {
139
140
  const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
140
141
  return c ? parseInt(c[1]) : e;
141
142
  }
@@ -150,7 +151,7 @@ function g(t) {
150
151
  const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
151
152
  return e && $(e[1]) ? e[1] : null;
152
153
  }
153
- function x(t, r) {
154
+ function V(t, r) {
154
155
  let e = t.parentElement;
155
156
  for (; e && e !== r; ) {
156
157
  if (e.tagName === "TD" && g(e))
@@ -159,62 +160,64 @@ function x(t, r) {
159
160
  }
160
161
  return null;
161
162
  }
162
- function G(t) {
163
- const r = t.getAttribute("style") || "", e = b(r, "width", 600), o = b(r, "padding", 0) * 2, c = Math.max(0, e - o);
163
+ function U(t) {
164
+ const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, c = Math.max(0, e - o);
164
165
  c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
165
166
  if (i.hasAttribute("width"))
166
167
  return;
167
- const n = x(i, t);
168
+ const n = V(i, t);
168
169
  if (!n)
169
170
  return;
170
- const s = g(n), d = b(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
171
+ const s = g(n), a = A(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), l = Math.max(1, u - a), d = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(d);
171
172
  if (p) {
172
- i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
173
+ i.setAttribute("width", String(Math.max(1, Math.min(l, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
173
174
  return;
174
175
  }
175
- if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
176
- const f = l && !l.trim().endsWith(";") ? "; " : "";
177
- i.setAttribute("style", `${l}${f}width: ${a}px`);
176
+ if (i.setAttribute("width", String(l)), !/\bwidth\s*:\s*\d/i.test(d)) {
177
+ const f = d && !d.trim().endsWith(";") ? "; " : "";
178
+ i.setAttribute("style", `${d}${f}width: ${l}px`);
178
179
  }
179
180
  });
180
181
  }
181
- const E = "MSO_MOBILE_HIDE_START", V = "MSO_MOBILE_HIDE_END";
182
- function U(t, r) {
182
+ const E = "MSO_MOBILE_HIDE_START", X = "MSO_MOBILE_HIDE_END";
183
+ function j(t, r) {
183
184
  t.querySelectorAll(q).forEach((e) => {
184
185
  var i, n;
185
186
  const o = e.querySelector(M);
186
187
  if (!o || o.children.length === 0)
187
188
  return;
188
189
  const c = e.previousSibling;
189
- (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(V), e.nextSibling));
190
+ (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(X), e.nextSibling));
190
191
  });
191
192
  }
192
- function X(t, r) {
193
+ function Y(t, r) {
193
194
  const e = t.match(/<!DOCTYPE[^>]*>/i);
194
195
  return (e ? `${e[0]}
195
196
  ` : "") + r.documentElement.outerHTML;
196
197
  }
197
- function Q(t) {
198
- const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
198
+ function I(t) {
199
+ const r = N(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
199
200
  if (!o.length)
200
201
  return t;
201
- const { buildCampaignUrl: c } = O(), i = N();
202
+ const { buildCampaignUrl: c } = O(), i = B();
202
203
  i.recommendationCampaignUrls = {};
203
204
  const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
204
- return o.forEach((u) => {
205
- var l, p, f, m;
206
- const a = u.getAttribute("recommendation-id");
207
- if (a) {
208
- if ((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()), c(a), U(u, e), !T(u)) {
209
- F(u, a, s);
210
- const { open: h, close: S } = R(e, a, s);
205
+ o.forEach((u) => {
206
+ var d, p, f, m;
207
+ const l = u.getAttribute("recommendation-id");
208
+ if (l) {
209
+ 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((h) => h.remove()), c(l), j(u, e), !P(u)) {
210
+ G(u, l, s);
211
+ const { open: h, close: S } = D(e, l, s);
211
212
  (f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
212
213
  }
213
- G(u);
214
+ U(u);
214
215
  }
215
- }), X(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
216
+ });
217
+ const a = Y(r, e);
218
+ return L(a.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
216
219
  }
217
220
  export {
218
- L as formatPriceVariable,
219
- Q as prepareRecommendationBlocks
221
+ R as formatPriceVariable,
222
+ I as prepareRecommendationBlocks
220
223
  };
@@ -2,6 +2,7 @@ const e = "https://academy.insiderone.com", o = {
2
2
  EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
+ EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
5
6
  EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
6
7
  };
7
8
  export {
@@ -0,0 +1,12 @@
1
+ var N = /* @__PURE__ */ ((I) => (I.OPEN = "display-condition:open", I.APPLY = "display-condition:apply", I.CANCEL = "display-condition:cancel", I))(N || {}), A = /* @__PURE__ */ ((I) => (I.INLINE = "inline", I.SAVED = "saved", I))(A || {});
2
+ const M = {
3
+ NAME_MIN: 2,
4
+ NAME_MAX: 40,
5
+ DESCRIPTION_MAX: 200,
6
+ CODE_MAX: 65535
7
+ };
8
+ export {
9
+ M as DISPLAY_CONDITION_LIMITS,
10
+ N as DisplayConditionEvent,
11
+ A as DisplayConditionSourceType
12
+ };
@@ -0,0 +1,25 @@
1
+ import { DisplayConditionEvent as i } from "../../enums/display-condition.js";
2
+ let n = null;
3
+ const d = () => {
4
+ n == null || n.detach();
5
+ }, L = (p, e) => {
6
+ var C;
7
+ const t = n;
8
+ t == null || t.detach(), (C = t == null ? void 0 : t.onCancel) == null || C.call(t);
9
+ let o = () => {
10
+ };
11
+ const l = (c) => {
12
+ const m = c.detail;
13
+ o(), m.applied = e.onApply(m.condition);
14
+ }, a = () => {
15
+ var c;
16
+ o(), (c = e.onCancel) == null || c.call(e);
17
+ };
18
+ return o = () => {
19
+ document.removeEventListener(i.APPLY, l), document.removeEventListener(i.CANCEL, a), (n == null ? void 0 : n.detach) === o && (n = null);
20
+ }, document.addEventListener(i.APPLY, l), document.addEventListener(i.CANCEL, a), n = { detach: o, onCancel: e.onCancel }, document.dispatchEvent(new CustomEvent(i.OPEN, { detail: p })), o;
21
+ };
22
+ export {
23
+ d as disposeDisplayConditionRequest,
24
+ L as requestDisplayCondition
25
+ };
@@ -0,0 +1,26 @@
1
+ import { BlockType as o } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const n = "conditions", t = "guido-display-conditions-control", d = 10, s = [o.STRIPE, o.STRUCTURE, o.CONTAINER], c = {
3
+ PLUS: "guido-display-condition-plus",
4
+ EDIT: "guido-display-condition-edit",
5
+ TRASH: "guido-display-condition-trash",
6
+ CHEVRON: "guido-display-condition-chevron"
7
+ }, e = {
8
+ ADD: "guidoDisplayConditionAdd",
9
+ CREATE: "guidoDisplayConditionCreate",
10
+ SELECT: "guidoDisplayConditionSelect",
11
+ SHOW_MORE: "guidoDisplayConditionShowMore",
12
+ SHOW_LESS: "guidoDisplayConditionShowLess",
13
+ EDIT: "guidoDisplayConditionEdit",
14
+ REMOVE: "guidoDisplayConditionRemove"
15
+ }, C = ["applyConditionSwitcher", "applyCondition", "displayConditions"], a = "You can add Display Condition by selecting an existing condition or creating a new one to show specific content.", O = "You can create or select a display condition to control content visibility based on your recipients' properties or events.";
16
+ export {
17
+ O as APPLIED_DESCRIPTION,
18
+ C as BUILT_IN_CONDITION_CONTROLS,
19
+ t as CONDITIONS_CONTROL_ID,
20
+ n as CONDITIONS_TAB_ID,
21
+ s as CONDITION_BLOCK_TYPES,
22
+ e as CONDITION_BUTTONS,
23
+ c as CONDITION_ICONS,
24
+ a as EMPTY_DESCRIPTION,
25
+ d as MAX_COLLAPSED_LINES
26
+ };