@bootdesk/js-web-adapter-react 0.3.3 → 0.3.5
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/README.md +17 -0
- package/dist/index.cjs +2299 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -6
- package/dist/index.d.ts +47 -6
- package/dist/index.js +2292 -243
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Component, ReactNode } from 'react';
|
|
2
|
-
import { WebChatClient, Message, Card, CustomCard, WebChatClientConfig, BroadcastClient
|
|
2
|
+
import { WebChatClient, PushConfig, ReconfigureConfig, PushSubscriptionStatus, Message, Card, CustomCard, WebChatClientConfig, BroadcastClient } from '@bootdesk/js-web-adapter-core';
|
|
3
3
|
export { Card, CustomCard, LaravelEchoBroadcastClient, Message, PHPCard, PushConfig, PushEventData, PushManager, PushSubscriptionStatus, PusherBroadcastClient, User, WebChatClient, createPushSubscriptionHandlers } from '@bootdesk/js-web-adapter-core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -41,8 +41,16 @@ type UploadConfig = AttachmentUploadConfig | SimpleUploadConfig;
|
|
|
41
41
|
|
|
42
42
|
type DisplayMode = "floating" | "fullscreen" | "embedded";
|
|
43
43
|
type ThemeMode = "light" | "dark" | "auto";
|
|
44
|
+
|
|
45
|
+
interface PreEntryHelpers {
|
|
46
|
+
start: (config?: ReconfigureConfig) => void;
|
|
47
|
+
}
|
|
48
|
+
interface PreEntryConfig {
|
|
49
|
+
render: (helpers: PreEntryHelpers) => React.ReactNode;
|
|
50
|
+
}
|
|
44
51
|
interface ChatWidgetProps {
|
|
45
52
|
client: WebChatClient;
|
|
53
|
+
locale?: string;
|
|
46
54
|
initialMode?: DisplayMode;
|
|
47
55
|
theme?: ThemeMode;
|
|
48
56
|
onThemeChange?: (theme: ThemeMode) => void;
|
|
@@ -74,8 +82,19 @@ interface ChatWidgetProps {
|
|
|
74
82
|
accept?: string;
|
|
75
83
|
maxFileSize?: number;
|
|
76
84
|
renderPushPrompt?: () => React.ReactNode;
|
|
85
|
+
pushConfig?: {
|
|
86
|
+
getVapidPublicKey: () => Promise<string>;
|
|
87
|
+
onSubscribe: PushConfig["onSubscribe"];
|
|
88
|
+
onUnsubscribe: PushConfig["onUnsubscribe"];
|
|
89
|
+
serviceWorkerUrl?: string;
|
|
90
|
+
serviceWorkerScope?: string;
|
|
91
|
+
serviceWorkerType?: "classic" | "module";
|
|
92
|
+
notificationOptions?: PushConfig["notificationOptions"];
|
|
93
|
+
};
|
|
94
|
+
preEntry?: PreEntryConfig;
|
|
95
|
+
onChatStart?: (config?: ReconfigureConfig) => void;
|
|
77
96
|
}
|
|
78
|
-
declare function ChatWidget({ client, initialMode, theme: themeProp, onThemeChange, position, className, showClose, showFullscreenToggle, title, placeholder, onOpen, onClose, embedded, floatingButton, enableAttachments, uploadConfig, accept, maxFileSize, renderPushPrompt, }: ChatWidgetProps): React.JSX.Element;
|
|
97
|
+
declare function ChatWidget({ client, locale: localeProp, initialMode, theme: themeProp, onThemeChange, position, className, showClose, showFullscreenToggle, title, placeholder, onOpen, onClose, embedded, floatingButton, enableAttachments, uploadConfig, accept, maxFileSize, renderPushPrompt, preEntry, onChatStart, pushConfig, }: ChatWidgetProps): React.JSX.Element;
|
|
79
98
|
|
|
80
99
|
interface HeaderProps {
|
|
81
100
|
title?: string;
|
|
@@ -87,8 +106,10 @@ interface HeaderProps {
|
|
|
87
106
|
className?: string;
|
|
88
107
|
theme?: string;
|
|
89
108
|
onThemeChange?: (theme: "light" | "dark" | "auto") => void;
|
|
109
|
+
pushStatus?: PushSubscriptionStatus;
|
|
110
|
+
onPushToggle?: () => void;
|
|
90
111
|
}
|
|
91
|
-
declare function Header({ title, onClose, onToggleFullscreen, isFullscreen, showConnectionStatus, isConnected, className, theme, onThemeChange, }: HeaderProps): React.JSX.Element;
|
|
112
|
+
declare function Header({ title, onClose, onToggleFullscreen, isFullscreen, showConnectionStatus, isConnected, className, theme, onThemeChange, pushStatus, onPushToggle, }: HeaderProps): React.JSX.Element;
|
|
92
113
|
|
|
93
114
|
interface MessageListProps {
|
|
94
115
|
messages: Message[];
|
|
@@ -264,7 +285,7 @@ interface AttachmentListProps {
|
|
|
264
285
|
}
|
|
265
286
|
declare function AttachmentList({ attachments, onRemove, className, }: AttachmentListProps): React.JSX.Element;
|
|
266
287
|
|
|
267
|
-
declare function useAttachmentUpload(uploadConfig
|
|
288
|
+
declare function useAttachmentUpload(uploadConfig?: UploadConfig): {
|
|
268
289
|
attachments: PendingAttachment[];
|
|
269
290
|
addFiles: (files: FileList | File[]) => void;
|
|
270
291
|
removeAttachment: (id: string) => void;
|
|
@@ -276,6 +297,7 @@ declare function useAttachmentUpload(uploadConfig: UploadConfig): {
|
|
|
276
297
|
};
|
|
277
298
|
|
|
278
299
|
interface LocaleStrings {
|
|
300
|
+
direction: "ltr" | "rtl";
|
|
279
301
|
chatWidget: {
|
|
280
302
|
title: string;
|
|
281
303
|
placeholder: string;
|
|
@@ -317,6 +339,20 @@ interface LocaleStrings {
|
|
|
317
339
|
openChat: string;
|
|
318
340
|
closeChat: string;
|
|
319
341
|
};
|
|
342
|
+
push: {
|
|
343
|
+
title: string;
|
|
344
|
+
description: string;
|
|
345
|
+
enable: string;
|
|
346
|
+
disable: string;
|
|
347
|
+
denied: string;
|
|
348
|
+
unsupported: string;
|
|
349
|
+
subscribing: string;
|
|
350
|
+
notifications: string;
|
|
351
|
+
};
|
|
352
|
+
notification: {
|
|
353
|
+
openChat: string;
|
|
354
|
+
dismiss: string;
|
|
355
|
+
};
|
|
320
356
|
common: {
|
|
321
357
|
loading: string;
|
|
322
358
|
error: string;
|
|
@@ -325,7 +361,7 @@ interface LocaleStrings {
|
|
|
325
361
|
download: string;
|
|
326
362
|
};
|
|
327
363
|
}
|
|
328
|
-
type SupportedLocale = "en" | "en-US" | "en-GB" | "pt" | "pt-BR" | "pt-PT" | "es";
|
|
364
|
+
type SupportedLocale = "en" | "en-US" | "en-GB" | "pt" | "pt-BR" | "pt-PT" | "es" | "da" | "sv" | "nb" | "fi" | "fr" | "de" | "it" | "nl" | "pl" | "cs" | "ro" | "hu" | "uk" | "ru" | "el" | "tr" | "et" | "ja" | "zh-CN" | "zh-TW" | "ko" | "vi" | "th" | "id" | "hi" | "ar";
|
|
329
365
|
type PartialLocaleStrings = Partial<{
|
|
330
366
|
[K in keyof LocaleStrings]: Partial<LocaleStrings[K]>;
|
|
331
367
|
}> & {
|
|
@@ -336,6 +372,8 @@ type PartialLocaleStrings = Partial<{
|
|
|
336
372
|
dropzone?: Partial<LocaleStrings["inputArea"]["dropzone"]>;
|
|
337
373
|
};
|
|
338
374
|
messageList?: Partial<LocaleStrings["messageList"]>;
|
|
375
|
+
push?: Partial<LocaleStrings["push"]>;
|
|
376
|
+
notification?: Partial<LocaleStrings["notification"]>;
|
|
339
377
|
common?: Partial<LocaleStrings["common"]>;
|
|
340
378
|
};
|
|
341
379
|
interface LocaleConfig {
|
|
@@ -345,6 +383,7 @@ interface LocaleConfig {
|
|
|
345
383
|
|
|
346
384
|
interface LocaleContextValue {
|
|
347
385
|
locale: string;
|
|
386
|
+
dir: "ltr" | "rtl";
|
|
348
387
|
strings: LocaleStrings;
|
|
349
388
|
t: (path: string) => string;
|
|
350
389
|
}
|
|
@@ -382,6 +421,8 @@ interface UsePushNotificationsOptions {
|
|
|
382
421
|
onSubscribe: PushConfig["onSubscribe"];
|
|
383
422
|
onUnsubscribe: PushConfig["onUnsubscribe"];
|
|
384
423
|
serviceWorkerUrl?: string;
|
|
424
|
+
serviceWorkerScope?: string;
|
|
425
|
+
serviceWorkerType?: "classic" | "module";
|
|
385
426
|
notificationOptions?: PushConfig["notificationOptions"];
|
|
386
427
|
}
|
|
387
428
|
declare function usePushNotifications(options: UsePushNotificationsOptions): {
|
|
@@ -392,4 +433,4 @@ declare function usePushNotifications(options: UsePushNotificationsOptions): {
|
|
|
392
433
|
unsubscribe: () => Promise<void>;
|
|
393
434
|
};
|
|
394
435
|
|
|
395
|
-
export { AttachmentList, type AttachmentUploadConfig, CardProvider, CardRenderer, type CardRendererProps, type CardRenderer$1 as CardRendererType, ChatProvider, ChatWidget, type ChatWidgetProps, DefaultCard, Dropzone, ErrorBoundary, FileCardComponent, FloatingButton, Header, ImageCardComponent, InputArea, type LocaleConfig, LocaleProvider, type LocaleStrings, MarkdownRenderer, MessageContent, MessageList, type PartialLocaleStrings, type PendingAttachment, PushPermissionPrompt, PushToggle, type SignedUploadUrl, type SimpleUploadConfig, type SupportedLocale, TypingIndicator, type UploadConfig, getAvailableLocales, registerLocale, renderMarkdown, useAttachmentUpload, useCardRegistry, useCardRegistry as useCardRendererRegistry, useChatClient, useChatContext, useLocale, useMessages, usePushNotifications, useStreaming, useTyping };
|
|
436
|
+
export { AttachmentList, type AttachmentUploadConfig, CardProvider, CardRenderer, type CardRendererProps, type CardRenderer$1 as CardRendererType, ChatProvider, ChatWidget, type ChatWidgetProps, DefaultCard, Dropzone, ErrorBoundary, FileCardComponent, FloatingButton, Header, ImageCardComponent, InputArea, type LocaleConfig, LocaleProvider, type LocaleStrings, MarkdownRenderer, MessageContent, MessageList, type PartialLocaleStrings, type PendingAttachment, type PreEntryConfig, type PreEntryHelpers, PushPermissionPrompt, PushToggle, type SignedUploadUrl, type SimpleUploadConfig, type SupportedLocale, TypingIndicator, type UploadConfig, getAvailableLocales, registerLocale, renderMarkdown, useAttachmentUpload, useCardRegistry, useCardRegistry as useCardRendererRegistry, useChatClient, useChatContext, useLocale, useMessages, usePushNotifications, useStreaming, useTyping };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Component, ReactNode } from 'react';
|
|
2
|
-
import { WebChatClient, Message, Card, CustomCard, WebChatClientConfig, BroadcastClient
|
|
2
|
+
import { WebChatClient, PushConfig, ReconfigureConfig, PushSubscriptionStatus, Message, Card, CustomCard, WebChatClientConfig, BroadcastClient } from '@bootdesk/js-web-adapter-core';
|
|
3
3
|
export { Card, CustomCard, LaravelEchoBroadcastClient, Message, PHPCard, PushConfig, PushEventData, PushManager, PushSubscriptionStatus, PusherBroadcastClient, User, WebChatClient, createPushSubscriptionHandlers } from '@bootdesk/js-web-adapter-core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -41,8 +41,16 @@ type UploadConfig = AttachmentUploadConfig | SimpleUploadConfig;
|
|
|
41
41
|
|
|
42
42
|
type DisplayMode = "floating" | "fullscreen" | "embedded";
|
|
43
43
|
type ThemeMode = "light" | "dark" | "auto";
|
|
44
|
+
|
|
45
|
+
interface PreEntryHelpers {
|
|
46
|
+
start: (config?: ReconfigureConfig) => void;
|
|
47
|
+
}
|
|
48
|
+
interface PreEntryConfig {
|
|
49
|
+
render: (helpers: PreEntryHelpers) => React.ReactNode;
|
|
50
|
+
}
|
|
44
51
|
interface ChatWidgetProps {
|
|
45
52
|
client: WebChatClient;
|
|
53
|
+
locale?: string;
|
|
46
54
|
initialMode?: DisplayMode;
|
|
47
55
|
theme?: ThemeMode;
|
|
48
56
|
onThemeChange?: (theme: ThemeMode) => void;
|
|
@@ -74,8 +82,19 @@ interface ChatWidgetProps {
|
|
|
74
82
|
accept?: string;
|
|
75
83
|
maxFileSize?: number;
|
|
76
84
|
renderPushPrompt?: () => React.ReactNode;
|
|
85
|
+
pushConfig?: {
|
|
86
|
+
getVapidPublicKey: () => Promise<string>;
|
|
87
|
+
onSubscribe: PushConfig["onSubscribe"];
|
|
88
|
+
onUnsubscribe: PushConfig["onUnsubscribe"];
|
|
89
|
+
serviceWorkerUrl?: string;
|
|
90
|
+
serviceWorkerScope?: string;
|
|
91
|
+
serviceWorkerType?: "classic" | "module";
|
|
92
|
+
notificationOptions?: PushConfig["notificationOptions"];
|
|
93
|
+
};
|
|
94
|
+
preEntry?: PreEntryConfig;
|
|
95
|
+
onChatStart?: (config?: ReconfigureConfig) => void;
|
|
77
96
|
}
|
|
78
|
-
declare function ChatWidget({ client, initialMode, theme: themeProp, onThemeChange, position, className, showClose, showFullscreenToggle, title, placeholder, onOpen, onClose, embedded, floatingButton, enableAttachments, uploadConfig, accept, maxFileSize, renderPushPrompt, }: ChatWidgetProps): React.JSX.Element;
|
|
97
|
+
declare function ChatWidget({ client, locale: localeProp, initialMode, theme: themeProp, onThemeChange, position, className, showClose, showFullscreenToggle, title, placeholder, onOpen, onClose, embedded, floatingButton, enableAttachments, uploadConfig, accept, maxFileSize, renderPushPrompt, preEntry, onChatStart, pushConfig, }: ChatWidgetProps): React.JSX.Element;
|
|
79
98
|
|
|
80
99
|
interface HeaderProps {
|
|
81
100
|
title?: string;
|
|
@@ -87,8 +106,10 @@ interface HeaderProps {
|
|
|
87
106
|
className?: string;
|
|
88
107
|
theme?: string;
|
|
89
108
|
onThemeChange?: (theme: "light" | "dark" | "auto") => void;
|
|
109
|
+
pushStatus?: PushSubscriptionStatus;
|
|
110
|
+
onPushToggle?: () => void;
|
|
90
111
|
}
|
|
91
|
-
declare function Header({ title, onClose, onToggleFullscreen, isFullscreen, showConnectionStatus, isConnected, className, theme, onThemeChange, }: HeaderProps): React.JSX.Element;
|
|
112
|
+
declare function Header({ title, onClose, onToggleFullscreen, isFullscreen, showConnectionStatus, isConnected, className, theme, onThemeChange, pushStatus, onPushToggle, }: HeaderProps): React.JSX.Element;
|
|
92
113
|
|
|
93
114
|
interface MessageListProps {
|
|
94
115
|
messages: Message[];
|
|
@@ -264,7 +285,7 @@ interface AttachmentListProps {
|
|
|
264
285
|
}
|
|
265
286
|
declare function AttachmentList({ attachments, onRemove, className, }: AttachmentListProps): React.JSX.Element;
|
|
266
287
|
|
|
267
|
-
declare function useAttachmentUpload(uploadConfig
|
|
288
|
+
declare function useAttachmentUpload(uploadConfig?: UploadConfig): {
|
|
268
289
|
attachments: PendingAttachment[];
|
|
269
290
|
addFiles: (files: FileList | File[]) => void;
|
|
270
291
|
removeAttachment: (id: string) => void;
|
|
@@ -276,6 +297,7 @@ declare function useAttachmentUpload(uploadConfig: UploadConfig): {
|
|
|
276
297
|
};
|
|
277
298
|
|
|
278
299
|
interface LocaleStrings {
|
|
300
|
+
direction: "ltr" | "rtl";
|
|
279
301
|
chatWidget: {
|
|
280
302
|
title: string;
|
|
281
303
|
placeholder: string;
|
|
@@ -317,6 +339,20 @@ interface LocaleStrings {
|
|
|
317
339
|
openChat: string;
|
|
318
340
|
closeChat: string;
|
|
319
341
|
};
|
|
342
|
+
push: {
|
|
343
|
+
title: string;
|
|
344
|
+
description: string;
|
|
345
|
+
enable: string;
|
|
346
|
+
disable: string;
|
|
347
|
+
denied: string;
|
|
348
|
+
unsupported: string;
|
|
349
|
+
subscribing: string;
|
|
350
|
+
notifications: string;
|
|
351
|
+
};
|
|
352
|
+
notification: {
|
|
353
|
+
openChat: string;
|
|
354
|
+
dismiss: string;
|
|
355
|
+
};
|
|
320
356
|
common: {
|
|
321
357
|
loading: string;
|
|
322
358
|
error: string;
|
|
@@ -325,7 +361,7 @@ interface LocaleStrings {
|
|
|
325
361
|
download: string;
|
|
326
362
|
};
|
|
327
363
|
}
|
|
328
|
-
type SupportedLocale = "en" | "en-US" | "en-GB" | "pt" | "pt-BR" | "pt-PT" | "es";
|
|
364
|
+
type SupportedLocale = "en" | "en-US" | "en-GB" | "pt" | "pt-BR" | "pt-PT" | "es" | "da" | "sv" | "nb" | "fi" | "fr" | "de" | "it" | "nl" | "pl" | "cs" | "ro" | "hu" | "uk" | "ru" | "el" | "tr" | "et" | "ja" | "zh-CN" | "zh-TW" | "ko" | "vi" | "th" | "id" | "hi" | "ar";
|
|
329
365
|
type PartialLocaleStrings = Partial<{
|
|
330
366
|
[K in keyof LocaleStrings]: Partial<LocaleStrings[K]>;
|
|
331
367
|
}> & {
|
|
@@ -336,6 +372,8 @@ type PartialLocaleStrings = Partial<{
|
|
|
336
372
|
dropzone?: Partial<LocaleStrings["inputArea"]["dropzone"]>;
|
|
337
373
|
};
|
|
338
374
|
messageList?: Partial<LocaleStrings["messageList"]>;
|
|
375
|
+
push?: Partial<LocaleStrings["push"]>;
|
|
376
|
+
notification?: Partial<LocaleStrings["notification"]>;
|
|
339
377
|
common?: Partial<LocaleStrings["common"]>;
|
|
340
378
|
};
|
|
341
379
|
interface LocaleConfig {
|
|
@@ -345,6 +383,7 @@ interface LocaleConfig {
|
|
|
345
383
|
|
|
346
384
|
interface LocaleContextValue {
|
|
347
385
|
locale: string;
|
|
386
|
+
dir: "ltr" | "rtl";
|
|
348
387
|
strings: LocaleStrings;
|
|
349
388
|
t: (path: string) => string;
|
|
350
389
|
}
|
|
@@ -382,6 +421,8 @@ interface UsePushNotificationsOptions {
|
|
|
382
421
|
onSubscribe: PushConfig["onSubscribe"];
|
|
383
422
|
onUnsubscribe: PushConfig["onUnsubscribe"];
|
|
384
423
|
serviceWorkerUrl?: string;
|
|
424
|
+
serviceWorkerScope?: string;
|
|
425
|
+
serviceWorkerType?: "classic" | "module";
|
|
385
426
|
notificationOptions?: PushConfig["notificationOptions"];
|
|
386
427
|
}
|
|
387
428
|
declare function usePushNotifications(options: UsePushNotificationsOptions): {
|
|
@@ -392,4 +433,4 @@ declare function usePushNotifications(options: UsePushNotificationsOptions): {
|
|
|
392
433
|
unsubscribe: () => Promise<void>;
|
|
393
434
|
};
|
|
394
435
|
|
|
395
|
-
export { AttachmentList, type AttachmentUploadConfig, CardProvider, CardRenderer, type CardRendererProps, type CardRenderer$1 as CardRendererType, ChatProvider, ChatWidget, type ChatWidgetProps, DefaultCard, Dropzone, ErrorBoundary, FileCardComponent, FloatingButton, Header, ImageCardComponent, InputArea, type LocaleConfig, LocaleProvider, type LocaleStrings, MarkdownRenderer, MessageContent, MessageList, type PartialLocaleStrings, type PendingAttachment, PushPermissionPrompt, PushToggle, type SignedUploadUrl, type SimpleUploadConfig, type SupportedLocale, TypingIndicator, type UploadConfig, getAvailableLocales, registerLocale, renderMarkdown, useAttachmentUpload, useCardRegistry, useCardRegistry as useCardRendererRegistry, useChatClient, useChatContext, useLocale, useMessages, usePushNotifications, useStreaming, useTyping };
|
|
436
|
+
export { AttachmentList, type AttachmentUploadConfig, CardProvider, CardRenderer, type CardRendererProps, type CardRenderer$1 as CardRendererType, ChatProvider, ChatWidget, type ChatWidgetProps, DefaultCard, Dropzone, ErrorBoundary, FileCardComponent, FloatingButton, Header, ImageCardComponent, InputArea, type LocaleConfig, LocaleProvider, type LocaleStrings, MarkdownRenderer, MessageContent, MessageList, type PartialLocaleStrings, type PendingAttachment, type PreEntryConfig, type PreEntryHelpers, PushPermissionPrompt, PushToggle, type SignedUploadUrl, type SimpleUploadConfig, type SupportedLocale, TypingIndicator, type UploadConfig, getAvailableLocales, registerLocale, renderMarkdown, useAttachmentUpload, useCardRegistry, useCardRegistry as useCardRendererRegistry, useChatClient, useChatContext, useLocale, useMessages, usePushNotifications, useStreaming, useTyping };
|