@fileverse-dev/ddoc 2.3.0-rtc-patch-3 → 2.3.0-rtc-patch-6

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/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export { useHeadlessEditor } from './package/hooks/use-headless-editor';
5
5
  export { ReminderBlock } from './package/extensions/reminder-block/reminder-block';
6
6
  export { type Reminder, type ReminderBlockOptions, } from './package/extensions/reminder-block/types';
7
7
  export { Editor } from '@tiptap/react';
8
+ export type { ICollaborationConfig } from './package/types';
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-CjlFbMdx.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-Bvk48XKE.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as Editor,
@@ -16,12 +16,12 @@ export declare const updateConnectionStateHandler: (context: SyncMachineContext)
16
16
  };
17
17
  export declare const websocketInitializer: (context: SyncMachineContext, event: SyncMachinEvent) => {
18
18
  socketClient: SocketClient;
19
- username: any;
20
19
  initialUpdate: any;
21
20
  roomKey: any;
22
21
  roomId: any;
23
22
  isOwner: any;
24
23
  isEns: any;
24
+ wsUrl: any;
25
25
  };
26
26
  export declare const yjsUpdateHandler: (context: SyncMachineContext, event: SyncMachinEvent) => {
27
27
  uncommittedUpdatesIdList?: undefined;
@@ -118,10 +118,20 @@ export declare const handleDisconnectionDueToError: (context: SyncMachineContext
118
118
  };
119
119
  export declare const terminateSessionHandler: (context: SyncMachineContext) => {
120
120
  socketClient: null;
121
+ roomId: string;
121
122
  roomMembers: never[];
122
123
  isConnected: boolean;
123
124
  awareness: null;
124
125
  _awarenessUpdateHandler: null;
126
+ roomKey: string;
127
+ wsUrl: string;
125
128
  uncommittedUpdatesIdList: never[];
126
129
  updateQueue: never[];
130
+ isOwner: boolean;
131
+ isReady: boolean;
132
+ isNewDoc: boolean;
133
+ contentTobeAppliedQueue: never[];
134
+ initialUpdate: null;
135
+ errorCount: number;
136
+ errorMessage: string;
127
137
  };
@@ -7,6 +7,12 @@ interface ISocketClientConfig {
7
7
  ownerEdSecret?: string;
8
8
  contractAddress?: string;
9
9
  ownerAddress?: string;
10
+ onCollaborationConnectCallback: (response: any) => void;
11
+ extraInfo?: {
12
+ documentTitle: string;
13
+ portalAddress: string;
14
+ commentKey: string;
15
+ };
10
16
  }
11
17
  export declare class SocketClient {
12
18
  private _websocketUrl;
@@ -18,14 +24,16 @@ export declare class SocketClient {
18
24
  private _webSocket;
19
25
  private _websocketServiceDid;
20
26
  private roomId;
21
- private clientUsername;
22
27
  roomMembers: RoomMember[];
23
28
  private collaborationKeyPair;
24
29
  private ownerKeyPair?;
25
30
  private contractAddress?;
26
31
  private ownerUcan?;
27
32
  private ownerAddress?;
33
+ private roomKey;
34
+ private roomInfo?;
28
35
  _onError: ISocketInitConfig['onError'] | null;
36
+ _onCollaborationConnectCallback: ISocketClientConfig['onCollaborationConnectCallback'] | null;
29
37
  constructor(config: ISocketClientConfig);
30
38
  private _getSequenceIdCallback;
31
39
  private _removeSequenceIdFromMap;
@@ -60,15 +60,7 @@ export interface SyncMachineContext {
60
60
  errorCount: number;
61
61
  errorMaxRetryCount: number;
62
62
  errorMessage: string;
63
- cryptoUtils: {
64
- generateKeyPair: () => {
65
- publicKey: Uint8Array;
66
- privateKey: Uint8Array;
67
- };
68
- encryptData: (data: Uint8Array, key: Uint8Array) => Uint8Array;
69
- decryptData: (data: Uint8Array, key: Uint8Array) => Uint8Array;
70
- generateRandomBytes: (length: number) => Uint8Array;
71
- };
63
+ onCollaborationConnectCallback: (response: any) => void;
72
64
  }
73
65
  export interface ErrorResponseMessage {
74
66
  status: boolean;
@@ -125,7 +117,6 @@ export interface ISocketInitConfig {
125
117
  onError: (err: string) => void;
126
118
  onWsEvent: EventHandler;
127
119
  roomId: string;
128
- username: string;
129
120
  }
130
121
  export declare enum SocketStatusEnum {
131
122
  CLOSED = "CLOSED",
@@ -153,11 +144,11 @@ export interface IpfsUploadResponse {
153
144
  mimetype: string;
154
145
  }
155
146
  export interface IAuthArgs {
156
- username: string;
157
147
  collaborationToken: string;
158
148
  documentId: string;
159
149
  ownerToken?: string;
160
150
  ownerAddress?: string;
161
151
  contractAddress?: string;
162
152
  collaborationDid?: string;
153
+ roomInfo?: string;
163
154
  }
@@ -1,7 +1,7 @@
1
1
  import { SyncMachineContext } from '.';
2
2
 
3
3
  interface IConnectConf {
4
- username: string;
4
+ username?: string;
5
5
  roomKey: string;
6
6
  roomId: string;
7
7
  isOwner: boolean;
@@ -9,6 +9,12 @@ interface IConnectConf {
9
9
  contractAddress?: string;
10
10
  ownerAddress?: string;
11
11
  isEns?: boolean;
12
+ wsUrl: string;
13
+ extraInfo?: {
14
+ documentTitle: string;
15
+ portalAddress: string;
16
+ commentKey: string;
17
+ };
12
18
  }
13
19
  export declare const useSyncMachine: (config: Partial<SyncMachineContext>) => {
14
20
  machine: (import('xstate').State<SyncMachineContext, {
@@ -148,20 +148,13 @@ export interface DdocProps extends CommentAccountProps {
148
148
  publicKey: string;
149
149
  privateKey: string;
150
150
  };
151
- collabConfig?: {
152
- roomKey: string;
153
- collaborationId: string;
154
- username: string;
155
- isOwner: boolean;
156
- ownerEdSecret?: string;
157
- contractAddress?: string;
158
- ownerAddress?: string;
159
- };
151
+ collabConfig?: ICollaborationConfig;
160
152
  /**
161
153
  * Document styling configuration
162
154
  * @description Customize the appearance of the document editor
163
155
  */
164
156
  documentStyling?: DocumentStyling;
157
+ onCollaborationConnectCallback?: (response: any) => void;
165
158
  }
166
159
  export interface IEditorSelectionData {
167
160
  from: number;
@@ -193,3 +186,18 @@ export interface IpfsImageFetchPayload {
193
186
  mimeType: string;
194
187
  authTag: string;
195
188
  }
189
+ export interface ICollaborationConfig {
190
+ roomKey: string;
191
+ collaborationId: string;
192
+ username: string;
193
+ isOwner: boolean;
194
+ ownerEdSecret?: string;
195
+ contractAddress?: string;
196
+ ownerAddress?: string;
197
+ wsUrl: string;
198
+ extraInfo?: {
199
+ documentTitle: string;
200
+ portalAddress: string;
201
+ commentKey: string;
202
+ };
203
+ }
@@ -1,7 +1,7 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
3
  import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, walletAddress, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, collabConfig, }: Partial<DdocProps>) => {
4
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, walletAddress, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, collabConfig, ...rest }: Partial<DdocProps>) => {
5
5
  editor: import('@tiptap/core').Editor | null;
6
6
  isContentLoading: boolean;
7
7
  ref: import('react').RefObject<HTMLDivElement>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "2.3.0-rtc-patch-3",
5
+ "version": "2.3.0-rtc-patch-6",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -24,7 +24,8 @@
24
24
  "build": "tsc && vite build",
25
25
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
26
26
  "preview": "vite preview",
27
- "prepare": "husky install"
27
+ "prepare": "husky install",
28
+ "build:watch": "vite build --watch"
28
29
  },
29
30
  "lint-staged": {
30
31
  "**/*.{js,jsx,ts,tsx}": [