@useinsider/guido 3.2.0-beta.8209d6d → 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 (94) hide show
  1. package/dist/@types/config/schemas.js +38 -36
  2. package/dist/components/Guido.vue.js +4 -4
  3. package/dist/components/Guido.vue2.js +82 -71
  4. package/dist/components/organisms/chat/blueprint/BlueprintCard.vue.js +20 -0
  5. package/dist/components/organisms/chat/blueprint/BlueprintCard.vue2.js +20 -0
  6. package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.js +23 -0
  7. package/dist/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue2.js +18 -0
  8. package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue.js +18 -0
  9. package/dist/components/organisms/chat/chatbox/ChatboxContainer.vue2.js +16 -0
  10. package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue.js +20 -0
  11. package/dist/components/organisms/chat/chatbox/ChatboxPanel.vue2.js +19 -0
  12. package/dist/components/organisms/chat/conversation/ChatConversation.vue.js +28 -0
  13. package/dist/components/organisms/chat/conversation/ChatConversation.vue2.js +20 -0
  14. package/dist/components/organisms/chat/conversation/ChatWelcome.vue.js +18 -0
  15. package/dist/components/organisms/chat/conversation/ChatWelcome.vue2.js +11 -0
  16. package/dist/components/organisms/chat/conversation/QuickActionChips.vue.js +22 -0
  17. package/dist/components/organisms/chat/conversation/QuickActionChips.vue2.js +42 -0
  18. package/dist/components/organisms/chat/input/ChatInput.vue.js +29 -0
  19. package/dist/components/organisms/chat/input/ChatInput.vue2.js +39 -0
  20. package/dist/components/organisms/chat/input/GuidoAgentSelector.vue.js +22 -0
  21. package/dist/components/organisms/chat/input/GuidoAgentSelector.vue2.js +29 -0
  22. package/dist/components/organisms/chat/messages/AiMessage.vue.js +26 -0
  23. package/dist/components/organisms/chat/messages/AiMessage.vue2.js +41 -0
  24. package/dist/components/organisms/chat/messages/AiMessageActions.vue.js +18 -0
  25. package/dist/components/organisms/chat/messages/AiMessageActions.vue2.js +27 -0
  26. package/dist/components/organisms/chat/messages/ChatLoading.vue.js +18 -0
  27. package/dist/components/organisms/chat/messages/ChatLoading.vue2.js +30 -0
  28. package/dist/components/organisms/chat/messages/ChatMessages.vue.js +26 -0
  29. package/dist/components/organisms/chat/messages/ChatMessages.vue2.js +67 -0
  30. package/dist/components/organisms/chat/messages/UserMessage.vue.js +18 -0
  31. package/dist/components/organisms/chat/messages/UserMessage.vue2.js +26 -0
  32. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  33. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  34. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  35. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  36. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  37. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  38. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  39. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  40. package/dist/composables/useChatState.js +130 -0
  41. package/dist/composables/useChatStreaming.js +191 -0
  42. package/dist/composables/useConversationEvents.js +37 -0
  43. package/dist/composables/useEmailTemplateApplier.js +41 -0
  44. package/dist/composables/useRibbonOffset.js +21 -0
  45. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  46. package/dist/enums/onboarding.js +7 -2
  47. package/dist/enums/unsubscribe.js +34 -27
  48. package/dist/guido.css +1 -1
  49. package/dist/node_modules/@vueuse/core/index.js +127 -0
  50. package/dist/node_modules/@vueuse/shared/index.js +68 -27
  51. package/dist/node_modules/dompurify/dist/purify.es.js +595 -0
  52. package/dist/node_modules/marked/lib/marked.esm.js +1152 -0
  53. package/dist/services/chatService.js +163 -0
  54. package/dist/services/templateLibraryApi.js +5 -4
  55. package/dist/src/@types/chat.d.ts +138 -0
  56. package/dist/src/@types/config/schemas.d.ts +4 -0
  57. package/dist/src/components/Guido.vue.d.ts +4 -0
  58. package/dist/src/components/organisms/chat/blueprint/BlueprintCard.vue.d.ts +38 -0
  59. package/dist/src/components/organisms/chat/blueprint/EmailTemplateBlueprintCard.vue.d.ts +35 -0
  60. package/dist/src/components/organisms/chat/chatbox/ChatboxContainer.vue.d.ts +4 -0
  61. package/dist/src/components/organisms/chat/chatbox/ChatboxPanel.vue.d.ts +4 -0
  62. package/dist/src/components/organisms/chat/conversation/ChatConversation.vue.d.ts +31 -0
  63. package/dist/src/components/organisms/chat/conversation/ChatWelcome.vue.d.ts +2 -0
  64. package/dist/src/components/organisms/chat/conversation/QuickActionChips.vue.d.ts +30 -0
  65. package/dist/src/components/organisms/chat/input/ChatInput.vue.d.ts +37 -0
  66. package/dist/src/components/organisms/chat/input/GuidoAgentSelector.vue.d.ts +2 -0
  67. package/dist/src/components/organisms/chat/messages/AiMessage.vue.d.ts +33 -0
  68. package/dist/src/components/organisms/chat/messages/AiMessageActions.vue.d.ts +18 -0
  69. package/dist/src/components/organisms/chat/messages/ChatLoading.vue.d.ts +32 -0
  70. package/dist/src/components/organisms/chat/messages/ChatMessages.vue.d.ts +37 -0
  71. package/dist/src/components/organisms/chat/messages/UserMessage.vue.d.ts +35 -0
  72. package/dist/src/composables/useChatState.d.ts +26 -0
  73. package/dist/src/composables/useChatStreaming.d.ts +26 -0
  74. package/dist/src/composables/useConfig.d.ts +2 -0
  75. package/dist/src/composables/useConversationEvents.d.ts +19 -0
  76. package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
  77. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  78. package/dist/src/enums/onboarding.d.ts +6 -0
  79. package/dist/src/enums/unsubscribe.d.ts +5 -0
  80. package/dist/src/services/chatService.d.ts +16 -0
  81. package/dist/src/stores/chat.d.ts +323 -0
  82. package/dist/src/stores/config.d.ts +18 -0
  83. package/dist/src/stores/editor.d.ts +23 -0
  84. package/dist/src/stores/onboarding.d.ts +4 -0
  85. package/dist/src/utils/generateId.d.ts +1 -0
  86. package/dist/src/utils/markdown.d.ts +1 -0
  87. package/dist/static/templates/empty/style.css.js +1 -0
  88. package/dist/stores/chat.js +26 -0
  89. package/dist/stores/editor.js +1 -0
  90. package/dist/stores/onboarding.js +4 -0
  91. package/dist/utils/generateId.js +7 -0
  92. package/dist/utils/markdown.js +21 -0
  93. package/dist/utils/pairProductVariables.js +89 -88
  94. package/package.json +4 -1
