@delmaredigital/payload-experiments 0.4.0-rc.7 → 0.4.0-rc.9
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/README.md +12 -12
- package/dist/admin/blocks/model.js +2 -2
- package/dist/admin/copy/blocks.js +1 -1
- package/dist/admin/surface/ResultsRoute.js +17 -11
- package/dist/admin/surface/TestsHome.js +53 -20
- package/dist/admin/surface/newTest/PageWizard.js +8 -2
- package/dist/admin/surface/results/ResultsHeader.js +11 -6
- package/dist/admin/surface/test/TestPage.js +3 -3
- package/dist/blocks/formState.js +1 -1
- package/dist/collections/experiments/config.js +8 -3
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +5 -4
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/endpoints/deleteImpact.js +2 -1
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +2 -8
- package/dist/endpoints/placementStatus.js +7 -4
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/transitions.js +37 -24
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +6 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/goals/fairness.js +2 -2
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.js +4 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/manifest/compile.js +8 -5
- package/dist/onInit.js +14 -0
- package/dist/options.js +5 -0
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/editor/ConfigureTestDrawer.js +5 -4
- package/dist/puck/editor/ExperimentSlotEditor.js +182 -58
- package/dist/puck/editor/QuickTestActions.d.ts +5 -2
- package/dist/puck/editor/QuickTestActions.js +16 -4
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +2 -1
- package/dist/puck/editor/VersionBuilder.d.ts +13 -2
- package/dist/puck/editor/VersionBuilder.js +133 -49
- package/dist/puck/editor/armWrites.js +1 -1
- package/dist/puck/editor/armsCache.js +1 -3
- package/dist/puck/editor/copy.d.ts +4 -1
- package/dist/puck/editor/copy.js +4 -1
- package/dist/puck/editor/editor.chrome.css +1 -0
- package/dist/puck/editor/editor.css +1 -0
- package/dist/puck/editor/editor.model.d.ts +1 -0
- package/dist/puck/editor/placementsCache.d.ts +5 -1
- package/dist/puck/editor/placementsCache.js +17 -9
- package/dist/puck/editor/usePageSaveReadiness.d.ts +9 -0
- package/dist/puck/editor/usePageSaveReadiness.js +34 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
- package/dist/puck/editor/usePlacementNotice.js +5 -4
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.js +2 -1
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +20 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +11 -2
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +2 -5
- package/dist/server/runResults.js +52 -14
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/testSurface/actions/DecideDialog.d.ts +4 -1
- package/dist/testSurface/actions/DecideDialog.js +32 -14
- package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
- package/dist/testSurface/actions/MakeContentResult.js +9 -1
- package/dist/testSurface/api.d.ts +5 -5
- package/dist/testSurface/api.js +21 -9
- package/dist/testSurface/copy/actions.d.ts +1 -0
- package/dist/testSurface/copy/actions.js +1 -0
- package/dist/testSurface/copy/common.d.ts +3 -1
- package/dist/testSurface/copy/common.js +4 -2
- package/dist/testSurface/copy/languages.d.ts +1 -0
- package/dist/testSurface/copy/languages.js +1 -0
- package/dist/testSurface/copy/metrics.d.ts +1 -0
- package/dist/testSurface/copy/metrics.js +1 -0
- package/dist/testSurface/copy/readiness.d.ts +12 -1
- package/dist/testSurface/copy/readiness.js +18 -1
- package/dist/testSurface/copy/results.d.ts +5 -2
- package/dist/testSurface/copy/results.js +5 -2
- package/dist/testSurface/copy/testPage.d.ts +20 -2
- package/dist/testSurface/copy/testPage.js +34 -3
- package/dist/testSurface/readPreflight.d.ts +5 -0
- package/dist/testSurface/readPreflight.js +7 -0
- package/dist/testSurface/readinessRead.d.ts +3 -0
- package/dist/testSurface/readinessRead.js +4 -0
- package/dist/testSurface/results/VerdictHero.d.ts +2 -1
- package/dist/testSurface/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.model.d.ts +1 -1
- package/dist/testSurface/results/results.model.js +6 -2
- package/dist/testSurface/surface/contracts.d.ts +8 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +2 -2
- package/dist/testSurface/surface/editorPlacement.js +1 -1
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +2 -2
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +20 -6
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +4 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.js +39 -34
- package/dist/testSurface/surface/readiness/Banner.js +23 -12
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +4 -3
- package/dist/testSurface/surface/readiness/SaveStatus.js +15 -15
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +6 -1
- package/dist/testSurface/surface/readiness/readiness.model.js +108 -11
- package/dist/testSurface/surface/readiness/useTransition.d.ts +4 -4
- package/dist/testSurface/surface/readiness/useTransition.js +12 -10
- package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -2
- package/dist/testSurface/surface/results/ReleasePages.js +5 -4
- package/dist/testSurface/surface/results/ResultsBody.d.ts +4 -2
- package/dist/testSurface/surface/results/ResultsBody.js +86 -43
- package/dist/testSurface/surface/results/useResults.d.ts +7 -6
- package/dist/testSurface/surface/results/useResults.js +3 -2
- package/dist/testSurface/surface/setting/parts.js +58 -18
- package/dist/testSurface/surface/test/AdvancedSection.js +1 -0
- package/dist/testSurface/surface/test/DeleteTest.d.ts +6 -2
- package/dist/testSurface/surface/test/DeleteTest.js +145 -54
- package/dist/testSurface/surface/test/GoalSection.js +7 -3
- package/dist/testSurface/surface/test/LengthSection.js +3 -0
- package/dist/testSurface/surface/test/PageHoldout.js +4 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +1 -1
- package/dist/testSurface/surface/test/TargetingSection.js +77 -12
- package/dist/testSurface/surface/test/TestSurface.js +81 -19
- package/dist/testSurface/surface/test/VersionsSection.js +56 -29
- package/dist/testSurface/surface/test/fields.d.ts +29 -4
- package/dist/testSurface/surface/test/fields.js +159 -39
- package/dist/testSurface/surface/test/pageParts.js +14 -5
- package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
- package/dist/testSurface/surface/test/testPage.model.js +6 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
- package/dist/testSurface/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +22 -4
- package/dist/testSurface/surface/useTestDocument.js +407 -160
- package/dist/testSurface/useApi.d.ts +5 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.js +3 -1
- package/dist/transitions/addMetric.d.ts +1 -4
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +1 -0
- package/dist/transitions/checkStart.js +17 -6
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +5 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +2 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +12 -8
- package/dist/transitions/nestedPlacementNames.d.ts +2 -2
- package/dist/transitions/nestedPlacementNames.js +4 -5
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +8 -7
- package/dist/transitions/placements.d.ts +2 -0
- package/dist/transitions/placements.js +5 -5
- package/dist/transitions/preflightData.d.ts +3 -2
- package/dist/transitions/preflightData.js +67 -41
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +67 -34
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +6 -3
- package/dist/types/endpoints.d.ts +52 -9
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/package.json +2 -2
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { createUsePuck, useGetPuck, FieldGroup } from '@puckeditor/core';
|
|
5
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { defaultArms } from '../../arms/model.js';
|
|
7
|
-
import {
|
|
7
|
+
import { BLOCK_SLOTS } from '../../blocks/model.js';
|
|
8
8
|
import { publishOutlineVersion } from './outlineVersion.js';
|
|
9
9
|
import { LeftoverVersions } from './LeftoverVersions.js';
|
|
10
10
|
import { Button } from '../../ui/Button.js';
|
|
@@ -15,8 +15,11 @@ import { Dialog } from '../../ui/Dialog.js';
|
|
|
15
15
|
import { accentVariables, deriveAccent, validateAccent } from '../../ui/accent.js';
|
|
16
16
|
import { ExperimentPicker } from '../ExperimentPicker.js';
|
|
17
17
|
import { TestSidebarField, useSidebarTargets } from './sidebar.js';
|
|
18
|
-
import { readPreflight } from '../../testSurface/readPreflight.js';
|
|
18
|
+
import { documentChanged, readPreflight, statusOrRoundChanged } from '../../testSurface/readPreflight.js';
|
|
19
19
|
import { classifyReadinessRead } from '../../testSurface/readinessRead.js';
|
|
20
|
+
import { READINESS_COPY } from '../../testSurface/copy/readiness.js';
|
|
21
|
+
import { TEST_PAGE } from '../../testSurface/copy/testPage.js';
|
|
22
|
+
import { useOnTestReturn } from '../../testSurface/useOnTestReturn.js';
|
|
20
23
|
import { useReadinessPolling } from '../../testSurface/useReadinessPolling.js';
|
|
21
24
|
import { PlacementNotice } from './PlacementNotice.js';
|
|
22
25
|
import { QuickTestActions } from './QuickTestActions.js';
|
|
@@ -37,7 +40,9 @@ import { ResultsReadout } from './ResultsReadout.js';
|
|
|
37
40
|
import { EditorControls } from './EditorControls.js';
|
|
38
41
|
import { acquirePlacements, cachedPreflight, cachedReadinessRead, placementsPending, placementsBlocking, placementReadError, invalidatePlacements, refreshPlacements, focusPlacements } from './placementsCache.js';
|
|
39
42
|
import { sidebarReadinessBlockers, editorPlacementMessage, editorNestedChecks } from '../../testSurface/surface/editorPlacement.js';
|
|
43
|
+
import { editorContentNotice, pageReadinessContext } from '../../testSurface/surface/readiness/readiness.model.js';
|
|
40
44
|
import { localPlacements, localBlockVisibility, localNestedTests } from './localPlacements.js';
|
|
45
|
+
import { usePageSaveReadiness } from './usePageSaveReadiness.js';
|
|
41
46
|
import { usePlacementNotice } from './usePlacementNotice.js';
|
|
42
47
|
import { useEditorSurface } from './editorSurface.js';
|
|
43
48
|
import { createBlockTest, CreateRefused } from './createTest.js';
|
|
@@ -68,7 +73,10 @@ function EditorRender(props) {
|
|
|
68
73
|
// Without localization or a known locale, omit it and use the server default.
|
|
69
74
|
const contentLocale = access.surface?.contentLanguageLabels?.length ? new URLSearchParams(window.location.search).get('locale') || undefined : undefined;
|
|
70
75
|
const root = useRef(null);
|
|
71
|
-
const
|
|
76
|
+
const loadTest = useRef(undefined);
|
|
77
|
+
const readTest = useCallback(()=>{
|
|
78
|
+
void loadTest.current?.();
|
|
79
|
+
}, []);
|
|
72
80
|
const [mode, setMode] = useState('light');
|
|
73
81
|
useEffect(()=>{
|
|
74
82
|
const node = root.current;
|
|
@@ -120,7 +128,8 @@ function EditorRender(props) {
|
|
|
120
128
|
key: bindingKey,
|
|
121
129
|
failures: 0
|
|
122
130
|
};
|
|
123
|
-
|
|
131
|
+
useOnTestReturn(readTest, experimentId !== undefined);
|
|
132
|
+
useReadinessPolling(loaded?.id === experimentId ? loaded?.read : undefined, readTest, true, documentPending);
|
|
124
133
|
const [active, setActive] = useState();
|
|
125
134
|
const [choosing, setChoosing] = useState(false);
|
|
126
135
|
const [clearError, setClearError] = useState(null);
|
|
@@ -158,12 +167,15 @@ function EditorRender(props) {
|
|
|
158
167
|
return testVersions && !testVersions.includes(slot) && Array.isArray(content) && content.length > 0;
|
|
159
168
|
}).join(',');
|
|
160
169
|
}).split(',').filter(Boolean);
|
|
170
|
+
useEffect(()=>experimentId === undefined ? undefined : acquireArms(experimentId), [
|
|
171
|
+
experimentId,
|
|
172
|
+
api
|
|
173
|
+
]);
|
|
161
174
|
useEffect(()=>{
|
|
162
175
|
if (experimentId === undefined) return;
|
|
163
176
|
const controller = new AbortController();
|
|
164
177
|
let current = true;
|
|
165
178
|
let request = 0;
|
|
166
|
-
const releaseArms = acquireArms(experimentId);
|
|
167
179
|
async function load() {
|
|
168
180
|
const revision = ++request;
|
|
169
181
|
setDocumentPending(true);
|
|
@@ -171,6 +183,7 @@ function EditorRender(props) {
|
|
|
171
183
|
const doc = await loadArms(experimentId, async (signal)=>{
|
|
172
184
|
const { response, body } = await readPreflight((boundedSignal)=>fetch(`${api}/xp-experiments/${encodeURIComponent(experimentId)}?depth=0`, {
|
|
173
185
|
credentials: 'include',
|
|
186
|
+
cache: 'no-store',
|
|
174
187
|
signal: boundedSignal
|
|
175
188
|
}), signal);
|
|
176
189
|
if (!response.ok) throw new TestReadError(response.status);
|
|
@@ -194,35 +207,32 @@ function EditorRender(props) {
|
|
|
194
207
|
});
|
|
195
208
|
const forbidden = read.loadState === 'forbidden';
|
|
196
209
|
const missing = read.loadState === 'missing';
|
|
197
|
-
setLoaded((value)
|
|
210
|
+
setLoaded((value)=>!forbidden && !missing && value && value.id === experimentId && value.doc ? {
|
|
211
|
+
...value,
|
|
212
|
+
read
|
|
213
|
+
} : {
|
|
198
214
|
id: experimentId,
|
|
199
215
|
read,
|
|
200
216
|
forbidden,
|
|
201
217
|
missing,
|
|
202
218
|
error: !forbidden && !missing,
|
|
203
219
|
shared: value?.id === experimentId ? value?.shared : undefined
|
|
204
|
-
})
|
|
220
|
+
});
|
|
205
221
|
}
|
|
206
222
|
} finally{
|
|
207
223
|
if (current && revision === request) setDocumentPending(false);
|
|
208
224
|
}
|
|
209
225
|
}
|
|
226
|
+
loadTest.current = load;
|
|
210
227
|
void load();
|
|
211
|
-
// The linked test opens in another tab; refresh this same document source on return.
|
|
212
|
-
const onVisible = ()=>{
|
|
213
|
-
if (document.visibilityState === 'visible') void load();
|
|
214
|
-
};
|
|
215
|
-
document.addEventListener('visibilitychange', onVisible);
|
|
216
228
|
return ()=>{
|
|
217
229
|
current = false;
|
|
218
230
|
controller.abort();
|
|
219
|
-
|
|
220
|
-
document.removeEventListener('visibilitychange', onVisible);
|
|
231
|
+
loadTest.current = undefined;
|
|
221
232
|
};
|
|
222
233
|
}, [
|
|
223
234
|
experimentId,
|
|
224
|
-
api
|
|
225
|
-
readAttempt
|
|
235
|
+
api
|
|
226
236
|
]);
|
|
227
237
|
const cachedExperiment = loaded?.id === experimentId && !loaded?.forbidden && !loaded?.missing ? knownArms?.doc : undefined;
|
|
228
238
|
const status = cachedExperiment?.status ?? (loaded?.id === experimentId ? loaded?.doc?.status : undefined);
|
|
@@ -289,7 +299,46 @@ function EditorRender(props) {
|
|
|
289
299
|
const unavailable = result?.forbidden || result?.missing;
|
|
290
300
|
const canManage = access.surface?.canManage === true && !unavailable;
|
|
291
301
|
const canSetUp = access.surface?.canManage === true && (experimentId === undefined || result?.missing === true);
|
|
292
|
-
const
|
|
302
|
+
const setupStatus = experiment?.status === 'draft' || experiment?.status === 'stopped';
|
|
303
|
+
const previousStatus = useRef(undefined);
|
|
304
|
+
useEffect(()=>{
|
|
305
|
+
const previous = previousStatus.current;
|
|
306
|
+
previousStatus.current = {
|
|
307
|
+
id: experimentId,
|
|
308
|
+
status
|
|
309
|
+
};
|
|
310
|
+
if (experimentId === undefined || !status || previous?.id !== experimentId || !previous.status || previous.status === status || !canManage) return;
|
|
311
|
+
const checkedStatus = cachedPreflight(api, experimentId, contentLocale)?.checks?.find((check)=>check.code === 'invalid-status');
|
|
312
|
+
if (checkedStatus && checkedStatus.ok !== setupStatus) invalidatePlacements(api, experimentId, contentLocale);
|
|
313
|
+
}, [
|
|
314
|
+
api,
|
|
315
|
+
experimentId,
|
|
316
|
+
status,
|
|
317
|
+
setupStatus,
|
|
318
|
+
canManage,
|
|
319
|
+
contentLocale
|
|
320
|
+
]);
|
|
321
|
+
const settledPreflight = preflight?.id === experimentId ? preflight?.value : undefined;
|
|
322
|
+
const readinessRead = experimentId === undefined || preflight?.pending ? undefined : cachedReadinessRead(api, experimentId, contentLocale);
|
|
323
|
+
const checkedVersion = settledPreflight?.document;
|
|
324
|
+
const version = checkedVersion?.updatedAt && experiment?.updatedAt && checkedVersion.updatedAt < experiment.updatedAt ? undefined : checkedVersion;
|
|
325
|
+
const legacyStatusChanged = !checkedVersion && setupStatus && settledPreflight?.checks.some((check)=>check.code === 'invalid-status' && !check.ok);
|
|
326
|
+
const statusChanged = !!experiment && (statusOrRoundChanged(version, experiment) || legacyStatusChanged);
|
|
327
|
+
const documentReadRetry = result?.read?.retry;
|
|
328
|
+
const needsRead = !preflight?.pending && !documentReadRetry && canManage && !!experiment && (documentChanged(version, experiment) || legacyStatusChanged || !!readinessRead && [
|
|
329
|
+
401,
|
|
330
|
+
403,
|
|
331
|
+
404
|
|
332
|
+
].includes(readinessRead.status));
|
|
333
|
+
useEffect(()=>{
|
|
334
|
+
if (needsRead && document.visibilityState === 'visible') readTest();
|
|
335
|
+
}, [
|
|
336
|
+
needsRead,
|
|
337
|
+
settledPreflight,
|
|
338
|
+
readinessRead,
|
|
339
|
+
readTest
|
|
340
|
+
]);
|
|
341
|
+
const editable = canManage && setupStatus && !statusChanged;
|
|
293
342
|
const [removed, setRemoved] = useState(null);
|
|
294
343
|
useEffect(()=>{
|
|
295
344
|
// Dialog cleanup must close the native modal before an outside tab can receive focus.
|
|
@@ -300,21 +349,22 @@ function EditorRender(props) {
|
|
|
300
349
|
]);
|
|
301
350
|
const splitIntent = useRef(false);
|
|
302
351
|
const [weightEdits, setWeightEdits] = useState({});
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
setWeightEdits((current)=>Object.fromEntries(Object.entries(current).filter(([key])=>keys.has(key))));
|
|
308
|
-
}, [
|
|
309
|
-
armKeys
|
|
310
|
-
]);
|
|
311
|
-
useEffect(()=>{
|
|
352
|
+
const [nameEdits, setNameEdits] = useState({});
|
|
353
|
+
const [draftBinding, setDraftBinding] = useState(bindingKey);
|
|
354
|
+
if (draftBinding !== bindingKey) {
|
|
355
|
+
setDraftBinding(bindingKey);
|
|
312
356
|
setWeightEdits({});
|
|
357
|
+
setNameEdits({});
|
|
313
358
|
splitIntent.current = false;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
359
|
+
}
|
|
360
|
+
const setNameEdit = (key, edit)=>setNameEdits((current)=>{
|
|
361
|
+
const next = {
|
|
362
|
+
...current
|
|
363
|
+
};
|
|
364
|
+
if (edit) next[key] = edit;
|
|
365
|
+
else delete next[key];
|
|
366
|
+
return next;
|
|
367
|
+
});
|
|
318
368
|
useEffect(()=>{
|
|
319
369
|
setRemoving((current)=>current?.key === bindingKey ? current : null);
|
|
320
370
|
}, [
|
|
@@ -566,17 +616,55 @@ function EditorRender(props) {
|
|
|
566
616
|
if (isCurrentBinding()) setSettingUp(false);
|
|
567
617
|
}
|
|
568
618
|
}
|
|
569
|
-
const
|
|
619
|
+
const savedPlacements = placements?.id === experimentId ? placements?.value : undefined;
|
|
620
|
+
const editorPage = currentPuckDocument(window.location.pathname, admin, savedPlacements);
|
|
621
|
+
const placementMessage = hidden || statusChanged ? undefined : editorPlacementMessage(savedPlacements, editorPage, experiment?.status);
|
|
622
|
+
const versionContent = usePuckSelector((state)=>{
|
|
623
|
+
if (!editable || !sidebar || !editorPage || experimentId === undefined) return '';
|
|
624
|
+
const blocks = localPlacements(state.appState.data).get(String(experimentId));
|
|
625
|
+
if (!blocks?.size) return '';
|
|
626
|
+
const items = Array.from(blocks, (id)=>state.getItemById(id));
|
|
627
|
+
return BLOCK_SLOTS.map((version)=>{
|
|
628
|
+
const filled = items.filter((item)=>{
|
|
629
|
+
const content = item?.props[version];
|
|
630
|
+
return Array.isArray(content) && content.length > 0;
|
|
631
|
+
}).length;
|
|
632
|
+
return filled === items.length ? 'filled' : filled > 0 ? 'partial' : 'empty';
|
|
633
|
+
}).join(',');
|
|
634
|
+
});
|
|
570
635
|
const currentPreflight = preflight && preflight.id === experimentId && Array.isArray(preflight.value?.checks) ? preflight.value : null;
|
|
571
|
-
const
|
|
636
|
+
const contentStates = versionContent.split(',');
|
|
637
|
+
const livePage = editorPage && versionContent ? {
|
|
638
|
+
...editorPage,
|
|
639
|
+
versionContent: Object.fromEntries(BLOCK_SLOTS.map((slot, index)=>[
|
|
640
|
+
slot,
|
|
641
|
+
contentStates[index]
|
|
642
|
+
]))
|
|
643
|
+
} : editorPage;
|
|
572
644
|
const surface = access.surface ? {
|
|
573
645
|
...access.surface,
|
|
574
|
-
editorPage,
|
|
646
|
+
editorPage: livePage,
|
|
575
647
|
apiRoute: api,
|
|
576
648
|
adminRoute: admin,
|
|
577
649
|
editorPlacementMessage: placementMessage,
|
|
578
650
|
contentLocale
|
|
579
651
|
} : undefined;
|
|
652
|
+
const sidebarDrafts = {
|
|
653
|
+
...Object.fromEntries(Object.entries(weightEdits).map(([key, draft])=>[
|
|
654
|
+
`weight:${key}`,
|
|
655
|
+
draft
|
|
656
|
+
])),
|
|
657
|
+
...Object.fromEntries(Object.entries(nameEdits).map(([key, draft])=>[
|
|
658
|
+
`name:${key}`,
|
|
659
|
+
{
|
|
660
|
+
label: editorCopy.versionName(experiment?.arms.find((arm)=>arm.key === key)?.label ?? draft.base),
|
|
661
|
+
base: draft.base,
|
|
662
|
+
value: draft.draft
|
|
663
|
+
}
|
|
664
|
+
]))
|
|
665
|
+
};
|
|
666
|
+
const hasSidebarDraft = Object.keys(sidebarDrafts).length > 0;
|
|
667
|
+
const showVersions = experiment && access.surface && !noAccess;
|
|
580
668
|
const quickTest = {
|
|
581
669
|
doc: experiment ? {
|
|
582
670
|
...experiment,
|
|
@@ -587,15 +675,13 @@ function EditorRender(props) {
|
|
|
587
675
|
preflightRead: experimentId === undefined ? undefined : cachedReadinessRead(api, experimentId, contentLocale),
|
|
588
676
|
preflightError: !currentPreflight ? placementReadError(api, experimentId, contentLocale) ?? null : null,
|
|
589
677
|
preflightPending: documentPending || !preflight || preflight.id !== experimentId || preflight.pending,
|
|
590
|
-
hasUnsaved: writes.busy ||
|
|
678
|
+
hasUnsaved: writes.busy || hasSidebarDraft,
|
|
679
|
+
fieldDrafts: sidebarDrafts,
|
|
591
680
|
saving: writes.busy ? 'saving' : 'idle',
|
|
592
681
|
stale: false,
|
|
593
682
|
errors: {},
|
|
594
|
-
chosenPages: {},
|
|
595
683
|
loadState: 'ready',
|
|
596
|
-
|
|
597
|
-
commit: async ()=>{},
|
|
598
|
-
choosePage: async ()=>{},
|
|
684
|
+
statusReadPending: statusChanged,
|
|
599
685
|
refreshPreflight: async (supersede)=>{
|
|
600
686
|
if (experimentId !== undefined) {
|
|
601
687
|
if (supersede) invalidatePlacements(api, experimentId, contentLocale);
|
|
@@ -603,11 +689,12 @@ function EditorRender(props) {
|
|
|
603
689
|
}
|
|
604
690
|
},
|
|
605
691
|
reload: async ()=>{
|
|
606
|
-
if (experimentId === undefined) return;
|
|
607
|
-
// A transition may succeed without a readable response body; recover its document too.
|
|
608
|
-
publishExperiment(experimentId, await readExperiment(`${api}/xp-experiments/${encodeURIComponent(experimentId)}?depth=0`));
|
|
692
|
+
if (experimentId === undefined || !isCurrentBinding()) return;
|
|
609
693
|
invalidatePlacements(api, experimentId, contentLocale);
|
|
610
|
-
await
|
|
694
|
+
await Promise.all([
|
|
695
|
+
loadTest.current?.(),
|
|
696
|
+
refreshPlacements(api, experimentId, contentLocale)
|
|
697
|
+
]);
|
|
611
698
|
},
|
|
612
699
|
acceptTransition: (result)=>{
|
|
613
700
|
const doc = result?.doc;
|
|
@@ -615,7 +702,9 @@ function EditorRender(props) {
|
|
|
615
702
|
}
|
|
616
703
|
};
|
|
617
704
|
const placementNotice = quickTest.preflightRead?.message ?? placementMessage;
|
|
618
|
-
|
|
705
|
+
const contentNotice = sidebar && editable && surface && quickTest.doc ? editorContentNotice(currentPreflight, pageReadinessContext(quickTest.doc, currentPreflight, surface)) : undefined;
|
|
706
|
+
usePlacementNotice(api, experimentId, canManage ? placementNotice ?? contentNotice : undefined, contentLocale, canManage);
|
|
707
|
+
usePageSaveReadiness(api, sidebar && canManage ? experimentId : undefined, editorPage, contentLocale);
|
|
619
708
|
const placementNoticeView = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
620
709
|
children: [
|
|
621
710
|
nestedNotice ? /*#__PURE__*/ _jsx(Banner, {
|
|
@@ -663,7 +752,7 @@ function EditorRender(props) {
|
|
|
663
752
|
});
|
|
664
753
|
}
|
|
665
754
|
}) : null;
|
|
666
|
-
const documentRead = result?.read ? classifyReadinessRead(result.read.status, undefined, documentFailures.current.failures, {
|
|
755
|
+
const documentRead = !experiment && result?.read ? classifyReadinessRead(result.read.status, undefined, documentFailures.current.failures, {
|
|
667
756
|
kind: 'document',
|
|
668
757
|
surface: 'editor',
|
|
669
758
|
resultsOnly
|
|
@@ -674,7 +763,7 @@ function EditorRender(props) {
|
|
|
674
763
|
}) : documentRead ? documentRead.retry ? /*#__PURE__*/ _jsx(Banner, {
|
|
675
764
|
tone: "error",
|
|
676
765
|
action: /*#__PURE__*/ _jsx(Button, {
|
|
677
|
-
onClick:
|
|
766
|
+
onClick: readTest,
|
|
678
767
|
children: editorCopy.retrySetup
|
|
679
768
|
}),
|
|
680
769
|
children: documentRead.message
|
|
@@ -706,7 +795,7 @@ function EditorRender(props) {
|
|
|
706
795
|
children: resultsOnly ? pickerCopy.resultsOnly : pickerCopy.forbidden
|
|
707
796
|
}) : /*#__PURE__*/ _jsx(Banner, {
|
|
708
797
|
tone: experiment?.status === 'running' ? 'warning' : 'info',
|
|
709
|
-
children: experimentId === undefined ? bannerFor() : experiment ? bannerFor(experiment.status, winner, originalLabel, experiment.decision ?? null) : editorCopy.loading
|
|
798
|
+
children: experimentId === undefined ? bannerFor() : experiment ? statusChanged ? READINESS_COPY.checking : bannerFor(experiment.status, winner, originalLabel, experiment.decision ?? null) : editorCopy.loading
|
|
710
799
|
});
|
|
711
800
|
const versionLockMessage = editable || !experiment ? undefined : canManage ? editorCopy.locked[experiment.status] ?? editorCopy.lockedGeneric : editorCopy.readOnlyVersions;
|
|
712
801
|
const removeDialog = removing?.key === bindingKey ? /*#__PURE__*/ _jsx(RemoveVersion, {
|
|
@@ -739,9 +828,9 @@ function EditorRender(props) {
|
|
|
739
828
|
/*#__PURE__*/ _jsx("strong", {
|
|
740
829
|
children: experiment.name
|
|
741
830
|
}),
|
|
742
|
-
/*#__PURE__*/ _jsx(StatusChip, {
|
|
831
|
+
!statusChanged ? /*#__PURE__*/ _jsx(StatusChip, {
|
|
743
832
|
status: experiment.status
|
|
744
|
-
})
|
|
833
|
+
}) : null
|
|
745
834
|
]
|
|
746
835
|
}) : null,
|
|
747
836
|
accessNotice,
|
|
@@ -750,10 +839,8 @@ function EditorRender(props) {
|
|
|
750
839
|
children: editorCopy.sharedTest
|
|
751
840
|
}) : null,
|
|
752
841
|
placementNoticeView,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
steps: sidebarBlockers
|
|
756
|
-
}) : null
|
|
842
|
+
editable ? /*#__PURE__*/ _jsx(BlockerList, {
|
|
843
|
+
steps: sidebarBlockers
|
|
757
844
|
}) : null,
|
|
758
845
|
experimentId !== undefined && access.surface && !result?.missing && !result?.error && !noAccess && (!unavailable || resultsOnly) ? /*#__PURE__*/ _jsx(ConfigureTestControl, {
|
|
759
846
|
id: experimentId,
|
|
@@ -766,7 +853,7 @@ function EditorRender(props) {
|
|
|
766
853
|
canManage && experiment && surface ? /*#__PURE__*/ _jsx(QuickTestActions, {
|
|
767
854
|
test: quickTest,
|
|
768
855
|
surface: surface
|
|
769
|
-
}, `${experimentId}/${experiment.status}`) : null,
|
|
856
|
+
}, `${experimentId}/${experiment.status}/${experiment.phase}`) : null,
|
|
770
857
|
canSetUp ? /*#__PURE__*/ _jsx(Button, {
|
|
771
858
|
variant: "primary",
|
|
772
859
|
busy: settingUp,
|
|
@@ -791,7 +878,34 @@ function EditorRender(props) {
|
|
|
791
878
|
onClick: (event)=>event.stopPropagation(),
|
|
792
879
|
onKeyDown: (event)=>event.stopPropagation(),
|
|
793
880
|
children: [
|
|
794
|
-
|
|
881
|
+
Object.entries(sidebarDrafts).map(([id, draft])=>{
|
|
882
|
+
const [kind, key] = id.split(':');
|
|
883
|
+
if (showVersions && experiment.arms.some((arm)=>arm.key === key)) return null;
|
|
884
|
+
return /*#__PURE__*/ _jsxs(Banner, {
|
|
885
|
+
tone: "warning",
|
|
886
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
887
|
+
onClick: ()=>{
|
|
888
|
+
if (kind === 'name') setNameEdit(key, null);
|
|
889
|
+
else setWeightEdits((current)=>{
|
|
890
|
+
const next = {
|
|
891
|
+
...current
|
|
892
|
+
};
|
|
893
|
+
delete next[key];
|
|
894
|
+
return next;
|
|
895
|
+
});
|
|
896
|
+
},
|
|
897
|
+
children: TEST_PAGE.discardEdit
|
|
898
|
+
}),
|
|
899
|
+
children: [
|
|
900
|
+
TEST_PAGE.detachedEdit(draft.label),
|
|
901
|
+
" ",
|
|
902
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
903
|
+
children: draft.value || TEST_PAGE.emptyValue
|
|
904
|
+
})
|
|
905
|
+
]
|
|
906
|
+
}, id);
|
|
907
|
+
}),
|
|
908
|
+
showVersions ? /*#__PURE__*/ _jsx("section", {
|
|
795
909
|
"aria-label": editorCopy.versionsGroup,
|
|
796
910
|
children: /*#__PURE__*/ _jsx(FieldGroup, {
|
|
797
911
|
label: editorCopy.versionsGroup,
|
|
@@ -832,7 +946,13 @@ function EditorRender(props) {
|
|
|
832
946
|
/*#__PURE__*/ _jsx(VersionName, {
|
|
833
947
|
arm: arm,
|
|
834
948
|
writes: writes,
|
|
835
|
-
editable: editable
|
|
949
|
+
editable: editable,
|
|
950
|
+
draftState: [
|
|
951
|
+
nameEdits[arm.key] ?? null,
|
|
952
|
+
(edit)=>{
|
|
953
|
+
if (isCurrentBinding()) setNameEdit(arm.key, edit);
|
|
954
|
+
}
|
|
955
|
+
]
|
|
836
956
|
}, `${experimentId}-${arm.key}`),
|
|
837
957
|
input,
|
|
838
958
|
arm.kind === 'variant' || arm.kind === 'holdout' && editable ? /*#__PURE__*/ _jsxs("div", {
|
|
@@ -880,6 +1000,7 @@ function EditorRender(props) {
|
|
|
880
1000
|
label: editorCopy.moreGroup,
|
|
881
1001
|
defaultExpanded: false,
|
|
882
1002
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
1003
|
+
disabled: hasSidebarDraft,
|
|
883
1004
|
onClick: ()=>setChoosing(true),
|
|
884
1005
|
children: editorCopy.differentTest
|
|
885
1006
|
})
|
|
@@ -902,7 +1023,10 @@ function EditorRender(props) {
|
|
|
902
1023
|
experiment && experiment.status !== 'draft' ? /*#__PURE__*/ _jsx(ResultsReadout, {
|
|
903
1024
|
id: experimentId,
|
|
904
1025
|
api: api,
|
|
905
|
-
experiment: experiment
|
|
1026
|
+
experiment: experiment,
|
|
1027
|
+
onRefresh: canManage && experiment.status === 'stopped' ? ()=>{
|
|
1028
|
+
void quickTest.refreshPreflight(true);
|
|
1029
|
+
} : undefined
|
|
906
1030
|
}, `results-${experimentId}`) : null,
|
|
907
1031
|
confirming ? /*#__PURE__*/ _jsxs("div", {
|
|
908
1032
|
className: "xp-slot-copy-confirm",
|
|
@@ -982,7 +1106,7 @@ function EditorRender(props) {
|
|
|
982
1106
|
title: experimentId === undefined ? editorCopy.unbound : result?.missing ? editorCopy.deleted : experiment?.name ?? experimentSlotLabel,
|
|
983
1107
|
children: experimentId === undefined ? editorCopy.unbound : result?.missing ? editorCopy.deleted : experiment?.name ?? experimentSlotLabel
|
|
984
1108
|
}),
|
|
985
|
-
experiment ? /*#__PURE__*/ _jsx(StatusChip, {
|
|
1109
|
+
experiment && !statusChanged ? /*#__PURE__*/ _jsx(StatusChip, {
|
|
986
1110
|
status: experiment.status
|
|
987
1111
|
}) : null
|
|
988
1112
|
]
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ActionTestApi, SurfaceProps } from '../../testSurface/surface/contracts.js';
|
|
2
2
|
/** Same transition runner and confirmation as the drawer; Decide stays there. */
|
|
3
|
-
export declare function QuickTestActions({ test, surface }:
|
|
3
|
+
export declare function QuickTestActions({ test, surface }: {
|
|
4
|
+
test: ActionTestApi;
|
|
5
|
+
surface: SurfaceProps;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { READINESS_COPY } from '../../testSurface/copy/readiness.js';
|
|
4
|
-
import { canStartTest, readyToStart } from '../../testSurface/readinessRead.js';
|
|
4
|
+
import { canStartTest, hasBrowserWritablePrimary, readyToStart } from '../../testSurface/readinessRead.js';
|
|
5
|
+
import { METRICS_COPY } from '../../testSurface/copy/metrics.js';
|
|
5
6
|
import { useState } from 'react';
|
|
6
7
|
import { Button } from '../../ui/Button.js';
|
|
8
|
+
import { Banner } from '../../ui/Feedback.js';
|
|
7
9
|
import { availableActions } from '../../testSurface/actions/actions.model.js';
|
|
8
10
|
import { ConfirmAction } from '../../testSurface/surface/readiness/ActionDialogs.js';
|
|
11
|
+
import { actionWaitMessage } from '../../testSurface/surface/readiness/SaveStatus.js';
|
|
9
12
|
import { useTransition } from '../../testSurface/surface/readiness/useTransition.js';
|
|
10
13
|
import { createApi } from '../../testSurface/api.js';
|
|
11
14
|
/** Same transition runner and confirmation as the drawer; Decide stays there. */ export function QuickTestActions({ test, surface }) {
|
|
@@ -19,17 +22,26 @@ import { createApi } from '../../testSurface/api.js';
|
|
|
19
22
|
if (!action) return null;
|
|
20
23
|
const ready = !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
21
24
|
const showAction = action.id !== 'start' || readyToStart(test, surface.editorPlacementMessage) && !test.hasUnsaved;
|
|
25
|
+
const wait = action.id === 'start' ? actionWaitMessage(test) : undefined;
|
|
22
26
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
23
27
|
children: [
|
|
28
|
+
!test.statusReadPending && action.id === 'start' && hasBrowserWritablePrimary(test.preflight, doc.metrics?.primary) ? /*#__PURE__*/ _jsx(Banner, {
|
|
29
|
+
tone: "warning",
|
|
30
|
+
children: METRICS_COPY.browserWritablePrimary
|
|
31
|
+
}) : null,
|
|
32
|
+
wait ? /*#__PURE__*/ _jsx("p", {
|
|
33
|
+
role: "status",
|
|
34
|
+
children: wait
|
|
35
|
+
}) : null,
|
|
24
36
|
showAction && action.id === 'start' ? /*#__PURE__*/ _jsx("p", {
|
|
25
37
|
role: "status",
|
|
26
38
|
children: READINESS_COPY.ready
|
|
27
39
|
}) : null,
|
|
28
|
-
showAction ? /*#__PURE__*/ _jsx(Button, {
|
|
29
|
-
disabled: transition.busy || confirm ||
|
|
40
|
+
showAction && !test.statusReadPending ? /*#__PURE__*/ _jsx(Button, {
|
|
41
|
+
disabled: transition.busy || confirm || action.id === 'start' && !ready,
|
|
30
42
|
busy: transition.busy,
|
|
31
43
|
onClick: ()=>{
|
|
32
|
-
if (action.id === 'start' && doc.status !== 'stopped') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id));
|
|
44
|
+
if (action.id === 'start' && doc.status !== 'stopped') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id, doc.phase));
|
|
33
45
|
else setConfirm(true);
|
|
34
46
|
},
|
|
35
47
|
children: action.label
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorExperiment } from './editor.model.js';
|
|
2
|
-
export declare function ResultsReadout({ id, api, experiment }: {
|
|
2
|
+
export declare function ResultsReadout({ id, api, experiment, onRefresh }: {
|
|
3
3
|
id: string | number;
|
|
4
4
|
api: string;
|
|
5
5
|
experiment: EditorExperiment;
|
|
6
|
+
onRefresh?: () => void;
|
|
6
7
|
}): import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
4
4
|
import { Button } from '../../ui/Button.js';
|
|
5
5
|
import { formatCount } from '../../testSurface/results/format.js';
|
|
6
6
|
import { editorCopy as C } from './copy.js';
|
|
7
|
-
export function ResultsReadout({ id, api, experiment }) {
|
|
7
|
+
export function ResultsReadout({ id, api, experiment, onRefresh }) {
|
|
8
8
|
const [data, setData] = useState(null);
|
|
9
9
|
const [refresh, setRefresh] = useState(0);
|
|
10
10
|
const pending = useRef(false);
|
|
@@ -94,6 +94,7 @@ export function ResultsReadout({ id, api, experiment }) {
|
|
|
94
94
|
if (pending.current) return;
|
|
95
95
|
pending.current = true;
|
|
96
96
|
setRefresh((value)=>value + 1);
|
|
97
|
+
onRefresh?.();
|
|
97
98
|
},
|
|
98
99
|
children: C.refresh
|
|
99
100
|
})
|
|
@@ -47,10 +47,16 @@ export declare function AddVariant({ experiment, writes, onSelect }: {
|
|
|
47
47
|
onSelect: (slot: ArmSlot) => void;
|
|
48
48
|
}): import("react").JSX.Element | null;
|
|
49
49
|
/** Always-visible editor for the saved version name. */
|
|
50
|
-
export
|
|
50
|
+
export type NameEdit = {
|
|
51
|
+
base: string;
|
|
52
|
+
draft: string;
|
|
53
|
+
submitted: boolean;
|
|
54
|
+
};
|
|
55
|
+
export declare function VersionName({ arm, writes, editable, draftState }: {
|
|
51
56
|
arm: EditorExperiment['arms'][number];
|
|
52
57
|
writes: ArmWrites;
|
|
53
58
|
editable: boolean;
|
|
59
|
+
draftState?: [NameEdit | null, (edit: NameEdit | null) => void];
|
|
54
60
|
}): import("react").JSX.Element;
|
|
55
61
|
export declare function RemoveVersion({ arm, writes, count, shared, onRemove, onClose }: {
|
|
56
62
|
arm: EditorExperiment['arms'][number];
|
|
@@ -60,7 +66,12 @@ export declare function RemoveVersion({ arm, writes, count, shared, onRemove, on
|
|
|
60
66
|
onRemove: (slot: ArmSlot) => void;
|
|
61
67
|
onClose: () => void;
|
|
62
68
|
}): import("react").JSX.Element;
|
|
63
|
-
export type
|
|
69
|
+
export type WeightEdit = {
|
|
70
|
+
value: string;
|
|
71
|
+
base: string;
|
|
72
|
+
label: string;
|
|
73
|
+
};
|
|
74
|
+
export type WeightEdits = Partial<Record<ArmKey, WeightEdit>>;
|
|
64
75
|
export declare function VersionWeights({ experiment, writes, edits, setEdits, groupId, splitIntent, editable, showSplit, beforeSplit, beforeActions, renderRow }: {
|
|
65
76
|
experiment: EditorExperiment;
|
|
66
77
|
writes: ArmWrites;
|