@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.
Files changed (254) hide show
  1. package/README.md +2 -8
  2. package/dist/admin/MetricSourceSelect.js +10 -3
  3. package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
  4. package/dist/admin/blocks/BlockPanel.d.ts +1 -0
  5. package/dist/admin/blocks/BlockPanel.js +75 -29
  6. package/dist/admin/blocks/model.js +5 -4
  7. package/dist/admin/copy/blocks.d.ts +14 -11
  8. package/dist/admin/copy/blocks.js +33 -22
  9. package/dist/admin/copy/goals.d.ts +15 -8
  10. package/dist/admin/copy/goals.js +18 -8
  11. package/dist/admin/copy/newTest.d.ts +10 -7
  12. package/dist/admin/copy/newTest.js +14 -7
  13. package/dist/admin/copy/status.d.ts +1 -1
  14. package/dist/admin/copy/status.js +2 -1
  15. package/dist/admin/pageCollections.d.ts +1 -0
  16. package/dist/admin/pageCollections.js +3 -0
  17. package/dist/admin/placementStatus.model.js +5 -3
  18. package/dist/admin/status.model.d.ts +1 -0
  19. package/dist/admin/status.model.js +2 -1
  20. package/dist/admin/surface/ResultsRoute.js +4 -8
  21. package/dist/admin/surface/SurfaceShell.d.ts +4 -2
  22. package/dist/admin/surface/SurfaceShell.js +28 -3
  23. package/dist/admin/surface/TestRowMenu.d.ts +13 -0
  24. package/dist/admin/surface/TestRowMenu.js +163 -0
  25. package/dist/admin/surface/TestsHome.d.ts +4 -3
  26. package/dist/admin/surface/TestsHome.js +186 -47
  27. package/dist/admin/surface/TestsSurface.js +2 -1
  28. package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
  29. package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
  30. package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
  31. package/dist/admin/surface/goals/GoalForm.js +280 -198
  32. package/dist/admin/surface/goals/GoalsList.js +102 -33
  33. package/dist/admin/surface/goals/data.d.ts +2 -0
  34. package/dist/admin/surface/goals/data.js +9 -0
  35. package/dist/admin/surface/goals/goals.css +3 -2
  36. package/dist/admin/surface/goals/goals.model.d.ts +2 -2
  37. package/dist/admin/surface/goals/goals.model.js +7 -12
  38. package/dist/admin/surface/home.model.d.ts +15 -8
  39. package/dist/admin/surface/home.model.js +22 -18
  40. package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
  41. package/dist/admin/surface/newTest/NewTest.js +156 -96
  42. package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
  43. package/dist/admin/surface/newTest/PageWizard.js +93 -68
  44. package/dist/admin/surface/newTest/newTest.css +28 -11
  45. package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
  46. package/dist/admin/surface/results/ResultsHeader.js +90 -63
  47. package/dist/admin/surface/surface.css +29 -0
  48. package/dist/admin/surface/test/TestPage.js +46 -38
  49. package/dist/admin/surface/useXpStepNav.d.ts +11 -0
  50. package/dist/admin/surface/useXpStepNav.js +14 -0
  51. package/dist/admin/views/TestsSurfaceClient.js +27 -3
  52. package/dist/admin/views/buildSurfaceProps.js +18 -66
  53. package/dist/arms/copy.d.ts +13 -3
  54. package/dist/arms/copy.js +5 -4
  55. package/dist/blocks/createExperimentBlock.js +1 -1
  56. package/dist/blocks/formState.js +1 -1
  57. package/dist/collections/experiments/armInvariants.js +8 -5
  58. package/dist/collections/metrics.js +12 -5
  59. package/dist/collections/serialize.js +3 -2
  60. package/dist/db/pageCopies.d.ts +5 -0
  61. package/dist/db/pageCopies.js +31 -0
  62. package/dist/db/snapshots.d.ts +1 -0
  63. package/dist/endpoints/duplicateOriginal.d.ts +38 -0
  64. package/dist/endpoints/duplicateOriginal.js +414 -0
  65. package/dist/endpoints/editorSurface.js +1 -1
  66. package/dist/endpoints/index.js +20 -0
  67. package/dist/endpoints/pages.js +245 -66
  68. package/dist/endpoints/placementStatus.js +1 -0
  69. package/dist/endpoints/results.js +3 -0
  70. package/dist/endpoints/testVersion.d.ts +2 -0
  71. package/dist/endpoints/testVersion.js +38 -0
  72. package/dist/endpoints/transitions.js +4 -5
  73. package/dist/exports/index.d.ts +1 -1
  74. package/dist/goals/picker/copy.js +1 -1
  75. package/dist/goals/sourceLabel.d.ts +2 -0
  76. package/dist/goals/sourceLabel.js +4 -0
  77. package/dist/hooks/trackPageCopies.d.ts +11 -0
  78. package/dist/hooks/trackPageCopies.js +7 -0
  79. package/dist/labels/arms.d.ts +3 -0
  80. package/dist/labels/arms.js +8 -0
  81. package/dist/options.d.ts +2 -0
  82. package/dist/options.js +18 -2
  83. package/dist/plugin.js +56 -2
  84. package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
  85. package/dist/puck/editor/ConfigureTestDrawer.js +36 -26
  86. package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
  87. package/dist/puck/editor/ExperimentSlotEditor.js +219 -106
  88. package/dist/puck/editor/LeftoverVersions.js +17 -32
  89. package/dist/puck/editor/QuickTestActions.d.ts +2 -2
  90. package/dist/puck/editor/QuickTestActions.js +44 -34
  91. package/dist/puck/editor/ResultsReadout.d.ts +3 -1
  92. package/dist/puck/editor/ResultsReadout.js +28 -16
  93. package/dist/puck/editor/VersionBuilder.d.ts +4 -2
  94. package/dist/puck/editor/VersionBuilder.js +42 -63
  95. package/dist/puck/editor/armWrites.js +1 -1
  96. package/dist/puck/editor/copy.d.ts +10 -6
  97. package/dist/puck/editor/copy.js +22 -12
  98. package/dist/puck/editor/editor.chrome.css +9 -8
  99. package/dist/puck/editor/editor.css +14 -9
  100. package/dist/puck/editor/placementsCache.d.ts +1 -1
  101. package/dist/puck/editor/placementsCache.js +9 -17
  102. package/dist/puck/editor/usePageSaveReadiness.d.ts +1 -4
  103. package/dist/puck/editor/usePageSaveReadiness.js +18 -21
  104. package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
  105. package/dist/puck/editor/usePlacementNotice.js +4 -5
  106. package/dist/puck/nestedTestCopy.js +2 -2
  107. package/dist/puck/slotConfig.d.ts +1 -1
  108. package/dist/puck/slotConfig.js +1 -1
  109. package/dist/results/analyse.d.ts +2 -0
  110. package/dist/results/analyse.js +2 -2
  111. package/dist/results/verdict.d.ts +4 -4
  112. package/dist/results/verdict.js +13 -10
  113. package/dist/server/runResults.js +2 -1
  114. package/dist/testSurface/PreviewLinks.d.ts +2 -1
  115. package/dist/testSurface/PreviewLinks.js +3 -3
  116. package/dist/testSurface/actions/DecideDialog.d.ts +7 -4
  117. package/dist/testSurface/actions/DecideDialog.js +71 -59
  118. package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
  119. package/dist/testSurface/actions/LifecycleAction.js +107 -0
  120. package/dist/testSurface/actions/MakeContentResult.js +1 -1
  121. package/dist/testSurface/actions/actions.model.d.ts +13 -5
  122. package/dist/testSurface/actions/actions.model.js +75 -22
  123. package/dist/testSurface/actions/decide.model.d.ts +1 -0
  124. package/dist/testSurface/actions/decide.model.js +1 -0
  125. package/dist/testSurface/allocation.model.js +6 -3
  126. package/dist/testSurface/api.d.ts +4 -1
  127. package/dist/testSurface/api.js +22 -14
  128. package/dist/testSurface/copy/actions.d.ts +36 -14
  129. package/dist/testSurface/copy/actions.js +39 -17
  130. package/dist/testSurface/copy/advanced.d.ts +10 -0
  131. package/dist/testSurface/copy/advanced.js +10 -0
  132. package/dist/testSurface/copy/arms.d.ts +1 -1
  133. package/dist/testSurface/copy/arms.js +1 -1
  134. package/dist/testSurface/copy/audience.d.ts +4 -3
  135. package/dist/testSurface/copy/audience.js +5 -4
  136. package/dist/testSurface/copy/common.d.ts +6 -6
  137. package/dist/testSurface/copy/common.js +6 -6
  138. package/dist/testSurface/copy/metrics.d.ts +6 -0
  139. package/dist/testSurface/copy/metrics.js +8 -0
  140. package/dist/testSurface/copy/pages.d.ts +67 -7
  141. package/dist/testSurface/copy/pages.js +74 -7
  142. package/dist/testSurface/copy/readiness.d.ts +8 -6
  143. package/dist/testSurface/copy/readiness.js +19 -10
  144. package/dist/testSurface/copy/recommendation.d.ts +1 -22
  145. package/dist/testSurface/copy/recommendation.js +2 -22
  146. package/dist/testSurface/copy/results.d.ts +16 -10
  147. package/dist/testSurface/copy/results.js +19 -11
  148. package/dist/testSurface/copy/review.d.ts +13 -10
  149. package/dist/testSurface/copy/review.js +14 -10
  150. package/dist/testSurface/copy/setting.d.ts +1 -2
  151. package/dist/testSurface/copy/setting.js +1 -2
  152. package/dist/testSurface/copy/surface.d.ts +11 -2
  153. package/dist/testSurface/copy/surface.js +14 -11
  154. package/dist/testSurface/copy/testPage.d.ts +16 -10
  155. package/dist/testSurface/copy/testPage.js +24 -18
  156. package/dist/testSurface/format/date.d.ts +5 -2
  157. package/dist/testSurface/format/date.js +24 -8
  158. package/dist/testSurface/format/roundProgress.d.ts +6 -0
  159. package/dist/testSurface/format/roundProgress.js +15 -0
  160. package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
  161. package/dist/testSurface/format/useDateFormatter.js +8 -0
  162. package/dist/testSurface/labels.d.ts +1 -2
  163. package/dist/testSurface/labels.js +2 -3
  164. package/dist/testSurface/lockedNotice.model.d.ts +2 -0
  165. package/dist/testSurface/lockedNotice.model.js +31 -0
  166. package/dist/testSurface/readPreflight.d.ts +0 -1
  167. package/dist/testSurface/readPreflight.js +0 -1
  168. package/dist/testSurface/results/CiChart.js +2 -1
  169. package/dist/testSurface/results/DataTable.d.ts +1 -1
  170. package/dist/testSurface/results/DataTable.js +4 -3
  171. package/dist/testSurface/results/VerdictHero.d.ts +1 -1
  172. package/dist/testSurface/results/legacy.d.ts +0 -5
  173. package/dist/testSurface/results/legacy.js +0 -14
  174. package/dist/testSurface/results/results.css +2 -2
  175. package/dist/testSurface/results/results.model.d.ts +8 -3
  176. package/dist/testSurface/results/results.model.js +25 -21
  177. package/dist/testSurface/results/snapshot.d.ts +2 -0
  178. package/dist/testSurface/results/snapshot.js +3 -0
  179. package/dist/testSurface/surface/contracts.d.ts +6 -1
  180. package/dist/testSurface/surface/editorPlacement.d.ts +1 -1
  181. package/dist/testSurface/surface/editorPlacement.js +1 -1
  182. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
  183. package/dist/testSurface/surface/pageBlock/parts.js +25 -12
  184. package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
  185. package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
  186. package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
  187. package/dist/testSurface/surface/pagePicker/PageCombobox.js +298 -209
  188. package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
  189. package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
  190. package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
  191. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +5 -3
  192. package/dist/testSurface/surface/readiness/ActionDialogs.js +213 -207
  193. package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
  194. package/dist/testSurface/surface/readiness/Banner.js +109 -148
  195. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
  196. package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
  197. package/dist/testSurface/surface/readiness/readiness.model.d.ts +14 -5
  198. package/dist/testSurface/surface/readiness/readiness.model.js +62 -12
  199. package/dist/testSurface/surface/readiness/useTransition.d.ts +3 -1
  200. package/dist/testSurface/surface/readiness/useTransition.js +49 -8
  201. package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -3
  202. package/dist/testSurface/surface/results/ReleasePages.js +41 -41
  203. package/dist/testSurface/surface/results/ResultsBody.d.ts +7 -2
  204. package/dist/testSurface/surface/results/ResultsBody.js +170 -110
  205. package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
  206. package/dist/testSurface/surface/results/recommendation.model.js +15 -59
  207. package/dist/testSurface/surface/results/useResults.d.ts +6 -2
  208. package/dist/testSurface/surface/setting/parts.js +31 -28
  209. package/dist/testSurface/surface/setting/setting.css +2 -1
  210. package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
  211. package/dist/testSurface/surface/test/DeleteTest.d.ts +5 -1
  212. package/dist/testSurface/surface/test/DeleteTest.js +63 -55
  213. package/dist/testSurface/surface/test/GoalSection.js +11 -11
  214. package/dist/testSurface/surface/test/LengthSection.js +21 -13
  215. package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
  216. package/dist/testSurface/surface/test/PageHoldout.js +7 -7
  217. package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
  218. package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
  219. package/dist/testSurface/surface/test/Section.js +8 -0
  220. package/dist/testSurface/surface/test/TargetingSection.js +7 -2
  221. package/dist/testSurface/surface/test/TestSurface.js +17 -43
  222. package/dist/testSurface/surface/test/VersionsSection.js +93 -70
  223. package/dist/testSurface/surface/test/fields.d.ts +4 -3
  224. package/dist/testSurface/surface/test/fields.js +10 -16
  225. package/dist/testSurface/surface/test/pageParts.js +13 -7
  226. package/dist/testSurface/surface/test/testPage.css +9 -2
  227. package/dist/testSurface/surface/useTestDocument.d.ts +1 -3
  228. package/dist/testSurface/surface/useTestDocument.js +110 -52
  229. package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
  230. package/dist/testSurface/surface/watchTestDocument.js +181 -0
  231. package/dist/testSurface/surfaceUrls.d.ts +1 -0
  232. package/dist/testSurface/surfaceUrls.js +4 -0
  233. package/dist/testSurface/useApi.d.ts +3 -0
  234. package/dist/transitions/addMetric.d.ts +1 -1
  235. package/dist/transitions/addMetric.js +5 -1
  236. package/dist/transitions/kernel.d.ts +2 -0
  237. package/dist/transitions/kernel.js +1 -1
  238. package/dist/transitions/pageAddress.d.ts +6 -0
  239. package/dist/transitions/pageAddress.js +71 -0
  240. package/dist/transitions/pageVersions.d.ts +1 -1
  241. package/dist/transitions/preflightData.js +10 -2
  242. package/dist/transitions/start.d.ts +1 -1
  243. package/dist/transitions/start.js +8 -5
  244. package/dist/types/armKey.d.ts +2 -0
  245. package/dist/types/armKey.js +1 -0
  246. package/dist/types/contracts.d.ts +11 -1
  247. package/dist/types/endpoints.d.ts +38 -9
  248. package/dist/types/endpoints.js +1 -1
  249. package/dist/types/surface.d.ts +7 -9
  250. package/dist/ui/Dialog.d.ts +21 -2
  251. package/dist/ui/Dialog.js +101 -4
  252. package/dist/ui/Inputs.js +0 -1
  253. package/dist/ui/ui.css +5 -1
  254. package/package.json +2 -2