@@ -0,0 +1,20 @@
1
+ import { defineComponent as e, ref as t, provide as r } from "vue";
2
+ import s from "./ChatWelcome.vue.js";
3
+ import n from "./QuickActionChips.vue.js";
4
+ import p from "../input/ChatInput.vue.js";
5
+ import a from "../messages/ChatMessages.vue.js";
6
+ const u = /* @__PURE__ */ e({
7
+ __name: "ChatConversation",
8
+ props: {
9
+ messages: null,
10
+ isLoading: { type: Boolean }
11
+ },
12
+ emits: ["send", "stop", "retry", "copy-message"],
13
+ setup(i) {
14
+ const o = t(null);
15
+ return r("chatScrollContainer", o), { __sfc: !0, scrollContainerRef: o, ChatWelcome: s, QuickActionChips: n, ChatInput: p, ChatMessages: a };
16
+ }
17
+ });
18
+ export {
19
+ u as default
20
+ };
@@ -0,0 +1,18 @@
1
+ import _ from "./ChatWelcome.vue2.js";
2
+ /* empty css */
3
+ import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var e = this, t = e._self._c, s = e._self._setupProxy;
6
+ return t("div", { staticClass: "chat-welcome" }, [t("p", { staticClass: "chat-welcome__subtitle" }, [e._v(" " + e._s(s.trans("newsletter.ai-welcome-subtitle")) + " ")]), t("p", { staticClass: "chat-welcome__title" }, [e._v(" " + e._s(s.trans("newsletter.ai-welcome-title")) + " ")])]);
7
+ }, l = [], c = /* @__PURE__ */ a(
8
+ _,
9
+ r,
10
+ l,
11
+ !1,
12
+ null,
13
+ "715e7d06"
14
+ );
15
+ const p = c.exports;
16
+ export {
17
+ p as default
18
+ };
@@ -0,0 +1,11 @@
1
+ import { defineComponent as t } from "vue";
2
+ import { useTranslations as e } from "../../../../composables/useTranslations.js";
3
+ const a = /* @__PURE__ */ t({
4
+ __name: "ChatWelcome",
5
+ setup(n) {
6
+ return { __sfc: !0, trans: e() };
7
+ }
8
+ });
9
+ export {
10
+ a as default
11
+ };
@@ -0,0 +1,22 @@
1
+ import s from "./QuickActionChips.vue2.js";
2
+ /* empty css */
3
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var e = function() {
5
+ var t = this, i = t._self._c, n = t._self._setupProxy;
6
+ return i("div", { staticClass: "quick-action-chips", class: { "quick-action-chips--compact": t.compact } }, t._l(n.chips, function(c) {
7
+ return i("button", { key: c.id, staticClass: "quick-action-chips__chip", on: { click: function(p) {
8
+ return n.onChipClick(c);
9
+ } } }, [t._v(" " + t._s(c.label) + " ")]);
10
+ }), 0);
11
+ }, r = [], _ = /* @__PURE__ */ o(
12
+ s,
13
+ e,
14
+ r,
15
+ !1,
16
+ null,
17
+ "0d23f2b4"
18
+ );
19
+ const m = _.exports;
20
+ export {
21
+ m as default
22
+ };
@@ -0,0 +1,42 @@
1
+ import { defineComponent as i, computed as n } from "vue";
2
+ import { useTranslations as c } from "../../../../composables/useTranslations.js";
3
+ const u = /* @__PURE__ */ i({
4
+ __name: "QuickActionChips",
5
+ props: {
6
+ compact: { type: Boolean, default: !1 }
7
+ },
8
+ emits: ["chip-click"],
9
+ setup(s, { emit: o }) {
10
+ const t = c(), a = [
11
+ {
12
+ id: "welcome",
13
+ labelKey: "newsletter.ai-quick-welcome",
14
+ prompt: "Generate a friendly welcome email for new subscribers, with a primary CTA to the catalog."
15
+ },
16
+ {
17
+ id: "promo-vip",
18
+ labelKey: "newsletter.ai-quick-promo",
19
+ prompt: "Generate a promotional email for VIP customers with a 20% off coupon and a hero banner."
20
+ },
21
+ {
22
+ id: "cart-abandonment",
23
+ labelKey: "newsletter.ai-quick-cart",
24
+ prompt: "Generate a cart-abandonment recovery email with a recommended products section."
25
+ },
26
+ {
27
+ id: "unsubscribe-footer",
28
+ labelKey: "newsletter.ai-quick-unsubscribe",
29
+ prompt: "Add a clean unsubscribe footer with a permission-reminder line and the company address."
30
+ }
31
+ ], r = n(() => a.map((e) => ({
32
+ ...e,
33
+ label: t(e.labelKey)
34
+ })));
35
+ return { __sfc: !0, emit: o, trans: t, chipDefinitions: a, chips: r, onChipClick: (e) => {
36
+ o("chip-click", e.prompt);
37
+ } };
38
+ }
39
+ });
40
+ export {
41
+ u as default
42
+ };
@@ -0,0 +1,29 @@
1
+ import n from "./ChatInput.vue2.js";
2
+ /* empty css */
3
+ import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var s = this, a = s._self._c, e = s._self._setupProxy;
6
+ return a("div", { staticClass: "chat-input" }, [a("div", { staticClass: "chat-input__container", class: { "chat-input__container--focused": e.isFocused } }, [a("div", { staticClass: "chat-input__text-area" }, [a("textarea", { directives: [{ name: "model", rawName: "v-model", value: e.message, expression: "message" }], ref: "textareaRef", staticClass: "chat-input__textarea", attrs: { rows: "1", disabled: s.disabled, placeholder: e.trans("newsletter.ai-input-placeholder") }, domProps: { value: e.message }, on: { blur: function(t) {
7
+ e.isFocused = !1;
8
+ }, focus: function(t) {
9
+ e.isFocused = !0;
10
+ }, input: [function(t) {
11
+ t.target.composing || (e.message = t.target.value);
12
+ }, e.handleInput], keydown: [function(t) {
13
+ return !t.type.indexOf("key") && s._k(t.keyCode, "enter", 13, t.key, "Enter") || t.ctrlKey || t.shiftKey || t.altKey || t.metaKey ? null : (t.preventDefault(), e.handleSend.apply(null, arguments));
14
+ }, function(t) {
15
+ if (!t.type.indexOf("key") && s._k(t.keyCode, "enter", 13, t.key, "Enter") || !t.shiftKey) return null;
16
+ t.stopPropagation();
17
+ }] } })]), a("div", { staticClass: "chat-input__toolbar" }, [a("div", { staticClass: "chat-input__toolbar-left" }, [a(e.GuidoAgentSelector)], 1), a("div", { staticClass: "chat-input__actions" }, [a("button", { staticClass: "chat-input__send-btn", attrs: { type: "button", disabled: !e.canSend && !s.isLoading }, on: { click: e.handleButtonClick } }, [s.isLoading ? a(e.InIcons, { attrs: { name: "line-stop", size: "24" } }) : a(e.InIcons, { attrs: { name: "line-send", size: "24" } })], 1)])])])]);
18
+ }, o = [], l = /* @__PURE__ */ i(
19
+ n,
20
+ r,
21
+ o,
22
+ !1,
23
+ null,
24
+ "dd031314"
25
+ );
26
+ const _ = l.exports;
27
+ export {
28
+ _ as default
29
+ };
@@ -0,0 +1,39 @@
1
+ import { defineComponent as g, ref as l, computed as v, nextTick as x } from "vue";
2
+ import { useTranslations as _ } from "../../../../composables/useTranslations.js";
3
+ import y from "./GuidoAgentSelector.vue.js";
4
+ import { InIcons as I } from "@useinsider/design-system-vue";
5
+ const S = /* @__PURE__ */ g({
6
+ __name: "ChatInput",
7
+ props: {
8
+ isLoading: { type: Boolean, default: !1 },
9
+ disabled: { type: Boolean, default: !1 }
10
+ },
11
+ emits: ["send", "stop"],
12
+ setup(c, { expose: d, emit: s }) {
13
+ const t = c, f = _(), n = l(null), o = l(""), p = l(!1), i = v(
14
+ () => o.value.trim().length > 0 && !t.isLoading && !t.disabled
15
+ ), a = () => {
16
+ const e = n.value;
17
+ if (!e)
18
+ return;
19
+ e.style.height = "auto";
20
+ const u = 120;
21
+ e.style.height = `${Math.min(e.scrollHeight, u)}px`, e.style.overflowY = e.scrollHeight > u ? "auto" : "hidden";
22
+ }, m = () => {
23
+ a();
24
+ }, r = () => {
25
+ i.value && (s("send", o.value.trim()), o.value = "", x(() => a()));
26
+ }, h = () => {
27
+ t.isLoading ? s("stop") : r();
28
+ };
29
+ return d({
30
+ focus: () => {
31
+ var e;
32
+ return (e = n.value) == null ? void 0 : e.focus();
33
+ }
34
+ }), { __sfc: !0, props: t, emit: s, trans: f, textareaRef: n, message: o, isFocused: p, canSend: i, autoResize: a, handleInput: m, handleSend: r, handleButtonClick: h, GuidoAgentSelector: y, InIcons: I };
35
+ }
36
+ });
37
+ export {
38
+ S as default
39
+ };
@@ -0,0 +1,22 @@
1
+ import s from "./GuidoAgentSelector.vue2.js";
2
+ /* empty css */
3
+ import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var l = function() {
5
+ var e = this, o = e._self._c, t = e._self._setupProxy;
6
+ return t.visibleAllowed.length > 1 ? o("div", { staticClass: "guido-agent-selector", attrs: { role: "tablist" } }, e._l(t.visibleAllowed, function(n) {
7
+ return o("button", { key: n.name, staticClass: "guido-agent-selector__option", class: { "guido-agent-selector__option--active": n.name === t.selectedAgent }, attrs: { role: "tab", type: "button", "aria-selected": n.name === t.selectedAgent }, on: { click: function(_) {
8
+ return t.handleSelect(n.name);
9
+ } } }, [e._v(" " + e._s(t.trans(n.labelKey)) + " ")]);
10
+ }), 0) : e._e();
11
+ }, a = [], i = /* @__PURE__ */ r(
12
+ s,
13
+ l,
14
+ a,
15
+ !1,
16
+ null,
17
+ "1179a597"
18
+ );
19
+ const f = i.exports;
20
+ export {
21
+ f as default
22
+ };
@@ -0,0 +1,29 @@
1
+ import { defineComponent as d, ref as m, computed as f, onMounted as g } from "vue";
2
+ import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
+ import { chatService as n } from "../../../../services/chatService.js";
4
+ const b = /* @__PURE__ */ d({
5
+ __name: "GuidoAgentSelector",
6
+ setup(v) {
7
+ const i = ["email-template-agent", "liquid-agent"], r = p(), s = m([]), a = m(n.activeAgent), c = [
8
+ { name: "email-template-agent", labelKey: "newsletter.ai-agent-template" },
9
+ { name: "liquid-agent", labelKey: "newsletter.ai-agent-liquid" }
10
+ ], o = f(() => c.filter(
11
+ (e) => s.value.some((l) => l.name === e.name)
12
+ )), u = (e) => {
13
+ a.value = e, n.selectedAgent = e, n.newConversation();
14
+ };
15
+ return g(async () => {
16
+ var l;
17
+ const e = await n.fetchVisibleAgents();
18
+ if (s.value = e.filter(
19
+ (t) => i.includes(t.name)
20
+ ), !o.value.some((t) => t.name === a.value)) {
21
+ const t = ((l = o.value[0]) == null ? void 0 : l.name) ?? "email-template-agent";
22
+ a.value = t, n.selectedAgent = t;
23
+ }
24
+ }), { __sfc: !0, ALLOWED_AGENTS: i, trans: r, allAgents: s, selectedAgent: a, allowedConfigs: c, visibleAllowed: o, handleSelect: u };
25
+ }
26
+ });
27
+ export {
28
+ b as default
29
+ };
@@ -0,0 +1,26 @@
1
+ import n from "./AiMessage.vue2.js";
2
+ /* empty css */
3
+ import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var e = this, s = e._self._c, t = e._self._setupProxy;
6
+ return t.isLoading || t.hasContent ? s("div", { staticClass: "ai-message d-f f-d-c a-i-f-s w-1" }, [t.isLoading && !t.hasContent ? s(t.ChatLoading, { attrs: { cycling: !t.statusText, text: t.statusText } }) : e._e(), t.hasContent || !t.isLoading ? [t.hasSegments ? s("div", { staticClass: "ai-message__segments" }, [e._l(e.message.segments, function(a) {
7
+ return [a.type === "text" && a.content ? s("div", { key: a._id, staticClass: "ai-message__text-segment", domProps: { innerHTML: e._s(t.formatMarkdown(a.content)) } }) : a.type === "error" ? s("div", { key: `err-${a._id}`, staticClass: "ai-message__error d-f a-i-c" }, [s(t.InIcons, { attrs: { name: "line-alert-triangle", size: "16" } }), s("span", { staticClass: "ai-message__error-text" }, [e._v(e._s(a.content))])], 1) : a.type === "blueprint" && a.blueprintType === "email_template" ? s(t.EmailTemplateBlueprintCard, { key: `bp-${a._id}`, attrs: { status: t.applyStatus[a.blueprintId ?? ""] ?? "pending", version: a.version }, on: { apply: function(c) {
8
+ return t.onApplyTemplate(a.blueprintId ?? "", a.blueprintData);
9
+ } } }) : a.type === "blueprint" ? s(t.BlueprintCard, { key: `bp-${a._id}`, attrs: { title: a.title, version: a.version } }) : e._e()];
10
+ }), t.isLoading && t.statusText ? s(t.ChatLoading, { attrs: { cycling: !1, text: t.statusText } }) : t.runningToolsCount > 0 ? s(t.ChatLoading, { attrs: { cycling: !1, text: t.runningToolsLabel } }) : e._e()], 2) : e.message.content ? s("div", { staticClass: "ai-message__content", domProps: { innerHTML: e._s(t.formatMarkdown(e.message.content)) } }) : e._e()] : e._e(), !t.isLoading && e.showFeedback ? s(t.AiMessageActions, { staticClass: "mt-2", attrs: { message: e.message }, on: { copy: function(a) {
11
+ return e.$emit("copy");
12
+ }, retry: function(a) {
13
+ return e.$emit("retry");
14
+ } } }) : e._e()], 2) : e._e();
15
+ }, o = [], l = /* @__PURE__ */ i(
16
+ n,
17
+ r,
18
+ o,
19
+ !1,
20
+ null,
21
+ "b287766f"
22
+ );
23
+ const f = l.exports;
24
+ export {
25
+ f as default
26
+ };
@@ -0,0 +1,41 @@
1
+ import { defineComponent as f, computed as r } from "vue";
2
+ import { useEmailTemplateApplier as g } from "../../../../composables/useEmailTemplateApplier.js";
3
+ import y from "../blueprint/BlueprintCard.vue.js";
4
+ import d from "../blueprint/EmailTemplateBlueprintCard.vue.js";
5
+ import A from "./AiMessageActions.vue.js";
6
+ import T from "./ChatLoading.vue.js";
7
+ import { formatMarkdown as h } from "../../../../utils/markdown.js";
8
+ import { InIcons as C } from "@useinsider/design-system-vue";
9
+ const E = /* @__PURE__ */ f({
10
+ __name: "AiMessage",
11
+ props: {
12
+ message: null,
13
+ showFeedback: { type: Boolean, default: !0 }
14
+ },
15
+ emits: ["copy", "retry"],
16
+ setup(p) {
17
+ const t = p, { applyStatus: i, applyTemplate: a } = g(), m = r(() => t.message.isStreaming === !0), n = r(
18
+ () => Array.isArray(t.message.segments) && t.message.segments.length > 0
19
+ ), s = r(() => n.value ? t.message.segments.filter(
20
+ (e) => e.type === "tool" && e.isRunning && !e.error
21
+ ).length : 0), l = r(() => {
22
+ if (s.value === 0)
23
+ return "";
24
+ if (s.value === 1) {
25
+ const e = t.message.segments.find(
26
+ (o) => o.type === "tool" && o.isRunning && !o.error
27
+ );
28
+ return (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? "Working...";
29
+ }
30
+ return `Working on ${s.value} tasks`;
31
+ }), u = r(() => n.value ? t.message.segments.some(
32
+ (e) => e.type === "text" && e.content || e.type === "blueprint"
33
+ ) : !!t.message.content), c = r(() => t.message.currentStatus ?? "");
34
+ return { __sfc: !0, props: t, applyStatus: i, applyTemplate: a, isLoading: m, hasSegments: n, runningToolsCount: s, runningToolsLabel: l, hasContent: u, statusText: c, onApplyTemplate: (e, o) => {
35
+ o && a(e, o);
36
+ }, BlueprintCard: y, EmailTemplateBlueprintCard: d, AiMessageActions: A, ChatLoading: T, formatMarkdown: h, InIcons: C };
37
+ }
38
+ });
39
+ export {
40
+ E as default
41
+ };
@@ -0,0 +1,18 @@
1
+ import a from "./AiMessageActions.vue2.js";
2
+ /* empty css */
3
+ import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var c = function() {
5
+ var e = this, s = e._self._c, t = e._self._setupProxy;
6
+ return s("div", { staticClass: "ai-message-actions d-f a-i-c" }, [s("button", { staticClass: "ai-message-actions__btn d-i-f a-i-c j-c-c bor-n cur-p bor-r-1", attrs: { type: "button", title: t.trans("newsletter.ai-retry") }, on: { click: t.handleRetry } }, [s(t.InIcons, { attrs: { name: "line-reset", size: "20" } })], 1), s("button", { staticClass: "ai-message-actions__btn d-i-f a-i-c j-c-c bor-n cur-p bor-r-1", class: { "ai-message-actions__btn--success": t.copied }, attrs: { type: "button", title: t.copied ? t.trans("newsletter.ai-copied") : t.trans("newsletter.ai-copy") }, on: { click: t.handleCopy } }, [s(t.InIcons, { attrs: { size: "20", name: t.copied ? "line-success-status" : "line-copy" } })], 1)]);
7
+ }, i = [], r = /* @__PURE__ */ n(
8
+ a,
9
+ c,
10
+ i,
11
+ !1,
12
+ null,
13
+ "4b57f736"
14
+ );
15
+ const m = r.exports;
16
+ export {
17
+ m as default
18
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as m } from "vue";
2
+ import { useChatState as y } from "../../../../composables/useChatState.js";
3
+ import { useTranslations as l } from "../../../../composables/useTranslations.js";
4
+ import { InIcons as d } from "@useinsider/design-system-vue";
5
+ import { useClipboard as f } from "../../../../node_modules/@vueuse/core/index.js";
6
+ const v = /* @__PURE__ */ m({
7
+ __name: "AiMessageActions",
8
+ props: {
9
+ message: null
10
+ },
11
+ emits: ["copy", "retry"],
12
+ setup(p, { emit: e }) {
13
+ const t = p, c = l(), { copy: n, copied: i } = f({ copiedDuring: 2e3 }), { retryLastUserMessage: r } = y(), a = () => {
14
+ const { segments: o } = t.message;
15
+ return Array.isArray(o) && o.length > 0 ? o.filter((s) => s.type === "text").map((s) => s.content ?? "").join(`
16
+ `) : t.message.content;
17
+ };
18
+ return { __sfc: !0, props: t, emit: e, trans: c, copy: n, copied: i, retryLastUserMessage: r, getPlainText: a, handleCopy: () => {
19
+ n(a()), e("copy");
20
+ }, handleRetry: () => {
21
+ r(), e("retry");
22
+ }, InIcons: d };
23
+ }
24
+ });
25
+ export {
26
+ v as default
27
+ };
@@ -0,0 +1,18 @@
1
+ import i from "./ChatLoading.vue2.js";
2
+ /* empty css */
3
+ import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var c = function() {
5
+ var a = this, s = a._self._c, t = a._self._setupProxy;
6
+ return s("div", { staticClass: "chat-loading d-f a-i-c" }, [s("span", { staticClass: "chat-loading__icon d-i-f a-i-c j-c-c" }, [s(t.InIcons, { staticClass: "i-c-10", attrs: { name: "line-smart-sirius-ai", size: "20" } })], 1), s("span", { staticClass: "chat-loading__text" }, [a._v(a._s(t.displayText))])]);
7
+ }, e = [], r = /* @__PURE__ */ n(
8
+ i,
9
+ c,
10
+ e,
11
+ !1,
12
+ null,
13
+ "4a52f577"
14
+ );
15
+ const d = r.exports;
16
+ export {
17
+ d as default
18
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as i, ref as c, computed as u, onMounted as p, onUnmounted as d } from "vue";
2
+ import { useTranslations as f } from "../../../../composables/useTranslations.js";
3
+ import { InIcons as g } from "@useinsider/design-system-vue";
4
+ const _ = /* @__PURE__ */ i({
5
+ __name: "ChatLoading",
6
+ props: {
7
+ text: { default: "" },
8
+ cycling: { type: Boolean, default: !0 }
9
+ },
10
+ setup(l) {
11
+ const e = l, o = 2500, s = f(), n = c(0);
12
+ let t = null;
13
+ const a = [
14
+ "newsletter.ai-loading-analyzing",
15
+ "newsletter.ai-loading-processing",
16
+ "newsletter.ai-loading-searching",
17
+ "newsletter.ai-loading-synthesizing"
18
+ ], r = u(() => e.text ? e.text : s(a[n.value]));
19
+ return p(() => {
20
+ e.cycling && !e.text && (t = setInterval(() => {
21
+ n.value = (n.value + 1) % a.length;
22
+ }, o));
23
+ }), d(() => {
24
+ t && (clearInterval(t), t = null);
25
+ }), { __sfc: !0, PHASE_INTERVAL: o, props: e, trans: s, phaseIndex: n, intervalId: t, phases: a, displayText: r, InIcons: g };
26
+ }
27
+ });
28
+ export {
29
+ _ as default
30
+ };
@@ -0,0 +1,26 @@
1
+ import i from "./ChatMessages.vue2.js";
2
+ /* empty css */
3
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var a = function() {
5
+ var e = this, n = e._self._c, r = e._self._setupProxy;
6
+ return n("div", { ref: "containerRef", staticClass: "chat-messages f-g-1", staticStyle: { "min-height": "0" } }, [n("div", { staticClass: "chat-messages__list d-f f-d-c p-4" }, [e._l(e.messages, function(t) {
7
+ return [t.role === "user" ? n(r.UserMessage, { key: t.id, attrs: { content: t.content, "show-actions": t.id === r.lastUserMessageId, timestamp: t.timestamp }, on: { copy: function(s) {
8
+ return e.$emit("copy-message", t.id);
9
+ } } }) : n(r.AiMessage, { key: `ai-${t.id}`, attrs: { message: t }, on: { copy: function(s) {
10
+ return e.$emit("copy-message", t.id);
11
+ }, retry: function(s) {
12
+ return e.$emit("retry", t.id);
13
+ } } })];
14
+ })], 2)]);
15
+ }, c = [], f = /* @__PURE__ */ o(
16
+ i,
17
+ a,
18
+ c,
19
+ !1,
20
+ null,
21
+ "42f0f380"
22
+ );
23
+ const u = f.exports;
24
+ export {
25
+ u as default
26
+ };
@@ -0,0 +1,67 @@
1
+ import { defineComponent as _, ref as m, inject as H, computed as C, watch as f, onMounted as M, nextTick as g, onUnmounted as T } from "vue";
2
+ import x from "./AiMessage.vue.js";
3
+ import U from "./UserMessage.vue.js";
4
+ const R = /* @__PURE__ */ _({
5
+ __name: "ChatMessages",
6
+ props: {
7
+ messages: null,
8
+ autoScroll: { type: Boolean, default: !0 }
9
+ },
10
+ emits: ["copy-message", "retry", "scroll"],
11
+ setup(S, { emit: d }) {
12
+ const t = S, p = 50, h = m(null), i = H("chatScrollContainer", m(null)), n = m(!1), E = C(() => {
13
+ for (let e = t.messages.length - 1; e >= 0; e--)
14
+ if (t.messages[e].role === "user")
15
+ return t.messages[e].id;
16
+ return null;
17
+ }), r = () => i.value ?? h.value, c = (e = !1) => {
18
+ if (n.value && !e)
19
+ return;
20
+ const o = r();
21
+ o && g(() => {
22
+ o.scrollTo({
23
+ top: o.scrollHeight,
24
+ behavior: "smooth"
25
+ }), e && (n.value = !1);
26
+ });
27
+ }, a = () => {
28
+ const e = r();
29
+ if (!e)
30
+ return;
31
+ const { scrollHeight: o, scrollTop: l, clientHeight: L } = e, v = o - l - L < p;
32
+ n.value = !v, d("scroll", { isAtBottom: v, scrollTop: l });
33
+ };
34
+ f(
35
+ () => t.messages.length,
36
+ () => {
37
+ t.autoScroll && c();
38
+ }
39
+ ), f(
40
+ () => {
41
+ var o, l;
42
+ const e = t.messages[t.messages.length - 1];
43
+ return e != null && e.isStreaming ? ((o = e.content) == null ? void 0 : o.length) ?? ((l = e.segments) == null ? void 0 : l.length) ?? 0 : -1;
44
+ },
45
+ () => {
46
+ t.autoScroll && c();
47
+ }
48
+ );
49
+ let s = null;
50
+ const u = () => {
51
+ const e = r();
52
+ e !== s && (s && s.removeEventListener("scroll", a), e && (e.addEventListener("scroll", a), s = e));
53
+ };
54
+ return M(() => {
55
+ g(() => {
56
+ u(), c(!0);
57
+ });
58
+ }), f(i, () => {
59
+ g(() => u());
60
+ }), T(() => {
61
+ s && (s.removeEventListener("scroll", a), s = null);
62
+ }), { __sfc: !0, SCROLL_THRESHOLD: p, props: t, emit: d, containerRef: h, externalContainer: i, userHasScrolledUp: n, lastUserMessageId: E, getScrollElement: r, scrollToBottom: c, handleScroll: a, boundScrollEl: s, bindScrollListener: u, AiMessage: x, UserMessage: U };
63
+ }
64
+ });
65
+ export {
66
+ R as default
67
+ };
@@ -0,0 +1,18 @@
1
+ import a from "./UserMessage.vue2.js";
2
+ /* empty css */
3
+ import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var i = function() {
5
+ var s = this, e = s._self._c, t = s._self._setupProxy;
6
+ return e("div", { staticClass: "user-message d-f f-d-c a-i-f-e w-1" }, [e("div", { staticClass: "user-message__view-wrapper" }, [e("div", { staticClass: "user-message__bubble-row d-f a-i-f-s j-c-f-e w-1" }, [s.showActions ? e("div", { staticClass: "user-message__actions d-f a-i-c" }, [e("button", { staticClass: "user-message__action-btn d-i-f a-i-c j-c-c bor-n cur-p bor-r-1", class: { "user-message__action-btn--success": t.copied }, attrs: { type: "button", title: t.copied ? t.trans("newsletter.ai-copied") : t.trans("newsletter.ai-copy") }, on: { click: t.handleCopy } }, [e(t.InIcons, { attrs: { size: "20", name: t.copied ? "line-success-status" : "line-copy" } })], 1)]) : s._e(), e("div", { staticClass: "user-message__bubble" }, [e("span", { staticClass: "user-message__text" }, [s._v(s._s(s.content))])])]), e("span", { staticClass: "user-message__timestamp" }, [s._v(" " + s._s(t.trans("newsletter.ai-you")) + " - " + s._s(t.formattedTime) + " ")])])]);
7
+ }, c = [], n = /* @__PURE__ */ r(
8
+ a,
9
+ i,
10
+ c,
11
+ !1,
12
+ null,
13
+ "bc03b908"
14
+ );
15
+ const u = n.exports;
16
+ export {
17
+ u as default
18
+ };
@@ -0,0 +1,26 @@
1
+ import { defineComponent as i, computed as a } from "vue";
2
+ import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
+ import { InIcons as m } from "@useinsider/design-system-vue";
4
+ import { useClipboard as c } from "../../../../node_modules/@vueuse/core/index.js";
5
+ const h = /* @__PURE__ */ i({
6
+ __name: "UserMessage",
7
+ props: {
8
+ content: null,
9
+ timestamp: { default: () => Date.now() },
10
+ showActions: { type: Boolean, default: !0 }
11
+ },
12
+ emits: ["copy"],
13
+ setup(o) {
14
+ const t = o, n = p(), { copy: e, copied: s } = c({ copiedDuring: 2e3 }), r = a(() => new Date(t.timestamp).toLocaleTimeString("en-US", {
15
+ hour: "2-digit",
16
+ minute: "2-digit",
17
+ hour12: !1
18
+ }));
19
+ return { __sfc: !0, props: t, trans: n, copy: e, copied: s, formattedTime: r, handleCopy: () => {
20
+ e(t.content);
21
+ }, InIcons: m };
22
+ }
23
+ });
24
+ export {
25
+ h as default
26
+ };
@@ -1,37 +1,57 @@
1
- import { defineComponent as p, computed as e, watch as m } from "vue";
2
- import { useTranslations as g } from "../../../composables/useTranslations.js";
3
- import { useOnboardingStore as u } from "../../../stores/onboarding.js";
4
- import { InOnboard as b } from "@useinsider/design-system-vue";
5
- const O = /* @__PURE__ */ p({
1
+ import { defineComponent as u, computed as d, watch as b, nextTick as f } from "vue";
2
+ import { useTranslations as C } from "../../../composables/useTranslations.js";
3
+ import { HEADER_SELECTOR as O, AMP_TOGGLE_BUTTON_SELECTOR as _, AMP_TOGGLE_WRAPPER_SELECTOR as T, POPOVER_LEFT_OFFSET as g, POPOVER_TOP_GAP as E } from "../../../enums/onboarding.js";
4
+ import { useOnboardingStore as x } from "../../../stores/onboarding.js";
5
+ import { InOnboard as P } from "@useinsider/design-system-vue";
6
+ const G = /* @__PURE__ */ u({
6
7
  __name: "AMPOnboarding",
7
- setup(l) {
8
- const i = g(), o = u(), r = e(() => `${window.innerWidth / 2 - 110}px`), a = e(() => [
9
- {
10
- classes: "guido-amp-onboarding",
11
- left: r.value,
12
- top: "70px",
13
- position: "Top Center",
14
- title: i("email-editor.onboarding-amp-title"),
15
- description: i("email-editor.onboarding-amp-description"),
16
- imageSource: "",
17
- backButtonClick: () => {
18
- },
19
- nextButtonType: "text",
20
- nextButtonText: i("action-builder.ok"),
21
- nextButtonClick: () => void o.close("ampOnboarding")
22
- }
23
- ]), d = e(() => o.onboardings.ampOnboarding.config.length > 0 && o.onboardings.ampOnboarding.isActive), s = () => {
24
- var n, t;
25
- (t = (n = o.getAmpCurrentCard) == null ? void 0 : n.nextButtonClick) == null || t.call(n);
26
- }, c = () => {
27
- var n, t;
28
- (t = (n = o.getAmpCurrentCard) == null ? void 0 : n.backButtonClick) == null || t.call(n);
8
+ setup(R) {
9
+ const e = C(), o = x(), r = () => {
10
+ const t = document.querySelector(O), n = document.querySelector(_), c = n == null ? void 0 : n.closest(T);
11
+ if (!c || !t)
12
+ return {
13
+ left: `${((t == null ? void 0 : t.offsetWidth) ?? window.innerWidth) / 2 - g}px`,
14
+ top: "68px"
15
+ };
16
+ const s = t.getBoundingClientRect(), i = c.getBoundingClientRect();
17
+ return {
18
+ left: `${i.left - s.left + i.width / 2 - g}px`,
19
+ top: `${i.bottom - s.top + E}px`
20
+ };
21
+ }, a = d(() => {
22
+ const { left: t, top: n } = r();
23
+ return [
24
+ {
25
+ classes: "guido-amp-onboarding",
26
+ left: t,
27
+ top: n,
28
+ position: "Top Center",
29
+ title: e("email-editor.onboarding-amp-title"),
30
+ description: e("email-editor.onboarding-amp-description"),
31
+ imageSource: "",
32
+ backButtonClick: () => {
33
+ },
34
+ nextButtonType: "text",
35
+ nextButtonText: e("action-builder.ok"),
36
+ nextButtonClick: () => void o.close("ampOnboarding")
37
+ }
38
+ ];
39
+ }), l = d(() => o.onboardings.ampOnboarding.config.length > 0 && o.onboardings.ampOnboarding.isActive), p = () => {
40
+ var t, n;
41
+ (n = (t = o.getAmpCurrentCard) == null ? void 0 : t.nextButtonClick) == null || n.call(t);
42
+ }, m = () => {
43
+ var t, n;
44
+ (n = (t = o.getAmpCurrentCard) == null ? void 0 : t.backButtonClick) == null || n.call(t);
29
45
  };
30
- return m(() => o.onboardings.ampOnboarding.isActive, (n) => {
31
- n && o.setConfig("ampOnboarding", a.value);
32
- }, { immediate: !0 }), { __sfc: !0, trans: i, onboardingStore: o, centerLeft: r, onboardingCardsConfig: a, isVisible: d, handleNext: s, handleBack: c, InOnboard: b };
46
+ return b(
47
+ () => o.onboardings.ampOnboarding.isActive,
48
+ async (t) => {
49
+ t && (await f(), o.setConfig("ampOnboarding", a.value));
50
+ },
51
+ { immediate: !0 }
52
+ ), { __sfc: !0, trans: e, onboardingStore: o, getTogglePosition: r, onboardingCardsConfig: a, isVisible: l, handleNext: p, handleBack: m, InOnboard: P };
33
53
  }
34
54
  });
35
55
  export {
36
- O as default
56
+ G as default
37
57
  };