@useinsider/guido 3.20.0 → 3.20.1-beta.10fbbe9

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 (36) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +25 -24
  3. package/dist/config/compiler/itemsCompilerRules.js +21 -5
  4. package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
  5. package/dist/config/migrator/itemsBlockMigrator.js +112 -108
  6. package/dist/extensions/Blocks/Items/block.js +78 -67
  7. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  8. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  9. package/dist/extensions/Blocks/Recommendation/block.js +51 -44
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
  11. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +90 -73
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  13. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +122 -90
  14. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  15. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
  16. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
  17. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +46 -25
  18. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +40 -17
  19. package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
  20. package/dist/guido.css +1 -1
  21. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
  22. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  23. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  24. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  25. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
  26. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  27. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +18 -5
  28. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  29. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
  30. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
  31. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  32. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
  33. package/dist/src/utils/liquidProtection.d.ts +3 -0
  34. package/dist/utils/liquidProtection.js +5 -0
  35. package/dist/utils/templatePreparation.js +61 -85
  36. package/package.json +1 -1
@@ -12,7 +12,7 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "1b5c844a"
15
+ "44a22ef1"
16
16
  );
17
17
  const v = n.exports;
18
18
  export {
@@ -11,25 +11,26 @@ import { migrate as V } from "../config/migrator/index.js";
11
11
  import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
12
12
  import { RIBBON_SELECTOR as Se } from "../enums/onboarding.js";
13
13
  import { useRecommendationExtensionStore as E } from "../extensions/Blocks/Recommendation/store/recommendation.js";
14
- import ve from "./organisms/AutoSaveController.vue.js";
15
- import be from "./organisms/base/AuthErrorModal.vue.js";
16
- import he from "./organisms/base/Toaster.vue.js";
17
- import Ee from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
18
- import we from "./organisms/header/HeaderWrapper.vue.js";
19
- import De from "./organisms/LoadingWrapper.vue.js";
20
- import Ce from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
21
- import ke from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
22
- import Fe from "./organisms/validation/ValidationErrorDrawer.vue.js";
23
- import { useStripoApi as Re } from "../services/stripoApi.js";
24
- import { useConfigStore as Me } from "../stores/config.js";
25
- import { useDynamicContentStore as Te } from "../stores/dynamic-content.js";
14
+ import { disposeUnsubscribeListeners as ve } from "../extensions/Blocks/Unsubscribe/block.js";
15
+ import be from "./organisms/AutoSaveController.vue.js";
16
+ import he from "./organisms/base/AuthErrorModal.vue.js";
17
+ import Ee from "./organisms/base/Toaster.vue.js";
18
+ import we from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
19
+ import De from "./organisms/header/HeaderWrapper.vue.js";
20
+ import Ce from "./organisms/LoadingWrapper.vue.js";
21
+ import ke from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
22
+ import Fe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
23
+ import Re from "./organisms/validation/ValidationErrorDrawer.vue.js";
24
+ import { useStripoApi as Me } from "../services/stripoApi.js";
25
+ import { useConfigStore as Te } from "../stores/config.js";
26
+ import { useDynamicContentStore as Ie } from "../stores/dynamic-content.js";
26
27
  import { useEditorStore as w } from "../stores/editor.js";
27
- import { usePreviewStore as Ie } from "../stores/preview.js";
28
- import { useSaveValidationStore as Le } from "../stores/save-validation.js";
29
- import { useTemplateStore as Ue } from "../stores/template.js";
30
- import { useUnsubscribeStore as Ae } from "../stores/unsubscribe.js";
28
+ import { usePreviewStore as Le } from "../stores/preview.js";
29
+ import { useSaveValidationStore as Ue } from "../stores/save-validation.js";
30
+ import { useTemplateStore as Ae } from "../stores/template.js";
31
+ import { useUnsubscribeStore as Be } from "../stores/unsubscribe.js";
31
32
  import { readTrackFloor as z } from "../utils/linkTrackingIds.js";
32
- const lt = /* @__PURE__ */ se({
33
+ const pt = /* @__PURE__ */ se({
33
34
  __name: "Guido",
34
35
  props: {
35
36
  config: null,
@@ -47,9 +48,9 @@ const lt = /* @__PURE__ */ se({
47
48
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
48
49
  ), X = m(
49
50
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
50
- ), D = W(), f = W(), y = Te(), C = Ae(), o = Me();
51
+ ), D = W(), f = W(), y = Ie(), C = Be(), o = Te();
51
52
  s.ready && o.init(s.config);
52
- const c = w(), Y = Ie(), l = p(() => c.hasChanges), { isTestPartner: Z } = pe(), { isEnabled: ee } = fe(), k = () => {
53
+ const c = w(), Y = Le(), l = p(() => c.hasChanges), { isTestPartner: Z } = pe(), { isEnabled: ee } = fe(), k = () => {
53
54
  var t;
54
55
  return (t = D.value) == null ? void 0 : t.handleSave(!0);
55
56
  }, F = (t) => {
@@ -68,7 +69,7 @@ const lt = /* @__PURE__ */ se({
68
69
  };
69
70
  }, { initPlugin: R, preloadRuntime: M } = ye(), { runExclusive: T, beginMount: I, isCurrentMount: S } = me();
70
71
  let u = 0;
71
- const { getDefaultTemplate: L } = Re(), { cloneTimersOnSave: U, hasTimerBlocks: A } = ge(), te = p(() => {
72
+ const { getDefaultTemplate: L } = Me(), { cloneTimersOnSave: U, hasTimerBlocks: A } = ge(), te = p(() => {
72
73
  var t;
73
74
  return !((t = o.ui) != null && t.showHeader);
74
75
  }), oe = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ne = p(
@@ -137,7 +138,7 @@ const lt = /* @__PURE__ */ se({
137
138
  };
138
139
  return ie(async () => {
139
140
  var e;
140
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), E().$reset(), w().$reset(), Ue().$reset(), Le().$reset(), b();
141
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), E().$reset(), w().$reset(), Ae().$reset(), Ue().$reset(), b();
141
142
  const t = (e = f.value) == null ? void 0 : e.parentElement;
142
143
  if (t && (i = new ResizeObserver(b), i.observe(t)), M(), s.ready)
143
144
  await h();
@@ -148,7 +149,7 @@ const lt = /* @__PURE__ */ se({
148
149
  }
149
150
  document.addEventListener("dynamic-content:open", v);
150
151
  }), ce(() => {
151
- if (i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), E().disposeStrategyPageReturn(), S(u))
152
+ if (ve(), i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), E().disposeStrategyPageReturn(), S(u))
152
153
  try {
153
154
  w().isStripoInitialized = !1;
154
155
  } catch (t) {
@@ -170,9 +171,9 @@ const lt = /* @__PURE__ */ se({
170
171
  hasChanges: l,
171
172
  saveSilent: k,
172
173
  setLoading: F
173
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: D, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, isSaveValidationEnabled: ee, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: R, preloadRuntime: M, runExclusive: T, beginMount: I, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: L, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: te, isRrsEnabled: oe, hasAssignedStrategy: ne, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: ve, AuthErrorModal: be, Toaster: he, FilterSelectionDrawer: Ee, HeaderWrapper: we, LoadingWrapper: De, SaveAsTemplateDrawer: Ce, UnsubscribeWrapper: ke, ValidationErrorDrawer: Fe };
174
+ }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: D, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, isSaveValidationEnabled: ee, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: R, preloadRuntime: M, runExclusive: T, beginMount: I, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: L, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: te, isRrsEnabled: oe, hasAssignedStrategy: ne, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: be, AuthErrorModal: he, Toaster: Ee, FilterSelectionDrawer: we, HeaderWrapper: De, LoadingWrapper: Ce, SaveAsTemplateDrawer: ke, UnsubscribeWrapper: Fe, ValidationErrorDrawer: Re };
174
175
  }
175
176
  });
176
177
  export {
177
- lt as default
178
+ pt as default
178
179
  };
@@ -1,6 +1,15 @@
1
1
  import { pairProductVariables as o } from "../../utils/pairProductVariables.js";
2
- import { wrapHiddenPriceTdsForOutlook as r, MSO_ITEMS_HIDE_START as e, MSO_ITEMS_HIDE_END as t } from "./utils/itemsCompilerUtils.js";
3
- const a = [
2
+ import { normalizeItemsBlockWidths as r, wrapHiddenPriceTdsForOutlook as t, lockHorizontalItemImageWidths as e, MSO_ITEMS_HIDE_START as s, MSO_ITEMS_HIDE_END as p } from "./utils/itemsCompilerUtils.js";
3
+ const c = [
4
+ {
5
+ id: "normalize-items-block-widths",
6
+ // Runs before the other items rules so they see non-zero widths; not AMP-safe.
7
+ description: "Normalize zero Items card widths in the compiled email",
8
+ type: "custom",
9
+ processor: r,
10
+ priority: 55
11
+ // Before pair-product-variables (60)
12
+ },
4
13
  {
5
14
  id: "pair-product-variables",
6
15
  description: "Replace product default values with template variables",
@@ -16,20 +25,27 @@ const a = [
16
25
  // with safe placeholder comments and collapse them inline for web-engine Outlook.
17
26
  description: "Mark hidden Items price tds for Outlook conditional hiding",
18
27
  type: "custom",
19
- processor: r,
28
+ processor: t,
20
29
  priority: 65
21
30
  // After pair-product-variables (60), before outlook rules (70+)
22
31
  },
32
+ {
33
+ id: "lock-horizontal-item-image-widths",
34
+ description: "Pin horizontal Items thumbnails to their width so narrow rows cannot collapse them",
35
+ type: "custom",
36
+ processor: e,
37
+ priority: 66
38
+ },
23
39
  {
24
40
  id: "swap-items-mso-markers",
25
41
  // Injecting the delicate `<!-- -->` ghost token LAST (after reco minify P99
26
42
  // and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
27
43
  description: "Swap Items MSO markers into [if !mso] conditional comments",
28
44
  type: "custom",
29
- processor: (i) => i.replaceAll(`<!--${e}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${t}-->`, "<!--<![endif]-->"),
45
+ processor: (i) => i.replaceAll(`<!--${s}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${p}-->`, "<!--<![endif]-->"),
30
46
  priority: 101
31
47
  }
32
48
  ];
33
49
  export {
34
- a as itemsCompilerRules
50
+ c as itemsCompilerRules
35
51
  };
@@ -1,28 +1,75 @@
1
- const p = "MSO_ITEMS_HIDE_START", E = "MSO_ITEMS_HIDE_END", u = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", _ = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price";
2
- function T(t) {
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) {
3
6
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
4
7
  return t;
5
- const i = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(i, "text/html");
8
+ const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
6
9
  let n = !1;
7
- if (r.querySelectorAll(_).forEach((e) => {
8
- var s, a;
9
- const o = e.getAttribute("style") || "";
10
- if (!/display\s*:\s*none/i.test(o))
10
+ if (o.querySelectorAll(I).forEach((e) => {
11
+ var d, u;
12
+ const r = e.getAttribute("style") || "";
13
+ if (!/display\s*:\s*none/i.test(r))
11
14
  return;
12
- const c = e.previousSibling;
13
- if (((c == null ? void 0 : c.nodeType) !== Node.COMMENT_NODE || c.data !== p) && ((s = e.parentNode) == null || s.insertBefore(r.createComment(p), e), (a = e.parentNode) == null || a.insertBefore(r.createComment(E), e.nextSibling)), !/mso-hide/i.test(o)) {
14
- const d = o.trim().endsWith(";") ? " " : "; ";
15
- e.setAttribute("style", `${o}${d}${u}`);
15
+ 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}`);
16
19
  }
17
20
  n = !0;
18
21
  }), !n)
19
22
  return t;
20
- const l = i.match(/<!DOCTYPE[^>]*>/i);
21
- return ((l ? `${l[0]}
22
- ` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
23
+ const c = s.match(/<!DOCTYPE[^>]*>/i);
24
+ return ((c ? `${c[0]}
25
+ ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
26
+ }
27
+ function N(t) {
28
+ if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
29
+ return t;
30
+ const s = new DOMParser().parseFromString(p(t), "text/html");
31
+ let o = !1;
32
+ if (s.querySelectorAll(h).forEach((i) => {
33
+ const e = i.getAttribute("style") || "";
34
+ if (!E(e) && !f(i.getAttribute("width")))
35
+ 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;
43
+ }
44
+ f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
45
+ }), !o)
46
+ return t;
47
+ const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
48
+ ` : "";
49
+ return A(c + s.documentElement.outerHTML);
50
+ }
51
+ function L(t) {
52
+ if (!t.includes("product-image-class"))
53
+ return t;
54
+ const s = new DOMParser().parseFromString(p(t), "text/html");
55
+ let o = !1;
56
+ if (s.querySelectorAll(O).forEach((i) => {
57
+ 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))
60
+ 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;
63
+ }), !o)
64
+ return t;
65
+ const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
66
+ ` : "";
67
+ return A(c + s.documentElement.outerHTML);
23
68
  }
24
69
  export {
25
- E as MSO_ITEMS_HIDE_END,
26
- p as MSO_ITEMS_HIDE_START,
27
- T as wrapHiddenPriceTdsForOutlook
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
28
75
  };