@useinsider/guido 3.17.0-beta.1f18d2d → 3.17.0-beta.211abaf

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/dist/@types/config/schemas.js +15 -13
  2. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  3. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +21 -0
  4. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  5. package/dist/components/organisms/header/EditorActions.vue2.js +34 -50
  6. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  7. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +39 -0
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  10. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  11. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  12. package/dist/components/organisms/header/RightSlot.vue.js +7 -6
  13. package/dist/components/organisms/header/RightSlot.vue2.js +17 -15
  14. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  15. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  16. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +24 -0
  17. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  18. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +18 -0
  19. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +74 -0
  20. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -34
  21. package/dist/composables/useAccessibilityApi.js +31 -0
  22. package/dist/composables/useCustomInterfaceAppearance.js +31 -28
  23. package/dist/composables/useModuleDynamicContentRepair.js +37 -0
  24. package/dist/composables/useStripo.js +1 -1
  25. package/dist/config/i18n/en/labels.json.js +28 -4
  26. package/dist/config/i18n/en/tooltips.json.js +2 -1
  27. package/dist/extensions/Blocks/Items/block.js +49 -118
  28. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  29. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +11 -12
  30. package/dist/extensions/Blocks/Items/template.js +152 -153
  31. package/dist/guido.css +1 -1
  32. package/dist/node_modules/@vueuse/core/index.js +102 -0
  33. package/dist/node_modules/@vueuse/shared/index.js +40 -28
  34. package/dist/sprite.svg +6 -0
  35. package/dist/src/@types/config/schemas.d.ts +4 -0
  36. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  37. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  38. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  39. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  40. package/dist/src/composables/useAccessibilityApi.d.ts +15 -0
  41. package/dist/src/composables/useActionsApi.d.ts +2 -2
  42. package/dist/src/composables/useConfig.d.ts +2 -0
  43. package/dist/src/composables/useModuleDynamicContentRepair.d.ts +13 -0
  44. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -35
  45. package/dist/src/stores/config.d.ts +18 -0
  46. package/dist/src/stores/editor.d.ts +76 -0
  47. package/dist/src/stores/onboarding.d.ts +377 -0
  48. package/dist/src/stores/version-history.d.ts +1 -1
  49. package/dist/src/utils/timeUtil.d.ts +10 -0
  50. package/dist/static/styles/components/accessibility.css.js +140 -0
  51. package/dist/static/styles/variables.css.js +1 -0
  52. package/dist/stores/editor.js +4 -1
  53. package/dist/stores/onboarding.js +16 -11
  54. package/dist/utils/pairProductVariables.js +58 -58
  55. package/dist/utils/timeUtil.js +7 -17
  56. package/package.json +1 -1
  57. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  58. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  59. package/dist/composables/useModuleRepair.js +0 -33
  60. package/dist/extensions/Blocks/Items/constants/currency.js +0 -25
  61. package/dist/src/composables/useModuleRepair.d.ts +0 -18
  62. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +0 -43
  63. package/dist/src/utils/itemsCurrencyRepair.d.ts +0 -17
  64. package/dist/utils/itemsCurrencyRepair.js +0 -39
  65. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
@@ -1,17 +1,18 @@
1
1
  import { useOnboardingApi as s } from "../services/onboardingApi.js";
2
2
  import { defineStore as e } from "pinia";
