@botpress/webchat 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/dist/index.d.ts +56 -28
- package/dist/index.js +8943 -9313
- package/dist/index.umd.cjs +146 -156
- package/dist/style.css +1 -1
- package/package.json +16 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@3.
|
|
2
|
+
> @botpress/webchat@3.2.0 build /home/runner/work/genisys/genisys/packages/webchat-components
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v5.4.8 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
|
-
[32m✓[39m
|
|
7
|
+
[32m✓[39m 3180 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
|
|
10
10
|
[vite:dts] Start generate declaration files...
|
|
11
11
|
computing gzip size...
|
|
12
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m
|
|
13
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
12
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.29 kB[22m[1m[22m[2m │ gzip: 8.69 kB[22m
|
|
13
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m771.34 kB[39m[22m[2m │ gzip: 212.14 kB[22m
|
|
14
14
|
[vite:dts] Start rollup declaration files...
|
|
15
15
|
Analysis will use the bundled TypeScript version 5.4.2
|
|
16
16
|
*** The target project appears to use TypeScript 5.6.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
17
|
-
[vite:dts] Declaration files built in
|
|
17
|
+
[vite:dts] Declaration files built in 21868ms.
|
|
18
18
|
|
|
19
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m
|
|
20
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[
|
|
21
|
-
[32m✓ built in 29.
|
|
19
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.29 kB[22m[1m[22m[2m │ gzip: 8.69 kB[22m
|
|
20
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m516.29 kB[39m[22m[2m │ gzip: 173.38 kB[22m
|
|
21
|
+
[32m✓ built in 29.78s[39m
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,16 @@ import { ClassAttributes } from 'react';
|
|
|
3
3
|
import { Client } from '@botpress/webchat-client';
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
import { ComponentPropsWithRef } from 'react';
|
|
6
|
+
import { LatestWebchatConfig as Configuration } from '@bpinternal/shared';
|
|
6
7
|
import { CSSProperties } from 'react';
|
|
7
8
|
import * as Dialog from '@radix-ui/react-dialog';
|
|
8
9
|
import { EventEmitter } from '@bpinternal/shared';
|
|
9
10
|
import type { FC } from 'react';
|
|
10
11
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
12
|
import { HTMLAttributes } from 'react';
|
|
13
|
+
import { IntegrationError } from '@botpress/webchat-client';
|
|
12
14
|
import { JSX as JSX_2 } from 'react';
|
|
13
15
|
import { JSX as JSX_3 } from 'react/jsx-runtime';
|
|
14
|
-
import { LatestWebchatConfig } from '@bpinternal/shared';
|
|
15
16
|
import { LatestWebchatTheme } from '@bpinternal/shared';
|
|
16
17
|
import { MemoExoticComponent } from 'react';
|
|
17
18
|
import { Message as Message_2 } from '@botpress/webchat-client';
|
|
@@ -92,7 +93,7 @@ declare type BlockProps<T extends GenericBlock['type']> = {
|
|
|
92
93
|
renderers?: Partial<Renderers>;
|
|
93
94
|
};
|
|
94
95
|
|
|
95
|
-
export declare const BOT_IS_BLOCKED = "This bot
|
|
96
|
+
export declare const BOT_IS_BLOCKED = "This bot has temporarily paused.\nPlease check back later.";
|
|
96
97
|
|
|
97
98
|
declare type BoundWebchatClientStore = ReturnType<typeof createWebchatClientStore>;
|
|
98
99
|
|
|
@@ -140,6 +141,10 @@ export declare type ColumnOf<T extends GenericBlock> = Omit<ColumnBlock, 'blocks
|
|
|
140
141
|
blocks: T[];
|
|
141
142
|
};
|
|
142
143
|
|
|
144
|
+
export declare const commonApiErrorMap: {
|
|
145
|
+
[key in 'MethodNotFound' | 'QuotaExceeded' | 'Forbidden']: WebchatError;
|
|
146
|
+
};
|
|
147
|
+
|
|
143
148
|
export declare type CommonBlockProps = Pick<RichBlockMessage, 'direction' | 'sender' | 'timestamp' | 'feedback'> & {
|
|
144
149
|
messageId: string;
|
|
145
150
|
metadata?: Record<string, any>;
|
|
@@ -157,7 +162,7 @@ export declare const Composer: MemoExoticComponent<ForwardRefExoticComponent<Omi
|
|
|
157
162
|
|
|
158
163
|
export declare const CONFIG_ACCESS_DENIED = "Access denied to configuration file. Please check your credentials or your configuration URL and try again.";
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
export { Configuration }
|
|
161
166
|
|
|
162
167
|
export declare const Container: {
|
|
163
168
|
({ children, className, connected, uploadFile, allowFileUpload, ...props }: Props_4): JSX_3.Element;
|
|
@@ -205,9 +210,14 @@ export declare function enrichMessage(messages: BlockMessage[], participants: Us
|
|
|
205
210
|
|
|
206
211
|
declare type ErrorProps = {
|
|
207
212
|
error: WebchatError;
|
|
213
|
+
restartConversation?: () => void;
|
|
208
214
|
};
|
|
209
215
|
|
|
210
|
-
export declare function ErrorState({ error }: ErrorProps): JSX_3.Element;
|
|
216
|
+
export declare function ErrorState({ error, restartConversation }: ErrorProps): JSX_3.Element;
|
|
217
|
+
|
|
218
|
+
declare type EventError = Error & {
|
|
219
|
+
type: 'error';
|
|
220
|
+
};
|
|
211
221
|
|
|
212
222
|
declare type Events = WebchatEvents & {
|
|
213
223
|
'*': AnyEvent;
|
|
@@ -239,9 +249,9 @@ export declare type GenericBlock = AudioBlock | BubbleBlock | ButtonBlock | Caro
|
|
|
239
249
|
|
|
240
250
|
export declare const getUseWebchatClientStore: typeof WebchatClientStores.getInstance;
|
|
241
251
|
|
|
242
|
-
export declare const handleIntegrationError: (
|
|
252
|
+
export declare const handleIntegrationError: (thrown: unknown) => WebchatError;
|
|
243
253
|
|
|
244
|
-
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, ...props }: HeaderProps) => JSX_3.Element;
|
|
254
|
+
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, ...props }: HeaderProps) => JSX_3.Element;
|
|
245
255
|
|
|
246
256
|
declare type HeaderProps = {
|
|
247
257
|
defaultOpen?: boolean;
|
|
@@ -250,13 +260,7 @@ declare type HeaderProps = {
|
|
|
250
260
|
onOpenChange?(open: boolean): void;
|
|
251
261
|
restartConversation?: () => void;
|
|
252
262
|
closeWindow?: () => void;
|
|
253
|
-
configuration: Pick<
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export declare type HookResult<T> = {
|
|
257
|
-
data: Simplify<T> | undefined;
|
|
258
|
-
isLoading: boolean;
|
|
259
|
-
error: WebchatError | undefined;
|
|
263
|
+
configuration: Pick<Configuration, 'email' | 'phone' | 'privacyPolicy' | 'website' | 'termsOfService' | 'botAvatar' | 'botDescription' | 'botName'>;
|
|
260
264
|
};
|
|
261
265
|
|
|
262
266
|
export declare type ImageBlock = {
|
|
@@ -275,18 +279,28 @@ export declare function integrationMessageToBlockMessage(message: IntegrationMes
|
|
|
275
279
|
|
|
276
280
|
declare type IntegrationMessageTypes = IntegrationMessage['payload']['type'];
|
|
277
281
|
|
|
278
|
-
export declare const INVALID_API_URL = "Invalid API URL
|
|
282
|
+
export declare const INVALID_API_URL = "Invalid API URL.\nPlease use a valid API URL.";
|
|
283
|
+
|
|
284
|
+
export declare const INVALID_BOTPRESS_URL = "Invalid URL.\nPlease make sure your client ID and API URL are valid";
|
|
279
285
|
|
|
280
|
-
export declare const
|
|
286
|
+
export declare const INVALID_CLIENT_ID = "Invalid Client ID.\nPlease use a valid Botpress Client ID.";
|
|
281
287
|
|
|
282
|
-
export declare const
|
|
288
|
+
export declare const INVALID_CONFIG_URL = "Invalid config URL.\nPlease make sure your config URL is valid";
|
|
283
289
|
|
|
284
|
-
export declare const
|
|
290
|
+
export declare const INVALID_CONFIGURATION = "Invalid webchat configuration.\nPlease make sure your config file is valid";
|
|
285
291
|
|
|
286
|
-
export declare const
|
|
292
|
+
export declare const INVALID_MESSAGE_CONTENT_TYPE = "Unable to process the message.\nPlease start a new conversation.";
|
|
293
|
+
|
|
294
|
+
export declare function isCommonApiErrorType(type: string): type is keyof typeof commonApiErrorMap;
|
|
295
|
+
|
|
296
|
+
export declare function isEventError(thrown: unknown): thrown is EventError;
|
|
287
297
|
|
|
288
298
|
export declare const isFileType: (type: string) => type is FileType;
|
|
289
299
|
|
|
300
|
+
export declare function isIntegrationError(thrown: unknown): thrown is IntegrationError;
|
|
301
|
+
|
|
302
|
+
export declare function isWebhookHandlerErrorType(type: string): type is keyof typeof webhookHandlerErrorMap;
|
|
303
|
+
|
|
290
304
|
export declare type LocationBlock = {
|
|
291
305
|
type: 'location';
|
|
292
306
|
latitude: number;
|
|
@@ -365,7 +379,7 @@ export declare const ModalProvider: ({ children }: {
|
|
|
365
379
|
|
|
366
380
|
export declare const NETWORK_ERROR = "Please check your internet connection and refresh the page.";
|
|
367
381
|
|
|
368
|
-
export declare const NOT_A_PARTICIPANT = "
|
|
382
|
+
export declare const NOT_A_PARTICIPANT = "Something went wrong. To fix it, please clear your browser's local and session storage and then refresh the page";
|
|
369
383
|
|
|
370
384
|
export declare type Options = {
|
|
371
385
|
timeout?: number;
|
|
@@ -374,7 +388,7 @@ export declare type Options = {
|
|
|
374
388
|
export declare type Props = {
|
|
375
389
|
className?: string;
|
|
376
390
|
renderers?: Partial<Renderers>;
|
|
377
|
-
configuration:
|
|
391
|
+
configuration: Configuration;
|
|
378
392
|
messages: BlockMessage[];
|
|
379
393
|
participants: User[];
|
|
380
394
|
connected?: boolean;
|
|
@@ -422,7 +436,7 @@ declare type Props_3 = ComponentProps<'div'> & {
|
|
|
422
436
|
name: string;
|
|
423
437
|
type: FileType;
|
|
424
438
|
}>;
|
|
425
|
-
} & Pick<
|
|
439
|
+
} & Pick<Configuration, 'composerPlaceholder' | 'footer'>;
|
|
426
440
|
|
|
427
441
|
declare type Props_4 = ComponentProps<'div'> & {
|
|
428
442
|
connected?: boolean;
|
|
@@ -444,12 +458,12 @@ declare type Props_6 = {
|
|
|
444
458
|
storageKey?: string;
|
|
445
459
|
user?: UserCredentials;
|
|
446
460
|
conversationId?: string;
|
|
447
|
-
configuration?:
|
|
461
|
+
configuration?: Configuration;
|
|
448
462
|
} & Pick<ComponentProps<typeof Chat>, 'allowFileUpload' | 'renderers'> & ComponentProps<'div'>;
|
|
449
463
|
|
|
450
464
|
declare type Props_7 = Partial<LatestWebchatTheme>;
|
|
451
465
|
|
|
452
|
-
export declare const QUOTA_EXCEEDED = "This bot has temporarily paused
|
|
466
|
+
export declare const QUOTA_EXCEEDED = "This bot has temporarily paused.\nPlease check back later.";
|
|
453
467
|
|
|
454
468
|
export declare type Renderers = {
|
|
455
469
|
[T in GenericBlock['type']]: FC<BlockObjects[T]>;
|
|
@@ -491,9 +505,7 @@ declare type ScopedClient = {
|
|
|
491
505
|
updateUser: (user: UserProfile) => Promise<User>;
|
|
492
506
|
};
|
|
493
507
|
|
|
494
|
-
export declare
|
|
495
|
-
[KeyType in keyof T]: T[KeyType];
|
|
496
|
-
} & {};
|
|
508
|
+
export declare const SSE_DISCONNECTED_ERROR = "You've been disconnected from the conversation.\nPlease refresh the page.";
|
|
497
509
|
|
|
498
510
|
declare type StorageLocation = 'sessionStorage' | 'localStorage';
|
|
499
511
|
|
|
@@ -502,6 +514,10 @@ export declare type StyleOptions = {
|
|
|
502
514
|
style?: CSSProperties;
|
|
503
515
|
};
|
|
504
516
|
|
|
517
|
+
/**
|
|
518
|
+
* StylesheetProvider component that manages theme styles and font loading
|
|
519
|
+
* Handles both default fonts and custom Google Fonts
|
|
520
|
+
*/
|
|
505
521
|
export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant }: Props_7) => JSX_3.Element;
|
|
506
522
|
|
|
507
523
|
export declare type TextBlock = {
|
|
@@ -868,6 +884,9 @@ export declare const webchatClasses: {
|
|
|
868
884
|
readonly image: {
|
|
869
885
|
readonly className: "bpMessageBlocksTextImage";
|
|
870
886
|
};
|
|
887
|
+
readonly imageError: {
|
|
888
|
+
readonly className: "bpMessageBlocksTextImageError";
|
|
889
|
+
};
|
|
871
890
|
readonly horizontalRule: {
|
|
872
891
|
readonly className: "bpMessageBlocksTextHorizontalRule";
|
|
873
892
|
};
|
|
@@ -1005,6 +1024,9 @@ export declare const webchatClasses: {
|
|
|
1005
1024
|
readonly container: {
|
|
1006
1025
|
readonly className: "bpReset bpErrorContainer";
|
|
1007
1026
|
};
|
|
1027
|
+
readonly id: {
|
|
1028
|
+
readonly className: "bpErrorId";
|
|
1029
|
+
};
|
|
1008
1030
|
readonly header: {
|
|
1009
1031
|
readonly className: "bpErrorHeader";
|
|
1010
1032
|
};
|
|
@@ -1045,7 +1067,7 @@ declare class WebchatClientStores {
|
|
|
1045
1067
|
static getInstance(name?: string, storageLocation?: StorageLocation): BoundWebchatClientStore;
|
|
1046
1068
|
}
|
|
1047
1069
|
|
|
1048
|
-
export declare type WebchatError = {
|
|
1070
|
+
export declare type WebchatError = ({
|
|
1049
1071
|
type: 'configuration';
|
|
1050
1072
|
message: typeof MISSING_CLIENT_ID | typeof MISSING_API_URL | typeof MISSING_BOT_ID | typeof INVALID_CLIENT_ID | typeof INVALID_CONFIGURATION | typeof MISSING_CONFIG_URL;
|
|
1051
1073
|
} | {
|
|
@@ -1053,10 +1075,12 @@ export declare type WebchatError = {
|
|
|
1053
1075
|
message: typeof BOT_IS_BLOCKED | typeof QUOTA_EXCEEDED | typeof NOT_A_PARTICIPANT;
|
|
1054
1076
|
} | {
|
|
1055
1077
|
type: 'network';
|
|
1056
|
-
message: typeof NETWORK_ERROR;
|
|
1078
|
+
message: typeof NETWORK_ERROR | typeof SSE_DISCONNECTED_ERROR;
|
|
1057
1079
|
} | {
|
|
1058
1080
|
type: string;
|
|
1059
1081
|
message: string;
|
|
1082
|
+
}) & {
|
|
1083
|
+
id?: string;
|
|
1060
1084
|
};
|
|
1061
1085
|
|
|
1062
1086
|
export declare type WebchatEvents = {
|
|
@@ -1081,4 +1105,8 @@ declare type WebchatStore = {
|
|
|
1081
1105
|
eventEmitter: EventEmitter<Events_2>;
|
|
1082
1106
|
};
|
|
1083
1107
|
|
|
1108
|
+
export declare const webhookHandlerErrorMap: {
|
|
1109
|
+
[key in 'ResourceNotFound' | 'Forbidden']: WebchatError;
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1084
1112
|
export { }
|