@@ -1,13 +1,16 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { theme } from '../../theme.js';
4
- import { useEffect, useRef, useState } from 'react';
4
+ import { useEffect, useId, useRef, useState } from 'react';
5
5
  import { Button } from '../../../ui/Button.js';
6
6
  import { Select } from '../../../ui/Inputs.js';
7
- import { RESULTS_COPY as C } from '../../copy/results.js';
8
- import { formatDate } from '../../format/date.js';
9
- import { ACTIONS_COPY } from '../../copy/actions.js';
10
- import { METRICS_COPY } from '../../copy/metrics.js';
7
+ import { RESULTS_COPY as C, daysOfPlan, percentileCapHelp, revenueCapHelp } from '../../copy/results.js';
8
+ import { relativeTime } from '../../format/date.js';
9
+ import { roundProgress } from '../../format/roundProgress.js';
10
+ import { useDateFormatter } from '../../format/useDateFormatter.js';
11
+ import { TEST_PAGE } from '../../copy/testPage.js';
12
+ import { LifecycleButton } from '../../actions/LifecycleAction.js';
13
+ import { percentileTail } from '../../copy/metrics.js';
11
14
  import { API_MESSAGES } from '../../copy/common.js';
12
15
  import { armLabel } from '../../labels.js';
13
16
  import { PreviewLinks } from '../../PreviewLinks.js';
