@useinsider/guido 3.23.0 → 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 (125) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +43 -40
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +2 -2
  5. package/dist/components/Guido.vue2.js +113 -96
  6. package/dist/components/organisms/AutoSaveController.vue2.js +20 -10
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
  8. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
  14. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
  15. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  16. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  17. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  18. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +25 -0
  19. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  20. package/dist/components/organisms/header/EditorActions.vue2.js +58 -73
  21. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  22. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +99 -0
  23. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  24. package/dist/components/organisms/header/HeaderWrapper.vue2.js +9 -17
  25. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  26. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  27. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  28. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  29. package/dist/components/organisms/header/RightSlot.vue.js +11 -10
  30. package/dist/components/organisms/header/RightSlot.vue2.js +13 -18
  31. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  32. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  33. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +22 -0
  34. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  35. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +19 -0
  36. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +90 -0
  37. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  38. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +60 -35
  39. package/dist/composables/useAccessibilityApi.js +51 -0
  40. package/dist/composables/useBlocksConfig.js +31 -20
  41. package/dist/composables/useCustomInterfaceAppearance.js +42 -41
  42. package/dist/composables/useDisplayConditions.js +117 -0
  43. package/dist/composables/useTranslations.js +2 -1
  44. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  45. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  46. package/dist/config/i18n/en/labels.json.js +36 -4
  47. package/dist/config/i18n/en/tooltips.json.js +2 -1
  48. package/dist/enums/academy.js +1 -0
  49. package/dist/enums/display-condition.js +12 -0
  50. package/dist/extensions/DisplayConditions/bridge.js +25 -0
  51. package/dist/extensions/DisplayConditions/constants.js +26 -0
  52. package/dist/extensions/DisplayConditions/control.js +215 -0
  53. package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
  54. package/dist/extensions/DisplayConditions/extension.js +28 -0
  55. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  56. package/dist/extensions/DisplayConditions/library.js +30 -0
  57. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  58. package/dist/extensions/LinkTracking/extension.js +17 -0
  59. package/dist/extensions/LinkTracking/writer.js +41 -0
  60. package/dist/guido.css +1 -1
  61. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  62. package/dist/node_modules/valibot/dist/index.js +297 -261
  63. package/dist/package.json.js +6 -6
  64. package/dist/services/displayConditionApi.js +39 -0
  65. package/dist/sprite.svg +10 -0
  66. package/dist/src/@types/config/schemas.d.ts +6 -0
  67. package/dist/src/@types/display-condition.d.ts +60 -0
  68. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +19 -1
  69. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  70. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
  71. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  72. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  73. package/dist/src/components/organisms/header/AutoSaveStatus.vue.d.ts +2 -0
  74. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  75. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -19
  76. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -19
  77. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  78. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  79. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  80. package/dist/src/composables/useAccessibilityApi.d.ts +13 -0
  81. package/dist/src/composables/useActionsApi.d.ts +2 -2
  82. package/dist/src/composables/useConfig.d.ts +4 -0
  83. package/dist/src/composables/useDisplayConditions.d.ts +18 -0
  84. package/dist/src/enums/academy.d.ts +1 -0
  85. package/dist/src/enums/display-condition.d.ts +15 -0
  86. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  87. package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
  88. package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
  89. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  90. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  91. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  92. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  93. package/dist/src/extensions/LinkTracking/extension.d.ts +2 -0
  94. package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
  95. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  96. package/dist/src/services/displayConditionApi.d.ts +8 -0
  97. package/dist/src/stores/autosave.d.ts +73 -1
  98. package/dist/src/stores/config.d.ts +187 -0
  99. package/dist/src/stores/display-condition.d.ts +84 -0
  100. package/dist/src/stores/editor.d.ts +109 -0
  101. package/dist/src/stores/onboarding.d.ts +966 -35
  102. package/dist/src/stores/version-history.d.ts +1 -1
  103. package/dist/src/utils/displayCondition.d.ts +11 -0
  104. package/dist/src/utils/linkTrackingIds.d.ts +22 -5
  105. package/dist/src/utils/protectTableText.d.ts +2 -0
  106. package/dist/src/utils/templatePreparation.d.ts +1 -1
  107. package/dist/src/utils/timeUtil.d.ts +5 -8
  108. package/dist/static/stripo-runtime-manifest.json.js +1 -1
  109. package/dist/static/styles/components/accessibility.css.js +234 -0
  110. package/dist/static/styles/variables.css.js +2 -0
  111. package/dist/stores/autosave.js +12 -7
  112. package/dist/stores/config.js +13 -6
  113. package/dist/stores/display-condition.js +29 -0
  114. package/dist/stores/editor.js +8 -3
  115. package/dist/stores/onboarding.js +48 -22
  116. package/dist/utils/displayCondition.js +26 -0
  117. package/dist/utils/linkTrackingIds.js +82 -48
  118. package/dist/utils/pairProductVariables.js +30 -29
  119. package/dist/utils/protectTableText.js +22 -0
  120. package/dist/utils/templatePreparation.js +67 -57
  121. package/dist/utils/timeUtil.js +6 -17
  122. package/package.json +2 -2
  123. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  124. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  125. /package/dist/src/components/organisms/{header/AutoSaveToggle.vue.d.ts → display-conditions/DisplayConditionCreateDrawer.vue.d.ts} +0 -0
