@useinsider/guido 3.16.0-beta.1fe8cea → 3.16.0-beta.2b04988

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 (58) hide show
  1. package/dist/components/Guido.vue.js +8 -8
  2. package/dist/components/Guido.vue2.js +76 -78
  3. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  4. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  5. package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +23 -46
  8. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  9. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  10. package/dist/composables/useHtmlValidator.js +0 -1
  11. package/dist/composables/useRecommendation.js +20 -19
  12. package/dist/composables/useSave.js +41 -84
  13. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  14. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  15. package/dist/config/migrator/itemsBlockMigrator.js +1 -1
  16. package/dist/enums/recommendation.js +17 -17
  17. package/dist/extensions/Blocks/Items/block.js +98 -49
  18. package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
  19. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  20. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  21. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
  22. package/dist/extensions/Blocks/Items/template.js +153 -152
  23. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
  24. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +21 -21
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -32
  26. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  27. package/dist/guido.css +1 -1
  28. package/dist/src/components/Guido.vue.d.ts +1 -17
  29. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  30. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  31. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  32. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  33. package/dist/src/composables/useHtmlValidator.d.ts +0 -14
  34. package/dist/src/composables/useSave.d.ts +1 -6
  35. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  36. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  37. package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
  38. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
  39. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  40. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  41. package/dist/src/stores/config.d.ts +0 -5
  42. package/dist/src/utils/templatePreparation.d.ts +0 -30
  43. package/dist/stores/config.js +6 -13
  44. package/dist/utils/pairProductVariables.js +60 -59
  45. package/dist/utils/templatePreparation.js +25 -28
  46. package/package.json +1 -1
  47. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  48. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  49. package/dist/composables/useSaveValidation.js +0 -276
  50. package/dist/composables/useSaveValidationRollout.js +0 -9
  51. package/dist/enums/save-validation.js +0 -4
  52. package/dist/src/@types/save-validation.d.ts +0 -19
  53. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  54. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  55. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  56. package/dist/src/enums/save-validation.d.ts +0 -27
  57. package/dist/src/stores/save-validation.d.ts +0 -22
  58. package/dist/stores/save-validation.js +0 -30
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Single owner for the Items price currency export contract (SD-147588).
3
+ *
4
+ * `data-curency` is deliberately misspelled (one `r`) — it is the attribute the
5
+ * server-side export transform (pairProductVariables) actually reads, so every
6
+ * layer that writes it and the live reader (template, controls, block self-heal,
7
+ * pairProductVariables) MUST go through these constants. A typo fix or mapping change
8
+ * in one of them would otherwise silently break sync with the others and ship the wrong
9
+ * currency position/token to the inbox. Mirrors the Recommendation block's `CURRENCY_ATTR`.
10
+ *
11
+ * Exception: the legacy migrator reads the raw misspelled string on purpose — it parses
12
+ * old templates frozen with that exact attr name, so it must NOT follow a future rename here.
13
+ */
14
+ export declare const ITEMS_CURRENCY_ATTR: {
15
+ readonly POSITION: "data-curency";
16
+ readonly SYMBOL: "data-currency_symbol";
17
+ };
18
+ /** Currency location select value `'1'` = after (price then symbol), anything else = before. */
19
+ export declare function currencyPositionFromLocation(location: string | undefined): 'after' | 'before';
@@ -286,11 +286,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
286
286
  * every block's recommendationConfigs across user edits.
287
287
  */
288
288
  hasInvalidBlock(): boolean;
289
- /**
290
- * Per-instance counterpart to `hasInvalidBlock`: the ids of every block
291
- * that fails required-field validation, one drawer row each (SD-147430).
292
- */
293
- invalidBlockIds(): string[];
294
289
  fetchRecommendationProducts(): Promise<void>;
295
290
  _doFetchProducts(): Promise<void>;
296
291
  }>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Builds the request/URL `productId` value from raw product ID segments.
3
+ * Trimming happens here — NOT on input change — so the user's in-progress
4
+ * text (trailing commas, spaces) is never rewritten under the caret (SD-147111).
5
+ */
6
+ export declare function sanitizeProductIds(ids: readonly (string | number | null | undefined)[]): string;
@@ -2106,11 +2106,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2106
2106
  };
2107
2107
  } | null;
2108
2108
  } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
2109
- /**
2110
- * Transactional campaigns keep the hard save block. Reactive getter, so
2111
- * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
2112
- */
2113
- isTransactional(): boolean;
2114
2109
  /**
2115
2110
  * Get the username
2116
2111
  */