@@ -15,18 +18,19 @@ import { actionablePreviewPages } from '../../previewLinks.model.js';
15
18
  import { VerdictHero } from '../../results/VerdictHero.js';
16
19
  import { StatTile } from '../../results/StatTile.js';
17
20
  import { DataTable, Swatch } from '../../results/DataTable.js';
18
- import { daysOfPlan } from '../../copy/results.js';
19
- import { formatCount, formatPercent } from '../../results/format.js';
21
+ import { formatCount, formatCurrency, formatPercent } from '../../results/format.js';
20
22
  import { DataQualityPanel } from '../../results/DataQualityPanel.js';
21
23
  import { CiChart } from '../../results/CiChart.js';
22
- import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, verdictCard } from '../../results/results.model.js';
24
+ import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, runningPlanLine, verdictCard } from '../../results/results.model.js';
25
+ import { hasMissingRolloutWinner } from '../../results/snapshot.js';
23
26
  import { recommendation } from './recommendation.model.js';
24
27
  import { useResults } from './useResults.js';
25
28
  import { DecideDialog } from '../../actions/DecideDialog.js';
26
29
  import { Banner } from '../../../ui/Banner.js';
27
- import { canReleasePages } from '../../results/releasePages.model.js';
30
+ import { availableActions } from '../../actions/actions.model.js';
28
31
  import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