3
- const t = () => ({
3
+ const r = () => ({
4
4
  cardIndex: 0,
5
5
  isActive: !1,
6
6
  config: []
7
7
  }), a = () => ({
8
8
  onboardings: {
9
- newVersionPopup: t(),
10
- genericOnboarding: t(),
11
- textBlockOnboarding: t(),
12
- versionHistoryOnboarding: t(),
13
- ampOnboarding: t(),
14
- itemsOnboarding: t()
9
+ newVersionPopup: r(),
10
+ genericOnboarding: r(),
11
+ textBlockOnboarding: r(),
12
+ versionHistoryOnboarding: r(),
13
+ ampOnboarding: r(),
14
+ itemsOnboarding: r(),
15
+ editorTabBarOnboarding: r()
15
16
  },
16
17
  userModalState: {},
17
18
  isFetched: !1
@@ -44,6 +45,10 @@ const t = () => ({
44
45
  const { itemsOnboarding: i } = n.onboardings;
45
46
  return i.config[i.cardIndex];
46
47
  },
48
+ getEditorTabBarCurrentCard: (n) => {
49
+ const { editorTabBarOnboarding: i } = n.onboardings;
50
+ return i.config[i.cardIndex];
51
+ },
47
52
  shouldShowOnboarding: (n) => (i) => {
48
53
  const o = n.userModalState.Guido;
49
54
  return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
@@ -72,8 +77,8 @@ const t = () => ({
72
77
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
73
78
  },
74
79
  updateCardPosition(n, i, o) {
75
- const r = this.onboardings[n].config[i];
76
- r && (r.top = o.top, r.position = o.position);
80
+ const t = this.onboardings[n].config[i];
81
+ t && (t.top = o.top, t.position = o.position);
77
82
  },
78
83
  setConfig(n, i) {
79
84
  this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
@@ -101,8 +106,8 @@ const t = () => ({
101
106
  }
102
107
  },
103
108
  async setUserModalState(n, i, o) {
104
- const { setUserModalState: r } = s();
105
- await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
109
+ const { setUserModalState: t } = s();
110
+ await t(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
106
111
  }
107
112
  }
108
113
  });
@@ -1,82 +1,82 @@
1
- import { ITEMS_CURRENCY_ATTR as D, isCustomCurrencySymbol as G } from "../extensions/Blocks/Items/constants/currency.js";
2
1
  import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
3
- import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.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";
4
4
  import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
5
+ import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
6
  const x = {
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) {
12
- let h = y;
13
- for (; h > 0 && /\s/.test(S[h - 1]); )
14
- h -= 1;
15
- return b.some((I) => S.endsWith(I, h));
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, $));
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;
21
- Object.entries(h).forEach(([n, d]) => {
22
- b.querySelectorAll(".ins-product-td").forEach((r) => {
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) => {
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 T, P, D;
26
+ const R = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[R];
27
+ if (f)
28
28
  switch (n) {
29
29
  case "imageSrc": {
30
30
  let e = null, s = null;
31
31
  if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
32
32
  break;
33
- const a = u.DEFAULT, l = u.ATTR;
33
+ const a = f.DEFAULT, l = f.ATTR;
34
34
  if (a && e.src) {
35
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;
36
+ a.some((b) => {
37
+ const u = b.split("/").pop() || "", y = i.split("/").pop() || "";
38
+ return i.includes(b) || i.includes(u) || y === u;
39
39
  }) && (e.src = `{{${l}_${o}}}`);
40
40
  }
41
- const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
41
+ const c = (P = (T = $.name) == null ? void 0 : T[R]) == null ? void 0 : P.ATTR;
42
42
  if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
- const i = (N = h.itemLink) == null ? void 0 : N[g];
43
+ const i = (D = $.itemLink) == null ? void 0 : D[R];
44
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}}}`);
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}}}`);
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;
52
+ const e = f, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
53
  t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
54
  const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
55
  if (c && l) {
56
- const i = c.href, R = `${window.location.href}${a}`;
57
- (i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
56
+ const i = c.href, _ = `${window.location.href}${a}`;
57
+ (i === _ || i.endsWith(a)) && (c.href = `{{${l}_${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, 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
69
  let C = "";
70
- V ? C = P : _ && (C = `{{${_}_${o}}}`), C && (f = i === "after" ? `${f} ${C}` : `${C} ${f}`), t.innerHTML = F(t, f);
70
+ W ? C = y : b && (C = `{{${b}_${o}}}`), C && (u = i === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = F(t, u);
71
71
  break;
72
72
  }
73
73
  case "quantity": {
74
- const e = u, s = e.ATTR, a = e.DEFAULT;
74
+ const e = f, s = e.ATTR, a = e.DEFAULT;
75
75
  t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${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");
79
+ const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
80
  if (l) {
81
81
  const c = l.href || "", i = `${window.location.href}${a}`;
82
82
  (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
@@ -84,7 +84,7 @@ function K(S) {
84
84
  break;
85
85
  }
86
86
  case "itemLink": {
87
- const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
87
+ const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
88
  if (l.href) {
89
89
  const c = l.href, i = `${window.location.href}${a}`;
90
90
  (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
@@ -92,8 +92,8 @@ function K(S) {
92
92
  break;
93
93
  }
94
94
  default: {
95
- if ("ATTR" in u) {
96
- const e = u.ATTR;
95
+ if ("ATTR" in f) {
96
+ const e = f.ATTR;
97
97
  t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
98
98
  }
99
99
  break;
@@ -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 = H.match(/<!DOCTYPE[^>]*>/i), O = I ? `${I[0]}
106
+ ` : "", q = g.querySelectorAll(".ins-product-td"), M = [];
107
+ q.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,16 +113,16 @@ function K(S) {
113
113
  number: p
114
114
  });
115
115
  });
116
- let A = q + b.documentElement.outerHTML;
116
+ let A = O + g.documentElement.outerHTML;
117
117
  M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
118
  const r = x[d], E = r ? `${r}_total_product_kind` : "";
119
119
  if (E) {
120
- const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
121
- A = A.replace(n, X(o));
120
+ const h = parseInt(p) - 1, o = `${`{% if ${E} > ${h} %}`}${n}{% endif %}`;
121
+ A = A.replace(n, G(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 U = g.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
+ return U.forEach((n) => {
126
126
  var t;
127
127
  const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
128
  if (!d || !x[p])
@@ -131,20 +131,20 @@ function K(S) {
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);
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);
136
136
  }), w.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);
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);
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);
144
144
  }
145
- A = g + A.slice(o);
145
+ A = R + A.slice(o);
146
146
  }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
147
  }
148
148
  export {
149
- K as pairProductVariables
149
+ J as pairProductVariables
150
150
  };
@@ -1,19 +1,9 @@
1
- const r = (t) => {
2
- const e = -t.getTimezoneOffset(), o = e >= 0 ? "+" : "-", n = Math.abs(e), s = Math.floor(n / 60), i = n % 60;
3
- return i === 0 ? `UTC${o}${s}` : `UTC${o}${s}:${String(i).padStart(2, "0")}`;
4
- }, a = () => {
5
- var e;
6
- const { timeZone: t } = new Intl.DateTimeFormat().resolvedOptions();
7
- return ((e = t.split("/").pop()) == null ? void 0 : e.replace(/_/g, " ")) ?? t;
8
- }, c = (t, e = !1) => {
9
- const o = t.toLocaleTimeString([], {
10
- hour: "2-digit",
11
- hour12: !1,
12
- minute: "2-digit",
13
- second: "2-digit"
14
- });
15
- return e ? `${o} (${r(t)} ${a()})` : o;
16
- };
1
+ const a = (t) => String(t).padStart(2, "0"), g = (t, e) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate(), i = (t, e = /* @__PURE__ */ new Date()) => ({
2
+ isToday: g(t, e),
3
+ time: `${a(t.getHours())}:${a(t.getMinutes())}`,
4
+ // Locale-aware order (US reads MM/DD/YYYY, TR reads DD.MM.YYYY) — mirrors formatLocalTime's Intl use.
5
+ date: t.toLocaleDateString([], { day: "2-digit", month: "2-digit", year: "numeric" })
6
+ });
17
7
  export {
18
- c as formatLocalTime
8
+ i as autoSaveTimestamp
19
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.1f18d2d",
3
+ "version": "3.17.0-beta.211abaf",
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,22 +0,0 @@
1
- import o from "./AutoSaveToggle.vue2.js";
2
- /* empty css */
3
- import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var e = this, a = e._self._c, t = e._self._setupProxy;
6
- return t.isFeatureEnabled("autosave") ? a("div", { staticClass: "d-f a-i-c mr-3 auto-save-toggle", on: { mouseenter: function(s) {
7
- t.isHovered = !0;
8
- }, mouseleave: function(s) {
9
- t.isHovered = !1;
10
- } } }, [a(t.InToggle, { attrs: { id: "guido__autosave-toggle", name: "guido-autosave-toggle", checked: t.autosaveStore.isOn, disable: t.editorStore.loadingStatus }, on: { click: t.toggle } }), a("span", { staticClass: "ml-2 auto-save-toggle__label t-c-55" }, [e._v(" " + e._s(t.trans("email-editor.auto-save")) + " ")]), t.autosaveStore.status === t.AUTOSAVE_STATUS.SAVING ? a("span", { staticClass: "ml-2 d-f a-i-c f-s-1" }, [a(t.InLoading, { attrs: { "color-class": "i-c-53", size: "16" } }), a("span", { staticClass: "ml-1 t-c-53" }, [e._v(" " + e._s(t.trans("newsletter.saving")) + " ")])], 1) : t.lastSavedLabel ? a("span", { staticClass: "ml-2 f-s-1 t-c-53" }, [e._v(" " + e._s(t.lastSavedLabel) + " ")]) : e._e(), t.isHovered ? a(t.InInfoBox, { staticClass: "auto-save-toggle__info-box", attrs: { id: "guido__autosave-info-box", size: "small", variant: "information", "description-text": t.trans("email-editor.auto-save-description"), "title-text": t.trans("email-editor.auto-save-title") } }) : e._e()], 1) : e._e();
11
- }, l = [], r = /* @__PURE__ */ i(
12
- o,
13
- n,
14
- l,
15
- !1,
16
- null,
17
- "2c964af4"
18
- );
19
- const d = r.exports;
20
- export {
21
- d as default
22
- };
@@ -1,19 +0,0 @@
1
- import { defineComponent as i, ref as f, computed as u } from "vue";
2
- import { useConfig as l } from "../../../composables/useConfig.js";
3
- import { useTranslations as p } from "../../../composables/useTranslations.js";
4
- import { useAutosaveStore as c, AUTOSAVE_STATUS as t } from "../../../stores/autosave.js";
5
- import { useEditorStore as S } from "../../../stores/editor.js";
6
- import { formatLocalTime as d } from "../../../utils/timeUtil.js";
7
- import { InToggle as g, InLoading as _, InInfoBox as A } from "@useinsider/design-system-vue";
8
- const U = /* @__PURE__ */ i({
9
- __name: "AutoSaveToggle",
10
- setup(v) {
11
- const { isFeatureEnabled: e } = l(), r = S(), o = c(), s = p(), n = f(!1), a = u(() => o.status !== t.SAVED || !o.lastSavedAt ? "" : d(o.lastSavedAt));
12
- return { __sfc: !0, isFeatureEnabled: e, editorStore: r, autosaveStore: o, trans: s, isHovered: n, lastSavedLabel: a, toggle: (m) => {
13
- o.isOn = m;
14
- }, AUTOSAVE_STATUS: t, InInfoBox: A, InLoading: _, InToggle: g };
15
- }
16
- });
17
- export {
18
- U as default
19
- };
@@ -1,33 +0,0 @@
1
- import { useConfig as C } from "./useConfig.js";
2
- import { useToaster as T } from "./useToaster.js";
3
- import { useTranslations as g } from "./useTranslations.js";
4
- import { ToasterTypeOptions as D } from "../enums/toaster.js";
5
- import { buildDynamicContentLookup as f, convertModuleDynamicContent as h } from "../utils/dynamicContentConverter.js";
6
- import { flattenDynamicContentList as O } from "../utils/genericUtil.js";
7
- import { repairItemsCurrencyAttributes as M } from "../utils/itemsCurrencyRepair.js";
8
- const N = "dynamic-content.unresolved-attributes-on-drop", R = () => {
9
- const { template: p, isFeatureEnabled: m } = C(), { showToaster: a } = T(), y = g();
10
- return { handleModuleAdd: (e, o) => {
11
- var s, l, u;
12
- try {
13
- if ((e == null ? void 0 : e.action) !== "ADD" && (e == null ? void 0 : e.action) !== "COPY")
14
- return;
15
- const t = (s = o == null ? void 0 : o.getTargetNode) == null ? void 0 : s.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
16
- if (!t || typeof r != "string")
17
- return;
18
- let n = M(r);
19
- const c = f(O((u = p.value) == null ? void 0 : u.dynamicContentList));
20
- let i = [];
21
- c.size > 0 && ({ html: n, unresolved: i } = h(n, c, m("liquidSyntax"))), n !== r && o.modifyHtml(t).replaceWith(n), i.length > 0 && a({
22
- type: D.Warning,
23
- message: y(N)
24
- });
25
- } catch (t) {
26
- console.error("Failed to repair module on add:", t);
27
- }
28
- } };
29
- };
30
- export {
31
- N as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
32
- R as useModuleRepair
33
- };
@@ -1,25 +0,0 @@
1
- import { DefaultConfigValues as c } from "../enums/settingsEnums.js";
2
- const s = {
3
- POSITION: "data-curency",
4
- SYMBOL: "data-currency_symbol"
5
- };
6
- function e(r) {
7
- return r === "1" ? "after" : "before";
8
- }
9
- function i(r) {
10
- const o = (r ?? "").trim();
11
- return o !== "" && o !== c.productPriceCurrencySymbolControlValue;
12
- }
13
- function a(r) {
14
- const o = r.priceCurrencyLocation, n = typeof o == "string" && o.trim() !== "", t = (r.priceCurrencySymbol ?? "").trim();
15
- return {
16
- position: n ? e(o) : void 0,
17
- symbol: i(t) ? t : void 0
18
- };
19
- }
20
- export {
21
- s as ITEMS_CURRENCY_ATTR,
22
- a as currencyAttrTargets,
23
- e as currencyPositionFromLocation,
24
- i as isCustomCurrencySymbol
25
- };
@@ -1,18 +0,0 @@
1
- import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
2
- export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
3
- /**
4
- * Repairs saved modules as they are dropped or copied into the editor, in one pass
5
- * over the module HTML. Two independent repairs run through a single write-back:
6
- *
7
- * - Dynamic content: saved modules serialize merge-tag chips by their display label
8
- * (`{{ Phone Number }}`); this maps them back to their canonical token
9
- * (`{{phone_number}}`) using the account's dynamic-content list.
10
- * - Items currency: v2 Items blocks can carry price `data-curency` /
11
- * `data-currency_symbol` attrs that drifted from their `esd-ext-config`; these are
12
- * healed from config (the export contract reads those exact attrs).
13
- *
14
- * Wired into Stripo via the `onModuleAdd` init callback (see `useStripo`).
15
- */
16
- export declare const useModuleRepair: () => {
17
- handleModuleAdd: (data: ModuleAddData, modifier: ModuleModifier) => void;
18
- };
@@ -1,43 +0,0 @@
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';
20
- /**
21
- * Whether a currency symbol is a partner customization vs the 'USD' default sentinel (SD-144644).
22
- * The default value means "use the catalog currency", so it is treated as NOT customized — the one
23
- * rule shared by the export transform (pairProductVariables) and the block self-heal, kept here so
24
- * the two layers can never drift. Trims first so a whitespace-only value is not read as custom.
25
- */
26
- export declare function isCustomCurrencySymbol(symbol: string | null | undefined): boolean;
27
- export interface CurrencyAttrTargets {
28
- /** Desired `data-curency`; `undefined` = leave the DOM attr as-is (no location recorded). */
29
- position?: 'before' | 'after';
30
- /** Desired `data-currency_symbol`; `undefined` = leave it (empty / the 'USD' sentinel). */
31
- symbol?: string;
32
- }
33
- /**
34
- * The single authority rule for which price currency attrs a config wants written,
35
- * shared by the block self-heal (Items/block.ts) and the module-drop repair
36
- * (itemsCurrencyRepair) so the two can never drift (SD-147588). Position is authoritative
37
- * only when a location is explicitly recorded (an absent value is "unknown", not 'before');
38
- * the symbol is written only for a custom value (never the 'USD' default sentinel).
39
- */
40
- export declare function currencyAttrTargets(config: {
41
- priceCurrencyLocation?: string;
42
- priceCurrencySymbol?: string;
43
- }): CurrencyAttrTargets;
@@ -1,17 +0,0 @@
1
- /**
2
- * Heals stale price currency attributes on every v2 Items block inside a dropped
3
- * saved module, driving `data-curency` / `data-currency_symbol` from each block's
4
- * `esd-ext-config`. A saved module can serialize attrs that no longer match its
5
- * config; the server-side export reads those exact attrs, so left stale they ship
6
- * the wrong currency position/symbol.
7
- *
8
- * Pure `string → string`. Returns the original string untouched when nothing needs
9
- * healing (0 blocks, all in sync) so the caller's `html !== currentHtml` guard stays
10
- * meaningful. Fail-open: any parse fault returns the input unchanged.
11
- *
12
- * The module `<td>` stripe has no table context, so it is wrapped before parsing —
13
- * a bare `<td>` root is otherwise dropped by the HTML parser (same reason
14
- * recommendationMigrator wraps). If the wrap fails to capture the blocks (non-`<td>`
15
- * root foster-parented out), it bails to the original string.
16
- */
17
- export declare function repairItemsCurrencyAttributes(html: string): string;
@@ -1,39 +0,0 @@
1
- import { currencyAttrTargets as u, ITEMS_CURRENCY_ATTR as c } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { ItemsBlockId as l } from "../extensions/Blocks/Items/enums/controlEnums.js";
3
- const s = "items-block-v2";
4
- function f(e) {
5
- const i = e.getAttribute("esd-ext-config");
6
- if (!i)
7
- return !1;
8
- let t, r;
9
- try {
10
- ({ position: t, symbol: r } = u(JSON.parse(i)));
11
- } catch {
12
- return !1;
13
- }
14
- let o = !1;
15
- return e.querySelectorAll(`.${l.PRICE} p`).forEach((n) => {
16
- t !== void 0 && n.getAttribute(c.POSITION) !== t && (n.setAttribute(c.POSITION, t), o = !0), r !== void 0 && n.getAttribute(c.SYMBOL) !== r && (n.setAttribute(c.SYMBOL, r), o = !0);
17
- }), o;
18
- }
19
- function S(e) {
20
- if (typeof e != "string" || !e.includes(s))
21
- return e;
22
- try {
23
- const t = new DOMParser().parseFromString(
24
- `<table><tbody><tr>${e}</tr></tbody></table>`,
25
- "text/html"
26
- ).querySelector("tr"), r = t.querySelectorAll(`.${s}`);
27
- if (r.length === 0)
28
- return e;
29
- let o = !1;
30
- return r.forEach((n) => {
31
- f(n) && (o = !0);
32
- }), o ? t.innerHTML : e;
33
- } catch (i) {
34
- return console.error("Failed to repair items currency on module add:", i), e;
35
- }
36
- }
37
- export {
38
- S as repairItemsCurrencyAttributes
39
- };