@n8n/chat 0.9.0 → 0.9.1

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/__stories__/App.stories.d.ts +16 -0
  2. package/__stories__/App.stories.js +38 -0
  3. package/__stories__/App.stories.mjs +32 -0
  4. package/__tests__/index.spec.d.ts +1 -0
  5. package/__tests__/index.spec.js +146 -0
  6. package/__tests__/index.spec.mjs +172 -0
  7. package/__tests__/setup.js +3 -0
  8. package/__tests__/setup.mjs +1 -0
  9. package/__tests__/utils/create.d.ts +5 -0
  10. package/__tests__/utils/create.js +16 -0
  11. package/__tests__/utils/create.mjs +10 -0
  12. package/__tests__/utils/fetch.d.ts +3 -0
  13. package/__tests__/utils/fetch.js +20 -0
  14. package/__tests__/utils/fetch.mjs +9 -0
  15. package/__tests__/utils/index.js +38 -0
  16. package/__tests__/utils/index.mjs +3 -0
  17. package/__tests__/utils/selectors.d.ts +12 -0
  18. package/__tests__/utils/selectors.js +58 -0
  19. package/__tests__/utils/selectors.mjs +41 -0
  20. package/api/generic.d.ts +6 -0
  21. package/api/generic.js +68 -0
  22. package/api/generic.mjs +54 -0
  23. package/api/index.js +27 -0
  24. package/api/index.mjs +2 -0
  25. package/api/message.d.ts +3 -0
  26. package/api/message.js +33 -0
  27. package/api/message.mjs +30 -0
  28. package/chat.bundle.es.js +10761 -0
  29. package/chat.bundle.umd.js +18 -0
  30. package/chat.es.js +6872 -0
  31. package/chat.umd.js +18 -0
  32. package/components/Button.vue +34 -0
  33. package/components/ChatWindow.vue +104 -0
  34. package/{src/components → components}/GetStarted.vue +7 -7
  35. package/{src/components → components}/GetStartedFooter.vue +2 -2
  36. package/{src/components → components}/Input.vue +34 -39
  37. package/{src/components → components}/Layout.vue +26 -42
  38. package/{src/components → components}/Message.vue +39 -46
  39. package/components/MessageTyping.vue +101 -0
  40. package/{src/components → components}/MessagesList.vue +4 -4
  41. package/{src/components → components}/PoweredBy.vue +6 -7
  42. package/components/index.js +76 -0
  43. package/components/index.mjs +10 -0
  44. package/composables/index.js +38 -0
  45. package/composables/index.mjs +3 -0
  46. package/composables/useChat.d.ts +1 -0
  47. package/composables/useChat.js +11 -0
  48. package/composables/useChat.mjs +5 -0
  49. package/composables/useI18n.d.ts +4 -0
  50. package/composables/useI18n.js +23 -0
  51. package/composables/useI18n.mjs +12 -0
  52. package/composables/useOptions.d.ts +3 -0
  53. package/composables/useOptions.js +14 -0
  54. package/composables/useOptions.mjs +8 -0
  55. package/constants/defaults.d.ts +3 -0
  56. package/constants/defaults.js +32 -0
  57. package/constants/defaults.mjs +26 -0
  58. package/constants/index.js +38 -0
  59. package/constants/index.mjs +3 -0
  60. package/constants/localStorage.d.ts +2 -0
  61. package/constants/localStorage.js +8 -0
  62. package/{src/constants/localStorage.ts → constants/localStorage.mjs} +1 -1
  63. package/constants/symbols.d.ts +3 -0
  64. package/constants/symbols.js +8 -0
  65. package/constants/symbols.mjs +2 -0
  66. package/css/index.css +31 -0
  67. package/event-buses/chatEventBus.d.ts +1 -0
  68. package/event-buses/chatEventBus.js +8 -0
  69. package/event-buses/chatEventBus.mjs +2 -0
  70. package/event-buses/index.js +16 -0
  71. package/event-buses/index.mjs +1 -0
  72. package/index.d.ts +3 -0
  73. package/index.js +43 -0
  74. package/index.mjs +36 -0
  75. package/main.css +151 -0
  76. package/package.json +35 -2
  77. package/plugins/chat.d.ts +3 -0
  78. package/plugins/chat.js +91 -0
  79. package/plugins/chat.mjs +90 -0
  80. package/plugins/index.js +16 -0
  81. package/plugins/index.mjs +1 -0
  82. package/style.css +1 -0
  83. package/types/App.vue.d.ts +8 -0
  84. package/types/__stories__/App.stories.d.ts +17 -0
  85. package/types/__tests__/index.spec.d.ts +1 -0
  86. package/types/__tests__/setup.d.ts +0 -0
  87. package/types/__tests__/utils/create.d.ts +5 -0
  88. package/types/__tests__/utils/fetch.d.ts +4 -0
  89. package/types/__tests__/utils/index.d.ts +3 -0
  90. package/types/__tests__/utils/selectors.d.ts +12 -0
  91. package/types/api/generic.d.ts +6 -0
  92. package/types/api/index.d.ts +2 -0
  93. package/types/api/message.d.ts +3 -0
  94. package/types/chat.d.ts +11 -0
  95. package/types/chat.js +1 -0
  96. package/types/chat.mjs +0 -0
  97. package/types/components/Button.vue.d.ts +9 -0
  98. package/types/components/Chat.vue.d.ts +2 -0
  99. package/types/components/ChatWindow.vue.d.ts +2 -0
  100. package/types/components/GetStarted.vue.d.ts +2 -0
  101. package/types/components/GetStartedFooter.vue.d.ts +2 -0
  102. package/types/components/Input.vue.d.ts +2 -0
  103. package/types/components/Layout.vue.d.ts +11 -0
  104. package/types/components/Message.vue.d.ts +21 -0
  105. package/types/components/MessageTyping.vue.d.ts +15 -0
  106. package/types/components/MessagesList.vue.d.ts +14 -0
  107. package/types/components/PoweredBy.vue.d.ts +2 -0
  108. package/types/components/index.d.ts +10 -0
  109. package/types/composables/index.d.ts +3 -0
  110. package/types/composables/useChat.d.ts +2 -0
  111. package/types/composables/useI18n.d.ts +4 -0
  112. package/types/composables/useOptions.d.ts +4 -0
  113. package/types/constants/defaults.d.ts +3 -0
  114. package/types/constants/index.d.ts +3 -0
  115. package/types/constants/localStorage.d.ts +2 -0
  116. package/types/constants/symbols.d.ts +4 -0
  117. package/types/event-buses/chatEventBus.d.ts +1 -0
  118. package/types/event-buses/index.d.ts +1 -0
  119. package/types/index.js +49 -0
  120. package/types/index.mjs +4 -0
  121. package/types/messages.d.ts +6 -0
  122. package/types/messages.js +1 -0
  123. package/types/messages.mjs +0 -0
  124. package/types/options.d.ts +25 -0
  125. package/types/options.js +1 -0
  126. package/types/options.mjs +0 -0
  127. package/types/plugins/chat.d.ts +3 -0
  128. package/types/plugins/index.d.ts +1 -0
  129. package/types/types/chat.d.ts +11 -0
  130. package/types/types/index.d.ts +4 -0
  131. package/types/types/messages.d.ts +6 -0
  132. package/types/types/options.d.ts +25 -0
  133. package/types/types/webhook.d.ts +16 -0
  134. package/types/utils/event-bus.d.ts +8 -0
  135. package/types/utils/mount.d.ts +1 -0
  136. package/types/webhook.d.ts +16 -0
  137. package/types/webhook.js +1 -0
  138. package/types/webhook.mjs +0 -0
  139. package/utils/event-bus.d.ts +8 -0
  140. package/utils/event-bus.js +38 -0
  141. package/utils/event-bus.mjs +32 -0
  142. package/utils/index.d.ts +2 -0
  143. package/utils/index.js +27 -0
  144. package/utils/index.mjs +2 -0
  145. package/utils/mount.d.ts +1 -0
  146. package/utils/mount.js +19 -0
  147. package/utils/mount.mjs +13 -0
  148. package/.eslintignore +0 -2
  149. package/.eslintrc.cjs +0 -10
  150. package/.np-config.json +0 -5
  151. package/.storybook/main.ts +0 -27
  152. package/.storybook/preview.scss +0 -4
  153. package/.storybook/preview.ts +0 -16
  154. package/.vscode/extensions.json +0 -3
  155. package/build.config.js +0 -21
  156. package/env.d.ts +0 -1
  157. package/index.html +0 -13
  158. package/resources/images/fullscreen.png +0 -0
  159. package/resources/images/windowed.png +0 -0
  160. package/resources/workflow-manual.json +0 -238
  161. package/resources/workflow.json +0 -119
  162. package/scripts/pack.js +0 -11
  163. package/scripts/postbuild.js +0 -36
  164. package/src/__stories__/App.stories.ts +0 -43
  165. package/src/__tests__/index.spec.ts +0 -218
  166. package/src/__tests__/utils/create.ts +0 -16
  167. package/src/__tests__/utils/fetch.ts +0 -18
  168. package/src/__tests__/utils/selectors.ts +0 -53
  169. package/src/api/generic.ts +0 -63
  170. package/src/api/message.ts +0 -37
  171. package/src/components/Button.vue +0 -41
  172. package/src/components/ChatWindow.vue +0 -125
  173. package/src/components/MessageTyping.vue +0 -109
  174. package/src/composables/useChat.ts +0 -7
  175. package/src/composables/useI18n.ts +0 -16
  176. package/src/composables/useOptions.ts +0 -11
  177. package/src/constants/defaults.ts +0 -29
  178. package/src/constants/symbols.ts +0 -8
  179. package/src/css/_tokens.scss +0 -36
  180. package/src/css/index.scss +0 -1
  181. package/src/event-buses/chatEventBus.ts +0 -3
  182. package/src/index.ts +0 -42
  183. package/src/main.scss +0 -5
  184. package/src/plugins/chat.ts +0 -105
  185. package/src/types/chat.ts +0 -12
  186. package/src/types/messages.ts +0 -6
  187. package/src/types/options.ts +0 -28
  188. package/src/types/webhook.ts +0 -17
  189. package/src/utils/event-bus.ts +0 -51
  190. package/src/utils/mount.ts +0 -16
  191. package/tsconfig.json +0 -27
  192. package/vite.config.ts +0 -59
  193. package/vitest.config.ts +0 -20
  194. /package/{src/App.vue → App.vue} +0 -0
  195. /package/{src/__tests__/setup.ts → __tests__/setup.d.ts} +0 -0
  196. /package/{src/__tests__/utils/index.ts → __tests__/utils/index.d.ts} +0 -0
  197. /package/{src/api/index.ts → api/index.d.ts} +0 -0
  198. /package/{src/components → components}/Chat.vue +0 -0
  199. /package/{src/components/index.ts → components/index.d.ts} +0 -0
  200. /package/{src/composables/index.ts → composables/index.d.ts} +0 -0
  201. /package/{src/constants/index.ts → constants/index.d.ts} +0 -0
  202. /package/{src/event-buses/index.ts → event-buses/index.d.ts} +0 -0
  203. /package/{public/favicon.ico → favicon.ico} +0 -0
  204. /package/{src/plugins/index.ts → plugins/index.d.ts} +0 -0
  205. /package/{src/shims.d.ts → shims.d.ts} +0 -0
  206. /package/{src/types/index.ts → types/index.d.ts} +0 -0
  207. /package/{src/utils/index.ts → types/utils/index.d.ts} +0 -0