29
32
  import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
33
+ import { notifyTestDocument } from '../watchTestDocument.js';
30
34
  export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
31
35
  // A different test owns an independent selection and action lifecycle.
32
36
  return /*#__PURE__*/ _jsx(ResultsContent, {
@@ -41,8 +45,10 @@ export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged,
41
45
  }, `${surface.apiRoute}/${id}`);
42
46
  }
43
47
  function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
48
+ const formatDate = useDateFormatter();
44
49
  const results = useResults(id, surface, documentVersion);
45
50
  const { api, doc, round, phases, state, data } = results;
51
+ const managerDoc = liveDocument ?? doc;
46
52
  const manage = surface.canManage && surface.canReadResults;
47
53
  const [placements, setPlacements] = useState(null);
48
54
  const [checks, setChecks] = useState([]);
@@ -53,6 +59,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
53
59
  const mounted = useRef(true);
54
60
  const [actionError, setActionError] = useState(null);
55
61
  const [deciding, setDeciding] = useState(null);
62
+ const previewId = useId();
56
63
  const [releasing, setReleasing] = useState(null);
57
64
  useEffect(()=>{
58
65
  mounted.current = true;
@@ -99,7 +106,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
99
106
  if (mounted.current) setBusy(false);
100
107
  }
101
108
  }
102
- const phase = data?.phases.find((phase)=>phase.phase === round);
109
+ const phase = phases.find((phase)=>phase.phase === round);
103
110
  const snapshot = data?.snapshot;
104
111
  const newestRound = defaultRound({
105
112
  phases,
@@ -107,18 +114,24 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
107
114
  });
108
115
  const latestPhase = phases.find((phase)=>phase.phase === newestRound);
109
116
  const decision = data?.decision ?? doc?.decision;
110
- const status = liveDocument?.status ?? doc?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
117
+ const status = managerDoc?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
111
118
  // ADM-06b: an older round never inherits the live test's running status.
112
119
  const lineStatus = !statusReadPending && status === 'running' && round === newestRound ? 'running' : 'stopped';
113
120
  const isDecidedTestRound = status === 'decided' && phase?.phaseKind === 'test' && decision?.phase === round;
114
121
  const showingDecision = isDecidedTestRound && Boolean(data?.decisionSnapshot);
115
122
  const shown = showingDecision ? data.decisionSnapshot : snapshot;
116
123
  const winner = phase?.arms.find((arm)=>arm.key === decision?.winnerArm)?.label ?? armLabel(decision?.winnerArm ?? 'control');
124
+ const control = phase?.arms.find((arm)=>arm.kind === 'control') ?? phases.find((item)=>item.phase === decision?.phase)?.arms.find((arm)=>arm.kind === 'control');
125
+ const planned = phase?.plannedDurationDays ?? (phase?.phaseKind === 'test' && lineStatus === 'running' ? managerDoc?.analysis?.plannedDurationDays : undefined);
126
+ const progress = roundProgress(phase?.startedAt ?? shown?.window.from, planned, lineStatus === 'running' ? Date.now() : Date.parse(shown?.window.to ?? ''));
127
+ const planLine = shown && lineStatus === 'running' ? runningPlanLine(shown, progress, formatDate) : null;
117
128
  const card = shown ? verdictCard({
118
129
  snapshot: shown,
119
130
  decisionSnapshot: data?.decisionSnapshot,
120
131
  isDecidedTestRound,
121
- winnerLabel: winner
132
+ winnerLabel: winner,
133
+ controlLabel: control?.label,
134
+ keepRunningAction: planLine
122
135
  }) : null;
123
136
  const placementLabels = usePlacementLabels({
124
137
  details: shown?.health?.filter((item)=>item.code === 'placement-unchecked').map((item)=>item.detail) ?? [],
@@ -144,91 +157,119 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
144
157
  latestActivity
145
158
  ]
146
159
  } : shown;
160
+ const qualityItems = phase && qualitySnapshot ? dataQuality(qualitySnapshot, context) : [];
147
161
  const primary = phase?.metrics.find((metric)=>metric.role === 'primary');
148
162
  // The endpoint decides the current round; historical rounds are read-only.
