@n8n/chat 0.9.1 → 0.10.0

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 (207) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.cjs +10 -0
  3. package/.np-config.json +5 -0
  4. package/.storybook/main.ts +4 -0
  5. package/.storybook/preview.scss +4 -0
  6. package/.storybook/preview.ts +15 -0
  7. package/.vscode/extensions.json +3 -0
  8. package/build.config.js +21 -0
  9. package/env.d.ts +1 -0
  10. package/index.html +13 -0
  11. package/package.json +2 -35
  12. package/resources/images/fullscreen.png +0 -0
  13. package/resources/images/windowed.png +0 -0
  14. package/resources/workflow-manual.json +238 -0
  15. package/resources/workflow.json +119 -0
  16. package/scripts/pack.js +11 -0
  17. package/scripts/postbuild.js +36 -0
  18. package/src/__stories__/App.stories.ts +43 -0
  19. package/src/__tests__/index.spec.ts +218 -0
  20. package/src/__tests__/utils/create.ts +16 -0
  21. package/src/__tests__/utils/fetch.ts +18 -0
  22. package/src/__tests__/utils/selectors.ts +53 -0
  23. package/src/api/generic.ts +63 -0
  24. package/src/api/message.ts +37 -0
  25. package/src/components/Button.vue +41 -0
  26. package/src/components/ChatWindow.vue +125 -0
  27. package/{components → src/components}/GetStarted.vue +7 -7
  28. package/{components → src/components}/GetStartedFooter.vue +2 -2
  29. package/{components → src/components}/Input.vue +39 -34
  30. package/{components → src/components}/Layout.vue +42 -26
  31. package/{components → src/components}/Message.vue +46 -39
  32. package/src/components/MessageTyping.vue +109 -0
  33. package/{components → src/components}/MessagesList.vue +4 -4
  34. package/{components → src/components}/PoweredBy.vue +7 -6
  35. package/src/composables/useChat.ts +7 -0
  36. package/src/composables/useI18n.ts +16 -0
  37. package/src/composables/useOptions.ts +11 -0
  38. package/src/constants/defaults.ts +29 -0
  39. package/{constants/localStorage.mjs → src/constants/localStorage.ts} +1 -1
  40. package/src/constants/symbols.ts +8 -0
  41. package/src/css/_tokens.scss +36 -0
  42. package/src/css/index.scss +1 -0
  43. package/src/event-buses/chatEventBus.ts +3 -0
  44. package/src/index.ts +42 -0
  45. package/src/main.scss +5 -0
  46. package/src/plugins/chat.ts +115 -0
  47. package/src/types/chat.ts +12 -0
  48. package/src/types/messages.ts +6 -0
  49. package/src/types/options.ts +28 -0
  50. package/src/types/webhook.ts +18 -0
  51. package/src/utils/event-bus.ts +51 -0
  52. package/src/utils/mount.ts +16 -0
  53. package/tsconfig.json +27 -0
  54. package/vite.config.ts +60 -0
  55. package/vitest.config.ts +20 -0
  56. package/__stories__/App.stories.d.ts +0 -16
  57. package/__stories__/App.stories.js +0 -38
  58. package/__stories__/App.stories.mjs +0 -32
  59. package/__tests__/index.spec.d.ts +0 -1
  60. package/__tests__/index.spec.js +0 -146
  61. package/__tests__/index.spec.mjs +0 -172
  62. package/__tests__/setup.js +0 -3
  63. package/__tests__/setup.mjs +0 -1
  64. package/__tests__/utils/create.d.ts +0 -5
  65. package/__tests__/utils/create.js +0 -16
  66. package/__tests__/utils/create.mjs +0 -10
  67. package/__tests__/utils/fetch.d.ts +0 -3
  68. package/__tests__/utils/fetch.js +0 -20
  69. package/__tests__/utils/fetch.mjs +0 -9
  70. package/__tests__/utils/index.js +0 -38
  71. package/__tests__/utils/index.mjs +0 -3
  72. package/__tests__/utils/selectors.d.ts +0 -12
  73. package/__tests__/utils/selectors.js +0 -58
  74. package/__tests__/utils/selectors.mjs +0 -41
  75. package/api/generic.d.ts +0 -6
  76. package/api/generic.js +0 -68
  77. package/api/generic.mjs +0 -54
  78. package/api/index.js +0 -27
  79. package/api/index.mjs +0 -2
  80. package/api/message.d.ts +0 -3
  81. package/api/message.js +0 -33
  82. package/api/message.mjs +0 -30
  83. package/chat.bundle.es.js +0 -10761
  84. package/chat.bundle.umd.js +0 -18
  85. package/chat.es.js +0 -6872
  86. package/chat.umd.js +0 -18
  87. package/components/Button.vue +0 -34
  88. package/components/ChatWindow.vue +0 -104
  89. package/components/MessageTyping.vue +0 -101
  90. package/components/index.js +0 -76
  91. package/components/index.mjs +0 -10
  92. package/composables/index.js +0 -38
  93. package/composables/index.mjs +0 -3
  94. package/composables/useChat.d.ts +0 -1
  95. package/composables/useChat.js +0 -11
  96. package/composables/useChat.mjs +0 -5
  97. package/composables/useI18n.d.ts +0 -4
  98. package/composables/useI18n.js +0 -23
  99. package/composables/useI18n.mjs +0 -12
  100. package/composables/useOptions.d.ts +0 -3
  101. package/composables/useOptions.js +0 -14
  102. package/composables/useOptions.mjs +0 -8
  103. package/constants/defaults.d.ts +0 -3
  104. package/constants/defaults.js +0 -32
  105. package/constants/defaults.mjs +0 -26
  106. package/constants/index.js +0 -38
  107. package/constants/index.mjs +0 -3
  108. package/constants/localStorage.d.ts +0 -2
  109. package/constants/localStorage.js +0 -8
  110. package/constants/symbols.d.ts +0 -3
  111. package/constants/symbols.js +0 -8
  112. package/constants/symbols.mjs +0 -2
  113. package/css/index.css +0 -31
  114. package/event-buses/chatEventBus.d.ts +0 -1
  115. package/event-buses/chatEventBus.js +0 -8
  116. package/event-buses/chatEventBus.mjs +0 -2
  117. package/event-buses/index.js +0 -16
  118. package/event-buses/index.mjs +0 -1
  119. package/index.d.ts +0 -3
  120. package/index.js +0 -43
  121. package/index.mjs +0 -36
  122. package/main.css +0 -151
  123. package/plugins/chat.d.ts +0 -3
  124. package/plugins/chat.js +0 -91
  125. package/plugins/chat.mjs +0 -90
  126. package/plugins/index.js +0 -16
  127. package/plugins/index.mjs +0 -1
  128. package/style.css +0 -1
  129. package/types/App.vue.d.ts +0 -8
  130. package/types/__stories__/App.stories.d.ts +0 -17
  131. package/types/__tests__/index.spec.d.ts +0 -1
  132. package/types/__tests__/setup.d.ts +0 -0
  133. package/types/__tests__/utils/create.d.ts +0 -5
  134. package/types/__tests__/utils/fetch.d.ts +0 -4
  135. package/types/__tests__/utils/index.d.ts +0 -3
  136. package/types/__tests__/utils/selectors.d.ts +0 -12
  137. package/types/api/generic.d.ts +0 -6
  138. package/types/api/index.d.ts +0 -2
  139. package/types/api/message.d.ts +0 -3
  140. package/types/chat.d.ts +0 -11
  141. package/types/chat.js +0 -1
  142. package/types/chat.mjs +0 -0
  143. package/types/components/Button.vue.d.ts +0 -9
  144. package/types/components/Chat.vue.d.ts +0 -2
  145. package/types/components/ChatWindow.vue.d.ts +0 -2
  146. package/types/components/GetStarted.vue.d.ts +0 -2
  147. package/types/components/GetStartedFooter.vue.d.ts +0 -2
  148. package/types/components/Input.vue.d.ts +0 -2
  149. package/types/components/Layout.vue.d.ts +0 -11
  150. package/types/components/Message.vue.d.ts +0 -21
  151. package/types/components/MessageTyping.vue.d.ts +0 -15
  152. package/types/components/MessagesList.vue.d.ts +0 -14
  153. package/types/components/PoweredBy.vue.d.ts +0 -2
  154. package/types/components/index.d.ts +0 -10
  155. package/types/composables/index.d.ts +0 -3
  156. package/types/composables/useChat.d.ts +0 -2
  157. package/types/composables/useI18n.d.ts +0 -4
  158. package/types/composables/useOptions.d.ts +0 -4
  159. package/types/constants/defaults.d.ts +0 -3
  160. package/types/constants/index.d.ts +0 -3
  161. package/types/constants/localStorage.d.ts +0 -2
  162. package/types/constants/symbols.d.ts +0 -4
  163. package/types/event-buses/chatEventBus.d.ts +0 -1
  164. package/types/event-buses/index.d.ts +0 -1
  165. package/types/index.js +0 -49
  166. package/types/index.mjs +0 -4
  167. package/types/messages.d.ts +0 -6
  168. package/types/messages.js +0 -1
  169. package/types/messages.mjs +0 -0
  170. package/types/options.d.ts +0 -25
  171. package/types/options.js +0 -1
  172. package/types/options.mjs +0 -0
  173. package/types/plugins/chat.d.ts +0 -3
  174. package/types/plugins/index.d.ts +0 -1
  175. package/types/types/chat.d.ts +0 -11
  176. package/types/types/index.d.ts +0 -4
  177. package/types/types/messages.d.ts +0 -6
  178. package/types/types/options.d.ts +0 -25
  179. package/types/types/webhook.d.ts +0 -16
  180. package/types/utils/event-bus.d.ts +0 -8
  181. package/types/utils/mount.d.ts +0 -1
  182. package/types/webhook.d.ts +0 -16
  183. package/types/webhook.js +0 -1
  184. package/types/webhook.mjs +0 -0
  185. package/utils/event-bus.d.ts +0 -8
  186. package/utils/event-bus.js +0 -38
  187. package/utils/event-bus.mjs +0 -32
  188. package/utils/index.d.ts +0 -2
  189. package/utils/index.js +0 -27
  190. package/utils/index.mjs +0 -2
  191. package/utils/mount.d.ts +0 -1
  192. package/utils/mount.js +0 -19
  193. package/utils/mount.mjs +0 -13
  194. /package/{favicon.ico → public/favicon.ico} +0 -0
  195. /package/{App.vue → src/App.vue} +0 -0
  196. /package/{__tests__/setup.d.ts → src/__tests__/setup.ts} +0 -0
  197. /package/{__tests__/utils/index.d.ts → src/__tests__/utils/index.ts} +0 -0
  198. /package/{api/index.d.ts → src/api/index.ts} +0 -0
  199. /package/{components → src/components}/Chat.vue +0 -0
  200. /package/{components/index.d.ts → src/components/index.ts} +0 -0
  201. /package/{composables/index.d.ts → src/composables/index.ts} +0 -0
  202. /package/{constants/index.d.ts → src/constants/index.ts} +0 -0
  203. /package/{event-buses/index.d.ts → src/event-buses/index.ts} +0 -0
  204. /package/{plugins/index.d.ts → src/plugins/index.ts} +0 -0
  205. /package/{shims.d.ts → src/shims.d.ts} +0 -0
  206. /package/{types/index.d.ts → src/types/index.ts} +0 -0
  207. /package/{types/utils/index.d.ts → src/utils/index.ts} +0 -0
