@inploi/plugin-chatbot 3.30.0 → 4.0.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.
@@ -2400,8 +2400,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
2400
2400
  id: import("valibot").StringSchema<string>;
2401
2401
  title: import("valibot").StringSchema<string>;
2402
2402
  }, undefined, {
2403
- id: string;
2404
2403
  title: string;
2404
+ id: string;
2405
2405
  }>;
2406
2406
  }, undefined, {
2407
2407
  flow: {
@@ -2645,8 +2645,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
2645
2645
  name: string;
2646
2646
  };
2647
2647
  job: {
2648
- id: string;
2649
2648
  title: string;
2649
+ id: string;
2650
2650
  };
2651
2651
  }>;
2652
2652
  export type JobApplication = {
@@ -1,7 +1,2 @@
1
- export declare const CHATBOT_ELEMENT_ID = "isdk";
2
- export declare const ERROR_MESSAGES: {
3
- not_in_local_storage: string;
4
- invalid_end_node: string;
5
- no_submissions: string;
6
- invalid_state: string;
7
- };
1
+ export declare const CHATBOT_WIDGET_ID = "inploi-chatbot";
2
+ export declare const CHATBOT_SELECTOR = "[data-widget='inploi-chatbot']";
package/dist/chatbot.d.ts CHANGED
@@ -1,11 +1,29 @@
1
+ import type { FeedbackPlugin, FeedbackPluginParams } from '@inploi/plugin-feedback';
1
2
  import { Logger } from '@inploi/sdk';
2
3
  import { Flow } from './chatbot.api';
3
4
  import { ChatbotDomManager } from './chatbot.dom';
5
+ import { ChatbotTranslationTerms } from './i18n';
4
6
  type RemoveInternal<T extends object> = {
5
7
  [P in keyof T as string extends P ? never : P extends `_${string}` ? never : P]: T[P];
6
8
  };
9
+ 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;
19
+ params?: Pick<FeedbackPluginParams, 'terms'>;
20
+ };
21
+ terms?: ChatbotTranslationTerms;
22
+ /** @deprecated For internal usage only */
23
+ _internal_domManager?: ChatbotDomManager;
24
+ };
7
25
  export type ChatbotPlugin = typeof chatbotPlugin;
8
- export type ChatbotPluginParams = RemoveInternal<Parameters<ChatbotPlugin>[0]>;
26
+ export type ChatbotPluginParams = RemoveInternal<InternalChatbotPluginParams>;
9
27
  export type Chatbot = ReturnType<ReturnType<ChatbotPlugin>>;
10
28
  export type OpenChatbotParams = {
11
29
  flow: Flow;
@@ -29,19 +47,11 @@ export type OpenChatbotParams = {
29
47
  id_type: 'internal' | 'external';
30
48
  };
31
49
  };
32
- export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
33
- theme: {
34
- /** Rotation for the hue. Between 0 and 360. */
35
- hue: number;
36
- /** Chroma multiplier. Values between 0 and 1.5 work best. */
37
- chroma?: number;
38
- mode: 'light' | 'dark';
39
- };
40
- /** @deprecated For internal usage only */
41
- _internal_domManager?: ChatbotDomManager;
42
- }) => ({ apiClient, logger, analytics }: {
50
+ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, terms, feedback, }: InternalChatbotPluginParams) => ({ apiClient, logger, analytics }: {
43
51
  apiClient: import("@inploi/sdk").ApiClient;
44
- logger: Logger;
52
+ logger: Logger; /** Fetches a flow by job ID.
53
+ * @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.
54
+ */
45
55
  analytics: import("@inploi/sdk").AnalyticsService;
46
56
  }) => {
47
57
  /** Optionally eagerly renders the interface ahead of needing the chatbot. */
@@ -1,4 +1,4 @@
1
1
  export declare const createChatbotDomManager: () => {
2
- getOrCreateChatbotElement: () => HTMLElement;
2
+ getOrCreateChatbotElement: () => Element;
3
3
  };
4
4
  export type ChatbotDomManager = ReturnType<typeof createChatbotDomManager>;
@@ -229,7 +229,7 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
229
229
  nextId?: string | undefined;
230
230
  };
231
231
  export declare const getFlowSubmissionsPayload: (submissions: KeyToSubmissionMap) => Record<string, unknown>;