149
- const canDecide = manage && !statusReadPending && (status === 'running' || status === 'stopped') && phase?.phaseKind === 'test' && (liveDocument?.phase == null || liveDocument.phase === round) && round === newestRound && state === 'ready' && Boolean(shown);
150
- const releaseDoc = liveDocument ? {
151
- kind: liveDocument.kind,
152
- status: liveDocument.status,
153
- phase: liveDocument.phase,
154
- decision: liveDocument.decision
155
- } : doc;
156
- const canRelease = manage && !!releaseDoc && canReleasePages(releaseDoc);
157
- if (releasing && (!canRelease || releaseDoc.phase !== releasing.phase)) setReleasing(null);
158
- function refreshDocument() {
163
+ const lifecycle = managerDoc || data ? availableActions({
164
+ ...managerDoc,
165
+ status,
166
+ kind: managerDoc?.kind ?? 'block',
167
+ decision: managerDoc?.decision,
168
+ canManage: surface.canManage,
169
+ canReadResults: surface.canReadResults
170
+ }) : [];
171
+ const decisionRound = phase?.phaseKind === 'test' && round === newestRound && (liveDocument?.phase == null || liveDocument.phase === round) ? phase : !phases.length && liveDocument?.phase != null ? {
172
+ phase: liveDocument.phase
173
+ } : null;
174
+ const canRelease = lifecycle.some((action)=>action.id === 'release-pages');
175
+ function refreshDocument(transition) {
176
+ if (transition && !onChanged) notifyTestDocument(surface.apiRoute, id);
159
177
  results.reload();
160
- onChanged?.();
178
+ onChanged?.(transition);
179
+ }
180
+ const roundActions = {};
181
+ for (const action of lifecycle){
182
+ if (statusReadPending) break;
183
+ if (action.id === 'decide' && (decisionRound || state !== 'loading')) roundActions.decide = /*#__PURE__*/ _jsx(LifecycleButton, {
184
+ action: action,
185
+ reason: decisionRound ? undefined : C.previousRound,
186
+ disabled: busy || !!releasing,
187
+ onClick: ()=>{
188
+ if (decisionRound) setDeciding({
189
+ ...decisionRound,
190
+ results: data && round === decisionRound.phase && 'arms' in decisionRound && (state === 'ready' || state === 'empty') ? data : undefined
191
+ });
192
+ }
193
+ });
194
+ if (action.id === 'release-pages') roundActions['release-pages'] = /*#__PURE__*/ _jsx(LifecycleButton, {
195
+ action: action,
196
+ disabled: busy || !!deciding,
197
+ onClick: ()=>{
198
+ setActionError(null);
199
+ setReleasing({
200
+ phase: managerDoc?.phase
201
+ });
202
+ }
203
+ });
161
204
  }
162
- const actions = /*#__PURE__*/ _jsxs(_Fragment, {
205
+ const pages = manage && placements ? actionablePreviewPages(placements, doc?.flagPoint) : [];
206
+ const editorUrls = [
207
+ ...new Set(pages.flatMap((page)=>page.editorUrl ? [
208
+ page.editorUrl
209
+ ] : []))
210
+ ];
211
+ const editOnPage = editorUrls.length ? /*#__PURE__*/ _jsx(Button, {
212
+ size: "sm",
213
+ href: editorUrls.length === 1 ? editorUrls[0] : `#${previewId}`,
214
+ children: TEST_PAGE.editOnPage
215
+ }) : null;
216
+ // A decided round displays the frozen snapshot used for the decision.
217
+ const refresh = manage && !showingDecision ? /*#__PURE__*/ _jsxs("div", {
218
+ className: "xp-results-refresh",
163
219
  children: [
164
- canDecide ? /*#__PURE__*/ _jsx(Button, {
165
- disabled: busy || !!deciding || !!releasing,
166
- onClick: ()=>{
167
- if (phase) setDeciding(phase);
168
- },
169
- children: ACTIONS_COPY.decide
170
- }) : null,
171
- canRelease && !statusReadPending ? /*#__PURE__*/ _jsx(Button, {
172
- variant: "secondary",
173
- disabled: busy || !!deciding || !!releasing,
220
+ /*#__PURE__*/ _jsx(Button, {
221
+ size: "sm",
222
+ busy: busy,
223
+ disabled: !!deciding || !!releasing,
174
224
  onClick: ()=>{
175
- setActionError(null);
176
- setReleasing({
177
- phase: releaseDoc.phase
178
- });
225
+ void recompute();
179
226
  },
180
- children: C.releasePages
227
+ children: busy ? C.recomputing : C.recompute
228
+ }),
229
+ snapshot?.computedAt ? /*#__PURE__*/ _jsx("span", {
230
+ className: "xp-ui-help",
231
+ children: C.updated(relativeTime(snapshot.computedAt, undefined, formatDate))
181
232
  }) : null
182
233
  ]
183
- });
234
+ }) : null;
184
235
  // Release details come only from the manager's own document, never the results response.
185
- const released = manage && releaseDoc?.decision?.pagesReleasedAt ? /*#__PURE__*/ _jsx(PagesReleased, {
186
- decision: releaseDoc.decision,
236
+ const releaseDecision = managerDoc?.decision;
237
+ const released = manage && releaseDecision?.pagesReleasedAt ? /*#__PURE__*/ _jsx(PagesReleased, {
238
+ decision: releaseDecision,
187
239
  apiRoute: surface.apiRoute,
188
240
  userId: surface.userId,
189
241
  userCollection: surface.userCollection
190
242
  }) : null;
191
- const meta = /*#__PURE__*/ _jsxs(_Fragment, {
192
- children: [
193
- /*#__PURE__*/ _jsxs("div", {
194
- className: "xp-round-meta",
195
- children: [
196
- phases.length > 0 ? /*#__PURE__*/ _jsx(Select, {
197
- id: "xp-results-round",
198
- label: C.round,
199
- disabled: !!deciding || !!releasing,
200
- value: round ?? '',
201
- onChange: (event)=>results.setRound(Number(event.target.value)),
202
- children: roundOptions(phases).map((option)=>/*#__PURE__*/ _jsx("option", {
203
- value: option.value,
204
- children: option.label
205
- }, option.value))
206
- }) : null,
207
- manage && shown ? /*#__PURE__*/ _jsxs("span", {
208
- children: [
209
- "· ",
210
- C.methods[shown.method]
211
- ]
212
- }) : null,
213
- showingDecision ? /*#__PURE__*/ _jsxs("span", {
214
- className: "xp-results-as-of",
215
- children: [
216
- manage ? '· ' : '',
217
- C.asOfDecision(formatDate(data.decisionSnapshot.computedAt))
218
- ]
219
- }) : null
220
- ]
221
- }),
222
- manage && !showingDecision ? /*#__PURE__*/ _jsx(Button, {
223
- variant: "quiet",
224
- size: "sm",
225
- disabled: busy || !!deciding || !!releasing,
226
- onClick: ()=>{
227
- void recompute();
228
- },
229
- children: busy ? C.recomputing : C.recompute
230
- }) : null
231
- ]
243
+ const meta = /*#__PURE__*/ _jsx(_Fragment, {
244
+ children: /*#__PURE__*/ _jsxs("div", {
245
+ className: "xp-round-meta",
246
+ children: [
247
+ phases.length > 0 ? /*#__PURE__*/ _jsx(Select, {
248
+ id: "xp-results-round",
249
+ label: C.round,
250
+ disabled: !!deciding || !!releasing,
251
+ value: round ?? '',
252
+ onChange: (event)=>results.setRound(Number(event.target.value)),
253
+ children: roundOptions(phases).map((option)=>/*#__PURE__*/ _jsx("option", {
254
+ value: option.value,
255
+ children: option.label
256
+ }, option.value))
257
+ }) : null,
258
+ manage && shown ? /*#__PURE__*/ _jsxs("span", {
259
+ children: [
260
+ "· ",
261
+ C.methods[shown.method]
262
+ ]
263
+ }) : null,
264
+ showingDecision ? /*#__PURE__*/ _jsxs("span", {
265
+ className: "xp-results-as-of",
266
+ children: [
267
+ manage ? '· ' : '',
268
+ C.asOfDecision(formatDate(data.decisionSnapshot.computedAt))
269
+ ]
270
+ }) : null
271
+ ]
272
+ })
232
273
  });
233
274
  const leader = shown?.verdict.recommendedArm;
234
275
  const leadingComparison = shown?.metrics.find((metric)=>metric.role === 'primary')?.comparisons.find((item)=>item.arm === leader);
@@ -236,8 +277,6 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
236
277
  'collecting',
237
278
  'rollout-collecting'
238
279
  ].includes(shown.verdict.code) ? leadingComparison?.chanceToWin : undefined;
239
- const days = shown ? Math.max(0, Math.floor((Date.parse(shown.window.to) - Date.parse(phase?.startedAt ?? shown.window.from)) / 86400000)) : undefined;
240
- const planned = doc?.analysis?.plannedDurationDays;
241
280
  const content = /*#__PURE__*/ _jsxs("div", {
242
281
  className: "xp-results",
243
282
  style: {
@@ -250,9 +289,13 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
250
289
  }) : null,
251
290
  !renderPage ? /*#__PURE__*/ _jsxs(_Fragment, {
252
291
  children: [
253
- /*#__PURE__*/ _jsx("div", {
292
+ /*#__PURE__*/ _jsxs("div", {
254
293
  className: "xp-ui-button-group",
255
- children: actions
294
+ children: [
295
+ editOnPage,
296
+ refresh,
297
+ Object.values(roundActions)
298
+ ]
256
299
  }),
257
300
  released
258
301
  ]
@@ -287,14 +330,14 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
287
330
  snapshot: shown,
288
331
  phase,
289
332
  status: lineStatus,
290
- plannedDurationDays: round === newestRound ? doc?.analysis?.plannedDurationDays : undefined
333
+ isDecidedTestRound
291
334
  }),
292
335
  guardrails: guardrailChips(shown),
293
336
  power: powerLine({
294
337
  snapshot: shown,
295
338
  phaseKind: phase.phaseKind,
296
339
  status: lineStatus
297
- }),
340
+ }, planLine),
298
341
  collecting: collectingLine({
299
342
  snapshot: shown,
300
343
  phaseKind: phase.phaseKind,
@@ -315,9 +358,9 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
315
358
  }),
316
359
  /*#__PURE__*/ _jsx(StatTile, {
317
360
  label: C.days,
318
- value: planned ? daysOfPlan(formatCount(days), formatCount(planned)) : formatCount(days)
361
+ value: progress.plannedDays === null ? formatCount(progress.day) : daysOfPlan(formatCount(progress.day), formatCount(progress.plannedDays))
319
362
  }),
320
- /*#__PURE__*/ _jsx(StatTile, {
363
+ shown.method === 'bayesian' ? /*#__PURE__*/ _jsx(StatTile, {
321
364
  label: C.chanceToWin,
322
365
  value: formatPercent(chance),
323
366
  detail: chance != null && leader ? /*#__PURE__*/ _jsxs(_Fragment, {
@@ -328,7 +371,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
328
371
  phase.arms.find((arm)=>arm.key === leader)?.label ?? armLabel(leader)
329
372
  ]
330
373
  }) : undefined
331
- })
374
+ }) : null
332
375
  ]
333
376
  }),
334
377
  phase.metrics.filter((metric)=>metric.role === 'primary').map((metric)=>/*#__PURE__*/ _jsx(MetricTable, {
@@ -355,10 +398,10 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
355
398
  shown.goalFairnessNotice ? /*#__PURE__*/ _jsx("p", {
356
399
  children: shown.goalFairnessNotice
357
400
  }) : null,
358
- /*#__PURE__*/ _jsx(DataQualityPanel, {
401
+ qualityItems.length > 0 || !hasMissingRolloutWinner(shown) ? /*#__PURE__*/ _jsx(DataQualityPanel, {
359
402
  problem: shown.verdict.code === 'data-problem',
360
- items: dataQuality(qualitySnapshot ?? shown, context)
361
- }),
403
+ items: qualityItems
404
+ }) : null,
362
405
  [
363
406
  'guardrail',
364
407
  'secondary'
@@ -376,7 +419,8 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
376
419
  }) : null
377
420
  ]
378
421
  }),
379
- manage && placements && actionablePreviewPages(placements, doc?.flagPoint).length > 0 ? /*#__PURE__*/ _jsxs("section", {
422
+ placements && pages.length > 0 && (editorUrls.length !== 1 || pages.some((page)=>page.url)) ? /*#__PURE__*/ _jsxs("section", {
423
+ id: previewId,
380
424
  className: "xp-results-block",
381
425
  children: [
382
426
  /*#__PURE__*/ _jsx("div", {
@@ -386,6 +430,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
386
430
  })
387
431
  }),
388
432
  /*#__PURE__*/ _jsx(PreviewLinks, {
433
+ showEditLinks: editorUrls.length !== 1 || !renderPage,
389
434
  apiRoute: surface.apiRoute,
390
435
  experimentId: id,
391
436
  flagPoint: doc?.flagPoint,
@@ -406,14 +451,14 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
406
451
  })
407
452
  ]
408
453
  }) : null,
409
- releasing && canRelease && releaseDoc.phase === releasing.phase ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
454
+ releasing ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
410
455
  id: id,
411
- disabled: statusReadPending,
456
+ name: managerDoc?.name,
457
+ disabled: statusReadPending || !canRelease || managerDoc?.phase !== releasing.phase,
412
458
  phase: releasing.phase,
413
459
  apiRoute: surface.apiRoute,
414
460
  onClose: ()=>setReleasing(null),
415
- onRefusal: (message, status)=>{
416
- setActionError(message);
461
+ onRefusal: (status)=>{
417
462
  if ([
418
463
  401,
419
464
  403,
@@ -422,7 +467,9 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
422
467
  422
423
468
  ].includes(status)) refreshDocument();
424
469
  },
425
- onSuccess: refreshDocument
470
+ onSuccess: (doc)=>refreshDocument({
471
+ doc
472
+ })
426
473
  }) : null
427
474
  ]
