create-ncblock 0.0.37 → 0.0.39
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/package.json +1 -1
- package/sdk-version.json +1 -1
- package/templates/debug/src/index.tsx +62 -4
package/package.json
CHANGED
package/sdk-version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.0.
|
|
1
|
+
{"version":"0.0.39"}
|
|
@@ -42,6 +42,7 @@ type NotionInitFixture =
|
|
|
42
42
|
| "invalid-ready"
|
|
43
43
|
| "invalid-manifest"
|
|
44
44
|
| "unsupported-protocol-version"
|
|
45
|
+
| "legacy-ready-v1"
|
|
45
46
|
type TrackedPage = {
|
|
46
47
|
page: NotionPage
|
|
47
48
|
draftTitle: string
|
|
@@ -56,6 +57,11 @@ const metaTextClass =
|
|
|
56
57
|
"font-mono text-[11px] font-normal normal-case tracking-normal text-(--muted)"
|
|
57
58
|
const HOST_NO_READY_ERROR_DELAY_SECONDS = 5
|
|
58
59
|
|
|
60
|
+
function makeMockDataSourceId(value: number): NotionDataSourceId {
|
|
61
|
+
return `00000000-0000-4000-8000-${String(value).padStart(12, "0")}` as NotionDataSourceId
|
|
62
|
+
}
|
|
63
|
+
const DEFAULT_QUERY_DATA_SOURCE_ID = makeMockDataSourceId(1)
|
|
64
|
+
|
|
59
65
|
function App() {
|
|
60
66
|
const blockId = useBlockId()
|
|
61
67
|
const parent = useParent()
|
|
@@ -286,7 +292,8 @@ function DevOnlyInvalidManifestFixture() {
|
|
|
286
292
|
window.parent.postMessage(
|
|
287
293
|
{
|
|
288
294
|
type: "ready",
|
|
289
|
-
|
|
295
|
+
status: "success",
|
|
296
|
+
bridgeProtocolVersion: 2,
|
|
290
297
|
manifest: {
|
|
291
298
|
version: 1,
|
|
292
299
|
dataSources: {
|
|
@@ -339,6 +346,7 @@ function DevOnlyUnsupportedProtocolVersionFixture() {
|
|
|
339
346
|
window.parent.postMessage(
|
|
340
347
|
{
|
|
341
348
|
type: "ready",
|
|
349
|
+
status: "success",
|
|
342
350
|
bridgeProtocolVersion: 1,
|
|
343
351
|
manifest: null,
|
|
344
352
|
},
|
|
@@ -369,6 +377,49 @@ function DevOnlyUnsupportedProtocolVersionFixture() {
|
|
|
369
377
|
)
|
|
370
378
|
}
|
|
371
379
|
|
|
380
|
+
function DevOnlyLegacyReadyV1Fixture() {
|
|
381
|
+
useEffect(() => {
|
|
382
|
+
if (window.parent === window) {
|
|
383
|
+
return
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Dev-only fixture for local manual testing of Notion host init error UI.
|
|
387
|
+
// This intentionally bypasses the SDK and sends the legacy protocol-v1
|
|
388
|
+
// ready shape that existed before ready messages carried `status`.
|
|
389
|
+
window.parent.postMessage(
|
|
390
|
+
{
|
|
391
|
+
type: "ready",
|
|
392
|
+
bridgeProtocolVersion: 1,
|
|
393
|
+
manifest: null,
|
|
394
|
+
},
|
|
395
|
+
"*",
|
|
396
|
+
)
|
|
397
|
+
}, [])
|
|
398
|
+
|
|
399
|
+
return (
|
|
400
|
+
<div className="min-h-screen bg-(--app-bg) p-8 text-(--foreground)">
|
|
401
|
+
<div className={cardClass}>
|
|
402
|
+
<div className={labelClass}>Local init fixture</div>
|
|
403
|
+
<h1 className="mt-2 text-[24px] font-semibold">
|
|
404
|
+
Legacy ready protocol v1
|
|
405
|
+
</h1>
|
|
406
|
+
<p className="mt-2 text-sm leading-6 text-(--muted)">
|
|
407
|
+
This dev-only fixture posts the old <code>ready</code> message shape
|
|
408
|
+
without a <code>status</code> field and with bridge protocol version{" "}
|
|
409
|
+
<code>1</code>. It does not mount the SDK provider. Use it only for
|
|
410
|
+
local manual testing of Notion host init error UI.
|
|
411
|
+
</p>
|
|
412
|
+
<DevOnlyHostErrorExpectation>
|
|
413
|
+
This page is the pre-error fixture, not the Notion error state. In the
|
|
414
|
+
Notion host, set the host minimum bridge protocol version above{" "}
|
|
415
|
+
<code>1</code>; the host-owned unsupported protocol version error
|
|
416
|
+
should cover this page.
|
|
417
|
+
</DevOnlyHostErrorExpectation>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
)
|
|
421
|
+
}
|
|
422
|
+
|
|
372
423
|
function DevOnlyHostErrorExpectation(props: { children: React.ReactNode }) {
|
|
373
424
|
return (
|
|
374
425
|
<div className="mt-3 rounded-md border border-(--border) bg-(--app-bg) px-3 py-2 text-sm leading-6 text-(--foreground)">
|
|
@@ -407,7 +458,8 @@ function getNotionInitFixture(): NotionInitFixture {
|
|
|
407
458
|
fixture === "no-ready" ||
|
|
408
459
|
fixture === "invalid-ready" ||
|
|
409
460
|
fixture === "invalid-manifest" ||
|
|
410
|
-
fixture === "unsupported-protocol-version"
|
|
461
|
+
fixture === "unsupported-protocol-version" ||
|
|
462
|
+
fixture === "legacy-ready-v1"
|
|
411
463
|
) {
|
|
412
464
|
return fixture
|
|
413
465
|
}
|
|
@@ -1453,7 +1505,8 @@ const PRESETS: {
|
|
|
1453
1505
|
label: "ready",
|
|
1454
1506
|
createMessage: () => ({
|
|
1455
1507
|
type: "ready",
|
|
1456
|
-
|
|
1508
|
+
status: "success",
|
|
1509
|
+
bridgeProtocolVersion: 2,
|
|
1457
1510
|
manifest: null,
|
|
1458
1511
|
}),
|
|
1459
1512
|
},
|
|
@@ -1471,7 +1524,11 @@ const PRESETS: {
|
|
|
1471
1524
|
createMessage: () => ({
|
|
1472
1525
|
type: "queryDataSource",
|
|
1473
1526
|
requestId: "debug-query",
|
|
1474
|
-
|
|
1527
|
+
snapshotId: JSON.stringify({
|
|
1528
|
+
dataSourceId: DEFAULT_QUERY_DATA_SOURCE_ID,
|
|
1529
|
+
limit: 20,
|
|
1530
|
+
}),
|
|
1531
|
+
dataSourceId: DEFAULT_QUERY_DATA_SOURCE_ID,
|
|
1475
1532
|
limit: 20,
|
|
1476
1533
|
}),
|
|
1477
1534
|
},
|
|
@@ -2189,6 +2246,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
|
2189
2246
|
{notionInitFixture === "unsupported-protocol-version" && (
|
|
2190
2247
|
<DevOnlyUnsupportedProtocolVersionFixture />
|
|
2191
2248
|
)}
|
|
2249
|
+
{notionInitFixture === "legacy-ready-v1" && <DevOnlyLegacyReadyV1Fixture />}
|
|
2192
2250
|
{notionInitFixture === "normal" && (
|
|
2193
2251
|
<NotionCustomBlock errorFallback={DebugInitErrorFallback}>
|
|
2194
2252
|
<App />
|