@inploi/plugin-chatbot 5.1.0 → 5.1.2
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 +3 -3
- package/cdn/style.css +1 -1
- package/dist/{chatbot-body-81bfa2bc.js → chatbot-body-4dab3467.js} +315 -332
- package/dist/{chatbot-body-f17e1b0d.cjs → chatbot-body-f463d29c.cjs} +1 -1
- package/dist/chatbot.api.d.ts +43 -42
- package/dist/chatbot.d.ts +28 -22
- package/dist/chatbot.idb.d.ts +2 -1
- package/dist/chatbot.state.d.ts +5 -4
- package/dist/chatbot.utils.d.ts +6 -17
- package/dist/components/chat-bubble.d.ts +5 -4
- package/dist/components/chat-input/chat-input.address.d.ts +2 -1
- package/dist/components/chat-input/chat-input.boolean.d.ts +3 -2
- package/dist/components/chat-input/chat-input.d.ts +1 -0
- package/dist/components/chat-input/chat-input.file.d.ts +3 -2
- package/dist/components/chat-input/chat-input.multiple-choice.d.ts +1 -0
- package/dist/components/chat-input/chat-input.number.d.ts +1 -0
- package/dist/components/chat-input/chat-input.phone-number.d.ts +2 -1
- package/dist/components/chat-input/chat-input.submit.d.ts +1 -0
- package/dist/components/chat-input/chat-input.text.d.ts +2 -1
- package/dist/components/chat-input/input-style.d.ts +1 -1
- package/dist/components/chatbot-body.d.ts +2 -1
- package/dist/components/chatbot.d.ts +2 -1
- package/dist/components/conversation.d.ts +1 -0
- package/dist/components/loading-indicator.d.ts +2 -1
- package/dist/components/message.link.d.ts +2 -1
- package/dist/components/send-button.d.ts +2 -1
- package/dist/components/skip-button.d.ts +2 -1
- package/dist/components/status-bar.d.ts +4 -3
- package/dist/components/typing-indicator.d.ts +2 -1
- package/dist/components/useChatService.d.ts +4 -3
- package/dist/components/useFocus.d.ts +1 -1
- package/dist/conditions.d.ts +1 -0
- package/dist/i18n.d.ts +6 -5
- package/dist/{index-4da34b43.js → index-06a5df34.js} +732 -721
- package/dist/index-97d91e46.cjs +5 -0
- package/dist/index.cdn.d.ts +1 -0
- package/dist/index.dev.d.ts +1 -0
- package/dist/interpolation.d.ts +1 -0
- package/dist/interpreter.d.ts +2 -1
- package/dist/mocks/browser.d.ts +1 -1
- package/dist/mocks/flows.mocks.d.ts +1 -0
- package/dist/mocks/handlers.d.ts +6 -6
- package/dist/mocks/mocks.utils.d.ts +3 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/progress.d.ts +1 -0
- package/dist/rpc.d.ts +7 -7
- package/dist/style/theme.d.ts +2 -1
- package/dist/style/theme.utils.d.ts +1 -0
- package/dist/style/tokens.d.ts +17 -21
- package/dist/style.css +1 -1
- package/package.json +7 -7
- package/dist/index-610bb8d8.cjs +0 -5
package/dist/chatbot.api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { GenericSchema, InferOutput } from 'valibot';
|
|
3
|
+
|
|
3
4
|
export type FlowPayload = {
|
|
4
5
|
flow: {
|
|
5
6
|
id: string;
|
|
@@ -7,11 +8,11 @@ export type FlowPayload = {
|
|
|
7
8
|
nodes: FlowNode[];
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
|
-
export declare const FlowSchema: import(
|
|
11
|
-
readonly id: import(
|
|
12
|
-
readonly version: import(
|
|
13
|
-
readonly build: import(
|
|
14
|
-
readonly nodes: import(
|
|
11
|
+
export declare const FlowSchema: import('valibot').ObjectSchema<{
|
|
12
|
+
readonly id: import('valibot').SchemaWithPipe<readonly [import('valibot').UnionSchema<[import('valibot').StringSchema<undefined>, import('valibot').NumberSchema<undefined>], undefined>, import('valibot').TransformAction<any, string>]>;
|
|
13
|
+
readonly version: import('valibot').NumberSchema<undefined>;
|
|
14
|
+
readonly build: import('valibot').NumberSchema<undefined>;
|
|
15
|
+
readonly nodes: import('valibot').ArraySchema<GenericSchema<{
|
|
15
16
|
data: {
|
|
16
17
|
text: string;
|
|
17
18
|
};
|
|
@@ -32,7 +33,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
32
33
|
integrationId: string;
|
|
33
34
|
skipConfirmation: boolean;
|
|
34
35
|
submitLabel: string;
|
|
35
|
-
submitKeys: (string[]
|
|
36
|
+
submitKeys: ("all" | string[]) & ("all" | string[] | undefined);
|
|
36
37
|
key?: string | undefined;
|
|
37
38
|
};
|
|
38
39
|
type: "integration-application-submit";
|
|
@@ -83,7 +84,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
83
84
|
key: string;
|
|
84
85
|
question: string;
|
|
85
86
|
optional: boolean;
|
|
86
|
-
format: "text" | "
|
|
87
|
+
format: "text" | "url" | "email" | "phone";
|
|
87
88
|
placeholder?: string | undefined;
|
|
88
89
|
maxChars?: number | undefined;
|
|
89
90
|
minChars?: number | undefined;
|
|
@@ -236,18 +237,18 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
236
237
|
isHead?: boolean | undefined;
|
|
237
238
|
nextId?: string | undefined;
|
|
238
239
|
}>, undefined>;
|
|
239
|
-
readonly context_schema: import(
|
|
240
|
-
readonly required: import(
|
|
241
|
-
readonly type: import(
|
|
240
|
+
readonly context_schema: import('valibot').OptionalSchema<import('valibot').NullableSchema<import('valibot').RecordSchema<import('valibot').StringSchema<undefined>, import('valibot').ObjectSchema<{
|
|
241
|
+
readonly required: import('valibot').BooleanSchema<undefined>;
|
|
242
|
+
readonly type: import('valibot').UnionSchema<[import('valibot').LiteralSchema<"string", undefined>, import('valibot').LiteralSchema<"number", undefined>], undefined>;
|
|
242
243
|
}, undefined>, undefined>, undefined>, undefined>;
|
|
243
244
|
}, undefined>;
|
|
244
245
|
export type Flow = InferOutput<typeof FlowSchema>;
|
|
245
|
-
export declare const FlowByIdPayloadSchema: import(
|
|
246
|
-
readonly flow: import(
|
|
247
|
-
readonly id: import(
|
|
248
|
-
readonly version: import(
|
|
249
|
-
readonly build: import(
|
|
250
|
-
readonly nodes: import(
|
|
246
|
+
export declare const FlowByIdPayloadSchema: import('valibot').ObjectSchema<{
|
|
247
|
+
readonly flow: import('valibot').ObjectSchema<{
|
|
248
|
+
readonly id: import('valibot').SchemaWithPipe<readonly [import('valibot').UnionSchema<[import('valibot').StringSchema<undefined>, import('valibot').NumberSchema<undefined>], undefined>, import('valibot').TransformAction<any, string>]>;
|
|
249
|
+
readonly version: import('valibot').NumberSchema<undefined>;
|
|
250
|
+
readonly build: import('valibot').NumberSchema<undefined>;
|
|
251
|
+
readonly nodes: import('valibot').ArraySchema<GenericSchema<{
|
|
251
252
|
data: {
|
|
252
253
|
text: string;
|
|
253
254
|
};
|
|
@@ -268,7 +269,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
268
269
|
integrationId: string;
|
|
269
270
|
skipConfirmation: boolean;
|
|
270
271
|
submitLabel: string;
|
|
271
|
-
submitKeys: (string[]
|
|
272
|
+
submitKeys: ("all" | string[]) & ("all" | string[] | undefined);
|
|
272
273
|
key?: string | undefined;
|
|
273
274
|
};
|
|
274
275
|
type: "integration-application-submit";
|
|
@@ -319,7 +320,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
319
320
|
key: string;
|
|
320
321
|
question: string;
|
|
321
322
|
optional: boolean;
|
|
322
|
-
format: "text" | "
|
|
323
|
+
format: "text" | "url" | "email" | "phone";
|
|
323
324
|
placeholder?: string | undefined;
|
|
324
325
|
maxChars?: number | undefined;
|
|
325
326
|
minChars?: number | undefined;
|
|
@@ -472,21 +473,21 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
472
473
|
isHead?: boolean | undefined;
|
|
473
474
|
nextId?: string | undefined;
|
|
474
475
|
}>, undefined>;
|
|
475
|
-
readonly context_schema: import(
|
|
476
|
-
readonly required: import(
|
|
477
|
-
readonly type: import(
|
|
476
|
+
readonly context_schema: import('valibot').OptionalSchema<import('valibot').NullableSchema<import('valibot').RecordSchema<import('valibot').StringSchema<undefined>, import('valibot').ObjectSchema<{
|
|
477
|
+
readonly required: import('valibot').BooleanSchema<undefined>;
|
|
478
|
+
readonly type: import('valibot').UnionSchema<[import('valibot').LiteralSchema<"string", undefined>, import('valibot').LiteralSchema<"number", undefined>], undefined>;
|
|
478
479
|
}, undefined>, undefined>, undefined>, undefined>;
|
|
479
480
|
}, undefined>;
|
|
480
481
|
}, undefined>;
|
|
481
|
-
export declare const FlowByJobPayloadSchema: import(
|
|
482
|
-
readonly company: import(
|
|
483
|
-
readonly name: import(
|
|
482
|
+
export declare const FlowByJobPayloadSchema: import('valibot').ObjectSchema<{
|
|
483
|
+
readonly company: import('valibot').ObjectSchema<{
|
|
484
|
+
readonly name: import('valibot').StringSchema<undefined>;
|
|
484
485
|
}, undefined>;
|
|
485
|
-
readonly flow: import(
|
|
486
|
-
readonly id: import(
|
|
487
|
-
readonly version: import(
|
|
488
|
-
readonly build: import(
|
|
489
|
-
readonly nodes: import(
|
|
486
|
+
readonly flow: import('valibot').ObjectSchema<{
|
|
487
|
+
readonly id: import('valibot').SchemaWithPipe<readonly [import('valibot').UnionSchema<[import('valibot').StringSchema<undefined>, import('valibot').NumberSchema<undefined>], undefined>, import('valibot').TransformAction<any, string>]>;
|
|
488
|
+
readonly version: import('valibot').NumberSchema<undefined>;
|
|
489
|
+
readonly build: import('valibot').NumberSchema<undefined>;
|
|
490
|
+
readonly nodes: import('valibot').ArraySchema<GenericSchema<{
|
|
490
491
|
data: {
|
|
491
492
|
text: string;
|
|
492
493
|
};
|
|
@@ -507,7 +508,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
507
508
|
integrationId: string;
|
|
508
509
|
skipConfirmation: boolean;
|
|
509
510
|
submitLabel: string;
|
|
510
|
-
submitKeys: (string[]
|
|
511
|
+
submitKeys: ("all" | string[]) & ("all" | string[] | undefined);
|
|
511
512
|
key?: string | undefined;
|
|
512
513
|
};
|
|
513
514
|
type: "integration-application-submit";
|
|
@@ -558,7 +559,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
558
559
|
key: string;
|
|
559
560
|
question: string;
|
|
560
561
|
optional: boolean;
|
|
561
|
-
format: "text" | "
|
|
562
|
+
format: "text" | "url" | "email" | "phone";
|
|
562
563
|
placeholder?: string | undefined;
|
|
563
564
|
maxChars?: number | undefined;
|
|
564
565
|
minChars?: number | undefined;
|
|
@@ -711,20 +712,20 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
711
712
|
isHead?: boolean | undefined;
|
|
712
713
|
nextId?: string | undefined;
|
|
713
714
|
}>, undefined>;
|
|
714
|
-
readonly context_schema: import(
|
|
715
|
-
readonly required: import(
|
|
716
|
-
readonly type: import(
|
|
715
|
+
readonly context_schema: import('valibot').OptionalSchema<import('valibot').NullableSchema<import('valibot').RecordSchema<import('valibot').StringSchema<undefined>, import('valibot').ObjectSchema<{
|
|
716
|
+
readonly required: import('valibot').BooleanSchema<undefined>;
|
|
717
|
+
readonly type: import('valibot').UnionSchema<[import('valibot').LiteralSchema<"string", undefined>, import('valibot').LiteralSchema<"number", undefined>], undefined>;
|
|
717
718
|
}, undefined>, undefined>, undefined>, undefined>;
|
|
718
719
|
}, undefined>;
|
|
719
|
-
readonly job: import(
|
|
720
|
-
readonly id: import(
|
|
721
|
-
readonly title: import(
|
|
720
|
+
readonly job: import('valibot').ObjectSchema<{
|
|
721
|
+
readonly id: import('valibot').SchemaWithPipe<readonly [import('valibot').UnionSchema<[import('valibot').StringSchema<undefined>, import('valibot').NumberSchema<undefined>], undefined>, import('valibot').TransformAction<any, string>]>;
|
|
722
|
+
readonly title: import('valibot').StringSchema<undefined>;
|
|
722
723
|
}, undefined>;
|
|
723
|
-
readonly user: import(
|
|
724
|
-
readonly city: import(
|
|
725
|
-
readonly country: import(
|
|
726
|
-
readonly isEU: import(
|
|
727
|
-
readonly continent: import(
|
|
724
|
+
readonly user: import('valibot').OptionalSchema<import('valibot').ObjectSchema<{
|
|
725
|
+
readonly city: import('valibot').OptionalSchema<import('valibot').StringSchema<undefined>, undefined>;
|
|
726
|
+
readonly country: import('valibot').OptionalSchema<import('valibot').StringSchema<undefined>, undefined>;
|
|
727
|
+
readonly isEU: import('valibot').OptionalSchema<import('valibot').BooleanSchema<undefined>, undefined>;
|
|
728
|
+
readonly continent: import('valibot').OptionalSchema<import('valibot').StringSchema<undefined>, undefined>;
|
|
728
729
|
}, undefined>, undefined>;
|
|
729
730
|
}, undefined>;
|
|
730
731
|
export type JobApplication = {
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FeedbackPlugin, FeedbackPluginParams, feedbackPlugin } from '@inploi/plugin-feedback';
|
|
2
2
|
import { Logger } from '@inploi/sdk';
|
|
3
3
|
import { Flow } from './chatbot.api';
|
|
4
4
|
import { ChatbotDomManager } from './chatbot.dom';
|
|
5
5
|
import { ChatbotTranslationTerms } from './i18n';
|
|
6
|
+
|
|
6
7
|
type RemoveInternal<T extends object> = {
|
|
7
8
|
[P in keyof T as string extends P ? never : P extends `_${string}` ? never : P]: T[P];
|
|
8
9
|
};
|
|
10
|
+
export type ChatbotTheme = {
|
|
11
|
+
/** Rotation for the hue. Between 0 and 360. */
|
|
12
|
+
hue: number;
|
|
13
|
+
/** Chroma multiplier. Values between 0 and 1.5 work best. */
|
|
14
|
+
chroma?: number;
|
|
15
|
+
mode: 'light' | 'dark';
|
|
16
|
+
};
|
|
17
|
+
export type ChatbotFeedback = {
|
|
18
|
+
plugin: FeedbackPlugin | Promise<{
|
|
19
|
+
feedbackPlugin: typeof feedbackPlugin;
|
|
20
|
+
}>;
|
|
21
|
+
params?: Pick<FeedbackPluginParams, 'terms'>;
|
|
22
|
+
};
|
|
9
23
|
type InternalChatbotPluginParams = {
|
|
10
|
-
theme:
|
|
11
|
-
|
|
12
|
-
hue: number;
|
|
13
|
-
/** Chroma multiplier. Values between 0 and 1.5 work best. */
|
|
14
|
-
chroma?: number;
|
|
15
|
-
mode: 'light' | 'dark';
|
|
16
|
-
};
|
|
17
|
-
feedback?: {
|
|
18
|
-
plugin: FeedbackPlugin | Promise<{
|
|
19
|
-
feedbackPlugin: typeof feedbackPlugin;
|
|
20
|
-
}>;
|
|
21
|
-
params?: Pick<FeedbackPluginParams, 'terms'>;
|
|
22
|
-
};
|
|
24
|
+
theme: ChatbotTheme;
|
|
25
|
+
feedback?: ChatbotFeedback;
|
|
23
26
|
terms?: ChatbotTranslationTerms;
|
|
24
27
|
/** @deprecated For internal usage only */
|
|
25
28
|
_internal_domManager?: ChatbotDomManager;
|
|
@@ -28,6 +31,7 @@ export type ChatbotPlugin = typeof chatbotPlugin;
|
|
|
28
31
|
export type ChatbotPluginParams = RemoveInternal<InternalChatbotPluginParams>;
|
|
29
32
|
export type Chatbot = ReturnType<ReturnType<ChatbotPlugin>>;
|
|
30
33
|
export type OpenChatbotParams = {
|
|
34
|
+
/** The application flow to be interpreted */
|
|
31
35
|
flow: Flow;
|
|
32
36
|
/** Specify the cache keys for restoring this flow from local state.
|
|
33
37
|
* This will be appended *in addition* to the flow id and version passed to `flow` property.
|
|
@@ -54,22 +58,24 @@ export type OpenChatbotParams = {
|
|
|
54
58
|
lng?: number;
|
|
55
59
|
};
|
|
56
60
|
};
|
|
61
|
+
export type FetchFlowByJobIdAdditionalProperties = Partial<OpenChatbotParams & {
|
|
62
|
+
/** What type of id to use. Defaults to `ats` */
|
|
63
|
+
idType: 'inploi' | 'ats';
|
|
64
|
+
}>;
|
|
65
|
+
export type FetchFlowByIdAdditionalProperties = Partial<OpenChatbotParams>;
|
|
57
66
|
export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, terms, feedback, }: InternalChatbotPluginParams) => ({ apiClient, rpcClient, logger, analytics }: {
|
|
58
|
-
apiClient: import(
|
|
59
|
-
rpcClient: import(
|
|
67
|
+
apiClient: import('@inploi/sdk').ApiClient;
|
|
68
|
+
rpcClient: import('@inploi/sdk').InploiRpcClient;
|
|
60
69
|
logger: Logger;
|
|
61
|
-
analytics: import(
|
|
70
|
+
analytics: import('@inploi/sdk').AnalyticsService;
|
|
62
71
|
}) => {
|
|
63
72
|
/** Optionally eagerly renders the interface ahead of needing the chatbot. */
|
|
64
73
|
prepare: () => Promise<void>;
|
|
65
74
|
/** Fetches a flow by job ID.
|
|
66
75
|
* @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
|
|
67
76
|
*/
|
|
68
|
-
fetchFlowByJobId: (jobId: string, additionalProperties?:
|
|
69
|
-
|
|
70
|
-
idType: 'inploi' | 'ats';
|
|
71
|
-
}>) => Promise<OpenChatbotParams>;
|
|
72
|
-
fetchFlowById: (flowId: string, additionalProperties?: Partial<OpenChatbotParams>) => Promise<OpenChatbotParams>;
|
|
77
|
+
fetchFlowByJobId: (jobId: string, additionalProperties?: FetchFlowByJobIdAdditionalProperties) => Promise<OpenChatbotParams>;
|
|
78
|
+
fetchFlowById: (flowId: string, additionalProperties?: FetchFlowByIdAdditionalProperties) => Promise<OpenChatbotParams>;
|
|
73
79
|
open: (params: OpenChatbotParams | Promise<OpenChatbotParams>) => Promise<void>;
|
|
74
80
|
close: () => Promise<void>;
|
|
75
81
|
};
|
package/dist/chatbot.idb.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flow } from './chatbot.api';
|
|
2
2
|
import { ChatMessage, KeyToSubmissionMap, StartedFlow } from './chatbot.state';
|
|
3
3
|
import { ChatInput } from './components/chat-input/chat-input';
|
|
4
|
+
|
|
4
5
|
export declare const idb: {
|
|
5
|
-
getStateData: (flow: Flow, flowKeys: string[]) => Promise<{
|
|
6
|
+
getStateData: (flow: Flow, flowKeys: string[], context: Record<string, unknown>) => Promise<{
|
|
6
7
|
currentInput: ChatInput | null;
|
|
7
8
|
nodeHistory: string[];
|
|
8
9
|
flowSessionId: string;
|
package/dist/chatbot.state.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { OpenChatbotParams } from '.';
|
|
|
2
2
|
import { Flow } from './chatbot.api';
|
|
3
3
|
import { ChatInput } from './components/chat-input/chat-input';
|
|
4
4
|
import { ChatbotFlowProgress } from './progress';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
export declare const getCacheKey: (flow: Pick<StartedFlow, "flowKeys" | "id" | "version" | "context">) => string;
|
|
6
7
|
export type StartedFlow = Flow & {
|
|
7
8
|
flowKeys: string[];
|
|
8
9
|
title: string;
|
|
@@ -32,9 +33,9 @@ type CurrentFlow = {
|
|
|
32
33
|
error: string;
|
|
33
34
|
};
|
|
34
35
|
export declare const store: {
|
|
35
|
-
current$: import(
|
|
36
|
-
viewState$: import(
|
|
37
|
-
inputHeight$: import(
|
|
36
|
+
current$: import('@preact/signals').Signal<CurrentFlow>;
|
|
37
|
+
viewState$: import('@preact/signals').Signal<"maximised" | "minimised" | "closed">;
|
|
38
|
+
inputHeight$: import('@preact/signals').Signal<number>;
|
|
38
39
|
startFlow: ({ flow, context, flowKeys, title, analytics, job, locationOrigin }: OpenChatbotParams) => Promise<void>;
|
|
39
40
|
cancelCurrentFlow: () => void;
|
|
40
41
|
markAsFinished: () => void;
|
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { FlowStateData, FlowSubmission, KeyToSubmissionMap } from './chatbot.state';
|
|
3
|
+
|
|
3
4
|
export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;
|
|
4
5
|
export declare const kbToReadableSize: (kb: number) => string;
|
|
5
6
|
export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
@@ -23,7 +24,7 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
23
24
|
integrationId: string;
|
|
24
25
|
skipConfirmation: boolean;
|
|
25
26
|
submitLabel: string;
|
|
26
|
-
submitKeys: (string[]
|
|
27
|
+
submitKeys: ("all" | string[]) & ("all" | string[] | undefined);
|
|
27
28
|
key?: string | undefined;
|
|
28
29
|
};
|
|
29
30
|
type: "integration-application-submit";
|
|
@@ -74,7 +75,7 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
74
75
|
key: string;
|
|
75
76
|
question: string;
|
|
76
77
|
optional: boolean;
|
|
77
|
-
format: "text" | "
|
|
78
|
+
format: "text" | "url" | "email" | "phone";
|
|
78
79
|
placeholder?: string | undefined;
|
|
79
80
|
maxChars?: number | undefined;
|
|
80
81
|
minChars?: number | undefined;
|
|
@@ -228,21 +229,7 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
228
229
|
nextId?: string | undefined;
|
|
229
230
|
};
|
|
230
231
|
export declare const getFlowSubmissionsPayload: (submissions: KeyToSubmissionMap) => Record<string, unknown>;
|
|
231
|
-
export declare const isSubmissionOfType: <T extends "
|
|
232
|
-
type: T;
|
|
233
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionBoolean, {
|
|
234
|
-
type: T;
|
|
235
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionNumber, {
|
|
236
|
-
type: T;
|
|
237
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionPhone, {
|
|
238
|
-
type: T;
|
|
239
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionEnum, {
|
|
240
|
-
type: T;
|
|
241
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionAddress, {
|
|
242
|
-
type: T;
|
|
243
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionFile, {
|
|
244
|
-
type: T;
|
|
245
|
-
}> | Extract<import("./chatbot.state").FlowSubmissionIntegration, {
|
|
232
|
+
export declare const isSubmissionOfType: <T extends FlowSubmission["type"]>(type: T) => (submission?: FlowSubmission) => submission is Extract<FlowSubmission, {
|
|
246
233
|
type: T;
|
|
247
234
|
}>;
|
|
248
235
|
export declare function gzip(string: string): string | Promise<string>;
|
|
@@ -251,5 +238,7 @@ export declare class AbortedError extends Error {
|
|
|
251
238
|
}
|
|
252
239
|
export declare function debounce<TFn extends (...params: any[]) => void>(func: TFn, timeout?: number): TFn;
|
|
253
240
|
export declare const isString: (value: unknown) => value is string;
|
|
241
|
+
/** Creates a deterministic hash string from an object by JSON stringifying with sorted keys */
|
|
242
|
+
export declare const hashObject: (obj: Record<string, unknown>) => string;
|
|
254
243
|
export declare const initialiseFlowStateData: () => FlowStateData;
|
|
255
244
|
export declare const getFormSubmitter: (e: Event) => HTMLButtonElement | HTMLInputElement;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { ComponentProps } from '../../node_modules/preact/compat';
|
|
3
|
+
|
|
3
4
|
declare const chatBubbleVariants: (props?: ({
|
|
4
5
|
side?: "left" | "right" | null | undefined;
|
|
5
6
|
animate?: boolean | null | undefined;
|
|
6
|
-
} & import(
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
8
|
type ChatBubbleVariants = VariantProps<typeof chatBubbleVariants>;
|
|
8
9
|
type ChatBubbleProps = ComponentProps<'p'> & ChatBubbleVariants;
|
|
9
|
-
export declare const ChatBubble: ({ children, className, animate, side, ...props }: ChatBubbleProps) => import("preact
|
|
10
|
+
export declare const ChatBubble: ({ children, className, animate, side, ...props }: ChatBubbleProps) => import("preact").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { QuestionAddressNode } from '@inploi/core/flows';
|
|
2
|
-
import
|
|
2
|
+
import { JSX } from 'preact';
|
|
3
3
|
import { FlowSubmissionAddress } from '../../chatbot.state';
|
|
4
4
|
import { ChatInputProps } from './chat-input';
|
|
5
|
+
|
|
5
6
|
export type AddressInputPayload = {
|
|
6
7
|
type: 'address';
|
|
7
8
|
/** submission id to wrap the address fields. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlowSubmissionBoolean } from '../../chatbot.state';
|
|
2
2
|
import { ChatInputProps } from './chat-input';
|
|
3
|
+
|
|
3
4
|
export type BooleanChoicePayload = {
|
|
4
5
|
type: 'boolean';
|
|
5
6
|
config: {
|
|
@@ -13,9 +14,9 @@ export type BooleanChoicePayload = {
|
|
|
13
14
|
submission: FlowSubmissionBoolean | null;
|
|
14
15
|
};
|
|
15
16
|
export declare const booleanButtonListClass = "flex items-center gap-2 p-2.5";
|
|
16
|
-
export declare const BooleanOption: import(
|
|
17
|
+
export declare const BooleanOption: import('preact').FunctionalComponent<Omit<import("preact").JSX.HTMLAttributes<HTMLButtonElement> & {
|
|
17
18
|
label: string;
|
|
18
19
|
}, "ref"> & {
|
|
19
|
-
ref?: import(
|
|
20
|
+
ref?: import('preact').Ref<HTMLButtonElement> | undefined;
|
|
20
21
|
}>;
|
|
21
22
|
export declare const ChatInputBoolean: ({ input, onSubmitSuccess }: ChatInputProps<BooleanChoicePayload>) => import("preact").JSX.Element;
|
|
@@ -9,6 +9,7 @@ import { NumberPayload } from './chat-input.number';
|
|
|
9
9
|
import { PhonePayload } from './chat-input.phone-number';
|
|
10
10
|
import { SubmitPayload } from './chat-input.submit';
|
|
11
11
|
import { TextPayload } from './chat-input.text';
|
|
12
|
+
|
|
12
13
|
export type SubmitSuccessFn = (submission: FlowSubmission | null) => void;
|
|
13
14
|
export type ChatInputProps<T extends ChatbotInput> = {
|
|
14
15
|
onSubmitSuccess: (value: T['submission']) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from 'preact';
|
|
2
2
|
import { FileToUpload, FlowSubmissionFile } from '../../chatbot.state';
|
|
3
3
|
import { ChatInputProps } from './chat-input';
|
|
4
|
+
|
|
4
5
|
export type FilePayload = {
|
|
5
6
|
type: 'file';
|
|
6
7
|
config: {
|
|
@@ -12,7 +13,7 @@ export type FilePayload = {
|
|
|
12
13
|
key: string;
|
|
13
14
|
submission: FlowSubmissionFile | null;
|
|
14
15
|
};
|
|
15
|
-
export declare const FileThumbnail: ({ file, class: className, ...props }: ComponentProps<
|
|
16
|
-
file: Pick<FileToUpload,
|
|
16
|
+
export declare const FileThumbnail: ({ file, class: className, ...props }: ComponentProps<"div"> & {
|
|
17
|
+
file: Pick<FileToUpload, "name" | "sizeKb">;
|
|
17
18
|
}) => import("preact").JSX.Element;
|
|
18
19
|
export declare const ChatInputFile: ({ input, onSubmitSuccess }: ChatInputProps<FilePayload>) => import("preact").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
|
|
2
|
+
|
|
2
3
|
type ChatbotBodyProps = {
|
|
3
4
|
apiClient: ApiClient;
|
|
4
5
|
logger: Logger;
|
|
5
6
|
analytics: AnalyticsService;
|
|
6
7
|
};
|
|
7
|
-
export declare const ChatbotBody: ({ logger, apiClient, analytics }: ChatbotBodyProps) => import("preact
|
|
8
|
+
export declare const ChatbotBody: ({ logger, apiClient, analytics }: ChatbotBodyProps) => import("preact").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
|
|
2
2
|
import { ChatbotPluginParams } from '..';
|
|
3
|
+
|
|
3
4
|
type ChatbotProps = {
|
|
4
5
|
apiClient: ApiClient;
|
|
5
6
|
logger: Logger;
|
|
6
7
|
analytics: AnalyticsService;
|
|
7
8
|
params: ChatbotPluginParams;
|
|
8
9
|
};
|
|
9
|
-
export declare const Chatbot: ({ logger, apiClient, analytics, params }: ChatbotProps) => import("preact
|
|
10
|
+
export declare const Chatbot: ({ logger, apiClient, analytics, params }: ChatbotProps) => import("preact").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ComponentProps } from 'preact';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export declare const SendButton: ({ class: className, ...props }: ComponentProps<"button">) => import("preact").JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ComponentProps } from 'preact';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export declare const SkipButton: ({ class: className, ...props }: ComponentProps<"button">) => import("preact").JSX.Element;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { ComponentChildren, ComponentProps } from 'preact';
|
|
3
3
|
import { ChatbotPluginParams } from '..';
|
|
4
|
+
|
|
4
5
|
declare const svgButtonClass: (props?: ({
|
|
5
6
|
variant?: "neutral" | "white" | null | undefined;
|
|
6
|
-
} & import(
|
|
7
|
-
export declare const SvgIconButton: ({ class: className, children, variant, ...props }: ComponentProps<
|
|
8
|
-
variant?: VariantProps<typeof svgButtonClass>[
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
export declare const SvgIconButton: ({ class: className, children, variant, ...props }: ComponentProps<"button"> & {
|
|
9
|
+
variant?: VariantProps<typeof svgButtonClass>["variant"];
|
|
9
10
|
}) => import("preact").JSX.Element;
|
|
10
11
|
export declare const StatusBar: ({ children, params }: {
|
|
11
12
|
children?: ComponentChildren;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ComponentProps } from '../../node_modules/preact/compat';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export declare const TypingIndicator: ({ className, ...props }: ComponentProps<"div">) => import("preact").JSX.Element;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ChatService } from '../interpreter';
|
|
2
2
|
import { SubmitSuccessFn } from './chat-input/chat-input';
|
|
3
|
+
|
|
3
4
|
export declare const chatStore: {
|
|
4
|
-
onSubmitSuccessFn$: import(
|
|
5
|
-
isBotTyping$: import(
|
|
5
|
+
onSubmitSuccessFn$: import('@preact/signals').Signal<SubmitSuccessFn>;
|
|
6
|
+
isBotTyping$: import('@preact/signals').Signal<boolean>;
|
|
6
7
|
scrollToEnd: {
|
|
7
8
|
instant: () => void;
|
|
8
9
|
smooth: () => void;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
11
12
|
export declare const useChatService: () => {
|
|
12
|
-
chatRef: import(
|
|
13
|
+
chatRef: import('preact/hooks').Ref<HTMLDivElement>;
|
|
13
14
|
chatService: ChatService;
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useFocusOnMount: () => import(
|
|
1
|
+
export declare const useFocusOnMount: () => import('preact/hooks').MutableRef<any>;
|
package/dist/conditions.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IfBlockNode } from '@inploi/core/flows';
|
|
2
2
|
import { KeyToSubmissionMap } from './chatbot.state';
|
|
3
|
+
|
|
3
4
|
export declare const isIfBlockConditionMet: (ifBlock: IfBlockNode, { context, submissions }: {
|
|
4
5
|
submissions?: KeyToSubmissionMap;
|
|
5
6
|
context: Record<string, unknown>;
|