@useinsider/guido 3.2.0-beta.803b92e → 3.2.0-beta.8220f9d

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 (113) hide show
  1. package/README.md +1 -25
  2. package/dist/@types/config/schemas.js +2 -2
  3. package/dist/components/Guido.vue.js +5 -5
  4. package/dist/components/Guido.vue2.js +88 -78
  5. package/dist/components/organisms/chat/blueprint/BlueprintCard.vue.js +20 -0
  6. package/dist/components/organisms/chat/blueprint/BlueprintCard.vue2.js +20 -0
  7. package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.js +23 -0
  8. package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue2.js +18 -0
  9. package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue.js +18 -0
  10. package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue2.js +16 -0
  11. package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue.js +20 -0
  12. package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue2.js +19 -0
  13. package/dist/components/organisms/chat/conversation/ChatConversation.vue.js +28 -0
  14. package/dist/components/organisms/chat/conversation/ChatConversation.vue2.js +20 -0
  15. package/dist/components/organisms/chat/conversation/ChatWelcome.vue.js +18 -0
  16. package/dist/components/organisms/chat/conversation/ChatWelcome.vue2.js +11 -0
  17. package/dist/components/organisms/chat/conversation/QuickActionChips.vue.js +22 -0
  18. package/dist/components/organisms/chat/conversation/QuickActionChips.vue2.js +42 -0
  19. package/dist/components/organisms/chat/input/ChatInput.vue.js +29 -0
  20. package/dist/components/organisms/chat/input/ChatInput.vue2.js +39 -0
  21. package/dist/components/organisms/chat/input/GuidoAgentSelector.vue.js +22 -0
  22. package/dist/components/organisms/chat/input/GuidoAgentSelector.vue2.js +29 -0
  23. package/dist/components/organisms/chat/messages/AiMessage.vue.js +26 -0
  24. package/dist/components/organisms/chat/messages/AiMessage.vue2.js +41 -0
  25. package/dist/components/organisms/chat/messages/AiMessageActions.vue.js +18 -0
  26. package/dist/components/organisms/chat/messages/AiMessageActions.vue2.js +27 -0
  27. package/dist/components/organisms/chat/messages/ChatLoading.vue.js +18 -0
  28. package/dist/components/organisms/chat/messages/ChatLoading.vue2.js +30 -0
  29. package/dist/components/organisms/chat/messages/ChatMessages.vue.js +26 -0
  30. package/dist/components/organisms/chat/messages/ChatMessages.vue2.js +67 -0
  31. package/dist/components/organisms/chat/messages/UserMessage.vue.js +18 -0
  32. package/dist/components/organisms/chat/messages/UserMessage.vue2.js +26 -0
  33. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  34. package/dist/components/organisms/header/RightSlot.vue2.js +8 -9
  35. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  36. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  37. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  38. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  39. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  40. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  41. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  42. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  43. package/dist/composables/useChatState.js +130 -0
  44. package/dist/composables/useChatStreaming.js +191 -0
  45. package/dist/composables/useConversationEvents.js +37 -0
  46. package/dist/composables/useEmailTemplateApplier.js +41 -0
  47. package/dist/composables/useRibbonOffset.js +21 -0
  48. package/dist/composables/useSave.js +15 -15
  49. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  50. package/dist/enums/onboarding.js +7 -2
  51. package/dist/enums/unsubscribe.js +34 -27
  52. package/dist/guido.css +1 -1
  53. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
  54. package/dist/node_modules/@vueuse/core/index.js +127 -0
  55. package/dist/node_modules/@vueuse/shared/index.js +68 -27
  56. package/dist/node_modules/dompurify/dist/purify.es.js +595 -0
  57. package/dist/node_modules/marked/lib/marked.esm.js +1152 -0
  58. package/dist/package.json.js +1 -1
  59. package/dist/services/chatService.js +163 -0
  60. package/dist/services/templateLibraryApi.js +5 -4
  61. package/dist/src/@types/chat.d.ts +138 -0
  62. package/dist/src/@types/config/schemas.d.ts +4 -4
  63. package/dist/src/components/Guido.vue.d.ts +5 -1
  64. package/dist/src/components/organisms/chat/blueprint/BlueprintCard.vue.d.ts +38 -0
  65. package/dist/src/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.d.ts +35 -0
  66. package/dist/src/components/organisms/chat/chatbox/ChatboxContainer.vue.d.ts +4 -0
  67. package/dist/src/components/organisms/chat/chatbox/ChatboxPanel.vue.d.ts +4 -0
  68. package/dist/src/components/organisms/chat/conversation/ChatConversation.vue.d.ts +31 -0
  69. package/dist/src/components/organisms/chat/conversation/QuickActionChips.vue.d.ts +30 -0
  70. package/dist/src/components/organisms/chat/input/ChatInput.vue.d.ts +37 -0
  71. package/dist/src/components/organisms/chat/messages/AiMessage.vue.d.ts +33 -0
  72. package/dist/src/components/organisms/chat/messages/AiMessageActions.vue.d.ts +18 -0
  73. package/dist/src/components/organisms/chat/messages/ChatLoading.vue.d.ts +32 -0
  74. package/dist/src/components/organisms/chat/messages/ChatMessages.vue.d.ts +37 -0
  75. package/dist/src/components/organisms/chat/messages/UserMessage.vue.d.ts +35 -0
  76. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  77. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  78. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  79. package/dist/src/composables/useChatState.d.ts +26 -0
  80. package/dist/src/composables/useChatStreaming.d.ts +26 -0
  81. package/dist/src/composables/useConfig.d.ts +2 -2
  82. package/dist/src/composables/useConversationEvents.d.ts +19 -0
  83. package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
  84. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  85. package/dist/src/composables/useSave.d.ts +1 -1
  86. package/dist/src/enums/onboarding.d.ts +6 -0
  87. package/dist/src/enums/unsubscribe.d.ts +5 -0
  88. package/dist/src/services/chatService.d.ts +16 -0
  89. package/dist/src/stores/chat.d.ts +323 -0
  90. package/dist/src/stores/config.d.ts +18 -18
  91. package/dist/src/stores/editor.d.ts +23 -0
  92. package/dist/src/stores/onboarding.d.ts +4 -0
  93. package/dist/src/utils/generateId.d.ts +1 -0
  94. package/dist/src/utils/markdown.d.ts +1 -0
  95. package/dist/stores/chat.js +26 -0
  96. package/dist/stores/editor.js +1 -0
  97. package/dist/stores/onboarding.js +4 -0
  98. package/dist/utils/generateId.js +7 -0
  99. package/dist/utils/markdown.js +21 -0
  100. package/dist/utils/pairProductVariables.js +89 -88
  101. package/package.json +6 -3
  102. package/dist/components/organisms/AutoSaveController.vue.js +0 -17
  103. package/dist/components/organisms/AutoSaveController.vue2.js +0 -13
  104. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  105. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  106. package/dist/composables/useAutoSave.js +0 -68
  107. package/dist/src/composables/useAutoSave.d.ts +0 -3
  108. package/dist/src/stores/autosave.d.ts +0 -6
  109. package/dist/src/utils/timeUtil.d.ts +0 -8
  110. package/dist/stores/autosave.js +0 -11
  111. package/dist/utils/timeUtil.js +0 -19
  112. /package/dist/src/components/organisms/{AutoSaveController.vue.d.ts → chat/conversation/ChatWelcome.vue.d.ts} +0 -0
  113. /package/dist/src/components/organisms/{header/AutoSaveToggle.vue.d.ts → chat/input/GuidoAgentSelector.vue.d.ts} +0 -0