@@ -0,0 +1,117 @@
1
+ import { useToaster as M } from "./useToaster.js";
2
+ import { useTranslations as x } from "./useTranslations.js";
3
+ import { ACADEMY_LINKS as L } from "../enums/academy.js";
4
+ import { DisplayConditionSourceType as y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } from "../enums/display-condition.js";
5
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
6
+ import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
7
+ import { useConfigStore as q } from "../stores/config.js";
8
+ import { useDisplayConditionStore as P } from "../stores/display-condition.js";
9
+ import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
10
+ import { escapeHtml as R } from "../utils/htmlEscape.js";
11
+ import { computed as B } from "vue";
12
+ const X = "email-editor.display-conditions", i = X, b = 409, S = (n, m, r) => ({
13
+ id: w(),
14
+ name: n.name.trim(),
15
+ description: n.description.trim(),
16
+ beforeScript: n.codeBefore,
17
+ afterScript: n.codeAfter,
18
+ extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
19
+ }), v = (n) => ({
20
+ name: n.name,
21
+ description: n.description,
22
+ codeBefore: n.codeBefore,
23
+ codeAfter: n.codeAfter
24
+ }), ne = () => {
25
+ const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = B(() => {
26
+ var e;
27
+ return (e = m.features) != null && e.liquidSyntax ? "liquid" : "pongo";
28
+ }), f = (e) => {
29
+ const t = { condition: e };
30
+ return document.dispatchEvent(new CustomEvent(I.APPLY, { detail: t })), n.close(), t.applied === !0;
31
+ }, D = () => {
32
+ n.view !== "none" && (document.dispatchEvent(new CustomEvent(I.CANCEL)), n.close());
33
+ }, N = (e) => {
34
+ if (e.mode === "select") {
35
+ n.openSelect();
36
+ return;
37
+ }
38
+ n.openCreate(e.mode === "edit" ? e.current : null);
39
+ }, $ = async () => {
40
+ const e = ++n.listRequest;
41
+ n.listStatus = "loading";
42
+ try {
43
+ const t = await r.list(u.value);
44
+ e === n.listRequest && (n.list = t, n.listStatus = "loaded");
45
+ } catch (t) {
46
+ console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
47
+ }
48
+ }, h = (e) => {
49
+ const t = {}, d = e.name.trim();
50
+ d ? d.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : d.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
51
+ const { DESCRIPTION_MAX: C } = s;
52
+ e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
53
+ const g = Y(e.codeBefore, e.codeAfter, u.value);
54
+ return ["codeBefore", "codeAfter"].forEach((a) => {
55
+ e[a].trim() ? g.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > s.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
56
+ }), t;
57
+ }, A = (e, t) => {
58
+ p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
59
+ }, T = (e) => o(
60
+ `${i}.${e}`,
61
+ {
62
+ academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
63
+ }
64
+ ), _ = () => {
65
+ p({ type: l.Error, message: o(`${i}.validation-failed`) });
66
+ }, c = (e) => ({ name: R(e) }), E = (e, t) => {
67
+ e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
68
+ };
69
+ return {
70
+ syntax: u,
71
+ handleOpen: N,
72
+ cancel: D,
73
+ loadList: $,
74
+ validate: h,
75
+ notifyInvalid: _,
76
+ describeWithAcademyLink: T,
77
+ createInline: (e) => {
78
+ A(
79
+ f(S(e, y.INLINE)),
80
+ o(`${i}.created`, c(e.name.trim()))
81
+ );
82
+ },
83
+ createAndSave: async (e) => {
84
+ try {
85
+ const t = await r.create(e, u.value);
86
+ return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], A(
87
+ f(S(v(t), y.SAVED, t.id)),
88
+ o(`${i}.created-and-saved`, c(t.name))
89
+ ), {};
90
+ } catch (t) {
91
+ return (t == null ? void 0 : t.status) === b ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
92
+ }
93
+ },
94
+ select: (e) => {
95
+ A(
96
+ f(S(v(e), y.SAVED, e.id)),
97
+ o(`${i}.applied`, c(e.name))
98
+ );
99
+ },
100
+ deleteSaved: async (e) => {
101
+ try {
102
+ await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
103
+ type: l.Success,
104
+ message: o(`${i}.deleted`, c(e.name))
105
+ });
106
+ } catch (t) {
107
+ E(t, o(`${i}.delete-failed`));
108
+ } finally {
109
+ n.pendingDelete = null;
110
+ }
111
+ }
112
+ };
113
+ };
114
+ export {
115
+ X as DISPLAY_CONDITIONS_TRANS_KEY,
116
+ ne as useDisplayConditions
117
+ };
@@ -9,7 +9,8 @@ const useTranslations = () => {
9
9
  var s;
10
10
  const r = (s = translations.value) == null ? void 0 : s[t];
11
11
  return r ? n ? Object.entries(n).reduce(
12
- (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
12
+ // A function replacer keeps `$&`, `$$` and `$1` in the value literal.
13
+ (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), () => String(l)),
13
14
  r
14
15
  ) : r : (console.warn(`Translation key not found: ${t}`), t);
15
16
  };
