@fileverse-dev/ddoc 2.3.0-rtc-patch-4 → 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-4USFk2FD.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,
@@ -14,7 +14,7 @@ export declare const initAwarenessHandler: (context: SyncMachineContext) => {
14
14
  export declare const updateConnectionStateHandler: (context: SyncMachineContext) => {
15
15
  isConnected: boolean;
16
16
  };
17
- export declare const websocketInitializer: (_context: SyncMachineContext, event: SyncMachinEvent) => {
17
+ export declare const websocketInitializer: (context: SyncMachineContext, event: SyncMachinEvent) => {
18
18
  socketClient: SocketClient;
19
19
  initialUpdate: any;
20
20
  roomKey: any;
@@ -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;
@@ -24,7 +30,10 @@ export declare class SocketClient {
24
30
  private contractAddress?;
25
31
  private ownerUcan?;
26
32
  private ownerAddress?;
33
+ private roomKey;
34
+ private roomInfo?;
27
35
  _onError: ISocketInitConfig['onError'] | null;
36
+ _onCollaborationConnectCallback: ISocketClientConfig['onCollaborationConnectCallback'] | null;
28
37
  constructor(config: ISocketClientConfig);
29
38
  private _getSequenceIdCallback;
30
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;
@@ -158,4 +150,5 @@ export interface IAuthArgs {
158
150
  ownerAddress?: string;
159
151
  contractAddress?: string;
160
152
  collaborationDid?: string;
153
+ roomInfo?: string;
161
154
  }
@@ -10,6 +10,11 @@ interface IConnectConf {
10
10
  ownerAddress?: string;
11
11
  isEns?: boolean;
12
12
  wsUrl: string;
13
+ extraInfo?: {
14
+ documentTitle: string;
15
+ portalAddress: string;
16
+ commentKey: string;
17
+ };
13
18
  }
14
19
  export declare const useSyncMachine: (config: Partial<SyncMachineContext>) => {
15
20
  machine: (import('xstate').State<SyncMachineContext, {
@@ -148,21 +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
- wsUrl: string;
160
- };
151
+ collabConfig?: ICollaborationConfig;
161
152
  /**
162
153
  * Document styling configuration
163
154
  * @description Customize the appearance of the document editor
164
155
  */
165
156
  documentStyling?: DocumentStyling;
157
+ onCollaborationConnectCallback?: (response: any) => void;
166
158
  }
167
159
  export interface IEditorSelectionData {
168
160
  from: number;
@@ -194,3 +186,18 @@ export interface IpfsImageFetchPayload {
194
186
  mimeType: string;
195
187
  authTag: string;
196
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-4",
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": {