428
475
  });
@@ -431,23 +478,29 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
431
478
  children: [
432
479
  renderPage ? renderPage({
433
480
  children: content,
434
- actions,
481
+ roundActions,
482
+ editOnPage,
483
+ refresh,
435
484
  released,
436
485
  data
437
486
  }) : content,
438
487
  deciding && manage ? /*#__PURE__*/ _jsx(DecideDialog, {
439
488
  apiRoute: surface.apiRoute,
440
489
  id: id,
490
+ name: managerDoc?.name ?? data?.experiment?.name,
441
491
  phase: deciding.phase,
442
492
  arms: deciding.arms,
493
+ results: deciding.results,
443
494
  checks: checks,
444
- unavailable: statusReadPending || status !== 'running' && status !== 'stopped' || liveDocument?.phase != null && liveDocument.phase !== deciding.phase,
495
+ pending: statusReadPending,
496
+ unavailable: !lifecycle.some((action)=>action.id === 'decide') || liveDocument?.phase != null && liveDocument.phase !== deciding.phase,
445
497
  onClose: ()=>setDeciding(null),
446
- onRefusal: refreshDocument,
498
+ onRefusal: ()=>refreshDocument(),
447
499
  onSuccess: onChanged ? (doc)=>{
448
500
  setDeciding(null);
449
- results.reload();
450
- onChanged(doc);
501
+ refreshDocument({
502
+ doc
503
+ });
451
504
  } : undefined
452
505
  }) : null
453
506
  ]