@@ -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
  };
@@ -1,19 +1,51 @@
1
- const e = "Items", o = "Default", t = "Custom", s = {
1
+ const e = "Items", o = "Default", i = "Custom", t = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
3
  "Structures & Modules": "Structures and Modules",
4
4
  "Recommendation Block": "Recommendation Block",
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
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
+ "email-editor.a11y-hide-images": "Hide images",
9
+ "email-editor.a11y-show-images": "Show images",
10
+ "email-editor.cvd-none": "No Color Deficiency",
11
+ "email-editor.cvd-protanopia": "Protanopia",
12
+ "email-editor.cvd-protanopia-description": "Causes red-green confusion and makes reds appear darker.",
13
+ "email-editor.cvd-deuteranopia": "Deuteranopia",
14
+ "email-editor.cvd-deuteranopia-description": "Causes red-green confusion.",
15
+ "email-editor.cvd-tritanopia": "Tritanopia",
16
+ "email-editor.cvd-tritanopia-description": "Causes blue-yellow confusion.",
17
+ "email-editor.cvd-achromatopsia": "Achromatopsia",
18
+ "email-editor.cvd-achromatopsia-description": "Causes complete color blindness.",
19
+ "email-editor.more-actions": "More actions",
20
+ "email-editor.preferences": "Preferences",
21
+ "email-editor.actions": "Actions",
22
+ "email-editor.accessibility-test": "Accessibility Test",
23
+ "email-editor.autosaved-at-today": "{boldStart}Autosaved{boldEnd} at {time}, Today",
24
+ "email-editor.autosaved-at-date": "{boldStart}Autosaved{boldEnd} at {date}",
25
+ "email-editor.export-html": "Export HTML",
26
+ "email-editor.onboarding-kebab-title": "Discover Preferences and Actions",
27
+ "email-editor.onboarding-kebab-description": "You can now access your Preferences and Actions easily such as Autosave, Export HTML, Version History, Accessibility Test and Save As Template.",
28
+ "email-editor.onboarding-autosave-title": "Autosave Your Design",
29
+ "email-editor.onboarding-autosave-description": "You can save your design automatically by enabling Autosave without losing your work.",
30
+ "email-editor.onboarding-accessibility-title": "Test Accessibility of Your Design",
31
+ "email-editor.onboarding-accessibility-description": "You can test the accessibility of your design to see the Failed, Passed items and update the Failed ones accordingly.",
8
32
  "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
33
  "OPT-IN SELECTION": "OPT-IN SELECTION",
10
34
  "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
11
35
  Default: o,
12
- Custom: t
36
+ Custom: i,
37
+ "Foreground color": "Foreground Color",
38
+ "Contrast ratio": "Contrast Ratio",
39
+ "You’ve fixed all issues!": `No Failed Items
40
+ You have no failed items.`,
41
+ "No accessibility issues found": `No Failed Items
42
+ You have no failed items.`,
43
+ "You have no ignored issues yet": `No Ignored Items
44
+ You have no ignored items.`
13
45
  };
14
46
  export {
15
- t as Custom,
47
+ i as Custom,
16
48
  o as Default,
17
49
  e as Items,
18
- s as default
50
+ t as default
19
51
  };
@@ -76,7 +76,8 @@ const e = {
76
76
  "The data source link is unavailable. Please, make sure there is an access to the data source.": "Enter an accessible Data Source Link to contiue.",
77
77
  "The file should not exceed the maximum resolution of {maxImageResolution}px.": "Upload files up to 1024x512 pixels to continue.",
78
78
  "The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor.",
79
- "Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit."
79
+ "Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit.",
80
+ 'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum</a>': 'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum.</a>'
80
81
  };
81
82
  export {
82
83
  e as default
@@ -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
+ };