@storystick/preview 0.2.0-rc.1 → 0.2.0-rc.3

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # @storystick/preview API contract
2
2
 
3
- Install this candidate explicitly with `@storystick/preview@0.2.0-rc.1` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
3
+ Install this candidate explicitly with `@storystick/preview@0.2.0-rc.3` 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.1, cohort `sdk-0.2.0-rc.1`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
5
+ Version 0.2.0-rc.3, cohort `sdk-0.2.0-rc.3`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
6
6
 
7
7
  This package supports the integration facades; installing it directly is an advanced use. 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
 
@@ -49,7 +49,7 @@ This package supports the integration facades; installing it directly is an adva
49
49
  | `./provenance/render-context` | Reserved SDK contract |
50
50
  | `./provenance/slice-model` | Reserved SDK contract |
51
51
 
52
- The qualified toolchain is Node 24.19.0 and pnpm 9.15.9. Next uses App Router 15.5.28, Sharp 0.35.5 and React/React DOM 19.2.8; Astro uses 7.4.4 with the Node adapter 11.1.9. Browser delivery is verified by bundling; hosted Preview activation and cross-browser behavior require the staging manual check. Source/CLI are Node tools, server entries belong on the server, and browser entries must never receive a server API key.
52
+ Supported consumer Node versions: `^22.13.0 || ^24.19.0`. The release build toolchain remains Node 24.19.0 and pnpm 9.15.9. Next uses App Router 15.5.28, Sharp 0.35.5 and React/React DOM 19.2.8; Astro uses 7.4.4 with the Node adapter 11.1.9. Browser delivery is verified by bundling; hosted Preview activation and cross-browser behavior require the staging manual check. Source/CLI are Node tools, server entries belong on the server, and browser entries must never receive a server API key.
53
53
 
54
54
  This is a support/tooling contract. It does not independently grant project access or permission to perform effects.
55
55
 
package/README.md CHANGED
@@ -39,5 +39,7 @@ early provenance script, and suspends its bindings across pagehide/session chang
39
39
  ## Candidate distribution contract
40
40
 
41
41
  See [PUBLIC-API.md](./PUBLIC-API.md) for supported entries, reserved SDK contracts,