@@ -463,6 +516,15 @@ function MetricTable({ metric, snapshot, phase, leader }) {
463
516
  const notices = [
464
517
  ...new Set(rows.map((row)=>row.capped.notice).filter(Boolean))
465
518
  ];
519
+ if (metric.kind === 'revenue' && !notices.length) {
520
+ const cap = snapshot.params.caps[metric.metricId];
521
+ if (cap?.resolvedCap === null || !cap && metric.capNotice === 'no-history') notices.push(C.noCap);
522
+ else if (cap?.type === 'percentile') notices.push(percentileCapHelp(percentileTail(cap.value)));
523
+ else {
524
+ const threshold = cap?.value ?? metric.resolvedCap;
525
+ if (threshold != null) notices.push(revenueCapHelp(formatCurrency(threshold)));
526
+ }
527
+ }
466
528
  return /*#__PURE__*/ _jsxs("section", {
467
529
  className: "xp-results-block",
468
530
  children: [
@@ -496,12 +558,10 @@ function MetricTable({ metric, snapshot, phase, leader }) {
496
558
  primary: metric.role === 'primary',
497
559
  leader: leader
498
560
  }),
499
- metric.kind === 'revenue' ? (notices.length ? notices : [
500
- METRICS_COPY.revenueHint
501
- ]).map((notice)=>/*#__PURE__*/ _jsx("p", {
561
+ notices.map((notice)=>/*#__PURE__*/ _jsx("p", {
502
562
  className: "xp-results-cap-help",
503
563
  children: notice
504
- }, notice)) : null
564
+ }, notice))
505
565
  ]
506
566
  });
507
567
  }
@@ -1,13 +1,10 @@
1
1
  import type { PhaseSummary } from '../../../types/endpoints.js';
2
2
  import type { Status } from '../../../types/contracts.js';
3
- import type { VerdictCode } from '../../../types/snapshot.js';
4
3
  import { type DisplaySnapshot } from '../../results/snapshot.js';
5
- export interface RecommendationContext {
4
+ /** Add guidance only when it gives the editor information the verdict does not. */
5
+ export declare function recommendation({ snapshot, phase, status, isDecidedTestRound }: {
6
6
  snapshot: DisplaySnapshot;
7
- phase?: PhaseSummary;
8
- plannedDurationDays?: number | null;
9
- status?: Status;
10
- }
11
- /** Select stored findings and format them; never run inference in the admin. */
12
- export declare const RECOMMENDATION: Record<VerdictCode, (ctx: RecommendationContext) => string>;
13
- export declare const recommendation: (ctx: RecommendationContext) => string;
7
+ phase: PhaseSummary;
8
+ status: Status;
9
+ isDecidedTestRound: boolean;
10
+ }): string | null;
@@ -1,62 +1,18 @@
1
- import { formatDate } from '../../format/date.js';
2
1
  import { armLabel } from '../../labels.js';
3
- import { formatCount, formatPercent } from '../../results/format.js';
2
+ import { formatCount } from '../../results/format.js';
3
+ import { collectingRecommendation, noDifferenceRecommendation } from '../../copy/recommendation.js';
4
4
  import { RESULTS_COPY } from '../../copy/results.js';
