@buffcore/admin-shell 0.8.42 → 0.8.44
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/screens/assistant/use-ask.d.ts +4 -3
- package/dist/workbench/app/ServedAgents.js +4 -1
- package/dist/workbench/app/ServedComp.d.ts +3 -0
- package/dist/workbench/app/ServedComp.js +33 -0
- package/dist/workbench/app/ServedPrototype.d.ts +2 -0
- package/dist/workbench/app/ServedPrototype.js +15 -1
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
- package/dist/workbench/app/actions.d.ts +7 -0
- package/dist/workbench/app/actions.js +1 -0
- package/dist/workbench/app/chat-session.d.ts +2 -0
- package/dist/workbench/app/chat.d.ts +2 -0
- package/dist/workbench/app/frame.js +5 -1
- package/dist/workbench/app/fresh.d.ts +63 -0
- package/dist/workbench/app/fresh.js +66 -0
- package/dist/workbench/app/pages.js +10 -2
- package/dist/workbench/app/places.d.ts +1 -1
- package/dist/workbench/app/prototype-comp.d.ts +46 -0
- package/dist/workbench/app/prototype-comp.js +77 -0
- package/dist/workbench/app/prototype.d.ts +1 -1
- package/dist/workbench/app/prototype.js +3 -1
- package/dist/workbench/app/test/loop-fixture.d.ts +15 -8
- package/dist/workbench/app/useStudio.d.ts +43 -1
- package/dist/workbench/app/useStudio.js +8 -1
- package/dist/workbench/app/work.d.ts +7 -7
- package/dist/workbench/studio/frame/Composer.js +13 -10
- package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
- package/dist/workbench/studio/frame/LimitCard.js +26 -0
- package/dist/workbench/studio/frame/PanelMessage.js +3 -0
- package/dist/workbench/studio/frame/SettingsSheet.js +10 -9
- package/dist/workbench/studio/frame/StudioFrame.js +4 -3
- package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
- package/dist/workbench/studio/frame/panelLines.js +2 -1
- package/dist/workbench/studio/frame/scrollbars.d.ts +1 -0
- package/dist/workbench/studio/frame/scrollbars.js +10 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +2 -0
- package/dist/workbench/studio/frame/useTurnDraft.js +12 -9
- package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.en.js +26 -0
- package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.es.js +25 -0
- package/dist/workbench/studio/i18n/frame.en.d.ts +16 -0
- package/dist/workbench/studio/i18n/frame.en.js +16 -0
- package/dist/workbench/studio/i18n/frame.es.json +17 -1
- package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
- package/dist/workbench/studio/i18n/fresh.en.js +20 -0
- package/dist/workbench/studio/i18n/fresh.es.json +18 -0
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
- package/dist/workbench/studio/loop/AgentsPage.js +5 -4
- package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
- package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
- package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
- package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
- package/dist/workbench/studio/loop/PrototypeApp.d.ts +9 -0
- package/dist/workbench/studio/loop/PrototypeApp.js +6 -4
- package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
- package/dist/workbench/studio/loop/PrototypeAttempt.js +40 -16
- package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
- package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
- package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
- package/dist/workbench/studio/loop/PrototypePage.js +1 -1
- package/dist/workbench/studio/loop/PrototypePreview.js +34 -29
- package/dist/workbench/studio/loop/PrototypeSimplePage.js +11 -4
- package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +2 -1
- package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
- package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
- package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
- package/dist/workbench/studio/loop/SaveStep.js +3 -1
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StructurePage.d.ts +5 -0
- package/dist/workbench/studio/loop/StructurePage.js +3 -2
- package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
- package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
- 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 +7 -0
- package/dist/workbench/studio/loop/prototype-document.js +78 -2
- package/dist/workbench/studio/loop/usePlanningDraft.js +5 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
- package/dist/workbench/studio/types.d.ts +2 -0
- package/dist/workbench/studio/work/work-test-data.d.ts +7 -4
- package/package.json +6 -6
|
@@ -92,7 +92,7 @@ export declare function useAsk(api: Client): {
|
|
|
92
92
|
}[] | undefined;
|
|
93
93
|
}[];
|
|
94
94
|
approval: {
|
|
95
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
95
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
96
96
|
signatures: {
|
|
97
97
|
by: string;
|
|
98
98
|
at: string;
|
|
@@ -210,7 +210,7 @@ export declare function useAsk(api: Client): {
|
|
|
210
210
|
}[] | undefined;
|
|
211
211
|
}[];
|
|
212
212
|
approval: {
|
|
213
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
213
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
214
214
|
signatures: {
|
|
215
215
|
by: string;
|
|
216
216
|
at: string;
|
|
@@ -379,6 +379,7 @@ export declare function useAsk(api: Client): {
|
|
|
379
379
|
approval: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
380
380
|
kind: import("zod").ZodEnum<{
|
|
381
381
|
brand: "brand";
|
|
382
|
+
comp: "comp";
|
|
382
383
|
money: "money";
|
|
383
384
|
places: "places";
|
|
384
385
|
plan: "plan";
|
|
@@ -505,7 +506,7 @@ export declare function useAsk(api: Client): {
|
|
|
505
506
|
}[] | undefined;
|
|
506
507
|
}[];
|
|
507
508
|
approval: {
|
|
508
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
509
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
509
510
|
signatures: {
|
|
510
511
|
by: string;
|
|
511
512
|
at: string;
|
|
@@ -64,7 +64,10 @@ export function ServedAgents({ state, actions }) {
|
|
|
64
64
|
busy.current = false;
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
return (_jsxs(_Fragment, { children: [_jsx(AgentsPage, {
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsx(AgentsPage, { review: {
|
|
68
|
+
on: state.agents.file?.review !== false,
|
|
69
|
+
onChange: blocked ? undefined : actions.fresh?.setting,
|
|
70
|
+
}, onChoose: () => {
|
|
68
71
|
if (agents.some((agent) => agent.state === 'missing'))
|
|
69
72
|
void discover();
|
|
70
73
|
}, onHelp: (agent, need) => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The comp on the served Prototype page: shown first while no look is approved, and on request
|
|
3
|
+
// after. Approving is a person's click; the route records it and refuses an agent.
|
|
4
|
+
import { useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { Button } from '../../components/Button.js';
|
|
7
|
+
import { captionText } from '../../components/styles.js';
|
|
8
|
+
import { PrototypeComp } from '../studio/loop/PrototypeComp.js';
|
|
9
|
+
import { useDesignApproval } from '../studio/loop/useDesignApproval.js';
|
|
10
|
+
import { usePrototypeComp } from './prototype-comp.js';
|
|
11
|
+
export function useServedComp(reads, needsRight) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const { reply, pictures, reload } = usePrototypeComp(reads);
|
|
14
|
+
const signing = useDesignApproval(`comp:${reply?.fingerprint ?? ''}`);
|
|
15
|
+
const [opened, setOpened] = useState(false);
|
|
16
|
+
if (!reads || !reply?.screens.length)
|
|
17
|
+
return undefined;
|
|
18
|
+
const open = !reply.approved || opened;
|
|
19
|
+
const view = (_jsx(PrototypeComp, { surface: reply.surface, width: reply.width, screens: reply.screens.map((screen) => ({
|
|
20
|
+
key: screen.key,
|
|
21
|
+
title: screen.title,
|
|
22
|
+
light: screen.light && pictures[screen.light],
|
|
23
|
+
dark: screen.dark && pictures[screen.dark],
|
|
24
|
+
})), references: reply.references.map((name) => (name ? pictures[name] : undefined)), approved: reply.approved, approvedBy: reply.approval?.signatures[0]?.by, needsRight: needsRight, result: signing.result, onApprove: reply.fingerprint
|
|
25
|
+
? () => void signing.approve(async () => {
|
|
26
|
+
const answer = await reads.approve(reply.fingerprint);
|
|
27
|
+
reload();
|
|
28
|
+
return answer;
|
|
29
|
+
})
|
|
30
|
+
: undefined, onClose: reply.approved ? () => setOpened(false) : undefined }));
|
|
31
|
+
const summary = reply.approved && !opened && (_jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 'var(--space-3)' }, children: [_jsx("span", { style: captionText, children: t('studio.comp.approved') }), _jsx(Button, { variant: "secondary", size: "lg", onClick: () => setOpened(true), children: t('studio.comp.open') })] }));
|
|
32
|
+
return { open, view, summary: summary || undefined };
|
|
33
|
+
}
|
|
@@ -10,6 +10,8 @@ interface ServedPrototypeProps {
|
|
|
10
10
|
onComment?: (text: string) => void;
|
|
11
11
|
onStep?: (body: NewChat, text: string) => void;
|
|
12
12
|
journey?: string;
|
|
13
|
+
/** The journey Play asked for was played here, so the page forgets the request. */
|
|
14
|
+
onPlayed?: () => void;
|
|
13
15
|
prototypeTurn?: Pick<Chat, 'work' | 'state' | 'change'>;
|
|
14
16
|
}
|
|
15
17
|
export declare function ServedPrototype(props: ServedPrototypeProps): import("react").JSX.Element;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { PrototypePage } from '../studio/loop/PrototypePage.js';
|
|
5
5
|
import { useDesignApproval } from '../studio/loop/useDesignApproval.js';
|
|
6
6
|
import { viewerCanBuild } from '../studio/loop/usePlanningSave.js';
|
|
7
7
|
import { usePrototypeRecord } from '../studio/loop/usePrototypeRecord.js';
|
|
8
8
|
import { catchUpChange } from './catch-up.js';
|
|
9
|
+
import { useFresh } from './fresh.js';
|
|
9
10
|
import { commentMessage, openPrototype, protoSample, protoView } from './prototype.js';
|
|
10
11
|
import { usePrototypeHome } from './prototype-home.js';
|
|
12
|
+
import { useServedComp } from './ServedComp.js';
|
|
11
13
|
import { usePrototypeScenes } from './usePrototypeScenes.js';
|
|
12
14
|
import { usePrototypeSnapshot } from './usePrototypeSnapshot.js';
|
|
13
15
|
import { usePrototypeUi } from './usePrototypeUi.js';
|
|
@@ -23,8 +25,13 @@ function usePrototypePage(props) {
|
|
|
23
25
|
}
|
|
24
26
|
// A missed probe can omit appUrl, including when a host set a different preview address.
|
|
25
27
|
const previewUrl = appUrl ?? (sameAddress && running !== true ? address.url : undefined) ?? stack.app;
|
|
28
|
+
const comp = useServedComp(props.actions.comp, model.view.needsRight);
|
|
29
|
+
// One object per request, so the preview tries it once, not on every render.
|
|
30
|
+
const name = props.journey ? model.planned(props.journey) : undefined;
|
|
31
|
+
const play = useMemo(() => (props.journey ? { id: props.journey, name } : undefined), [props.journey, name]);
|
|
26
32
|
return {
|
|
27
33
|
page: {
|
|
34
|
+
comp,
|
|
28
35
|
appUrl: stack.state === 'running' ? appUrl : undefined,
|
|
29
36
|
simple: props.actions.prototypeHome ? { checks: prototypeChecks(model) } : undefined,
|
|
30
37
|
home: props.actions.prototypeHome
|
|
@@ -36,6 +43,7 @@ function usePrototypePage(props) {
|
|
|
36
43
|
source: model.home,
|
|
37
44
|
previewIdentity: JSON.stringify([stack.app, model.change]),
|
|
38
45
|
product: props.state.product.name,
|
|
46
|
+
...(play ? { play, onPlayed: props.onPlayed } : {}),
|
|
39
47
|
onDev: () => props.actions.go?.('dev'),
|
|
40
48
|
}
|
|
41
49
|
: undefined,
|
|
@@ -62,6 +70,9 @@ function usePrototypePage(props) {
|
|
|
62
70
|
onSave: () => void model.recording.save(),
|
|
63
71
|
onStart: model.snapshot.start,
|
|
64
72
|
onStop: () => void model.snapshot.stop(),
|
|
73
|
+
critique: !model.critique?.change || model.critique.change === model.change
|
|
74
|
+
? model.critique
|
|
75
|
+
: undefined,
|
|
65
76
|
onRecord: async () => {
|
|
66
77
|
if (model.snapshot.reply?.linked)
|
|
67
78
|
return;
|
|
@@ -88,6 +99,7 @@ function usePrototypeModel(props) {
|
|
|
88
99
|
if (!state.stackUnconfirmed)
|
|
89
100
|
confirmed.current = state;
|
|
90
101
|
const { stack: { output: _output, ...ports }, ...facts } = confirmed.current;
|
|
102
|
+
const critique = useFresh(actions, 'prototype').reply?.critique;
|
|
91
103
|
const snapshot = usePrototypeSnapshot(actions, { ...facts, stack: ports }, change, own, props.every);
|
|
92
104
|
const sample = protoSample(state, change, { ...ui, t }, source.scenes);
|
|
93
105
|
sample.proto.consoleRead = { pending: source.pending, failure: source.failure };
|
|
@@ -130,6 +142,8 @@ function usePrototypeModel(props) {
|
|
|
130
142
|
source,
|
|
131
143
|
home,
|
|
132
144
|
snapshot: { ...snapshot, own, start: takeSnapshot },
|
|
145
|
+
critique,
|
|
146
|
+
planned: (id) => journeys.find((entry) => entry.id === id)?.name,
|
|
133
147
|
};
|
|
134
148
|
}
|
|
135
149
|
function prototypeHandlers(model) {
|