@useinsider/guido 3.18.2-beta.eedafd2 → 3.18.2-beta.fc246a7

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 (65) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +26 -28
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +51 -53
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  10. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  11. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  12. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  13. package/dist/composables/useHtmlCompiler.js +26 -37
  14. package/dist/composables/useHtmlValidator.js +0 -2
  15. package/dist/composables/useHttp.js +22 -24
  16. package/dist/composables/useSave.js +45 -90
  17. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  18. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  19. package/dist/config/migrator/itemsBlockMigrator.js +257 -167
  20. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  22. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  23. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  24. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  25. package/dist/extensions/Blocks/Items/template.js +219 -204
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +36 -43
  27. package/dist/guido.css +1 -1
  28. package/dist/services/templateLibraryApi.js +14 -17
  29. package/dist/src/@types/config/schemas.d.ts +0 -4
  30. package/dist/src/components/Guido.vue.d.ts +1 -17
  31. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  32. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  33. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  34. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  35. package/dist/src/composables/useConfig.d.ts +0 -2
  36. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  37. package/dist/src/composables/useSave.d.ts +1 -6
  38. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  39. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  40. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  41. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  42. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  44. package/dist/src/stores/config.d.ts +0 -30
  45. package/dist/src/utils/genericUtil.d.ts +0 -6
  46. package/dist/src/utils/templatePreparation.d.ts +0 -30
  47. package/dist/stores/config.js +22 -39
  48. package/dist/utils/genericUtil.js +54 -63
  49. package/dist/utils/pairProductVariables.js +71 -71
  50. package/dist/utils/templatePreparation.js +45 -49
  51. package/package.json +1 -1
  52. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  53. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  54. package/dist/composables/useSaveValidation.js +0 -279
  55. package/dist/composables/useSaveValidationRollout.js +0 -9
  56. package/dist/enums/save-validation.js +0 -4
  57. package/dist/src/@types/save-validation.d.ts +0 -19
  58. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  59. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  60. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  61. package/dist/src/enums/save-validation.d.ts +0 -27
  62. package/dist/src/stores/save-validation.d.ts +0 -22
  63. package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
  64. package/dist/stores/save-validation.js +0 -30
  65. package/dist/utils/liquidDynamicContent.js +0 -15
