@delmaredigital/payload-experiments 0.4.0-rc.9 → 0.4.0
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 +2 -8
- package/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +75 -29
- package/dist/admin/blocks/model.js +5 -4
- package/dist/admin/copy/blocks.d.ts +14 -11
- package/dist/admin/copy/blocks.js +33 -22
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +10 -7
- package/dist/admin/copy/newTest.js +14 -7
- package/dist/admin/copy/status.d.ts +1 -1
- package/dist/admin/copy/status.js +2 -1
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/placementStatus.model.js +5 -3
- package/dist/admin/status.model.d.ts +1 -0
- package/dist/admin/status.model.js +2 -1
- package/dist/admin/surface/ResultsRoute.js +4 -8
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +28 -3
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +4 -3
- package/dist/admin/surface/TestsHome.js +186 -47
- package/dist/admin/surface/TestsSurface.js +2 -1
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -198
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +15 -8
- package/dist/admin/surface/home.model.js +22 -18
- package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
- package/dist/admin/surface/newTest/NewTest.js +156 -96
- package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
- package/dist/admin/surface/newTest/PageWizard.js +93 -68
- package/dist/admin/surface/newTest/newTest.css +28 -11
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +90 -63
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.js +46 -38
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/admin/views/buildSurfaceProps.js +18 -66
- package/dist/arms/copy.d.ts +13 -3
- package/dist/arms/copy.js +5 -4
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +1 -1
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/serialize.js +3 -2
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +414 -0
- package/dist/endpoints/editorSurface.js +1 -1
- package/dist/endpoints/index.js +20 -0
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +1 -0
- package/dist/endpoints/results.js +3 -0
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +4 -5
- package/dist/exports/index.d.ts +1 -1
- package/dist/goals/picker/copy.js +1 -1
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/labels/arms.d.ts +3 -0
- package/dist/labels/arms.js +8 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +18 -2
- package/dist/plugin.js +56 -2
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +36 -26
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +219 -106
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +2 -2
- package/dist/puck/editor/QuickTestActions.js +44 -34
- package/dist/puck/editor/ResultsReadout.d.ts +3 -1
- package/dist/puck/editor/ResultsReadout.js +28 -16
- package/dist/puck/editor/VersionBuilder.d.ts +4 -2
- package/dist/puck/editor/VersionBuilder.js +42 -63
- package/dist/puck/editor/armWrites.js +1 -1
- package/dist/puck/editor/copy.d.ts +10 -6
- package/dist/puck/editor/copy.js +22 -12
- package/dist/puck/editor/editor.chrome.css +9 -8
- package/dist/puck/editor/editor.css +14 -9
- package/dist/puck/editor/placementsCache.d.ts +1 -1
- package/dist/puck/editor/placementsCache.js +9 -17
- package/dist/puck/editor/usePageSaveReadiness.d.ts +1 -4
- package/dist/puck/editor/usePageSaveReadiness.js +18 -21
- package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
- package/dist/puck/editor/usePlacementNotice.js +4 -5
- package/dist/puck/nestedTestCopy.js +2 -2
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/verdict.d.ts +4 -4
- package/dist/results/verdict.js +13 -10
- package/dist/server/runResults.js +2 -1
- package/dist/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +7 -4
- package/dist/testSurface/actions/DecideDialog.js +71 -59
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.js +1 -1
- package/dist/testSurface/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +75 -22
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/api.d.ts +4 -1
- package/dist/testSurface/api.js +22 -14
- package/dist/testSurface/copy/actions.d.ts +36 -14
- package/dist/testSurface/copy/actions.js +39 -17
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +6 -6
- package/dist/testSurface/copy/common.js +6 -6
- package/dist/testSurface/copy/metrics.d.ts +6 -0
- package/dist/testSurface/copy/metrics.js +8 -0
- package/dist/testSurface/copy/pages.d.ts +67 -7
- package/dist/testSurface/copy/pages.js +74 -7
- package/dist/testSurface/copy/readiness.d.ts +8 -6
- package/dist/testSurface/copy/readiness.js +19 -10
- package/dist/testSurface/copy/recommendation.d.ts +1 -22
- package/dist/testSurface/copy/recommendation.js +2 -22
- package/dist/testSurface/copy/results.d.ts +16 -10
- package/dist/testSurface/copy/results.js +19 -11
- package/dist/testSurface/copy/review.d.ts +13 -10
- package/dist/testSurface/copy/review.js +14 -10
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.d.ts +11 -2
- package/dist/testSurface/copy/surface.js +14 -11
- package/dist/testSurface/copy/testPage.d.ts +16 -10
- package/dist/testSurface/copy/testPage.js +24 -18
- package/dist/testSurface/format/date.d.ts +5 -2
- package/dist/testSurface/format/date.js +24 -8
- package/dist/testSurface/format/roundProgress.d.ts +6 -0
- package/dist/testSurface/format/roundProgress.js +15 -0
- package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
- package/dist/testSurface/format/useDateFormatter.js +8 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/readPreflight.d.ts +0 -1
- package/dist/testSurface/readPreflight.js +0 -1
- package/dist/testSurface/results/CiChart.js +2 -1
- package/dist/testSurface/results/DataTable.d.ts +1 -1
- package/dist/testSurface/results/DataTable.js +4 -3
- package/dist/testSurface/results/VerdictHero.d.ts +1 -1
- package/dist/testSurface/results/legacy.d.ts +0 -5
- package/dist/testSurface/results/legacy.js +0 -14
- package/dist/testSurface/results/results.css +2 -2
- package/dist/testSurface/results/results.model.d.ts +8 -3
- package/dist/testSurface/results/results.model.js +25 -21
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +6 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +1 -1
- package/dist/testSurface/surface/editorPlacement.js +1 -1
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
- package/dist/testSurface/surface/pageBlock/parts.js +25 -12
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +298 -209
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +5 -3
- package/dist/testSurface/surface/readiness/ActionDialogs.js +213 -207
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +109 -148
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
- package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +14 -5
- package/dist/testSurface/surface/readiness/readiness.model.js +62 -12
- package/dist/testSurface/surface/readiness/useTransition.d.ts +3 -1
- package/dist/testSurface/surface/readiness/useTransition.js +49 -8
- package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -3
- package/dist/testSurface/surface/results/ReleasePages.js +41 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +7 -2
- package/dist/testSurface/surface/results/ResultsBody.js +170 -110
- package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
- package/dist/testSurface/surface/results/recommendation.model.js +15 -59
- package/dist/testSurface/surface/results/useResults.d.ts +6 -2
- package/dist/testSurface/surface/setting/parts.js +31 -28
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +5 -1
- package/dist/testSurface/surface/test/DeleteTest.js +63 -55
- package/dist/testSurface/surface/test/GoalSection.js +11 -11
- package/dist/testSurface/surface/test/LengthSection.js +21 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +7 -7
- package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +7 -2
- package/dist/testSurface/surface/test/TestSurface.js +17 -43
- package/dist/testSurface/surface/test/VersionsSection.js +93 -70
- package/dist/testSurface/surface/test/fields.d.ts +4 -3
- package/dist/testSurface/surface/test/fields.js +10 -16
- package/dist/testSurface/surface/test/pageParts.js +13 -7
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/useTestDocument.d.ts +1 -3
- package/dist/testSurface/surface/useTestDocument.js +110 -52
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/testSurface/useApi.d.ts +3 -0
- package/dist/transitions/addMetric.d.ts +1 -1
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/kernel.d.ts +2 -0
- package/dist/transitions/kernel.js +1 -1
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.d.ts +1 -1
- package/dist/transitions/preflightData.js +10 -2
- package/dist/transitions/start.d.ts +1 -1
- package/dist/transitions/start.js +8 -5
- package/dist/types/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +11 -1
- package/dist/types/endpoints.d.ts +38 -9
- package/dist/types/endpoints.js +1 -1
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/Dialog.d.ts +21 -2
- package/dist/ui/Dialog.js +101 -4
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +5 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { canStartTest,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { canStartTest, readyToStart } from '../../readinessRead.js';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
6
|
import { actionWaitMessage, SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
@@ -9,33 +9,30 @@ import { actionGroupLabel, availableActions } from '../../actions/actions.model.
|
|
|
9
9
|
import { createApi } from '../../api.js';
|
|
10
10
|
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
11
11
|
import { READINESS_COPY as C, decidedCopy, fixFieldsNext, runningCopy, stoppedCopy } from '../../copy/readiness.js';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { useDateFormatter } from '../../format/useDateFormatter.js';
|
|
13
|
+
import { daysRemaining, displayDate, blockingSteps, pageReadinessContext, errorSection, readinessCaveats } from './readiness.model.js';
|
|
14
|
+
import { LifecycleButton, LifecycleDialog } from '../../actions/LifecycleAction.js';
|
|
15
15
|
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
16
|
-
import { placementUncheckedCopy } from '../../copy/readiness.js';
|
|
17
|
-
import { useTransition } from './useTransition.js';
|
|
18
16
|
import { BlockerList } from './BlockerList.js';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'add-metric',
|
|
22
|
-
'allocate'
|
|
23
|
-
];
|
|
24
|
-
export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
17
|
+
export function ReadinessContent({ test, surface, resultsVersion, embedded = false, barRef }) {
|
|
18
|
+
const formatDate = useDateFormatter();
|
|
25
19
|
const [selected, setSelected] = useState(null);
|
|
26
|
-
const [
|
|
27
|
-
const transition = useTransition(test, undefined, surface);
|
|
20
|
+
const [audience, setAudience] = useState();
|
|
28
21
|
const doc = test.doc;
|
|
22
|
+
const people = audience?.phase === doc.phase ? audience?.people ?? null : null;
|
|
29
23
|
useEffect(()=>{
|
|
30
24
|
let active = true;
|
|
31
|
-
//
|
|
25
|
+
// Refreshes retain the last count for this round while loading.
|
|
32
26
|
if (surface.canReadResults && doc.status === 'running') {
|
|
33
27
|
void Promise.resolve().then(()=>active ? createApi(surface.apiRoute).summary([
|
|
34
28
|
doc.id
|
|
35
29
|
]) : undefined).then((result)=>{
|
|
36
30
|
if (!result?.ok) return;
|
|
37
31
|
const count = result.data?.[doc.id]?.exposures;
|
|
38
|
-
if (active
|
|
32
|
+
if (active && typeof count === 'number' && Number.isFinite(count)) setAudience({
|
|
33
|
+
phase: doc.phase,
|
|
34
|
+
people: count
|
|
35
|
+
});
|
|
39
36
|
}).catch(()=>{});
|
|
40
37
|
}
|
|
41
38
|
return ()=>{
|
|
@@ -44,6 +41,7 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
44
41
|
}, [
|
|
45
42
|
doc.id,
|
|
46
43
|
doc.status,
|
|
44
|
+
doc.phase,
|
|
47
45
|
surface.apiRoute,
|
|
48
46
|
surface.canReadResults,
|
|
49
47
|
resultsVersion
|
|
@@ -63,7 +61,7 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
63
61
|
const readinessBlockers = blockingSteps(labelledPreflight, pageReadinessContext(doc, test.preflight, surface));
|
|
64
62
|
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
65
63
|
const ready = readyToStart(test, surface.editorPlacementMessage);
|
|
66
|
-
const startEnabled =
|
|
64
|
+
const startEnabled = canStartTest(test, surface.editorPlacementMessage);
|
|
67
65
|
const wait = setup ? actionWaitMessage(test) : undefined;
|
|
68
66
|
const blockers = [
|
|
69
67
|
...readinessBlockers
|
|
@@ -93,145 +91,108 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
93
91
|
});
|
|
94
92
|
const startReason = wait ?? blockers[0]?.sentence ?? test.preflightError ?? (!ready ? C.checking : undefined);
|
|
95
93
|
const actions = availableActions({
|
|
96
|
-
|
|
97
|
-
kind: doc.kind,
|
|
98
|
-
arms: doc.arms,
|
|
94
|
+
...doc,
|
|
99
95
|
decision,
|
|
100
|
-
canManage: surface.canManage
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const action = actions.find((item)=>item.id === selected);
|
|
109
|
-
const sentence = test.statusReadPending ? C.checking : transition.busy ? C.changing : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
|
|
110
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
111
|
-
className: `xp-readiness xp-readiness--${setup && ready && !blockers.length && !transition.busy ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
|
|
96
|
+
canManage: surface.canManage,
|
|
97
|
+
canReadResults: surface.canReadResults
|
|
98
|
+
}).filter((action)=>action.id !== 'delete' && (!embedded || ![
|
|
99
|
+
'decide',
|
|
100
|
+
'release-pages'
|
|
101
|
+
].includes(action.id)));
|
|
102
|
+
const sentence = test.statusReadPending ? C.checking : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt, formatDate), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt, formatDate), winner) : C.archived;
|
|
103
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
112
104
|
children: [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children: "⚠ "
|
|
122
|
-
}),
|
|
123
|
-
METRICS_COPY.browserWritablePrimary
|
|
124
|
-
]
|
|
125
|
-
}) : null,
|
|
126
|
-
test.preflight?.checks.filter((check)=>check.code === 'make-content-unsupported' && check.warning).map((check)=>/*#__PURE__*/ _jsx("p", {
|
|
127
|
-
children: READINESS[check.code].next(check.detail, doc)
|
|
128
|
-
}, check.code)),
|
|
129
|
-
test.preflight?.checks.filter((check)=>check.warning && [
|
|
130
|
-
'goal-in-some-versions',
|
|
131
|
-
'placement-unchecked'
|
|
132
|
-
].includes(check.code)).map((check, index)=>{
|
|
133
|
-
const placement = check.code === 'placement-unchecked' ? preflightPlacementLabel(check.detail, test.preflight, surface.adminRoute) : undefined;
|
|
134
|
-
return /*#__PURE__*/ _jsx("p", {
|
|
135
|
-
children: placement ? placement.href ? /*#__PURE__*/ _jsx("a", {
|
|
136
|
-
href: placement.href,
|
|
137
|
-
children: placementUncheckedCopy(placement.title)
|
|
138
|
-
}) : placementUncheckedCopy(placement.title) : READINESS[check.code].next(check.detail, doc)
|
|
139
|
-
}, `${check.code}:${index}`);
|
|
140
|
-
}),
|
|
141
|
-
[
|
|
142
|
-
...new Map(test.preflight?.goalNotes?.map((note)=>[
|
|
143
|
-
String(note.metricId),
|
|
144
|
-
note
|
|
145
|
-
])).values()
|
|
146
|
-
].map((note)=>/*#__PURE__*/ _jsxs("p", {
|
|
147
|
-
className: "xp-readiness__warning",
|
|
105
|
+
/*#__PURE__*/ _jsx("div", {
|
|
106
|
+
ref: barRef,
|
|
107
|
+
className: "xp-test-readiness-bar",
|
|
108
|
+
role: "region",
|
|
109
|
+
"aria-label": C.label,
|
|
110
|
+
"data-dialog-background": true,
|
|
111
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
112
|
+
className: `xp-readiness xp-readiness--${setup && ready && !blockers.length ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
|
|
148
113
|
children: [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
114
|
+
readinessCaveats(test, surface.adminRoute).map(({ key, sentence, href, emphasized })=>/*#__PURE__*/ _jsxs("p", {
|
|
115
|
+
className: emphasized ? 'xp-readiness__warning' : undefined,
|
|
116
|
+
children: [
|
|
117
|
+
emphasized ? /*#__PURE__*/ _jsx("span", {
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
children: "⚠ "
|
|
120
|
+
}) : null,
|
|
121
|
+
href ? /*#__PURE__*/ _jsx("a", {
|
|
122
|
+
href: href,
|
|
123
|
+
children: sentence
|
|
124
|
+
}) : sentence
|
|
125
|
+
]
|
|
126
|
+
}, key)),
|
|
127
|
+
!test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
128
|
+
children: stoppedCopy(displayDate(doc.stoppedAt, formatDate))
|
|
129
|
+
}) : null,
|
|
130
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
131
|
+
className: "xp-readiness__state",
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ _jsx(SaveStatus, {
|
|
134
|
+
test: test,
|
|
135
|
+
messageInBlockerList: setup && !!test.preflight && !test.preflightError
|
|
136
|
+
}),
|
|
137
|
+
sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
|
|
138
|
+
className: "xp-readiness__separator",
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
children: "·"
|
|
141
|
+
}) : null,
|
|
142
|
+
sentence ? /*#__PURE__*/ _jsx("p", {
|
|
143
|
+
role: "status",
|
|
144
|
+
children: sentence
|
|
145
|
+
}) : null,
|
|
146
|
+
setup ? /*#__PURE__*/ _jsx(BlockerList, {
|
|
147
|
+
steps: blockers,
|
|
148
|
+
renderSentence: (_, index)=>{
|
|
149
|
+
const step = blockers[index];
|
|
150
|
+
return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
|
|
151
|
+
href: `#section-${step.section}`,
|
|
152
|
+
onClick: (event)=>{
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
if (step.section !== 'header') jumpToSection(step.section, step.arm);
|
|
155
|
+
},
|
|
156
|
+
children: step.sentence
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}) : null
|
|
160
|
+
]
|
|
152
161
|
}),
|
|
153
|
-
|
|
162
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
163
|
+
className: "xp-readiness__actions",
|
|
164
|
+
children: [
|
|
165
|
+
setup && readinessBlockers.length > 0 && !test.preflightRead?.message && !test.statusReadPending ? /*#__PURE__*/ _jsx(Button, {
|
|
166
|
+
variant: "quiet",
|
|
167
|
+
disabled: test.preflightPending || !!selected,
|
|
168
|
+
onClick: ()=>{
|
|
169
|
+
void test.refreshPreflight(true);
|
|
170
|
+
},
|
|
171
|
+
children: C.refresh
|
|
172
|
+
}) : null,
|
|
173
|
+
actions.map((item)=>{
|
|
174
|
+
if (test.statusReadPending) return null;
|
|
175
|
+
const reason = item.id === 'start' ? startReason : item.unavailable;
|
|
176
|
+
return /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
177
|
+
action: embedded && item.hint ? {
|
|
178
|
+
...item,
|
|
179
|
+
hint: undefined
|
|
180
|
+
} : item,
|
|
181
|
+
reason: reason,
|
|
182
|
+
showReason: item.id !== 'start',
|
|
183
|
+
disabled: item.id === 'start' && !startEnabled,
|
|
184
|
+
onClick: ()=>setSelected(item)
|
|
185
|
+
}, item.id);
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
154
189
|
]
|
|
155
|
-
}, note.metricId)),
|
|
156
|
-
!test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
157
|
-
children: stoppedCopy(displayDate(doc.stoppedAt))
|
|
158
|
-
}) : null,
|
|
159
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
160
|
-
className: "xp-readiness__state",
|
|
161
|
-
children: [
|
|
162
|
-
/*#__PURE__*/ _jsx(SaveStatus, {
|
|
163
|
-
test: test,
|
|
164
|
-
messageInBlockerList: setup && !!test.preflight && !test.preflightError
|
|
165
|
-
}),
|
|
166
|
-
sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
|
|
167
|
-
className: "xp-readiness__separator",
|
|
168
|
-
"aria-hidden": "true",
|
|
169
|
-
children: "·"
|
|
170
|
-
}) : null,
|
|
171
|
-
sentence ? /*#__PURE__*/ _jsx("p", {
|
|
172
|
-
role: "status",
|
|
173
|
-
children: sentence
|
|
174
|
-
}) : null,
|
|
175
|
-
setup ? /*#__PURE__*/ _jsx(BlockerList, {
|
|
176
|
-
steps: blockers,
|
|
177
|
-
renderSentence: (_, index)=>{
|
|
178
|
-
const step = blockers[index];
|
|
179
|
-
return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
|
|
180
|
-
href: `#section-${step.section}`,
|
|
181
|
-
onClick: (event)=>{
|
|
182
|
-
event.preventDefault();
|
|
183
|
-
if (step.section !== 'header') jumpToSection(step.section, step.arm);
|
|
184
|
-
},
|
|
185
|
-
children: step.sentence
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}) : null
|
|
189
|
-
]
|
|
190
|
-
}),
|
|
191
|
-
/*#__PURE__*/ _jsx("div", {
|
|
192
|
-
className: "xp-readiness__actions",
|
|
193
|
-
children: !test.statusReadPending && actions.map((item)=>{
|
|
194
|
-
const reason = item.id === 'start' ? startReason : item.id === 'allocate' && doc.allocation >= 100 ? C.everyone : undefined;
|
|
195
|
-
const disabled = transition.busy || !!selected || !!reason || item.id === 'start' && !startEnabled;
|
|
196
|
-
return /*#__PURE__*/ _jsxs("span", {
|
|
197
|
-
title: reason,
|
|
198
|
-
children: [
|
|
199
|
-
reason && reason !== wait && item.id !== 'start' ? /*#__PURE__*/ _jsx("span", {
|
|
200
|
-
className: "xp-readiness-action-reason",
|
|
201
|
-
children: reason
|
|
202
|
-
}) : null,
|
|
203
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
204
|
-
busy: transition.busy,
|
|
205
|
-
variant: item.tone === 'primary' || item.id === 'stop' ? 'primary' : 'secondary',
|
|
206
|
-
disabled: disabled,
|
|
207
|
-
onClick: ()=>{
|
|
208
|
-
if (disabled) return;
|
|
209
|
-
if (item.id === 'start' && doc.status === 'draft') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id, doc.phase));
|
|
210
|
-
else setSelected(item.id);
|
|
211
|
-
},
|
|
212
|
-
children: item.label
|
|
213
|
-
})
|
|
214
|
-
]
|
|
215
|
-
}, item.id);
|
|
216
190
|
})
|
|
217
191
|
}),
|
|
218
|
-
|
|
219
|
-
role: "alert",
|
|
220
|
-
children: transition.error
|
|
221
|
-
}) : null,
|
|
222
|
-
action?.id === 'allocate' ? /*#__PURE__*/ _jsx(AllocateAction, {
|
|
223
|
-
test: test,
|
|
224
|
-
surface: surface,
|
|
225
|
-
onClose: ()=>setSelected(null)
|
|
226
|
-
}) : action?.id === 'add-metric' ? /*#__PURE__*/ _jsx(AddMetricAction, {
|
|
227
|
-
test: test,
|
|
228
|
-
surface: surface,
|
|
229
|
-
onClose: ()=>setSelected(null)
|
|
230
|
-
}) : action ? /*#__PURE__*/ _jsx(ConfirmAction, {
|
|
192
|
+
selected ? /*#__PURE__*/ _jsx(LifecycleDialog, {
|
|
231
193
|
test: test,
|
|
232
194
|
surface: surface,
|
|
233
|
-
action:
|
|
234
|
-
winnerLabel: winner,
|
|
195
|
+
action: selected,
|
|
235
196
|
onClose: ()=>setSelected(null)
|
|
236
197
|
}) : null
|
|
237
198
|
]
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ActionTestApi } from '../contracts.js';
|
|
2
2
|
export declare function actionWaitMessage(test: Pick<ActionTestApi, 'stale' | 'hasUnsaved' | 'saving' | 'fieldDrafts'>): string | undefined;
|
|
3
|
-
|
|
3
|
+
type SaveState = Pick<ActionTestApi, 'saving' | 'hasUnsaved' | 'stale' | 'errors'>;
|
|
4
|
+
export declare function saveStatusMessage(test: SaveState): string | null;
|
|
4
5
|
type Props = {
|
|
5
6
|
test: ActionTestApi;
|
|
6
7
|
messageInBlockerList?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare function ReadinessReadStatus({ test, messageInBlockerList }: Props): import("react").JSX.Element;
|
|
9
|
-
export declare function SaveStatus(
|
|
10
|
+
export declare function SaveStatus(props: Props | {
|
|
11
|
+
save: SaveState;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
10
13
|
export {};
|
|
@@ -47,20 +47,21 @@ export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
|
|
|
47
47
|
}) : null
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
export function SaveStatus(
|
|
51
|
-
const
|
|
50
|
+
export function SaveStatus(props) {
|
|
51
|
+
const state = 'test' in props ? props.test : props.save;
|
|
52
|
+
const message = saveStatusMessage(state);
|
|
52
53
|
return /*#__PURE__*/ _jsxs("div", {
|
|
53
54
|
className: "xp-save-status",
|
|
54
55
|
"aria-live": "polite",
|
|
55
56
|
children: [
|
|
56
57
|
message ? /*#__PURE__*/ _jsx("span", {
|
|
57
|
-
role:
|
|
58
|
+
role: state.saving === 'error' ? 'alert' : 'status',
|
|
58
59
|
children: message
|
|
59
60
|
}) : null,
|
|
60
|
-
/*#__PURE__*/ _jsx(ReadinessReadStatus, {
|
|
61
|
-
test: test,
|
|
62
|
-
messageInBlockerList: messageInBlockerList
|
|
63
|
-
})
|
|
61
|
+
'test' in props ? /*#__PURE__*/ _jsx(ReadinessReadStatus, {
|
|
62
|
+
test: props.test,
|
|
63
|
+
messageInBlockerList: props.messageInBlockerList
|
|
64
|
+
}) : null
|
|
64
65
|
]
|
|
65
66
|
});
|
|
66
67
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReadinessCode, PreflightResult } from '../../../types/endpoints.js';
|
|
2
2
|
import type { SerializedFlagPoint } from '../../../types/admin.js';
|
|
3
3
|
import type { TestDocument } from '../testDocument.model.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DateFormatter } from '../../format/date.js';
|
|
5
|
+
import type { ActionTestApi, SurfaceProps } from '../contracts.js';
|
|
5
6
|
import { type SectionId } from '../contracts.js';
|
|
6
7
|
export type ReadinessContext = Pick<TestDocument, 'arms' | 'unitType' | 'flagPoint'> & {
|
|
7
8
|
editorPage?: SurfaceProps['editorPage'];
|
|
@@ -20,15 +21,22 @@ export declare const READINESS: Record<ReadinessCode, {
|
|
|
20
21
|
next(detail: unknown, ctx: ReadinessContext): string | null;
|
|
21
22
|
nextStep?: string | ((detail: unknown, ctx: ReadinessContext) => string | undefined);
|
|
22
23
|
}>;
|
|
24
|
+
type ReadinessCaveat = {
|
|
25
|
+
key: string;
|
|
26
|
+
sentence: string;
|
|
27
|
+
href?: string;
|
|
28
|
+
emphasized?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function readinessCaveats({ doc, preflight, statusReadPending }: Pick<ActionTestApi, 'doc' | 'preflight' | 'statusReadPending'>, adminRoute: string): ReadinessCaveat[];
|
|
23
31
|
export declare function blockingSteps(preflight: PreflightResult | null, ctx: ReadinessContext): {
|
|
24
|
-
arm?: import("../../../types/
|
|
32
|
+
arm?: import("../../../types/armKey.js").ArmKey | undefined;
|
|
25
33
|
section: "header" | SectionId;
|
|
26
34
|
sentence: string;
|
|
27
35
|
code: ReadinessCode;
|
|
28
36
|
}[];
|
|
29
37
|
export declare function nextStep(preflight: PreflightResult | null, ctx: ReadinessContext): {
|
|
30
38
|
nextStep?: string | undefined;
|
|
31
|
-
arm?: import("../../../types/
|
|
39
|
+
arm?: import("../../../types/armKey.js").ArmKey | undefined;
|
|
32
40
|
section: "header" | SectionId;
|
|
33
41
|
sentence: string;
|
|
34
42
|
code: ReadinessCode;
|
|
@@ -42,8 +50,9 @@ export declare function sectionDone(test: {
|
|
|
42
50
|
preflight: PreflightResult | null;
|
|
43
51
|
doc?: Pick<TestDocument, 'targeting'> | null;
|
|
44
52
|
}): Record<SectionId, boolean>;
|
|
45
|
-
export declare function displayDate(value: unknown): string | null;
|
|
53
|
+
export declare function displayDate(value: unknown, formatDate: DateFormatter): string | null;
|
|
46
54
|
export declare function daysRemaining(doc: TestDocument, now: number): number | null;
|
|
47
55
|
export declare function pageReadinessContext(doc: TestDocument, preflight: PreflightResult | null, surface: SurfaceProps): ReadinessContext;
|
|
48
56
|
/** First affected row in arm order; shared by the wizard and the test-page jump. */
|
|
49
|
-
export declare function readinessArm(code: ReadinessCode, detail: unknown, ctx: ReadinessContext): import("../../../types/
|
|
57
|
+
export declare function readinessArm(code: ReadinessCode, detail: unknown, ctx: ReadinessContext): import("../../../types/armKey.js").ArmKey | undefined;
|
|
58
|
+
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { nestedTestCopy } from '../../../puck/nestedTestCopy.js';
|
|
2
2
|
import { SURFACE_COPY } from '../../copy/surface.js';
|
|
3
|
-
import {
|
|
3
|
+
import { roundProgress } from '../../format/roundProgress.js';
|
|
4
4
|
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
5
|
-
import { unpublishedPlacementsCopy, asymmetricGoalsCopy, placementUncheckedCopy, interactingTestsCopy, sameAddressCopy, identicalVersionCopy, unsupportedContentCopy, versionPageUnavailableCopy, versionPageUncheckedCopy, placementFailureCopy, pageInUseCopy, unpublishedPageCopy, READINESS_COPY as C, attributeNext, contentNext, draftContentNext, unsavedContentNext, partialContentNext, summaryContentNext, goalPeopleNext, parameterNext, placementNext, ruleNext, versionsNext } from '../../copy/readiness.js';
|
|
5
|
+
import { duplicateVersionCopy, unpublishedPlacementsCopy, asymmetricGoalsCopy, placementUncheckedCopy, interactingTestsCopy, sameAddressCopy, identicalVersionCopy, unsupportedContentCopy, versionPageUnavailableCopy, versionPageUncheckedCopy, placementFailureCopy, pageInUseCopy, unpublishedPageCopy, READINESS_COPY as C, attributeNext, contentNext, draftContentNext, unsavedContentNext, partialContentNext, summaryContentNext, goalPeopleNext, parameterNext, placementNext, ruleNext, versionsNext } from '../../copy/readiness.js';
|
|
6
6
|
import { PLACEMENT_LANGUAGES, placementLanguageSuffix } from '../../copy/languages.js';
|
|
7
|
+
import { METRICS_COPY } from '../../copy/metrics.js';
|
|
8
|
+
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
9
|
+
import { hasBrowserWritablePrimary } from '../../readinessRead.js';
|
|
7
10
|
import { normalisePath } from '../../../runtime/normalisePath.js';
|
|
8
11
|
import { testPageCollection } from '../pagePicker/pagePicker.model.js';
|
|
9
12
|
import { SECTION_ORDER } from '../contracts.js';
|
|
@@ -24,7 +27,7 @@ const row = (section, next)=>({
|
|
|
24
27
|
next
|
|
25
28
|
});
|
|
26
29
|
const versions = row('versions', (detail)=>versionsNext(detailText(detail, C.versionFallback)));
|
|
27
|
-
const samePage = (detail, page)=>detail.collection === page.collection && String(detail.id) === String(page.id);
|
|
30
|
+
const samePage = (detail, page)=>page.id !== undefined && detail.collection === page.collection && String(detail.id) === String(page.id);
|
|
28
31
|
const strings = (value)=>Array.isArray(value) ? value.filter((item)=>typeof item === 'string') : [];
|
|
29
32
|
function emptyContentGuidance(detail, ctx) {
|
|
30
33
|
const placements = Array.isArray(detail) ? detail.map(object) : [];
|
|
@@ -140,7 +143,7 @@ function emptyContentGuidance(detail, ctx) {
|
|
|
140
143
|
nextStep: C.publishPage
|
|
141
144
|
},
|
|
142
145
|
'duplicate-version-row': {
|
|
143
|
-
...row('versions', (detail)=>detailRows(detail).map((value)
|
|
146
|
+
...row('versions', (detail)=>detailRows(detail).map((value)=>duplicateVersionCopy(text(object(value).title, 'this page'))).join('\n')),
|
|
144
147
|
nextStep: (detail)=>detailRows(detail).map((value)=>`Edit ${text(object(value).title, 'this page')}`).join('\n')
|
|
145
148
|
},
|
|
146
149
|
'nested-tests': row('versions', (detail)=>nestedTestCopy.readiness(detail)),
|
|
@@ -178,7 +181,7 @@ function emptyContentGuidance(detail, ctx) {
|
|
|
178
181
|
...row('versions', (detail, ctx)=>{
|
|
179
182
|
const paths = object(detail).paths;
|
|
180
183
|
const path = text(Array.isArray(paths) ? paths[0] : undefined, 'this page');
|
|
181
|
-
return pageInUseCopy(path, pageArm(path, ctx)?.kind === 'variant');
|
|
184
|
+
return pageInUseCopy(path, pageArm(path, ctx)?.kind === 'variant', ctx.arms.find((arm)=>arm.kind === 'control')?.label);
|
|
182
185
|
}),
|
|
183
186
|
nextStep: C.choosePages
|
|
184
187
|
},
|
|
@@ -188,11 +191,11 @@ function emptyContentGuidance(detail, ctx) {
|
|
|
188
191
|
},
|
|
189
192
|
'unknown-collection': row('versions', ()=>"That page type isn't set up for tests."),
|
|
190
193
|
'version-identical': {
|
|
191
|
-
...row('versions', (detail, ctx)=>identicalVersionCopy(text(object(detail).path, object(detail).title ? `${group(object(detail).arm, ctx)} on ${text(object(detail).title, 'this page')}` : group(object(detail).arm, ctx)))),
|
|
194
|
+
...row('versions', (detail, ctx)=>identicalVersionCopy(text(object(detail).path, object(detail).title ? `${group(object(detail).arm, ctx)} on ${text(object(detail).title, 'this page')}` : group(object(detail).arm, ctx)), group('control', ctx))),
|
|
192
195
|
nextStep: (detail, ctx)=>`Edit ${text(object(detail).path, group(object(detail).arm, ctx))}`
|
|
193
196
|
},
|
|
194
197
|
'version-same-address': {
|
|
195
|
-
...row('versions', (detail, ctx)=>sameAddressCopy(group(object(detail).arm, ctx), group(object(detail).otherArm, ctx), text(object(detail).path, 'this address')
|
|
198
|
+
...row('versions', (detail, ctx)=>sameAddressCopy(group(object(detail).arm, ctx), group(object(detail).otherArm, ctx), text(object(detail).path, 'this address'))),
|
|
196
199
|
nextStep: 'Choose pages'
|
|
197
200
|
},
|
|
198
201
|
'page-target-unpublished': {
|
|
@@ -204,7 +207,7 @@ function emptyContentGuidance(detail, ctx) {
|
|
|
204
207
|
original: arm?.kind === 'control',
|
|
205
208
|
found: placement?.id != null && placement.published === false,
|
|
206
209
|
collection: ctx.collectionLabel
|
|
207
|
-
} : undefined);
|
|
210
|
+
} : undefined, arm?.label);
|
|
208
211
|
}),
|
|
209
212
|
nextStep: C.choosePages
|
|
210
213
|
},
|
|
@@ -235,6 +238,55 @@ function emptyContentGuidance(detail, ctx) {
|
|
|
235
238
|
'slot-required': versions,
|
|
236
239
|
'duplicate-slot': versions
|
|
237
240
|
};
|
|
241
|
+
export function readinessCaveats({ doc, preflight, statusReadPending }, adminRoute) {
|
|
242
|
+
if (!doc || !preflight) return [];
|
|
243
|
+
const caveats = [];
|
|
244
|
+
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
245
|
+
if (setup) {
|
|
246
|
+
if (preflight.checks.some((check)=>check.code === 'page-targets-unchecked' && check.warning)) {
|
|
247
|
+
caveats.push({
|
|
248
|
+
key: 'page-targets-unchecked',
|
|
249
|
+
sentence: C.uncheckedPages
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (!statusReadPending && hasBrowserWritablePrimary(preflight, doc.metrics?.primary)) {
|
|
253
|
+
caveats.push({
|
|
254
|
+
key: 'browser-writable-primary',
|
|
255
|
+
sentence: METRICS_COPY.browserWritablePrimary,
|
|
256
|
+
emphasized: true
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
for (const [index, check] of preflight.checks.entries()){
|
|
261
|
+
if (!check.warning) continue;
|
|
262
|
+
const key = `${check.code}:${index}`;
|
|
263
|
+
if (check.code === 'placement-unchecked') {
|
|
264
|
+
const { title, href } = preflightPlacementLabel(check.detail, preflight, adminRoute);
|
|
265
|
+
caveats.push({
|
|
266
|
+
key,
|
|
267
|
+
sentence: placementUncheckedCopy(title),
|
|
268
|
+
href
|
|
269
|
+
});
|
|
270
|
+
} else if (check.code === 'goal-in-some-versions' || check.code === 'make-content-unsupported' || setup && check.code === 'version-identical') {
|
|
271
|
+
const sentence = READINESS[check.code].next(check.detail, doc);
|
|
272
|
+
if (sentence) caveats.push({
|
|
273
|
+
key,
|
|
274
|
+
sentence
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const [metricId, note] of new Map(preflight.goalNotes?.map((note)=>[
|
|
279
|
+
String(note.metricId),
|
|
280
|
+
note
|
|
281
|
+
]))){
|
|
282
|
+
caveats.push({
|
|
283
|
+
key: `goal-note:${metricId}`,
|
|
284
|
+
sentence: note.message,
|
|
285
|
+
emphasized: true
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return caveats;
|
|
289
|
+
}
|
|
238
290
|
export function blockingSteps(preflight, ctx) {
|
|
239
291
|
return [
|
|
240
292
|
'header',
|
|
@@ -291,14 +343,12 @@ export function sectionDone(test) {
|
|
|
291
343
|
section === 'who' && test.doc && !test.doc.targeting?.length ? false : test.preflight ? !test.preflight.checks.some((check)=>!check.ok && (Object.hasOwn(READINESS, check.code) ? READINESS[check.code].section : SECTION_ORDER[0]) === section) : section === 'advanced'
|
|
292
344
|
]));
|
|
293
345
|
}
|
|
294
|
-
export function displayDate(value) {
|
|
346
|
+
export function displayDate(value, formatDate) {
|
|
295
347
|
if (typeof value !== 'string' || !Number.isFinite(Date.parse(value))) return null;
|
|
296
348
|
return formatDate(value);
|
|
297
349
|
}
|
|
298
350
|
export function daysRemaining(doc, now) {
|
|
299
|
-
|
|
300
|
-
const start = typeof doc.startedAt === 'string' ? Date.parse(doc.startedAt) : NaN;
|
|
301
|
-
return typeof days === 'number' && days > 0 && Number.isFinite(start) ? Math.max(0, Math.ceil(days - (now - start) / 86_400_000)) : null;
|
|
351
|
+
return roundProgress(doc.startedAt, doc.analysis?.plannedDurationDays, now).daysToGo;
|
|
302
352
|
}
|
|
303
353
|
function pageArm(path, ctx) {
|
|
304
354
|
return ctx.arms.find((arm)=>arm.pageTarget && normalisePath(arm.pageTarget) === normalisePath(path));
|
|
@@ -3,7 +3,7 @@ import type { ActionTestApi } from '../contracts.js';
|
|
|
3
3
|
import type { SurfaceProps } from '../contracts.js';
|
|
4
4
|
import type { ActionId } from '../../actions/actions.model.js';
|
|
5
5
|
/** The ref closes the gap before React renders the disabled button. */
|
|
6
|
-
export declare function useTransition(test: ActionTestApi, onSuccess?: () => void, surface?: SurfaceProps): {
|
|
6
|
+
export declare function useTransition(test: ActionTestApi, onSuccess?: () => void, surface?: SurfaceProps, keepRefusal?: boolean): {
|
|
7
7
|
busy: boolean;
|
|
8
8
|
checking: boolean;
|
|
9
9
|
error: string | null;
|
|
@@ -11,4 +11,6 @@ export declare function useTransition(test: ActionTestApi, onSuccess?: () => voi
|
|
|
11
11
|
closeOnSuccess?: boolean | undefined;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
clearError: () => void;
|
|
14
|
+
reloadRequired: boolean;
|
|
15
|
+
refreshAfterDismissal: () => void;
|
|
14
16
|
};
|