@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
@@ -22,7 +22,6 @@ export const VERDICT_LABELS = {
22
22
  'data-problem': 'Check the data',
23
23
  'guardrail-failing': 'An important outcome got worse',
24
24
  collecting: 'Collecting results',
25
- 'original-better': 'The Original is better',
26
25
  'worse-none-better': 'No better option',
27
26
  winner: 'A winner',
28
27
  mixed: 'Mixed results',
@@ -40,8 +39,8 @@ export function statusLabel(status) {
40
39
  export function phaseKindLabel(kind) {
41
40
  return PHASE_KIND_LABELS[kind];
42
41
  }
43
- export function verdictCodeLabel(code) {
44
- return VERDICT_LABELS[code];
42
+ export function verdictCodeLabel(code, controlLabel = 'The control version') {
43
+ return code === 'original-better' ? `${controlLabel} is better` : VERDICT_LABELS[code];
45
44
  }
46
45
  export function kindLabel(kind) {
47
46
  return KIND_LABELS[kind];
@@ -1,3 +1,5 @@
1
1
  import type { Status } from '../types/contracts.js';
2
2
  import type { EditableField } from '../types/admin.js';
3
+ import type { SectionId } from './surface/contracts.js';
4
+ export declare function sectionLockNotice(status: Status, section: SectionId): string | null;
3
5
  export declare function lockedReason(status: Status, field: string, table: Record<Status, readonly EditableField[]>): string | null;
@@ -1,4 +1,35 @@
1
+ import { EDITABLE_BY_STATUS } from '../collections/experiments/editability.js';
1
2
  import { LOCKED_MESSAGES } from './copy/common.js';
3
+ const sectionFields = {
4
+ what: [
5
+ 'name',
6
+ 'hypothesis',
7
+ 'flagPoint',
8
+ 'pageCollection'
9
+ ],
10
+ versions: [
11
+ 'arms'
12
+ ],
13
+ win: [
14
+ 'metrics'
15
+ ],
16
+ who: [
17
+ 'targeting',
18
+ 'allocation'
19
+ ],
20
+ length: [
21
+ 'analysis'
22
+ ],
23
+ advanced: [
24
+ 'analysis',
25
+ 'exposurePolicy'
26
+ ]
27
+ };
28
+ export function sectionLockNotice(status, section) {
29
+ const fields = sectionFields[section];
30
+ if (fields.some((field)=>EDITABLE_BY_STATUS[status].includes(field))) return null;
31
+ return lockedReason(status, fields[0], EDITABLE_BY_STATUS);
32
+ }
2
33
  export function lockedReason(status, field, table) {
3
34
  if ([
4
35
  'slug',
@@ -1,6 +1,5 @@
1
1
  import type { PreflightResult } from '../types/endpoints.js';
2
2
  export declare const PREFLIGHT_TIMEOUT_MS = 15000;
3
- export declare const READINESS_REFRESH_MS = 30000;
4
3
  type DocumentVersion = NonNullable<PreflightResult['document']>;
5
4
  export declare function statusOrRoundChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
6
5
  export declare function documentChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
@@ -1,5 +1,4 @@
1
1
  export const PREFLIGHT_TIMEOUT_MS = 15_000;
2
- export const READINESS_REFRESH_MS = 30_000;
3
2
  export function statusOrRoundChanged(answer, current) {
4
3
  return !!answer && (answer.status !== current.status || answer.phase !== undefined && answer.phase !== current.phase);
5
4
  }
@@ -3,10 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { theme } from '../theme.js';
4
4
  import { RESULTS_COPY as C, chartSummary, contentChangeTitle } from '../copy/results.js';
5
5
  import { chartModel } from './chart.model.js';
6
- import { formatDate } from '../format/date.js';
6
+ import { useDateFormatter } from '../format/useDateFormatter.js';
7
7
  import { formatPercent } from './format.js';
8
8
  import { seriesColor } from './DataTable.js';
9
9
  export function CiChart({ series, metricId, metricName, phase, contentChanges }) {
10
+ const formatDate = useDateFormatter();
10
11
  const model = chartModel({
11
12
  series,
12
13
  metricId,
@@ -10,7 +10,7 @@ export declare const seriesColor: (key: string) => "var(--xp-series-a)" | "var(-
10
10
  export declare function Swatch({ arm }: {
11
11
  arm: string;
12
12
  }): import("react").JSX.Element;
13
- export declare function DataTable({ rows, caption, metricKind, leader, primary }: DataTableProps & {
13
+ export declare function DataTable({ rows, caption, method, metricKind, leader, primary }: DataTableProps & {
14
14
  leader?: string | null;
15
15
  primary?: boolean;
16
16
  }): import("react").JSX.Element;
@@ -18,7 +18,8 @@ function updateScrollCues(wrap) {
18
18
  wrap.parentElement?.classList.toggle('has-left', wrap.scrollLeft > 0);
19
19
  wrap.parentElement?.classList.toggle('has-right', wrap.scrollLeft + wrap.clientWidth < wrap.scrollWidth - 1);
20
20
  }
21
- export function DataTable({ rows, caption, metricKind, leader, primary = false }) {
21
+ export function DataTable({ rows, caption, method, metricKind, leader, primary = false }) {
22
+ const showChance = primary && method === 'bayesian' && rows.some((row)=>!row.baseline && row.chanceToWin != null);
22
23
  const scrollRef = useRef(null);
23
24
  useEffect(()=>{
24
25
  const wrap = scrollRef.current;
@@ -83,7 +84,7 @@ export function DataTable({ rows, caption, metricKind, leader, primary = false }
83
84
  className: "num",
84
85
  children: C.ci
85
86
  }),
86
- primary ? /*#__PURE__*/ _jsx("th", {
87
+ showChance ? /*#__PURE__*/ _jsx("th", {
87
88
  scope: "col",
88
89
  className: "num",
89
90
  children: C.chanceToWin
@@ -138,7 +139,7 @@ export function DataTable({ rows, caption, metricKind, leader, primary = false }
138
139
  className: `num${row.baseline ? ' muted' : ''}`,
139
140
  children: row.baseline ? '—' : row.comparison?.method === 'sequential' ? row.comparison.adjustedCI ?? row.comparison.ci : row.comparison?.ci ?? '—'
140
141
  }),
141
- primary ? /*#__PURE__*/ _jsx("td", {
142
+ showChance ? /*#__PURE__*/ _jsx("td", {
142
143
  className: "num",
143
144
  children: row.baseline ? '—' : row.chanceToWin ?? '—'
144
145
  }) : null
@@ -7,7 +7,7 @@ export interface VerdictHeroProps {
7
7
  collecting?: string | null;
8
8
  sinceShipping?: string | null;
9
9
  meta?: ReactNode;
10
- recommendation?: string;
10
+ recommendation?: string | null;
11
11
  browserWritablePrimary?: boolean;
12
12
  }
13
13
  import './results.css';
@@ -9,8 +9,3 @@ export declare function legacyRolloutLine(snapshot: LegacySnapshot, phase: Phase
9
9
  export declare function legacyMinimum(snapshot: LegacySnapshot, ctx: ResultsContext): number | undefined;
10
10
  /** Stands in for CORE-15a minExposuresPerArm by deriving the old notice from the frozen verdict. */
11
11
  export declare function legacyTooFew(snapshot: LegacySnapshot): boolean;
12
- /** Stands in for CORE-15a winnerArm in rollout recommendations using the old recommended arm and label. */
13
- export declare function legacyRecommendationWinner(snapshot: LegacySnapshot, phase?: PhaseSummary): {
14
- key: string | null;
15
- label: string;
16
- };
@@ -11,17 +11,3 @@ import { armLabel } from '../labels.js';
11
11
  /** Stands in for CORE-15a minExposuresPerArm by deriving the old notice from the frozen verdict. */ export function legacyTooFew(snapshot) {
12
12
  return snapshot.verdict.code === 'collecting' || snapshot.verdict.code === 'rollout-collecting';
13
13
  }
14
- /** Stands in for CORE-15a winnerArm in rollout recommendations using the old recommended arm and label. */ export function legacyRecommendationWinner(snapshot, phase) {
15
- const key = snapshot.winnerArm ?? snapshot.verdict.recommendedArm;
16
- const stored = phase?.arms.find((arm)=>arm.key === key)?.label.trim();
17
- return {
18
- key,
19
- label: stored || (key && [
20
- 'control',
21
- 'variantA',
22
- 'variantB',
23
- 'variantC',
24
- 'holdout'
25
- ].includes(key) ? armLabel(key) : RESULTS_COPY.shippedGroup)
26
- };
27
- }
@@ -8,7 +8,7 @@
8
8
  :where(.xp-test-surface) .xp-round-meta .xp-ui-field { display: flex; align-items: center; gap: var(--xp-space-2); margin: 0; min-width: 0; }
9
9
  :where(.xp-test-surface) .xp-round-meta .xp-ui-combobox-wrap { width: auto; max-width: 100%; }
10
10
  :where(.xp-test-surface) .xp-results-chips { display: flex; flex-wrap: wrap; gap: var(--xp-space-2); list-style: none; padding: 0; margin-bottom: 0; }
11
- :where(.xp-test-surface) .xp-stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); overflow: hidden; }
11
+ :where(.xp-test-surface) .xp-stat-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); overflow: hidden; }
12
12
  :where(.xp-test-surface) .xp-stat-tile { padding: 20px; min-width: 0; }
13
13
  :where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 1px solid var(--xp-border); }
14
14
  :where(.xp-test-surface) .xp-stat-tile-label, :where(.xp-test-surface) .xp-stat-tile-detail { font: var(--xp-text-small); color: var(--xp-text-2); }
@@ -56,7 +56,7 @@
56
56
  :where(.xp-test-surface) .xp-preview-links { display: grid; gap: 12px; }
57
57
  :where(.xp-test-surface) .xp-preview-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--xp-border); padding-bottom: 12px; }
58
58
  @media (max-width: 720px) {
59
- :where(.xp-test-surface) .xp-stat-tiles { grid-template-columns: minmax(0, 1fr); }
59
+ :where(.xp-test-surface) .xp-stat-tiles { grid-auto-flow: row; }
60
60
  :where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 0; border-top: 1px solid var(--xp-border); }
61
61
  :where(.xp-test-surface) .xp-verdict-hero { padding: 20px; }
62
62
  :where(.xp-test-surface) .xp-verdict-hero h2 { font-size: 24px; line-height: 30px; }
@@ -1,6 +1,8 @@
1
1
  import type { DocId, Status } from '../../types/contracts.js';
2
2
  import type { PhaseSummary, ResultsResponse } from '../../types/endpoints.js';
3
3
  import type { Snapshot } from '../../types/snapshot.js';
4
+ import type { DateFormatter } from '../format/date.js';
5
+ import type { roundProgress } from '../format/roundProgress.js';
4
6
  import { type DisplaySnapshot } from './snapshot.js';
5
7
  import type { PlacementLabel } from '../placements/placementLabels.model.js';
6
8
  type Metric = Snapshot['metrics'][number];
@@ -26,11 +28,13 @@ export type VerdictCardModel = {
26
28
  detail: string;
27
29
  guardrailLine?: string;
28
30
  };
29
- export declare function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel }: {
31
+ export declare function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel, controlLabel, keepRunningAction }: {
32
+ controlLabel?: string;
30
33
  snapshot: DisplaySnapshot;
31
34
  decisionSnapshot?: DisplaySnapshot;
32
35
  isDecidedTestRound: boolean;
33
36
  winnerLabel: string;
37
+ keepRunningAction?: string | null;
34
38
  }): VerdictCardModel;
35
39
  export declare function rolloutLine(snapshot: DisplaySnapshot, phase: PhaseSummary, phases: PhaseSummary[], decision?: Pick<Decision, 'winnerArm'>): string | null;
36
40
  export interface CappedCellModel {
@@ -87,7 +91,8 @@ interface RoundLineInput {
87
91
  phaseKind: Snapshot['phaseKind'];
88
92
  status: Status;
89
93
  }
90
- export declare function powerLine({ snapshot, phaseKind, status }: RoundLineInput): string | null;
94
+ export declare function runningPlanLine(snapshot: DisplaySnapshot, progress: ReturnType<typeof roundProgress>, formatDate: DateFormatter): string;
95
+ export declare function powerLine({ snapshot, phaseKind, status }: RoundLineInput, planned: string | null): string | null;
91
96
  export interface ResultsContext {
92
97
  placementLabels?: Map<string, PlacementLabel>;
93
98
  status?: string;
@@ -108,5 +113,5 @@ export interface DataQualityItem {
108
113
  shares?: string[];
109
114
  }
110
115
  export declare function dataQuality(snapshot: DisplaySnapshot, ctx?: ResultsContext): DataQualityItem[];
111
- export declare function verdictLabel(snapshot: DisplaySnapshot): string;
116
+ export declare function verdictLabel(snapshot: DisplaySnapshot, controlLabel?: string): string;
112
117
  export {};
@@ -1,6 +1,7 @@
1
+ import { isLongDuration } from '../../results/verdict.js';
1
2
  import { READINESS_COPY, placementUncheckedCopy, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
2
3
  import { armLabel, phaseKindLabel, verdictCodeLabel } from '../labels.js';
3
- import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal } from '../copy/results.js';
4
+ import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, keepRunningTo, metricUnavailable, moreDays, pastPlannedEnd, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal, verdictControlCopy } from '../copy/results.js';
4
5
  import { formatCI, formatCount, formatMetric, formatPercent, formatProbability } from './format.js';
5
6
  import { legacyMinimum, legacyRolloutLine, legacyTooFew } from './legacy.js';
6
7
  import { isLegacySnapshot } from './snapshot.js';
@@ -15,16 +16,21 @@ export function roundOptions(phases) {
15
16
  label: roundLabel(phase.phase, phaseKindLabel(phase.phaseKind))
16
17
  }));
17
18
  }
18
- export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel }) {
19
+ export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel, controlLabel, keepRunningAction }) {
20
+ const copy = (text)=>controlLabel ? verdictControlCopy(text, controlLabel) : text;
19
21
  if (isDecidedTestRound) return {
20
22
  title: decidedTitle(winnerLabel),
21
- finding: decisionSnapshot?.verdict.finding ?? null,
22
- detail: decisionSnapshot?.verdict.detail ?? null
23
+ finding: decisionSnapshot ? copy(decisionSnapshot.verdict.finding) : null,
24
+ detail: decisionSnapshot ? copy(decisionSnapshot.verdict.detail) : null
23
25
  };
24
- const { headline, detail, guardrailLine } = snapshot.verdict;
26
+ const { code, finding, detail, guardrailLine } = snapshot.verdict;
27
+ const headline = code === 'keep-running' && !isLongDuration(snapshot.power) && keepRunningAction !== undefined ? [
28
+ finding,
29
+ keepRunningAction
30
+ ].filter(Boolean).join(' ') : snapshot.verdict.headline;
25
31
  return {
26
- headline,
27
- detail,
32
+ headline: copy(headline),
33
+ detail: copy(detail),
28
34
  ...guardrailLine === undefined ? {} : {
29
35
  guardrailLine
30
36
  }
@@ -76,12 +82,12 @@ export function armRows({ snapshot, phase, metricId }) {
76
82
  };
77
83
  if (group.kind === 'control' && snapshot.phaseKind === 'test') return {
78
84
  ...row,
79
- baseline: RESULTS_COPY.original
85
+ baseline: group.label
80
86
  };
81
87
  const comparison = metric?.comparisons.find((comparison)=>comparison.arm === group.key);
82
88
  if (!comparison) return row;
83
89
  row.lift = formatPercent(comparison.lift, true);
84
- row.chanceToWin = snapshot.method === 'bayesian' ? formatPercent(comparison.chanceToWin) : '—';
90
+ if (snapshot.method === 'bayesian' && Number.isFinite(comparison.chanceToWin)) row.chanceToWin = formatPercent(comparison.chanceToWin);
85
91
  const common = {
86
92
  ci: formatCI(comparison.ci),
87
93
  significance: RESULTS_COPY.significance[comparison.significant]
@@ -112,11 +118,15 @@ export function guardrailChips(snapshot) {
112
118
  status: RESULTS_COPY.guardrails[guardrail.status]
113
119
  }));
114
120
  }
115
- export function powerLine({ snapshot, phaseKind, status }) {
121
+ export function runningPlanLine(snapshot, progress, formatDate) {
122
+ const date = progress.end === null ? null : formatDate(progress.end);
123
+ const planned = date === null ? RESULTS_COPY.plannedEnd : progress.daysToGo === 0 ? pastPlannedEnd(date) : keepRunningTo(date);
124
+ const days = snapshot.power.daysRemaining;
125
+ return days !== null && progress.daysToGo !== null && days > progress.daysToGo ? `${planned} ${moreDays(formatCount(Math.ceil(days)))}` : planned;
126
+ }
127
+ export function powerLine({ snapshot, phaseKind, status }, planned) {
116
128
  if (phaseKind !== 'test' || status !== 'running' || snapshot.verdict.code !== 'collecting') return null;
117
- const { power } = snapshot;
118
- if (power.feasible === false || power.daysRemaining !== null && power.daysRemaining > 90) return RESULTS_COPY.infeasible;
119
- return power.daysRemaining !== null && power.daysRemaining >= 1 ? moreDays(formatCount(Math.ceil(power.daysRemaining))) : RESULTS_COPY.plannedEnd;
129
+ return isLongDuration(snapshot.power) ? RESULTS_COPY.infeasible : planned;
120
130
  }
121
131
  function comparedKeys(snapshot, phase) {
122
132
  return phase ? phase.arms.filter((arm)=>arm.kind !== 'holdout' || snapshot.phaseKind === 'rollout').map((arm)=>arm.key) : Object.keys(snapshot.exposures.perArm).filter((key)=>key !== 'holdout' || snapshot.phaseKind === 'rollout');
@@ -144,12 +154,6 @@ export function dataQuality(snapshot, ctx = {}) {
144
154
  } : {},
145
155
  nextStep: item.code === 'placement-unchecked' ? `Open ${ctx.placementLabels?.get(placementDetailKey(item.detail))?.title ?? item.detail.path ?? 'the page'}` : item.code === 'goal-in-some-versions' ? 'Edit the versions' : item.code === 'version-page-unavailable' ? versionPageUnavailableCopy(item.path, ctx.status) : versionPageUncheckedCopy(item.path, ctx.status)
146
156
  });
147
- // Test snapshots store null by design; only rollout snapshots record the shipped winner.
148
- if (!isLegacySnapshot(snapshot) && snapshot.phaseKind === 'rollout' && snapshot.winnerArm === null) items.push({
149
- id: 'missing-winner',
150
- message: RESULTS_COPY.missingWinner,
151
- nextStep: RESULTS_COPY.missingWinnerNext
152
- });
153
157
  const srmTotal = Object.keys(snapshot.srm.expected).reduce((total, key)=>total + (snapshot.exposures.perArm[key] ?? 0), 0);
154
158
  if (snapshot.srm.flagged) items.push({
155
159
  id: 'srm',
@@ -194,6 +198,6 @@ export function dataQuality(snapshot, ctx = {}) {
194
198
  });
195
199
  return items;
196
200
  }
197
- export function verdictLabel(snapshot) {
198
- return verdictCodeLabel(snapshot.verdict.code);
201
+ export function verdictLabel(snapshot, controlLabel) {
202
+ return verdictCodeLabel(snapshot.verdict.code, controlLabel);
199
203
  }
@@ -11,4 +11,6 @@ export type LegacySnapshot = Omit<Snapshot, keyof Core15aFields> & ({
11
11
  export type DisplaySnapshot = Snapshot | LegacySnapshot;
12
12
  /** A stored null winner is current data; only missing CORE-15a fields mark history. */
13
13
  export declare function isLegacySnapshot(snapshot: DisplaySnapshot): snapshot is LegacySnapshot;
14
+ /** Test snapshots store null by design; current rollouts record the shipped winner. */
15
+ export declare function hasMissingRolloutWinner(snapshot: DisplaySnapshot): boolean;
14
16
  export {};
@@ -1,3 +1,6 @@
1
1
  /** A stored null winner is current data; only missing CORE-15a fields mark history. */ export function isLegacySnapshot(snapshot) {
2
2
  return snapshot.winnerArm === undefined || snapshot.minExposuresPerArm === undefined;
3
3
  }
4
+ /** Test snapshots store null by design; current rollouts record the shipped winner. */ export function hasMissingRolloutWinner(snapshot) {
5
+ return !isLegacySnapshot(snapshot) && snapshot.phaseKind === 'rollout' && snapshot.winnerArm === null;
6
+ }
@@ -12,13 +12,18 @@ type FieldLifecycle = Pick<DocumentApi, 'mountDraft' | 'submitDraft' | 'syncDocu
12
12
  export type TestDocApi = Omit<DocumentApi, keyof FieldLifecycle> & Partial<FieldLifecycle>;
13
13
  /** Quick actions have a document reader and transition handlers, with no field editor. */
14
14
  export type ActionTestApi = Omit<TestDocApi, 'stage' | 'commit' | 'choosePage' | 'chosenPages' | 'mountDraft' | 'submitDraft' | 'trackDraft' | 'syncDocument'>;
15
+ export type BlockVersionContent = Partial<Record<ArmSlot, 'filled' | 'partial' | 'empty'>>;
15
16
  /** Serialisable props the server root view passes to the surface (ADM-20). */
16
17
  export interface SurfaceProps {
17
18
  /** Present only when configuring a block from its page editor. */
18
19
  editorPage?: {
19
20
  collection: string;
20
21
  id: string;
21
- versionContent?: Partial<Record<ArmSlot, 'filled' | 'partial' | 'empty'>>;
22
+ versionContent?: BlockVersionContent;
23
+ } | {
24
+ collection?: never;
25
+ id?: never;
26
+ versionContent: BlockVersionContent;
22
27
  };
23
28
  editorPlacementMessage?: string;
24
29
  adminRoute: string;
@@ -10,7 +10,7 @@ export declare function editorPlacementMessage(placements: PreflightResult['plac
10
10
  export declare function editorPreflight(answer: PreflightResult | null, surface: SurfaceProps, includeLocalBlocker?: boolean): PreflightResult | null;
11
11
  /** Shared sidebar policy; the bounded list renders these steps verbatim. */
12
12
  export declare function sidebarReadinessBlockers(test: ActionTestApi, surface: SurfaceProps): ({
13
- arm?: import("../../types/contracts.js").ArmKey | undefined;
13
+ arm?: import("../../types/armKey.js").ArmKey | undefined;
14
14
  section: "header" | import("./contracts.js").SectionId;
15
15
  sentence: string;
16
16
  code: import("../../transitions/checkStart.js").ReadinessCode;
@@ -24,7 +24,7 @@ export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from
24
24
  });
25
25
  }
26
26
  /** Editor context is a hint for guidance only; Start still runs server preflight. */ export function editorPlacementMessage(placements, page, status) {
27
- if (!page || !placements || !status || status === 'decided' || status === 'archived') return;
27
+ if (page?.id === undefined || !placements || !status || status === 'decided' || status === 'archived') return;
28
28
  const here = placements.filter((p)=>p.collection === page.collection && String(p.id) === String(page.id));
29
29
  if (!here.length) return status === 'running' ? RUNNING_SAVE_PAGE : SAVE_PAGE;
30
30
  if (!here.some((p)=>p.detail === 'Published')) return status === 'running' ? RUNNING_PUBLISH_PAGE : PUBLISH_PAGE;
@@ -1,7 +1,7 @@
1
1
  import { TEST_PAGE as C } from '../../copy/testPage.js';
2
2
  import { placementLabel } from '../../placementLabel.js';
3
3
  export function placementLine(placement) {
4
- return `${C.onPage} ${placementLabel(placement, true)}`;
4
+ return `${C.onPage} ${placementLabel(placement, false)}`;
5
5
  }
6
6
  export function slotReady(placement, arm) {
7
7
  const slot = arm.kind === 'holdout' ? 'control' : arm.key;
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Banner } from '../../../ui/Banner.js';
4
+ import { holdoutContent } from '../../copy/audience.js';
5
+ import { actionGroupLabel } from '../../actions/actions.model.js';
4
6
  import { Button } from '../../../ui/Button.js';
5
7
  import { placementPages } from '../../../lib/placementPages.js';
6
8
  import { TEST_PAGE as C, placementCount } from '../../copy/testPage.js';
@@ -22,14 +24,21 @@ function Binding({ test, surface }) {
22
24
  ]
23
25
  }) : null : placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
24
26
  children: [
25
- pages.map((placement)=>/*#__PURE__*/ _jsxs("p", {
26
- className: "xp-ui-button-group",
27
+ pages.map((placement)=>/*#__PURE__*/ _jsxs("div", {
28
+ className: "xp-page-binding-row xp-ui-button-group",
27
29
  children: [
28
- placementLine(placement),
29
- placement.slotCount > 1 ? placementCount(placement.slotCount) : null,
30
- ' ',
30
+ /*#__PURE__*/ _jsxs("span", {
31
+ children: [
32
+ placementLine(placement),
33
+ placement.slotCount > 1 ? placementCount(placement.slotCount) : null
34
+ ]
35
+ }),
36
+ /*#__PURE__*/ _jsx("span", {
37
+ className: "xp-content-chip",
38
+ children: placement.detail === 'Published' ? C.published : C.draft
39
+ }),
31
40
  placement.editorUrl ? /*#__PURE__*/ _jsx(Button, {
32
- variant: "link",
41
+ variant: "secondary",
33
42
  size: "sm",
34
43
  href: placement.editorUrl,
35
44
  "aria-label": pages.length > 1 ? `${C.openPage}: ${placementLabel(placement, true)}` : undefined,
@@ -38,6 +47,7 @@ function Binding({ test, surface }) {
38
47
  ]
39
48
  }, placement.key)),
40
49
  /*#__PURE__*/ _jsx("p", {
50
+ className: "xp-ui-help",
41
51
  children: C.editedOnPage
42
52
  })
43
53
  ]
@@ -51,9 +61,11 @@ function VersionContent({ test, surface, armIndex, summary }) {
51
61
  if (!arm) return null;
52
62
  if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
53
63
  className: "xp-content-chip",
54
- children: C.holdoutContent
64
+ children: holdoutContent(actionGroupLabel('control', test.doc?.arms.find((arm)=>arm.key === 'control')?.label))
55
65
  });
56
- const placements = test.preflight?.placements ?? [];
66
+ const live = summary && arm.key !== 'holdout' ? surface.editorPage?.versionContent?.[arm.key] : undefined;
67
+ if (summary && !live) return null;
68
+ const placements = summary ? [] : test.preflight?.placements ?? [];
57
69
  const pages = placementPages(placements);
58
70
  const localized = pages.some((page)=>page.allLocales || page.locales?.length);
59
71
  const editPages = new Map();
@@ -64,17 +76,18 @@ function VersionContent({ test, surface, armIndex, summary }) {
64
76
  group.push(page);
65
77
  editPages.set(key, group);
66
78
  }
67
- const ready = placements.length > 0 && placements.every((placement)=>slotReady(placement, arm));
79
+ const ready = live ? live === 'filled' : placements.length > 0 && placements.every((placement)=>slotReady(placement, arm));
80
+ const label = live === 'partial' ? C.partialSlotContent : ready ? C.ready : C.empty;
68
81
  return /*#__PURE__*/ _jsxs("div", {
69
82
  className: "xp-version-content",
70
83
  children: [
71
84
  /*#__PURE__*/ _jsx("span", {
72
85
  className: `xp-content-chip ${ready ? 'xp-content-ready' : 'xp-content-empty'}`,
73
- children: ready ? C.ready : C.empty
86
+ children: label
74
87
  }),
75
88
  /*#__PURE__*/ _jsx("div", {
76
89
  className: "xp-ui-button-group",
77
- children: !summary ? [
90
+ children: [
78
91
  ...editPages.values()
79
92
  ].map((group)=>{
80
93
  const page = group[0];
@@ -86,7 +99,7 @@ function VersionContent({ test, surface, armIndex, summary }) {
86
99
  "aria-label": localized ? label : pages.length > 1 ? `${C.editOnPage}: ${page.title}` : undefined,
87
100
  children: label
88
101
  }, page.key);
89
- }) : null
102
+ })
90
103
  })
91
104
  ]
92
105
  });
@@ -1,6 +1,13 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { Arm } from '../../../types/contracts.js';
3
+ import type { SurfaceProps, TestDocApi } from '../contracts.js';
2
4
  import type { PageCollection } from './pagePicker.model.js';
3
- export declare function CopyRoute({ collection, children }: {
5
+ import './pagePicker.css';
6
+ export declare function CopyRoute({ collection, arm, test, surface, children, onBusy }: {
4
7
  collection: PageCollection;
8
+ arm: Arm;
9
+ test: TestDocApi;
10
+ surface: SurfaceProps;
5
11
  children?: ReactNode;
12
+ onBusy?: (busy: boolean) => void;
6
13
  }): import("react").JSX.Element;