232
- export declare const isSubmissionOfType: <T extends "string" | "number" | "boolean" | "enum" | "phone" | "address" | "file" | "integration">(type: T) => (submission?: FlowSubmission) => submission is Extract<import("./chatbot.state").FlowSubmissionString, {
232
+ export declare const isSubmissionOfType: <T extends "string" | "number" | "boolean" | "address" | "enum" | "phone" | "file" | "integration">(type: T) => (submission?: FlowSubmission) => submission is Extract<import("./chatbot.state").FlowSubmissionString, {
233
233
  type: T;
234
234
  }> | Extract<import("./chatbot.state").FlowSubmissionBoolean, {
235
235
  type: T;
@@ -1,8 +1,10 @@
1
1
  import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
2
+ import { ChatbotPluginParams } from '..';
2
3
  type ChatbotProps = {
3
4
  apiClient: ApiClient;
4
5
  logger: Logger;
5
6
  analytics: AnalyticsService;
7
+ params: ChatbotPluginParams;
6
8
  };
7
- export declare const Chatbot: ({ logger, apiClient, analytics }: ChatbotProps) => import("preact/compat").JSX.Element;
9
+ export declare const Chatbot: ({ logger, apiClient, analytics, params }: ChatbotProps) => import("preact/compat").JSX.Element;
8
10
  export {};
@@ -1,4 +1,6 @@
1
1
  import { ComponentChildren } from 'preact';
2
- export declare const StatusBar: ({ children }: {
2
+ import { ChatbotPluginParams } from '..';
3
+ export declare const StatusBar: ({ children, params }: {
3
4
  children?: ComponentChildren;
5
+ params: ChatbotPluginParams;
4
6
  }) => import("preact").JSX.Element;
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,271 @@
1
+ export declare const TranslationProvider: (props: {
2
+ terms?: Partial<import("i18n").TranslationDict<{
3
+ readonly error_heading: "Something unexpected happened";
4
+ readonly undo: "Undo";
5
+ readonly send: "Send";
6
+ readonly skip: "Skip";
7
+ readonly skipped: "Skipped";
8
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
9
+ readonly complete_submission: "Complete submission";
10
+ readonly submission_completed: "Submission completed!";
11
+ readonly submission_failed: "Failed to submit";
12
+ readonly maximize: "Maximise";
13
+ readonly minimize: "Minimise";
14
+ readonly close_application: "Close application";
15
+ readonly applying_for: "Applying for “{{title}}”";
16
+ /** When an application is at an invalid state, the user will get this error. */
17
+ readonly invalid_state: "Invalid application state";
18
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
19
+ readonly upload_file: {
20
+ readonly one: "Select file to upload";
21
+ readonly other: "Select files to upload";
22
+ };
23
+ readonly file_max_size: "max {{size}}";
24
+ readonly file_extensions: "Accepted file extensions";
25
+ readonly address_error: "Something went wrong! Plase continue manually";
26
+ readonly address_search: "Type and search for places…";
27
+ readonly address_manual: "Fill in manually";
28
+ readonly back: "Back";
29
+ readonly search: "Search";
30
+ readonly unknown_error: "An error occurred";
31
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
32
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
33
+ readonly validation_phone: "Please enter a valid phone number";
34
+ readonly validation_country_code: "Please select a country code";
35
+ readonly validation_number: "Please enter a valid number";
36
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
37
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
38
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
39
+ readonly validation_file: "Please select a file";
40
+ readonly validation_file_ext: "Please only upload {{ext}} files";
41
+ readonly validation_file_max: {
42
+ readonly one: "Please only upload one file";
43
+ readonly other: "Please only upload up to {{count}} files";
44
+ };
45
+ }>> | undefined;
46
+ locale: string | undefined;
47
+ children?: import("preact").ComponentChildren;
48
+ }) => import("preact").JSX.Element, useTranslation: <T extends {
49
+ readonly error_heading: "Something unexpected happened";
50
+ readonly undo: "Undo";
51
+ readonly send: "Send";
52
+ readonly skip: "Skip";
53
+ readonly skipped: "Skipped";
54
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
55
+ readonly complete_submission: "Complete submission";
56
+ readonly submission_completed: "Submission completed!";
57
+ readonly submission_failed: "Failed to submit";
58
+ readonly maximize: "Maximise";
59
+ readonly minimize: "Minimise";
60
+ readonly close_application: "Close application";
61
+ readonly applying_for: "Applying for “{{title}}”";
62
+ /** When an application is at an invalid state, the user will get this error. */
63
+ readonly invalid_state: "Invalid application state";
64
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
65
+ readonly upload_file: {
66
+ readonly one: "Select file to upload";
67
+ readonly other: "Select files to upload";
68
+ };
69
+ readonly file_max_size: "max {{size}}";
70
+ readonly file_extensions: "Accepted file extensions";
71
+ readonly address_error: "Something went wrong! Plase continue manually";
72
+ readonly address_search: "Type and search for places…";
73
+ readonly address_manual: "Fill in manually";
74
+ readonly back: "Back";
75
+ readonly search: "Search";
76
+ readonly unknown_error: "An error occurred";
77
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
78
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
79
+ readonly validation_phone: "Please enter a valid phone number";
80
+ readonly validation_country_code: "Please select a country code";
81
+ readonly validation_number: "Please enter a valid number";
82
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
83
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
84
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
85
+ readonly validation_file: "Please select a file";
86
+ readonly validation_file_ext: "Please only upload {{ext}} files";
87
+ readonly validation_file_max: {
88
+ readonly one: "Please only upload one file";
89
+ readonly other: "Please only upload up to {{count}} files";
90
+ };
91
+ } = {
92
+ readonly error_heading: "Something unexpected happened";
93
+ readonly undo: "Undo";
94
+ readonly send: "Send";
95
+ readonly skip: "Skip";
96
+ readonly skipped: "Skipped";
97
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
98
+ readonly complete_submission: "Complete submission";
99
+ readonly submission_completed: "Submission completed!";
100
+ readonly submission_failed: "Failed to submit";
101
+ readonly maximize: "Maximise";
102
+ readonly minimize: "Minimise";
103
+ readonly close_application: "Close application";
104
+ readonly applying_for: "Applying for “{{title}}”";
105
+ /** When an application is at an invalid state, the user will get this error. */
106
+ readonly invalid_state: "Invalid application state";
107
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
108
+ readonly upload_file: {
109
+ readonly one: "Select file to upload";
110
+ readonly other: "Select files to upload";
111
+ };
112
+ readonly file_max_size: "max {{size}}";
113
+ readonly file_extensions: "Accepted file extensions";
114
+ readonly address_error: "Something went wrong! Plase continue manually";
115
+ readonly address_search: "Type and search for places…";
116
+ readonly address_manual: "Fill in manually";
117
+ readonly back: "Back";
118
+ readonly search: "Search";
119
+ readonly unknown_error: "An error occurred";
120
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
121
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
122
+ readonly validation_phone: "Please enter a valid phone number";
123
+ readonly validation_country_code: "Please select a country code";
124
+ readonly validation_number: "Please enter a valid number";
125
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
126
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
127
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
128
+ readonly validation_file: "Please select a file";
129
+ readonly validation_file_ext: "Please only upload {{ext}} files";
130
+ readonly validation_file_max: {
131
+ readonly one: "Please only upload one file";
132
+ readonly other: "Please only upload up to {{count}} files";
133
+ };
134
+ }>() => {
135
+ t: import("i18n").TFn<T>;
136
+ locale: string | undefined;
137
+ }, createTFunction: <T extends {
138
+ readonly error_heading: "Something unexpected happened";
139
+ readonly undo: "Undo";
140
+ readonly send: "Send";
141
+ readonly skip: "Skip";
142
+ readonly skipped: "Skipped";
143
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
144
+ readonly complete_submission: "Complete submission";
145
+ readonly submission_completed: "Submission completed!";
146
+ readonly submission_failed: "Failed to submit";
147
+ readonly maximize: "Maximise";
148
+ readonly minimize: "Minimise";
149
+ readonly close_application: "Close application";
150
+ readonly applying_for: "Applying for “{{title}}”";
151
+ /** When an application is at an invalid state, the user will get this error. */
152
+ readonly invalid_state: "Invalid application state";
153
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
154
+ readonly upload_file: {
155
+ readonly one: "Select file to upload";
156
+ readonly other: "Select files to upload";
157
+ };
158
+ readonly file_max_size: "max {{size}}";
159
+ readonly file_extensions: "Accepted file extensions";
160
+ readonly address_error: "Something went wrong! Plase continue manually";
161
+ readonly address_search: "Type and search for places…";
162
+ readonly address_manual: "Fill in manually";
163
+ readonly back: "Back";
164
+ readonly search: "Search";
165
+ readonly unknown_error: "An error occurred";
166
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
167
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
168
+ readonly validation_phone: "Please enter a valid phone number";
169
+ readonly validation_country_code: "Please select a country code";
170
+ readonly validation_number: "Please enter a valid number";
171
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
172
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
173
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
174
+ readonly validation_file: "Please select a file";
175
+ readonly validation_file_ext: "Please only upload {{ext}} files";
176
+ readonly validation_file_max: {
177
+ readonly one: "Please only upload one file";
178
+ readonly other: "Please only upload up to {{count}} files";
179
+ };
180
+ } = {
181
+ readonly error_heading: "Something unexpected happened";
182
+ readonly undo: "Undo";
183
+ readonly send: "Send";
184
+ readonly skip: "Skip";
185
+ readonly skipped: "Skipped";
186
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
187
+ readonly complete_submission: "Complete submission";
188
+ readonly submission_completed: "Submission completed!";
189
+ readonly submission_failed: "Failed to submit";
190
+ readonly maximize: "Maximise";
191
+ readonly minimize: "Minimise";
192
+ readonly close_application: "Close application";
193
+ readonly applying_for: "Applying for “{{title}}”";
194
+ /** When an application is at an invalid state, the user will get this error. */
195
+ readonly invalid_state: "Invalid application state";
196
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
197
+ readonly upload_file: {
198
+ readonly one: "Select file to upload";
199
+ readonly other: "Select files to upload";
200
+ };
201
+ readonly file_max_size: "max {{size}}";
202
+ readonly file_extensions: "Accepted file extensions";
203
+ readonly address_error: "Something went wrong! Plase continue manually";
204
+ readonly address_search: "Type and search for places…";
205
+ readonly address_manual: "Fill in manually";
206
+ readonly back: "Back";
207
+ readonly search: "Search";
208
+ readonly unknown_error: "An error occurred";
209
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
210
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
211
+ readonly validation_phone: "Please enter a valid phone number";
212
+ readonly validation_country_code: "Please select a country code";
213
+ readonly validation_number: "Please enter a valid number";
214
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
215
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
216
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
217
+ readonly validation_file: "Please select a file";
218
+ readonly validation_file_ext: "Please only upload {{ext}} files";
219
+ readonly validation_file_max: {
220
+ readonly one: "Please only upload one file";
221
+ readonly other: "Please only upload up to {{count}} files";
222
+ };
223
+ }>(options: {
224
+ overrides: Partial<import("i18n").TranslationDict<{
225
+ readonly error_heading: "Something unexpected happened";
226
+ readonly undo: "Undo";
227
+ readonly send: "Send";
228
+ readonly skip: "Skip";
229
+ readonly skipped: "Skipped";
230
+ readonly submission_redirect_message: "Almost there! Please complete your submission here:";
231
+ readonly complete_submission: "Complete submission";
232
+ readonly submission_completed: "Submission completed!";
233
+ readonly submission_failed: "Failed to submit";
234
+ readonly maximize: "Maximise";
235
+ readonly minimize: "Minimise";
236
+ readonly close_application: "Close application";
237
+ readonly applying_for: "Applying for “{{title}}”";
238
+ /** When an application is at an invalid state, the user will get this error. */
239
+ readonly invalid_state: "Invalid application state";
240
+ readonly redirect_url_error: "Couldn’t get the redirect URL.";
241
+ readonly upload_file: {
242
+ readonly one: "Select file to upload";
243
+ readonly other: "Select files to upload";
244
+ };
245
+ readonly file_max_size: "max {{size}}";
246
+ readonly file_extensions: "Accepted file extensions";
247
+ readonly address_error: "Something went wrong! Plase continue manually";
248
+ readonly address_search: "Type and search for places…";
249
+ readonly address_manual: "Fill in manually";
250
+ readonly back: "Back";
251
+ readonly search: "Search";
252
+ readonly unknown_error: "An error occurred";
253
+ readonly validation_max_chars: "Please enter no more than {{count}} characters";
254
+ readonly validation_min_chars: "Please enter {{count}} or more characters";
255
+ readonly validation_phone: "Please enter a valid phone number";
256
+ readonly validation_country_code: "Please select a country code";
257
+ readonly validation_number: "Please enter a valid number";
258
+ readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
259
+ readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
260
+ readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
261
+ readonly validation_file: "Please select a file";
262
+ readonly validation_file_ext: "Please only upload {{ext}} files";
263
+ readonly validation_file_max: {
264
+ readonly one: "Please only upload one file";
265
+ readonly other: "Please only upload up to {{count}} files";
266
+ };
267
+ }>>;
268
+ locale: string | undefined;
269
+ }) => import("i18n").TFn<T>;
270
+ export type TFunction = ReturnType<typeof useTranslation>['t'];
271
+ export type ChatbotTranslationTerms = Parameters<typeof TranslationProvider>[0]['terms'];