@inploi/plugin-chatbot 14.8.0 → 14.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 (39) hide show
  1. package/cdn/index.js +6 -6
  2. package/cdn/style.css +1 -1
  3. package/dist/accessible-labels.test.d.ts +1 -0
  4. package/dist/chatbot-body-3e08ab1b.js +4073 -0
  5. package/dist/chatbot-body-d0635102.cjs +5 -0
  6. package/dist/chatbot.d.ts +6 -0
  7. package/dist/chatbot.idb.d.ts +2 -2
  8. package/dist/chatbot.resume.d.ts +15 -0
  9. package/dist/chatbot.resume.test.d.ts +1 -0
  10. package/dist/chatbot.state.d.ts +24 -404
  11. package/dist/chatbot.storage.test.d.ts +1 -0
  12. package/dist/chatbot.utils.d.ts +1 -253
  13. package/dist/components/chat-input/chat-input.address.d.ts +1 -14
  14. package/dist/components/chat-input/chat-input.boolean.d.ts +1 -13
  15. package/dist/components/chat-input/chat-input.d.ts +1 -12
  16. package/dist/components/chat-input/chat-input.file.d.ts +1 -12
  17. package/dist/components/chat-input/chat-input.multiple-choice.d.ts +1 -14
  18. package/dist/components/chat-input/chat-input.number.d.ts +1 -14
  19. package/dist/components/chat-input/chat-input.phone-number.d.ts +1 -17
  20. package/dist/components/chat-input/chat-input.submit.d.ts +1 -10
  21. package/dist/components/chat-input/chat-input.text.d.ts +1 -14
  22. package/dist/components/chat-input/chat-input.text.test.d.ts +1 -0
  23. package/dist/components/chatbot-body.lifecycle.test.d.ts +1 -0
  24. package/dist/components/message.link.d.ts +1 -1
  25. package/dist/components/useChatService.d.ts +4 -1
  26. package/dist/components/useChatService.test.d.ts +1 -0
  27. package/dist/i18n.d.ts +114 -0
  28. package/dist/index-5de8da64.js +3368 -0
  29. package/dist/index-d28fa66d.cjs +5 -0
  30. package/dist/plugin-chatbot.cjs +1 -1
  31. package/dist/plugin-chatbot.js +1 -1
  32. package/dist/style/tokens.d.ts +6 -4
  33. package/dist/style.css +1 -1
  34. package/package.json +8 -8
  35. package/dist/chatbot-body-0c22653b.cjs +0 -5
  36. package/dist/chatbot-body-dd2054d0.js +0 -4543
  37. package/dist/index-5e99d91d.js +0 -3275
  38. package/dist/index-b625775f.cjs +0 -5
  39. package/dist/interpreter.d.ts +0 -59
@@ -1,260 +1,8 @@
1
- import { FlowNode } from '@inploi/core/flows';
2
- import { FlowStateData, FlowSubmission } from './chatbot.state';
1
+ import { FlowStateData, FlowSubmission } from '@inploi/flows/engine';
3
2
 