@@ -15,36 +15,6 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
15
15
  * same source), so it is reliably present regardless of how the block was added.
16
16
  */
17
17
  export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
18
- /**
19
- * Hydrates the recommendation extension store from the persisted `esd-ext-config`
20
- * JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
21
- *
22
- * Why this runs before `compileHtml`:
23
- * The HTML compiler's `prepareRecommendationBlocks` rule asks
24
- * `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
25
- * from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
26
- * populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
27
- * only fires when the user *selects* the block. Saving without ever
28
- * selecting a migrated block would otherwise build the URL from empty/
29
- * default state and the campaign URL would not be saved.
30
- *
31
- * Why we read raw HTML, not compiled HTML:
32
- * Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
33
- * compiled output, so `esd-ext-config` is gone by the time the compiler
34
- * pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
35
- * the attribute as the migrator wrote it.
36
- *
37
- * Reference data pre-load:
38
- * When the template has recommendation blocks, this also pre-loads the
39
- * shared reference data (languages / currency list) so the save-time
40
- * required-fields validator can check each block's locale and currency
41
- * against the partner's real options. Best-effort — on a fetch failure the
42
- * validator degrades to its empty-list guard (`requiredFields.ts`) instead
43
- * of blocking the save or stranding the Save button.
44
- */
45
- declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
46
18
  export declare const useTemplatePreparation: () => {
47
19
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
- hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
49
20
  };
