@notionhq/custom-blocks 0.1.17 → 0.1.18
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/bridge/SandboxBridge.d.ts +2 -1
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +7 -5
- package/dist/bridge/sandboxClient.d.ts +1 -0
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +26 -17
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -0
- package/dist/protocol/dataSources/dataSource.d.ts +12 -12
- package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -1
- package/dist/protocol/ids.d.ts +10 -26
- package/dist/protocol/ids.d.ts.map +1 -1
- package/dist/protocol/ids.js +25 -5
- package/dist/protocol/messages/createPage.d.ts +8 -8
- package/dist/protocol/messages/createPageResult.d.ts +5 -5
- package/dist/protocol/messages/currentUserChanged.d.ts +1 -1
- package/dist/protocol/messages/dataSourcesChanged.d.ts +3 -3
- package/dist/protocol/messages/getPage.d.ts +6 -6
- package/dist/protocol/messages/getUser.d.ts +2 -2
- package/dist/protocol/messages/getUser.js +2 -2
- package/dist/protocol/messages/hostToSandbox.d.ts +45 -45
- package/dist/protocol/messages/init.d.ts +14 -14
- package/dist/protocol/messages/listUsers.d.ts +1 -1
- package/dist/protocol/messages/pageChanged.d.ts +5 -5
- package/dist/protocol/messages/parentChanged.d.ts +4 -4
- package/dist/protocol/messages/queryDataSource.d.ts +1 -1
- package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +8 -8
- package/dist/protocol/messages/updatePage.d.ts +1 -1
- package/dist/protocol/messages/updatePageResult.d.ts +5 -5
- package/dist/protocol/pages/page.d.ts +10 -10
- package/dist/protocol/parent.d.ts +4 -4
- package/dist/protocol/users/user.d.ts +4 -7
- package/dist/protocol/users/user.d.ts.map +1 -1
- package/dist/protocol/users/user.js +2 -1
- package/dist/react/standalonePreview.d.ts.map +1 -1
- package/dist/react/standalonePreview.js +3 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +6 -6
- package/src/bridge/sandboxClient.ts +28 -17
- package/src/init.ts +1 -0
- package/src/react/standalonePreview.ts +3 -1
|
@@ -10,7 +10,7 @@ export type { NotionPageId } from "../ids.js";
|
|
|
10
10
|
* The custom block's nearest enclosing page ancestor, carried in `init.page` and `pageChanged`.
|
|
11
11
|
*/
|
|
12
12
|
export declare const customBlockPageSchema: v.ObjectSchema<{
|
|
13
|
-
readonly id: v.
|
|
13
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
14
14
|
/**
|
|
15
15
|
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
16
16
|
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
@@ -18,19 +18,19 @@ export declare const customBlockPageSchema: v.ObjectSchema<{
|
|
|
18
18
|
*/
|
|
19
19
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
20
20
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
21
|
-
readonly page_id: v.
|
|
21
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
22
22
|
}, undefined>, v.ObjectSchema<{
|
|
23
23
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
24
|
-
readonly data_source_id: v.
|
|
24
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
25
25
|
}, undefined>, v.ObjectSchema<{
|
|
26
26
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
27
27
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
28
28
|
}, undefined>, v.ObjectSchema<{
|
|
29
29
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
30
|
-
readonly block_id: v.
|
|
30
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
31
31
|
}, undefined>, v.ObjectSchema<{
|
|
32
32
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
33
|
-
readonly agent_id: v.
|
|
33
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
34
34
|
}, undefined>], undefined>;
|
|
35
35
|
}, undefined>;
|
|
36
36
|
export type CustomBlockPage = v.InferOutput<typeof customBlockPageSchema>;
|
|
@@ -412,22 +412,22 @@ export type NotionPagePropertyWriteMap = v.InferOutput<typeof notionPageProperty
|
|
|
412
412
|
*/
|
|
413
413
|
export declare const notionPageSchema: v.ObjectSchema<{
|
|
414
414
|
readonly object: v.LiteralSchema<"page", undefined>;
|
|
415
|
-
readonly id: v.
|
|
415
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
416
416
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
417
417
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
418
|
-
readonly page_id: v.
|
|
418
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
419
419
|
}, undefined>, v.ObjectSchema<{
|
|
420
420
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
421
|
-
readonly data_source_id: v.
|
|
421
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
422
422
|
}, undefined>, v.ObjectSchema<{
|
|
423
423
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
424
424
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
425
425
|
}, undefined>, v.ObjectSchema<{
|
|
426
426
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
427
|
-
readonly block_id: v.
|
|
427
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
428
428
|
}, undefined>, v.ObjectSchema<{
|
|
429
429
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
430
|
-
readonly agent_id: v.
|
|
430
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
431
431
|
}, undefined>], undefined>;
|
|
432
432
|
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
433
433
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
3
3
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
4
|
-
readonly page_id: v.
|
|
4
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
5
5
|
}, undefined>, v.ObjectSchema<{
|
|
6
6
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
7
|
-
readonly data_source_id: v.
|
|
7
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
8
8
|
}, undefined>, v.ObjectSchema<{
|
|
9
9
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
10
10
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
11
11
|
}, undefined>, v.ObjectSchema<{
|
|
12
12
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
13
|
-
readonly block_id: v.
|
|
13
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
14
14
|
}, undefined>, v.ObjectSchema<{
|
|
15
15
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
16
|
-
readonly agent_id: v.
|
|
16
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
17
17
|
}, undefined>], undefined>;
|
|
18
18
|
/**
|
|
19
19
|
* A record's parent reference.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
declare const
|
|
3
|
-
export type NotionUserId =
|
|
4
|
-
readonly [notionUserIdBrand]: "NotionUserId";
|
|
5
|
-
};
|
|
2
|
+
export declare const notionUserIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
3
|
+
export type NotionUserId = v.InferOutput<typeof notionUserIdSchema>;
|
|
6
4
|
export declare const notionUserSchema: v.ObjectSchema<{
|
|
7
5
|
readonly object: v.LiteralSchema<"user", undefined>;
|
|
8
|
-
readonly id: v.StringSchema<undefined>;
|
|
6
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
9
7
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
10
8
|
readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
11
9
|
readonly type: v.LiteralSchema<"person", undefined>;
|
|
@@ -18,7 +16,7 @@ export declare const notionUserListSchema: v.ObjectSchema<{
|
|
|
18
16
|
readonly object: v.LiteralSchema<"list", undefined>;
|
|
19
17
|
readonly results: v.ArraySchema<v.ObjectSchema<{
|
|
20
18
|
readonly object: v.LiteralSchema<"user", undefined>;
|
|
21
|
-
readonly id: v.StringSchema<undefined>;
|
|
19
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
22
20
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
23
21
|
readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
24
22
|
readonly type: v.LiteralSchema<"person", undefined>;
|
|
@@ -32,5 +30,4 @@ export declare const notionUserListSchema: v.ObjectSchema<{
|
|
|
32
30
|
readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
33
31
|
}, undefined>;
|
|
34
32
|
export type NotionUserList = v.InferOutput<typeof notionUserListSchema>;
|
|
35
|
-
export {};
|
|
36
33
|
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/users/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/users/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,kBAAkB,+FAA8C,CAAA;AAC7E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,gBAAgB;;;;;;;;;aAS3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;aAO/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
export const notionUserIdSchema = v.pipe(v.string(), v.brand("NotionUserId"));
|
|
2
3
|
export const notionUserSchema = v.object({
|
|
3
4
|
object: v.literal("user"),
|
|
4
|
-
id:
|
|
5
|
+
id: notionUserIdSchema,
|
|
5
6
|
name: v.optional(v.string()),
|
|
6
7
|
avatar_url: v.nullable(v.string()),
|
|
7
8
|
type: v.literal("person"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/standalonePreview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/standalonePreview.ts"],"names":[],"mappings":"AAaA,wBAAgB,0BAA0B,SAuBzC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_CONTRAST_MODE } from "../protocol/contrast.js";
|
|
2
2
|
import { notionBlockIdSchema, notionPageIdSchema, } from "../protocol/ids.js";
|
|
3
|
+
import { notionUserIdSchema } from "../protocol/users/user.js";
|
|
3
4
|
import * as v from "valibot";
|
|
4
5
|
import { customBlockHost } from "../bridge/sandboxClient.js";
|
|
5
6
|
const previewBlockId = v.parse(notionBlockIdSchema, "");
|
|
6
7
|
const previewPageId = v.parse(notionPageIdSchema, "");
|
|
8
|
+
const previewUserId = v.parse(notionUserIdSchema, "");
|
|
7
9
|
export function seedStandalonePreviewState() {
|
|
8
10
|
customBlockHost.setMockState({
|
|
9
11
|
type: "init",
|
|
@@ -18,7 +20,7 @@ export function seedStandalonePreviewState() {
|
|
|
18
20
|
dataSources: { bindings: {} },
|
|
19
21
|
currentUser: {
|
|
20
22
|
object: "user",
|
|
21
|
-
id:
|
|
23
|
+
id: previewUserId,
|
|
22
24
|
name: "Preview User",
|
|
23
25
|
avatar_url: null,
|
|
24
26
|
type: "person",
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -98,6 +98,7 @@ export class SandboxBridge {
|
|
|
98
98
|
private initializationId: string | undefined
|
|
99
99
|
private latestDataSourceBindings: NotionDataSourceBindings = {}
|
|
100
100
|
private isMockState = false
|
|
101
|
+
private isListening = false
|
|
101
102
|
private resolveInit: (() => void) | undefined
|
|
102
103
|
private rejectInit: ((reason: Error) => void) | undefined
|
|
103
104
|
private readonly initMessage: Promise<void> = new Promise(
|
|
@@ -107,13 +108,12 @@ export class SandboxBridge {
|
|
|
107
108
|
},
|
|
108
109
|
)
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// the constructor just attaches the listener.
|
|
114
|
-
if (typeof window !== "undefined") {
|
|
115
|
-
window.addEventListener("message", this.handleMessage)
|
|
111
|
+
startListening() {
|
|
112
|
+
if (this.isListening || typeof window === "undefined") {
|
|
113
|
+
return
|
|
116
114
|
}
|
|
115
|
+
this.isListening = true
|
|
116
|
+
window.addEventListener("message", this.handleMessage)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
private static MAX_LOG_ENTRIES = 100
|
|
@@ -22,23 +22,34 @@ import { type MessageLogEntry, SandboxBridge } from "./SandboxBridge.js"
|
|
|
22
22
|
|
|
23
23
|
export type { MessageLogEntry }
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
let bridge: SandboxBridge | undefined
|
|
26
|
+
|
|
27
|
+
function getBridge(): SandboxBridge {
|
|
28
|
+
if (!bridge) {
|
|
29
|
+
bridge = new SandboxBridge()
|
|
30
|
+
}
|
|
31
|
+
return bridge
|
|
32
|
+
}
|
|
26
33
|
|
|
27
34
|
export const customBlockHost = {
|
|
35
|
+
start: () => {
|
|
36
|
+
getBridge().startListening()
|
|
37
|
+
},
|
|
38
|
+
|
|
28
39
|
sendConnect: (manifestResult: ManifestLoadResult) => {
|
|
29
|
-
|
|
40
|
+
getBridge().sendConnect(manifestResult)
|
|
30
41
|
},
|
|
31
42
|
|
|
32
43
|
awaitInit: (signal?: AbortSignal): Promise<void> => {
|
|
33
|
-
return
|
|
44
|
+
return getBridge().awaitInit(signal)
|
|
34
45
|
},
|
|
35
46
|
|
|
36
47
|
subscribe: (listener: () => void) => {
|
|
37
|
-
return
|
|
48
|
+
return getBridge().subscribe(listener)
|
|
38
49
|
},
|
|
39
50
|
|
|
40
51
|
getState: (): CustomBlockHostState => {
|
|
41
|
-
return
|
|
52
|
+
return getBridge().getHostState()
|
|
42
53
|
},
|
|
43
54
|
|
|
44
55
|
/**
|
|
@@ -46,17 +57,17 @@ export const customBlockHost = {
|
|
|
46
57
|
* standalone preview state.
|
|
47
58
|
*/
|
|
48
59
|
setMockState: (message: InitMessage) => {
|
|
49
|
-
|
|
60
|
+
getBridge().setMockState(message)
|
|
50
61
|
},
|
|
51
62
|
|
|
52
63
|
postResize: (height: number) => {
|
|
53
|
-
|
|
64
|
+
getBridge().postResize(height)
|
|
54
65
|
},
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
export const customBlockDataSources = {
|
|
58
69
|
query: (key: string, options?: UseDataSourceOptions) => {
|
|
59
|
-
|
|
70
|
+
getBridge().queryDataSource(key, options)
|
|
60
71
|
},
|
|
61
72
|
|
|
62
73
|
getView: (
|
|
@@ -64,18 +75,18 @@ export const customBlockDataSources = {
|
|
|
64
75
|
key: string,
|
|
65
76
|
): DataSourceQueryView => {
|
|
66
77
|
return getDataSourceQueryViewWithBridge(hostState, key, args =>
|
|
67
|
-
|
|
78
|
+
getBridge().updateDataSourcePage(args),
|
|
68
79
|
)
|
|
69
80
|
},
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
export const messageLog = {
|
|
73
84
|
getSnapshot: (): readonly MessageLogEntry[] => {
|
|
74
|
-
return
|
|
85
|
+
return getBridge().getMessageLog()
|
|
75
86
|
},
|
|
76
87
|
|
|
77
88
|
subscribe: (listener: () => void) => {
|
|
78
|
-
return
|
|
89
|
+
return getBridge().subscribeToMessageLog(listener)
|
|
79
90
|
},
|
|
80
91
|
}
|
|
81
92
|
|
|
@@ -87,28 +98,28 @@ export const pages = {
|
|
|
87
98
|
* Creates a new Notion page.
|
|
88
99
|
*/
|
|
89
100
|
create: (input: CreatePageArgs): Promise<CreatePageResult> => {
|
|
90
|
-
return
|
|
101
|
+
return getBridge().createPage(input)
|
|
91
102
|
},
|
|
92
103
|
|
|
93
104
|
/**
|
|
94
105
|
* Fetches a page by id.
|
|
95
106
|
*/
|
|
96
107
|
get: (pageId: NotionPageId): Promise<GetPageResult> => {
|
|
97
|
-
return
|
|
108
|
+
return getBridge().getPage(pageId)
|
|
98
109
|
},
|
|
99
110
|
|
|
100
111
|
/**
|
|
101
112
|
* Updates an existing page.
|
|
102
113
|
*/
|
|
103
114
|
update: (input: UpdatePageArgs): Promise<UpdatePageResult> => {
|
|
104
|
-
return
|
|
115
|
+
return getBridge().updatePage(input)
|
|
105
116
|
},
|
|
106
117
|
|
|
107
118
|
/**
|
|
108
119
|
* Soft-delete a page by archiving it.
|
|
109
120
|
*/
|
|
110
121
|
delete: (pageId: NotionPageId): Promise<UpdatePageResult> => {
|
|
111
|
-
return
|
|
122
|
+
return getBridge().updatePage({ pageId, archived: true })
|
|
112
123
|
},
|
|
113
124
|
}
|
|
114
125
|
|
|
@@ -120,13 +131,13 @@ export const users = {
|
|
|
120
131
|
* Lists users visible in the current custom block workspace.
|
|
121
132
|
*/
|
|
122
133
|
list: (input?: ListUsersArgs): Promise<ListUsersResult> => {
|
|
123
|
-
return
|
|
134
|
+
return getBridge().listUsers(input)
|
|
124
135
|
},
|
|
125
136
|
|
|
126
137
|
/**
|
|
127
138
|
* Fetches a user by id.
|
|
128
139
|
*/
|
|
129
140
|
get: (userId: NotionUserId): Promise<GetUserResult> => {
|
|
130
|
-
return
|
|
141
|
+
return getBridge().getUser(userId)
|
|
131
142
|
},
|
|
132
143
|
}
|
package/src/init.ts
CHANGED
|
@@ -3,11 +3,13 @@ import {
|
|
|
3
3
|
notionBlockIdSchema,
|
|
4
4
|
notionPageIdSchema,
|
|
5
5
|
} from "@notionhq/custom-blocks-protocol/ids.js"
|
|
6
|
+
import { notionUserIdSchema } from "@notionhq/custom-blocks-protocol/users/user.js"
|
|
6
7
|
import * as v from "valibot"
|
|
7
8
|
import { customBlockHost } from "../bridge/sandboxClient.js"
|
|
8
9
|
|
|
9
10
|
const previewBlockId = v.parse(notionBlockIdSchema, "")
|
|
10
11
|
const previewPageId = v.parse(notionPageIdSchema, "")
|
|
12
|
+
const previewUserId = v.parse(notionUserIdSchema, "")
|
|
11
13
|
|
|
12
14
|
export function seedStandalonePreviewState() {
|
|
13
15
|
customBlockHost.setMockState({
|
|
@@ -23,7 +25,7 @@ export function seedStandalonePreviewState() {
|
|
|
23
25
|
dataSources: { bindings: {} },
|
|
24
26
|
currentUser: {
|
|
25
27
|
object: "user",
|
|
26
|
-
id:
|
|
28
|
+
id: previewUserId,
|
|
27
29
|
name: "Preview User",
|
|
28
30
|
avatar_url: null,
|
|
29
31
|
type: "person",
|