42
- the qualified runtime matrix and the candidate cohort. Upgrade Storystick
43
- packages together.
42
+ the qualified runtime matrix and the candidate cohort. Keep communicating
43
+ Preview contracts compatible. Independent changes can use the
44
+ [targeted package release path](../../release/README.md#prepare-only-the-required-scope);
45
+ do not republish every package solely because one adapter changed.
package/dist/.source-hash CHANGED
@@ -1 +1 @@
1
- bd76a6ce0bc6a45860a5c7a43beca2a761804917b32721b33339d3cbe862a05d
1
+ a5f163aae4bf2733892f4674626e581304e6173491f17c8ccdfea4886b0fa0a9
@@ -1,7 +1,8 @@
1
+ import { type StudioContentShapeDescriptor } from '@storystick/types';
1
2
  import type { PreviewPerspective, PreviewReadContext } from '@storystick/types/preview-query-targeting';
2
3
  import type { PreviewV2RevealSourceRequest, PreviewV2RevealSliceRequest } from '../provenance/reveal-contract.js';
3
4
  import type { ImperativeEditorNavigationTarget } from '@storystick/types/editor-destination';
4
- export declare const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION: 11;
5
+ export declare const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION: 12;
5
6
  export declare const STORYSTICK_AUTHORING_RUNTIME_GLOBAL: "StorystickAuthoringRuntime";
6
7
  export declare const STORYSTICK_AUTHORING_RUNTIME_PATH: "/authoring-runtime/authoring-runtime.js";
7
8
  export interface PreviewAuthoringAdmission {
@@ -12,6 +13,7 @@ export interface PreviewAuthoringAdmission {
12
13
  projectId: string;
13
14
  projectShortId: string;
14
15
  contentShapeCapability: string;
16
+ contentShapeDescriptor: StudioContentShapeDescriptor;
15
17
  token: string;
16
18
  /** Project/admission-bound Convex RPC authority; never use the public SDK token. */
17
19
  rpcToken: string;
@@ -1,4 +1,5 @@
1
- export const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION = 11;
1
+ import { isStudioContentShapeDescriptor } from '@storystick/types';
2
+ export const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION = 12;
2
3
  export const STORYSTICK_AUTHORING_RUNTIME_GLOBAL = 'StorystickAuthoringRuntime';
3
4
  export const STORYSTICK_AUTHORING_RUNTIME_PATH = '/authoring-runtime/authoring-runtime.js';
4
5
  export function isPreviewAuthoringAdmission(value, now = Date.now()) {
@@ -21,7 +22,8 @@ export function isPreviewAuthoringAdmission(value, now = Date.now()) {
21
22
  !Number.isFinite(files.expiresAt) ||
22
23
  files.expiresAt <= now)
23
24
  return false;
24
- return (['projectId', 'projectShortId', 'contentShapeCapability', 'token', 'rpcToken'].every((key) => typeof entry[key] === 'string' && entry[key] !== '') &&
25
+ return (isStudioContentShapeDescriptor(entry.contentShapeDescriptor) &&
26
+ ['projectId', 'projectShortId', 'contentShapeCapability', 'token', 'rpcToken'].every((key) => typeof entry[key] === 'string' && entry[key] !== '') &&
25
27
  typeof entry.expiresAt === 'number' &&
26
28
  Number.isFinite(entry.expiresAt) &&
27
29
  entry.expiresAt > now);
@@ -1,2 +1,2 @@
1
1
  /** Initial browser gate; no storage writers, transport or authenticated runtime. */
2
- export { isPreviewBrowserContext } from '../identity/browser-context-gate.js';
2
+ export { isPreviewBrowserContext, hasExplicitPreviewBrowserContext, readStandalonePreviewSessionId } from '../identity/browser-context-gate.js';
@@ -1,2 +1,2 @@
1
1
  /** Initial browser gate; no storage writers, transport or authenticated runtime. */
2
- export { isPreviewBrowserContext } from '../identity/browser-context-gate.js';
2
+ export { isPreviewBrowserContext, hasExplicitPreviewBrowserContext, readStandalonePreviewSessionId } from '../identity/browser-context-gate.js';
@@ -0,0 +1,362 @@
1
+ /** Product copy shared by Studio, embedded Preview and standalone views. */
2
+ export interface PreviewCopy {
3
+ readonly title: string;
4
+ readonly body: string;
5
+ }
6
+ export declare const PREVIEW_COPY: {
7
+ readonly setup: {
8
+ readonly title: "Set up your preview";
9
+ readonly body: "Add your site’s address to see it here while you edit.";
10
+ };
11
+ readonly "invalid-url": {
12
+ readonly title: "Check the preview address";
13
+ readonly body: "The configured address isn’t valid. Add an HTTP or HTTPS site address in Preview and origins.";
14
+ };
15
+ readonly "origins-missing": {
16
+ readonly title: "Finish preview setup";
17
+ readonly body: "Allow your site to connect to Storystick in Preview and origins.";
18
+ };
19
+ readonly "origin-forbidden": {
20
+ readonly title: "This site isn’t allowed";
21
+ readonly body: "This site isn’t included in the project’s allowed preview origins.";
22
+ };
23
+ readonly "project-mismatch": {
24
+ readonly title: "This site uses another project";
25
+ readonly body: "Check the preview address and the Storystick project connected to this site.";
26
+ };
27
+ readonly "document-empty": {
28
+ readonly title: "Open a document";
29
+ readonly body: "Its preview will appear here.";
30
+ };
31
+ readonly "document-context": {
32
+ readonly title: "Preview this content on a page";
33
+ readonly body: "This document has no preview of its own. Open it from a page that uses it.";
34
+ };
35
+ readonly "route-unmapped": {
36
+ readonly title: "Page without a document";
37
+ readonly body: "This page isn’t linked to a Storystick document. The editor is still on {document}.";
38
+ };
39
+ readonly "another-page": {
40
+ readonly title: "Preview shows another page";
41
+ readonly body: "You’re editing {document}. The preview shows {page}.";
42
+ };
43
+ readonly preparing: {
44
+ readonly title: "Preparing preview";
45
+ readonly body: "Your site will appear here when it’s ready.";
46
+ };
47
+ readonly "page-loading": {
48
+ readonly title: "Loading your site";
49
+ readonly body: "Waiting for the page to respond.";
50
+ };
51
+ readonly connecting: {
52
+ readonly title: "Connecting preview";
53
+ readonly body: "Connecting this site to Studio.";
54
+ };
55
+ readonly "workspace-creating": {
56
+ readonly title: "Starting working preview";
57
+ readonly body: "Preparing the environment for this working version.";
58
+ };
59
+ readonly "workspace-restoring": {
60
+ readonly title: "Resuming working preview";
61
+ readonly body: "Restoring the environment and its saved changes.";
62
+ };
63
+ readonly "workspace-installing": {
64
+ readonly title: "Preparing the project";
65
+ readonly body: "Installing the project’s dependencies. The first start can take longer.";
66
+ };
67
+ readonly "workspace-checking": {
68
+ readonly title: "Checking the project";
69
+ readonly body: "Checking this version before starting the site.";
70
+ };
71
+ readonly "workspace-launching": {
72
+ readonly title: "Starting the site";
73
+ readonly body: "Starting the working preview server.";
74
+ };
75
+ readonly "retained-loading": {
76
+ readonly title: "Loading {page}";
77
+ readonly body: "The previous page is still shown.";
78
+ };
79
+ readonly updating: {
80
+ readonly title: "Updating preview";
81
+ readonly body: "Waiting for the updated page.";
82
+ };
83
+ readonly "taking-longer": {
84
+ readonly title: "Preview is taking longer";
85
+ readonly body: "We’re still waiting for the requested page.";
86
+ };
87
+ readonly reconnect: {
88
+ readonly title: "Reconnect your preview";
89
+ readonly body: "This preview connection is no longer valid. Reconnect to continue.";
90
+ };
91
+ readonly "deployment-changed": {
92
+ readonly title: "The site has changed";
93
+ readonly body: "Reconnect preview to use the current site deployment.";
94
+ };
95
+ readonly "open-from-studio": {
96
+ readonly title: "Open preview from Studio";
97
+ readonly body: "Start a new preview from Studio to connect this page.";
98
+ };
99
+ readonly "connection-interrupted": {
100
+ readonly title: "Preview connection interrupted";
101
+ readonly body: "The connection couldn’t be restored. Reconnect preview to continue.";
102
+ };
103
+ readonly "access-unavailable": {
104
+ readonly title: "Preview access unavailable";
105
+ readonly body: "This preview is no longer available with your current access. Return to Studio to open an available view.";
106
+ };
107
+ readonly "view-unavailable": {
108
+ readonly title: "This view is no longer available";
109
+ readonly body: "Choose an available version in Studio, then open preview again.";
110
+ };
111
+ readonly ended: {
112
+ readonly title: "Preview ended";
113
+ readonly body: "This preview was closed. Return to Studio to start another.";
114
+ };
115
+ readonly "exit-incomplete": {
116
+ readonly title: "Preview hasn’t fully closed";
117
+ readonly body: "The shared preview ended, but this tab couldn’t leave preview mode.";
118
+ };
119
+ readonly "admission-superseded": {
120
+ readonly title: "Preview changed in another view";
121
+ readonly body: "Reconnect to follow the current preview.";
122
+ };
123
+ readonly "connection-mismatch": {
124
+ readonly title: "Preview couldn’t connect";
125
+ readonly body: "The site and Studio couldn’t establish the same preview session.";
126
+ };
127
+ readonly "integration-update": {
128
+ readonly title: "Preview integration needs an update";
129
+ readonly body: "A developer needs to update the site’s preview integration before Studio can connect.";
130
+ };
131
+ readonly "content-unavailable": {
132
+ readonly title: "Preview content unavailable";
133
+ readonly body: "The content service couldn’t answer this page’s request.";
134
+ };
135
+ readonly "render-failed": {
136
+ readonly title: "This page couldn’t load";
137
+ readonly body: "The site couldn’t render this page. You can keep editing or open another page.";
138
+ };
139
+ readonly "update-failed": {
140
+ readonly title: "Preview couldn’t update";
141
+ readonly body: "The requested page wasn’t confirmed. Try opening it again.";
142
+ };
143
+ readonly "scope-mismatch": {
144
+ readonly title: "Preview shows another version";
145
+ readonly body: "The site hasn’t confirmed the version selected in Studio.";
146
+ };
147
+ readonly "selection-superseded": {
148
+ readonly title: "The version changed";
149
+ readonly body: "Your selection was replaced before the preview finished updating.";
150
+ };
151
+ readonly "version-unavailable": {
152
+ readonly title: "This version couldn’t open";
153
+ readonly body: "Choose the version again, or return to another available version.";
154
+ };
155
+ readonly "route-lookup-failed": {
156
+ readonly title: "Page connection unavailable";
157
+ readonly body: "Studio couldn’t identify the document for this page.";
158
+ };
159
+ readonly "sync-failed": {
160
+ readonly title: "This page couldn’t be shown";
161
+ readonly body: "Preview didn’t confirm the document you requested.";
162
+ };
163
+ readonly unavailable: {
164
+ readonly title: "Preview is unavailable";
165
+ readonly body: "Studio couldn’t prepare this preview. Try again, or share the diagnostic with your project administrator.";
166
+ };
167
+ readonly busy: {
168
+ readonly title: "Preview is temporarily busy";
169
+ readonly body: "The service couldn’t accept this request yet.";
170
+ };
171
+ readonly "visual-connecting": {
172
+ readonly title: "Connecting visual editing";
173
+ readonly body: "";
174
+ };
175
+ readonly "visual-limited": {
176
+ readonly title: "Visual editing is limited";
177
+ readonly body: "Some elements can’t be selected on this page. You can still edit their content in Studio.";
178
+ };
179
+ readonly "visual-update": {
180
+ readonly title: "Visual editing needs an update";
181
+ readonly body: "The page is available, but a developer needs to update its editing integration.";
182
+ };
183
+ readonly "visual-partial": {
184
+ readonly title: "Some elements aren’t selectable";
185
+ readonly body: "";
186
+ };
187
+ readonly "visual-empty": {
188
+ readonly title: "No editable elements on this page";
189
+ readonly body: "";
190
+ };
191
+ readonly "visual-unavailable": {
192
+ readonly title: "Page selection unavailable";
193
+ readonly body: "The page’s editing controls couldn’t be confirmed. You can continue editing in Studio.";
194
+ };
195
+ readonly "minimap-unavailable": {
196
+ readonly title: "Minimap unavailable for this page";
197
+ readonly body: "Open Preview to view this page without the minimap.";
198
+ };
199
+ readonly "marker-diagnostic": {
200
+ readonly title: "Editing markers need attention";
201
+ readonly body: "";
202
+ };
203
+ readonly "workspace-unavailable": {
204
+ readonly title: "Working preview unavailable";
205
+ readonly body: "This working version isn’t available right now. Open it again, or use the current site.";
206
+ };
207
+ readonly "workspace-configuration": {
208
+ readonly title: "Working preview needs setup";
209
+ readonly body: "A project administrator needs to complete this environment’s setup before it can start.";
210
+ };
211
+ readonly "workspace-unconfirmed": {
212
+ readonly title: "Working preview status is unconfirmed";
213
+ readonly body: "The environment hasn’t confirmed the last operation. A project administrator can check its status before another attempt.";
214
+ };
215
+ readonly "workspace-stopped": {
216
+ readonly title: "Working preview is stopped";
217
+ readonly body: "Resume this working version, or use the current site.";
218
+ };
219
+ readonly "workspace-start-failed": {
220
+ readonly title: "Working preview couldn’t start";
221
+ readonly body: "The environment couldn’t start. Try again, or use the current site.";
222
+ };
223
+ readonly "workspace-not-prepared": {
224
+ readonly title: "Working preview isn’t set up";
225
+ readonly body: "A project administrator needs to prepare this working version before it can start.";
226
+ };
227
+ readonly "workspace-forbidden": {
228
+ readonly title: "Working preview needs project access";
229
+ readonly body: "A project administrator needs to start this working version.";
230
+ };
231
+ readonly "workspace-limit": {
232
+ readonly title: "Working preview limit reached";
233
+ readonly body: "This working preview has reached its usage limit. A project administrator can review it.";
234
+ };
235
+ readonly "workspace-near-limit": {
236
+ readonly title: "Working preview is nearing its limit";
237
+ readonly body: "";
238
+ };
239
+ readonly "workspace-recovery": {
240
+ readonly title: "Working files need recovery";
241
+ readonly body: "Some file changes need to be recovered before this environment can restart.";
242
+ };
243
+ readonly "workspace-switch-failed": {
244
+ readonly title: "Environment couldn’t change";
245
+ readonly body: "The requested environment couldn’t be selected.";
246
+ };
247
+ readonly "workspace-stop-failed": {
248
+ readonly title: "Working preview couldn’t stop";
249
+ readonly body: "The environment didn’t confirm that it stopped.";
250
+ };
251
+ readonly "workspace-stopped-recovery": {
252
+ readonly title: "Preview stopped, files need recovery";
253
+ readonly body: "Some file changes still need to be recovered before this environment is used again.";
254
+ };
255
+ readonly "workspace-release": {
256
+ readonly title: "Select this working version’s content";
257
+ readonly body: "This environment belongs to {release}. Select it to preview its content.";
258
+ };
259
+ readonly "workspace-selection-failed": {
260
+ readonly title: "Working version couldn’t be selected";
261
+ readonly body: "The requested content version couldn’t be applied.";
262
+ };
263
+ readonly "field-hidden": {
264
+ readonly title: "This field isn’t visible here";
265
+ readonly body: "It’s on this page, but isn’t currently visible.";
266
+ };
267
+ readonly "field-absent": {
268
+ readonly title: "This field isn’t on this page";
269
+ readonly body: "Its content is available in the editor.";
270
+ };
271
+ readonly "field-pending": {
272
+ readonly title: "The page isn’t ready to locate this field";
273
+ readonly body: "";
274
+ };
275
+ readonly "field-missing": {
276
+ readonly title: "This content couldn’t be located";
277
+ readonly body: "It may have changed in this version. Open its document to continue.";
278
+ };
279
+ readonly "field-ambiguous": {
280
+ readonly title: "Choose an editing version";
281
+ readonly body: "This content appears in more than one version.";
282
+ };
283
+ readonly "field-closest": {
284
+ readonly title: "Showing the containing section";
285
+ readonly body: "The exact field couldn’t be located.";
286
+ };
287
+ readonly "field-opening": {
288
+ readonly title: "Opening the selected content";
289
+ readonly body: "It will open when the editor is ready.";
290
+ };
291
+ readonly "field-open-failed": {
292
+ readonly title: "This content couldn’t open";
293
+ readonly body: "Try opening its document again.";
294
+ };
295
+ readonly "field-multiple": {
296
+ readonly title: "Multiple preview targets";
297
+ readonly body: "";
298
+ };
299
+ readonly "release-nonmember": {
300
+ readonly title: "This page uses Main";
301
+ readonly body: "It isn’t included in {release}.";
302
+ };
303
+ readonly "release-follows-main": {
304
+ readonly title: "Preview now follows Main";
305
+ readonly body: "{release} was published.";
306
+ };
307
+ readonly "release-archived": {
308
+ readonly title: "Preview now follows Main";
309
+ readonly body: "{release} was archived.";
310
+ };
311
+ readonly "release-unavailable": {
312
+ readonly title: "This release view is unavailable";
313
+ readonly body: "Preview is showing Main for this page.";
314
+ };
315
+ readonly "release-readonly": {
316
+ readonly title: "This version can’t be edited";
317
+ readonly body: "Choose an editable version to continue.";
318
+ };
319
+ readonly "opening-invalid": {
320
+ readonly title: "This preview link is unavailable";
321
+ readonly body: "Open a new preview from Studio.";
322
+ };
323
+ readonly "opening-failed": {
324
+ readonly title: "Preview couldn’t open";
325
+ readonly body: "The connection couldn’t be prepared. Try again, or return to Studio.";
326
+ };
327
+ readonly "editor-unavailable": {
328
+ readonly title: "Editor unavailable";
329
+ readonly body: "The editor couldn’t connect. Try again, or open this content in Studio.";
330
+ };
331
+ readonly "editing-forbidden": {
332
+ readonly title: "Editing isn’t available with your access";
333
+ readonly body: "";
334
+ };
335
+ readonly "element-empty": {
336
+ readonly title: "Select an element on the page";
337
+ readonly body: "Its content will open here.";
338
+ };
339
+ readonly "runtime-unavailable": {
340
+ readonly title: "Preview controls couldn’t load";
341
+ readonly body: "Reload this preview to try connecting again.";
342
+ };
343
+ readonly "diagnostic-copied": {
344
+ readonly title: "Diagnostic copied";
345
+ readonly body: "";
346
+ };
347
+ readonly "diagnostic-failed": {
348
+ readonly title: "Diagnostic couldn’t be copied";
349
+ readonly body: "Retry, or select the diagnostic text.";
350
+ };
351
+ readonly reconnecting: {
352
+ readonly title: "Reconnecting preview";
353
+ readonly body: "We’re trying to restore the connection.";
354
+ };
355
+ readonly "setup-readonly": {
356
+ readonly title: "Preview isn’t set up yet";
357
+ readonly body: "A project administrator can add the site address. You can continue working in Studio.";
358
+ };
359
+ };
360
+ export type PreviewCopyKey = keyof typeof PREVIEW_COPY;
361
+ /** Names and labels come from the already admitted presentation context. */
362
+ export declare function previewCopy(key: PreviewCopyKey, params?: Readonly<Record<string, string>>): PreviewCopy;
@@ -0,0 +1,96 @@
1
+ export const PREVIEW_COPY = {
2
+ "setup": { "title": "Set up your preview", "body": "Add your site’s address to see it here while you edit." },
3
+ "invalid-url": { "title": "Check the preview address", "body": "The configured address isn’t valid. Add an HTTP or HTTPS site address in Preview and origins." },
4
+ "origins-missing": { "title": "Finish preview setup", "body": "Allow your site to connect to Storystick in Preview and origins." },
5
+ "origin-forbidden": { "title": "This site isn’t allowed", "body": "This site isn’t included in the project’s allowed preview origins." },
6
+ "project-mismatch": { "title": "This site uses another project", "body": "Check the preview address and the Storystick project connected to this site." },
7
+ "document-empty": { "title": "Open a document", "body": "Its preview will appear here." },
8
+ "document-context": { "title": "Preview this content on a page", "body": "This document has no preview of its own. Open it from a page that uses it." },
9
+ "route-unmapped": { "title": "Page without a document", "body": "This page isn’t linked to a Storystick document. The editor is still on {document}." },
10
+ "another-page": { "title": "Preview shows another page", "body": "You’re editing {document}. The preview shows {page}." },
11
+ "preparing": { "title": "Preparing preview", "body": "Your site will appear here when it’s ready." },
12
+ "page-loading": { "title": "Loading your site", "body": "Waiting for the page to respond." },
13
+ "connecting": { "title": "Connecting preview", "body": "Connecting this site to Studio." },
14
+ "workspace-creating": { "title": "Starting working preview", "body": "Preparing the environment for this working version." },
15
+ "workspace-restoring": { "title": "Resuming working preview", "body": "Restoring the environment and its saved changes." },
16
+ "workspace-installing": { "title": "Preparing the project", "body": "Installing the project’s dependencies. The first start can take longer." },
17
+ "workspace-checking": { "title": "Checking the project", "body": "Checking this version before starting the site." },
18
+ "workspace-launching": { "title": "Starting the site", "body": "Starting the working preview server." },
19
+ "retained-loading": { "title": "Loading {page}", "body": "The previous page is still shown." },
20
+ "updating": { "title": "Updating preview", "body": "Waiting for the updated page." },
21
+ "taking-longer": { "title": "Preview is taking longer", "body": "We’re still waiting for the requested page." },
22
+ "reconnect": { "title": "Reconnect your preview", "body": "This preview connection is no longer valid. Reconnect to continue." },
23
+ "deployment-changed": { "title": "The site has changed", "body": "Reconnect preview to use the current site deployment." },
24
+ "open-from-studio": { "title": "Open preview from Studio", "body": "Start a new preview from Studio to connect this page." },
25
+ "connection-interrupted": { "title": "Preview connection interrupted", "body": "The connection couldn’t be restored. Reconnect preview to continue." },
26
+ "access-unavailable": { "title": "Preview access unavailable", "body": "This preview is no longer available with your current access. Return to Studio to open an available view." },
27
+ "view-unavailable": { "title": "This view is no longer available", "body": "Choose an available version in Studio, then open preview again." },
28
+ "ended": { "title": "Preview ended", "body": "This preview was closed. Return to Studio to start another." },
29
+ "exit-incomplete": { "title": "Preview hasn’t fully closed", "body": "The shared preview ended, but this tab couldn’t leave preview mode." },
30
+ "admission-superseded": { "title": "Preview changed in another view", "body": "Reconnect to follow the current preview." },
31
+ "connection-mismatch": { "title": "Preview couldn’t connect", "body": "The site and Studio couldn’t establish the same preview session." },
32
+ "integration-update": { "title": "Preview integration needs an update", "body": "A developer needs to update the site’s preview integration before Studio can connect." },
33
+ "content-unavailable": { "title": "Preview content unavailable", "body": "The content service couldn’t answer this page’s request." },
34
+ "render-failed": { "title": "This page couldn’t load", "body": "The site couldn’t render this page. You can keep editing or open another page." },
35
+ "update-failed": { "title": "Preview couldn’t update", "body": "The requested page wasn’t confirmed. Try opening it again." },
36
+ "scope-mismatch": { "title": "Preview shows another version", "body": "The site hasn’t confirmed the version selected in Studio." },
37
+ "selection-superseded": { "title": "The version changed", "body": "Your selection was replaced before the preview finished updating." },
38
+ "version-unavailable": { "title": "This version couldn’t open", "body": "Choose the version again, or return to another available version." },
39
+ "route-lookup-failed": { "title": "Page connection unavailable", "body": "Studio couldn’t identify the document for this page." },
40
+ "sync-failed": { "title": "This page couldn’t be shown", "body": "Preview didn’t confirm the document you requested." },
41
+ "unavailable": { "title": "Preview is unavailable", "body": "Studio couldn’t prepare this preview. Try again, or share the diagnostic with your project administrator." },
42
+ "busy": { "title": "Preview is temporarily busy", "body": "The service couldn’t accept this request yet." },
43
+ "visual-connecting": { "title": "Connecting visual editing", "body": "" },
44
+ "visual-limited": { "title": "Visual editing is limited", "body": "Some elements can’t be selected on this page. You can still edit their content in Studio." },
45
+ "visual-update": { "title": "Visual editing needs an update", "body": "The page is available, but a developer needs to update its editing integration." },
46
+ "visual-partial": { "title": "Some elements aren’t selectable", "body": "" },
47
+ "visual-empty": { "title": "No editable elements on this page", "body": "" },
48
+ "visual-unavailable": { "title": "Page selection unavailable", "body": "The page’s editing controls couldn’t be confirmed. You can continue editing in Studio." },
49
+ "minimap-unavailable": { "title": "Minimap unavailable for this page", "body": "Open Preview to view this page without the minimap." },
50
+ "marker-diagnostic": { "title": "Editing markers need attention", "body": "" },
51
+ "workspace-unavailable": { "title": "Working preview unavailable", "body": "This working version isn’t available right now. Open it again, or use the current site." },
52
+ "workspace-configuration": { "title": "Working preview needs setup", "body": "A project administrator needs to complete this environment’s setup before it can start." },
53
+ "workspace-unconfirmed": { "title": "Working preview status is unconfirmed", "body": "The environment hasn’t confirmed the last operation. A project administrator can check its status before another attempt." },
54
+ "workspace-stopped": { "title": "Working preview is stopped", "body": "Resume this working version, or use the current site." },
55
+ "workspace-start-failed": { "title": "Working preview couldn’t start", "body": "The environment couldn’t start. Try again, or use the current site." },
56
+ "workspace-not-prepared": { "title": "Working preview isn’t set up", "body": "A project administrator needs to prepare this working version before it can start." },
57
+ "workspace-forbidden": { "title": "Working preview needs project access", "body": "A project administrator needs to start this working version." },
58
+ "workspace-limit": { "title": "Working preview limit reached", "body": "This working preview has reached its usage limit. A project administrator can review it." },
59
+ "workspace-near-limit": { "title": "Working preview is nearing its limit", "body": "" },
60
+ "workspace-recovery": { "title": "Working files need recovery", "body": "Some file changes need to be recovered before this environment can restart." },
61
+ "workspace-switch-failed": { "title": "Environment couldn’t change", "body": "The requested environment couldn’t be selected." },
62
+ "workspace-stop-failed": { "title": "Working preview couldn’t stop", "body": "The environment didn’t confirm that it stopped." },
63
+ "workspace-stopped-recovery": { "title": "Preview stopped, files need recovery", "body": "Some file changes still need to be recovered before this environment is used again." },
64
+ "workspace-release": { "title": "Select this working version’s content", "body": "This environment belongs to {release}. Select it to preview its content." },
65
+ "workspace-selection-failed": { "title": "Working version couldn’t be selected", "body": "The requested content version couldn’t be applied." },
66
+ "field-hidden": { "title": "This field isn’t visible here", "body": "It’s on this page, but isn’t currently visible." },
67
+ "field-absent": { "title": "This field isn’t on this page", "body": "Its content is available in the editor." },
68
+ "field-pending": { "title": "The page isn’t ready to locate this field", "body": "" },
69
+ "field-missing": { "title": "This content couldn’t be located", "body": "It may have changed in this version. Open its document to continue." },
70
+ "field-ambiguous": { "title": "Choose an editing version", "body": "This content appears in more than one version." },
71
+ "field-closest": { "title": "Showing the containing section", "body": "The exact field couldn’t be located." },
72
+ "field-opening": { "title": "Opening the selected content", "body": "It will open when the editor is ready." },
73
+ "field-open-failed": { "title": "This content couldn’t open", "body": "Try opening its document again." },
74
+ "field-multiple": { "title": "Multiple preview targets", "body": "" },
75
+ "release-nonmember": { "title": "This page uses Main", "body": "It isn’t included in {release}." },
76
+ "release-follows-main": { "title": "Preview now follows Main", "body": "{release} was published." },
77
+ "release-archived": { "title": "Preview now follows Main", "body": "{release} was archived." },
78
+ "release-unavailable": { "title": "This release view is unavailable", "body": "Preview is showing Main for this page." },
79
+ "release-readonly": { "title": "This version can’t be edited", "body": "Choose an editable version to continue." },
80
+ "opening-invalid": { "title": "This preview link is unavailable", "body": "Open a new preview from Studio." },
81
+ "opening-failed": { "title": "Preview couldn’t open", "body": "The connection couldn’t be prepared. Try again, or return to Studio." },
82
+ "editor-unavailable": { "title": "Editor unavailable", "body": "The editor couldn’t connect. Try again, or open this content in Studio." },
83
+ "editing-forbidden": { "title": "Editing isn’t available with your access", "body": "" },
84
+ "element-empty": { "title": "Select an element on the page", "body": "Its content will open here." },
85
+ "runtime-unavailable": { "title": "Preview controls couldn’t load", "body": "Reload this preview to try connecting again." },
86
+ "diagnostic-copied": { "title": "Diagnostic copied", "body": "" },
87
+ "diagnostic-failed": { "title": "Diagnostic couldn’t be copied", "body": "Retry, or select the diagnostic text." },
88
+ "reconnecting": { "title": "Reconnecting preview", "body": "We’re trying to restore the connection." },
89
+ "setup-readonly": { "title": "Preview isn’t set up yet", "body": "A project administrator can add the site address. You can continue working in Studio." },
90
+ };
91
+ /** Names and labels come from the already admitted presentation context. */
92
+ export function previewCopy(key, params = {}) {
93
+ const copy = PREVIEW_COPY[key];
94
+ const format = (text) => text.replace(/\{(\w+)\}/g, (match, name) => params[name] ?? match);
95
+ return { title: format(copy.title), body: format(copy.body) };
96
+ }
@@ -0,0 +1,6 @@
1
+ /** Diagnostics intentionally exclude exception messages, arbitrary payloads and credentials. */
2
+ export declare function safePreviewCode(value: unknown): string;
3
+ export declare function safePreviewOrigin(value: unknown): string | null;
4
+ export declare function previewDiagnostic(input: unknown): string;
5
+ /** Re-sanitize at the rendering/copy boundary even when a caller supplies its own report. */
6
+ export declare function sanitizePreviewDiagnostic(payload: string): string;
@@ -0,0 +1,64 @@
1
+ import { PREVIEW_FEEDBACK, normalizePreviewCode } from './preview-feedback.js';
2
+ /** Diagnostics intentionally exclude exception messages, arbitrary payloads and credentials. */
3
+ export function safePreviewCode(value) {
4
+ if (typeof value !== 'string')
5
+ return 'UNKNOWN';
6
+ const code = normalizePreviewCode(value);
7
+ if (Object.hasOwn(PREVIEW_FEEDBACK, code))
8
+ return code;
9
+ if (/^(?:PROJECT_WORKSPACE_[A-Z_]{1,80}|PREVIEW_(?:GRANT_ACTIVATION|GRANT_ACCESS|AUTHORING_ADMISSION)_[A-Z_]{1,40})$/.test(code))
10
+ return code;
11
+ return 'UNKNOWN';
12
+ }
13
+ export function safePreviewOrigin(value) {
14
+ if (typeof value !== 'string')
15
+ return null;
16
+ try {
17
+ const url = new URL(value);
18
+ return url.protocol === 'https:' || url.protocol === 'http:' ? url.origin : null;
19
+ }
20
+ catch {
21
+ return null;
22
+ }
23
+ }
24
+ const STATES = new Set(['idle', 'loading', 'ready', 'error', 'empty', 'dormant', 'authenticated', 'pending', 'unauthenticated', 'device', 'navigation', 'visible', 'hidden', 'unavailable', 'iframe', 'loaded']);
25
+ const OPERATIONS = new Set(['connect', 'reconnect', 'navigate', 'reload', 'start', 'resume', 'stop', 'select-version', 'exit', 'activate', 'authoring']);
26
+ const PHASES = new Set(['dormant', 'preflight', 'booting', 'auth', 'loading', 'connecting', 'render', 'proof', 'paint', 'ack', 'ready', 'failed', 'authenticating', 'transitioning', 'unconfirmed', 'blocked', 'error']);
27
+ const STATE_KEYS = new Set(['stageState', 'authStatus', 'mode', 'frame', 'stage', 'status', 'iframeLoadStatus']);
28
+ const TIMING_KEYS = new Set(['iframe_load_ms', 'auth_request_ms', 'auth_response_ms', 'iframe_visible_ms']);
29
+ const COUNT_KEYS = new Set(['attempt', 'generation', 'desiredGeneration', 'presentedGeneration', 'reloadCount']);
30
+ export function previewDiagnostic(input) {
31
+ const report = { format: 'storystick-preview-v1' };
32
+ if (typeof input !== 'object' || input === null || Array.isArray(input))
33
+ return JSON.stringify(report, null, 2);
34
+ for (const [key, value] of Object.entries(input)) {
35
+ if (key === 'code' || key === 'internalCause')
36
+ report[key] = value === null ? null : safePreviewCode(value);
37
+ else if (key === 'reference' && typeof value === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,95}$/.test(value))
38
+ report[key] = value;
39
+ else if (key === 'operation' && typeof value === 'string' && OPERATIONS.has(value))
40
+ report[key] = value;
41
+ else if (key === 'phase' && typeof value === 'string' && PHASES.has(value))
42
+ report[key] = value;
43
+ else if (key === 'runtimeError' && value !== null && typeof value === 'object')
44
+ report.code = safePreviewCode(value.code);
45
+ else if (key === 'origin' || key === 'previewUrl')
46
+ report[key] = safePreviewOrigin(value);
47
+ else if (STATE_KEYS.has(key) && typeof value === 'string' && STATES.has(value))
48
+ report[key] = value;
49
+ else if (TIMING_KEYS.has(key) && (value === null || typeof value === 'number' && Number.isFinite(value) && value >= 0))
50
+ report[key] = value;
51
+ else if (COUNT_KEYS.has(key) && typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)
52
+ report[key] = value;
53
+ }
54
+ return JSON.stringify(report, null, 2);
55
+ }
56
+ /** Re-sanitize at the rendering/copy boundary even when a caller supplies its own report. */
57
+ export function sanitizePreviewDiagnostic(payload) {
58
+ try {
59
+ return previewDiagnostic(JSON.parse(payload));
60
+ }
61
+ catch {
62
+ return previewDiagnostic(null);
63
+ }
64
+ }
@@ -0,0 +1,23 @@
1
+ import { type PreviewCopyKey } from './preview-copy.js';
2
+ export type PreviewFeedbackTone = 'neutral' | 'attention' | 'error';
3
+ export type PreviewFeedbackScope = 'configuration' | 'connection' | 'page' | 'visual-editing' | 'minimap' | 'environment';
4
+ export type PreviewFeedbackAction = 'configure' | 'reconnect' | 'retry' | 'retry-page' | 'retry-start' | 'resume' | 'current-site' | 'studio' | 'open-preview' | 'exit' | 'editor' | 'choose-version';
5
+ export interface PreviewFeedback {
6
+ readonly title: string;
7
+ readonly body: string;
8
+ readonly key: PreviewCopyKey;
9
+ readonly tone: PreviewFeedbackTone;
10
+ readonly scope: PreviewFeedbackScope;
11
+ readonly action: PreviewFeedbackAction | null;
12
+ readonly actionLabel: string | null;
13
+ readonly diagnostic: boolean;
14
+ /** Retaining a page must never outlive its admission or version boundary. */
15
+ readonly invalidatesPresentation: boolean;
16
+ readonly audience: 'editor' | 'developer';
17
+ }
18
+ /** Domain codes select product meaning; transport severity never selects presentation. */
19
+ export declare const PREVIEW_FEEDBACK: Readonly<Record<string, PreviewFeedback>>;
20
+ export declare function normalizePreviewCode(code: string): string;
21
+ export declare function lookupPreviewFeedback(code: string | null | undefined): PreviewFeedback;
22
+ /** A capability failure is local only after the current authorized page was accepted. */
23
+ export declare function isPreviewCapabilityFeedback(code: string): boolean;
@@ -0,0 +1,131 @@
1
+ import { PREVIEW_COPY } from './preview-copy.js';
2
+ const ACTION_LABELS = {
3
+ configure: 'Configure preview', reconnect: 'Reconnect preview', retry: 'Try again',
4
+ 'retry-page': 'Retry this page', 'retry-start': 'Retry start', resume: 'Resume working preview',
5
+ 'current-site': 'Use current site', studio: 'Return to Studio', 'open-preview': 'Open Preview',
6
+ exit: 'Retry exit', editor: 'Open editor', 'choose-version': 'Choose a version',
7
+ };
8
+ function feedback(key, scope, action, tone = 'error', options = {}) {
9
+ return { ...PREVIEW_COPY[key], key, scope, action, actionLabel: action === null ? null : ACTION_LABELS[action],
10
+ tone, diagnostic: true, invalidatesPresentation: scope === 'connection' || scope === 'configuration', audience: 'editor', ...options };
11
+ }
12
+ const setup = feedback('setup', 'configuration', 'configure', 'neutral', { diagnostic: false });
13
+ const origins = feedback('origins-missing', 'configuration', 'configure', 'neutral', { diagnostic: false });
14
+ const reconnect = feedback('reconnect', 'connection', 'reconnect', 'attention');
15
+ const access = feedback('access-unavailable', 'connection', 'studio', 'attention');
16
+ const binding = feedback('connection-mismatch', 'connection', 'reconnect');
17
+ const missing = feedback('open-from-studio', 'connection', 'studio', 'neutral', { diagnostic: false });
18
+ const visualLimited = feedback('visual-limited', 'visual-editing', 'editor', 'attention');
19
+ const workspaceSetup = feedback('workspace-configuration', 'environment', 'current-site', 'attention');
20
+ const workspaceUnconfirmed = feedback('workspace-unconfirmed', 'environment', 'current-site', 'attention');
21
+ const workspaceFailed = feedback('workspace-start-failed', 'environment', 'retry-start');
22
+ /** Domain codes select product meaning; transport severity never selects presentation. */
23
+ export const PREVIEW_FEEDBACK = {
24
+ preview_url_not_configured: setup,
25
+ preview_url_invalid: feedback('invalid-url', 'configuration', 'configure', 'attention'),
26
+ origin_not_configured: origins,
27
+ origin_not_allowed: feedback('origin-forbidden', 'configuration', 'configure', 'attention'),
28
+ PREVIEW_ORIGIN_FORBIDDEN: feedback('origin-forbidden', 'configuration', 'configure', 'attention'),
29
+ preview_project_mismatch: feedback('project-mismatch', 'configuration', 'configure', 'attention'),
30
+ PREVIEW_PROJECT_MISMATCH: feedback('project-mismatch', 'configuration', 'configure', 'attention'),
31
+ preview_activation_invalid: reconnect,
32
+ PREVIEW_ACTIVATION_INVALID: reconnect,
33
+ PREVIEW_CONTEXT_UNAVAILABLE: feedback('unavailable', 'connection', 'retry'),
34
+ session_expired: reconnect,
35
+ session_not_found: reconnect,
36
+ 'runtime.SESSION_EXPIRED': reconnect,
37
+ PREVIEW_GRANT_MALFORMED: reconnect,
38
+ PREVIEW_GRANT_INVALID: reconnect,
39
+ PREVIEW_GRANT_EXPIRED: reconnect,
40
+ PREVIEW_VIEW_UNAVAILABLE: reconnect,
41
+ CONTENT_SHAPE_RELOAD_REQUIRED: feedback('deployment-changed', 'connection', 'reconnect', 'attention'),
42
+ PREVIEW_GRANT_MISSING: missing,
43
+ PREVIEW_GRANT_REQUIRED: missing,
44
+ PREVIEW_REQUIRED: missing,
45
+ SESSION_SUBSCRIPTION_UNAVAILABLE: feedback('connection-interrupted', 'connection', 'reconnect'),
46
+ identity_carrier_timeout: feedback('connection-interrupted', 'connection', 'reconnect'),
47
+ identity_recovery_exhausted: feedback('connection-interrupted', 'connection', 'reconnect'),
48
+ preview_lifecycle_blocked: access,
49
+ PREVIEW_GRANT_REVOKED: access,
50
+ PREVIEW_ACCESS_REVOKED: access,
51
+ PREVIEW_GRANT_FORBIDDEN: access,
52
+ INVALID_IDENTITY_CLAIM: access,
53
+ PREVIEW_CONTEXT_INVALID: feedback('view-unavailable', 'connection', 'choose-version', 'attention'),
54
+ PREVIEW_CONTEXT_ENDED: feedback('ended', 'connection', 'studio', 'neutral', { diagnostic: false }),
55
+ PREVIEW_CONTEXT_EXIT_UNAVAILABLE: feedback('exit-incomplete', 'connection', 'exit', 'attention'),
56
+ PREVIEW_ADMISSION_SUPERSEDED: feedback('admission-superseded', 'connection', 'reconnect', 'attention'),
57
+ protocol_invalid: binding,
58
+ session_mismatch: binding,
59
+ PREVIEW_GRANT_BINDING_MISMATCH: binding,
60
+ PREVIEW_ORIGIN_MISMATCH: binding,
61
+ PREVIEW_TOKEN_PROTOCOL_INVALID: feedback('integration-update', 'connection', 'studio', 'attention'),
62
+ 'runtime.preview_read_unavailable': feedback('content-unavailable', 'page', 'retry-page'),
63
+ 'runtime.customer_render_failed': feedback('render-failed', 'page', 'retry-page'),
64
+ PREVIEW_CONVERGENCE_STOPPED: feedback('update-failed', 'page', 'retry-page'),
65
+ 'runtime.PREVIEW_SCOPE_MISMATCH': feedback('scope-mismatch', 'page', 'retry-page', 'attention', { invalidatesPresentation: true }),
66
+ 'runtime.PREVIEW_RELEASE_SCOPE_MISMATCH': feedback('scope-mismatch', 'page', 'retry-page', 'attention', { invalidatesPresentation: true }),
67
+ 'runtime.preview_context_superseded': feedback('selection-superseded', 'page', 'choose-version', 'attention', { invalidatesPresentation: true }),
68
+ 'runtime.schema_sync_delayed': feedback('visual-connecting', 'visual-editing', null, 'neutral'),
69
+ 'runtime.cache_unavailable': visualLimited,
70
+ 'runtime.schema_delivery_failed': visualLimited,
71
+ 'runtime.schema_upgrade_required': feedback('visual-update', 'visual-editing', 'editor', 'attention'),
72
+ 'runtime.suspicious_codeword_sink': feedback('marker-diagnostic', 'visual-editing', null, 'attention', { audience: 'developer' }),
73
+ PREVIEW_MINIMAP_TIMEOUT: feedback('minimap-unavailable', 'minimap', 'open-preview', 'neutral'),
74
+ workspace_preview_unavailable: feedback('workspace-unavailable', 'environment', 'retry-start', 'attention'),
75
+ workspace_preview_stopped: feedback('workspace-stopped', 'environment', 'resume', 'neutral', { diagnostic: false }),
76
+ workspace_preview_start_failed: workspaceFailed,
77
+ PROJECT_WORKSPACE_NOT_ENABLED: workspaceSetup,
78
+ PROJECT_WORKSPACE_EXECUTION_DISABLED: workspaceSetup,
79
+ PROJECT_WORKSPACE_PROVIDER_NOT_CONFIGURED: workspaceSetup,
80
+ PROJECT_WORKSPACE_PROVIDER_NAMESPACE_UNKNOWN: workspaceSetup,
81
+ PROJECT_WORKSPACE_PROVIDER_NAMESPACE_CHANGED: workspaceSetup,
82
+ PROJECT_WORKSPACE_RECIPE_CHANGED: workspaceSetup,
83
+ PROJECT_WORKSPACE_SOURCE_PREPARATION_MISMATCH: workspaceSetup,
84
+ PROJECT_WORKSPACE_BUDGET_UNAVAILABLE: workspaceSetup,
85
+ PROJECT_WORKSPACE_BUDGET_ALLOCATION_INVALID: workspaceSetup,
86
+ PROJECT_WORKSPACE_BUDGET_CHANGED: workspaceSetup,
87
+ PROJECT_WORKSPACE_ALLOCATION_OUTCOME_UNKNOWN: workspaceUnconfirmed,
88
+ PROJECT_WORKSPACE_OUTCOME_UNKNOWN: workspaceUnconfirmed,
89
+ PROJECT_WORKSPACE_SUSPEND_UNCONFIRMED: workspaceUnconfirmed,
90
+ PROJECT_WORKSPACE_RUNTIME_NOT_STOPPED: workspaceUnconfirmed,
91
+ PROJECT_WORKSPACE_RELEASE_NOT_EDITABLE: feedback('release-readonly', 'environment', 'choose-version', 'attention', { diagnostic: false }),
92
+ PROJECT_WORKSPACE_RELEASE_REQUIRED: feedback('workspace-selection-failed', 'environment', 'choose-version', 'attention'),
93
+ PROJECT_WORKSPACE_BINDING_MISMATCH: feedback('workspace-unavailable', 'environment', 'current-site', 'attention', { invalidatesPresentation: true }),
94
+ PROJECT_WORKSPACE_BUSY: feedback('busy', 'environment', 'retry-start', 'attention'),
95
+ PROJECT_WORKSPACE_NOT_PREPARED: feedback('workspace-not-prepared', 'environment', 'current-site', 'neutral', { diagnostic: false }),
96
+ PROJECT_WORKSPACE_FORBIDDEN: feedback('workspace-forbidden', 'environment', 'current-site', 'attention', { diagnostic: false }),
97
+ PROJECT_WORKSPACE_BUDGET_EXHAUSTED: feedback('workspace-limit', 'environment', 'current-site', 'attention', { diagnostic: false }),
98
+ PROJECT_WORKSPACE_SOURCE_RECOVERY_REQUIRED: feedback('workspace-recovery', 'environment', 'current-site', 'attention'),
99
+ workspace_switch_failed: feedback('workspace-switch-failed', 'environment', 'retry'),
100
+ workspace_stop_failed: feedback('workspace-stop-failed', 'environment', 'retry'),
101
+ workspace_stopped_recovery: feedback('workspace-stopped-recovery', 'environment', 'current-site', 'attention'),
102
+ workspace_selection_failed: feedback('workspace-selection-failed', 'environment', 'choose-version'),
103
+ PREVIEW_SESSION_MISSING: feedback('opening-invalid', 'connection', 'studio', 'neutral', { diagnostic: false }),
104
+ PREVIEW_REDIRECT_UNSAFE: feedback('opening-invalid', 'connection', 'studio', 'neutral', { diagnostic: false }),
105
+ PREVIEW_SCOPE_CONFLICT: feedback('opening-invalid', 'connection', 'studio', 'neutral', { diagnostic: false }),
106
+ preview_session_creation_failed: feedback('opening-failed', 'connection', 'reconnect'),
107
+ UNKNOWN: feedback('unavailable', 'page', 'retry'),
108
+ };
109
+ export function normalizePreviewCode(code) {
110
+ return code.startsWith('storystick/') ? code.slice('storystick/'.length) : code;
111
+ }
112
+ export function lookupPreviewFeedback(code) {
113
+ const key = normalizePreviewCode(code ?? '');
114
+ if (Object.hasOwn(PREVIEW_FEEDBACK, key))
115
+ return PREVIEW_FEEDBACK[key];
116
+ if (/^PROJECT_WORKSPACE_[A-Z_]{1,80}$/.test(key))
117
+ return workspaceFailed;
118
+ if (/^PREVIEW_(?:GRANT_ACTIVATION|GRANT_ACCESS|AUTHORING_ADMISSION)_[A-Z_]{1,40}$/.test(key)) {
119
+ if (key.endsWith('_RATE_LIMITED'))
120
+ return feedback('busy', 'connection', 'retry', 'attention');
121
+ if (key.endsWith('_AUTH_FAILED'))
122
+ return access;
123
+ return feedback('unavailable', 'connection', 'retry');
124
+ }
125
+ return PREVIEW_FEEDBACK.UNKNOWN;
126
+ }
127
+ /** A capability failure is local only after the current authorized page was accepted. */
128
+ export function isPreviewCapabilityFeedback(code) {
129
+ const scope = lookupPreviewFeedback(code).scope;
130
+ return scope === 'visual-editing';
131
+ }
@@ -1,4 +1,6 @@
1
1
  /** Public bootstrap hint only. The same-origin token route still authorizes it. */
2
2
  export declare function readStandalonePreviewSessionId(expectedProjectId?: string): string | null;
3
+ /** Explicit intent is a display hint only; it grants no Preview access. */
4
+ export declare function hasExplicitPreviewBrowserContext(expectedProjectId?: string): boolean;
3
5
  /** Small, framework-independent gate; never loads the authenticated runtime. */
4
6
  export declare function isPreviewBrowserContext(expectedProjectId?: string): boolean;
@@ -14,9 +14,14 @@ export function readStandalonePreviewSessionId(expectedProjectId) {
14
14
  return null;
15
15
  return /^[A-Za-z0-9_-]{1,180}$/.test(stored.sessionId) ? stored.sessionId : null;
16
16
  }
17
+ /** Explicit intent is a display hint only; it grants no Preview access. */
18
+ export function hasExplicitPreviewBrowserContext(expectedProjectId) {
19
+ return typeof window !== 'undefined' && (new URLSearchParams(window.location.search).has(PREVIEW_SESSION_QUERY_PARAM) ||
20
+ readStandalonePreviewSessionId(expectedProjectId) !== null);
21
+ }
17
22
  /** Small, framework-independent gate; never loads the authenticated runtime. */
18
23
  export function isPreviewBrowserContext(expectedProjectId) {
19
24
  if (typeof window === 'undefined')
20
25
  return false;
21
- return window.parent !== window || readStandalonePreviewSessionId(expectedProjectId) !== null;
26
+ return window.parent !== window || hasExplicitPreviewBrowserContext(expectedProjectId);
22
27
  }
@@ -10,4 +10,4 @@ export declare function rememberStandaloneView(view: {
10
10
  /** Persistent interaction choice for this view only; access is authorized separately. */
11
11
  export declare function readStandaloneInteractionMode(projectId: string | null, sessionId: string | null): 'edit' | 'browse';
12
12
  export { rememberStandaloneInteractionMode } from './carriers/storage.js';
13
- export { readStandalonePreviewSessionId, isPreviewBrowserContext } from './browser-context-gate.js';
13
+ export { readStandalonePreviewSessionId, isPreviewBrowserContext, hasExplicitPreviewBrowserContext } from './browser-context-gate.js';
@@ -19,4 +19,4 @@ export function readStandaloneInteractionMode(projectId, sessionId) {
19
19
  : 'edit';
20
20
  }
21
21
  export { rememberStandaloneInteractionMode } from './carriers/storage.js';
22
- export { readStandalonePreviewSessionId, isPreviewBrowserContext } from './browser-context-gate.js';
22
+ export { readStandalonePreviewSessionId, isPreviewBrowserContext, hasExplicitPreviewBrowserContext } from './browser-context-gate.js';
@@ -1,48 +1,6 @@
1
- /**
2
- * ADR-134 §9.T2 — SDK-side copy table for the `<Storystick />` terminal
3
- * panel in `@storystick/next`. Mirror of `apps/studio/src/lib/preview-
4
- * error-copy.ts`, scoped to the SUBSET of codes the customer-side panel
5
- * actually renders. A contract test at `apps/studio/tests/sdk-error-
6
- * copy-contract.test.ts` pins overlap rows verbatim against Studio's
7
- * copy so the two tables can't drift on shared codes.
8
- *
9
- * Why a separate table : Studio product copy doesn't ship in customer-
10
- * runtime bundle (different audience, different vocabulary, different
11
- * bundle size budget). The SDK surface renders inside the customer's
12
- * page, so it speaks to the DEVELOPER hosting the customer site rather
13
- * than to a Studio editor. Phrasing can legitimately diverge on Studio-
14
- * specific codes ; the contract test ensures shared codes don't.
15
- *
16
- * Codes covered :
17
- * - `runtime.cache_unavailable` (D6 — Layer1 cache failed to open)
18
- * - `runtime.schema_sync_delayed` (D6 — attempt 1 of schema retry)
19
- * - `runtime.schema_delivery_failed` (D6 — attempt 5 of schema retry)
20
- * - `identity_carrier_timeout` when Studio identity cannot be established.
21
- * - PreviewGrant/context boundary codes emitted by the same-origin token
22
- * route or Convex subscriptions.
23
- *
24
- * Unknown codes fall back to a generic entry. The fallback's body is
25
- * intentionally honest : the SDK doesn't claim to know what happened.
26
- */
27
- export interface SdkErrorCopyEntry {
28
- title: string;
29
- body: string;
30
- /**
31
- * Non-exhaustive list of likely causes. The SDK panel renders these
32
- * as a bullet list inside the red surface. Empty array → list is
33
- * suppressed.
34
- */
35
- commonCauses: ReadonlyArray<string>;
1
+ import { type PreviewFeedback } from './framework/preview-feedback.js';
2
+ export interface SdkErrorCopyEntry extends PreviewFeedback {
3
+ readonly commonCauses: ReadonlyArray<string>;
36
4
  }
37
- /**
38
- * Canonical map. Codes here MUST match `apps/studio/src/lib/preview-
39
- * error-copy.ts` on overlap rows (contract-tested). Title + body
40
- * fields share verbatim, commonCauses share as a set (order can
41
- * differ).
42
- */
43
5
  export declare const SDK_ERROR_COPY: Readonly<Record<string, SdkErrorCopyEntry>>;
44
- /**
45
- * Look up the structured SDK copy for a code. Always returns an entry
46
- * (never null) so the panel can render unconditionally.
47
- */
48
6
  export declare function lookupSdkCopy(code: string | null | undefined): SdkErrorCopyEntry;
@@ -1,182 +1,5 @@
1
- /**
2
- * ADR-134 §9.T2 — SDK-side copy table for the `<Storystick />` terminal
3
- * panel in `@storystick/next`. Mirror of `apps/studio/src/lib/preview-
4
- * error-copy.ts`, scoped to the SUBSET of codes the customer-side panel
5
- * actually renders. A contract test at `apps/studio/tests/sdk-error-
6
- * copy-contract.test.ts` pins overlap rows verbatim against Studio's
7
- * copy so the two tables can't drift on shared codes.
8
- *
9
- * Why a separate table : Studio product copy doesn't ship in customer-
10
- * runtime bundle (different audience, different vocabulary, different
11
- * bundle size budget). The SDK surface renders inside the customer's
12
- * page, so it speaks to the DEVELOPER hosting the customer site rather
13
- * than to a Studio editor. Phrasing can legitimately diverge on Studio-
14
- * specific codes ; the contract test ensures shared codes don't.
15
- *
16
- * Codes covered :
17
- * - `runtime.cache_unavailable` (D6 — Layer1 cache failed to open)
18
- * - `runtime.schema_sync_delayed` (D6 — attempt 1 of schema retry)
19
- * - `runtime.schema_delivery_failed` (D6 — attempt 5 of schema retry)
20
- * - `identity_carrier_timeout` when Studio identity cannot be established.
21
- * - PreviewGrant/context boundary codes emitted by the same-origin token
22
- * route or Convex subscriptions.
23
- *
24
- * Unknown codes fall back to a generic entry. The fallback's body is
25
- * intentionally honest : the SDK doesn't claim to know what happened.
26
- */
27
- const PREVIEW_ACCESS_ENDED = {
28
- title: 'Preview access ended',
29
- body: 'This preview is no longer active. Return to Storystick Studio to open a new preview.',
30
- commonCauses: [],
31
- };
32
- const PREVIEW_ADMISSION_MISSING = {
33
- title: 'Preview access is missing',
34
- body: 'The site did not receive the Preview admission cookie. Open a fresh Preview from Studio. If this continues, check the site’s HTTPS and cookie configuration.',
35
- commonCauses: [
36
- 'The browser did not accept or send the Preview cookie in this context.',
37
- 'The Preview admission expired or was cleared.',
38
- ],
39
- };
40
- const PREVIEW_RENDER_ADMISSION_MISSING = {
41
- title: 'Preview needs a fresh activation',
42
- body: 'The site could not confirm Preview for its current deployment. Reopen Preview from Studio.',
43
- commonCauses: [
44
- 'The site was redeployed after Preview was opened.',
45
- 'The browser did not return the site’s Draft Mode cookie.',
46
- ],
47
- };
48
- const PREVIEW_BINDING_MISMATCH = {
49
- title: 'Preview binding mismatch',
50
- body: 'This preview does not match the active project, origin, or session. Reopen the document from the correct Storystick Studio project.',
51
- commonCauses: [],
52
- };
53
- const PREVIEW_VIEW_UNAVAILABLE = {
54
- title: 'This preview has expired',
55
- body: 'Open a new preview from Studio to continue.',
56
- commonCauses: [],
57
- };
58
- const PREVIEW_ADMISSION_SUPERSEDED = {
59
- title: 'Preview changed in another view',
60
- body: 'This page could not reconnect to the current preview. Reopen it from Studio.',
61
- commonCauses: [],
62
- };
63
- const PREVIEW_PROTOCOL_INVALID = {
64
- title: 'Preview adapter mismatch',
65
- body: 'The customer preview route returned an incompatible response. Update the Storystick packages together, then reopen the document.',
66
- commonCauses: [],
67
- };
68
- /**
69
- * Canonical map. Codes here MUST match `apps/studio/src/lib/preview-
70
- * error-copy.ts` on overlap rows (contract-tested). Title + body
71
- * fields share verbatim, commonCauses share as a set (order can
72
- * differ).
73
- */
74
- export const SDK_ERROR_COPY = {
75
- 'runtime.preview_read_unavailable': {
76
- title: 'Preview content temporarily unavailable',
77
- body: 'The content service could not answer this page’s request. Retry when the connection is restored.',
78
- commonCauses: [],
79
- },
80
- 'runtime.customer_render_failed': {
81
- title: 'This page could not render',
82
- body: 'The customer site reported a rendering error. You can open another document. Retry this page after its rendering error has been corrected.',
83
- commonCauses: [],
84
- },
85
- // ─── D-category runtime warnings/errors (emitted by SDK boot/schema) ──
86
- 'runtime.cache_unavailable': {
87
- title: 'Preview cache unavailable',
88
- body: 'The preview cache could not be opened, so observed overlays are disabled. Authenticated preview still works; the editor will fall back to explicit rendering.',
89
- commonCauses: [
90
- 'IndexedDB is disabled (private browsing on older Firefox / Safari).',
91
- 'A browser extension is blocking storage access.',
92
- ],
93
- },
94
- 'runtime.schema_sync_delayed': {
95
- title: 'Loading schema is taking longer than usual',
96
- body: 'Studio is still fetching the project schema. Field-level overlays will be limited until the schema arrives.',
97
- commonCauses: [
98
- 'Slow network between the iframe and the Storystick gateway.',
99
- 'The gateway returned a transient error and the SDK is retrying.',
100
- ],
101
- },
102
- 'runtime.schema_delivery_failed': {
103
- title: 'Schema delivery failed',
104
- body: 'The preview schema could not be fetched after 5 attempts. Field-level overlays are unavailable for this session.',
105
- commonCauses: [
106
- 'The Storystick gateway is unreachable from the iframe.',
107
- 'Network conditions prevented the schema HTTP request from completing.',
108
- 'Reload the iframe to retry from a fresh attempt cycle.',
109
- ],
110
- },
111
- // ─── Grant / origin / session codes ────────────────────────────
112
- identity_carrier_timeout: {
113
- title: 'Preview identity could not be established',
114
- body: 'Studio did not deliver a preview identity to this iframe in time. Reopen the document in Storystick Studio to retry.',
115
- commonCauses: [],
116
- },
117
- PREVIEW_GRANT_MISSING: PREVIEW_ADMISSION_MISSING,
118
- 'storystick/PREVIEW_GRANT_MISSING': PREVIEW_ADMISSION_MISSING,
119
- CONTENT_SHAPE_RELOAD_REQUIRED: PREVIEW_RENDER_ADMISSION_MISSING,
120
- 'storystick/CONTENT_SHAPE_RELOAD_REQUIRED': PREVIEW_RENDER_ADMISSION_MISSING,
121
- PREVIEW_GRANT_MALFORMED: PREVIEW_ACCESS_ENDED,
122
- 'storystick/PREVIEW_GRANT_MALFORMED': PREVIEW_ACCESS_ENDED,
123
- PREVIEW_GRANT_INVALID: PREVIEW_ACCESS_ENDED,
124
- 'storystick/PREVIEW_GRANT_INVALID': PREVIEW_ACCESS_ENDED,
125
- PREVIEW_GRANT_REVOKED: PREVIEW_ACCESS_ENDED,
126
- 'storystick/PREVIEW_GRANT_REVOKED': PREVIEW_ACCESS_ENDED,
127
- PREVIEW_GRANT_EXPIRED: PREVIEW_ACCESS_ENDED,
128
- 'storystick/PREVIEW_GRANT_EXPIRED': PREVIEW_ACCESS_ENDED,
129
- PREVIEW_ACCESS_REVOKED: PREVIEW_ACCESS_ENDED,
130
- 'storystick/PREVIEW_ACCESS_REVOKED': PREVIEW_ACCESS_ENDED,
131
- PREVIEW_VIEW_UNAVAILABLE,
132
- 'storystick/PREVIEW_VIEW_UNAVAILABLE': PREVIEW_VIEW_UNAVAILABLE,
133
- PREVIEW_ADMISSION_SUPERSEDED,
134
- 'storystick/PREVIEW_ADMISSION_SUPERSEDED': PREVIEW_ADMISSION_SUPERSEDED,
135
- PREVIEW_CONTEXT_INVALID: PREVIEW_ACCESS_ENDED,
136
- 'storystick/PREVIEW_CONTEXT_INVALID': PREVIEW_ACCESS_ENDED,
137
- PREVIEW_CONTEXT_ENDED: PREVIEW_ACCESS_ENDED,
138
- PREVIEW_CONTEXT_EXIT_UNAVAILABLE: {
139
- title: 'Preview exit could not finish',
140
- body: 'The shared preview ended, but this page could not clear its local preview access. Retry Exit Preview.',
141
- commonCauses: [],
142
- },
143
- PREVIEW_GRANT_REQUIRED: PREVIEW_BINDING_MISMATCH,
144
- PREVIEW_GRANT_FORBIDDEN: PREVIEW_BINDING_MISMATCH,
145
- 'storystick/PREVIEW_GRANT_FORBIDDEN': PREVIEW_BINDING_MISMATCH,
146
- PREVIEW_GRANT_BINDING_MISMATCH: PREVIEW_BINDING_MISMATCH,
147
- 'storystick/PREVIEW_GRANT_BINDING_MISMATCH': PREVIEW_BINDING_MISMATCH,
148
- PREVIEW_ORIGIN_MISMATCH: PREVIEW_BINDING_MISMATCH,
149
- 'storystick/PREVIEW_ORIGIN_MISMATCH': PREVIEW_BINDING_MISMATCH,
150
- PREVIEW_PROJECT_MISMATCH: PREVIEW_BINDING_MISMATCH,
151
- 'storystick/PREVIEW_PROJECT_MISMATCH': PREVIEW_BINDING_MISMATCH,
152
- PREVIEW_TOKEN_PROTOCOL_INVALID: PREVIEW_PROTOCOL_INVALID,
153
- PREVIEW_REQUIRED: {
154
- title: 'Preview mode required',
155
- body: 'This route can only be rendered inside an active Storystick preview session. Open it from Studio to view.',
156
- commonCauses: [],
157
- },
158
- UNKNOWN: {
159
- title: 'Unknown preview error',
160
- body: 'The Storystick SDK received an unrecognised error code. Reload the iframe ; if the issue persists, check the Studio logs.',
161
- commonCauses: [],
162
- },
163
- };
164
- /**
165
- * Fallback entry. Returned by `lookupSdkCopy` for codes not in the map.
166
- * Honest body — the SDK doesn't pretend to know.
167
- */
168
- const FALLBACK_SDK_ENTRY = {
169
- title: 'Storystick preview error',
170
- body: 'Preview connection lost. Reopen the document in Storystick Studio to resume.',
171
- commonCauses: [],
172
- };
173
- /**
174
- * Look up the structured SDK copy for a code. Always returns an entry
175
- * (never null) so the panel can render unconditionally.
176
- */
1
+ import { PREVIEW_FEEDBACK, lookupPreviewFeedback } from './framework/preview-feedback.js';
2
+ export const SDK_ERROR_COPY = Object.fromEntries(Object.entries(PREVIEW_FEEDBACK).map(([code, entry]) => [code, { ...entry, commonCauses: [] }]));
177
3
  export function lookupSdkCopy(code) {
178
- if (typeof code !== 'string' || code.length === 0) {
179
- return FALLBACK_SDK_ENTRY;
180
- }
181
- return SDK_ERROR_COPY[code] ?? FALLBACK_SDK_ENTRY;
4
+ return { ...lookupPreviewFeedback(code), commonCauses: [] };
182
5
  }
@@ -1,3 +1,6 @@
1
+ import { lookupPreviewFeedback } from '../framework/preview-feedback.js';
2
+ import { PREVIEW_COPY } from '../framework/preview-copy.js';
3
+ import { previewDiagnostic, safePreviewCode } from '../framework/preview-diagnostic.js';
1
4
  import { PREVIEW_PAGE_BRAND_HTML, PREVIEW_PAGE_STYLES } from "../page-presentation.js";
2
5
  import { StorystickError } from "@storystick/client";
3
6
  import { mapPreviewSessionError } from "@storystick/preview/session-subscriber";
@@ -63,12 +66,9 @@ function buildHtmlError(error, sessionId) {
63
66
  const diagnostic = sessionId && /^[A-Za-z0-9_-]{1,128}$/.test(sessionId) && diagnosticCodes.includes(error.code)
64
67
  ? `<script>window.parent.postMessage(${JSON.stringify({ type: 'storystick.preview.activation-error', sessionId, code: error.code })}, '*');</script>`
65
68
  : '';
66
- const code = escapeHtml(error.code);
67
- const details = escapeHtml([
68
- error.code, error.message,
69
- ...('upstreamCode' in error && error.upstreamCode ? [`Upstream code: ${error.upstreamCode}`] : []),
70
- ...('upstreamRef' in error && error.upstreamRef ? [`Reference: ${error.upstreamRef}`] : []),
71
- ].join('\n'));
69
+ const code = escapeHtml(safePreviewCode(error.code));
70
+ const feedback = lookupPreviewFeedback(error.code);
71
+ const details = escapeHtml(previewDiagnostic({ code: error.code, reference: 'upstreamRef' in error ? error.upstreamRef : undefined }));
72
72
  const retryScript = error.retryable
73
73
  ? `<script>
74
74
  (() => {
@@ -93,10 +93,10 @@ function buildHtmlError(error, sessionId) {
93
93
  } catch (_) {}
94
94
  if (attempt >= maxAttempts) {
95
95
  document.body.dataset.previewRecovery = 'stopped';
96
- document.title = 'Preview unavailable';
96
+ document.title = ${JSON.stringify(PREVIEW_COPY['connection-interrupted'].title)};
97
97
  document.querySelector('[data-ss-preview-page-progress]')?.remove();
98
- document.querySelector('[data-ss-preview-page-title]').textContent = 'Preview unavailable';
99
- document.querySelector('[data-ss-preview-page-description]').textContent = 'The site could not reconnect. Try again, or reopen Preview from Studio.';
98
+ document.querySelector('[data-ss-preview-page-title]').textContent = ${JSON.stringify(PREVIEW_COPY['connection-interrupted'].title)};
99
+ document.querySelector('[data-ss-preview-page-description]').textContent = ${JSON.stringify(PREVIEW_COPY['connection-interrupted'].body)};
100
100
  return;
101
101
  }
102
102
  const delay = Math.min(5000, Math.round(500 * Math.pow(1.5, attempt - 1)));
@@ -106,12 +106,8 @@ function buildHtmlError(error, sessionId) {
106
106
  })();
107
107
  </script>`
108
108
  : "";
109
- const title = error.retryable ? "Preview reconnecting" : "Preview unavailable";
110
- const description = error.retryable
111
- ? "We’re reconnecting to your site. Your preview will open here when it’s ready."
112
- : error.code === "PREVIEW_PROJECT_MISMATCH"
113
- ? "This site belongs to another project. Open Preview from the correct project in Studio."
114
- : "Reopen this preview from Storystick Studio to continue.";
109
+ const title = escapeHtml(error.retryable ? PREVIEW_COPY.reconnecting.title : feedback.title);
110
+ const description = escapeHtml(error.retryable ? PREVIEW_COPY.reconnecting.body : feedback.action === 'reconnect' ? `${feedback.body} ${PREVIEW_COPY['open-from-studio'].body}` : feedback.body);
115
111
  return `<!doctype html>
116
112
  <html lang="en">
117
113
  <head>
@@ -121,10 +117,10 @@ function buildHtmlError(error, sessionId) {
121
117
  <style>body { margin: 0; } ${PREVIEW_PAGE_STYLES}</style>
122
118
  </head>
123
119
  <body>
124
- <main data-ss-preview-page>
120
+ <main data-ss-preview-page data-preview-code="${code}">
125
121
  <div data-ss-preview-page-content>
126
122
  ${PREVIEW_PAGE_BRAND_HTML}
127
- <div role="${error.retryable ? 'status' : 'alert'}">
123
+ <div role="status">
128
124
  <div data-ss-preview-page-heading>
129
125
  ${error.retryable ? '<span data-ss-preview-page-progress aria-hidden="true"></span>' : ''}
130
126
  <h1 data-ss-preview-page-title>${title}</h1>
@@ -132,10 +128,10 @@ function buildHtmlError(error, sessionId) {
132
128
  <p data-ss-preview-page-description>${description}</p>
133
129
  </div>
134
130
  ${error.retryable ? '<div data-ss-preview-page-actions><button type="button" data-ss-preview-page-action="primary" onclick="window.location.reload()">Try again</button></div>' : ''}
135
- <details>
136
- <summary>Technical details</summary>
131
+ ${feedback.diagnostic ? `<details>
132
+ <summary>Diagnostic</summary>
137
133
  <pre data-preview-error="${code}">${details}</pre>
138
- </details>
134
+ </details>` : ''}
139
135
  </div>
140
136
  </main>
141
137
  ${diagnostic}
@@ -1,3 +1,4 @@
1
+ import { collectRouteDocumentSliceTypes } from '@storystick/types/public-delivery';
1
2
  import { collectPreviewReadObservations } from '@storystick/client/internal';
2
3
  import { appliedPreviewVariantIdFromQueryResult, previewReadScopeEchoFromQueryResult, requestedPreviewVariantIdFromQueryResult, collectPreviewProvenanceSourceMappedQueryResults, collectPreviewFrameDependencies, createPreviewProvenanceEditableManifestMatcher, formatPreviewProvenanceCanonicalPath, materializePreviewProvenanceSourceMap, planPreviewProvenanceEditableTextLeaves, previewProvenanceEditableTextPathPatternMatches, previewProvenanceRichTextTextNodes, previewProvenanceSourceIdentityFromQueryResult, } from '@storystick/preview/provenance';
3
4
  import { normalizePreviewVariantId } from '@storystick/preview/identity';
@@ -515,18 +516,7 @@ function collectSlicePlanningScopes(document) {
515
516
  return scopes;
516
517
  }
517
518
  export function unstable_collectPreviewRouteDocumentSliceTypes(document) {
518
- const out = new Set();
519
- for (const scope of collectSlicePlanningScopes(document)) {
520
- for (const slice of scope.slices) {
521
- if (!isRecord(slice))
522
- continue;
523
- const sliceType = slice._type;
524
- if (typeof sliceType === 'string' && sliceType.length > 0) {
525
- out.add(sliceType);
526
- }
527
- }
528
- }
529
- return out;
519
+ return collectRouteDocumentSliceTypes(document);
530
520
  }
531
521
  function zoneMappingsSidecar(document) {
532
522
  const mappings = document._zoneMappings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storystick/preview",
3
- "version": "0.2.0-rc.1",
3
+ "version": "0.2.0-rc.3",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -181,9 +181,9 @@
181
181
  },
182
182
  "dependencies": {
183
183
  "convex": "1.42.3",
184
- "@storystick/client": "0.2.0-rc.1",
185
- "@storystick/transport-allowlist": "0.1.0-rc.1",
186
- "@storystick/types": "0.1.0-rc.1"
184
+ "@storystick/transport-allowlist": "0.1.0-rc.3",
185
+ "@storystick/client": "0.2.0-rc.3",
186
+ "@storystick/types": "0.1.0-rc.3"
187
187
  },
188
188
  "devDependencies": {
189
189
  "fake-indexeddb": "^6.2.5",
@@ -193,7 +193,7 @@
193
193
  "@types/node": "^22.13.10"
194
194
  },
195
195
  "engines": {
196
- "node": ">=24.19.0 <25"
196
+ "node": "^22.13.0 || ^24.19.0"
197
197
  },
198
198
  "repository": {
199
199
  "type": "git",