@@ -1,101 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { PropType } from 'vue';
3
- import { computed } from 'vue';
4
- import { Message } from './index';
5
- import type { ChatMessage } from '@n8n/chat/types';
6
-
7
- const props = defineProps({
8
- animation: {
9
- type: String as PropType<'bouncing' | 'scaling'>,
10
- default: 'bouncing',
11
- },
12
- });
13
-
14
- const message: ChatMessage = {
15
- id: 'typing',
16
- text: '',
17
- sender: 'bot',
18
- createdAt: '',
19
- };
20
-
21
- const classes = computed(() => {
22
- return {
23
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
- 'chat-message-typing': true,
25
- [`chat-message-typing-animation-${props.animation}`]: true,
26
- };
27
- });
28
- </script>
29
- <template>
30
- <Message :class="classes" :message="message">
31
- <div class="chat-message-typing-body">
32
- <span class="chat-message-typing-circle"></span>
33
- <span class="chat-message-typing-circle"></span>
34
- <span class="chat-message-typing-circle"></span>
35
- </div>
36
- </Message>
37
- </template>
38
- <style>
39
- .chat-message-typing {
40
- max-width: 80px;
41
- }
42
- .chat-message-typing.chat-message-typing-animation-scaling .chat-message-typing-circle {
43
- animation: chat-message-typing-animation-scaling 800ms ease-in-out infinite;
44
- animation-delay: 3600ms;
45
- }
46
- .chat-message-typing.chat-message-typing-animation-bouncing .chat-message-typing-circle {
47
- animation: chat-message-typing-animation-bouncing 800ms ease-in-out infinite;
48
- animation-delay: 3600ms;
49
- }
50
- .chat-message-typing .chat-message-typing-body {
51
- display: flex;
52
- justify-content: center;
53
- align-items: center;
54
- }
55
- .chat-message-typing .chat-message-typing-circle {
56
- display: block;
57
- height: 10px;
58
- width: 10px;
59
- border-radius: 50%;
60
- background-color: var(--chat--color-typing);
61
- margin: 3px;
62
- }
63
- .chat-message-typing .chat-message-typing-circle:nth-child(1) {
64
- animation-delay: 0ms;
65
- }
66
- .chat-message-typing .chat-message-typing-circle:nth-child(2) {
67
- animation-delay: 333ms;
68
- }
69
- .chat-message-typing .chat-message-typing-circle:nth-child(3) {
70
- animation-delay: 666ms;
71
- }
72
-
73
- @keyframes chat-message-typing-animation-scaling {
74
- 0% {
75
- transform: scale(1);
76
- }
77
- 33% {
78
- transform: scale(1);
79
- }
80
- 50% {
81
- transform: scale(1.4);
82
- }
83
- 100% {
84
- transform: scale(1);
85
- }
86
- }
87
- @keyframes chat-message-typing-animation-bouncing {
88
- 0% {
89
- transform: translateY(0);
90
- }
91
- 33% {
92
- transform: translateY(0);
93
- }
94
- 50% {
95
- transform: translateY(-10px);
96
- }
97
- 100% {
98
- transform: translateY(0);
99
- }
100
- }
101
- </style>
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Button", {
7
- enumerable: true,
8
- get: function () {
9
- return _Button.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "Chat", {
13
- enumerable: true,
14
- get: function () {
15
- return _Chat.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "ChatWindow", {
19
- enumerable: true,
20
- get: function () {
21
- return _ChatWindow.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "GetStarted", {
25
- enumerable: true,
26
- get: function () {
27
- return _GetStarted.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "GetStartedFooter", {
31
- enumerable: true,
32
- get: function () {
33
- return _GetStartedFooter.default;
34
- }
35
- });
36
- Object.defineProperty(exports, "Input", {
37
- enumerable: true,
38
- get: function () {
39
- return _Input.default;
40
- }
41
- });
42
- Object.defineProperty(exports, "Layout", {
43
- enumerable: true,
44
- get: function () {
45
- return _Layout.default;
46
- }
47
- });
48
- Object.defineProperty(exports, "Message", {
49
- enumerable: true,
50
- get: function () {
51
- return _Message.default;
52
- }
53
- });
54
- Object.defineProperty(exports, "MessagesList", {
55
- enumerable: true,
56
- get: function () {
57
- return _MessagesList.default;
58
- }
59
- });
60
- Object.defineProperty(exports, "PoweredBy", {
61
- enumerable: true,
62
- get: function () {
63
- return _PoweredBy.default;
64
- }
65
- });
66
- var _Button = _interopRequireDefault(require("./Button.vue"));
67
- var _Chat = _interopRequireDefault(require("./Chat.vue"));
68
- var _ChatWindow = _interopRequireDefault(require("./ChatWindow.vue"));
69
- var _GetStarted = _interopRequireDefault(require("./GetStarted.vue"));
70
- var _GetStartedFooter = _interopRequireDefault(require("./GetStartedFooter.vue"));
71
- var _Input = _interopRequireDefault(require("./Input.vue"));
72
- var _Layout = _interopRequireDefault(require("./Layout.vue"));
73
- var _Message = _interopRequireDefault(require("./Message.vue"));
74
- var _MessagesList = _interopRequireDefault(require("./MessagesList.vue"));
75
- var _PoweredBy = _interopRequireDefault(require("./PoweredBy.vue"));
76
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,10 +0,0 @@
1
- export { default as Button } from "./Button.vue";
2
- export { default as Chat } from "./Chat.vue";
3
- export { default as ChatWindow } from "./ChatWindow.vue";
4
- export { default as GetStarted } from "./GetStarted.vue";
5
- export { default as GetStartedFooter } from "./GetStartedFooter.vue";
6
- export { default as Input } from "./Input.vue";
7
- export { default as Layout } from "./Layout.vue";
8
- export { default as Message } from "./Message.vue";
9
- export { default as MessagesList } from "./MessagesList.vue";
10
- export { default as PoweredBy } from "./PoweredBy.vue";
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _useChat = require("./useChat");
7
- Object.keys(_useChat).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _useChat[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _useChat[key];
14
- }
15
- });
16
- });
17
- var _useI18n = require("./useI18n");
18
- Object.keys(_useI18n).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _useI18n[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _useI18n[key];
25
- }
26
- });
27
- });
28
- var _useOptions = require("./useOptions");
29
- Object.keys(_useOptions).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _useOptions[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _useOptions[key];
36
- }
37
- });
38
- });
@@ -1,3 +0,0 @@
1
- export * from "./useChat.mjs";
2
- export * from "./useI18n.mjs";
3
- export * from "./useOptions.mjs";
@@ -1 +0,0 @@
1
- export declare function useChat(): Chat;
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useChat = useChat;
7
- var _vue = require("vue");
8
- var _constants = require("@n8n/chat/constants");
9
- function useChat() {
10
- return (0, _vue.inject)(_constants.ChatSymbol);
11
- }
@@ -1,5 +0,0 @@
1
- import { inject } from "vue";
2
- import { ChatSymbol } from "@n8n/chat/constants";
3
- export function useChat() {
4
- return inject(ChatSymbol);
5
- }
@@ -1,4 +0,0 @@
1
- export declare function useI18n(): {
2
- t: (key: string) => string;
3
- te: (key: string) => boolean;
4
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useI18n = useI18n;
7
- var _useOptions = require("@n8n/chat/composables/useOptions");
8
- function useI18n() {
9
- const {
10
- options
11
- } = (0, _useOptions.useOptions)();
12
- const language = options?.defaultLanguage ?? "en";
13
- function t(key) {
14
- return options?.i18n?.[language]?.[key] ?? key;
15
- }
16
- function te(key) {
17
- return !!options?.i18n?.[language]?.[key];
18
- }
19
- return {
20
- t,
21
- te
22
- };
23
- }
@@ -1,12 +0,0 @@
1
- import { useOptions } from "@n8n/chat/composables/useOptions";
2
- export function useI18n() {
3
- const { options } = useOptions();
4
- const language = options?.defaultLanguage ?? "en";
5
- function t(key) {
6
- return options?.i18n?.[language]?.[key] ?? key;
7
- }
8
- function te(key) {
9
- return !!options?.i18n?.[language]?.[key];
10
- }
11
- return { t, te };
12
- }
@@ -1,3 +0,0 @@
1
- export declare function useOptions(): {
2
- options: ChatOptions;
3
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useOptions = useOptions;
7
- var _vue = require("vue");
8
- var _constants = require("@n8n/chat/constants");
9
- function useOptions() {
10
- const options = (0, _vue.inject)(_constants.ChatOptionsSymbol);
11
- return {
12
- options
13
- };
14
- }
@@ -1,8 +0,0 @@
1
- import { inject } from "vue";
2
- import { ChatOptionsSymbol } from "@n8n/chat/constants";
3
- export function useOptions() {
4
- const options = inject(ChatOptionsSymbol);
5
- return {
6
- options
7
- };
8
- }
@@ -1,3 +0,0 @@
1
- import type { ChatOptions } from '@n8n/chat/types';
2
- export declare const defaultOptions: ChatOptions;
3
- export declare const defaultMountingTarget = "#n8n-chat";
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.defaultOptions = exports.defaultMountingTarget = void 0;
7
- const defaultOptions = exports.defaultOptions = {
8
- webhookUrl: "http://localhost:5678",
9
- webhookConfig: {
10
- method: "POST",
11
- headers: {}
12
- },
13
- target: "#n8n-chat",
14
- mode: "window",
15
- loadPreviousSession: true,
16
- chatInputKey: "chatInput",
17
- chatSessionKey: "sessionId",
18
- defaultLanguage: "en",
19
- showWelcomeScreen: false,
20
- initialMessages: ["Hi there! \u{1F44B}", "My name is Nathan. How can I assist you today?"],
21
- i18n: {
22
- en: {
23
- title: "Hi there! \u{1F44B}",
24
- subtitle: "Start a chat. We're here to help you 24/7.",
25
- footer: "",
26
- getStarted: "New Conversation",
27
- inputPlaceholder: "Type your question.."
28
- }
29
- },
30
- theme: {}
31
- };
32
- const defaultMountingTarget = exports.defaultMountingTarget = "#n8n-chat";
@@ -1,26 +0,0 @@
1
- export const defaultOptions = {
2
- webhookUrl: "http://localhost:5678",
3
- webhookConfig: {
4
- method: "POST",
5
- headers: {}
6
- },
7
- target: "#n8n-chat",
8
- mode: "window",
9
- loadPreviousSession: true,
10
- chatInputKey: "chatInput",
11
- chatSessionKey: "sessionId",
12
- defaultLanguage: "en",
13
- showWelcomeScreen: false,
14
- initialMessages: ["Hi there! \u{1F44B}", "My name is Nathan. How can I assist you today?"],
15
- i18n: {
16
- en: {
17
- title: "Hi there! \u{1F44B}",
18
- subtitle: "Start a chat. We're here to help you 24/7.",
19
- footer: "",
20
- getStarted: "New Conversation",
21
- inputPlaceholder: "Type your question.."
22
- }
23
- },
24
- theme: {}
25
- };
26
- export const defaultMountingTarget = "#n8n-chat";
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _defaults = require("./defaults");
7
- Object.keys(_defaults).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _defaults[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _defaults[key];
14
- }
15
- });
16
- });
17
- var _localStorage = require("./localStorage");
18
- Object.keys(_localStorage).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _localStorage[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _localStorage[key];
25
- }
26
- });
27
- });
28
- var _symbols = require("./symbols");
29
- Object.keys(_symbols).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _symbols[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _symbols[key];
36
- }
37
- });
38
- });
@@ -1,3 +0,0 @@
1
- export * from "./defaults.mjs";
2
- export * from "./localStorage.mjs";
3
- export * from "./symbols.mjs";
@@ -1,2 +0,0 @@
1
- export declare const localStorageNamespace = "n8n-chat";
2
- export declare const localStorageSessionIdKey = "n8n-chat/sessionId";
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.localStorageSessionIdKey = exports.localStorageNamespace = void 0;
7
- const localStorageNamespace = exports.localStorageNamespace = "n8n-chat";
8
- const localStorageSessionIdKey = exports.localStorageSessionIdKey = `${localStorageNamespace}/sessionId`;
@@ -1,3 +0,0 @@
1
- import type { InjectionKey } from 'vue';
2
- export declare const ChatSymbol: InjectionKey<Chat>;
3
- export declare const ChatOptionsSymbol: InjectionKey<ChatOptions>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ChatSymbol = exports.ChatOptionsSymbol = void 0;
7
- const ChatSymbol = exports.ChatSymbol = "Chat";
8
- const ChatOptionsSymbol = exports.ChatOptionsSymbol = "ChatOptions";
@@ -1,2 +0,0 @@
1
- export const ChatSymbol = "Chat";
2
- export const ChatOptionsSymbol = "ChatOptions";
package/css/index.css DELETED
@@ -1,31 +0,0 @@
1
- :root {
2
- --chat--color-primary: #e74266;
3
- --chat--color-primary-shade-50: #db4061;
4
- --chat--color-primary-shade-100: #cf3c5c;
5
- --chat--color-secondary: #20b69e;
6
- --chat--color-secondary-shade-50: #1ca08a;
7
- --chat--color-white: #ffffff;
8
- --chat--color-light: #f2f4f8;
9
- --chat--color-light-shade-50: #e6e9f1;
10
- --chat--color-light-shade-100: #c2c5cc;
11
- --chat--color-medium: #d2d4d9;
12
- --chat--color-dark: #101330;
13
- --chat--color-disabled: #777980;
14
- --chat--color-typing: #404040;
15
- --chat--spacing: 1rem;
16
- --chat--border-radius: 0.25rem;
17
- --chat--transition-duration: 0.15s;
18
- --chat--window--width: 400px;
19
- --chat--window--height: 600px;
20
- --chat--textarea--height: 50px;
21
- --chat--message--bot--background: var(--chat--color-white);
22
- --chat--message--bot--color: var(--chat--color-dark);
23
- --chat--message--user--background: var(--chat--color-secondary);
24
- --chat--message--user--color: var(--chat--color-white);
25
- --chat--message--pre--background: rgba(0, 0, 0, 0.05);
26
- --chat--toggle--background: var(--chat--color-primary);
27
- --chat--toggle--hover--background: var(--chat--color-primary-shade-50);
28
- --chat--toggle--active--background: var(--chat--color-primary-shade-100);
29
- --chat--toggle--color: var(--chat--color-white);
30
- --chat--toggle--size: 64px;
31
- }
@@ -1 +0,0 @@
1
- export declare const chatEventBus: any;
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.chatEventBus = void 0;
7
- var _utils = require("@n8n/chat/utils");
8
- const chatEventBus = exports.chatEventBus = (0, _utils.createEventBus)();
@@ -1,2 +0,0 @@
1
- import { createEventBus } from "@n8n/chat/utils";
2
- export const chatEventBus = createEventBus();
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _chatEventBus = require("./chatEventBus");
7
- Object.keys(_chatEventBus).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _chatEventBus[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _chatEventBus[key];
14
- }
15
- });
16
- });
@@ -1 +0,0 @@
1
- export * from "./chatEventBus.mjs";
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import './main.scss';
2
- import type { ChatOptions } from '@n8n/chat/types';
3
- export declare function createChat(options?: Partial<ChatOptions>): import("vue").App<Element>;
package/index.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createChat = createChat;
7
- require("./main.scss");
8
- var _vue = require("vue");
9
- var _App = _interopRequireDefault(require("./App.vue"));
10
- var _constants = require("@n8n/chat/constants");
11
- var _utils = require("@n8n/chat/utils");
12
- var _plugins = require("@n8n/chat/plugins");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- function createChat(options) {
15
- const resolvedOptions = {
16
- ..._constants.defaultOptions,
17
- ...options,
18
- webhookConfig: {
19
- ..._constants.defaultOptions.webhookConfig,
20
- ...options?.webhookConfig
21
- },
22
- i18n: {
23
- ..._constants.defaultOptions.i18n,
24
- ...options?.i18n,
25
- en: {
26
- ..._constants.defaultOptions.i18n?.en,
27
- ...options?.i18n?.en
28
- }
29
- },
30
- theme: {
31
- ..._constants.defaultOptions.theme,
32
- ...options?.theme
33
- }
34
- };
35
- const mountingTarget = resolvedOptions.target ?? _constants.defaultMountingTarget;
36
- if (typeof mountingTarget === "string") {
37
- (0, _utils.createDefaultMountingTarget)(mountingTarget);
38
- }
39
- const app = (0, _vue.createApp)(_App.default);
40
- app.use(_plugins.ChatPlugin, resolvedOptions);
41
- app.mount(mountingTarget);
42
- return app;
43
- }
package/index.mjs DELETED
@@ -1,36 +0,0 @@
1
- import "./main.scss";
2
- import { createApp } from "vue";
3
- import App from "./App.vue";
4
- import { defaultMountingTarget, defaultOptions } from "@n8n/chat/constants";
5
- import { createDefaultMountingTarget } from "@n8n/chat/utils";
6
- import { ChatPlugin } from "@n8n/chat/plugins";
7
- export function createChat(options) {
8
- const resolvedOptions = {
9
- ...defaultOptions,
10
- ...options,
11
- webhookConfig: {
12
- ...defaultOptions.webhookConfig,
13
- ...options?.webhookConfig
14
- },
15
- i18n: {
16
- ...defaultOptions.i18n,
17
- ...options?.i18n,
18
- en: {
19
- ...defaultOptions.i18n?.en,
20
- ...options?.i18n?.en
21
- }
22
- },
23
- theme: {
24
- ...defaultOptions.theme,
25
- ...options?.theme
26
- }
27
- };
28
- const mountingTarget = resolvedOptions.target ?? defaultMountingTarget;
29
- if (typeof mountingTarget === "string") {
30
- createDefaultMountingTarget(mountingTarget);
31
- }
32
- const app = createApp(App);
33
- app.use(ChatPlugin, resolvedOptions);
34
- app.mount(mountingTarget);
35
- return app;
36
- }