50
- export {};
@@ -1,8 +1,8 @@
1
- import { MessageType as o } from "../@types/config/schemas.js";
1
+ import "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as r } from "../@types/config/validator.js";
4
- import { defineStore as a } from "pinia";
5
- const g = a("guido-config", {
3
+ import { parseConfig as o } from "../@types/config/validator.js";
4
+ import { defineStore as r } from "pinia";
5
+ const f = r("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -113,13 +113,6 @@ const g = a("guido-config", {
113
113
  var e, n;
114
114
  return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
115
115
  },
116
- /**
117
- * Transactional campaigns keep the hard save block. Reactive getter, so
118
- * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
119
- */
120
- isTransactional() {
121
- return this.messageType === o.TRANSACTIONAL;
122
- },
123
116
  /**
124
117
  * Get the username
125
118
  */
@@ -150,7 +143,7 @@ const g = a("guido-config", {
150
143
  * Initialize the config store with validated configuration
151
144
  */
152
145
  init(i) {
153
- const e = r(i);
146
+ const e = o(i);
154
147
  this.config = e, this.initialized = !0;
155
148
  },
156
149
  /**
@@ -162,5 +155,5 @@ const g = a("guido-config", {
162
155
  }
163
156
  });
164
157
  export {
165
- g as useConfigStore
158
+ f as useConfigStore
166
159
  };
@@ -1,82 +1,83 @@
1
+ import { ITEMS_CURRENCY_ATTR as N } from "../extensions/Blocks/Items/constants/currency.js";
1
2
  import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- import { DefaultConfigValues as V } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { escapeReplacement as G } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
3
+ import { DefaultConfigValues as G } from "../extensions/Blocks/Items/enums/settingsEnums.js";
4
+ import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
5
  import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
6
7
  const x = {
7
8
  CART_ITEMS: "ins_apr",
8
9
  BROWSED_ITEMS: "browsed_item",
9
10
  PURCHASED_ITEMS: "purchased_item"
10
- }, N = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function v(S, H, g) {
12
- let $ = H;
13
- for (; $ > 0 && /\s/.test(S[$ - 1]); )
14
- $ -= 1;
15
- return g.some((I) => S.endsWith(I, $));
11
+ }, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
+ function v(S, I, b) {
13
+ let h = I;
14
+ for (; h > 0 && /\s/.test(S[h - 1]); )
15
+ h -= 1;
16
+ return b.some((P) => S.endsWith(P, h));
16
17
  }
17
- function J(S) {
18
- const H = N(S), g = new DOMParser().parseFromString(H, "text/html");
19
- X(g);
20
- const $ = L.PAIRS_FOR_EXTENSION;
21
- Object.entries($).forEach(([n, d]) => {
22
- g.querySelectorAll(".ins-product-td").forEach((r) => {
18
+ function Z(S) {
19
+ const I = O(S), b = new DOMParser().parseFromString(I, "text/html");
20
+ Y(b);
21
+ const h = L.PAIRS_FOR_EXTENSION;
22
+ Object.entries(h).forEach(([n, d]) => {
23
+ b.querySelectorAll(".ins-product-td").forEach((r) => {
23
24
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
25
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var T, P, D;
26
- const R = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[R];
27
- if (f)
26
+ var $, H, D;
27
+ const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
28
+ if (u)
28
29
  switch (n) {
29
30
  case "imageSrc": {
30
31
  let e = null, s = null;
31
32
  if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
32
33
  break;
33
- const a = f.DEFAULT, l = f.ATTR;
34
+ const a = u.DEFAULT, l = u.ATTR;
34
35
  if (a && e.src) {
35
36
  const i = e.src;
36
- a.some((b) => {
37
- const u = b.split("/").pop() || "", y = i.split("/").pop() || "";
38
- return i.includes(b) || i.includes(u) || y === u;
37
+ a.some((_) => {
38
+ const f = _.split("/").pop() || "", C = i.split("/").pop() || "";
39
+ return i.includes(_) || i.includes(f) || C === f;
39
40
  }) && (e.src = `{{${l}_${o}}}`);
40
41
  }
41
- const c = (P = (T = $.name) == null ? void 0 : T[R]) == null ? void 0 : P.ATTR;
42
+ const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
42
43
  if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
- const i = (D = $.itemLink) == null ? void 0 : D[R];
44
+ const i = (D = h.itemLink) == null ? void 0 : D[g];
44
45
  if (i) {
45
- const _ = i.HREF, b = i.DEFAULT_HREF || "#!", u = s.href;
46
- (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(b) || u === `${window.location.href}${b}` || !u || u === window.location.href) && (s.href = `{{${_}_${o}}}`);
46
+ const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
47
+ (f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
47
48
  }
48
49
  }
49
50
  break;
50
51
  }
51
52
  case "name": {
52
- const e = f, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
+ const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
54
  t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
55
  const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
56
  if (c && l) {
56
- const i = c.href, _ = `${window.location.href}${a}`;
57
- (i === _ || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
57
+ const i = c.href, R = `${window.location.href}${a}`;
58
+ (i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
58
59
  }
59
60
  break;
60
61
  }
61
62
  case "price":
62
63
  case "originalPrice": {
63
- const e = f, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute("data-curency") || "before";
64
- let _;
65
- c ? _ = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = l ? e.PRICE_FORMATTED : e.PRICE;
66
- const b = e.CURRENCY;
67
- let u = `{{${_}_${o}}}`;
68
- const y = (t.getAttribute("data-currency_symbol") || "").trim(), W = y !== "" && y !== V.productPriceCurrencySymbolControlValue;
69
- let C = "";
70
- W ? C = y : b && (C = `{{${b}_${o}}}`), C && (u = i === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = F(t, u);
64
+ const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(N.POSITION) || "before";
65
+ let R;
66
+ c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
67
+ const _ = e.CURRENCY;
68
+ let f = `{{${R}_${o}}}`;
69
+ const C = (t.getAttribute(N.SYMBOL) || "").trim(), V = C !== "" && C !== G.productPriceCurrencySymbolControlValue;
70
+ let y = "";
71
+ V ? y = C : _ && (y = `{{${_}_${o}}}`), y && (f = i === "after" ? `${f} ${y}` : `${y} ${f}`), t.innerHTML = F(t, f);
71
72
  break;
72
73
  }
73
74
  case "quantity": {
74
- const e = f, s = e.ATTR, a = e.DEFAULT;
75
+ const e = u, s = e.ATTR, a = e.DEFAULT;
75
76
  t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
76
77
  break;
77
78
  }
78
79
  case "button": {
79
- const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
+ const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
81
  if (l) {
81
82
  const c = l.href || "", i = `${window.location.href}${a}`;
82
83
  (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
@@ -84,7 +85,7 @@ function J(S) {
84
85
  break;
85
86
  }
86
87
  case "itemLink": {
87
- const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
+ const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
89
  if (l.href) {
89
90
  const c = l.href, i = `${window.location.href}${a}`;
90
91
  (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
@@ -92,8 +93,8 @@ function J(S) {
92
93
  break;
93
94
  }
94
95
  default: {
95
- if ("ATTR" in f) {
96
- const e = f.ATTR;
96
+ if ("ATTR" in u) {
97
+ const e = u.ATTR;
97
98
  t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
98
99
  }
99
100
  break;
@@ -102,9 +103,9 @@ function J(S) {
102
103
  });
103
104
  });
104
105
  });
105
- const I = H.match(/<!DOCTYPE[^>]*>/i), O = I ? `${I[0]}
106
- ` : "", q = g.querySelectorAll(".ins-product-td"), M = [];
107
- q.forEach((n) => {
106
+ const P = I.match(/<!DOCTYPE[^>]*>/i), q = P ? `${P[0]}
107
+ ` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
108
+ U.forEach((n) => {
108
109
  const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
109
110
  M.push({
110
111
  element: n,
@@ -113,16 +114,16 @@ function J(S) {
113
114
  number: p
114
115
  });
115
116
  });
116
- let A = O + g.documentElement.outerHTML;
117
+ let A = q + b.documentElement.outerHTML;
117
118
  M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
119
  const r = x[d], E = r ? `${r}_total_product_kind` : "";
119
120
  if (E) {
120
- const h = parseInt(p) - 1, o = `${`{% if ${E} > ${h} %}`}${n}{% endif %}`;
121
- A = A.replace(n, G(o));
121
+ const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
122
+ A = A.replace(n, X(o));
122
123
  }
123
124
  });
124
- const U = g.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
- return U.forEach((n) => {
125
+ const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
126
+ return W.forEach((n) => {
126
127
  var t;
127
128
  const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
129
  if (!d || !x[p])
@@ -131,20 +132,20 @@ function J(S) {
131
132
  if (!r || k.has(r))
132
133
  return;
133
134
  k.add(r);
134
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), h = w.get(E) ?? { number: d, type: p, wrap: [] };
135
- h.wrap.push(m !== "false"), w.set(E, h);
135
+ 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: [] };
136
+ T.wrap.push(m !== "false"), w.set(E, T);
136
137
  }), w.forEach(({ number: n, type: d, wrap: p }, r) => {
137
138
  if (r.includes("{% if") || !p.some(Boolean))
138
139
  return;
139
- const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, h = `{% if ${E}_${n} != ${m}_${n} %}`, t = [h, N(h)];
140
- let R = "", o = 0, f = 0, T = A.indexOf(r);
141
- for (; T !== -1; ) {
142
- const P = p[f] === !0 && !v(A, T, t);
143
- R += A.slice(o, T) + (P ? `${h}${r}{% endif %}` : r), o = T + r.length, f += 1, T = A.indexOf(r, o);
140
+ 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)];
141
+ let g = "", o = 0, u = 0, $ = A.indexOf(r);
142
+ for (; $ !== -1; ) {
143
+ const H = p[u] === !0 && !v(A, $, t);
144
+ g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
144
145
  }
145
- A = R + A.slice(o);
146
+ A = g + A.slice(o);
146
147
  }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
148
  }
148
149
  export {
149
- J as pairProductVariables
150
+ Z as pairProductVariables
150
151
  };
@@ -1,27 +1,27 @@
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
4
  import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
- import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
7
  import { DATA_ATTRIBUTES as A } 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 _ } from "../stores/editor.js";
11
- import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
12
- import { assignTrackingIds as O } from "./linkTrackingIds.js";
13
- function M(m) {
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
+ import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
+ import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
+ function O(m) {
14
14
  const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
15
  return n.forEach((i) => {
16
16
  const o = i.getAttribute(A.PAGE_LIST);
17
- o && t.push(...N(o));
17
+ o && t.push(...R(o));
18
18
  }), [...new Set(t)];
19
19
  }
20
- async function C(m) {
20
+ async function M(m) {
21
21
  const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
22
  if (a.length === 0)
23
23
  return;
24
- const n = T();
24
+ const n = C();
25
25
  a.forEach((t) => {
26
26
  var r, l, g, f, c;
27
27
  const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
@@ -68,39 +68,39 @@ async function C(m) {
68
68
  }
69
69
  }
70
70
  const Z = () => {
71
- const m = z(), u = _(), a = v(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = R(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
71
+ const m = N(), u = z(), a = _(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
72
72
  return {
73
73
  prepareTemplateDetails: async () => {
74
74
  let { html: r, css: l, syncModulesIds: g = [] } = await t();
75
75
  if (e("linkTrackingIds"))
76
76
  try {
77
- const { html: y, changed: I, nextSeq: k } = O(r, u.trackIdSessionFloor);
78
- u.trackIdSessionFloor = k, I && (r = y, await i(y, l));
77
+ const { html: y, changed: H, nextSeq: I } = v(r, u.trackIdSessionFloor);
78
+ u.trackIdSessionFloor = I, H && (r = y, await i(y, l));
79
79
  } catch (y) {
80
80
  console.error("Tracking-id step failed, saving anyway:", y);
81
81
  }
82
- const { html: f, ampHtml: c = "", ampErrors: w = [] } = await n({
82
+ const { html: f, ampHtml: c = "", ampErrors: T = [] } = await n({
83
83
  minimize: !0,
84
84
  resetDataSavedFlag: !1
85
85
  });
86
- a.selectedUnsubscribePages.length && await a.fetchTemplates(), await C(r);
87
- const { compiledHtml: D, stats: S, appliedRules: E } = o(f), P = c && p(c).compiledHtml, F = m.getSelectedDynamicContentList, H = T(), b = M(r);
86
+ a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(r);
87
+ const { compiledHtml: w, stats: S, appliedRules: D } = o(f), E = c && p(c).compiledHtml, P = m.getSelectedDynamicContentList, F = C(), b = O(r);
88
88
  return console.debug("HTML Compilation Stats:", {
89
89
  originalSize: S.originalSize,
90
90
  compiledSize: S.compiledSize,
91
91
  reduction: `${S.reductionPercentage.toFixed(2)}%`,
92
- appliedRules: E,
92
+ appliedRules: D,
93
93
  executionTime: `${S.executionTime.toFixed(2)}ms`
94
94
  }), {
95
- dynamicContentList: F,
96
- compiledHtml: D,
95
+ dynamicContentList: P,
96
+ compiledHtml: w,
97
97
  rawHtml: r,
98
98
  css: l,
99
- ampHtml: P,
100
- ampErrors: w,
99
+ ampHtml: E,
100
+ ampErrors: T,
101
101
  modules: g.map(Number),
102
102
  recommendation: {
103
- campaignUrls: H.recommendationCampaignUrls,
103
+ campaignUrls: F.recommendationCampaignUrls,
104
104
  configs: {}
105
105
  },
106
106
  unsubscribe: {
@@ -108,13 +108,10 @@ const Z = () => {
108
108
  config: b
109
109
  }
110
110
  };
111
- },
112
- // Exposed so the back/test validate-only path can seed the reco store the
113
- // same way a full save does (required-field findings depend on it).
114
- hydrateRecommendationStore: C
111
+ }
115
112
  };
116
113
  };
117
114
  export {
118
- M as getHtmlReferencedUnsubscribePages,
115
+ O as getHtmlReferencedUnsubscribePages,
119
116
  Z as useTemplatePreparation
120
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.16.0-beta.1fe8cea",
3
+ "version": "3.16.0-beta.2b04988",
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
- "cdf0f8c8"
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 s } 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 _ } from "../../../stores/save-validation.js";
8
- import { InIcons as C } from "@useinsider/design-system-vue";
9
- const O = /* @__PURE__ */ m({
10
- __name: "ValidationErrorDrawer",
11
- setup(h) {
12
- const r = v(), t = _(), n = y(), a = g(), { saveWithErrors: i } = S(), o = p(!1), l = s(() => `${r("email-editor.validation-errors")} (${t.errorCount})`), u = s(() => {
13
- const e = {
14
- primaryButton: {
15
- styling: "solid",
16
- type: "primary",
17
- labelText: r("email-editor.update-design")
18
- }
19
- };
20
- return !a.isTransactional && t.intent !== "test" && (e.secondaryButton = {
21
- styling: "solid",
22
- type: "subtle-primary",
23
- labelText: r("email-editor.save-and-continue"),
24
- loadingStatus: o.value
25
- }), e;
26
- }), d = s(() => t.errors.map((e) => {
27
- const c = e.detail ? ` (${e.detail})` : "";
28
- return `${e.message}${c}`;
29
- }));
30
- return { __sfc: !0, trans: r, store: t, editorStore: n, configStore: a, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
31
- t.isDrawerOpen && t.close();
32
- }, handleSaveAndContinue: async () => {
33
- if (!o.value) {
34
- o.value = !0, n.loadingStatus = !0;
35
- try {
36
- await i() ? t.close() : n.loadingStatus = !1;
37
- } catch {
38
- n.loadingStatus = !1;
39
- } finally {
40
- o.value = !1;
41
- }
42
- }
43
- }, WpDrawer: f, InIcons: C };
44
- }
45
- });
46
- export {
47
- O as default
48
- };