@weavy/uikit-react 12.1.0 → 13.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.
- package/changelog.md +36 -0
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/WeavyClient.d.ts +8 -1
- package/dist/cjs/types/components/Attachment.d.ts +2 -1
- package/dist/cjs/types/components/Chat.d.ts +1 -1
- package/dist/cjs/types/components/PdfViewer.d.ts +3 -1
- package/dist/cjs/types/components/Preview.d.ts +8 -10
- package/dist/cjs/types/contexts/PreviewContext.d.ts +2 -1
- package/dist/cjs/types/contexts/WeavyContext.d.ts +2 -3
- package/dist/cjs/types/types/Chat.d.ts +1 -1
- package/dist/cjs/types/types/types.d.ts +16 -5
- package/dist/cjs/types/ui/Spinner.d.ts +9 -0
- package/dist/cjs/types/utils/fileUtilities.d.ts +1 -4
- package/dist/css/weavy-chat.css +270 -94
- package/dist/css/weavy-messenger.css +274 -96
- package/dist/css/weavy.css +274 -96
- package/dist/esm/index.js +28 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/WeavyClient.d.ts +8 -1
- package/dist/esm/types/components/Attachment.d.ts +2 -1
- package/dist/esm/types/components/Chat.d.ts +1 -1
- package/dist/esm/types/components/PdfViewer.d.ts +3 -1
- package/dist/esm/types/components/Preview.d.ts +8 -10
- package/dist/esm/types/contexts/PreviewContext.d.ts +2 -1
- package/dist/esm/types/contexts/WeavyContext.d.ts +2 -3
- package/dist/esm/types/types/Chat.d.ts +1 -1
- package/dist/esm/types/types/types.d.ts +16 -5
- package/dist/esm/types/ui/Spinner.d.ts +9 -0
- package/dist/esm/types/utils/fileUtilities.d.ts +1 -4
- package/dist/index.d.ts +14 -7
- package/package.json +2 -2
- package/rollup.config.js +3 -1
- package/src/client/WeavyClient.ts +105 -24
- package/src/components/Attachment.tsx +8 -7
- package/src/components/Chat.tsx +3 -3
- package/src/components/Conversation.tsx +3 -3
- package/src/components/Message.tsx +1 -1
- package/src/components/Messages.tsx +1 -1
- package/src/components/PdfViewer.tsx +88 -83
- package/src/components/Preview.tsx +115 -54
- package/src/components/SearchUsers.tsx +2 -2
- package/src/contexts/PreviewContext.tsx +90 -16
- package/src/contexts/WeavyContext.tsx +7 -4
- package/src/hooks/useBadge.ts +2 -6
- package/src/hooks/useChat.ts +3 -14
- package/src/hooks/useConversation.ts +1 -7
- package/src/hooks/useConversations.ts +1 -7
- package/src/hooks/useFileUploader.ts +6 -8
- package/src/hooks/useMembers.ts +1 -7
- package/src/hooks/useMessages.ts +1 -7
- package/src/hooks/useMutateChat.ts +6 -11
- package/src/hooks/useMutateConversation.ts +7 -10
- package/src/hooks/useMutateConversationName.ts +10 -12
- package/src/hooks/useMutateDeleteReaction.ts +3 -8
- package/src/hooks/useMutateExternalBlobs.ts +6 -11
- package/src/hooks/useMutateMeeting.ts +6 -11
- package/src/hooks/useMutateMembers.ts +8 -13
- package/src/hooks/useMutateMessage.ts +10 -15
- package/src/hooks/useMutatePinned.ts +3 -8
- package/src/hooks/useMutateReaction.ts +6 -12
- package/src/hooks/useMutateRead.ts +1 -10
- package/src/hooks/useMutateRemoveMembers.ts +7 -12
- package/src/hooks/useMutateTyping.ts +6 -11
- package/src/hooks/useSearchUsers.ts +1 -6
- package/src/hooks/useUser.ts +3 -14
- package/src/scss/theme/_appbar.scss +4 -2
- package/src/scss/theme/_cm-editor.scss +1 -1
- package/src/scss/theme/_code-vscode-dark.scss +184 -0
- package/src/scss/theme/_code-vscode-light.scss +179 -0
- package/src/scss/theme/_code.scss +9 -112
- package/src/scss/theme/_files.scss +1 -1
- package/src/scss/theme/_message-editor.scss +1 -1
- package/src/scss/theme/_overlays.scss +2 -2
- package/src/scss/theme/_panels.scss +11 -7
- package/src/scss/theme/_preview-code.scss +5 -0
- package/src/scss/theme/_preview-embed.scss +3 -3
- package/src/scss/theme/_preview-image.scss +1 -1
- package/src/scss/theme/_preview-text.scss +1 -1
- package/src/scss/theme/_preview.scss +7 -2
- package/src/scss/weavy-chat.scss +1 -0
- package/src/scss/weavy-messenger.scss +1 -0
- package/src/types/Chat.ts +1 -1
- package/src/types/types.ts +16 -5
- package/src/ui/Spinner.tsx +18 -0
- package/src/utils/fileUtilities.ts +11 -125
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
export default class WeavyClient {
|
|
2
2
|
url: string;
|
|
3
|
-
tokenFactory: () => string | Promise<string>;
|
|
4
3
|
connection: import("@microsoft/signalr").HubConnection;
|
|
4
|
+
tokenFactory: (refresh: boolean) => Promise<string>;
|
|
5
5
|
groups: string[];
|
|
6
6
|
connectionEvents: any[];
|
|
7
7
|
isConnectionStarted: any;
|
|
8
|
+
token: string;
|
|
9
|
+
tokenPromise: Promise<string> | null;
|
|
8
10
|
EVENT_NAMESPACE: string;
|
|
9
11
|
EVENT_CLOSE: string;
|
|
10
12
|
EVENT_RECONNECTING: string;
|
|
11
13
|
EVENT_RECONNECTED: string;
|
|
12
14
|
constructor(options: WeavyClientOptions);
|
|
15
|
+
get(url: string, retry?: boolean): Promise<Response>;
|
|
16
|
+
post(url: string, method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", body: string | FormData, contentType?: string, retry?: boolean): Promise<Response>;
|
|
17
|
+
getToken(refresh: boolean): Promise<string>;
|
|
18
|
+
tokenFactoryInternal(refresh?: boolean, fromSR?: boolean): Promise<string>;
|
|
13
19
|
subscribe(group: string, event: string, callback: any): Promise<void>;
|
|
14
20
|
unsubscribe(group: string, event: string, callback: any): Promise<void>;
|
|
21
|
+
destroy(): void;
|
|
15
22
|
triggerHandler(name: string, ...data: any): void;
|
|
16
23
|
}
|
|
@@ -8,6 +8,7 @@ declare type Props = {
|
|
|
8
8
|
kind: string;
|
|
9
9
|
size: number;
|
|
10
10
|
provider: string;
|
|
11
|
+
onClick?: (e: any) => void;
|
|
11
12
|
};
|
|
12
|
-
declare const Attachment: ({ previewFormat, url, previewUrl, mediaType, name, kind, size, provider }: Props) => JSX.Element;
|
|
13
|
+
declare const Attachment: ({ previewFormat, url, previewUrl, mediaType, name, kind, size, provider, onClick }: Props) => JSX.Element;
|
|
13
14
|
export default Attachment;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type Props = {
|
|
3
3
|
src: string;
|
|
4
|
+
pdfCMapsUrl: string;
|
|
5
|
+
pdfWorkerUrl: string;
|
|
4
6
|
};
|
|
5
|
-
declare const PdfViewer: ({ src }: Props) => JSX.Element;
|
|
7
|
+
declare const PdfViewer: ({ src, pdfCMapsUrl, pdfWorkerUrl }: Props) => JSX.Element;
|
|
6
8
|
export default PdfViewer;
|
|
@@ -7,20 +7,16 @@ declare type ImageProps = {
|
|
|
7
7
|
export declare const PreviewImage: ({ src, width, height }: ImageProps) => JSX.Element;
|
|
8
8
|
declare type DocumentProps = {
|
|
9
9
|
src: string;
|
|
10
|
+
client: any;
|
|
10
11
|
};
|
|
11
|
-
export declare const PreviewDocument: ({ src }: DocumentProps) => JSX.Element;
|
|
12
|
-
declare type
|
|
12
|
+
export declare const PreviewDocument: ({ src, client }: DocumentProps) => JSX.Element;
|
|
13
|
+
declare type MediaProps = {
|
|
14
|
+
format: string;
|
|
13
15
|
src: string;
|
|
14
16
|
name: string;
|
|
15
17
|
mediaType?: string;
|
|
16
18
|
};
|
|
17
|
-
export declare const
|
|
18
|
-
declare type AudioProps = {
|
|
19
|
-
src: string;
|
|
20
|
-
name: string;
|
|
21
|
-
mediaType?: string;
|
|
22
|
-
};
|
|
23
|
-
export declare const PreviewAudio: ({ src, name, mediaType }: AudioProps) => JSX.Element;
|
|
19
|
+
export declare const PreviewMedia: ({ format, src, name, mediaType }: MediaProps) => JSX.Element;
|
|
24
20
|
declare type TextProps = {
|
|
25
21
|
src: string;
|
|
26
22
|
html?: boolean;
|
|
@@ -45,7 +41,9 @@ declare type IconProps = {
|
|
|
45
41
|
};
|
|
46
42
|
export declare const PreviewIcon: ({ children, src, icon, name, provider, download, className }: IconProps) => JSX.Element;
|
|
47
43
|
declare type PreviewProps = {
|
|
44
|
+
client: any;
|
|
48
45
|
src: string;
|
|
46
|
+
link?: string;
|
|
49
47
|
format: PreviewFormatType;
|
|
50
48
|
name: string;
|
|
51
49
|
icon: string;
|
|
@@ -54,5 +52,5 @@ declare type PreviewProps = {
|
|
|
54
52
|
mediaType?: string;
|
|
55
53
|
provider?: string;
|
|
56
54
|
};
|
|
57
|
-
export declare const Preview: ({ src, format, name, icon, width, height, mediaType, provider }: PreviewProps) => JSX.Element;
|
|
55
|
+
export declare const Preview: ({ client, src, link, format, name, icon, width, height, mediaType, provider }: PreviewProps) => JSX.Element;
|
|
58
56
|
export default Preview;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const PreviewContext: React.Context<PreviewContextProps>;
|
|
3
3
|
declare type Props = {
|
|
4
|
+
client: any;
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
};
|
|
6
|
-
declare const PreviewProvider: ({ children }: Props) => JSX.Element;
|
|
7
|
+
declare const PreviewProvider: ({ client, children }: Props) => JSX.Element;
|
|
7
8
|
export default PreviewProvider;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import WeavyClient from "../client/WeavyClient";
|
|
3
2
|
export declare const WeavyContext: React.Context<WeavyContextProps>;
|
|
4
|
-
declare type
|
|
3
|
+
declare type WeavyProviderProperties = {
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
client: WeavyClient;
|
|
7
6
|
options?: WeavyContextOptions;
|
|
8
7
|
};
|
|
9
|
-
declare const WeavyProvider: ({ children, client, options }:
|
|
8
|
+
declare const WeavyProvider: ({ children, client, options }: WeavyProviderProperties) => JSX.Element;
|
|
10
9
|
export default WeavyProvider;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface WeavyClient {
|
|
3
3
|
url: string;
|
|
4
|
-
|
|
4
|
+
tokenFactoryInternal: () => Promise<string>;
|
|
5
5
|
subscribe: Function;
|
|
6
6
|
unsubscribe: Function;
|
|
7
|
+
destroy: Function;
|
|
8
|
+
get: (url: string, retry?: boolean) => Promise<Response>;
|
|
9
|
+
post: (url: string, method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", body: string | FormData, contentType?: string, retry?: boolean) => Promise<Response>;
|
|
7
10
|
}
|
|
8
11
|
declare type WeavyClientOptions = {
|
|
9
12
|
url: string;
|
|
10
|
-
tokenFactory: (
|
|
13
|
+
tokenFactory: (refresh: boolean) => Promise<string>;
|
|
11
14
|
};
|
|
12
15
|
declare type WeavyContextProps = {
|
|
13
16
|
client: WeavyClient | null;
|
|
@@ -19,6 +22,8 @@ declare type WeavyContextOptions = {
|
|
|
19
22
|
enableCloudFiles?: boolean;
|
|
20
23
|
enableScrollbarDetection?: boolean;
|
|
21
24
|
filebrowserUrl?: string;
|
|
25
|
+
pdfWorkerUrl?: string;
|
|
26
|
+
pdfCMapsUrl?: string;
|
|
22
27
|
reactions?: string[];
|
|
23
28
|
};
|
|
24
29
|
declare type MessengerContextProps = {
|
|
@@ -114,11 +119,17 @@ declare type AttachmentType = {
|
|
|
114
119
|
size: number;
|
|
115
120
|
provider: string;
|
|
116
121
|
download_url: string;
|
|
117
|
-
|
|
118
|
-
thumbnail_url: string;
|
|
122
|
+
embed_url: string;
|
|
119
123
|
external_url: string;
|
|
124
|
+
thumbnail_url: string;
|
|
125
|
+
preview_format: PreviewFormatType;
|
|
126
|
+
application_url: string;
|
|
127
|
+
preview_url: string;
|
|
128
|
+
created_at: string;
|
|
129
|
+
created_by?: UserType;
|
|
130
|
+
createdById?: number;
|
|
120
131
|
};
|
|
121
|
-
declare type PreviewFormatType = "
|
|
132
|
+
declare type PreviewFormatType = "audio" | "code" | "embed" | "html" | "image" | "pdf" | "text" | "video" | "none";
|
|
122
133
|
declare type ReactionType = {
|
|
123
134
|
id: number;
|
|
124
135
|
parent: MessageType;
|
|
@@ -6,15 +6,12 @@ export declare function isWebImage(path: string): boolean;
|
|
|
6
6
|
export declare function isBitmap(path: string): boolean;
|
|
7
7
|
export declare function isMetaFile(path: string): boolean;
|
|
8
8
|
export declare function isVideo(ext: string): boolean;
|
|
9
|
+
export declare function isMarkdown(ext: string): boolean;
|
|
9
10
|
export declare function isMarkup(ext: string): boolean;
|
|
10
11
|
export declare function isCode(ext: string): boolean;
|
|
11
12
|
export declare function isText(ext: string): boolean;
|
|
12
13
|
export declare function isOfficeDocument(path: string): boolean;
|
|
13
|
-
export declare function canResize(path: string): boolean;
|
|
14
|
-
export declare function canConvertToImage(filename: string): boolean;
|
|
15
|
-
export declare function canConvertToPdf(filename: string): boolean;
|
|
16
14
|
export declare function getIcon(name: string, mediaType?: string): {
|
|
17
15
|
icon: string;
|
|
18
16
|
color?: string;
|
|
19
17
|
};
|
|
20
|
-
export declare function getPreviewFormat(filename: string): PreviewFormatType;
|