@inploi/plugin-chatbot 3.11.0 → 3.12.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/cdn/index.js +12 -12
- package/dist/{job-application-content-3cc77e28.js → chatbot-body-04c70e40.js} +341 -265
- package/dist/{job-application-content-69860abf.cjs → chatbot-body-a6d50df4.cjs} +352 -276
- package/dist/chatbot.api.d.ts +2441 -13
- package/dist/chatbot.d.ts +25 -5
- package/dist/chatbot.idb.d.ts +15 -7
- package/dist/chatbot.utils.d.ts +9 -6
- package/dist/{index-356e7fb6.cjs → index-413f4efe.cjs} +2175 -1999
- package/dist/{index-5333c591.js → index-ec980c39.js} +2194 -2018
- package/dist/index.dev.d.ts +1 -0
- package/dist/interpreter.d.ts +5 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +2 -2
- package/package.json +8 -6
- package/dist/chatbot.state.d.ts +0 -94
package/dist/index.dev.d.ts
CHANGED
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
|
|
3
3
|
import { ChatInput } from './components/chat-input/chat-input';
|
|
4
|
-
import {
|
|
4
|
+
import { ChatMessage, FlowSubmission, KeyToSubmissionMap } from './chatbot.state';
|
|
5
5
|
export declare const followNodes: ({ node, nodes, stopWhen, }: {
|
|
6
6
|
node: FlowNode;
|
|
7
7
|
nodes: FlowNode[];
|
|
@@ -19,7 +19,7 @@ export type ChatService = {
|
|
|
19
19
|
type: TType;
|
|
20
20
|
}>;
|
|
21
21
|
signal?: AbortSignal;
|
|
22
|
-
}) => Promise<Extract<
|
|
22
|
+
}) => Promise<Extract<FlowSubmission, {
|
|
23
23
|
type: TType;
|
|
24
24
|
}>>;
|
|
25
25
|
};
|
|
@@ -40,6 +40,9 @@ type ChatbotInterpreterParams<TContext extends Record<string, unknown>> = {
|
|
|
40
40
|
};
|
|
41
41
|
export declare const createFlowInterpreter: <TContext extends Record<string, unknown>>({ flow, analytics, logger, context, apiClient, getSubmissions, chatService, onFlowEnd, onInterpret, }: ChatbotInterpreterParams<TContext>) => {
|
|
42
42
|
interpret: (startFromNodeId?: string) => Promise<void>;
|
|
43
|
+
undo: (nodeHistory: string[]) => {
|
|
44
|
+
removed: number;
|
|
45
|
+
};
|
|
43
46
|
abort: () => void;
|
|
44
47
|
};
|
|
45
48
|
export declare const interpolateString: (str: string, context: KeyToSubmissionMap | undefined) => string;
|
package/dist/plugin-chatbot.cjs
CHANGED
package/dist/plugin-chatbot.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-chatbot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@inploi/sdk": "*"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@happy-dom/global-registrator": "
|
|
25
|
+
"@happy-dom/global-registrator": "14.3.6",
|
|
26
26
|
"@hookform/resolvers": "^3.3.2",
|
|
27
27
|
"@preact/preset-vite": "^2.5.0",
|
|
28
28
|
"@preact/signals": "^1.2.2",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"eslint": "^7.32.0",
|
|
46
46
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
47
47
|
"eslint-plugin-tailwindcss": "^3.14.1",
|
|
48
|
-
"happy-dom": "
|
|
49
|
-
"idb
|
|
48
|
+
"happy-dom": "14.3.6",
|
|
49
|
+
"idb": "^8.0.0",
|
|
50
50
|
"msw": "^2.0.10",
|
|
51
51
|
"playwright-msw": "^3.0.0",
|
|
52
52
|
"postcss": "^8.4.31",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"vite-plugin-dts": "^3.7.0",
|
|
67
67
|
"vite-tsconfig-paths": "^4.2.1",
|
|
68
68
|
"@inploi/core": "1.11.6",
|
|
69
|
-
"@inploi/design-tokens": "0.2.
|
|
70
|
-
"@inploi/sdk": "1.12.
|
|
69
|
+
"@inploi/design-tokens": "0.2.1",
|
|
70
|
+
"@inploi/sdk": "1.12.1",
|
|
71
71
|
"eslint-config-custom": "0.1.0",
|
|
72
72
|
"tsconfig": "0.1.0"
|
|
73
73
|
},
|
|
@@ -78,10 +78,12 @@
|
|
|
78
78
|
"dev": "vite",
|
|
79
79
|
"build:cdn": "VITE_MOCKS=false vite build --mode=cdn",
|
|
80
80
|
"build:npm": "VITE_MOCKS=false vite build --mode=production",
|
|
81
|
+
"build:deps": "cd ../.. && turbo build --filter=plugin-chatbot",
|
|
81
82
|
"build": "concurrently 'pnpm build:npm' 'pnpm run build:cdn'",
|
|
82
83
|
"setup-local": "cp -n .env.example .env || true",
|
|
83
84
|
"check": "eslint src --fix --max-warnings 0 && tsc",
|
|
84
85
|
"test": "bun test src/",
|
|
86
|
+
"test:watch": "bun test src/ --watch",
|
|
85
87
|
"test:int": "playwright test",
|
|
86
88
|
"test:ui": "playwright test --ui",
|
|
87
89
|
"preview": "vite preview"
|
package/dist/chatbot.state.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@preact/signals';
|
|
2
|
-
import { JobApplication } from './chatbot.api';
|
|
3
|
-
import { DistributivePick } from './chatbot.utils';
|
|
4
|
-
import { ChatInput } from './components/chat-input/chat-input';
|
|
5
|
-
import { ChatbotInput } from './components/chat-input/chat-input';
|
|
6
|
-
import { ChatbotFlowProgress } from './progress';
|
|
7
|
-
export declare const getCacheKey: (application: JobApplication) => string;
|
|
8
|
-
export type ViewState = 'maximised' | 'minimised';
|
|
9
|
-
export declare const viewState: Signal<ViewState>;
|
|
10
|
-
export declare const inputHeight: Signal<number>;
|
|
11
|
-
export type StartedJobApplication = JobApplication & {
|
|
12
|
-
data: ApplicationData;
|
|
13
|
-
startedAt: Date;
|
|
14
|
-
nodeIdToProgress: Record<string, ChatbotFlowProgress>;
|
|
15
|
-
};
|
|
16
|
-
type CurrentApplication = {
|
|
17
|
-
state: 'idle';
|
|
18
|
-
application?: never;
|
|
19
|
-
error?: never;
|
|
20
|
-
} | {
|
|
21
|
-
state: 'loading';
|
|
22
|
-
application?: never;
|
|
23
|
-
error?: never;
|
|
24
|
-
} | {
|
|
25
|
-
state: 'loaded';
|
|
26
|
-
application: StartedJobApplication;
|
|
27
|
-
error?: never;
|
|
28
|
-
} | {
|
|
29
|
-
state: 'error';
|
|
30
|
-
application?: never;
|
|
31
|
-
error: string;
|
|
32
|
-
};
|
|
33
|
-
export declare const application: {
|
|
34
|
-
current$: Signal<CurrentApplication>;
|
|
35
|
-
start: (application: JobApplication) => Promise<void>;
|
|
36
|
-
cancel: () => void;
|
|
37
|
-
markAsFinished: () => void;
|
|
38
|
-
setCurrentNodeId: (currentNodeId: string) => void;
|
|
39
|
-
restart: () => void;
|
|
40
|
-
addMessage: (message: ChatMessage, groupId?: string) => void;
|
|
41
|
-
/** Removes from the last message backwards, all the messages that have the groupId passed, until it reaches one that doesn't */
|
|
42
|
-
removeLastGroupMessagesById: (groupId: string) => void;
|
|
43
|
-
setSubmission: (fieldKey: string, submission: ApplicationSubmission | null) => void;
|
|
44
|
-
setInput: (input: ChatInput | undefined) => void;
|
|
45
|
-
};
|
|
46
|
-
export type MessageAuthor = 'bot' | 'user';
|
|
47
|
-
type SystemMessage = {
|
|
48
|
-
type: 'system';
|
|
49
|
-
text: string;
|
|
50
|
-
variant: 'info' | 'warning' | 'error' | 'success';
|
|
51
|
-
};
|
|
52
|
-
type TextMessage = {
|
|
53
|
-
author: MessageAuthor;
|
|
54
|
-
type: 'text';
|
|
55
|
-
text: string;
|
|
56
|
-
};
|
|
57
|
-
type LinkMessage = {
|
|
58
|
-
type: 'link';
|
|
59
|
-
href: string;
|
|
60
|
-
text: string;
|
|
61
|
-
};
|
|
62
|
-
type ImageMessage = {
|
|
63
|
-
author: MessageAuthor;
|
|
64
|
-
type: 'image';
|
|
65
|
-
url: string;
|
|
66
|
-
width: number;
|
|
67
|
-
height: number;
|
|
68
|
-
};
|
|
69
|
-
type FileMessage = {
|
|
70
|
-
author: MessageAuthor;
|
|
71
|
-
type: 'file';
|
|
72
|
-
fileName: string;
|
|
73
|
-
fileSizeKb: number;
|
|
74
|
-
};
|
|
75
|
-
export type ChatMessage = TextMessage | ImageMessage | SystemMessage | FileMessage | LinkMessage;
|
|
76
|
-
export type ApplicationSubmission = DistributivePick<ChatbotInput, 'type' | 'value'>;
|
|
77
|
-
export type KeyToSubmissionMap = {
|
|
78
|
-
[key: string]: ApplicationSubmission;
|
|
79
|
-
};
|
|
80
|
-
/** Dynamic part of an application */
|
|
81
|
-
export type ApplicationData = {
|
|
82
|
-
/** History of messages left in the chat */
|
|
83
|
-
messages: (ChatMessage & {
|
|
84
|
-
groupId?: string;
|
|
85
|
-
})[];
|
|
86
|
-
submissions: KeyToSubmissionMap;
|
|
87
|
-
currentNodeId: string | null;
|
|
88
|
-
/** Needs to be separate because a node can have many inputs */
|
|
89
|
-
currentInput?: ChatInput;
|
|
90
|
-
isFinished: boolean;
|
|
91
|
-
sequence: number;
|
|
92
|
-
flowSessionId: string;
|
|
93
|
-
};
|
|
94
|
-
export {};
|