4
- export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;
5
- export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
6
- type: "flow-section";
7
- id: string;
8
- data: {
9
- title: string;
10
- };
11
- isHead?: boolean | undefined;
12
- nextId?: string | undefined;
13
- } | {
14
- type: "pre-apply-result";
15
- id: string;
16
- data: {
17
- key: string;
18
- participationKey: string;
19
- messages: {
20
- hard: string;
21
- advisory: string;
22
- matched: string;
23
- };
24
- continueLabel: string;
25
- alternativeLink?: {
26
- href: string;
27
- label: string;
28
- } | undefined;
29
- };
30
- isHead?: boolean | undefined;
31
- nextId?: string | undefined;
32
- } | {
33
- type: "text";
34
- id: string;
35
- data: {
36
- text: string;
37
- };
38
- isHead?: boolean | undefined;
39
- nextId?: string | undefined;
40
- } | {
41
- type: "end-flow";
42
- id: string;
43
- data: {
44
- systemMessage: string;
45
- };
46
- isHead?: boolean | undefined;
47
- nextId?: string | undefined;
48
- } | {
49
- type: "integration-application-submit";
50
- id: string;
51
- data: {
52
- integrationId: string;
53
- skipConfirmation: boolean;
54
- submitLabel: string;
55
- submitKeys: "all" | string[];
56
- key?: string | undefined;
57
- successMessage?: string | undefined;
58
- };
59
- isHead?: boolean | undefined;
60
- nextId?: string | undefined;
61
- } | {
62
- type: "integration-workflow-get";
63
- id: string;
64
- data: {
65
- integrationId: string;
66
- };
67
- isHead?: boolean | undefined;
68
- nextId?: string | undefined;
69
- } | {
70
- type: "link";
71
- id: string;
72
- data: {
73
- href: string;
74
- cta: string;
75
- };
76
- isHead?: boolean | undefined;
77
- nextId?: string | undefined;
78
- } | {
79
- type: "image";
80
- id: string;
81
- data: {
82
- url: string;
83
- width: number;
84
- height: number;
85
- };
86
- isHead?: boolean | undefined;
87
- nextId?: string | undefined;
88
- } | {
89
- type: "question-boolean";
90
- id: string;
91
- data: {
92
- key: string;
93
- question: string;
94
- trueLabel: string;
95
- falseLabel: string;
96
- optional: boolean;
97
- preApply?: {
98
- severity: "hard" | "advisory";
99
- mismatchMessage: string;
100
- expectedValue: boolean;
101
- } | undefined;
102
- };
103
- isHead?: boolean | undefined;
104
- nextId?: string | undefined;
105
- } | {
106
- type: "question-text";
107
- id: string;
108
- data: {
109
- key: string;
110
- question: string;
111
- optional: boolean;
112
- format: "date" | "text" | "url" | "email" | "phone";
113
- placeholder?: string | undefined;
114
- maxChars?: number | undefined;
115
- minChars?: number | undefined;
116
- };
117
- isHead?: boolean | undefined;
118
- nextId?: string | undefined;
119
- } | {
120
- type: "question-number";
121
- id: string;
122
- data: {
123
- key: string;
124
- question: string;
125
- optional: boolean;
126
- placeholder?: string | undefined;
127
- decimalCases?: number | undefined;
128
- min?: number | undefined;
129
- max?: number | undefined;
130
- };
131
- isHead?: boolean | undefined;
132
- nextId?: string | undefined;
133
- } | {
134
- type: "question-phone";
135
- id: string;
136
- data: {
137
- key: string;
138
- question: string;
139
- optional: boolean;
140
- placeholder: string;
141
- minChars: number;
142
- defaultCountryCode: string;
143
- };
144
- isHead?: boolean | undefined;
145
- nextId?: string | undefined;
146
- } | {
147
- type: "question-enum";
148
- id: string;
149
- data: {
150
- options: {
151
- value: string;
152
- label: string;
153
- }[];
154
- key: string;
155
- question: string;
156
- maxSelected: number;
157
- minSelected: number;
158
- preApply?: {
159
- severity: "hard" | "advisory";
160
- mismatchMessage: string;
161
- expectedValue: string;
162
- } | undefined;
163
- };
164
- isHead?: boolean | undefined;
165
- nextId?: string | undefined;
166
- } | {
167
- type: "question-file";
168
- id: string;
169
- data: {
170
- key: string;
171
- question: string;
172
- optional: boolean;
173
- extensions: string[];
174
- multiple?: boolean | undefined;
175
- maxSizeKb?: number | undefined;
176
- };
177
- isHead?: boolean | undefined;
178
- nextId?: string | undefined;
179
- } | {
180
- type: "question-address";
181
- id: string;
182
- data: {
183
- keys: {
184
- line1: string | null;
185
- line2: string | null;
186
- line3: string | null;
187
- city: string | null;
188
- state: string | null;
189
- postcode: string | null;
190
- country: string | null;
191
- };
192
- key: string;
193
- question: string;
194
- optional: boolean;
195
- placeholder?: string | undefined;
196
- line2Required?: boolean | undefined;
197
- };
198
- isHead?: boolean | undefined;
199
- nextId?: string | undefined;
200
- } | {
201
- type: "if-block";
202
- id: string;
203
- data: {
204
- compareKey: string;
205
- compareValue: string;
206
- compare: "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo";
207
- } | {
208
- combinator: "and" | "or";
209
- conditions: {
210
- compareKey: string;
211
- compareValue: string;
212
- compare: "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo";
213
- }[];
214
- };
215
- isHead?: boolean | undefined;
216
- nextId?: string | undefined;
217
- branchId?: string | undefined;
218
- } | {
219
- type: "jump";
220
- id: string;
221
- data: {
222
- targetId: string;
223
- };
224
- isHead?: boolean | undefined;
225
- nextId?: string | undefined;
226
- } | {
227
- type: "add-submission";
228
- id: string;
229
- data: {
230
- value: string;
231
- key: string;
232
- };
233
- isHead?: boolean | undefined;
234
- nextId?: string | undefined;
235
- } | {
236
- type: "check-duplicate";
237
- id: string;
238
- data: {
239
- key: string;
240
- email: string;
241
- scope: "job" | "company";
242
- };
243
- isHead?: boolean | undefined;
244
- nextId?: string | undefined;
245
- } | {
246
- type: "feedback";
247
- id: string;
248
- data: {};
249
- isHead?: boolean | undefined;
250
- nextId?: string | undefined;
251
- };
252
3
  export declare const isSubmissionOfType: <T extends FlowSubmission["type"]>(type: T) => (submission?: FlowSubmission) => submission is Extract<FlowSubmission, {
253
4
  type: T;
254
5
  }>;
