@talkjs/react-components 0.0.18 → 0.0.19
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/base.css +1 -1
- package/default.css +1 -1
- package/default.d.ts +77 -67
- package/default.js +277 -249
- package/globalConstants.js +1 -1
- package/package.json +1 -1
- package/theming.d.ts +59 -151
- package/theming.js +1 -1
package/globalConstants.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext as n,useContext as e}from"react";import{tracking as
|
|
2
|
+
import{createContext as n,useContext as e}from"react";import{tracking as o}from"@legendapp/state";class r extends Error{}function i(n,e){if(!n)throw new r(e??"Assertion failed")}const t=Object.assign(i,{is:function(n,e,o){return i(e,o)},unreachable:function(){throw new Error("Unreachable code")},keyNonNullable:function(n,e){if(!(e in n))throw new r(`Missing key "${e}"`);const o=n[e];if(null==o)throw new r(`Key "${e}" is null or undefined`)},insideObservingContext:function(){if(!o.current)throw new Error("You aren't inside an observing context")},never:function(n){throw new Error("Unreachable")},defined:function(n){if(null==n)throw new r("Value is not defined")}}),c=n(void 0),s=p(c),u=n(void 0),d=p(u),f=n(void 0),a=p(f),l=n(void 0),w=n(l),h=n(void 0),v=p(h),b=n(void 0),g=p(b);function p(n){return()=>{const o=e(n);return t(void 0!==o),o}}export{h as ChatboxControllerContext,u as EditorInternalsContext,l as PermissionContext,b as SessionContext,f as StoreContext,c as ThemeContext,v as useChatboxController,d as useEditorInternals,w as usePermission,g as useSession,a as useStore,s as useTheme};
|
|
3
3
|
//# sourceMappingURL=globalConstants.js.map
|
package/package.json
CHANGED
package/theming.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { ReactElement } from 'react';
|
|
|
13
13
|
import { ReferencedMessageSnapshot } from '@talkjs/core';
|
|
14
14
|
import { SendMessageParams } from '@talkjs/core';
|
|
15
15
|
import { SendTextMessageParams } from '@talkjs/core';
|
|
16
|
+
import { TalkSession } from '@talkjs/core';
|
|
16
17
|
import { TextBlock } from '@talkjs/core';
|
|
17
18
|
import { TypingSnapshot } from '@talkjs/core';
|
|
18
19
|
import { UserSnapshot } from '@talkjs/core';
|
|
@@ -56,6 +57,14 @@ export declare interface AudioPlayerProps {
|
|
|
56
57
|
className?: string;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
export declare interface AvatarProps extends BaseChatboxProps {
|
|
61
|
+
photoUrl: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare interface BaseChatboxProps {
|
|
65
|
+
common: CommonChatboxProps;
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
/**
|
|
60
69
|
* Brands a base type `T`.
|
|
61
70
|
*
|
|
@@ -75,63 +84,6 @@ declare interface Branding<B extends string> {
|
|
|
75
84
|
__tag: Record<B, true>;
|
|
76
85
|
}
|
|
77
86
|
|
|
78
|
-
/**
|
|
79
|
-
* @public
|
|
80
|
-
*
|
|
81
|
-
* A string that is one of `"notifications" | "microphone" | "geolocation"`.
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
* Note that more possible values may be added in the future, so make sure your
|
|
85
|
-
* handler can deal with unknown permission types gracefully.
|
|
86
|
-
*/
|
|
87
|
-
export declare type BrowserPermission = "notifications" | "microphone" | "geolocation";
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Passed to `chatbox.beforeBrowserPermissionPrompt` when a browser permission
|
|
91
|
-
* dialog needs to be shown to the user.
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
export declare interface BrowserPermissionRequest {
|
|
96
|
-
/**
|
|
97
|
-
* The type of permission requested.
|
|
98
|
-
*
|
|
99
|
-
* @remarks
|
|
100
|
-
* Note that more possible values may be added in the future, so make sure your
|
|
101
|
-
* handler can deal with unknown permission types gracefully.
|
|
102
|
-
*/
|
|
103
|
-
type: BrowserPermission;
|
|
104
|
-
/**
|
|
105
|
-
* Cancel whatever user action caused the permission to be requested.
|
|
106
|
-
*
|
|
107
|
-
* @remarks
|
|
108
|
-
* For example, if a user wants to share their location for the first time so
|
|
109
|
-
* that this event is triggered, then if you call `cancel()`, no permission
|
|
110
|
-
* will be requested from the browser, the location sharing will be cancelled,
|
|
111
|
-
* and TalkJS will continue as if the location sharing button had not been
|
|
112
|
-
* clicked at all.
|
|
113
|
-
*
|
|
114
|
-
* This may be useful if you're using this event to show custom UI elements
|
|
115
|
-
* that nudge users towards granting permission, and this UI has a "cancel"
|
|
116
|
-
* button.
|
|
117
|
-
*/
|
|
118
|
-
cancel(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Show the browser permission prompt that lets the user allow or deny this
|
|
121
|
-
* permission.
|
|
122
|
-
*
|
|
123
|
-
* @remarks
|
|
124
|
-
* When the user clicks "Allow", then the user action that triggered the
|
|
125
|
-
* browser permission request will proceed and the return value resolves to
|
|
126
|
-
* `"granted"`.
|
|
127
|
-
*
|
|
128
|
-
* When the user clicks "Deny", then the user action is cancelled, the
|
|
129
|
-
* `onMissingBrowserPermission` event is triggered, and the return value
|
|
130
|
-
* resolves to `"denied"`.
|
|
131
|
-
*/
|
|
132
|
-
showPrompt(): Promise<"granted" | "denied">;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
87
|
export declare interface Chatbox {
|
|
136
88
|
deleteMessage(messageId: string): Promise<void>;
|
|
137
89
|
setEditing(messageId: string | null): void;
|
|
@@ -150,25 +102,31 @@ export declare interface Chatbox {
|
|
|
150
102
|
setMessageFieldText: (text: string) => void;
|
|
151
103
|
}
|
|
152
104
|
|
|
153
|
-
export declare interface ChatHeaderProps {
|
|
154
|
-
conversation: ConversationSnapshot;
|
|
155
|
-
participants: ParticipantSnapshot[];
|
|
156
|
-
currentUser: UserSnapshot;
|
|
157
|
-
t: Translation;
|
|
158
|
-
chatbox: Chatbox;
|
|
159
|
-
themeCustom?: any;
|
|
105
|
+
export declare interface ChatHeaderProps extends BaseChatboxProps {
|
|
160
106
|
isUserConnected: {
|
|
161
107
|
[userId: string]: boolean;
|
|
162
108
|
};
|
|
163
109
|
permissions: UserPermissions;
|
|
164
|
-
device: DeviceFeatures;
|
|
165
110
|
}
|
|
166
111
|
|
|
167
|
-
export declare interface
|
|
168
|
-
|
|
112
|
+
export declare interface CommonChatboxProps {
|
|
113
|
+
app: AppMetadata;
|
|
169
114
|
currentUser: UserSnapshot;
|
|
170
115
|
t: Translation;
|
|
116
|
+
chatbox: Chatbox;
|
|
171
117
|
themeCustom?: any;
|
|
118
|
+
device: DeviceFeatures;
|
|
119
|
+
theme: Theme;
|
|
120
|
+
conversation: ConversationSnapshot;
|
|
121
|
+
participants: ParticipantSnapshot[];
|
|
122
|
+
typing: TypingSnapshot;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare interface ContentBlockProps extends BaseChatboxProps {
|
|
126
|
+
message: MessageSnapshot;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export declare interface ConversationImageProps extends BaseChatboxProps {
|
|
172
130
|
}
|
|
173
131
|
|
|
174
132
|
export { ConversationSnapshot }
|
|
@@ -178,11 +136,7 @@ export declare interface Coordinates {
|
|
|
178
136
|
longitude: number;
|
|
179
137
|
}
|
|
180
138
|
|
|
181
|
-
export declare
|
|
182
|
-
currentUser: UserSnapshot;
|
|
183
|
-
message: MessageSnapshot;
|
|
184
|
-
conversation: ConversationSnapshot;
|
|
185
|
-
}
|
|
139
|
+
export declare function daysBetween(from: number, to: number): number;
|
|
186
140
|
|
|
187
141
|
export declare interface DeviceFeatures {
|
|
188
142
|
/**
|
|
@@ -222,7 +176,7 @@ declare interface EditorState {
|
|
|
222
176
|
|
|
223
177
|
export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
|
|
224
178
|
|
|
225
|
-
declare interface EmojiPickerProps {
|
|
179
|
+
export declare interface EmojiPickerProps {
|
|
226
180
|
colorScheme: "light" | "dark";
|
|
227
181
|
}
|
|
228
182
|
|
|
@@ -248,17 +202,14 @@ export declare function getPhotoUrlWithFallback(user: UserSnapshot): string;
|
|
|
248
202
|
|
|
249
203
|
export declare function getRandomColor(id: string): string;
|
|
250
204
|
|
|
251
|
-
export declare
|
|
205
|
+
export declare interface GroupChatImageProps extends BaseChatboxProps {
|
|
206
|
+
}
|
|
252
207
|
|
|
253
|
-
|
|
254
|
-
* Finds the best-matching translation set for the given locale `code`.
|
|
255
|
-
*/
|
|
256
|
-
export declare function i18n(code: string): Translation;
|
|
208
|
+
export declare function html(strings: TemplateStringsArray, ...args: any[]): ReactElement;
|
|
257
209
|
|
|
258
|
-
export declare interface IconProps {
|
|
210
|
+
export declare interface IconProps extends BaseChatboxProps {
|
|
259
211
|
type: "attach" | "chevronLeft" | "left" | "chevronRight" | "right" | "chevronUp" | "up" | "chevronDown" | "down" | "close" | "emoji" | "locationPin" | "more" | "plus" | "search" | "send" | "spinner" | "play" | "pause" | "updown" | "addEmoji" | "microphone" | "mic" | "stop" | "download" | "location" | "email" | "movie" | "image" | "attachment" | "horizontalDots" | "verticalDots" | "reply" | "back";
|
|
260
212
|
className?: string;
|
|
261
|
-
themeCustom?: any;
|
|
262
213
|
}
|
|
263
214
|
|
|
264
215
|
export { ImageBlock }
|
|
@@ -312,50 +263,31 @@ export declare type MenuItemProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
312
263
|
textValue?: string;
|
|
313
264
|
};
|
|
314
265
|
|
|
266
|
+
export declare interface MessageActionMenuProps extends BaseChatboxProps {
|
|
267
|
+
}
|
|
268
|
+
|
|
315
269
|
export declare function MessageContent(props: MessageContentProps): JSX.Element;
|
|
316
270
|
|
|
317
|
-
export declare interface MessageContentProps {
|
|
318
|
-
currentUser: UserSnapshot;
|
|
271
|
+
export declare interface MessageContentProps extends BaseChatboxProps {
|
|
319
272
|
message: MessageSnapshot;
|
|
320
|
-
t: Translation;
|
|
321
273
|
messageStatus: MessageStatus;
|
|
322
|
-
themeCustom?: any;
|
|
323
274
|
className?: string;
|
|
324
275
|
}
|
|
325
276
|
|
|
326
|
-
export declare interface MessageDividerProps {
|
|
277
|
+
export declare interface MessageDividerProps extends BaseChatboxProps {
|
|
327
278
|
isReadMarker: boolean;
|
|
328
279
|
isDayMarker: boolean;
|
|
329
280
|
timestamp?: number;
|
|
330
|
-
currentUser: UserSnapshot;
|
|
331
|
-
conversation: ConversationSnapshot;
|
|
332
|
-
app: AppMetadata;
|
|
333
|
-
t: Translation;
|
|
334
|
-
themeCustom?: any;
|
|
335
281
|
}
|
|
336
282
|
|
|
337
|
-
export declare interface MessageFieldProps {
|
|
338
|
-
conversation: ConversationSnapshot;
|
|
339
|
-
participants: ParticipantSnapshot[];
|
|
283
|
+
export declare interface MessageFieldProps extends BaseChatboxProps {
|
|
340
284
|
referencedMessage: MessageSnapshot | undefined;
|
|
341
|
-
currentUser: UserSnapshot;
|
|
342
285
|
permissions: UserPermissions;
|
|
343
|
-
t: Translation;
|
|
344
|
-
chatbox: Chatbox;
|
|
345
286
|
editor?: EditorController;
|
|
346
|
-
themeCustom?: any;
|
|
347
|
-
device: DeviceFeatures;
|
|
348
287
|
editMessageId: string | undefined;
|
|
349
288
|
}
|
|
350
289
|
|
|
351
|
-
export declare interface MessageListFooterProps {
|
|
352
|
-
typing: TypingSnapshot;
|
|
353
|
-
conversation: ConversationSnapshot;
|
|
354
|
-
participants: ParticipantSnapshot[];
|
|
355
|
-
currentUser: UserSnapshot;
|
|
356
|
-
t: Translation;
|
|
357
|
-
chatbox: Chatbox;
|
|
358
|
-
themeCustom?: any;
|
|
290
|
+
export declare interface MessageListFooterProps extends BaseChatboxProps {
|
|
359
291
|
}
|
|
360
292
|
|
|
361
293
|
export declare interface MessagePermissions extends UserPermissions {
|
|
@@ -364,65 +296,30 @@ export declare interface MessagePermissions extends UserPermissions {
|
|
|
364
296
|
canEditMessage: boolean;
|
|
365
297
|
}
|
|
366
298
|
|
|
367
|
-
export declare interface MessageProps {
|
|
368
|
-
app: AppMetadata;
|
|
369
|
-
currentUser: UserSnapshot;
|
|
299
|
+
export declare interface MessageProps extends BaseChatboxProps {
|
|
370
300
|
message: MessageSnapshot;
|
|
371
301
|
messageStatus: MessageStatus;
|
|
372
|
-
conversation: ConversationSnapshot;
|
|
373
|
-
participants: ParticipantSnapshot[];
|
|
374
302
|
permissions: MessagePermissions;
|
|
375
|
-
t: Translation;
|
|
376
|
-
chatbox: Chatbox;
|
|
377
|
-
themeCustom?: any;
|
|
378
|
-
device: DeviceFeatures;
|
|
379
303
|
}
|
|
380
304
|
|
|
381
305
|
export { MessageSnapshot }
|
|
382
306
|
|
|
383
307
|
export declare type MessageStatus = "sending" | "sent" | "everyoneRead";
|
|
384
308
|
|
|
385
|
-
/**
|
|
386
|
-
* Sent by `onMissingBrowserPermission` when the user tried to do an action that
|
|
387
|
-
* require explicit browser permission, but that permission has been denied.
|
|
388
|
-
*
|
|
389
|
-
* @remarks
|
|
390
|
-
* This event is meant to let you show a message to the user if an action (eg
|
|
391
|
-
* sharing a location, or enabling notifications) can't proceed because the
|
|
392
|
-
* browser permission for that has been denied.
|
|
393
|
-
*
|
|
394
|
-
* If you want to control when to show the browser permissions prompt, use
|
|
395
|
-
* `beforeBrowserPermissionPrompt`.
|
|
396
|
-
*
|
|
397
|
-
* This event is emitted both when the user has denied this permission in the
|
|
398
|
-
* past, and when a user action just triggered a browser permissions prompt
|
|
399
|
-
* which the user then denied. If you need to differentiate between these two
|
|
400
|
-
* cases, use `beforeBrowserPermissionPrompt`, and inspect the return value of
|
|
401
|
-
* {@link BrowserPermissionRequest.showPrompt}.
|
|
402
|
-
*
|
|
403
|
-
* @public
|
|
404
|
-
*/
|
|
405
|
-
export declare interface MissingBrowserPermissionEvent {
|
|
406
|
-
/**
|
|
407
|
-
* The type of permission that was denied.
|
|
408
|
-
*
|
|
409
|
-
* @remarks
|
|
410
|
-
* Note that more possible values may be added in the future, so make sure your
|
|
411
|
-
* handler can deal with unknown permission types gracefully.
|
|
412
|
-
*/
|
|
413
|
-
type: BrowserPermission;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
309
|
export { ParticipantSnapshot }
|
|
417
310
|
|
|
311
|
+
export declare interface ReferencedMessageProps extends BaseChatboxProps {
|
|
312
|
+
referencedMessage: ReferencedMessageSnapshot;
|
|
313
|
+
}
|
|
314
|
+
|
|
418
315
|
export { ReferencedMessageSnapshot }
|
|
419
316
|
|
|
420
|
-
export declare interface
|
|
421
|
-
|
|
422
|
-
message: MessageSnapshot;
|
|
423
|
-
conversation: ConversationSnapshot;
|
|
317
|
+
export declare interface ReplyBarProps extends BaseChatboxProps {
|
|
318
|
+
referencedMessage: MessageSnapshot;
|
|
424
319
|
}
|
|
425
320
|
|
|
321
|
+
export { TalkSession }
|
|
322
|
+
|
|
426
323
|
declare function Text_2({ block, className }: TextProps): ReactElement;
|
|
427
324
|
export { Text_2 as Text }
|
|
428
325
|
|
|
@@ -438,6 +335,13 @@ export declare interface TextProps {
|
|
|
438
335
|
}
|
|
439
336
|
|
|
440
337
|
export declare interface Theme {
|
|
338
|
+
Avatar: React_2.ComponentType<AvatarProps>;
|
|
339
|
+
ConversationImage: React_2.ComponentType<ConversationImageProps>;
|
|
340
|
+
GroupChatImage: React_2.ComponentType<GroupChatImageProps>;
|
|
341
|
+
ReferencedMessage: React_2.ComponentType<ReferencedMessageProps>;
|
|
342
|
+
ReplyBar: React_2.ComponentType<ReplyBarProps>;
|
|
343
|
+
TimeAgo: React_2.ComponentType<TimeAgoProps>;
|
|
344
|
+
MessageActionMenu: React_2.ComponentType<MessageActionMenuProps>;
|
|
441
345
|
ChatHeader: React_2.ComponentType<ChatHeaderProps>;
|
|
442
346
|
Message: React_2.ComponentType<MessageProps>;
|
|
443
347
|
MessageField: React_2.ComponentType<MessageFieldProps>;
|
|
@@ -463,6 +367,10 @@ export declare interface TimeAgo {
|
|
|
463
367
|
short: string;
|
|
464
368
|
}
|
|
465
369
|
|
|
370
|
+
export declare interface TimeAgoProps extends BaseChatboxProps {
|
|
371
|
+
timestamp: number;
|
|
372
|
+
}
|
|
373
|
+
|
|
466
374
|
export declare type Translation = TranslationData & TranslationStrings;
|
|
467
375
|
|
|
468
376
|
declare interface TranslationData {
|
|
@@ -608,7 +516,7 @@ declare global {
|
|
|
608
516
|
declare global {
|
|
609
517
|
namespace JSX {
|
|
610
518
|
interface IntrinsicElements {
|
|
611
|
-
"t-chatbox": typeof
|
|
519
|
+
"t-chatbox": typeof UnthemedChatbox;
|
|
612
520
|
}
|
|
613
521
|
}
|
|
614
522
|
}
|