5
- import { legacyRecommendationWinner } from '../../results/legacy.js';
6
- import { isLegacySnapshot } from '../../results/snapshot.js';
7
- import { RECOMMENDATION_COPY as C, collectingRecommendation, guardrailRecommendation, mixedRecommendation, rolloutCollectingRecommendation, rolloutReadoutRecommendation, runningRecommendation, winnerRecommendation, worseRecommendation, storedGuardrailFinding } from '../../copy/recommendation.js';
8
- function label(ctx, key, fallback = C.group) {
9
- const stored = ctx.phase?.arms.find((arm)=>arm.key === key)?.label.trim();
10
- return stored || (key && [
11
- 'control',
12
- 'variantA',
13
- 'variantB',
14
- 'variantC',
15
- 'holdout'
16
- ].includes(key) ? armLabel(key) : fallback);
5
+ import { hasMissingRolloutWinner } from '../../results/snapshot.js';
6
+ /** Add guidance only when it gives the editor information the verdict does not. */ export function recommendation({ snapshot, phase, status, isDecidedTestRound }) {
7
+ if (hasMissingRolloutWinner(snapshot)) return `${RESULTS_COPY.missingWinner} ${RESULTS_COPY.missingWinnerNext}`;
8
+ if (isDecidedTestRound) return null;
9
+ if (snapshot.verdict.code === 'collecting' && status === 'running' && snapshot.power.exposuresNeededPerArm != null) {
10
+ const groups = phase.arms.filter((arm)=>arm.kind !== 'holdout').length;
11
+ return collectingRecommendation(formatCount(Math.round(snapshot.power.exposuresNeededPerArm * groups)));
12
+ }
13
+ if (snapshot.verdict.code === 'no-difference') {
14
+ const control = phase.arms.find((arm)=>arm.kind === 'control');
15
+ return noDifferenceRecommendation(control?.label.trim() || armLabel('control'));
16
+ }
17
+ return null;
17
18
  }
18
- const primary = ({ snapshot })=>snapshot.metrics.find((metric)=>metric.role === 'primary');
19
- const worse = (ctx)=>primary(ctx)?.comparisons.find((comparison)=>comparison.significant === 'worse' && ctx.phase?.arms.some((arm)=>arm.key === comparison.arm && arm.kind === 'variant'))?.arm;
20
- const rolloutWinner = (ctx)=>isLegacySnapshot(ctx.snapshot) ? legacyRecommendationWinner(ctx.snapshot, ctx.phase) : {
21
- key: ctx.snapshot.winnerArm,
22
- label: label(ctx, ctx.snapshot.winnerArm)
23
- };
24
- /** Select stored findings and format them; never run inference in the admin. */ export const RECOMMENDATION = {
25
- unavailable: ()=>C.unavailable,
26
- 'data-problem': ()=>C.dataProblem,
27
- 'guardrail-failing': (ctx)=>{
28
- const guardrail = ctx.snapshot.guardrails.find((guardrail)=>guardrail.status === 'failing');
29
- const metric = ctx.snapshot.metrics.find((metric)=>metric.metricId === guardrail?.metricId);
30
- // Guardrail safety uses one-sided tests, distinct from comparison significance.
31
- // Select the group the server named; do not re-infer harm from the table.
32
- const group = ctx.phase?.arms.find((arm)=>ctx.snapshot.verdict.finding === storedGuardrailFinding(arm.label.trim() || armLabel(arm.key), metric?.name ?? C.guardrail));
33
- return guardrailRecommendation(label(ctx, ctx.snapshot.verdict.worstArm ?? group?.key), metric?.name ?? C.guardrail);
34
- },
35
- collecting: (ctx)=>{
36
- if (ctx.status === 'stopped') return C.stoppedCollecting;
37
- const needed = ctx.snapshot.power.exposuresNeededPerArm;
38
- const groups = ctx.phase?.arms.filter((arm)=>arm.kind !== 'holdout').length ?? ctx.snapshot.k + 1;
39
- return needed === null ? C.collecting : collectingRecommendation(formatCount(Math.round(needed * groups)));
40
- },
41
- 'original-better': ()=>C.originalBetter,
42
- 'worse-none-better': (ctx)=>worseRecommendation(label(ctx, worse(ctx))),
43
- winner: (ctx)=>winnerRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm)),
44
- mixed: (ctx)=>mixedRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm), label(ctx, worse(ctx))),
45
- 'keep-running': (ctx)=>{
46
- // Same condition as the server's long-duration branch (src/results/verdict.ts).
47
- const power = ctx.snapshot.power;
48
- if (!power.feasible || power.daysRemaining !== null && power.daysRemaining > 90) return C.longDuration;
49
- const days = ctx.plannedDurationDays;
50
- const start = Date.parse(ctx.phase?.startedAt ?? '');
51
- const end = days != null && Number.isFinite(days) && days > 0 ? start + days * 86_400_000 : NaN;
52
- return Number.isFinite(end) ? runningRecommendation(formatDate(end)) : C.keepRunning;
53
- },
54
- 'no-difference': ()=>C.noDifference,
55
- 'rollout-collecting': (ctx)=>rolloutCollectingRecommendation(rolloutWinner(ctx).label),
56
- 'rollout-readout': (ctx)=>rolloutReadoutRecommendation(rolloutWinner(ctx).label, formatPercent(primary(ctx)?.comparisons.find((comparison)=>comparison.arm === rolloutWinner(ctx).key)?.lift, true))
57
- };
58
- export const recommendation = (ctx)=>{
59
- if (!isLegacySnapshot(ctx.snapshot) && ctx.snapshot.phaseKind === 'rollout' && ctx.snapshot.winnerArm === null) return RESULTS_COPY.missingWinner;
60
- const sentence = RECOMMENDATION[ctx.snapshot.verdict.code];
61
- return sentence(ctx);
62
- };
@@ -1,10 +1,11 @@
1
- import type { DocId, Status } from '../../../types/contracts.js';
1
+ import type { DocId, ExperimentKind, Status } from '../../../types/contracts.js';
2
2
  import type { PhaseSummary, ResultsResponse } from '../../../types/endpoints.js';
3
3
  import { type ApiResult } from '../../api.js';
4
4
  import type { PageReleaseDecision } from '../../results/releasePages.model.js';
5
5
  export interface ResultsDocument {
6
+ name?: string;
6
7
  flagPoint?: string;
7
- kind?: string;
8
+ kind?: ExperimentKind;
8
9
  status: Status;
9
10
  phase?: number;
10
11
  arms: Array<{
@@ -45,7 +46,10 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
45
46
  q?: string;
46
47
  path?: string;
47
48
  page?: number;
49
+ mode?: "block";
48
50
  }, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").PagesResult>>;
51
+ previewPageCopy: (id: DocId, arm: string, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPagePlan>>;
52
+ makePageCopy: (id: DocId, arm: string, plan: import("../../../types/endpoints.js").CopyPagePlan) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPageResult>>;
49
53
  placementStatus: (body: import("../../../types/endpoints.js").PlacementStatusBody) => Promise<ApiResult<import("../../../types/endpoints.js").PlacementStatusResult>>;
50
54
  start: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
51
55
  allocate: (id: DocId, body: import("../../../types/endpoints.js").AllocateBody, options?: {