@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.
Files changed (53) hide show
  1. package/cdn/index.js +3 -3
  2. package/cdn/style.css +1 -1
  3. package/dist/{chatbot-body-81bfa2bc.js → chatbot-body-4dab3467.js} +315 -332
  4. package/dist/{chatbot-body-f17e1b0d.cjs → chatbot-body-f463d29c.cjs} +1 -1
  5. package/dist/chatbot.api.d.ts +43 -42
  6. package/dist/chatbot.d.ts +28 -22
  7. package/dist/chatbot.idb.d.ts +2 -1
  8. package/dist/chatbot.state.d.ts +5 -4
  9. package/dist/chatbot.utils.d.ts +6 -17
  10. package/dist/components/chat-bubble.d.ts +5 -4
  11. package/dist/components/chat-input/chat-input.address.d.ts +2 -1
  12. package/dist/components/chat-input/chat-input.boolean.d.ts +3 -2
  13. package/dist/components/chat-input/chat-input.d.ts +1 -0
  14. package/dist/components/chat-input/chat-input.file.d.ts +3 -2
  15. package/dist/components/chat-input/chat-input.multiple-choice.d.ts +1 -0
  16. package/dist/components/chat-input/chat-input.number.d.ts +1 -0
  17. package/dist/components/chat-input/chat-input.phone-number.d.ts +2 -1
  18. package/dist/components/chat-input/chat-input.submit.d.ts +1 -0
  19. package/dist/components/chat-input/chat-input.text.d.ts +2 -1
  20. package/dist/components/chat-input/input-style.d.ts +1 -1
  21. package/dist/components/chatbot-body.d.ts +2 -1
  22. package/dist/components/chatbot.d.ts +2 -1
  23. package/dist/components/conversation.d.ts +1 -0
  24. package/dist/components/loading-indicator.d.ts +2 -1
  25. package/dist/components/message.link.d.ts +2 -1
  26. package/dist/components/send-button.d.ts +2 -1
  27. package/dist/components/skip-button.d.ts +2 -1
  28. package/dist/components/status-bar.d.ts +4 -3
  29. package/dist/components/typing-indicator.d.ts +2 -1
  30. package/dist/components/useChatService.d.ts +4 -3
  31. package/dist/components/useFocus.d.ts +1 -1
  32. package/dist/conditions.d.ts +1 -0
  33. package/dist/i18n.d.ts +6 -5
  34. package/dist/{index-4da34b43.js → index-06a5df34.js} +732 -721
  35. package/dist/index-97d91e46.cjs +5 -0
  36. package/dist/index.cdn.d.ts +1 -0
  37. package/dist/index.dev.d.ts +1 -0
  38. package/dist/interpolation.d.ts +1 -0
  39. package/dist/interpreter.d.ts +2 -1
  40. package/dist/mocks/browser.d.ts +1 -1
  41. package/dist/mocks/flows.mocks.d.ts +1 -0
  42. package/dist/mocks/handlers.d.ts +6 -6
  43. package/dist/mocks/mocks.utils.d.ts +3 -2
  44. package/dist/plugin-chatbot.cjs +1 -1
  45. package/dist/plugin-chatbot.js +1 -1
  46. package/dist/progress.d.ts +1 -0
  47. package/dist/rpc.d.ts +7 -7
  48. package/dist/style/theme.d.ts +2 -1
  49. package/dist/style/theme.utils.d.ts +1 -0
  50. package/dist/style/tokens.d.ts +17 -21
  51. package/dist/style.css +1 -1
  52. package/package.json +7 -7
  53. package/dist/index-610bb8d8.cjs +0 -5