255
6
  export declare function gzip(string: string): string | Promise<string>;
256
- export declare class AbortedError extends Error {
257
- constructor();
258
- }
259
7
  export declare const initialiseFlowStateData: () => FlowStateData;
260
8
  export declare const getFormSubmitter: (e: Event) => HTMLButtonElement | HTMLInputElement;
@@ -1,18 +1,5 @@
1
- import { QuestionAddressNode } from '@inploi/core/flows';
1
+ import { AddressInputPayload } from '@inploi/flows/engine';
2
2
  import { JSX } from 'preact';
3
- import { FlowSubmissionAddress } from '../../chatbot.state';
4
3
  import { ChatInputProps } from './chat-input';
5
4
 
6
- export type AddressInputPayload = {
7
- type: 'address';
8
- /** submission id to wrap the address fields. */
9
- key: string | undefined;
10
- config: {
11
- optional: boolean;
12
- keys: QuestionAddressNode['data']['keys'];
13
- line2Required?: boolean;
14
- placeholder?: string;
15
- };
16
- submission: FlowSubmissionAddress | null;
17
- };
18
5
  export declare const ChatInputAddress: ({ input, onSubmitSuccess, logger }: ChatInputProps<AddressInputPayload>) => JSX.Element;
@@ -1,18 +1,6 @@
1
- import { FlowSubmissionBoolean } from '../../chatbot.state';
1
+ import { BooleanChoicePayload } from '@inploi/flows/engine';
2
2
  import { ChatInputProps } from './chat-input';
3
3
 
4
- export type BooleanChoicePayload = {
5
- type: 'boolean';
6
- config: {
7
- labels: {
8
- true: string;
9
- false: string;
10
- };
11
- optional: boolean;
12
- };
13
- key: string | undefined;
14
- submission: FlowSubmissionBoolean | null;
15
- };
16
4
  export declare const booleanButtonListClass = "flex items-center flex-wrap gap-2 p-2.5";
17
5
  export declare const booleanButtonListItemClass = "min-w-0 max-w-full flex-auto";