@@ -1,84 +1,85 @@
1
- import { productPairs as P } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function L(F) {
3
- const R = F.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(R, "text/html"), y = P.PAIRS_FOR_EXTENSION;
4
- Object.entries(y).forEach(([n, l]) => {
5
- $.querySelectorAll(".ins-product-td").forEach((c) => {
6
- const E = c.getAttribute("data-number") || "1", T = c.getAttribute("data-type") || "CART_ITEMS";
7
- c.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
- var H;
9
- const b = e.getAttribute("data-type") || T, u = e.getAttribute("data-number") || E, p = l[b];
10
- if (p)
11
- switch (n) {
1
+ import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ function q(w) {
3
+ const y = w.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(y, "text/html"), C = L.PAIRS_FOR_EXTENSION;
4
+ Object.entries(C).forEach(([r, f]) => {
5
+ T.querySelectorAll(".ins-product-td").forEach((o) => {
6
+ const A = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
+ o.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
8
+ var k, F, I;
9
+ const $ = e.getAttribute("data-type") || b, d = e.getAttribute("data-number") || A, u = f[$];
10
+ if (u)
11
+ switch (r) {
12
12
  case "imageSrc": {
13
- let t = null, o = null;
14
- if (e.tagName === "IMG" ? (t = e, o = t.closest("a")) : (t = e.querySelector("img"), o = e.querySelector("a") || e.closest("a")), !t)
13
+ let t = null, i = null;
14
+ if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
15
15
  break;
16
- const i = p.DEFAULT, a = p.ATTR;
17
- if (i && t.src) {
18
- const r = t.src;
19
- i.some((f) => {
20
- const s = f.split("/").pop() || "", _ = r.split("/").pop() || "";
21
- return r.includes(f) || r.includes(s) || _ === s;
22
- }) && (t.src = `{{${a}_${u}}}`);
16
+ const a = u.DEFAULT, s = u.ATTR;
17
+ if (a && t.src) {
18
+ const c = t.src;
19
+ a.some((h) => {
20
+ const l = h.split("/").pop() || "", g = c.split("/").pop() || "";
21
+ return c.includes(h) || c.includes(l) || g === l;
22
+ }) && (t.src = `{{${s}_${d}}}`);
23
23
  }
24
- if (o) {
25
- const r = (H = y.itemLink) == null ? void 0 : H[b];
26
- if (r) {
27
- const d = r.HREF, f = r.DEFAULT_HREF || "#!", s = o.href;
28
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(f) || s === `${window.location.href}${f}` || !s || s === window.location.href) && (o.href = `{{${d}_${u}}}`);
24
+ const n = (F = (k = C.name) == null ? void 0 : k[$]) == null ? void 0 : F.ATTR;
25
+ if (n && t.setAttribute("alt", `{{${n}_${d}}}`), i) {
26
+ const c = (I = C.itemLink) == null ? void 0 : I[$];
27
+ if (c) {
28
+ const E = c.HREF, h = c.DEFAULT_HREF || "#!", l = i.href;
29
+ (l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${d}}}`);
29
30
  }
30
31
  }
31
32
  break;
32
33
  }
33
34
  case "name": {
34
- const t = p, o = t.ATTR, i = t.DEFAULT_HREF || "#!", a = t.HREF;
35
- e.textContent && (e.textContent = `{{${o}_${u}}}`);
36
- const r = e.closest("a") || (e.tagName === "A" ? e : null);
37
- if (r && a) {
38
- const d = r.href, f = `${window.location.href}${i}`;
39
- (d === f || d.endsWith(i)) && (r.href = `{{${a}_${u}}}`);
35
+ const t = u, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
36
+ e.textContent && (e.textContent = `{{${i}_${d}}}`);
37
+ const n = e.closest("a") || (e.tagName === "A" ? e : null);
38
+ if (n && s) {
39
+ const c = n.href, E = `${window.location.href}${a}`;
40
+ (c === E || c.endsWith(a)) && (n.href = `{{${s}_${d}}}`);
40
41
  }
41
42
  break;
42
43
  }
43
44
  case "price":
44
45
  case "originalPrice": {
45
- const t = p, o = e.getAttribute("data-formated"), i = e.getAttribute("data-single_price"), a = o === "true", r = i === "true", d = e.getAttribute("data-curency") || "before";
46
- let f;
47
- r ? f = a ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : f = a ? t.PRICE_FORMATTED : t.PRICE;
48
- const s = t.CURRENCY;
49
- let _ = `{{${f}_${u}}}`;
50
- if (s) {
51
- const k = `{{${s}_${u}}}`;
52
- _ = d === "after" ? `${_} ${k}` : `${k} ${_}`;
46
+ const t = u, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", c = e.getAttribute("data-curency") || "before";
47
+ let E;
48
+ n ? E = s ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : E = s ? t.PRICE_FORMATTED : t.PRICE;
49
+ const h = t.CURRENCY;
50
+ let l = `{{${E}_${d}}}`;
51
+ if (h) {
52
+ const g = `{{${h}_${d}}}`;
53
+ l = c === "after" ? `${l} ${g}` : `${g} ${l}`;
53
54
  }
54
- e.textContent = _;
55
+ e.textContent = l;
55
56
  break;
56
57
  }
57
58
  case "quantity": {
58
- const t = p, o = t.ATTR, i = t.DEFAULT;
59
- e.textContent && e.textContent.trim() === i && (e.textContent = `{{${o}_${u}}}`);
59
+ const t = u, i = t.ATTR, a = t.DEFAULT;
60
+ e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${d}}}`);
60
61
  break;
61
62
  }
62
63
  case "button": {
63
- const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
64
- if (a) {
65
- const r = a.href || "", d = `${window.location.href}${i}`;
66
- (r === "" || r === "#" || r === d || r.endsWith(i) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${o}_${u}}}`);
64
+ const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
65
+ if (s) {
66
+ const n = s.href || "", c = `${window.location.href}${a}`;
67
+ (n === "" || n === "#" || n === c || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${d}}}`);
67
68
  }
68
69
  break;
69
70
  }
70
71
  case "itemLink": {
71
- const t = p, o = t.HREF, i = t.DEFAULT_HREF || "#!", a = e;
72
- if (a.href) {
73
- const r = a.href, d = `${window.location.href}${i}`;
74
- (r === d || r.endsWith(i)) && (a.href = `{{${o}_${u}}}`);
72
+ const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
73
+ if (s.href) {
74
+ const n = s.href, c = `${window.location.href}${a}`;
75
+ (n === c || n.endsWith(a)) && (s.href = `{{${i}_${d}}}`);
75
76
  }
76
77
  break;
77
78
  }
78
79
  default: {
79
- if ("ATTR" in p) {
80
- const t = p.ATTR;
81
- e.textContent && (e.textContent = `{{${t}_${u}}}`);
80
+ if ("ATTR" in u) {
81
+ const t = u.ATTR;
82
+ e.textContent && (e.textContent = `{{${t}_${d}}}`);
82
83
  }
83
84
  break;
84
85
  }
@@ -86,55 +87,55 @@ function L(F) {
86
87
  });
87
88
  });
88
89
  });
89
- const S = R.match(/<!DOCTYPE[^>]*>/i), I = S ? `${S[0]}
90
- ` : "", w = $.querySelectorAll(".ins-product-td"), m = [];
91
- w.forEach((n) => {
92
- const l = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", c = n.getAttribute("data-nodup"), E = n.outerHTML;
93
- m.push({
94
- element: n,
95
- outerHtml: E,
96
- type: l,
97
- number: A,
98
- nodup: c || void 0
90
+ const S = y.match(/<!DOCTYPE[^>]*>/i), M = S ? `${S[0]}
91
+ ` : "", P = T.querySelectorAll(".ins-product-td"), H = [];
92
+ P.forEach((r) => {
93
+ const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", o = r.getAttribute("data-nodup"), A = r.outerHTML;
94
+ H.push({
95
+ element: r,
96
+ outerHtml: A,
97
+ type: f,
98
+ number: p,
99
+ nodup: o || void 0
99
100
  });
100
101
  });
101
- let h = I + $.documentElement.outerHTML;
102
- m.reverse().forEach(({ outerHtml: n, type: l, number: A }) => {
103
- let c = "";
104
- switch (l) {
102
+ let _ = M + T.documentElement.outerHTML;
103
+ H.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
104
+ let o = "";
105
+ switch (f) {
105
106
  case "CART_ITEMS":
106
- c = "ins_apr_total_product_kind";
107
+ o = "ins_apr_total_product_kind";
107
108
  break;
108
109
  case "BROWSED_ITEMS":
109
- c = "browsed_item_total_product_kind";
110
+ o = "browsed_item_total_product_kind";
110
111
  break;
111
112
  case "PURCHASED_ITEMS":
112
- c = "purchased_item_total_product_kind";
113
+ o = "purchased_item_total_product_kind";
113
114
  break;
114
115
  }
115
- if (c) {
116
- const T = parseInt(A) - 1, b = `${`{% if ${c} > ${T} %}`}${n}{% endif %}`;
117
- h = h.replace(n, b);
116
+ if (o) {
117
+ const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
118
+ _ = _.replace(r, $);
118
119
  }
119
120
  });
120
- const M = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), g = [];
121
- return M.forEach((n) => {
122
- const l = n.getAttribute("data-number"), A = n.getAttribute("data-type");
123
- if (!l || A !== "CART_ITEMS")
121
+ const D = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
122
+ return D.forEach((r) => {
123
+ const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
124
+ if (!f || p !== "CART_ITEMS")
124
125
  return;
125
- const c = n.closest(".product-original-price-class");
126
- if (c) {
127
- const E = c.outerHTML;
128
- g.some((C) => C.tdOuterHtml === E) || g.push({ tdOuterHtml: E, number: l });
126
+ const o = r.closest(".product-original-price-class");
127
+ if (o) {
128
+ const A = o.outerHTML;
129
+ R.some((m) => m.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
129
130
  }
130
- }), g.reverse().forEach(({ tdOuterHtml: n, number: l }) => {
131
- const A = `{% if ins_apr_price_${l} != ins_apr_originalprice_${l} %}`;
132
- if (!h.includes(A) && !n.includes("{% if")) {
133
- const E = `${A}${n}{% endif %}`;
134
- h = h.replace(n, E);
131
+ }), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
132
+ const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
133
+ if (!_.includes(p) && !r.includes("{% if")) {
134
+ const A = `${p}${r}{% endif %}`;
135
+ _ = _.replace(r, A);
135
136
  }
136
- }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
137
+ }), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
137
138
  }
138
139
  export {
139
- L as pairProductVariables
140
+ q as pairProductVariables
140
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.2.0-beta.803b92e",
3
+ "version": "3.2.0-beta.8220f9d",
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",
@@ -32,10 +32,12 @@
32
32
  "author": "",
33
33
  "license": "ISC",
34
34
  "dependencies": {
35
- "@stripoinc/ui-editor-extensions": "3.7.0",
35
+ "@stripoinc/ui-editor-extensions": "3.8.0",
36
36
  "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
37
37
  "@vueuse/core": "11.3.0",
38
+ "dompurify": "3.4.2",
38
39
  "lodash-es": "4.17.21",
40
+ "marked": "17.0.5",
39
41
  "pinia": "2.3.1",
40
42
  "valibot": "1.1.0",
41
43
  "vite": "6.3.5",
@@ -50,6 +52,7 @@
50
52
  "@playwright/test": "1.57.0",
51
53
  "@stylistic/eslint-plugin": "3.1.0",
52
54
  "@stylistic/eslint-plugin-migrate": "3.1.0",
55
+ "@types/dompurify": "3.2.0",
53
56
  "@types/eslint": "8.56.12",
54
57
  "@types/eslint__eslintrc": "2.1.2",
55
58
  "@types/eslint__js": "8.42.3",
@@ -86,7 +89,7 @@
86
89
  },
87
90
  "guido": {
88
91
  "stripo": {
89
- "version": "2.60.0"
92
+ "version": "2.62.0"
90
93
  }
91
94
  }
92
95
  }
@@ -1,17 +0,0 @@
1
- import n from "./AutoSaveController.vue2.js";
2
- import t from "../../_virtual/_plugin-vue2_normalizer.js";
3
- var o = function() {
4
- var r = this, e = r._self._c;
5
- return r._self._setupProxy, e("div", { staticClass: "d-n" });
6
- }, s = [], _ = /* @__PURE__ */ t(
7
- n,
8
- o,
9
- s,
10
- !1,
11
- null,
12
- null
13
- );
14
- const f = _.exports;
15
- export {
16
- f as default
17
- };
@@ -1,13 +0,0 @@
1
- import { defineComponent as t } from "vue";
2
- import { useAutoSave as r } from "../../composables/useAutoSave.js";
3
- import { useSave as s } from "../../composables/useSave.js";
4
- const f = /* @__PURE__ */ t({
5
- __name: "AutoSaveController",
6
- setup(a) {
7
- const { save: e } = s(), o = () => e(!1, !0);
8
- return r(o), { __sfc: !0, save: e, backgroundSave: o };
9
- }
10
- });
11
- export {
12
- f as default
13
- };
@@ -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 === "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
- "4cbf0abd"
18
- );
19
- const d = r.exports;
20
- export {
21
- d as default
22
- };
@@ -1,19 +0,0 @@
1
- import { defineComponent as m, ref as i, computed as f } from "vue";
2
- import { useConfig as u } from "../../../composables/useConfig.js";
3
- import { useTranslations as l } from "../../../composables/useTranslations.js";
4
- import { useAutosaveStore as p } from "../../../stores/autosave.js";
5
- import { useEditorStore as c } from "../../../stores/editor.js";
6
- import { formatLocalTime as d } from "../../../utils/timeUtil.js";
7
- import { InToggle as g, InLoading as v, InInfoBox as S } from "@useinsider/design-system-vue";
8
- const B = /* @__PURE__ */ m({
9
- __name: "AutoSaveToggle",
10
- setup(_) {
11
- const { isFeatureEnabled: t } = u(), e = c(), o = p(), r = l(), s = i(!1), n = f(() => o.status !== "saved" || !o.lastSavedAt ? "" : d(o.lastSavedAt));
12
- return { __sfc: !0, isFeatureEnabled: t, editorStore: e, autosaveStore: o, trans: r, isHovered: s, lastSavedLabel: n, toggle: (a) => {
13
- o.isOn = a;
14
- }, InInfoBox: S, InLoading: v, InToggle: g };
15
- }
16
- });
17
- export {
18
- B as default
19
- };
@@ -1,68 +0,0 @@
1
- import { useConfig as m } from "./useConfig.js";
2
- import { useAutosaveStore as p } from "../stores/autosave.js";
3
- import { useEditorStore as S } from "../stores/editor.js";
4
- import { computed as E, watch as f, onUnmounted as y } from "vue";
5
- const A = 18e4, c = 6e4, O = (l) => {
6
- const { isFeatureEnabled: b } = m(), s = S(), t = p();
7
- let o = null, u = 0;
8
- const n = E(
9
- () => b("autosave") && t.isOn
10
- ), g = () => s.hasChanges && !s.isSaveButtonDisabled && !s.isCodeEditorOpen, h = () => ({
11
- hasChanges: s.hasChanges,
12
- isSaveButtonDisabled: s.isSaveButtonDisabled,
13
- isCodeEditorOpen: s.isCodeEditorOpen
14
- }), r = async (e) => {
15
- if (!n.value) {
16
- console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
17
- return;
18
- }
19
- if (!g()) {
20
- console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
21
- return;
22
- }
23
- if (t.status === "saving") {
24
- console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
25
- return;
26
- }
27
- console.debug("guido:autosave:save-start", { trigger: e }), t.status = "saving";
28
- try {
29
- await l(), s.hasChanges = !1, t.status = "saved", t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
30
- } catch (i) {
31
- console.debug("guido:autosave:error", { trigger: e, error: i }), t.status = "error";
32
- }
33
- }, a = () => {
34
- const { visibilityState: e } = document;
35
- if (console.debug("guido:autosave:visibility-change", {
36
- visibilityState: e,
37
- isActive: n.value
38
- }), e !== "hidden")
39
- return;
40
- const i = Date.now() - u;
41
- if (i < c) {
42
- console.debug("guido:autosave:visibility-debounced", {
43
- sinceLastMs: i,
44
- debounceMs: c
45
- });
46
- return;
47
- }
48
- u = Date.now(), r("visibility");
49
- }, d = () => {
50
- o && (clearInterval(o), o = null);
51
- }, v = () => {
52
- document.removeEventListener("visibilitychange", a), window.removeEventListener("pagehide", a);
53
- };
54
- f(
55
- n,
56
- (e) => {
57
- console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), o = setInterval(() => {
58
- console.debug("guido:autosave:interval-tick"), r("interval");
59
- }, A), document.addEventListener("visibilitychange", a), window.addEventListener("pagehide", a)) : (d(), v(), t.status = "idle");
60
- },
61
- { immediate: !0 }
62
- ), y(() => {
63
- d(), v();
64
- });
65
- };
66
- export {
67
- O as useAutoSave
68
- };
@@ -1,3 +0,0 @@
1
- type SaveSilent = () => unknown;
2
- export declare const useAutoSave: (saveSilent: SaveSilent) => void;
3
- export {};
@@ -1,6 +0,0 @@
1
- export type AutosaveStatus = 'idle' | 'saving' | 'saved' | 'error';
2
- export declare const useAutosaveStore: import("pinia").StoreDefinition<"guidoAutosave", {
3
- isOn: boolean;
4
- lastSavedAt: Date | null;
5
- status: AutosaveStatus;
6
- }, {}, {}>;
@@ -1,8 +0,0 @@
1
- /**
2
- * Formats a Date as local time in 24-hour format.
3
- * Pass `useTimezone = true` to append the UTC offset and city name — useful when the
4
- * timestamp must clearly communicate the client's timezone.
5
- * @example formatLocalTime(date) -> 12:20:02
6
- * @example formatLocalTime(date, true) -> 12:20:02 (UTC+3 Istanbul)
7
- */
8
- export declare const formatLocalTime: (date: Date, useTimezone?: boolean) => string;
@@ -1,11 +0,0 @@
1
- import { defineStore as t } from "pinia";
2
- const s = t("guidoAutosave", {
3
- state: () => ({
4
- isOn: !1,
5
- lastSavedAt: null,
6
- status: "idle"
7
- })
8
- });
9
- export {
10
- s as useAutosaveStore
11
- };
@@ -1,19 +0,0 @@
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
- };
17
- export {
18
- c as formatLocalTime
19
- };