@@ -1,100 +1,100 @@
1
- import { ITEMS_CURRENCY_ATTR as D, isCustomCurrencySymbol as G } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
1
+ import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
- import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
6
- const x = {
4
+ import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
+ import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
6
+ const O = {
7
7
  CART_ITEMS: "ins_apr",
8
8
  BROWSED_ITEMS: "browsed_item",
9
9
  PURCHASED_ITEMS: "purchased_item"
10
- }, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function v(S, y, b) {
10
+ }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function B(S, y, b) {
12
12
  let h = y;
13
13
  for (; h > 0 && /\s/.test(S[h - 1]); )
14
14
  h -= 1;
15
15
  return b.some((I) => S.endsWith(I, h));
16
16
  }
17
- function K(S) {
18
- const y = O(S), b = new DOMParser().parseFromString(y, "text/html");
19
- Y(b);
20
- const h = L.PAIRS_FOR_EXTENSION;
17
+ function Z(S) {
18
+ const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
+ v(b);
20
+ const h = w.PAIRS_FOR_EXTENSION;
21
21
  Object.entries(h).forEach(([n, d]) => {
22
22
  b.querySelectorAll(".ins-product-td").forEach((r) => {
23
23
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
24
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var $, H, N;
26
- const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
27
- if (u)
25
+ var $, F, D, N;
26
+ const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
27
+ if (f)
28
28
  switch (n) {
29
29
  case "imageSrc": {
30
- let e = null, s = null;
31
- if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
30
+ let e = null, a = null;
31
+ if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
32
32
  break;
33
- const a = u.DEFAULT, l = u.ATTR;
34
- if (a && e.src) {
35
- const i = e.src;
36
- a.some((_) => {
37
- const f = _.split("/").pop() || "", P = i.split("/").pop() || "";
38
- return i.includes(_) || i.includes(f) || P === f;
39
- }) && (e.src = `{{${l}_${o}}}`);
33
+ const l = f.DEFAULT, c = f.ATTR;
34
+ if (l && e.src) {
35
+ const s = e.src;
36
+ l.some((R) => {
37
+ const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
38
+ return s.includes(R) || s.includes(u) || H === u;
39
+ }) && (e.src = `{{${c}_${o}}}`);
40
40
  }
41
- const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
42
- if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
- const i = (N = h.itemLink) == null ? void 0 : N[g];
44
- if (i) {
45
- const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
46
- (f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
41
+ const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
42
+ if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
43
+ const s = (D = h.itemLink) == null ? void 0 : D[g];
44
+ if (s) {
45
+ const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
46
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
47
47
  }
48
48
  }
49
49
  break;
50
50
  }
51
51
  case "name": {
52
- const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
- t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
- const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
- if (c && l) {
56
- const i = c.href, R = `${window.location.href}${a}`;
57
- (i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
52
+ const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
53
+ t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
54
+ const i = t.closest("a") || (t.tagName === "A" ? t : null);
55
+ if (i && c) {
56
+ const s = i.href, _ = `${window.location.href}${l}`;
57
+ (s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
58
58
  }
59
59
  break;
60
60
  }
61
61
  case "price":
62
62
  case "originalPrice": {
63
- const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(D.POSITION) || "before";
64
- let R;
65
- c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
66
- const _ = e.CURRENCY;
67
- let f = `{{${R}_${o}}}`;
68
- const P = (t.getAttribute(D.SYMBOL) || "").trim(), V = G(P);
63
+ const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
64
+ let _;
65
+ i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
66
+ const R = e.CURRENCY;
67
+ let u = `{{${_}_${o}}}`;
68
+ const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
69
69
  let C = "";
70
- V ? C = P : _ && (C = `{{${_}_${o}}}`), C && (f = i === "after" ? `${f} ${C}` : `${C} ${f}`), t.innerHTML = F(t, f);
70
+ G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
71
71
  break;
72
72
  }
73
73
  case "quantity": {
74
- const e = u, s = e.ATTR, a = e.DEFAULT;
75
- t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
74
+ const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
75
+ c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
76
76
  break;
77
77
  }
78
78
  case "button": {
79
- const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
- if (l) {
81
- const c = l.href || "", i = `${window.location.href}${a}`;
82
- (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
79
+ const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
80
+ if (c) {
81
+ const i = c.href || "", s = `${window.location.href}${l}`;
82
+ (i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
83
83
  }
84
84
  break;
85
85
  }
86
86
  case "itemLink": {
87
- const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
- if (l.href) {
89
- const c = l.href, i = `${window.location.href}${a}`;
90
- (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
87
+ const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
88
+ if (c.href) {
89
+ const i = c.href, s = `${window.location.href}${l}`;
90
+ (i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
91
91
  }
92
92
  break;
93
93
  }
94
94
  default: {
95
- if ("ATTR" in u) {
96
- const e = u.ATTR;
97
- t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
95
+ if ("ATTR" in f) {
96
+ const e = f.ATTR;
97
+ t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
98
98
  }
99
99
  break;
100
100
  }
@@ -102,9 +102,9 @@ function K(S) {
102
102
  });
103
103
  });
104
104
  });
105
- const I = y.match(/<!DOCTYPE[^>]*>/i), q = I ? `${I[0]}
106
- ` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
107
- U.forEach((n) => {
105
+ const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
106
+ ` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
107
+ W.forEach((n) => {
108
108
  const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
109
109
  M.push({
110
110
  element: n,
@@ -113,38 +113,38 @@ function K(S) {
113
113
  number: p
114
114
  });
115
115
  });
116
- let A = q + b.documentElement.outerHTML;
116
+ let A = U + b.documentElement.outerHTML;
117
117
  M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
- const r = x[d], E = r ? `${r}_total_product_kind` : "";
118
+ const r = O[d], E = r ? `${r}_total_product_kind` : "";
119
119
  if (E) {
120
120
  const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
121
121
  A = A.replace(n, X(o));
122
122
  }
123
123
  });
124
- const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
- return W.forEach((n) => {
124
+ const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
+ return V.forEach((n) => {
126
126
  var t;
127
127
  const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
- if (!d || !x[p])
128
+ if (!d || !O[p])
129
129
  return;
130
130
  const r = n.closest(".product-original-price-class");
131
131
  if (!r || k.has(r))
132
132
  return;
133
133
  k.add(r);
134
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
135
- T.wrap.push(m !== "false"), w.set(E, T);
136
- }), w.forEach(({ number: n, type: d, wrap: p }, r) => {
134
+ const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
135
+ T.wrap.push(m !== "false"), L.set(E, T);
136
+ }), L.forEach(({ number: n, type: d, wrap: p }, r) => {
137
137
  if (r.includes("{% if") || !p.some(Boolean))
138
138
  return;
139
- const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
140
- let g = "", o = 0, u = 0, $ = A.indexOf(r);
139
+ const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
140
+ let g = "", o = 0, f = 0, $ = A.indexOf(r);
141
141
  for (; $ !== -1; ) {
142
- const H = p[u] === !0 && !v(A, $, t);
143
- g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
142
+ const F = p[f] === !0 && !B(A, $, t);
143
+ g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
144
144
  }
145
145
  A = g + A.slice(o);
146
146
  }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
147
  }
148
148
  export {
149
- K as pairProductVariables
149
+ Z as pairProductVariables
150
150
  };
@@ -1,31 +1,30 @@
1
- import { useActionsApi as R } from "../composables/useActionsApi.js";
1
+ import { useActionsApi as k } from "../composables/useActionsApi.js";
2
2
  import { useConfig as U } from "../composables/useConfig.js";
3
3
  import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
4
- import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
- import { useRecommendationExtensionStore as I } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
+ import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
- import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
8
- import { parsePageList as N } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
- import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
10
- import { useEditorStore as O } from "../stores/editor.js";
7
+ import { DATA_ATTRIBUTES as C } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
8
+ import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
+ import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
10
+ import { useEditorStore as z } from "../stores/editor.js";
11
11
  import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
- import { isPlainObject as v } from "./genericUtil.js";
13
- import { assignTrackingIds as M } from "./linkTrackingIds.js";
14
- function q(l) {
15
- const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), t = [];
16
- return i.forEach((c) => {
17
- const o = c.getAttribute(T.PAGE_LIST);
18
- o && t.push(...N(o));
12
+ import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
+ function O(l) {
14
+ const c = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${C.PAGE_LIST}]`), t = [];
15
+ return c.forEach((i) => {
16
+ const o = i.getAttribute(C.PAGE_LIST);
17
+ o && t.push(...R(o));
19
18
  }), [...new Set(t)];
20
19
  }
21
- async function A(l) {
22
- const a = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
23
- if (a.length === 0)
20
+ async function M(l) {
21
+ const n = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
22
+ if (n.length === 0)
24
23
  return;
25
- const i = I();
26
- a.forEach((t) => {
24
+ const c = T();
25
+ n.forEach((t) => {
27
26
  var r, d, g, f, s, y;
28
- const c = t.getAttribute("recommendation-id"), o = c ? Number(c) : NaN;
27
+ const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
29
28
  if (!Number.isFinite(o))
30
29
  return;
31
30
  const p = t.getAttribute("esd-ext-config");
@@ -37,21 +36,21 @@ async function A(l) {
37
36
  } catch {
38
37
  return;
39
38
  }
40
- if (!v(e))
39
+ if (!e || typeof e != "object" || Array.isArray(e))
41
40
  return;
42
41
  const b = {
43
42
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
44
43
  // already-saved blocks that never re-run the migrator don't emit a
45
44
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
46
- strategy: L(e.strategy) || n.strategy,
47
- strategyId: e.strategyId ?? n.strategyId,
48
- language: e.language ?? n.language,
49
- size: e.size ?? n.size,
45
+ strategy: L(e.strategy) || a.strategy,
46
+ strategyId: e.strategyId ?? a.strategyId,
47
+ language: e.language ?? a.language,
48
+ size: e.size ?? a.size,
50
49
  // Spread the default arrays so each block gets a fresh reference
51
50
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
52
- productIds: e.productIds ?? [...n.productIds],
53
- filters: e.filters ?? [...n.filters],
54
- shuffleProducts: e.shuffleProducts ?? n.shuffleProducts,
51
+ productIds: e.productIds ?? [...a.productIds],
52
+ filters: e.filters ?? [...a.filters],
53
+ shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
55
54
  currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? m.code,
56
55
  currencySymbol: ((d = e.currency) == null ? void 0 : d.symbol) ?? m.symbol,
57
56
  currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? m.alignment,
@@ -59,10 +58,10 @@ async function A(l) {
59
58
  currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? m.decimalSeparator,
60
59
  currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? m.thousandSeparator
61
60
  };
62
- i.seedBlockUrlConfig(o, b);
61
+ c.seedBlockUrlConfig(o, b);
63
62
  });
64
63
  try {
65
- await i.fetchRecommendationCreateData();
64
+ await c.fetchRecommendationCreateData();
66
65
  } catch (t) {
67
66
  console.warn(
68
67
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -70,54 +69,51 @@ async function A(l) {
70
69
  );
71
70
  }
72
71
  }
73
- const te = () => {
74
- const l = z(), u = O(), a = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: c } = R(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
72
+ const Z = () => {
73
+ const l = N(), u = z(), n = _(), { getCompiledEmail: c, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
75
74
  return {
76
75
  prepareTemplateDetails: async () => {
77
76
  let { html: r, css: d, syncModulesIds: g = [] } = await t();
78
77
  if (e("linkTrackingIds"))
79
78
  try {
80
- const { html: h, changed: H, nextSeq: k } = M(r, u.trackIdSessionFloor);
81
- u.trackIdSessionFloor = k, H && (r = h, await c(h, d));
79
+ const { html: h, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
80
+ u.trackIdSessionFloor = H, F && (r = h, await i(h, d));
82
81
  } catch (h) {
83
82
  console.error("Tracking-id step failed, saving anyway:", h);
84
83
  }
85
- const { html: f, ampHtml: s = "", ampErrors: y = [] } = await i({
84
+ const { html: f, ampHtml: s = "", ampErrors: y = [] } = await c({
86
85
  minimize: !0,
87
86
  resetDataSavedFlag: !1
88
87
  });
89
- a.selectedUnsubscribePages.length && await a.fetchTemplates(), await A(r);
90
- const { compiledHtml: w, stats: S, appliedRules: D } = o(f), P = s && p(s).compiledHtml, E = l.getSelectedDynamicContentList, F = I(), C = q(r);
88
+ n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
89
+ const { compiledHtml: I, stats: S, appliedRules: w } = o(f), D = s && p(s).compiledHtml, E = l.getSelectedDynamicContentList, P = T(), A = O(r);
91
90
  return console.debug("HTML Compilation Stats:", {
92
91
  originalSize: S.originalSize,
93
92
  compiledSize: S.compiledSize,
94
93
  reduction: `${S.reductionPercentage.toFixed(2)}%`,
95
- appliedRules: D,
94
+ appliedRules: w,
96
95
  executionTime: `${S.executionTime.toFixed(2)}ms`
97
96
  }), {
98
97
  dynamicContentList: E,
99
- compiledHtml: w,
98
+ compiledHtml: I,
100
99
  rawHtml: r,
101
100
  css: d,
102
- ampHtml: P,
101
+ ampHtml: D,
103
102
  ampErrors: y,
104
103
  modules: g.map(Number),
105
104
  recommendation: {
106
- campaignUrls: F.recommendationCampaignUrls,
105
+ campaignUrls: P.recommendationCampaignUrls,
107
106
  configs: {}
108
107
  },
109
108
  unsubscribe: {
110
- status: C.length > 0,
111
- config: C
109
+ status: A.length > 0,
110
+ config: A
112
111
  }
113
112
  };
114
- },
115
- // Exposed so the back/test validate-only path can seed the reco store the
116
- // same way a full save does (required-field findings depend on it).
117
- hydrateRecommendationStore: A
113
+ }
118
114
  };
119
115
  };
120
116
  export {
121
- q as getHtmlReferencedUnsubscribePages,
122
- te as useTemplatePreparation
117
+ O as getHtmlReferencedUnsubscribePages,
118
+ Z as useTemplatePreparation
123
119
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.2-beta.eedafd2",
3
+ "version": "3.18.2-beta.fc246a7",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,20 +0,0 @@
1
- import a from "./ValidationErrorDrawer.vue2.js";
2
- /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var i = function() {
5
- var r = this, o = r._self._c, t = r._self._setupProxy;
6
- return o(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [o("div", { staticClass: "d-f f-d-c validation-error-list" }, r._l(t.rows, function(e, n) {
7
- return o("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [o(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), o("span", { staticClass: "validation-error-row__text" }, [r._v(r._s(e))])], 1);
8
- }), 0)]);
9
- }, l = [], _ = /* @__PURE__ */ s(
10
- a,
11
- i,
12
- l,
13
- !1,
14
- null,
15
- "30d2e1f9"
16
- );
17
- const p = _.exports;
18
- export {
19
- p as default
20
- };
@@ -1,48 +0,0 @@
1
- import { defineComponent as m, ref as p, computed as a } from "vue";
2
- import f from "../../wrappers/WpDrawer.vue.js";
3
- import { useSave as S } from "../../../composables/useSave.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { useConfigStore as g } from "../../../stores/config.js";
6
- import { useEditorStore as y } from "../../../stores/editor.js";
7
- import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
8
- import { InIcons as w } from "@useinsider/design-system-vue";
9
- const I = /* @__PURE__ */ m({
10
- __name: "ValidationErrorDrawer",
11
- setup(_) {
12
- const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = p(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
13
- const t = {
14
- primaryButton: {
15
- styling: "solid",
16
- type: "primary",
17
- labelText: r("email-editor.update-design")
18
- }
19
- };
20
- return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
21
- styling: "solid",
22
- type: "subtle-primary",
23
- labelText: r("email-editor.save-and-continue"),
24
- loadingStatus: o.value
25
- }), t;
26
- }), d = a(() => e.errors.map((t) => {
27
- const c = t.detail ? ` (${t.detail})` : "";
28
- return `${t.message}${c}`;
29
- }));
30
- return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
31
- e.isDrawerOpen && e.close();
32
- }, handleSaveAndContinue: async () => {
33
- if (!o.value) {
34
- o.value = !0, n.loadingStatus = !0;
35
- try {
36
- await i() ? e.close() : n.loadingStatus = !1;
37
- } catch (t) {
38
- console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
39
- } finally {
40
- o.value = !1;
41
- }
42
- }
43
- }, WpDrawer: f, InIcons: w };
44
- }
45
- });
46
- export {
47
- I as default
48
- };