@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.
- package/README.md +1 -25
- package/dist/@types/config/schemas.js +2 -2
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +88 -78
- package/dist/components/organisms/chat/blueprint/BlueprintCard.vue.js +20 -0
- package/dist/components/organisms/chat/blueprint/BlueprintCard.vue2.js +20 -0
- package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.js +23 -0
- package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue2.js +18 -0
- package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue.js +18 -0
- package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue2.js +16 -0
- package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue.js +20 -0
- package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue2.js +19 -0
- package/dist/components/organisms/chat/conversation/ChatConversation.vue.js +28 -0
- package/dist/components/organisms/chat/conversation/ChatConversation.vue2.js +20 -0
- package/dist/components/organisms/chat/conversation/ChatWelcome.vue.js +18 -0
- package/dist/components/organisms/chat/conversation/ChatWelcome.vue2.js +11 -0
- package/dist/components/organisms/chat/conversation/QuickActionChips.vue.js +22 -0
- package/dist/components/organisms/chat/conversation/QuickActionChips.vue2.js +42 -0
- package/dist/components/organisms/chat/input/ChatInput.vue.js +29 -0
- package/dist/components/organisms/chat/input/ChatInput.vue2.js +39 -0
- package/dist/components/organisms/chat/input/GuidoAgentSelector.vue.js +22 -0
- package/dist/components/organisms/chat/input/GuidoAgentSelector.vue2.js +29 -0
- package/dist/components/organisms/chat/messages/AiMessage.vue.js +26 -0
- package/dist/components/organisms/chat/messages/AiMessage.vue2.js +41 -0
- package/dist/components/organisms/chat/messages/AiMessageActions.vue.js +18 -0
- package/dist/components/organisms/chat/messages/AiMessageActions.vue2.js +27 -0
- package/dist/components/organisms/chat/messages/ChatLoading.vue.js +18 -0
- package/dist/components/organisms/chat/messages/ChatLoading.vue2.js +30 -0
- package/dist/components/organisms/chat/messages/ChatMessages.vue.js +26 -0
- package/dist/components/organisms/chat/messages/ChatMessages.vue2.js +67 -0
- package/dist/components/organisms/chat/messages/UserMessage.vue.js +18 -0
- package/dist/components/organisms/chat/messages/UserMessage.vue2.js +26 -0
- package/dist/components/organisms/header/RightSlot.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +8 -9
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/composables/useChatState.js +130 -0
- package/dist/composables/useChatStreaming.js +191 -0
- package/dist/composables/useConversationEvents.js +37 -0
- package/dist/composables/useEmailTemplateApplier.js +41 -0
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +15 -15
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
- package/dist/node_modules/@vueuse/core/index.js +127 -0
- package/dist/node_modules/@vueuse/shared/index.js +68 -27
- package/dist/node_modules/dompurify/dist/purify.es.js +595 -0
- package/dist/node_modules/marked/lib/marked.esm.js +1152 -0
- package/dist/package.json.js +1 -1
- package/dist/services/chatService.js +163 -0
- package/dist/services/templateLibraryApi.js +5 -4
- package/dist/src/@types/chat.d.ts +138 -0
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/components/Guido.vue.d.ts +5 -1
- package/dist/src/components/organisms/chat/blueprint/BlueprintCard.vue.d.ts +38 -0
- package/dist/src/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.d.ts +35 -0
- package/dist/src/components/organisms/chat/chatbox/ChatboxContainer.vue.d.ts +4 -0
- package/dist/src/components/organisms/chat/chatbox/ChatboxPanel.vue.d.ts +4 -0
- package/dist/src/components/organisms/chat/conversation/ChatConversation.vue.d.ts +31 -0
- package/dist/src/components/organisms/chat/conversation/QuickActionChips.vue.d.ts +30 -0
- package/dist/src/components/organisms/chat/input/ChatInput.vue.d.ts +37 -0
- package/dist/src/components/organisms/chat/messages/AiMessage.vue.d.ts +33 -0
- package/dist/src/components/organisms/chat/messages/AiMessageActions.vue.d.ts +18 -0
- package/dist/src/components/organisms/chat/messages/ChatLoading.vue.d.ts +32 -0
- package/dist/src/components/organisms/chat/messages/ChatMessages.vue.d.ts +37 -0
- package/dist/src/components/organisms/chat/messages/UserMessage.vue.d.ts +35 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useChatState.d.ts +26 -0
- package/dist/src/composables/useChatStreaming.d.ts +26 -0
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useConversationEvents.d.ts +19 -0
- package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/services/chatService.d.ts +16 -0
- package/dist/src/stores/chat.d.ts +323 -0
- package/dist/src/stores/config.d.ts +18 -18
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/utils/generateId.d.ts +1 -0
- package/dist/src/utils/markdown.d.ts +1 -0
- package/dist/stores/chat.js +26 -0
- package/dist/stores/editor.js +1 -0
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/generateId.js +7 -0
- package/dist/utils/markdown.js +21 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/package.json +6 -3
- package/dist/components/organisms/AutoSaveController.vue.js +0 -17
- package/dist/components/organisms/AutoSaveController.vue2.js +0 -13
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
- package/dist/composables/useAutoSave.js +0 -68
- package/dist/src/composables/useAutoSave.d.ts +0 -3
- package/dist/src/stores/autosave.d.ts +0 -6
- package/dist/src/utils/timeUtil.d.ts +0 -8
- package/dist/stores/autosave.js +0 -11
- package/dist/utils/timeUtil.js +0 -19
- /package/dist/src/components/organisms/{AutoSaveController.vue.d.ts → chat/conversation/ChatWelcome.vue.d.ts} +0 -0
- /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
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
Object.entries(
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
switch (
|
|
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,
|
|
14
|
-
if (e.tagName === "IMG" ? (t = e,
|
|
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
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}) && (t.src = `{{${
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 =
|
|
35
|
-
e.textContent && (e.textContent = `{{${
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
(
|
|
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 =
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
|
|
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 =
|
|
59
|
-
e.textContent && e.textContent.trim() ===
|
|
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 =
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
(
|
|
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 =
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
(
|
|
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
|
|
80
|
-
const t =
|
|
81
|
-
e.textContent && (e.textContent = `{{${t}_${
|
|
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 =
|
|
90
|
-
` : "",
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
element:
|
|
95
|
-
outerHtml:
|
|
96
|
-
type:
|
|
97
|
-
number:
|
|
98
|
-
nodup:
|
|
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
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
switch (
|
|
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
|
-
|
|
107
|
+
o = "ins_apr_total_product_kind";
|
|
107
108
|
break;
|
|
108
109
|
case "BROWSED_ITEMS":
|
|
109
|
-
|
|
110
|
+
o = "browsed_item_total_product_kind";
|
|
110
111
|
break;
|
|
111
112
|
case "PURCHASED_ITEMS":
|
|
112
|
-
|
|
113
|
+
o = "purchased_item_total_product_kind";
|
|
113
114
|
break;
|
|
114
115
|
}
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
if (o) {
|
|
117
|
+
const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
|
|
118
|
+
_ = _.replace(r, $);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const
|
|
121
|
-
return
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
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
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
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
|
-
}),
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
const
|
|
134
|
-
|
|
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
|
-
}),
|
|
137
|
+
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
137
138
|
}
|
|
138
139
|
export {
|
|
139
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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,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;
|
package/dist/stores/autosave.js
DELETED
package/dist/utils/timeUtil.js
DELETED
|
@@ -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
|
-
};
|
|
File without changes
|
|
File without changes
|