18
6
  export declare const BooleanOption: import('preact').FunctionalComponent<Omit<import("preact").JSX.HTMLAttributes<HTMLButtonElement> & {
@@ -1,14 +1,5 @@
1
+ import { ChatbotInput, FlowSubmission } from '@inploi/flows/engine';
1
2
  import { AnalyticsService, Logger } from '@inploi/sdk';
2
- import { DistributivePick } from '../../chatbot.utils';
3
- import { FlowSubmission } from '../../chatbot.state';
4
- import { AddressInputPayload } from './chat-input.address';
5
- import { BooleanChoicePayload } from './chat-input.boolean';
6
- import { FilePayload } from './chat-input.file';
7
- import { MultipleChoicePayload } from './chat-input.multiple-choice';
8
- import { NumberPayload } from './chat-input.number';
9
- import { PhonePayload } from './chat-input.phone-number';
10
- import { SubmitPayload } from './chat-input.submit';
11
- import { TextPayload } from './chat-input.text';
12
3
 
13
4
  export type SubmitSuccessFn = (submission: FlowSubmission | null) => void;
14
5
  export type ChatInputProps<T extends ChatbotInput> = {
@@ -17,6 +8,4 @@ export type ChatInputProps<T extends ChatbotInput> = {
17
8
  logger: Logger;
18
9
  analytics: Pick<AnalyticsService, 'log'>;
19
10
  };
20
- export type ChatbotInput = TextPayload | NumberPayload | MultipleChoicePayload | BooleanChoicePayload | FilePayload | SubmitPayload | AddressInputPayload | PhonePayload;
21
- export type ChatInput = DistributivePick<ChatbotInput, 'type' | 'config' | 'key'>;
22
11
  export declare const ChatInput: ({ logger, analytics }: Pick<ChatInputProps<ChatbotInput>, "logger" | "analytics">) => import("preact").JSX.Element;
@@ -1,18 +1,7 @@
1
+ import { FilePayload, FileToUpload } from '@inploi/flows/engine';
1
2
  import { ComponentProps } from 'preact';
2
- import { FileToUpload, FlowSubmissionFile } from '../../chatbot.state';
3
3
  import { ChatInputProps } from './chat-input';
4
4
 
5
- export type FilePayload = {
6
- type: 'file';
7
- config: {
8
- optional: boolean;
9
- extensions: string[];
10
- fileSizeLimitKib?: number;
11
- allowMultiple: boolean;
12
- };
13
- key: string;
14
- submission: FlowSubmissionFile | null;
15
- };
16
5
  export declare const FileThumbnail: ({ file, class: className, ...props }: ComponentProps<"div"> & {
17
6
  file: Pick<FileToUpload, "name" | "sizeKb">;
18
7
  }) => import("preact").JSX.Element;
@@ -1,17 +1,4 @@
1
- import { FlowSubmissionEnum } from '../../chatbot.state';
1
+ import { MultipleChoicePayload } from '@inploi/flows/engine';
2
2
  import { ChatInputProps } from './chat-input';
3
3
 
4
- export type MultipleChoicePayload = {
5
- type: 'multiple-choice';
6
- key: string | undefined;
7
- config: {
8
- options: {
9
- value: string;
10
- label: string;
11
- }[];
12
- minSelected?: number;
13
- maxSelected?: number;
14
- };
15
- submission: FlowSubmissionEnum;
16
- };
17
4
  export declare const ChatInputMultipleChoice: ({ input, onSubmitSuccess }: ChatInputProps<MultipleChoicePayload>) => import("preact").JSX.Element;
@@ -1,17 +1,4 @@
1
- import { FlowSubmissionNumber } from '../../chatbot.state';
1
+ import { NumberPayload } from '@inploi/flows/engine';
2
2
  import { ChatInputProps } from './chat-input';
3
3
 
4
- export type NumberPayload = {
5
- type: 'number';
6
- key: string | undefined;
7
- config: {
8
- optional: boolean;
9
- placeholder?: string;
10
- defaultValue?: string;
11
- decimalCases?: number;
12
- min?: number;
13
- max?: number;
14
- };
15
- submission: FlowSubmissionNumber | null;
16
- };
17
4
  export declare const ChatInputNumber: ({ input, onSubmitSuccess }: ChatInputProps<NumberPayload>) => import("preact").JSX.Element;
@@ -1,20 +1,4 @@
1
- import { FlowSubmissionPhone, FlowSubmissionString } from '../../chatbot.state';
1
+ import { PhonePayload } from '@inploi/flows/engine';
2
2
  import { ChatInputProps } from './chat-input';
3
3
 
4
- export type PhonePayload = {
5
- type: 'phone';
6
- key: string | undefined;
7
- config: {
8
- optional: boolean;
9
- submissionFormat: 'phone' | 'text';
10
- placeholder?: string;
11
- defaultValue: {
12
- countryCode?: string;
13
- phoneNumber?: string;
14
- };
15
- minChars?: number;
16
- maxChars?: number;
17
- };
18
- submission: FlowSubmissionPhone | FlowSubmissionString | null;
19
- };
20
4
  export declare const ChatInputPhoneNumber: ({ input, onSubmitSuccess }: ChatInputProps<PhonePayload>) => import("preact").JSX.Element;
@@ -1,13 +1,4 @@
1
+ import { SubmitPayload } from '@inploi/flows/engine';
1
2
  import { ChatInputProps } from './chat-input';
2
3
 
3
- export type SubmitPayload = {
4
- type: 'submit';
5
- /** `availableAt` (epoch ms) keeps submit unavailable until then, after an unsuccessful attempt (PROD-7112). */
6
- config: {
7
- label: string;
8
- availableAt?: number;
9
- };
10
- key: string | undefined;
11
- submission: null;
12
- };
13
4
  export declare const ChatInputSubmit: ({ input, onSubmitSuccess }: ChatInputProps<SubmitPayload>) => import("preact").JSX.Element;
@@ -1,18 +1,5 @@
1
+ import { TextPayload } from '@inploi/flows/engine';
1
2
  import { JSX } from 'preact';
2
- import { FlowSubmissionString } from '../../chatbot.state';
3
3
  import { ChatInputProps } from './chat-input';
4
4
 
5
- export type TextPayload = {
6
- type: 'text';
7
- key: string | undefined;
8
- config: {
9
- optional: boolean;
10
- placeholder?: string;
11
- format: 'date' | 'text' | 'email' | 'url';
12
- defaultValue?: string;
13
- maxChars: number | undefined;
14
- minChars: number | undefined;
15
- };
16
- submission: FlowSubmissionString | null;
17
- };
18
5
  export declare const ChatInputText: ({ input, onSubmitSuccess }: ChatInputProps<TextPayload>) => JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { LinkMessage as LinkMessageProps } from '../chatbot.state';
1
+ import { LinkMessage as LinkMessageProps } from '@inploi/flows/engine';
2
2
 
3
3
  export declare const LinkMessage: ({ message }: {
4
4
  message: LinkMessageProps;
@@ -1,10 +1,13 @@
1
- import { ChatService } from '../interpreter';
1
+ import { ChatService } from '@inploi/flows/engine';
2
2
  import { SubmitSuccessFn } from './chat-input/chat-input';
3
3
 
4
4
  export declare const chatStore: {
5
5
  onSubmitSuccessFn$: import('@preact/signals').Signal<SubmitSuccessFn>;
6
6
  onInteractionFn$: import('@preact/signals').Signal<() => void>;
7
7
  isBotTyping$: import('@preact/signals').Signal<boolean>;
8
+ /** A Turnstile challenge is waiting for the candidate in the conversation (PROD-7320). */
9
+ captchaVisible$: import('@preact/signals').Signal<boolean>;
10
+ themeMode$: import('@preact/signals').Signal<"light" | "dark">;
8
11
  isReadingHistory$: import('@preact/signals').Signal<boolean>;
9
12
  scrollToEnd: () => void;
10
13
  };
@@ -0,0 +1 @@
1
+ export {};