document-model 1.0.36 → 1.0.38

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.
@@ -9,6 +9,20 @@ export { z } from './schema';
9
9
  export type * from './schema/types';
10
10
  export type { FileInput } from './utils';
11
11
  export type { Immutable } from 'immer';
12
+ export type ActionSigner = {
13
+ user: {
14
+ address: string;
15
+ chainId: string;
16
+ };
17
+ app: {
18
+ name: string;
19
+ key: string;
20
+ };
21
+ signature: string;
22
+ };
23
+ export type ActionContext = {
24
+ signer?: ActionSigner;
25
+ };
12
26
  /**
13
27
  * Defines the basic structure of an action.
14
28
  *
@@ -23,6 +37,8 @@ export type Action<T extends string = string, I = unknown, S extends OperationSc
23
37
  scope: S;
24
38
  /** The attachments included in the action. */
25
39
  attachments?: AttachmentInput[] | undefined;
40
+ /** The context of the action. */
41
+ context?: ActionContext;
26
42
  };
27
43
  export type ActionWithAttachment<T extends string = string, I = unknown, S extends OperationScope = OperationScope> = Action<T, I, S> & {
28
44
  attachments: AttachmentInput[];
@@ -186,15 +202,25 @@ export type DocumentModel<S = unknown, A extends Action = Action, L = unknown, C
186
202
  utils: DocumentModelUtils<S, A, L>;
187
203
  documentModel: DocumentModelState;
188
204
  };
205
+ export type ENSInfo = {
206
+ name?: string;
207
+ avatarUrl?: string;
208
+ };
209
+ export type User = {
210
+ address: `0x${string}`;
211
+ chainId: number;
212
+ ens?: ENSInfo;
213
+ };
189
214
  export type EditorContext = {
190
215
  theme: 'light' | 'dark';
191
216
  debug?: boolean;
217
+ user?: User;
192
218
  };
193
219
  export type ActionErrorCallback = (error: unknown) => void;
194
220
  export type EditorProps<S, A extends Action, L> = {
195
221
  document: Document<S, A, L>;
196
222
  dispatch: (action: A | BaseAction, onErrorCallback?: ActionErrorCallback) => void;
197
- editorContext: EditorContext;
223
+ context: EditorContext;
198
224
  error?: unknown;
199
225
  };
200
226
  export type Editor<S = unknown, A extends Action = Action, L = unknown> = {
@@ -9,6 +9,20 @@ export { z } from './schema';
9
9
  export type * from './schema/types';
10
10
  export type { FileInput } from './utils';
11
11
  export type { Immutable } from 'immer';
12
+ export type ActionSigner = {
13
+ user: {
14
+ address: string;
15
+ chainId: string;
16
+ };
17
+ app: {
18
+ name: string;
19
+ key: string;
20
+ };
21
+ signature: string;
22
+ };
23
+ export type ActionContext = {
24
+ signer?: ActionSigner;
25
+ };
12
26
  /**
13
27
  * Defines the basic structure of an action.
14
28
  *
@@ -23,6 +37,8 @@ export type Action<T extends string = string, I = unknown, S extends OperationSc
23
37
  scope: S;
24
38
  /** The attachments included in the action. */
25
39
  attachments?: AttachmentInput[] | undefined;
40
+ /** The context of the action. */
41
+ context?: ActionContext;
26
42
  };
27
43
  export type ActionWithAttachment<T extends string = string, I = unknown, S extends OperationScope = OperationScope> = Action<T, I, S> & {
28
44
  attachments: AttachmentInput[];
@@ -186,15 +202,25 @@ export type DocumentModel<S = unknown, A extends Action = Action, L = unknown, C
186
202
  utils: DocumentModelUtils<S, A, L>;
187
203
  documentModel: DocumentModelState;
188
204
  };
205
+ export type ENSInfo = {
206
+ name?: string;
207
+ avatarUrl?: string;
208
+ };
209
+ export type User = {
210
+ address: `0x${string}`;
211
+ chainId: number;
212
+ ens?: ENSInfo;
213
+ };
189
214
  export type EditorContext = {
190
215
  theme: 'light' | 'dark';
191
216
  debug?: boolean;
217
+ user?: User;
192
218
  };
193
219
  export type ActionErrorCallback = (error: unknown) => void;
194
220
  export type EditorProps<S, A extends Action, L> = {
195
221
  document: Document<S, A, L>;
196
222
  dispatch: (action: A | BaseAction, onErrorCallback?: ActionErrorCallback) => void;
197
- editorContext: EditorContext;
223
+ context: EditorContext;
198
224
  error?: unknown;
199
225
  };
200
226
  export type Editor<S = unknown, A extends Action = Action, L = unknown> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "files": [