@buffcore/admin-shell 0.8.43 → 0.8.45
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/dist/components/Markdown.d.ts +9 -3
- package/dist/components/Markdown.js +84 -34
- package/dist/components/Sheet.d.ts +5 -1
- package/dist/components/Sheet.js +8 -2
- package/dist/components/TextArea.d.ts +3 -1
- package/dist/components/TextArea.js +3 -3
- package/dist/components/icons.d.ts +1 -0
- package/dist/components/icons.js +1 -0
- package/dist/workbench/app/ServedPrototype.d.ts +2 -0
- package/dist/workbench/app/ServedPrototype.js +11 -1
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
- package/dist/workbench/app/actions.d.ts +4 -2
- package/dist/workbench/app/actions.js +9 -4
- package/dist/workbench/app/brief-short.d.ts +14 -0
- package/dist/workbench/app/brief-short.js +103 -0
- package/dist/workbench/app/chat-session.d.ts +5 -5
- package/dist/workbench/app/chat-session.js +8 -3
- package/dist/workbench/app/chat.d.ts +17 -4
- package/dist/workbench/app/chat.js +9 -4
- package/dist/workbench/app/frame.js +5 -1
- package/dist/workbench/app/loop.js +2 -18
- package/dist/workbench/app/pages.js +10 -2
- package/dist/workbench/app/prototype.js +3 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +13 -1
- package/dist/workbench/app/useStudio.d.ts +2 -1
- package/dist/workbench/studio/frame/AgentPanel.js +24 -1
- package/dist/workbench/studio/frame/Composer.js +13 -10
- package/dist/workbench/studio/frame/PanelList.js +1 -1
- package/dist/workbench/studio/frame/Segmented.d.ts +3 -1
- package/dist/workbench/studio/frame/Segmented.js +4 -3
- package/dist/workbench/studio/frame/SettingsSheet.js +10 -9
- package/dist/workbench/studio/frame/StudioFrame.js +7 -6
- package/dist/workbench/studio/frame/StudioRegions.js +4 -1
- package/dist/workbench/studio/frame/TurnControls.d.ts +2 -1
- package/dist/workbench/studio/frame/TurnControls.js +4 -1
- package/dist/workbench/studio/frame/layout.d.ts +2 -0
- package/dist/workbench/studio/frame/layout.js +2 -0
- package/dist/workbench/studio/frame/panelControls.d.ts +21 -1
- package/dist/workbench/studio/frame/scrollbars.d.ts +1 -0
- package/dist/workbench/studio/frame/scrollbars.js +12 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +22 -2
- package/dist/workbench/studio/frame/useTurnDraft.js +48 -16
- package/dist/workbench/studio/i18n/frame.en.d.ts +3 -0
- package/dist/workbench/studio/i18n/frame.en.js +4 -1
- package/dist/workbench/studio/i18n/frame.es.json +4 -1
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/i18n/loop.en.d.ts +11 -38
- package/dist/workbench/studio/i18n/loop.en.js +11 -38
- package/dist/workbench/studio/i18n/loop.es.json +11 -38
- package/dist/workbench/studio/i18n/marks.en.d.ts +41 -0
- package/dist/workbench/studio/i18n/marks.en.js +42 -0
- package/dist/workbench/studio/i18n/marks.es.json +40 -0
- package/dist/workbench/studio/i18n/start.en.d.ts +5 -0
- package/dist/workbench/studio/i18n/start.en.js +7 -2
- package/dist/workbench/studio/i18n/start.es.json +7 -2
- package/dist/workbench/studio/i18n/workspace.en.d.ts +45 -0
- package/dist/workbench/studio/i18n/workspace.en.js +46 -0
- package/dist/workbench/studio/i18n/workspace.es.json +44 -0
- package/dist/workbench/studio/loop/BriefDocument.d.ts +9 -6
- package/dist/workbench/studio/loop/BriefDocument.js +48 -76
- package/dist/workbench/studio/loop/BriefLists.d.ts +11 -0
- package/dist/workbench/studio/loop/BriefLists.js +42 -0
- package/dist/workbench/studio/loop/BriefPage.d.ts +6 -2
- package/dist/workbench/studio/loop/BriefPage.js +32 -4
- package/dist/workbench/studio/loop/BriefReading.d.ts +19 -0
- package/dist/workbench/studio/loop/BriefReading.js +22 -0
- package/dist/workbench/studio/loop/BriefSection.d.ts +22 -0
- package/dist/workbench/studio/loop/BriefSection.js +47 -0
- package/dist/workbench/studio/loop/BriefWho.d.ts +6 -0
- package/dist/workbench/studio/loop/BriefWho.js +56 -0
- package/dist/workbench/studio/loop/CanvasBar.d.ts +0 -1
- package/dist/workbench/studio/loop/CanvasBar.js +2 -3
- package/dist/workbench/studio/loop/ConsoleFrame.d.ts +13 -0
- package/dist/workbench/studio/loop/ConsoleFrame.js +29 -0
- package/dist/workbench/studio/loop/NotThisCard.d.ts +6 -1
- package/dist/workbench/studio/loop/NotThisCard.js +28 -20
- package/dist/workbench/studio/loop/ProtoJourneys.d.ts +1 -8
- package/dist/workbench/studio/loop/ProtoJourneys.js +0 -14
- package/dist/workbench/studio/loop/PrototypeApp.d.ts +12 -1
- package/dist/workbench/studio/loop/PrototypeApp.js +30 -13
- package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
- package/dist/workbench/studio/loop/PrototypeAttempt.js +94 -29
- package/dist/workbench/studio/loop/PrototypePage.d.ts +4 -2
- package/dist/workbench/studio/loop/PrototypePage.js +25 -1
- package/dist/workbench/studio/loop/PrototypePreview.d.ts +35 -6
- package/dist/workbench/studio/loop/PrototypePreview.js +127 -76
- package/dist/workbench/studio/loop/PrototypePreviewSlot.d.ts +13 -0
- package/dist/workbench/studio/loop/PrototypePreviewSlot.js +23 -0
- package/dist/workbench/studio/loop/PrototypeScenes.d.ts +1 -1
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StudioLoop.d.ts +7 -2
- package/dist/workbench/studio/loop/StudioLoop.js +4 -10
- package/dist/workbench/studio/loop/WorkspaceBar.d.ts +15 -0
- package/dist/workbench/studio/loop/WorkspaceBar.js +52 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.d.ts +17 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.js +99 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.d.ts +14 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.js +42 -0
- package/dist/workbench/studio/loop/WorkspaceStage.d.ts +24 -0
- package/dist/workbench/studio/loop/WorkspaceStage.js +142 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.d.ts +20 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.js +96 -0
- package/dist/workbench/studio/loop/moments.js +0 -3
- package/dist/workbench/studio/loop/prototype-bridge.d.ts +8 -0
- package/dist/workbench/studio/loop/prototype-bridge.js +16 -0
- package/dist/workbench/studio/loop/prototype-document.d.ts +9 -0
- package/dist/workbench/studio/loop/prototype-document.js +90 -2
- package/dist/workbench/studio/loop/prototype-part.d.ts +43 -0
- package/dist/workbench/studio/loop/prototype-part.js +104 -0
- package/dist/workbench/studio/loop/types.d.ts +26 -26
- package/dist/workbench/studio/loop/types.js +0 -3
- package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +6 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.js +4 -0
- package/dist/workbench/studio/loop/workspace-journeys.d.ts +22 -0
- package/dist/workbench/studio/loop/workspace-journeys.js +63 -0
- package/dist/workbench/studio/loop/workspace-state.d.ts +94 -0
- package/dist/workbench/studio/loop/workspace-state.js +50 -0
- package/dist/workbench/studio/marks/ChangeList.d.ts +7 -0
- package/dist/workbench/studio/marks/ChangeList.js +70 -0
- package/dist/workbench/studio/marks/MarkHint.d.ts +18 -0
- package/dist/workbench/studio/marks/MarkHint.js +58 -0
- package/dist/workbench/studio/marks/MarkNumber.d.ts +6 -0
- package/dist/workbench/studio/marks/MarkNumber.js +24 -0
- package/dist/workbench/studio/marks/MarksLayer.d.ts +15 -0
- package/dist/workbench/studio/marks/MarksLayer.js +144 -0
- package/dist/workbench/studio/marks/PinNote.d.ts +13 -0
- package/dist/workbench/studio/marks/PinNote.js +49 -0
- package/dist/workbench/studio/marks/QueuedChanges.d.ts +6 -0
- package/dist/workbench/studio/marks/QueuedChanges.js +51 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.d.ts +15 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.js +67 -0
- package/dist/workbench/studio/marks/marks-message.d.ts +13 -0
- package/dist/workbench/studio/marks/marks-message.js +93 -0
- package/dist/workbench/studio/marks/marks.d.ts +105 -0
- package/dist/workbench/studio/marks/marks.js +133 -0
- package/dist/workbench/studio/marks/useMarking.d.ts +36 -0
- package/dist/workbench/studio/marks/useMarking.js +111 -0
- package/dist/workbench/studio/marks/useSendMarks.d.ts +18 -0
- package/dist/workbench/studio/marks/useSendMarks.js +80 -0
- package/dist/workbench/studio/types.d.ts +2 -0
- package/dist/workbench/studio/work/StudioLater.js +0 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +6 -0
- package/package.json +6 -6
- package/dist/workbench/studio/loop/FsPlan.d.ts +0 -7
- package/dist/workbench/studio/loop/FsPlan.js +0 -64
- package/dist/workbench/studio/loop/FsStage.d.ts +0 -6
- package/dist/workbench/studio/loop/FsStage.js +0 -74
- package/dist/workbench/studio/loop/FsToolbar.d.ts +0 -6
- package/dist/workbench/studio/loop/FsToolbar.js +0 -61
- package/dist/workbench/studio/loop/FullScreen.d.ts +0 -5
- package/dist/workbench/studio/loop/FullScreen.js +0 -89
- package/dist/workbench/studio/loop/PrototypePreviewMenus.d.ts +0 -18
- package/dist/workbench/studio/loop/PrototypePreviewMenus.js +0 -75
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.d.ts +0 -27
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.js +0 -52
- package/dist/workbench/studio/loop/fsViews.d.ts +0 -12
- package/dist/workbench/studio/loop/fsViews.js +0 -6
|
@@ -1,37 +1,61 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { PrototypeAppFrame } from './PrototypeAppFrame.js';
|
|
4
4
|
import { PrototypeAppView } from './PrototypeAppView.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useShowPreview } from './PrototypePreviewSlot.js';
|
|
6
6
|
import { usePrototypeFrame } from './usePrototypeFrame.js';
|
|
7
7
|
export function PrototypeAttempt({ navigation, onNavigate, onSwitch, ...props }) {
|
|
8
|
-
const
|
|
9
|
-
embed: '1',
|
|
10
|
-
apeNav: navigation.id,
|
|
11
|
-
locale: props.locale,
|
|
12
|
-
mode: props.mode,
|
|
13
|
-
...(navigation.journey ? { journey: navigation.journey.key } : {}),
|
|
14
|
-
...(props.preview ? { studioPreview: '1' } : {}),
|
|
15
|
-
...(props.preview && navigation.journey ? { stepCaption: '1' } : {}),
|
|
16
|
-
...(navigation.step !== undefined ? { step: String(navigation.step) } : {}),
|
|
17
|
-
...(navigation.data ? { data: navigation.data } : {}),
|
|
18
|
-
}).toString();
|
|
19
|
-
const url = new URL(props.address);
|
|
20
|
-
url.search = search;
|
|
21
|
-
const model = usePrototypeFrame(url.origin, navigation.id, props.address !== props.given ? onSwitch : undefined,
|
|
8
|
+
const model = usePrototypeFrame(new URL(props.address).origin, navigation.id, props.address !== props.given ? onSwitch : undefined,
|
|
22
9
|
// One missed probe is not "not running" while the app answered lately.
|
|
23
10
|
props.running === false && props.snapshotReady ? undefined : props.running);
|
|
11
|
+
// The address is fixed for each document the frame loads (a navigation, or a retry of it), with
|
|
12
|
+
// the choice of that moment; a later choice the running app was told leaves it, so no reload.
|
|
13
|
+
const previewing = !!props.preview;
|
|
14
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a new document takes the current choice
|
|
15
|
+
const url = useMemo(() => frameAddress(props, navigation, previewing), [props.address, props.locale, props.mode, previewing, navigation.id, model.frameKey]);
|
|
24
16
|
const ready = model.journeys !== undefined;
|
|
17
|
+
// In the studio's preview a running app is told the choice; elsewhere the frame reloads with it.
|
|
18
|
+
const go = (choice) => onNavigate(choice, !!props.preview &&
|
|
19
|
+
model.show({ journey: choice.journey?.key, step: choice.step, data: choice.data }));
|
|
25
20
|
const play = (key) => {
|
|
26
21
|
const journey = model.journeys?.find((candidate) => candidate.key === key);
|
|
27
22
|
if (journey && model.alive())
|
|
28
|
-
|
|
23
|
+
go({ journey, overlay: model.preview !== undefined });
|
|
29
24
|
};
|
|
25
|
+
// Play on another page: once the running app lists its journeys, that one starts at step 1.
|
|
26
|
+
const asked = props.play;
|
|
27
|
+
const listed = model.journeys;
|
|
28
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: once per request and journey list
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!asked || !listed || !model.alive())
|
|
31
|
+
return;
|
|
32
|
+
const journey = listed.find((candidate) => candidate.key === asked.id) ??
|
|
33
|
+
listed.find((candidate) => !!asked.name && candidate.title === asked.name);
|
|
34
|
+
if (journey)
|
|
35
|
+
go({ journey, step: 0, overlay: model.preview !== undefined });
|
|
36
|
+
else
|
|
37
|
+
props.onPlayed?.();
|
|
38
|
+
}, [asked, listed]);
|
|
30
39
|
const app = (_jsx(PrototypeAppFrame, { frame: model.frame, url: url.href, href: props.href, product: props.product, ready: ready, enlarged: !!navigation.journey, failure: model.failure, recoverable: model.recoverable, onDev: props.onDev, cause: model.cause, fill: !!props.preview }, model.frameKey));
|
|
31
40
|
if (props.preview)
|
|
32
|
-
return (_jsx(LivePreview, { ...props, preview: props.preview, app, model, navigation,
|
|
41
|
+
return (_jsx(LivePreview, { ...props, preview: props.preview, app, model, navigation, play, onNavigate: go }));
|
|
33
42
|
return (_jsx(PrototypeAppView, { title: props.product, href: props.href, ready: ready, journeys: model.journeys ?? [], left: model.left, onPlay: play, onSignInHelp: () => model.fail('cookies'), app: app, reviewPanel: props.reviewPanel?.(ready, true) }));
|
|
34
43
|
}
|
|
44
|
+
function frameAddress(props, navigation, previewing) {
|
|
45
|
+
const url = new URL(props.address);
|
|
46
|
+
url.search = new URLSearchParams({
|
|
47
|
+
embed: '1',
|
|
48
|
+
apeNav: navigation.id,
|
|
49
|
+
locale: props.locale,
|
|
50
|
+
mode: props.mode,
|
|
51
|
+
...(navigation.journey ? { journey: navigation.journey.key } : {}),
|
|
52
|
+
...(previewing ? { studioPreview: '1', stepCaption: '1' } : {}),
|
|
53
|
+
...(navigation.step !== undefined ? { step: String(navigation.step) } : {}),
|
|
54
|
+
...(navigation.data ? { data: navigation.data } : {}),
|
|
55
|
+
}).toString();
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
/** The running app's part of the workspace, shown in the slot above it (PrototypePreviewSlot). */
|
|
35
59
|
function LivePreview({ app, product, href, preview, model, navigation, onNavigate, play, }) {
|
|
36
60
|
const ready = model.journeys !== undefined;
|
|
37
61
|
const journeys = model.journeys ?? [];
|
|
@@ -42,23 +66,64 @@ function LivePreview({ app, product, href, preview, model, navigation, onNavigat
|
|
|
42
66
|
const step = current && requested < current.steps ? requested : 0;
|
|
43
67
|
const caption = model.stepCaption;
|
|
44
68
|
const data = navigation.data ?? 'full';
|
|
45
|
-
|
|
69
|
+
// One step mover for as long as the app runs: what draws over the stage keeps its hold on it.
|
|
70
|
+
const latest = useRef({ selected, model, onNavigate, preview });
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
latest.current = { selected, model, onNavigate, preview };
|
|
73
|
+
});
|
|
74
|
+
const onStep = useCallback((next) => {
|
|
75
|
+
const { selected, model, onNavigate } = latest.current;
|
|
76
|
+
if (selected && model.preview && model.alive() && next >= 0 && next < selected.steps)
|
|
77
|
+
onNavigate({ journey: selected, step: next, overlay: true });
|
|
78
|
+
}, []);
|
|
79
|
+
const partAt = useCallback((x, y) => latest.current.model.partAt(x, y), []);
|
|
80
|
+
// A mark in the change list shows its device, and its journey step or sample data, again.
|
|
81
|
+
const onShow = useCallback((place) => {
|
|
82
|
+
const { model, onNavigate, preview } = latest.current;
|
|
83
|
+
preview.onDevice?.(place.device);
|
|
84
|
+
if (place.device === 'tablet')
|
|
85
|
+
preview.onOrientation?.(place.orientation ?? 'portrait');
|
|
86
|
+
if (!model.alive())
|
|
87
|
+
return;
|
|
88
|
+
const journey = model.journeys?.find((entry) => entry.key === place.journey);
|
|
89
|
+
const data = (place.data ?? 'full');
|
|
90
|
+
if (journey)
|
|
91
|
+
onNavigate({ journey, step: place.step ?? 0, overlay: true });
|
|
92
|
+
else if (!place.journey && model.preview?.includes(data))
|
|
93
|
+
onNavigate({ data });
|
|
94
|
+
}, []);
|
|
95
|
+
useShowPreview({
|
|
96
|
+
product,
|
|
97
|
+
app,
|
|
98
|
+
ready,
|
|
99
|
+
href: ready ? href : undefined,
|
|
100
|
+
roles: preview.roles,
|
|
101
|
+
journeys,
|
|
102
|
+
left: model.left,
|
|
103
|
+
journey: selected?.key,
|
|
104
|
+
device: preview.device ?? 'mobile',
|
|
105
|
+
orientation: preview.orientation,
|
|
106
|
+
onDevice: preview.onDevice,
|
|
107
|
+
onOrientation: preview.onOrientation,
|
|
108
|
+
dataStates: model.preview,
|
|
109
|
+
data: !selected && model.preview?.includes(data) ? data : undefined,
|
|
110
|
+
onPlay: play,
|
|
111
|
+
partAt,
|
|
112
|
+
onShow,
|
|
113
|
+
onData: (choice) => {
|
|
46
114
|
if (model.alive() && model.preview?.includes(choice))
|
|
47
115
|
onNavigate({ data: choice });
|
|
48
|
-
},
|
|
116
|
+
},
|
|
117
|
+
play: current && (model.preview || opening)
|
|
49
118
|
? {
|
|
119
|
+
title: current.title,
|
|
50
120
|
step,
|
|
51
121
|
total: current.steps,
|
|
52
122
|
caption: caption?.key === current.key && caption.step === step ? caption.text : '',
|
|
53
123
|
pending: !ready,
|
|
54
|
-
onStep
|
|
55
|
-
if (selected &&
|
|
56
|
-
model.preview &&
|
|
57
|
-
model.alive() &&
|
|
58
|
-
next >= 0 &&
|
|
59
|
-
next < selected.steps)
|
|
60
|
-
onNavigate({ journey: selected, step: next, overlay: true });
|
|
61
|
-
},
|
|
124
|
+
onStep,
|
|
62
125
|
}
|
|
63
|
-
: undefined
|
|
126
|
+
: undefined,
|
|
127
|
+
});
|
|
128
|
+
return null;
|
|
64
129
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import type { PrototypeComment } from '../../app/prototype.ts';
|
|
3
3
|
import type { Level } from '../types.ts';
|
|
4
4
|
import { type PrototypeAppProps } from './PrototypeApp.tsx';
|
|
@@ -6,6 +6,7 @@ import type { PrototypeSnapshotProps } from './PrototypeSnapshot.tsx';
|
|
|
6
6
|
import type { PrototypeChecks } from './PrototypeVersionBar.tsx';
|
|
7
7
|
import { type ProtoView } from './protoView.ts';
|
|
8
8
|
import type { LoopMoment, LoopSample } from './types.ts';
|
|
9
|
+
import { type WorkspaceSetup } from './workspace-state.tsx';
|
|
9
10
|
export type PrototypeSample = Pick<LoopSample, 'product' | 'proto' | 'journeys' | 'choices'>;
|
|
10
11
|
/** The comp (`PrototypeComp`): shown in the app's place while `open`, else its summary below. */
|
|
11
12
|
export interface CompSlot {
|
|
@@ -44,9 +45,10 @@ export interface PrototypePageProps {
|
|
|
44
45
|
onPlayer?: (action: 'play' | 'next' | 'start') => void;
|
|
45
46
|
onData?: (data: ProtoView['data']) => void;
|
|
46
47
|
onMarks?: (on: boolean) => void;
|
|
47
|
-
onFullScreen?: () => void;
|
|
48
48
|
onCatchUp?: () => void;
|
|
49
49
|
onAction?: (action: string) => void;
|
|
50
50
|
level?: Level | null;
|
|
51
|
+
/** What marking adds to the workspace: the overlay over the device, the marks' count, the tool. */
|
|
52
|
+
workspace?: Pick<WorkspaceSetup, 'overlay' | 'changes' | 'tool' | 'onTool'>;
|
|
51
53
|
}
|
|
52
54
|
export declare function PrototypePage(props: PrototypePageProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// The product app first; saved review below it, and the existing scenes last.
|
|
3
3
|
import { useT } from '@buffcore/i18n/react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
import { IsolatedFrames } from '../../../components/frame-isolation.js';
|
|
5
6
|
import { Page } from '../../../components/Page.js';
|
|
6
7
|
import { Loading } from '../../../components/states.js';
|
|
@@ -17,9 +18,11 @@ import { PrototypeSimplePage } from './PrototypeSimplePage.js';
|
|
|
17
18
|
import { prototypeAddress } from './prototype-bridge.js';
|
|
18
19
|
import { PROTOTYPE_HOME_LAYOUT } from './prototype-home-layout.js';
|
|
19
20
|
import { canApprove, PROTO_VIEWS } from './protoView.js';
|
|
21
|
+
import { PrototypeWorkspace } from './workspace-state.js';
|
|
20
22
|
export function PrototypePage(props) {
|
|
21
23
|
const { sample, moment, view: suppliedView, onApprove } = props;
|
|
22
24
|
const t = useT();
|
|
25
|
+
const setup = useWorkspaceSetup(props);
|
|
23
26
|
const source = suppliedView ?? (moment ? PROTO_VIEWS[moment] : undefined);
|
|
24
27
|
const view = source && {
|
|
25
28
|
...source,
|
|
@@ -28,13 +31,34 @@ export function PrototypePage(props) {
|
|
|
28
31
|
if (!view)
|
|
29
32
|
return _jsx(Loading, {});
|
|
30
33
|
if (props.simple && props.home)
|
|
31
|
-
return (_jsx(PrototypeSimplePage, { ...props, view: view, preview: _jsx(
|
|
34
|
+
return (_jsx(PrototypeSimplePage, { ...props, view: view, preview: _jsx(PrototypeWorkspace, { setup: setup, children: _jsx(PrototypeApp, { ...props.home, preview: {
|
|
35
|
+
roles: sample.journeys,
|
|
36
|
+
device: view.device,
|
|
37
|
+
onDevice: props.onDevice,
|
|
38
|
+
orientation: view.orientation,
|
|
39
|
+
onOrientation: props.onOrientation,
|
|
40
|
+
} }) }) }));
|
|
32
41
|
const approve = canApprove(view);
|
|
33
42
|
const legacyHref = !props.home ? prototypeAddress(props.appUrl)?.href : undefined;
|
|
34
43
|
return (_jsx(HostSide, { subject: { change: sample.proto.change.id, version: view.version }, children: _jsxs(Page, { boundedHeader: !!props.home, crumbs: [prototypeCrumb(sample, view, t)].filter(Boolean), title: props.title ?? t('studio.frame.page.prototype'), sub: t(props.home ? 'studio.prototype.intro' : 'studio.loop.proto.lead', {
|
|
35
44
|
name: sample.product.name,
|
|
36
45
|
}), actions: !props.home && (approve || legacyHref) ? (_jsxs(Row, { children: [legacyHref && (_jsx("a", { href: legacyHref, target: "_blank", rel: "noopener noreferrer", style: { color: 'var(--brand-ink)' }, children: t('studio.loop.proto.open') })), approve && _jsx(ApproveBlock, { view: view, onApprove: onApprove })] })) : undefined, children: [props.home && _jsx("style", { children: PROTOTYPE_HOME_LAYOUT }), props.home ? (_jsxs(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: [_jsx("span", { "data-prototype-draft": true, title: t('studio.prototype.draft'), style: captionText, children: t('studio.prototype.draft') }), props.comp?.open && props.comp.view, _jsx("div", { hidden: props.comp?.open || undefined, style: { display: props.comp?.open ? 'none' : 'contents' }, children: _jsx(PrototypeApp, { ...props.home }) }), !props.comp?.open && props.comp?.summary, _jsx(PrototypeReview, { ...props, view: view, snapshotOk: (props.home.snapshotReady ?? props.home.running) && props.home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props, view: view })] })) : (_jsxs(_Fragment, { children: [_jsx(DesignLevel, { level: props.level === null ? undefined : (props.level ?? 'guide'), needsRight: !!view.needsRight, named: hasRuleSigners(view.signatures) }), _jsx(ApproveWhy, { view: view }), _jsx(PrototypeReview, { ...props, view: view })] })), _jsx(Place, { id: "approve:prototype" })] }) }));
|
|
37
46
|
}
|
|
47
|
+
/** What the page gives the workspace, kept while none of it changes (the stage reads it). */
|
|
48
|
+
function useWorkspaceSetup({ sample, home, workspace }) {
|
|
49
|
+
const { consoleUrl, others, consoleOthers } = sample.proto;
|
|
50
|
+
const { overlay, changes, tool, onTool } = workspace ?? {};
|
|
51
|
+
const appUrl = home?.url;
|
|
52
|
+
return useMemo(() => ({
|
|
53
|
+
overlay,
|
|
54
|
+
changes,
|
|
55
|
+
tool,
|
|
56
|
+
onTool,
|
|
57
|
+
appUrl,
|
|
58
|
+
consoleUrl,
|
|
59
|
+
screens: { app: others, console: consoleOthers ?? [] },
|
|
60
|
+
}), [overlay, changes, tool, onTool, appUrl, consoleUrl, others, consoleOthers]);
|
|
61
|
+
}
|
|
38
62
|
function prototypeCrumb(sample, view, t) {
|
|
39
63
|
const { proto } = sample;
|
|
40
64
|
const picked = proto.lanes.find((lane) => lane.id === view.lane);
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Left, PlayableJourney } from './prototype-bridge.ts';
|
|
3
|
+
import type { DataState, ProtoView } from './protoView.ts';
|
|
4
|
+
import type { JourneyRole } from './types.ts';
|
|
5
|
+
import { type WorkspaceStage as Stage } from './workspace-state.tsx';
|
|
6
|
+
type Device = NonNullable<ProtoView['device']>;
|
|
7
|
+
type Orientation = NonNullable<ProtoView['orientation']>;
|
|
8
|
+
/** The customer app's journey playing: its step, the app's words for it, and how to move. */
|
|
3
9
|
export interface PreviewPlay {
|
|
10
|
+
title: string;
|
|
4
11
|
step: number;
|
|
5
12
|
total: number;
|
|
6
13
|
caption: string;
|
|
7
14
|
pending?: boolean;
|
|
8
15
|
onStep: (step: number) => void;
|
|
9
16
|
}
|
|
10
|
-
export
|
|
17
|
+
export interface PrototypePreviewProps {
|
|
18
|
+
product: string;
|
|
19
|
+
/** The customer app's frame, or what stands in for it. */
|
|
11
20
|
app: ReactNode;
|
|
21
|
+
ready?: boolean;
|
|
22
|
+
href?: string;
|
|
23
|
+
/** The plan's journeys, by role and app. */
|
|
24
|
+
roles: readonly JourneyRole[];
|
|
25
|
+
/** The journeys the running app plays. */
|
|
26
|
+
journeys: readonly PlayableJourney[];
|
|
27
|
+
left?: readonly Left[];
|
|
28
|
+
/** The app's journey playing (its key). */
|
|
29
|
+
journey?: string;
|
|
30
|
+
device: Device;
|
|
31
|
+
orientation?: Orientation;
|
|
32
|
+
onDevice?: (device: Device) => void;
|
|
33
|
+
onOrientation?: (orientation: Orientation) => void;
|
|
34
|
+
data?: DataState;
|
|
35
|
+
dataStates?: readonly DataState[];
|
|
36
|
+
onData?: (data: DataState) => void;
|
|
37
|
+
onPlay?: (key: string) => void;
|
|
12
38
|
play?: PreviewPlay;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
/** The running app's part at a point, and showing a marked place again (marking reads them). */
|
|
40
|
+
partAt?: Stage['partAt'];
|
|
41
|
+
onShow?: Stage['show'];
|
|
42
|
+
}
|
|
43
|
+
export declare function PrototypePreview(props: PrototypePreviewProps): import("react").JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -1,86 +1,137 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
// The prototype workspace around the running app: the bar (app, device, tools), the journeys and
|
|
3
|
+
// screens on the left, the device in the middle with its step bar under it, and on a phone-wide
|
|
4
|
+
// studio the bar at the app's foot with the journeys in a sheet.
|
|
5
|
+
import { useT } from '@buffcore/i18n/react';
|
|
6
|
+
import { useMemo, useState } from 'react';
|
|
7
|
+
import { Sheet } from '../../../components/Sheet.js';
|
|
8
|
+
import { usePrototypeNarrow } from '../frame/layout.js';
|
|
9
|
+
import { PrototypeUnavailable } from './PrototypeUnavailable.js';
|
|
10
|
+
import { WorkspaceBar } from './WorkspaceBar.js';
|
|
11
|
+
import { useStepName } from './WorkspaceJourneys.js';
|
|
12
|
+
import { WorkspaceLeft } from './WorkspaceLeft.js';
|
|
13
|
+
import { WorkspaceStage } from './WorkspaceStage.js';
|
|
14
|
+
import { FootBar, StepBar } from './WorkspaceSteps.js';
|
|
15
|
+
import { openJourney, workspaceGroups } from './workspace-journeys.js';
|
|
16
|
+
import { useWorkspace } from './workspace-state.js';
|
|
17
|
+
/** Which journey each app has open, what a click on one does, and the step bar for the shown app. */
|
|
18
|
+
function useJourneys(props) {
|
|
19
|
+
const space = useWorkspace();
|
|
20
|
+
const name = useStepName();
|
|
21
|
+
const { roles, journeys, journey, play, onPlay } = props;
|
|
22
|
+
const groups = useMemo(() => workspaceGroups(roles, journeys), [roles, journeys]);
|
|
23
|
+
// An app journey the running app does not play, opened to read its steps.
|
|
24
|
+
const [peek, setPeek] = useState();
|
|
25
|
+
const appOpen = openJourney(groups, 'app', peek, peek ? undefined : journey);
|
|
26
|
+
const consoleOpen = openJourney(groups, 'console', space.console.journey);
|
|
27
|
+
const playing = !!play && !peek && !!appOpen?.key && appOpen.key === journey;
|
|
28
|
+
const onOpen = (picked) => {
|
|
29
|
+
if (picked.where === 'console') {
|
|
30
|
+
space.setApp('console');
|
|
31
|
+
if (picked.id !== space.console.journey)
|
|
32
|
+
space.setConsole({ journey: picked.id, step: 0 });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
space.setApp('app');
|
|
36
|
+
if (!picked.key || !onPlay)
|
|
37
|
+
return setPeek(picked.id);
|
|
38
|
+
setPeek(undefined);
|
|
39
|
+
if (picked.key !== journey)
|
|
40
|
+
onPlay(picked.key);
|
|
41
|
+
};
|
|
42
|
+
const toConsole = (journey) => (step) => space.setConsole({ journey: journey.id, step });
|
|
43
|
+
const appPlay = play && !peek
|
|
44
|
+
? {
|
|
45
|
+
journey: appOpen?.name ?? play.title,
|
|
46
|
+
step: play.step,
|
|
47
|
+
total: play.total,
|
|
48
|
+
caption: play.caption || (appOpen ? name(appOpen, play.step) : ''),
|
|
49
|
+
pending: play.pending,
|
|
50
|
+
onStep: play.onStep,
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
const consolePlay = consoleOpen && {
|
|
54
|
+
journey: consoleOpen.name,
|
|
55
|
+
step: space.console.step,
|
|
56
|
+
total: consoleOpen.steps.length,
|
|
57
|
+
caption: name(consoleOpen, space.console.step),
|
|
58
|
+
onStep: toConsole(consoleOpen),
|
|
59
|
+
};
|
|
60
|
+
const onApp = space.app === 'app';
|
|
61
|
+
const shownPlay = onApp ? appPlay : consolePlay;
|
|
62
|
+
// What the customer app shows, whichever journey the list has open (a mark records it).
|
|
63
|
+
const shown = journey ? openJourney(groups, 'app', undefined, journey) : undefined;
|
|
64
|
+
const appWhere = {
|
|
65
|
+
journey: play && shown?.key === journey ? journey : undefined,
|
|
66
|
+
step: play?.step,
|
|
67
|
+
screen: play ? play.caption || (shown ? name(shown, play.step) : play.title) : '',
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
list: {
|
|
71
|
+
groups,
|
|
72
|
+
open: onApp ? appOpen : consoleOpen,
|
|
73
|
+
step: shownPlay?.step ?? 0,
|
|
74
|
+
onOpen,
|
|
75
|
+
onStep: onApp
|
|
76
|
+
? playing && !play?.pending
|
|
77
|
+
? play?.onStep
|
|
78
|
+
: undefined
|
|
79
|
+
: consoleOpen && toConsole(consoleOpen),
|
|
80
|
+
},
|
|
81
|
+
play: shownPlay,
|
|
82
|
+
where: onApp
|
|
83
|
+
? appWhere
|
|
84
|
+
: { journey: consoleOpen?.id, step: consolePlay?.step, screen: consolePlay?.caption ?? '' },
|
|
85
|
+
};
|
|
14
86
|
}
|
|
15
|
-
|
|
16
|
-
[data-preview-device]:not([data-prototype-layout-known] *) {
|
|
17
|
-
border: 0;
|
|
18
|
-
border-radius: 0;
|
|
19
|
-
box-shadow: none;
|
|
20
|
-
}
|
|
21
|
-
}`;
|
|
22
|
-
/** The product app and its toolbar fill the page's preview area. */
|
|
23
|
-
export function PrototypePreview({ app, play, ...props }) {
|
|
87
|
+
export function PrototypePreview(props) {
|
|
24
88
|
const t = useT();
|
|
25
89
|
const narrow = usePrototypeNarrow();
|
|
26
|
-
const
|
|
27
|
-
|
|
90
|
+
const space = useWorkspace();
|
|
91
|
+
const [sheet, setSheet] = useState();
|
|
92
|
+
const journeys = useJourneys(props);
|
|
93
|
+
const device = props.device;
|
|
94
|
+
const orientation = props.orientation ?? 'portrait';
|
|
95
|
+
const screen = journeys.where.screen ||
|
|
96
|
+
(space.app === 'console' ? t('studio.workspace.console') : props.product);
|
|
97
|
+
const { journey, step } = journeys.where;
|
|
98
|
+
// Kept while nothing in it changes: what draws over the device reads the stage.
|
|
99
|
+
const data = space.app === 'app' && !journey ? props.data : undefined;
|
|
100
|
+
const where = useMemo(() => ({ journey, step, screen, data }), [journey, step, screen, data]);
|
|
101
|
+
// Play belongs to the journey shown, in its app, on its device: any switch stops it.
|
|
102
|
+
const playing = [space.app, journey ?? '', device, orientation].join(' ');
|
|
103
|
+
const left = (close) => ({
|
|
104
|
+
...journeys.list,
|
|
105
|
+
onOpen: (journey) => {
|
|
106
|
+
journeys.list.onOpen(journey);
|
|
107
|
+
if (journey.where === 'console' || journey.key)
|
|
108
|
+
close?.();
|
|
109
|
+
},
|
|
110
|
+
ready: props.ready,
|
|
111
|
+
left: props.left,
|
|
112
|
+
data: props.data,
|
|
113
|
+
dataStates: props.dataStates,
|
|
114
|
+
onData: props.onData,
|
|
115
|
+
onSignInHelp: props.ready ? () => setSheet('signin') : undefined,
|
|
116
|
+
});
|
|
117
|
+
const stage = (_jsx(WorkspaceStage, { device: device, orientation: orientation, narrow: narrow, app: props.app, where: where, partAt: props.partAt, show: props.onShow, below: !narrow && journeys.play && _jsx(StepBar, { play: journeys.play, context: playing }) }));
|
|
118
|
+
return (_jsxs("div", { "data-section": "app", "data-app-ready": props.ready ? '' : undefined, style: {
|
|
28
119
|
display: 'grid',
|
|
29
|
-
gridTemplateRows: 'auto minmax(0, 1fr)',
|
|
120
|
+
gridTemplateRows: narrow ? 'auto minmax(0, 1fr) auto' : 'auto minmax(0, 1fr)',
|
|
30
121
|
minBlockSize: 0,
|
|
31
122
|
minInlineSize: 0,
|
|
32
|
-
}, children: [_jsx(
|
|
123
|
+
}, children: [_jsx(WorkspaceBar, { device: device, orientation: orientation, narrow: narrow, onDevice: props.onDevice, onOrientation: props.onOrientation }), _jsxs("div", { style: {
|
|
33
124
|
display: 'grid',
|
|
34
|
-
|
|
35
|
-
|
|
125
|
+
gridTemplateColumns: narrow
|
|
126
|
+
? 'minmax(0, 1fr)'
|
|
127
|
+
: 'calc(var(--width-margin) * .72) minmax(0, 1fr)',
|
|
36
128
|
minBlockSize: 0,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
maxInlineSize: '100%',
|
|
46
|
-
inlineSize: narrow || desktop ? '100%' : undefined,
|
|
47
|
-
alignSelf: desktop ? 'start' : undefined,
|
|
48
|
-
aspectRatio: narrow
|
|
49
|
-
? undefined
|
|
50
|
-
: desktop
|
|
51
|
-
? '16 / 10'
|
|
52
|
-
: props.device === 'tablet'
|
|
53
|
-
? '3 / 4'
|
|
54
|
-
: '9 / 19',
|
|
55
|
-
overflow: 'hidden',
|
|
56
|
-
background: 'var(--surface-canvas)',
|
|
57
|
-
}, children: [_jsx("div", { style: { blockSize: '100%', overflow: 'auto' }, children: app }), play && _jsx(PreviewPlayer, { ...play })] }) })] }));
|
|
58
|
-
}
|
|
59
|
-
function PreviewPlayer({ step, total, caption, pending, onStep }) {
|
|
60
|
-
const t = useT();
|
|
61
|
-
const { locale } = useLocale();
|
|
62
|
-
const rtl = isRtl(locale);
|
|
63
|
-
return (_jsxs("section", { "data-prototype-focus-group": true, "aria-label": t('simple.player'), style: {
|
|
64
|
-
position: 'absolute',
|
|
65
|
-
insetInline: 'var(--space-3)',
|
|
66
|
-
insetBlockEnd: 'var(--space-3)',
|
|
67
|
-
display: 'grid',
|
|
68
|
-
gridTemplateColumns: 'auto minmax(0, 1fr) auto',
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
gap: 'var(--space-2)',
|
|
71
|
-
padding: 'var(--space-2)',
|
|
72
|
-
background: 'var(--surface-panel)',
|
|
73
|
-
border: 'var(--border-width-hairline) solid var(--border-default)',
|
|
74
|
-
borderRadius: 'var(--radius-overlay)',
|
|
75
|
-
boxShadow: 'var(--shadow-overlay)',
|
|
76
|
-
}, children: [_jsx(Button, { variant: "secondary", icon: rtl ? 'chevron-right' : 'chevron-left', disabled: step === 0, "aria-disabled": pending || undefined, onClick: () => {
|
|
77
|
-
if (!pending)
|
|
78
|
-
onStep(step - 1);
|
|
79
|
-
}, children: t('simple.player.back') }), _jsxs("span", { "aria-live": "polite", style: { display: 'grid', textAlign: 'center', minInlineSize: 0 }, children: [_jsx("strong", { style: { ...captionText, color: 'var(--text-strong)' }, children: t('simple.try.step', {
|
|
80
|
-
n: formatNumber(locale, step + 1),
|
|
81
|
-
total: formatNumber(locale, total),
|
|
82
|
-
}) }), _jsx("span", { style: { ...captionText, overflowWrap: 'anywhere' }, children: caption })] }), _jsx(Button, { variant: "tonal", iconEnd: rtl ? 'chevron-left' : 'chevron-right', disabled: step >= total - 1, "aria-disabled": pending || undefined, onClick: () => {
|
|
83
|
-
if (!pending)
|
|
84
|
-
onStep(step + 1);
|
|
85
|
-
}, children: t('simple.player.next') })] }));
|
|
129
|
+
}, children: [!narrow && (_jsx("aside", { "aria-label": t('studio.workspace.left'), style: {
|
|
130
|
+
minBlockSize: 0,
|
|
131
|
+
display: 'grid',
|
|
132
|
+
boxSizing: 'border-box',
|
|
133
|
+
padding: 'var(--space-3)',
|
|
134
|
+
background: 'var(--surface-page)',
|
|
135
|
+
borderInlineEnd: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
136
|
+
}, children: _jsx(WorkspaceLeft, { ...left() }) })), stage] }), narrow && _jsx(FootBar, { play: journeys.play, onJourneys: () => setSheet('journeys') }), sheet === 'journeys' && (_jsx(Sheet, { title: t('studio.workspace.left'), onClose: () => setSheet(undefined), children: _jsx(WorkspaceLeft, { ...left(() => setSheet(undefined)) }) })), sheet === 'signin' && (_jsx(Sheet, { title: t('simple.options.signin'), onClose: () => setSheet(undefined), children: _jsx(PrototypeUnavailable, { status: "cookies", product: props.product, href: props.href, onOpen: () => setSheet(undefined) }) }))] }));
|
|
86
137
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PrototypePreviewProps } from './PrototypePreview.tsx';
|
|
3
|
+
/**
|
|
4
|
+
* The workspace, drawn once: `live` while the app may run, when what its parts report is shown;
|
|
5
|
+
* `waiting` otherwise, and until they report.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PreviewSlot({ live, waiting, children, }: {
|
|
8
|
+
live: boolean;
|
|
9
|
+
waiting: PrototypePreviewProps;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/** Shows `view` in the workspace above, for as long as the caller is in the page. */
|
|
13
|
+
export declare function useShowPreview(view: PrototypePreviewProps): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The studio's preview keeps one workspace while the customer app starts, runs, stops or is
|
|
3
|
+
// refused: the running app's parts report what the workspace shows, and only the app's slot
|
|
4
|
+
// changes, so the console's frame beside it is never put back in the page (or loaded again).
|
|
5
|
+
import { createContext, useContext, useLayoutEffect, useState } from 'react';
|
|
6
|
+
import { PrototypePreview } from './PrototypePreview.js';
|
|
7
|
+
const ReportContext = createContext(null);
|
|
8
|
+
/**
|
|
9
|
+
* The workspace, drawn once: `live` while the app may run, when what its parts report is shown;
|
|
10
|
+
* `waiting` otherwise, and until they report.
|
|
11
|
+
*/
|
|
12
|
+
export function PreviewSlot({ live, waiting, children, }) {
|
|
13
|
+
const [reported, setReported] = useState();
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx(PrototypePreview, { ...(live && reported ? reported : waiting) }), _jsx(ReportContext.Provider, { value: setReported, children: children })] }));
|
|
15
|
+
}
|
|
16
|
+
/** Shows `view` in the workspace above, for as long as the caller is in the page. */
|
|
17
|
+
export function useShowPreview(view) {
|
|
18
|
+
const report = useContext(ReportContext);
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
report?.(view);
|
|
21
|
+
});
|
|
22
|
+
useLayoutEffect(() => () => report?.(undefined), [report]);
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrototypePageProps } from './PrototypePage.tsx';
|
|
2
2
|
import type { ProtoView } from './protoView.ts';
|
|
3
|
-
type WorkingProps = Pick<PrototypePageProps, 'sample' | 'home' | 'onComment' | 'onContext' | 'onDevice' | 'onOrientation' | 'onFocus' | 'onJourney' | 'onPlayer' | 'onData' | 'onMarks' | '
|
|
3
|
+
type WorkingProps = Pick<PrototypePageProps, 'sample' | 'home' | 'onComment' | 'onContext' | 'onDevice' | 'onOrientation' | 'onFocus' | 'onJourney' | 'onPlayer' | 'onData' | 'onMarks' | 'onConsoleRetry'> & {
|
|
4
4
|
view: ProtoView;
|
|
5
5
|
};
|
|
6
6
|
export declare function PrototypeSceneTools(props: WorkingProps): import("react").JSX.Element;
|
|
@@ -22,7 +22,7 @@ export function ServedPlanning(props) {
|
|
|
22
22
|
function ServedBrief({ state, actions, draft, hasContent, writing, onNext, send }) {
|
|
23
23
|
const t = useT();
|
|
24
24
|
const sample = briefProps(state);
|
|
25
|
-
return (_jsx(BriefPage, { sample: sample, notThis: sample.notThis, onAddNot: send && ((line) => send(t('studio.start.not.request', { line }))), level: state.effectiveLevel, saved: hasContent && draft.save?.state === 'saved', draft: draft, onNext: onNext, onAnswer: actions.answerInChat, questionControls: actions.chooseQuestion
|
|
25
|
+
return (_jsx(BriefPage, { sample: sample, notThis: sample.notThis, onAddNot: send && ((line) => send(t('studio.start.not.request', { line }))), onEditNot: send && ((line, to) => send(t('studio.start.not.editRequest', { line, to }))), level: state.effectiveLevel, saved: hasContent && draft.save?.state === 'saved', draft: draft, onNext: onNext, onAnswer: actions.answerInChat, questionControls: actions.chooseQuestion
|
|
26
26
|
? {
|
|
27
27
|
choices: actions.questionChoices,
|
|
28
28
|
onChoose: actions.chooseQuestion,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FrameLayout } from '../types.ts';
|
|
2
|
-
import type { LoopMoment, LoopSample } from './types.ts';
|
|
2
|
+
import type { BriefShort, LoopMoment, LoopSample } from './types.ts';
|
|
3
3
|
export interface StudioLoopProps {
|
|
4
4
|
moment: LoopMoment;
|
|
5
5
|
sample: LoopSample;
|
|
@@ -7,5 +7,10 @@ export interface StudioLoopProps {
|
|
|
7
7
|
appUrl?: string;
|
|
8
8
|
/** Forces the frame's layout; otherwise it measures the width it has. */
|
|
9
9
|
layout?: FrameLayout;
|
|
10
|
+
/** The Brief's Not this project lines, and a section open to read. */
|
|
11
|
+
brief?: {
|
|
12
|
+
notThis?: readonly string[];
|
|
13
|
+
reading?: BriefShort | 'whole';
|
|
14
|
+
};
|
|
10
15
|
}
|
|
11
|
-
export declare function StudioLoop({ moment, sample, layout, appUrl }: StudioLoopProps): import("react").JSX.Element;
|
|
16
|
+
export declare function StudioLoop({ moment, sample, layout, appUrl, brief }: StudioLoopProps): import("react").JSX.Element;
|
|
@@ -7,7 +7,6 @@ import { StudioFrame } from '../frame/StudioFrame.js';
|
|
|
7
7
|
import { AgentsPage } from './AgentsPage.js';
|
|
8
8
|
import { BrandPage } from './BrandPage.js';
|
|
9
9
|
import { BriefPage } from './BriefPage.js';
|
|
10
|
-
import { FullScreen } from './FullScreen.js';
|
|
11
10
|
import { JourneysPage } from './JourneysPage.js';
|
|
12
11
|
import { MOMENTS } from './moments.js';
|
|
13
12
|
import { PlanPage } from './PlanPage.js';
|
|
@@ -35,7 +34,6 @@ const inert = {
|
|
|
35
34
|
onPlayer: () => { },
|
|
36
35
|
onData: () => { },
|
|
37
36
|
onMarks: () => { },
|
|
38
|
-
onFullScreen: () => { },
|
|
39
37
|
onTab: () => { },
|
|
40
38
|
onSet: () => { },
|
|
41
39
|
onRun: () => { },
|
|
@@ -54,7 +52,7 @@ const inert = {
|
|
|
54
52
|
onGo: () => { },
|
|
55
53
|
onSend: () => { },
|
|
56
54
|
};
|
|
57
|
-
function MomentPage({ moment, sample }) {
|
|
55
|
+
function MomentPage({ moment, sample, brief, }) {
|
|
58
56
|
const level = MOMENTS[moment].level;
|
|
59
57
|
switch (moment) {
|
|
60
58
|
case 'fresh':
|
|
@@ -63,7 +61,7 @@ function MomentPage({ moment, sample }) {
|
|
|
63
61
|
return _jsx(AgentsPage, { ...inert, sample: sample });
|
|
64
62
|
case 'brief':
|
|
65
63
|
case 'autopilot':
|
|
66
|
-
return _jsx(BriefPage, { ...inert, sample: sample, level: level });
|
|
64
|
+
return (_jsx(BriefPage, { ...inert, sample: sample, level: level, notThis: brief?.notThis, reading: brief?.reading, onAnswer: brief ? inert.onAction : undefined, onAddNot: inert.onAction, onEditNot: inert.onAction }));
|
|
67
65
|
case 'plan':
|
|
68
66
|
return _jsx(PlanPage, { ...inert, sample: sample });
|
|
69
67
|
case 'brand':
|
|
@@ -72,15 +70,11 @@ function MomentPage({ moment, sample }) {
|
|
|
72
70
|
return _jsx(BrandPage, { ...inert, sample: sample, level: level, picked: sample.brandPick.id });
|
|
73
71
|
case 'journeys':
|
|
74
72
|
return _jsx(JourneysPage, { ...inert, sample: sample });
|
|
75
|
-
case 'fs-tablet':
|
|
76
|
-
case 'fs-overview':
|
|
77
|
-
case 'fs-change':
|
|
78
|
-
return _jsx(FullScreen, { sample: sample, moment: moment });
|
|
79
73
|
default:
|
|
80
74
|
return _jsx(PrototypePage, { ...inert, sample: sample, view: PROTO_VIEWS[moment] });
|
|
81
75
|
}
|
|
82
76
|
}
|
|
83
|
-
export function StudioLoop({ moment, sample, layout, appUrl }) {
|
|
77
|
+
export function StudioLoop({ moment, sample, layout, appUrl, brief }) {
|
|
84
78
|
const t = useT();
|
|
85
79
|
const dark = useDarkMode();
|
|
86
80
|
const def = MOMENTS[moment];
|
|
@@ -97,5 +91,5 @@ export function StudioLoop({ moment, sample, layout, appUrl }) {
|
|
|
97
91
|
name: product.agent.name,
|
|
98
92
|
about,
|
|
99
93
|
messages: sample.talk[moment],
|
|
100
|
-
}, children: _jsx(MomentPage, { moment: moment, sample: sample }) }));
|
|
94
|
+
}, children: _jsx(MomentPage, { moment: moment, sample: sample, brief: brief }) }));
|
|
101
95
|
}
|