@storystick/next 0.2.0-rc.0 → 0.2.0-rc.2
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/PUBLIC-API.md +2 -2
- package/dist/.source-hash +1 -1
- package/dist/preview/route-initial.js +21 -6
- package/dist/preview-error-surface.d.ts +1 -7
- package/dist/preview-error-surface.js +1 -23
- package/dist/server-runtime.js +21 -15
- package/dist/storystick-component.js +7 -3
- package/dist/storystick-preview-runtime.js +18 -10
- package/package.json +6 -6
package/PUBLIC-API.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @storystick/next API contract
|
|
2
2
|
|
|
3
|
-
Install this candidate explicitly with `@storystick/next@0.2.0-rc.
|
|
3
|
+
Install this candidate explicitly with `@storystick/next@0.2.0-rc.2` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
|
|
4
4
|
|
|
5
|
-
Version 0.2.0-rc.
|
|
5
|
+
Version 0.2.0-rc.2, cohort `sdk-0.2.0-rc.2`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
|
|
6
6
|
|
|
7
7
|
This package is a product integration facade. Reserved contracts are required between SDK packages and must be upgraded with the same cohort. Their public export paths do not promise independent stability.
|
|
8
8
|
|
package/dist/.source-hash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
211b14d8b654f14d3ad98557128d012e87d75573ab07151adeabe8bda3d331d1
|
|
@@ -6,7 +6,7 @@ import { getPreviewTransport, resolvePreviewRequestOrigin } from './internal.js'
|
|
|
6
6
|
import { primePreviewGrantAccess } from '@storystick/preview/server/extract-token';
|
|
7
7
|
import { resolveStorystickApplicationBuildId } from '../code-version.js';
|
|
8
8
|
import { buildPreviewGrantCookieFromActivation, setPreviewGrantCookieOnResponse, } from '@storystick/preview/server/route-session-cookie';
|
|
9
|
-
import {
|
|
9
|
+
import { previewInitialRouteErrorResponse, } from './route-errors.js';
|
|
10
10
|
import { PREVIEW_SESSION_QUERY_PARAM, PREVIEW_VARIANT_QUERY_PARAM, PREVIEW_RELEASE_QUERY_PARAM, PreviewScopeConflictError, createPreviewScope, writePreviewScopeToSearchParams, } from '@storystick/preview/identity';
|
|
11
11
|
const DEFAULTS = {
|
|
12
12
|
redirectParam: 'redirect',
|
|
@@ -19,7 +19,10 @@ export function createStorystickPreviewHandler(options = {}) {
|
|
|
19
19
|
const url = request.nextUrl;
|
|
20
20
|
const sessionId = url.searchParams.get(PREVIEW_SESSION_QUERY_PARAM);
|
|
21
21
|
if (!isSafePreviewSessionId(sessionId)) {
|
|
22
|
-
return withNoReferrer(
|
|
22
|
+
return withNoReferrer(previewInitialRouteErrorResponse(request, {
|
|
23
|
+
status: 400, code: 'PREVIEW_SESSION_MISSING', message: 'preview session selector is required',
|
|
24
|
+
category: 'validation', recoverable: true, retryable: false,
|
|
25
|
+
}));
|
|
23
26
|
}
|
|
24
27
|
let activation;
|
|
25
28
|
try {
|
|
@@ -27,7 +30,10 @@ export function createStorystickPreviewHandler(options = {}) {
|
|
|
27
30
|
}
|
|
28
31
|
catch (error) {
|
|
29
32
|
if (error instanceof PreviewActivationError) {
|
|
30
|
-
return withNoReferrer(
|
|
33
|
+
return withNoReferrer(previewInitialRouteErrorResponse(request, {
|
|
34
|
+
status: 400, code: 'PREVIEW_ACTIVATION_INVALID', message: 'preview activation is missing or malformed',
|
|
35
|
+
category: 'validation', recoverable: true, retryable: false,
|
|
36
|
+
}));
|
|
31
37
|
}
|
|
32
38
|
throw error;
|
|
33
39
|
}
|
|
@@ -38,7 +44,10 @@ export function createStorystickPreviewHandler(options = {}) {
|
|
|
38
44
|
catch (error) {
|
|
39
45
|
if (error instanceof PreviewRedirectError) {
|
|
40
46
|
console.warn('[storystick/preview] unsafe redirect rejected');
|
|
41
|
-
return withNoReferrer(
|
|
47
|
+
return withNoReferrer(previewInitialRouteErrorResponse(request, {
|
|
48
|
+
status: 400, code: 'PREVIEW_REDIRECT_UNSAFE', message: 'unsafe redirect',
|
|
49
|
+
category: 'validation', recoverable: true, retryable: false,
|
|
50
|
+
}));
|
|
42
51
|
}
|
|
43
52
|
throw error;
|
|
44
53
|
}
|
|
@@ -51,7 +60,10 @@ export function createStorystickPreviewHandler(options = {}) {
|
|
|
51
60
|
}
|
|
52
61
|
catch (error) {
|
|
53
62
|
if (error instanceof PreviewScopeConflictError) {
|
|
54
|
-
return withNoReferrer(
|
|
63
|
+
return withNoReferrer(previewInitialRouteErrorResponse(request, {
|
|
64
|
+
status: 400, code: 'PREVIEW_SCOPE_CONFLICT', message: 'preview cannot select a variant and a release together',
|
|
65
|
+
category: 'validation', recoverable: true, retryable: false,
|
|
66
|
+
}));
|
|
55
67
|
}
|
|
56
68
|
throw error;
|
|
57
69
|
}
|
|
@@ -89,7 +101,10 @@ export function createStorystickPreviewHandler(options = {}) {
|
|
|
89
101
|
exchange.previewOrigin !== requestOrigin ||
|
|
90
102
|
exchange.projectId !== (await getPreviewTransport()).projectId ||
|
|
91
103
|
exchange.grantExpiresAt <= Date.now()) {
|
|
92
|
-
return withNoReferrer(
|
|
104
|
+
return withNoReferrer(previewInitialRouteErrorResponse(request, {
|
|
105
|
+
status: 502, code: 'PREVIEW_GRANT_BINDING_MISMATCH', message: 'preview unavailable',
|
|
106
|
+
category: 'auth', recoverable: true, retryable: false,
|
|
107
|
+
}));
|
|
93
108
|
}
|
|
94
109
|
const cookie = buildPreviewGrantCookieFromActivation(exchange, Date.now(), resolveStorystickApplicationBuildId());
|
|
95
110
|
const draft = await draftMode();
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
code?: string | null;
|
|
3
|
-
studioUrl?: string | null;
|
|
4
|
-
}
|
|
5
|
-
/** A terminal Preview state owns its viewport, without changing customer DOM.
|
|
6
|
-
* Isolate product styling from the customer's page and its error boundary. */
|
|
7
|
-
export declare function PreviewErrorSurface({ code, studioUrl }: PreviewErrorSurfaceProps): import("react").JSX.Element;
|
|
1
|
+
export { PreviewTerminalState as PreviewErrorSurface, type PreviewTerminalStateProps as PreviewErrorSurfaceProps } from '@storystick/react/internal/preview-terminal-state';
|
|
@@ -1,24 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import { lookupSdkCopy } from '@storystick/preview/sdk-error-copy';
|
|
6
|
-
import { PreviewPanelMessage } from '@storystick/react/internal/preview-panel-state';
|
|
7
|
-
import { StorystickMark } from '@storystick/react/internal/storystick-mark';
|
|
8
|
-
/** A terminal Preview state owns its viewport, without changing customer DOM.
|
|
9
|
-
* Isolate product styling from the customer's page and its error boundary. */
|
|
10
|
-
export function PreviewErrorSurface({ code, studioUrl }) {
|
|
11
|
-
const copy = lookupSdkCopy(code);
|
|
12
|
-
const host = useRef(null);
|
|
13
|
-
const [root, setRoot] = useState(null);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (host.current)
|
|
16
|
-
setRoot(host.current.shadowRoot ?? host.current.attachShadow({ mode: 'open' }));
|
|
17
|
-
}, []);
|
|
18
|
-
return _jsx("div", { ref: host, "data-storystick-preview-error": "", "data-storystick-preview-controls": "", style: {
|
|
19
|
-
all: 'initial', position: 'fixed', inset: 0, zIndex: 2147483646, background: '#fafafa',
|
|
20
|
-
}, children: root ? createPortal(_jsxs("div", { style: {
|
|
21
|
-
boxSizing: 'border-box', minHeight: '100%', display: 'flex', flexDirection: 'column',
|
|
22
|
-
alignItems: 'center', justifyContent: 'center', padding: 24, color: '#18181b',
|
|
23
|
-
}, children: [_jsx(StorystickMark, { style: { width: 18, height: 18, marginBottom: 16, transform: 'rotate(90deg)' } }), _jsx(PreviewPanelMessage, { title: copy.title, description: copy.body, actions: studioUrl ? _jsx("a", { "data-ss-panel-action": "", href: studioUrl, children: "Return to Studio" }) : null, children: code || copy.commonCauses.length ? _jsxs("details", { children: [_jsx("summary", { children: "Technical details" }), code ? _jsx("pre", { children: code }) : null, copy.commonCauses.length ? _jsx("ul", { style: { textAlign: 'left', paddingLeft: 18 }, children: copy.commonCauses.map(cause => _jsx("li", { children: cause }, cause)) }) : null] }) : null })] }), root) : null });
|
|
24
|
-
}
|
|
2
|
+
export { PreviewTerminalState as PreviewErrorSurface } from '@storystick/react/internal/preview-terminal-state';
|
package/dist/server-runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { routeDataMatches } from '@storystick/types/public-delivery';
|
|
1
2
|
import { PUBLIC_RENDER_CHALLENGE_HEADER, isPublicRenderChallenge } from '@storystick/types/public-delivery';
|
|
2
3
|
import { fetchProjectLocaleSettings } from '@storystick/client/adapter';
|
|
3
4
|
import { createPublicRenderReceipt, createPublicSiteManifest } from '@storystick/client';
|
|
@@ -744,6 +745,21 @@ async function routes(storyTypes) {
|
|
|
744
745
|
// resolvePage — ADR-094 §1 Next façade
|
|
745
746
|
// ─────────────────────────────────────────────
|
|
746
747
|
import { resolveStorystickPage } from '@storystick/client/adapter';
|
|
748
|
+
function compilePublicPageData(declarations, querySchema) {
|
|
749
|
+
if (declarations === undefined)
|
|
750
|
+
return undefined;
|
|
751
|
+
if (!querySchema && Object.keys(declarations).length)
|
|
752
|
+
throw new TypeError('storystick/QUERY_INVALID: resolvePage data requires querySchema.');
|
|
753
|
+
return Object.fromEntries(Object.entries(declarations).map(([key, declaration]) => {
|
|
754
|
+
const limit = declaration.first === undefined ? 10_000 : Math.min(10_000, declaration.first);
|
|
755
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || !Object.hasOwn(querySchema.stories, declaration.query))
|
|
756
|
+
throw new TypeError('storystick/QUERY_INVALID: Invalid public page data declaration.');
|
|
757
|
+
return [key, { limit, ...(declaration.for ? { for: [...declaration.for] } : {}), query: {
|
|
758
|
+
version: 2, target: { kind: 'documents', storyType: declaration.query }, selection: { mode: 'all' }, cardinality: 'many',
|
|
759
|
+
page: { first: Math.min(100, limit) }, locale: { code: 'default', fallback: 'configured' }, generatedSchemaFingerprint: querySchema.fingerprint,
|
|
760
|
+
} }];
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
747
763
|
const resolveStorystickPageCached = cache(async (cacheKey, previewSessionId, previewRoutePathname, querySchema) => {
|
|
748
764
|
const input = JSON.parse(cacheKey);
|
|
749
765
|
// The site manifest must code authored values before the client hydrates
|
|
@@ -754,7 +770,7 @@ const resolveStorystickPageCached = cache(async (cacheKey, previewSessionId, pre
|
|
|
754
770
|
: {
|
|
755
771
|
sessionId: previewSessionId ?? null,
|
|
756
772
|
routePathname: previewRoutePathname,
|
|
757
|
-
}, input.publicOrigins ? { ...await readProjectLocaleSettings(), publicOrigins: input.publicOrigins } : undefined, true);
|
|
773
|
+
}, previewRoutePathname !== undefined && input.publicOrigins ? { ...await readProjectLocaleSettings(), publicOrigins: input.publicOrigins } : undefined, true);
|
|
758
774
|
return resolveStorystickPage(client, input);
|
|
759
775
|
});
|
|
760
776
|
function serializeResolvePageSearchParams(searchParams) {
|
|
@@ -882,6 +898,7 @@ export async function resolvePage(input) {
|
|
|
882
898
|
pathname: publicPathname,
|
|
883
899
|
locale: input.locale,
|
|
884
900
|
publicOrigins: input.publicOrigins,
|
|
901
|
+
dataQueries: compilePublicPageData(input.data, input.querySchema),
|
|
885
902
|
...(input.storyTypes ? { storyTypes: [...input.storyTypes] } : {}),
|
|
886
903
|
}), previewRequest?.sessionId, previewRequest?.routePathname, input.querySchema);
|
|
887
904
|
if (route.type === 'redirect') {
|
|
@@ -903,6 +920,7 @@ export async function resolvePage(input) {
|
|
|
903
920
|
declaration: input.data,
|
|
904
921
|
querySchema: input.querySchema,
|
|
905
922
|
document: route.document,
|
|
923
|
+
composedData: route.data,
|
|
906
924
|
storyType: route.storyType,
|
|
907
925
|
localeContext: route.localeContext,
|
|
908
926
|
previewRequest,
|
|
@@ -939,7 +957,7 @@ async function prepareResolvedPageRoute(input) {
|
|
|
939
957
|
// Public and Preview draft routes deliberately share this exact boundary.
|
|
940
958
|
attachDocumentLocaleRouting(input.document, input.localeContext);
|
|
941
959
|
const [data, document] = await Promise.all([
|
|
942
|
-
resolveDeclaredPageData({
|
|
960
|
+
input.composedData !== undefined ? Promise.resolve(input.composedData) : resolveDeclaredPageData({
|
|
943
961
|
declaration: input.declaration,
|
|
944
962
|
querySchema: input.querySchema,
|
|
945
963
|
document: input.document,
|
|
@@ -991,19 +1009,7 @@ async function resolveDeclaredPageData(input) {
|
|
|
991
1009
|
return Object.fromEntries(resolved);
|
|
992
1010
|
}
|
|
993
1011
|
function pageDataDeclarationMatchesRoute(input) {
|
|
994
|
-
|
|
995
|
-
if (conditions === undefined || conditions.length === 0)
|
|
996
|
-
return true;
|
|
997
|
-
for (const condition of conditions) {
|
|
998
|
-
if (typeof condition === 'string') {
|
|
999
|
-
if (input.sliceTypes().has(condition))
|
|
1000
|
-
return true;
|
|
1001
|
-
continue;
|
|
1002
|
-
}
|
|
1003
|
-
if (condition.storyType === input.storyType)
|
|
1004
|
-
return true;
|
|
1005
|
-
}
|
|
1006
|
-
return false;
|
|
1012
|
+
return routeDataMatches(input.declaration.for, input.storyType, input.sliceTypes);
|
|
1007
1013
|
}
|
|
1008
1014
|
async function readStorystickList(input) {
|
|
1009
1015
|
const context = input.localeContext ??
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { isPreviewBrowserContext } from "@storystick/preview/framework/browser-context";
|
|
3
|
+
import { isPreviewBrowserContext, hasExplicitPreviewBrowserContext, readStandalonePreviewSessionId } from "@storystick/preview/framework/browser-context";
|
|
4
|
+
import { PREVIEW_COPY } from '@storystick/preview/framework/preview-copy';
|
|
4
5
|
import { useEffect, useLayoutEffect, useState, useSyncExternalStore } from "react";
|
|
5
6
|
import { commitPreviewRenderReceipt } from '@storystick/preview/framework/render-receipt';
|
|
6
7
|
function subscribeEmbeddingContext() {
|
|
@@ -38,8 +39,11 @@ export function Storystick(props = {}) {
|
|
|
38
39
|
}, [active]);
|
|
39
40
|
if (!active)
|
|
40
41
|
return null;
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const projectId = props.projectId ?? process.env.NEXT_PUBLIC_STORYSTICK_PROJECT_ID;
|
|
43
|
+
const explicit = hasExplicitPreviewBrowserContext(projectId);
|
|
44
|
+
const invalidLink = window.parent === window && explicit && !readStandalonePreviewSessionId(projectId);
|
|
45
|
+
if (runtime.failed && explicit)
|
|
46
|
+
return (_jsxs("aside", { role: "status", "data-storystick-preview-controls": "", children: [PREVIEW_COPY[invalidLink ? 'opening-invalid' : 'runtime-unavailable'].title, ". ", PREVIEW_COPY[invalidLink ? 'opening-invalid' : 'runtime-unavailable'].body, !invalidLink ? _jsx("button", { type: "button", onClick: () => window.location.reload(), children: "Reload Preview" }) : null] }));
|
|
43
47
|
const Runtime = runtime.module?.StorystickPreviewRuntime;
|
|
44
48
|
return Runtime ? _jsx(Runtime, { ...props }) : null;
|
|
45
49
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { PREVIEW_COPY } from '@storystick/preview/framework/preview-copy';
|
|
4
|
+
import { hasExplicitPreviewBrowserContext } from '@storystick/preview/framework/browser-context';
|
|
5
|
+
import { readStandalonePreviewSessionId, readStandaloneStudioUrl } from '@storystick/preview/identity/browser-context';
|
|
4
6
|
import { ensureStandalonePreviewView, PreviewViewRecoveryError } from "./preview-view-bootstrap.js";
|
|
5
7
|
import { isPreviewBrowserContext } from "@storystick/preview/identity/browser-context";
|
|
6
8
|
import { PreviewStandaloneHost } from "./preview-standalone-host.js";
|
|
@@ -229,6 +231,7 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
229
231
|
// so the iframe sees a consistent (endpoint, convexUrl) pair.
|
|
230
232
|
const [infra, setInfra] = useState(null);
|
|
231
233
|
const [bootstrapError, setBootstrapError] = useState(null);
|
|
234
|
+
const [bootstrapSlow, setBootstrapSlow] = useState(false);
|
|
232
235
|
const [bootstrapAttempt, setBootstrapAttempt] = useState(0);
|
|
233
236
|
// Initialize the singleton on mount. Idempotent — StrictMode dev
|
|
234
237
|
// double-mount and HMR are both safe.
|
|
@@ -252,25 +255,24 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
252
255
|
const opts = buildInfraOptions(props);
|
|
253
256
|
const tokenRoute = storystickRouteForBasePath(basePath, STORYSTICK_PREVIEW_TOKEN_ROUTE_PATH);
|
|
254
257
|
let cancelled = false;
|
|
255
|
-
let timedOut = false;
|
|
256
258
|
const deadline = setTimeout(() => {
|
|
257
|
-
timedOut = true;
|
|
258
259
|
if (!cancelled)
|
|
259
|
-
|
|
260
|
+
setBootstrapSlow(true);
|
|
260
261
|
}, 10000);
|
|
261
262
|
setBootstrapError(null);
|
|
263
|
+
setBootstrapSlow(false);
|
|
262
264
|
void (async () => {
|
|
263
265
|
try {
|
|
264
266
|
const viewReady = ensureStandalonePreviewView(projectId);
|
|
265
267
|
// Keep explicit sync configuration fast; discovery and recovery are independent.
|
|
266
268
|
const discovered = resolveInfra(projectId, opts);
|
|
267
269
|
const boot = viewReady.then(async () => {
|
|
268
|
-
if (opts.convexUrl !== undefined && !cancelled
|
|
270
|
+
if (opts.convexUrl !== undefined && !cancelled)
|
|
269
271
|
void previewRuntime.init({ projectId, gatewaySyncUrl: opts.convexUrl, tokenRoute });
|
|
270
272
|
});
|
|
271
273
|
const [resolved] = await Promise.all([discovered, boot]);
|
|
272
274
|
clearTimeout(deadline);
|
|
273
|
-
if (cancelled
|
|
275
|
+
if (cancelled)
|
|
274
276
|
return;
|
|
275
277
|
setInfra(resolved);
|
|
276
278
|
if (opts.convexUrl === undefined)
|
|
@@ -278,10 +280,12 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
278
280
|
}
|
|
279
281
|
catch (err) {
|
|
280
282
|
if (!cancelled)
|
|
281
|
-
setBootstrapError(err instanceof PreviewViewRecoveryError ?
|
|
283
|
+
setBootstrapError(err instanceof PreviewViewRecoveryError ? PREVIEW_COPY['opening-invalid'].body : PREVIEW_COPY['connection-interrupted'].body);
|
|
282
284
|
}
|
|
283
285
|
finally {
|
|
284
286
|
clearTimeout(deadline);
|
|
287
|
+
if (!cancelled)
|
|
288
|
+
setBootstrapSlow(false);
|
|
285
289
|
}
|
|
286
290
|
})();
|
|
287
291
|
return () => {
|
|
@@ -449,6 +453,7 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
449
453
|
// Every live view observes the same end revision. Clear only that context,
|
|
450
454
|
// then refresh the native tree; a late tab cannot end a newer activation.
|
|
451
455
|
const endingContextRef = useRef(null);
|
|
456
|
+
const [exitAttempt, setExitAttempt] = useState(0);
|
|
452
457
|
useEffect(() => {
|
|
453
458
|
const context = state.readContext;
|
|
454
459
|
if (state.readContextStatus !== 'ended' || !context)
|
|
@@ -497,7 +502,7 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
497
502
|
previewRuntime.reportContextExitUnavailable(context);
|
|
498
503
|
}
|
|
499
504
|
})();
|
|
500
|
-
}, [basePath, router, state.readContext, state.readContextStatus]);
|
|
505
|
+
}, [basePath, router, state.readContext, state.readContextStatus, exitAttempt]);
|
|
501
506
|
// A projected content checkpoint updates native pages and layouts, including
|
|
502
507
|
// ordinary reads that returned null/empty. No per-component subscription.
|
|
503
508
|
useEffect(() => {
|
|
@@ -553,9 +558,12 @@ export function StorystickPreviewRuntime(props = {}) {
|
|
|
553
558
|
// of static rendering. Mounted on every render path, including the
|
|
554
559
|
// error branch, so the reverse channel keeps reporting even when
|
|
555
560
|
// preview state has degraded to `'error'`.
|
|
556
|
-
const
|
|
561
|
+
const invalidStandaloneLink = typeof window !== 'undefined' && window.parent === window &&
|
|
562
|
+
hasExplicitPreviewBrowserContext(readProjectId(props.projectId) ?? undefined) &&
|
|
563
|
+
readStandalonePreviewSessionId(readProjectId(props.projectId) ?? undefined) === null;
|
|
564
|
+
const reporter = (_jsxs(_Fragment, { children: [typeof window !== 'undefined' && window.parent === window && !invalidStandaloneLink && (state.state !== 'idle' || bootstrapError !== null || bootstrapSlow) && (_jsx(Suspense, { fallback: null, children: _jsx(PreviewStandaloneHost, { basePath: basePath, projectId: readProjectId(props.projectId), state: state, recovery: { error: bootstrapError, pending: bootstrapSlow, retry: () => setBootstrapAttempt(n => n + 1) } }) })), _jsx(PreviewProvenanceRuntimeLoader, { enabled: props.previewProvenanceRuntimeEnabled === true, source: props.previewProvenanceRuntimeSrc ??
|
|
557
565
|
storystickRouteForBasePath(basePath, STORYSTICK_PREVIEW_PROVENANCE_RUNTIME_ROUTE_PATH), sessionId: state.sessionId }), !props.resetRenderError && _jsx(Suspense, { fallback: null, children: _jsx(PreviewLocationReporter, { basePath: basePath }) })] }));
|
|
558
566
|
// Keep the controls at a stable React position through terminal failures so
|
|
559
567
|
// their last validated Studio destination survives a revoked session.
|
|
560
|
-
return _jsxs(_Fragment, { children: [state.state === "error" && _jsx(PreviewErrorSurface, { code: state.errorCode, studioUrl: state.standaloneStudioUrl ?? readStandaloneStudioUrl(readProjectId(props.projectId), state.sessionId) }), reporter] });
|
|
568
|
+
return _jsxs(_Fragment, { children: [(invalidStandaloneLink || state.state === "error" && (state.readContext !== null || hasExplicitPreviewBrowserContext(readProjectId(props.projectId) ?? undefined))) && _jsx(PreviewErrorSurface, { code: invalidStandaloneLink ? "PREVIEW_SESSION_MISSING" : state.errorCode, onRetryExit: state.readContextStatus === 'ended' ? () => { endingContextRef.current = null; setExitAttempt(attempt => attempt + 1); } : undefined, studioUrl: state.standaloneStudioUrl ?? readStandaloneStudioUrl(readProjectId(props.projectId), state.sessionId) }), reporter] });
|
|
561
569
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storystick/next",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.2",
|
|
4
4
|
"license": "FSL-1.1-MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"server-only": "^0.0.1",
|
|
91
|
-
"@storystick/
|
|
92
|
-
"@storystick/
|
|
93
|
-
"@storystick/
|
|
94
|
-
"@storystick/
|
|
95
|
-
"@storystick/
|
|
91
|
+
"@storystick/preview": "0.2.0-rc.2",
|
|
92
|
+
"@storystick/types": "0.1.0-rc.2",
|
|
93
|
+
"@storystick/client": "0.2.0-rc.2",
|
|
94
|
+
"@storystick/media": "0.2.0-rc.2",
|
|
95
|
+
"@storystick/react": "0.2.0-rc.2"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@testing-library/react": "^16.3.2",
|