@n8n/chat 0.1.5 → 0.2.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.
- package/.eslintignore +2 -0
- package/.eslintrc.cjs +53 -0
- package/.np-config.json +5 -0
- package/.storybook/main.ts +27 -0
- package/.storybook/preview.scss +4 -0
- package/.storybook/preview.ts +16 -0
- package/.vscode/extensions.json +3 -0
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package.json +5 -2
- package/resources/workflow.json +293 -0
- package/scripts/pack.js +11 -0
- package/scripts/postbuild.js +16 -0
- package/src/App.vue +23 -0
- package/src/__stories__/App.stories.ts +43 -0
- package/src/__tests__/index.spec.ts +223 -0
- package/src/__tests__/setup.ts +1 -0
- package/src/__tests__/utils/create.ts +16 -0
- package/src/__tests__/utils/fetch.ts +18 -0
- package/src/__tests__/utils/index.ts +3 -0
- package/src/__tests__/utils/selectors.ts +53 -0
- package/src/api/generic.ts +64 -0
- package/src/api/message.ts +31 -0
- package/src/components/Button.vue +41 -0
- package/src/components/Chat.vue +48 -0
- package/src/components/ChatWindow.vue +125 -0
- package/src/components/GetStarted.vue +24 -0
- package/src/components/GetStartedFooter.vue +20 -0
- package/src/components/Input.vue +93 -0
- package/src/components/Layout.vue +82 -0
- package/src/components/Message.vue +97 -0
- package/src/components/MessageTyping.vue +109 -0
- package/src/components/MessagesList.vue +37 -0
- package/src/components/PoweredBy.vue +17 -0
- package/src/composables/useChat.ts +7 -0
- package/src/composables/useI18n.ts +16 -0
- package/src/composables/useOptions.ts +11 -0
- package/src/constants/defaults.ts +25 -0
- package/src/constants/localStorage.ts +2 -0
- package/src/constants/symbols.ts +8 -0
- package/src/event-buses/chatEventBus.ts +3 -0
- package/src/index.ts +42 -0
- package/src/main.scss +40 -0
- package/src/plugins/chat.ts +101 -0
- package/src/shims.d.ts +6 -0
- package/src/types/chat.ts +12 -0
- package/src/types/messages.ts +6 -0
- package/src/types/options.ts +23 -0
- package/src/types/webhook.ts +17 -0
- package/src/utils/event-bus.ts +51 -0
- package/src/utils/mount.ts +16 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +51 -0
- package/vitest.config.ts +20 -0
- package/chat.bundle.es.js +0 -10773
- package/chat.bundle.umd.js +0 -18
- package/chat.es.js +0 -6869
- package/chat.umd.js +0 -18
- package/style.css +0 -1
- package/types/App.vue.d.ts +0 -8
- package/types/__stories__/App.stories.d.ts +0 -17
- package/types/api/generic.d.ts +0 -6
- package/types/api/message.d.ts +0 -3
- package/types/components/Button.vue.d.ts +0 -9
- package/types/components/Chat.vue.d.ts +0 -2
- package/types/components/ChatWindow.vue.d.ts +0 -2
- package/types/components/GetStarted.vue.d.ts +0 -2
- package/types/components/GetStartedFooter.vue.d.ts +0 -2
- package/types/components/Input.vue.d.ts +0 -2
- package/types/components/Layout.vue.d.ts +0 -11
- package/types/components/Message.vue.d.ts +0 -21
- package/types/components/MessageTyping.vue.d.ts +0 -15
- package/types/components/MessagesList.vue.d.ts +0 -14
- package/types/components/PoweredBy.vue.d.ts +0 -2
- package/types/composables/useChat.d.ts +0 -2
- package/types/composables/useI18n.d.ts +0 -4
- package/types/composables/useOptions.d.ts +0 -4
- package/types/constants/defaults.d.ts +0 -3
- package/types/constants/localStorage.d.ts +0 -2
- package/types/constants/symbols.d.ts +0 -4
- package/types/event-buses/chatEventBus.d.ts +0 -1
- package/types/index.d.ts +0 -2
- package/types/plugins/chat.d.ts +0 -3
- package/types/types/chat.d.ts +0 -11
- package/types/types/messages.d.ts +0 -6
- package/types/types/options.d.ts +0 -20
- package/types/types/webhook.d.ts +0 -15
- package/types/utils/event-bus.d.ts +0 -8
- package/types/utils/mount.d.ts +0 -1
- /package/{favicon.ico → public/favicon.ico} +0 -0
- /package/{types/api/index.d.ts → src/api/index.ts} +0 -0
- /package/{types/components/index.d.ts → src/components/index.ts} +0 -0
- /package/{types/composables/index.d.ts → src/composables/index.ts} +0 -0
- /package/{types/constants/index.d.ts → src/constants/index.ts} +0 -0
- /package/{types/event-buses/index.d.ts → src/event-buses/index.ts} +0 -0
- /package/{types/plugins/index.d.ts → src/plugins/index.ts} +0 -0
- /package/{types/types/index.d.ts → src/types/index.ts} +0 -0
- /package/{types/utils/index.d.ts → src/utils/index.ts} +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
import type { ChatMessage } from '../types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<{
|
|
4
|
-
messages: {
|
|
5
|
-
type: PropType<ChatMessage[]>;
|
|
6
|
-
required: true;
|
|
7
|
-
};
|
|
8
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
-
messages: {
|
|
10
|
-
type: PropType<ChatMessage[]>;
|
|
11
|
-
required: true;
|
|
12
|
-
};
|
|
13
|
-
}>>, {}, {}>;
|
|
14
|
-
export default _default;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chatEventBus: import('../utils').EventBus;
|
package/types/index.d.ts
DELETED
package/types/plugins/chat.d.ts
DELETED
package/types/types/chat.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ChatMessage } from '../types/messages';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export interface Chat {
|
|
4
|
-
initialMessages: Ref<ChatMessage[]>;
|
|
5
|
-
messages: Ref<ChatMessage[]>;
|
|
6
|
-
currentSessionId: Ref<string | null>;
|
|
7
|
-
waitingForResponse: Ref<boolean>;
|
|
8
|
-
loadPreviousSession: () => Promise<string>;
|
|
9
|
-
startNewSession: () => Promise<void>;
|
|
10
|
-
sendMessage: (text: string) => Promise<void>;
|
|
11
|
-
}
|
package/types/types/options.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface ChatOptions {
|
|
2
|
-
webhookUrl: string;
|
|
3
|
-
webhookConfig?: {
|
|
4
|
-
method?: 'GET' | 'POST';
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
target?: string | Element;
|
|
8
|
-
mode?: 'window' | 'fullscreen';
|
|
9
|
-
defaultLanguage?: 'en';
|
|
10
|
-
initialMessages?: string[];
|
|
11
|
-
i18n: Record<string, {
|
|
12
|
-
title: string;
|
|
13
|
-
subtitle: string;
|
|
14
|
-
footer: string;
|
|
15
|
-
getStarted: string;
|
|
16
|
-
inputPlaceholder: string;
|
|
17
|
-
[message: string]: string;
|
|
18
|
-
}>;
|
|
19
|
-
theme?: {};
|
|
20
|
-
}
|
package/types/types/webhook.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface LoadPreviousSessionResponseItem {
|
|
2
|
-
id: string[];
|
|
3
|
-
kwargs: {
|
|
4
|
-
content: string;
|
|
5
|
-
additional_kwargs: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
lc: number;
|
|
8
|
-
type: string;
|
|
9
|
-
}
|
|
10
|
-
export interface LoadPreviousSessionResponse {
|
|
11
|
-
data: LoadPreviousSessionResponseItem[];
|
|
12
|
-
}
|
|
13
|
-
export interface SendMessageResponse {
|
|
14
|
-
output: string;
|
|
15
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type CallbackFn = Function;
|
|
2
|
-
export type UnregisterFn = () => void;
|
|
3
|
-
export interface EventBus {
|
|
4
|
-
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
-
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
-
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function createEventBus(): EventBus;
|
package/types/utils/mount.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|