create-ncblock 0.0.26 → 0.0.28
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 +48 -1
package/package.json
CHANGED
package/sdk-version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.0.
|
|
1
|
+
{"version":"0.0.26"}
|
|
@@ -37,6 +37,7 @@ type NotionInitFixture =
|
|
|
37
37
|
| "no-ready"
|
|
38
38
|
| "invalid-ready"
|
|
39
39
|
| "invalid-manifest"
|
|
40
|
+
| "unsupported-protocol-version"
|
|
40
41
|
type TrackedPage = {
|
|
41
42
|
page: NotionPage
|
|
42
43
|
draftTitle: string
|
|
@@ -316,6 +317,48 @@ function DevOnlyInvalidManifestFixture() {
|
|
|
316
317
|
)
|
|
317
318
|
}
|
|
318
319
|
|
|
320
|
+
function DevOnlyUnsupportedProtocolVersionFixture() {
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (window.parent === window) {
|
|
323
|
+
return
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Dev-only fixture for local manual testing of Notion host init error UI.
|
|
327
|
+
// This intentionally bypasses the SDK so the host receives a ready message
|
|
328
|
+
// with a bridge protocol version below the host minimum.
|
|
329
|
+
window.parent.postMessage(
|
|
330
|
+
{
|
|
331
|
+
type: "ready",
|
|
332
|
+
bridgeProtocolVersion: 1,
|
|
333
|
+
manifest: null,
|
|
334
|
+
},
|
|
335
|
+
"*",
|
|
336
|
+
)
|
|
337
|
+
}, [])
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<div className="min-h-screen bg-(--app-bg) p-8 text-(--foreground)">
|
|
341
|
+
<div className={cardClass}>
|
|
342
|
+
<div className={labelClass}>Local init fixture</div>
|
|
343
|
+
<h1 className="mt-2 text-[24px] font-semibold">
|
|
344
|
+
Unsupported protocol version
|
|
345
|
+
</h1>
|
|
346
|
+
<p className="mt-2 text-sm leading-6 text-(--muted)">
|
|
347
|
+
This dev-only fixture posts a <code>ready</code> message with bridge
|
|
348
|
+
protocol version <code>1</code> and does not mount the SDK provider.
|
|
349
|
+
Use it only for local manual testing of Notion host init error UI.
|
|
350
|
+
</p>
|
|
351
|
+
<DevOnlyHostErrorExpectation>
|
|
352
|
+
This page is the pre-error fixture, not the Notion error state. In the
|
|
353
|
+
Notion host, set the host minimum bridge protocol version above{" "}
|
|
354
|
+
<code>1</code>; the host-owned unsupported protocol version error
|
|
355
|
+
should then cover this page.
|
|
356
|
+
</DevOnlyHostErrorExpectation>
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
)
|
|
360
|
+
}
|
|
361
|
+
|
|
319
362
|
function DevOnlyHostErrorExpectation(props: { children: React.ReactNode }) {
|
|
320
363
|
return (
|
|
321
364
|
<div className="mt-3 rounded-md border border-(--border) bg-(--app-bg) px-3 py-2 text-sm leading-6 text-(--foreground)">
|
|
@@ -353,7 +396,8 @@ function getNotionInitFixture(): NotionInitFixture {
|
|
|
353
396
|
if (
|
|
354
397
|
fixture === "no-ready" ||
|
|
355
398
|
fixture === "invalid-ready" ||
|
|
356
|
-
fixture === "invalid-manifest"
|
|
399
|
+
fixture === "invalid-manifest" ||
|
|
400
|
+
fixture === "unsupported-protocol-version"
|
|
357
401
|
) {
|
|
358
402
|
return fixture
|
|
359
403
|
}
|
|
@@ -2127,6 +2171,9 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
|
2127
2171
|
{notionInitFixture === "invalid-manifest" && (
|
|
2128
2172
|
<DevOnlyInvalidManifestFixture />
|
|
2129
2173
|
)}
|
|
2174
|
+
{notionInitFixture === "unsupported-protocol-version" && (
|
|
2175
|
+
<DevOnlyUnsupportedProtocolVersionFixture />
|
|
2176
|
+
)}
|
|
2130
2177
|
{notionInitFixture === "normal" && (
|
|
2131
2178
|
<NotionCustomBlock errorFallback={DebugInitErrorFallback}>
|
|
2132
2179
|
<App />
|