@@ -49,45 +49,40 @@ async function onSubmitKeydown(event: KeyboardEvent) {
49
49
  </div>
50
50
  </template>
51
51
 
52
- <style lang="scss">
52
+ <style>
53
53
  .chat-input {
54
- display: flex;
55
- justify-content: center;
56
- align-items: center;
57
- width: 100%;
58
-
59
- textarea {
60
- font-family: inherit;
61
- font-size: inherit;
62
- width: 100%;
63
- border: 0;
64
- padding: var(--chat--spacing);
65
- max-height: var(--chat--textarea--height);
66
- resize: none;
67
- }
68
-
69
- .chat-input-send-button {
70
- height: var(--chat--textarea--height);
71
- width: var(--chat--textarea--height);
72
- background: white;
73
- cursor: pointer;
74
- color: var(--chat--color-secondary);
75
- border: 0;
76
- font-size: 24px;
77
- display: inline-flex;
78
- align-items: center;
79
- justify-content: center;
80
- transition: color var(--chat--transition-duration) ease;
81
-
82
- &:hover,
83
- &:focus {
84
- color: var(--chat--color-secondary-shade-50);
85
- }
86
-
87
- &[disabled] {
88
- cursor: default;
89
- color: var(--chat--color-disabled);
90
- }
91
- }
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ width: 100%;
58
+ }
59
+ .chat-input textarea {
60
+ font-family: inherit;
61
+ font-size: inherit;
62
+ width: 100%;
63
+ border: 0;
64
+ padding: var(--chat--spacing);
65
+ max-height: var(--chat--textarea--height);
66
+ resize: none;
67
+ }
68
+ .chat-input .chat-input-send-button {
69
+ height: var(--chat--textarea--height);
70
+ width: var(--chat--textarea--height);
71
+ background: white;
72
+ cursor: pointer;
73
+ color: var(--chat--color-secondary);
74
+ border: 0;
75
+ font-size: 24px;
76
+ display: inline-flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ transition: color var(--chat--transition-duration) ease;
80
+ }
81
+ .chat-input .chat-input-send-button:hover, .chat-input .chat-input-send-button:focus {
82
+ color: var(--chat--color-secondary-shade-50);
83
+ }
84
+ .chat-input .chat-input-send-button[disabled] {
85
+ cursor: default;
86
+ color: var(--chat--color-disabled);
92
87
  }
93
88
  </style>
@@ -35,48 +35,32 @@ onBeforeUnmount(() => {
35
35
  </main>
36
36
  </template>
37
37
 
38
- <style lang="scss">
38
+ <style>
39
39
  .chat-layout {
40
- width: 100%;
41
- height: 100%;
42
- display: flex;
43
- overflow-y: auto;
44
- flex-direction: column;
45
- font-family: var(
46
- --chat--font-family,
47
- (
48
- -apple-system,
49
- BlinkMacSystemFont,
50
- 'Segoe UI',
51
- Roboto,
52
- Oxygen-Sans,
53
- Ubuntu,
54
- Cantarell,
55
- 'Helvetica Neue',
56
- sans-serif
57
- )
58
- );
59
-
60
- .chat-header {
61
- padding: var(--chat--header--padding, var(--chat--spacing));
62
- background: var(--chat--header--background, var(--chat--color-dark));
63
- color: var(--chat--header--color, var(--chat--color-light));
64
- }
65
-
66
- .chat-body {
67
- background: var(--chat--body--background, var(--chat--color-light));
68
- flex: 1;
69
- display: flex;
70
- flex-direction: column;
71
- overflow-y: auto;
72
- position: relative;
73
- min-height: 100px;
74
- }
75
-
76
- .chat-footer {
77
- border-top: 1px solid var(--chat--color-light-shade-100);
78
- background: var(--chat--footer--background, var(--chat--color-light));
79
- color: var(--chat--footer--color, var(--chat--color-dark));
80
- }
40
+ width: 100%;
41
+ height: 100%;
42
+ display: flex;
43
+ overflow-y: auto;
44
+ flex-direction: column;
45
+ font-family: var(--chat--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif);
46
+ }
47
+ .chat-layout .chat-header {
48
+ padding: var(--chat--header--padding, var(--chat--spacing));
49
+ background: var(--chat--header--background, var(--chat--color-dark));
50
+ color: var(--chat--header--color, var(--chat--color-light));
51
+ }
52
+ .chat-layout .chat-body {
53
+ background: var(--chat--body--background, var(--chat--color-light));
54
+ flex: 1;
55
+ display: flex;
56
+ flex-direction: column;
57
+ overflow-y: auto;
58
+ position: relative;
59
+ min-height: 100px;
60
+ }
61
+ .chat-layout .chat-footer {
62
+ border-top: 1px solid var(--chat--color-light-shade-100);
63
+ background: var(--chat--footer--background, var(--chat--color-light));
64
+ color: var(--chat--footer--color, var(--chat--color-dark));
81
65
  }
82
66
  </style>
@@ -46,52 +46,45 @@ const markdownOptions = {
46
46
  </div>
47
47
  </template>
48
48
 
49
- <style lang="scss">
49
+ <style>
50
50
  .chat-message {
51
- display: block;
52
- max-width: 80%;
53
- padding: var(--chat--message--padding, var(--chat--spacing));
54
- border-radius: var(--chat--message--border-radius, var(--chat--border-radius));
55
-
56
- + .chat-message {
57
- margin-top: var(--chat--message--margin-bottom, calc(var(--chat--spacing) * 0.5));
58
- }
59
-
60
- &.chat-message-from-bot {
61
- background-color: var(--chat--message--bot--background);
62
- color: var(--chat--message--bot--color);
63
- border-bottom-left-radius: 0;
64
- }
65
-
66
- &.chat-message-from-user {
67
- background-color: var(--chat--message--user--background);
68
- color: var(--chat--message--user--color);
69
- margin-left: auto;
70
- border-bottom-right-radius: 0;
71
- }
72
-
73
- > .chat-message-markdown {
74
- display: block;
75
- box-sizing: border-box;
76
-
77
- > *:first-child {
78
- margin-top: 0;
79
- }
80
-
81
- > *:last-child {
82
- margin-bottom: 0;
83
- }
84
-
85
- pre {
86
- font-family: inherit;
87
- font-size: inherit;
88
- margin: 0;
89
- white-space: pre-wrap;
90
- box-sizing: border-box;
91
- padding: var(--chat--spacing);
92
- background: var(--chat--message--pre--background);
93
- border-radius: var(--chat--border-radius);
94
- }
95
- }
51
+ display: block;
52
+ max-width: 80%;
53
+ padding: var(--chat--message--padding, var(--chat--spacing));
54
+ border-radius: var(--chat--message--border-radius, var(--chat--border-radius));
55
+ }
56
+ .chat-message + .chat-message {
57
+ margin-top: var(--chat--message--margin-bottom, calc(var(--chat--spacing) * 0.5));
58
+ }
59
+ .chat-message.chat-message-from-bot {
60
+ background-color: var(--chat--message--bot--background);
61
+ color: var(--chat--message--bot--color);
62
+ border-bottom-left-radius: 0;
63
+ }
64
+ .chat-message.chat-message-from-user {
65
+ background-color: var(--chat--message--user--background);
66
+ color: var(--chat--message--user--color);
67
+ margin-left: auto;
68
+ border-bottom-right-radius: 0;
69
+ }
70
+ .chat-message > .chat-message-markdown {
71
+ display: block;
72
+ box-sizing: border-box;
73
+ }
74
+ .chat-message > .chat-message-markdown > *:first-child {
75
+ margin-top: 0;
76
+ }
77
+ .chat-message > .chat-message-markdown > *:last-child {
78
+ margin-bottom: 0;
79
+ }
80
+ .chat-message > .chat-message-markdown pre {
81
+ font-family: inherit;
82
+ font-size: inherit;
83
+ margin: 0;
84
+ white-space: pre-wrap;
85
+ box-sizing: border-box;
86
+ padding: var(--chat--spacing);
87
+ background: var(--chat--message--pre--background);
88
+ border-radius: var(--chat--border-radius);
96
89
  }
97
90
  </style>
@@ -0,0 +1,101 @@
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>
@@ -28,10 +28,10 @@ const { initialMessages, waitingForResponse } = chatStore;
28
28
  </div>
29
29
  </template>
30
30
 
31
- <style lang="scss">
31
+ <style>
32
32
  .chat-messages-list {
33
- margin-top: auto;
34
- display: block;
35
- padding: var(--chat--messages-list--padding, var(--chat--spacing));
33
+ margin-top: auto;
34
+ display: block;
35
+ padding: var(--chat--messages-list--padding, var(--chat--spacing));
36
36
  }
37
37
  </style>
@@ -5,13 +5,12 @@
5
5
  </div>
6
6
  </template>
7
7
 
8
- <style lang="scss">
8
+ <style>
9
9
  .chat-powered-by {
10
- text-align: center;
11
-
12
- a {
13
- color: var(--chat--color-primary);
14
- text-decoration: none;
15
- }
10
+ text-align: center;
11
+ }
12
+ .chat-powered-by a {
13
+ color: var(--chat--color-primary);
14
+ text-decoration: none;
16
15
  }
17
16
  </style>
@@ -0,0 +1,76 @@
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 }; }
@@ -0,0 +1,10 @@
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";
@@ -0,0 +1,38 @@
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
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./useChat.mjs";
2
+ export * from "./useI18n.mjs";
3
+ export * from "./useOptions.mjs";
@@ -0,0 +1 @@
1
+ export declare function useChat(): Chat;
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import { inject } from "vue";
2
+ import { ChatSymbol } from "@n8n/chat/constants";
3
+ export function useChat() {
4
+ return inject(ChatSymbol);
5
+ }
@@ -0,0 +1,4 @@
1
+ export declare function useI18n(): {
2
+ t: (key: string) => string;
3
+ te: (key: string) => boolean;
4
+ };
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useOptions(): {
2
+ options: ChatOptions;
3
+ };
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ import type { ChatOptions } from '@n8n/chat/types';
2
+ export declare const defaultOptions: ChatOptions;
3
+ export declare const defaultMountingTarget = "#n8n-chat";
@@ -0,0 +1,32 @@
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";