@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.
Files changed (43) hide show
  1. package/dist/bridge/SandboxBridge.d.ts +2 -1
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +7 -5
  4. package/dist/bridge/sandboxClient.d.ts +1 -0
  5. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  6. package/dist/bridge/sandboxClient.js +26 -17
  7. package/dist/init.d.ts.map +1 -1
  8. package/dist/init.js +1 -0
  9. package/dist/protocol/dataSources/dataSource.d.ts +12 -12
  10. package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -1
  11. package/dist/protocol/ids.d.ts +10 -26
  12. package/dist/protocol/ids.d.ts.map +1 -1
  13. package/dist/protocol/ids.js +25 -5
  14. package/dist/protocol/messages/createPage.d.ts +8 -8
  15. package/dist/protocol/messages/createPageResult.d.ts +5 -5
  16. package/dist/protocol/messages/currentUserChanged.d.ts +1 -1
  17. package/dist/protocol/messages/dataSourcesChanged.d.ts +3 -3
  18. package/dist/protocol/messages/getPage.d.ts +6 -6
  19. package/dist/protocol/messages/getUser.d.ts +2 -2
  20. package/dist/protocol/messages/getUser.js +2 -2
  21. package/dist/protocol/messages/hostToSandbox.d.ts +45 -45
  22. package/dist/protocol/messages/init.d.ts +14 -14
  23. package/dist/protocol/messages/listUsers.d.ts +1 -1
  24. package/dist/protocol/messages/pageChanged.d.ts +5 -5
  25. package/dist/protocol/messages/parentChanged.d.ts +4 -4
  26. package/dist/protocol/messages/queryDataSource.d.ts +1 -1
  27. package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
  28. package/dist/protocol/messages/sandboxToHost.d.ts +8 -8
  29. package/dist/protocol/messages/updatePage.d.ts +1 -1
  30. package/dist/protocol/messages/updatePageResult.d.ts +5 -5
  31. package/dist/protocol/pages/page.d.ts +10 -10
  32. package/dist/protocol/parent.d.ts +4 -4
  33. package/dist/protocol/users/user.d.ts +4 -7
  34. package/dist/protocol/users/user.d.ts.map +1 -1
  35. package/dist/protocol/users/user.js +2 -1
  36. package/dist/react/standalonePreview.d.ts.map +1 -1
  37. package/dist/react/standalonePreview.js +3 -1
  38. package/dist/version.js +1 -1
  39. package/package.json +1 -1
  40. package/src/bridge/SandboxBridge.ts +6 -6
  41. package/src/bridge/sandboxClient.ts +28 -17
  42. package/src/init.ts +1 -0
  43. 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.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
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.CustomSchema<import("./ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
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 notionUserIdBrand: unique symbol;
3
- export type NotionUserId = string & {
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,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAA;AAE9C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAA;CAC5C,CAAA;AAED,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
+ {"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: v.string(),
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":"AAWA,wBAAgB,0BAA0B,SAuBzC"}
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
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.17"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.18"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -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
- constructor() {
111
- // `connect` is sent later by `initCustomBlock` (after the manifest fetch
112
- // resolves). Top-level / no-iframe rejection is handled there too, so
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
- const bridge = new SandboxBridge()
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
- bridge.sendConnect(manifestResult)
40
+ getBridge().sendConnect(manifestResult)
30
41
  },
31
42
 
32
43
  awaitInit: (signal?: AbortSignal): Promise<void> => {
33
- return bridge.awaitInit(signal)
44
+ return getBridge().awaitInit(signal)
34
45
  },
35
46
 
36
47
  subscribe: (listener: () => void) => {
37
- return bridge.subscribe(listener)
48
+ return getBridge().subscribe(listener)
38
49
  },
39
50
 
40
51
  getState: (): CustomBlockHostState => {
41
- return bridge.getHostState()
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
- bridge.setMockState(message)
60
+ getBridge().setMockState(message)
50
61
  },
51
62
 
52
63
  postResize: (height: number) => {
53
- bridge.postResize(height)
64
+ getBridge().postResize(height)
54
65
  },
55
66
  }
56
67
 
57
68
  export const customBlockDataSources = {
58
69
  query: (key: string, options?: UseDataSourceOptions) => {
59
- bridge.queryDataSource(key, options)
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
- bridge.updateDataSourcePage(args),
78
+ getBridge().updateDataSourcePage(args),
68
79
  )
69
80
  },
70
81
  }
71
82
 
72
83
  export const messageLog = {
73
84
  getSnapshot: (): readonly MessageLogEntry[] => {
74
- return bridge.getMessageLog()
85
+ return getBridge().getMessageLog()
75
86
  },
76
87
 
77
88
  subscribe: (listener: () => void) => {
78
- return bridge.subscribeToMessageLog(listener)
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 bridge.createPage(input)
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 bridge.getPage(pageId)
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 bridge.updatePage(input)
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 bridge.updatePage({ pageId, archived: true })
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 bridge.listUsers(input)
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 bridge.getUser(userId)
141
+ return getBridge().getUser(userId)
131
142
  },
132
143
  }
package/src/init.ts CHANGED
@@ -76,6 +76,7 @@ export function initCustomBlock(
76
76
  opts: InitCustomBlockOptions = {},
77
77
  ): Promise<CustomBlockInitPayload> {
78
78
  if (initPromise === undefined) {
79
+ customBlockHost.start()
79
80
  initPromise = performHandshake(opts)
80
81
  }
81
82
  return initPromise
@@ -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",