@@ -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("valibot").ObjectSchema<{
11
- readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>, import("valibot").TransformAction<any, string>]>;
12
- readonly version: import("valibot").NumberSchema<undefined>;
13
- readonly build: import("valibot").NumberSchema<undefined>;
14
- readonly nodes: import("valibot").ArraySchema<GenericSchema<{
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[] | "all") & (string[] | "all" | undefined);
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" | "phone" | "url" | "email";
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("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").ObjectSchema<{
240
- readonly required: import("valibot").BooleanSchema<undefined>;
241
- readonly type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"string", undefined>, import("valibot").LiteralSchema<"number", undefined>], undefined>;
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("valibot").ObjectSchema<{
246
- readonly flow: import("valibot").ObjectSchema<{
247
- readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>, import("valibot").TransformAction<any, string>]>;
248
- readonly version: import("valibot").NumberSchema<undefined>;
249
- readonly build: import("valibot").NumberSchema<undefined>;
250
- readonly nodes: import("valibot").ArraySchema<GenericSchema<{
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[] | "all") & (string[] | "all" | undefined);
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" | "phone" | "url" | "email";
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("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").ObjectSchema<{
476
- readonly required: import("valibot").BooleanSchema<undefined>;
477
- readonly type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"string", undefined>, import("valibot").LiteralSchema<"number", undefined>], undefined>;
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("valibot").ObjectSchema<{
482
- readonly company: import("valibot").ObjectSchema<{
483
- readonly name: import("valibot").StringSchema<undefined>;
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("valibot").ObjectSchema<{
486
- readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>, import("valibot").TransformAction<any, string>]>;
487
- readonly version: import("valibot").NumberSchema<undefined>;
488
- readonly build: import("valibot").NumberSchema<undefined>;
489
- readonly nodes: import("valibot").ArraySchema<GenericSchema<{
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[] | "all") & (string[] | "all" | undefined);
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" | "phone" | "url" | "email";
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("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").ObjectSchema<{
715
- readonly required: import("valibot").BooleanSchema<undefined>;
716
- readonly type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"string", undefined>, import("valibot").LiteralSchema<"number", undefined>], undefined>;
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("valibot").ObjectSchema<{
720
- readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>, import("valibot").TransformAction<any, string>]>;
721
- readonly title: import("valibot").StringSchema<undefined>;
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("valibot").OptionalSchema<import("valibot").ObjectSchema<{
724
- readonly city: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
725
- readonly country: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
726
- readonly isEU: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
727
- readonly continent: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
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 type { FeedbackPlugin, FeedbackPluginParams, feedbackPlugin } from '@inploi/plugin-feedback';
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
- /** 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
- 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("@inploi/sdk").ApiClient;
59
- rpcClient: import("@inploi/sdk").InploiRpcClient;
67
+ apiClient: import('@inploi/sdk').ApiClient;
68
+ rpcClient: import('@inploi/sdk').InploiRpcClient;
60
69
  logger: Logger;
61
- analytics: import("@inploi/sdk").AnalyticsService;
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?: Partial<OpenChatbotParams & {
69
- /** What type of id to use. Defaults to `ats` */
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
  };
@@ -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;
@@ -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
- export declare const getCacheKey: (flow: Pick<StartedFlow, 'flowKeys' | 'id' | 'version'>) => string;
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("@preact/signals").Signal<CurrentFlow>;
36
- viewState$: import("@preact/signals").Signal<"maximised" | "minimised" | "closed">;
37
- inputHeight$: import("@preact/signals").Signal<number>;
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;
@@ -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[] | "all") & (string[] | "all" | undefined);
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" | "phone" | "url" | "email";
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 "string" | "number" | "boolean" | "phone" | "enum" | "address" | "file" | "integration">(type: T) => (submission?: FlowSubmission) => submission is Extract<import("./chatbot.state").FlowSubmissionString, {
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 type { VariantProps } from 'class-variance-authority';
2
- import type { ComponentProps } from '../../node_modules/preact/compat';
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("class-variance-authority/types").ClassProp) | undefined) => string;
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/compat").JSX.Element;
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 type { JSX } from 'preact';
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("preact").FunctionalComponent<Omit<import("preact").JSX.HTMLAttributes<HTMLButtonElement> & {
17
+ export declare const BooleanOption: import('preact').FunctionalComponent<Omit<import("preact").JSX.HTMLAttributes<HTMLButtonElement> & {
17
18
  label: string;
18
19
  }, "ref"> & {
19
- ref?: import("preact").Ref<HTMLButtonElement> | undefined;
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<'div'> & {
16
- file: Pick<FileToUpload, 'name' | 'sizeKb'>;
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,5 +1,6 @@
1
1
  import { FlowSubmissionEnum } from '../../chatbot.state';
2
2
  import { ChatInputProps } from './chat-input';
3
+
3
4
  export type MultipleChoicePayload = {
4
5
  type: 'multiple-choice';
5
6
  key: string | undefined;
@@ -1,5 +1,6 @@
1
1
  import { FlowSubmissionNumber } from '../../chatbot.state';
2
2
  import { ChatInputProps } from './chat-input';
3
+
3
4
  export type NumberPayload = {
4
5
  type: 'number';
5
6
  key: string | undefined;
@@ -1,5 +1,6 @@
1
1
  import { FlowSubmissionPhone, FlowSubmissionString } from '../../chatbot.state';
2
- import type { ChatInputProps } from './chat-input';
2
+ import { ChatInputProps } from './chat-input';
3
+
3
4
  export type PhonePayload = {
4
5
  type: 'phone';
5
6
  key: string | undefined;
@@ -1,4 +1,5 @@
1
1
  import { ChatInputProps } from './chat-input';
2
+
2
3
  export type SubmitPayload = {
3
4
  type: 'submit';
4
5
  config: {
@@ -1,6 +1,7 @@
1
- import type { JSX } from 'preact';
1
+ import { JSX } from 'preact';
2
2
  import { FlowSubmissionString } from '../../chatbot.state';
3
3
  import { ChatInputProps } from './chat-input';
4
+
4
5
  export type TextPayload = {
5
6
  type: 'text';
6
7
  key: string | undefined;
@@ -1,3 +1,3 @@
1
1
  export declare const chatInputClass: (props?: ({
2
2
  optional?: boolean | null | undefined;
3
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
3
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -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/compat").JSX.Element;
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/compat").JSX.Element;
10
+ export declare const Chatbot: ({ logger, apiClient, analytics, params }: ChatbotProps) => import("preact").JSX.Element;
10
11
  export {};
@@ -1,4 +1,5 @@
1
1
  import { VNode } from 'preact';
2
+
2
3
  export declare const Conversation: ({ lastSentMessageFooter }: {
3
4
  lastSentMessageFooter: VNode | null;
4
5
  }) => import("preact").JSX.Element;
@@ -1,2 +1,3 @@
1
1
  import { ComponentProps } from 'preact';
2
- export declare const LoadingIndicator: (props: ComponentProps<'svg'>) => import("preact").JSX.Element;
2
+
3
+ export declare const LoadingIndicator: (props: ComponentProps<"svg">) => import("preact").JSX.Element;
@@ -1,4 +1,5 @@
1
- import type { LinkMessage as LinkMessageProps } from '../chatbot.state';
1
+ import { LinkMessage as LinkMessageProps } from '../chatbot.state';
2
+
2
3
  export declare const LinkMessage: ({ message }: {
3
4
  message: LinkMessageProps;
4
5
  }) => import("preact").JSX.Element;
@@ -1,2 +1,3 @@
1
1
  import { ComponentProps } from 'preact';
2
- export declare const SendButton: ({ class: className, ...props }: ComponentProps<'button'>) => import("preact").JSX.Element;
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
- export declare const SkipButton: ({ class: className, ...props }: ComponentProps<'button'>) => import("preact").JSX.Element;
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("class-variance-authority/types").ClassProp) | undefined) => string;
7
- export declare const SvgIconButton: ({ class: className, children, variant, ...props }: ComponentProps<'button'> & {
8
- variant?: VariantProps<typeof svgButtonClass>['variant'];
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
- export declare const TypingIndicator: ({ className, ...props }: ComponentProps<'div'>) => import("preact/compat").JSX.Element;
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("@preact/signals").Signal<SubmitSuccessFn>;
5
- isBotTyping$: import("@preact/signals").Signal<boolean>;
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("preact/hooks").Ref<HTMLDivElement>;
13
+ chatRef: import('preact/hooks').Ref<HTMLDivElement>;
13
14
  chatService: ChatService;
14
15
  };
@@ -1 +1 @@
1
- export declare const useFocusOnMount: () => import("preact/hooks").MutableRef<any>;
1
+ export declare const useFocusOnMount: () => import('preact/hooks').MutableRef<any>;
@@ -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>;