@delmaredigital/payload-experiments 0.4.0-rc.9 → 0.4.1

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 +3 -7
  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,5 +1,4 @@
1
1
  export declare const RESULTS_COPY: {
2
- readonly chooseGroup: "Choose a group";
3
2
  readonly tests: "Tests";
4
3
  readonly results: "Results";
5
4
  readonly test: "Test";
@@ -39,7 +38,6 @@ export declare const RESULTS_COPY: {
39
38
  readonly chanceToWin: "Chance to win";
40
39
  readonly risk: "Risk";
41
40
  readonly comparison: "Comparison";
42
- readonly original: "Original";
43
41
  readonly holdout: "Measured, not compared";
44
42
  readonly holdoutBaseline: "Holdout · baseline";
45
43
  readonly shippedGroup: "the winner";
@@ -59,7 +57,7 @@ export declare const RESULTS_COPY: {
59
57
  readonly noCap: "Not capped: fewer than 20 people had this outcome in the 90 days before Start, so every value counts in full.";
60
58
  readonly quality: "Data quality";
61
59
  readonly missingWinner: "The stored winner is missing from this round's results.";
62
- readonly missingWinnerNext: "Recompute; if it persists, contact a developer before trusting these results.";
60
+ readonly missingWinnerNext: "Refresh results. If the problem continues, contact a developer before trusting these results.";
63
61
  readonly srm: "Traffic isn't splitting as set. Caching, a page placed twice, or automated traffic could affect the split.";
64
62
  readonly srmAction: "Don't trust these results. Ask a developer to check for caching, a page placed twice, or automated traffic.";
65
63
  readonly multiGroup: "People who saw more than one group were excluded.";
@@ -73,7 +71,7 @@ export declare const RESULTS_COPY: {
73
71
  readonly tooFew: "Too few people have seen the compared groups.";
74
72
  readonly tooFewNext: "Keep collecting results until each compared group reaches the planned minimum.";
75
73
  readonly layerFull: "The layer has fewer slices reserved than the requested allocation.";
76
- readonly layerNext: "Free slices in the layer, then use \"Let more people in\".";
74
+ readonly layerNext: "Free up room in the layer to include more people.";
77
75
  readonly unavailable: {
78
76
  'source-failed': string;
79
77
  'source-unavailable': string;
@@ -84,7 +82,7 @@ export declare const RESULTS_COPY: {
84
82
  'not-supplied': string;
85
83
  'analysis-failed': string;
86
84
  };
87
- readonly unavailableNext: "Recompute; if it persists, contact a developer.";
85
+ readonly unavailableNext: "Refresh results. If the problem continues, contact a developer.";
88
86
  readonly loading: "Loading results…";
89
87
  readonly refreshing: "Refreshing…";
90
88
  readonly retryPreview: "Retry preview links";
@@ -92,11 +90,13 @@ export declare const RESULTS_COPY: {
92
90
  readonly empty: "No results yet — the first results appear within the hour after Start.";
93
91
  readonly retry: "Retry";
94
92
  readonly round: "Round";
95
- readonly recompute: "Recompute";
96
- readonly recomputing: "Recomputing…";
97
- readonly primary: "Primary outcome";
98
- readonly secondary: "Supporting (not used for the decision)";
99
- readonly guardrail: "Guardrails";
93
+ readonly recompute: "Refresh results";
94
+ readonly recomputing: "Refreshing…";
95
+ readonly updated: (time: string) => string;
96
+ readonly previousRound: "Choose the latest test round to decide.";
97
+ readonly primary: "Main goal";
98
+ readonly secondary: "Also tracked (not used for the decision)";
99
+ readonly guardrail: "Must not get worse";
100
100
  readonly chart: "Confidence interval over time";
101
101
  readonly noHistory: "Not enough history yet.";
102
102
  };
@@ -104,10 +104,14 @@ export declare const pagesReleasedCopy: (date: string, name?: string) => string;
104
104
  export declare const roundLabel: (round: number, kind: string) => string;
105
105
  export declare const decidedTitle: (winner: string) => string;
106
106
  export declare const shippingTitle: (winner: string) => string;
107
+ export declare const keepRunningTo: (date: string) => string;
108
+ export declare const pastPlannedEnd: (date: string) => string;
107
109
  export declare const moreDays: (days: string) => string;
108
110
  export declare const collectingCopy: (n: string, minimum: string, conversions: string, conversionMinimum: string) => string;
109
111
  export declare const uncappedTotal: (total: string) => string;
110
112
  export declare const cappedCount: (count: string, cap: string) => string;
113
+ export declare const revenueCapHelp: (threshold: string) => string;
114
+ export declare const percentileCapHelp: (tail: number) => string;
111
115
  export declare const atLeast: (bound: string) => string;
112
116
  export declare const atMost: (bound: string) => string;
113
117
  export declare const intervalCopy: (low: string, high: string) => string;
@@ -120,3 +124,5 @@ export declare const metricUnavailable: (name: string, reason: string) => string
120
124
  export declare const chartSummary: (metric: string, groups: string, from: string, to: string, changes?: string[]) => string;
121
125
  export declare const contentChangeTitle: (date: string) => string;
122
126
  export declare const daysOfPlan: (days: string, planned: string) => string;
127
+ /** Use the frozen control label in the fixed wording stored by older verdict writers. */
128
+ export declare function verdictControlCopy(sentence: string, control: string): string;
@@ -1,5 +1,5 @@
1
+ import { GOAL_ROLES } from './metrics.js';
1
2
  export const RESULTS_COPY = {
2
- chooseGroup: 'Choose a group',
3
3
  tests: 'Tests',
4
4
  results: 'Results',
5
5
  test: 'Test',
@@ -39,7 +39,6 @@ export const RESULTS_COPY = {
39
39
  chanceToWin: 'Chance to win',
40
40
  risk: 'Risk',
41
41
  comparison: 'Comparison',
42
- original: 'Original',
43
42
  holdout: 'Measured, not compared',
44
43
  holdoutBaseline: 'Holdout · baseline',
45
44
  shippedGroup: 'the winner',
@@ -59,7 +58,7 @@ export const RESULTS_COPY = {
59
58
  noCap: 'Not capped: fewer than 20 people had this outcome in the 90 days before Start, so every value counts in full.',
60
59
  quality: 'Data quality',
61
60
  missingWinner: "The stored winner is missing from this round's results.",
62
- missingWinnerNext: 'Recompute; if it persists, contact a developer before trusting these results.',
61
+ missingWinnerNext: 'Refresh results. If the problem continues, contact a developer before trusting these results.',
63
62
  srm: "Traffic isn't splitting as set. Caching, a page placed twice, or automated traffic could affect the split.",
64
63
  srmAction: "Don't trust these results. Ask a developer to check for caching, a page placed twice, or automated traffic.",
65
64
  multiGroup: 'People who saw more than one group were excluded.',
@@ -73,7 +72,7 @@ export const RESULTS_COPY = {
73
72
  tooFew: 'Too few people have seen the compared groups.',
74
73
  tooFewNext: 'Keep collecting results until each compared group reaches the planned minimum.',
75
74
  layerFull: 'The layer has fewer slices reserved than the requested allocation.',
76
- layerNext: 'Free slices in the layer, then use "Let more people in".',
75
+ layerNext: 'Free up room in the layer to include more people.',
77
76
  unavailable: {
78
77
  'source-failed': "couldn't be read this time; the next results run will try again.",
79
78
  'source-unavailable': "can't be read because its data source is no longer available. Ask a developer to check this goal.",
@@ -84,7 +83,7 @@ export const RESULTS_COPY = {
84
83
  'not-supplied': "has no data for this results run; the next results run will try again.",
85
84
  'analysis-failed': "couldn't be calculated this time; the next results run will try again."
86
85
  },
87
- unavailableNext: 'Recompute; if it persists, contact a developer.',
86
+ unavailableNext: 'Refresh results. If the problem continues, contact a developer.',
88
87
  loading: 'Loading results…',
89
88
  refreshing: 'Refreshing…',
90
89
  retryPreview: 'Retry preview links',
@@ -92,11 +91,13 @@ export const RESULTS_COPY = {
92
91
  empty: 'No results yet — the first results appear within the hour after Start.',
93
92
  retry: 'Retry',
94
93
  round: 'Round',
95
- recompute: 'Recompute',
96
- recomputing: 'Recomputing…',
97
- primary: 'Primary outcome',
98
- secondary: 'Supporting (not used for the decision)',
99
- guardrail: 'Guardrails',
94
+ recompute: 'Refresh results',
95
+ recomputing: 'Refreshing…',
96
+ updated: (time)=>`Updated ${time}`,
97
+ previousRound: 'Choose the latest test round to decide.',
98
+ primary: GOAL_ROLES.primary,
99
+ secondary: `${GOAL_ROLES.secondary} (not used for the decision)`,
100
+ guardrail: GOAL_ROLES.guardrail,
100
101
  chart: 'Confidence interval over time',
101
102
  noHistory: 'Not enough history yet.'
102
103
  };
@@ -104,10 +105,14 @@ export const pagesReleasedCopy = (date, name)=>`Pages released ${date}${name ? `
104
105
  export const roundLabel = (round, kind)=>`Round ${round} · ${kind}`;
105
106
  export const decidedTitle = (winner)=>`Decided: ${winner}`;
106
107
  export const shippingTitle = (winner)=>`Since shipping ${winner}`;
107
- export const moreDays = (days)=>`About ${days} more ${days === '1' ? 'day' : 'days'}.`;
108
+ export const keepRunningTo = (date)=>`Keep running to the planned end (${date}).`;
109
+ export const pastPlannedEnd = (date)=>`The planned end was ${date}.`;
110
+ export const moreDays = (days)=>`At this traffic, a clear answer needs about ${days} more ${days === '1' ? 'day' : 'days'}.`;
108
111
  export const collectingCopy = (n, minimum, conversions, conversionMinimum)=>`${n} of ${minimum} people, ${conversions} of ${conversionMinimum} conversions`;
109
112
  export const uncappedTotal = (total)=>`Total ${total} (not capped)`;
110
113
  export const cappedCount = (count, cap)=>`${count} capped at ${cap}`;
114
+ export const revenueCapHelp = (threshold)=>`Amounts above ${threshold} are limited in the comparison. Totals include the full amounts.`;
115
+ export const percentileCapHelp = (tail)=>revenueCapHelp(tail === 0 ? 'the largest amount from the 90 days before the test' : `the cutoff for the largest ${tail}% of amounts from the 90 days before the test`);
111
116
  export const atLeast = (bound)=>`at least ${bound}`;
112
117
  export const atMost = (bound)=>`at most ${bound}`;
113
118
  export const intervalCopy = (low, high)=>`${low} to ${high}`;
@@ -123,3 +128,6 @@ export const chartSummary = (metric, groups, from, to, changes = [])=>`${metric}
123
128
  }).format(changes)}.` : ''}`;
124
129
  export const contentChangeTitle = (date)=>`Content changed ${date} by an editor`;
125
130
  export const daysOfPlan = (days, planned)=>`${days} of ${planned}`;
131
+ /** Use the frozen control label in the fixed wording stored by older verdict writers. */ export function verdictControlCopy(sentence, control) {
132
+ return sentence.replace(/^The Original is better\.(?= Decide for the Original\.$|$)/, ()=>`${control} is better.`).replace(/(^|\. )Decide for the Original(?=\.$| or restart without (?:it|them)\.$)/, (_, boundary)=>`${boundary}Decide for ${control}`).replace(/^((?:Both|All \d+ variants) beat )the Original;/, (_, lead)=>`${lead}${control};`).replace(/^(The main outcome improved compared with |This describes the shipped version compared with people still seeing )the Original\.$/, (_, lead)=>`${lead}${control}.`).replace(/(^|\. )((?:Smallest group so far|Fewest conversions so far): )Original,/g, (_, boundary, lead)=>`${boundary}${lead}${control},`);
133
+ }
@@ -1,17 +1,20 @@
1
1
  export declare const REVIEW_COPY: {
2
- readonly noBaseline: "No data yet for this metric.";
2
+ readonly noBaseline: "No data yet for this goal.";
3
3
  readonly preview: "Preview";
4
- readonly previewBlocked: "Your browser blocked the preview window. Allow pop-ups for this site, then try again.";
4
+ readonly previewBlocked: "Your browser blocked the preview window. Allow pop-ups for this site.";
5
5
  readonly placedTimes: (n: number) => string;
6
6
  readonly raise: "Raise allocation";
7
- readonly addMetric: "Add a metric";
7
+ readonly addMetric: "Add a goal";
8
8
  readonly allocationBody: "Raising allocation adds people; nobody already taking part changes group. Lowering needs a new round.";
9
9
  readonly allocationInvalid: "Enter a whole percentage higher than the current allocation and no more than 100.";
10
- readonly role: "Role";
11
- readonly supporting: "Supporting";
12
- readonly guardrail: "Guardrail";
13
- readonly metric: "Metric";
14
- readonly chooseMetric: "Choose a metric";
15
- readonly loadingMetrics: "Loading metrics…";
16
- readonly noMetrics: "All available goals are already on this test.";
10
+ readonly role: "How it counts";
11
+ readonly primary: "Main goal";
12
+ readonly supporting: "Also tracked";
13
+ readonly guardrail: "Must not get worse";
14
+ readonly metric: "Goal";
15
+ readonly chooseMetric: "Choose a goal";
16
+ readonly loadingMetrics: "Loading goals…";
17
+ readonly createGoal: "Create a goal";
18
+ readonly noMetrics: "There are no goals yet.";
19
+ readonly allMetricsAttached: "Every goal is already on this test.";
17
20
  };
@@ -1,17 +1,21 @@
1
+ import { GOAL_ROLES } from './metrics.js';
1
2
  export const REVIEW_COPY = {
2
- noBaseline: 'No data yet for this metric.',
3
+ noBaseline: 'No data yet for this goal.',
3
4
  preview: 'Preview',
4
- previewBlocked: 'Your browser blocked the preview window. Allow pop-ups for this site, then try again.',
5
+ previewBlocked: 'Your browser blocked the preview window. Allow pop-ups for this site.',
5
6
  placedTimes: (n)=>`(placed ${n} times on this page)`,
6
7
  raise: 'Raise allocation',
7
- addMetric: 'Add a metric',
8
+ addMetric: 'Add a goal',
8
9
  allocationBody: 'Raising allocation adds people; nobody already taking part changes group. Lowering needs a new round.',
9
10
  allocationInvalid: 'Enter a whole percentage higher than the current allocation and no more than 100.',
10
- role: 'Role',
11
- supporting: 'Supporting',
12
- guardrail: 'Guardrail',
13
- metric: 'Metric',
14
- chooseMetric: 'Choose a metric',
15
- loadingMetrics: 'Loading metrics…',
16
- noMetrics: 'All available goals are already on this test.'
11
+ role: 'How it counts',
12
+ primary: GOAL_ROLES.primary,
13
+ supporting: GOAL_ROLES.secondary,
14
+ guardrail: GOAL_ROLES.guardrail,
15
+ metric: 'Goal',
16
+ chooseMetric: 'Choose a goal',
17
+ loadingMetrics: 'Loading goals…',
18
+ createGoal: 'Create a goal',
19
+ noMetrics: 'There are no goals yet.',
20
+ allMetricsAttached: 'Every goal is already on this test.'
17
21
  };
@@ -3,8 +3,7 @@ export declare const SETTING_COPY: {
3
3
  readonly setValues: "Set values";
4
4
  readonly setting: "Setting";
5
5
  readonly choose: "Choose the setting first.";
6
- readonly current: "Current: {value}";
7
- readonly holdout: "Sees the Original.";
6
+ readonly current: "Current";
8
7
  readonly yes: "Yes";
9
8
  readonly no: "No";
10
9
  readonly empty: "Not set";
@@ -3,8 +3,7 @@ export const SETTING_COPY = {
3
3
  setValues: 'Set values',
4
4
  setting: 'Setting',
5
5
  choose: 'Choose the setting first.',
6
- current: 'Current: {value}',
7
- holdout: 'Sees the Original.',
6
+ current: 'Current',
8
7
  yes: 'Yes',
9
8
  no: 'No',
10
9
  empty: 'Not set',
@@ -18,7 +18,15 @@ export declare const SURFACE_COPY: {
18
18
  readonly retry: "Try again";
19
19
  readonly empty: "Create a test to learn what works.";
20
20
  readonly clear: "Clear";
21
- readonly groups: readonly ["Needs attention", "Running", "Ready to start", "Draft", "Decided", "Archived"];
21
+ readonly groups: {
22
+ readonly attention: "Needs attention";
23
+ readonly running: "Running";
24
+ readonly ready: "Ready to start";
25
+ readonly draft: "Draft";
26
+ readonly stopped: "Stopped";
27
+ readonly decided: "Decided";
28
+ readonly archived: "Archived";
29
+ };
22
30
  readonly kinds: {
23
31
  readonly block: "Page block";
24
32
  readonly flag: "Setting";
@@ -26,13 +34,14 @@ export declare const SURFACE_COPY: {
26
34
  readonly page: "Whole page";
27
35
  };
28
36
  readonly ready: "Ready to start";
37
+ readonly readyAgain: "Ready to start a new round";
29
38
  readonly next: "Review setup";
30
39
  readonly continue: "Continue setup";
31
40
  readonly results: "View results";
32
41
  readonly open: "Open";
33
42
  readonly health: {
34
43
  readonly red: "Needs attention";
35
- readonly amber: "Check data";
44
+ readonly amber: "Needs attention";
36
45
  readonly green: "On track";
37
46
  };
38
47
  readonly backToSetup: "Back to setup";
@@ -1,3 +1,4 @@
1
+ import { READINESS_COPY } from './readiness.js';
1
2
  export const SURFACE_COPY = {
2
3
  title: 'Tests',
3
4
  test: 'Test',
@@ -18,14 +19,15 @@ export const SURFACE_COPY = {
18
19
  retry: 'Try again',
19
20
  empty: 'Create a test to learn what works.',
20
21
  clear: 'Clear',
21
- groups: [
22
- 'Needs attention',
23
- 'Running',
24
- 'Ready to start',
25
- 'Draft',
26
- 'Decided',
27
- 'Archived'
28
- ],
22
+ groups: {
23
+ attention: READINESS_COPY.needsAttention,
24
+ running: 'Running',
25
+ ready: 'Ready to start',
26
+ draft: 'Draft',
27
+ stopped: 'Stopped',
28
+ decided: 'Decided',
29
+ archived: 'Archived'
30
+ },
29
31
  kinds: {
30
32
  block: 'Page block',
31
33
  flag: 'Setting',
@@ -33,19 +35,20 @@ export const SURFACE_COPY = {
33
35
  page: 'Whole page'
34
36
  },
35
37
  ready: 'Ready to start',
38
+ readyAgain: 'Ready to start a new round',
36
39
  next: 'Review setup',
37
40
  continue: 'Continue setup',
38
41
  results: 'View results',
39
42
  open: 'Open',
40
43
  health: {
41
- red: 'Needs attention',
42
- amber: 'Check data',
44
+ red: READINESS_COPY.needsAttention,
45
+ amber: READINESS_COPY.needsAttention,
43
46
  green: 'On track'
44
47
  },
45
48
  backToSetup: 'Back to setup'
46
49
  };
47
50
  export function runningLine(days, planned, people) {
48
- return `Running ${days} days of ${planned} · ${people} people so far`;
51
+ return `Day ${days} of ${planned} · ${people} people so far`;
49
52
  }
50
53
  export function decidedLine(date, winner) {
51
54
  return `Decided ${date}: ${winner}`;
@@ -50,9 +50,11 @@ export declare const TEST_PAGE: {
50
50
  };
51
51
  readonly hypothesis: "Why are you testing this? (optional)";
52
52
  readonly hypothesisPlaceholder: "We believe … will … because …";
53
- readonly notPlaced: "Not on a page yet. Open a page, add an Experiment block and choose this test.";
54
- readonly onPage: "On:";
55
- readonly openPage: "Open the page";
53
+ readonly notPlaced: "This test needs a block on a page. Add it to a Test block.";
54
+ readonly onPage: "Page:";
55
+ readonly openPage: "Open page";
56
+ readonly published: "Published";
57
+ readonly draft: "Draft";
56
58
  readonly editedOnPage: "Versions are edited on the page.";
57
59
  readonly editOnPage: "Edit on page";
58
60
  readonly empty: "Empty";
@@ -61,8 +63,9 @@ export declare const TEST_PAGE: {
61
63
  readonly ready: "Content ready";
62
64
  readonly emptySlot: "Nothing in this slot yet";
63
65
  readonly pageBinding: "Each version is a whole page at its own address.";
66
+ readonly partialSlotContent: "Some slots empty";
64
67
  readonly pageAddress: "Page address";
65
- readonly holdoutContent: "Sees the Original";
68
+ readonly valueColumn: "Value";
66
69
  readonly label: "Version label";
67
70
  readonly weight: "Share (%)";
68
71
  readonly balanceHelp: "Changing a share balances the other versions so the total stays at 100%.";
@@ -73,17 +76,18 @@ export declare const TEST_PAGE: {
73
76
  readonly invalidShare: "Use a whole number from 0 to 100.";
74
77
  readonly holdoutPrefix: "Holdout: ";
75
78
  readonly allocation: "How many people take part";
79
+ readonly everyoneMatches: "Everyone who matches the audience takes part.";
76
80
  readonly traffic: "How people are split";
77
81
  readonly otherGoals: "Other goals (optional)";
78
82
  readonly otherGoalsTitle: "Other goals";
79
83
  readonly dontTrack: "Don't track";
80
- readonly watch: "Watch";
84
+ readonly watch: "Also tracked";
81
85
  readonly mustNotWorsen: "Must not get worse";
82
- readonly otherGoalsHelp: "Watch: shown in results. Must not get worse: you're warned if a version makes it worse.";
83
- readonly goal: "Goal";
86
+ readonly otherGoalsHelp: "Also tracked goals appear in results. Choose Must not get worse to get a warning when a version hurts that goal.";
87
+ readonly goal: "Main goal";
84
88
  readonly goalHelp: "The one thing you want more of. It decides the winner.";
85
89
  readonly guardrailsShort: "Must not get worse";
86
- readonly secondaryShort: "Also keep an eye on";
90
+ readonly secondaryShort: "Also tracked";
87
91
  readonly manageGoals: "Manage goals";
88
92
  readonly chooseGoal: "Choose a goal";
89
93
  readonly goalsError: "Couldn't load goals. Try again.";
@@ -104,6 +108,7 @@ export declare const TEST_PAGE: {
104
108
  readonly reach: "About how many people will see this per day?";
105
109
  readonly reachHelp: "A rough number is fine. It only sets the suggested length.";
106
110
  readonly duration: "Planned length (days)";
111
+ readonly endDate: "Planned end date";
107
112
  readonly noSuggestion: "Enter a daily number above to get a suggestion. 4 weeks is a safe default.";
108
113
  readonly chooseGoalSuggestion: "Choose a goal to get a suggestion.";
109
114
  readonly required: "(required)";
@@ -127,7 +132,8 @@ export declare const DELETE_TEST: {
127
132
  readonly changedPages: (count: number) => string;
128
133
  readonly unreadablePages: (count: number, total: number) => string;
129
134
  readonly pageWinner: "These addresses will change where they send visitors:";
130
- readonly content: "Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.";
135
+ readonly content: "Deleting the test does not delete your page content. A Test block that used this test stays on its page and says the test was deleted.";
136
+ readonly runningSteps: readonly ["Stop the test.", "Archive the test."];
131
137
  readonly archiveFirst: "You can delete this test after it is archived.";
132
138
  readonly close: "Close";
133
139
  readonly labelWithCode: (label: string, code: string) => string;
@@ -137,7 +143,7 @@ export declare const DELETE_TEST: {
137
143
  readonly cancel: "Cancel";
138
144
  readonly deleted: "Test deleted.";
139
145
  readonly title: (name: string) => string;
140
- readonly consequences: "This permanently deletes the test and all its rounds and results.";
146
+ readonly consequences: "This permanently deletes the test and all its rounds and results. You can't undo this.";
141
147
  readonly alreadyDeleted: "This test was already deleted.";
142
148
  readonly checking: "Checking what visitors will see…";
143
149
  readonly checkFailed: "Couldn't check what visitors will see after deletion. You can still choose to delete this test.";
@@ -1,8 +1,6 @@
1
- import { ACTIONS_COPY } from './actions.js';
1
+ import { GOAL_ROLES } from './metrics.js';
2
2
  import { API_MESSAGES } from './common.js';
3
3
  import { PLACEMENT_LANGUAGES } from './languages.js';
4
- const guardrailsShort = 'Must not get worse';
5
- const secondaryShort = 'Also keep an eye on';
6
4
  export const TEST_PAGE = {
7
5
  noAudienceRules: 'No audience choices are available here. Everyone eligible takes part; leave this section as it is.',
8
6
  editVersionsOnCanvas: 'Edit version content on the canvas.',
@@ -54,9 +52,11 @@ export const TEST_PAGE = {
54
52
  },
55
53
  hypothesis: 'Why are you testing this? (optional)',
56
54
  hypothesisPlaceholder: 'We believe … will … because …',
57
- notPlaced: 'Not on a page yet. Open a page, add an Experiment block and choose this test.',
58
- onPage: 'On:',
59
- openPage: 'Open the page',
55
+ notPlaced: 'This test needs a block on a page. Add it to a Test block.',
56
+ onPage: 'Page:',
57
+ openPage: 'Open page',
58
+ published: 'Published',
59
+ draft: 'Draft',
60
60
  editedOnPage: 'Versions are edited on the page.',
61
61
  editOnPage: 'Edit on page',
62
62
  empty: 'Empty',
@@ -65,8 +65,9 @@ export const TEST_PAGE = {
65
65
  ready: 'Content ready',
66
66
  emptySlot: 'Nothing in this slot yet',
67
67
  pageBinding: 'Each version is a whole page at its own address.',
68
+ partialSlotContent: 'Some slots empty',
68
69
  pageAddress: 'Page address',
69
- holdoutContent: 'Sees the Original',
70
+ valueColumn: 'Value',
70
71
  label: 'Version label',
71
72
  weight: 'Share (%)',
72
73
  balanceHelp: 'Changing a share balances the other versions so the total stays at 100%.',
@@ -77,17 +78,18 @@ export const TEST_PAGE = {
77
78
  invalidShare: 'Use a whole number from 0 to 100.',
78
79
  holdoutPrefix: 'Holdout: ',
79
80
  allocation: 'How many people take part',
81
+ everyoneMatches: 'Everyone who matches the audience takes part.',
80
82
  traffic: 'How people are split',
81
83
  otherGoals: 'Other goals (optional)',
82
84
  otherGoalsTitle: 'Other goals',
83
85
  dontTrack: "Don't track",
84
- watch: 'Watch',
85
- mustNotWorsen: 'Must not get worse',
86
- otherGoalsHelp: "Watch: shown in results. Must not get worse: you're warned if a version makes it worse.",
87
- goal: 'Goal',
86
+ watch: GOAL_ROLES.secondary,
87
+ mustNotWorsen: GOAL_ROLES.guardrail,
88
+ otherGoalsHelp: "Also tracked goals appear in results. Choose Must not get worse to get a warning when a version hurts that goal.",
89
+ goal: GOAL_ROLES.primary,
88
90
  goalHelp: 'The one thing you want more of. It decides the winner.',
89
- guardrailsShort,
90
- secondaryShort,
91
+ guardrailsShort: GOAL_ROLES.guardrail,
92
+ secondaryShort: GOAL_ROLES.secondary,
91
93
  manageGoals: 'Manage goals',
92
94
  chooseGoal: 'Choose a goal',
93
95
  goalsError: "Couldn't load goals. Try again.",
@@ -108,6 +110,7 @@ export const TEST_PAGE = {
108
110
  reach: 'About how many people will see this per day?',
109
111
  reachHelp: 'A rough number is fine. It only sets the suggested length.',
110
112
  duration: 'Planned length (days)',
113
+ endDate: 'Planned end date',
111
114
  noSuggestion: 'Enter a daily number above to get a suggestion. 4 weeks is a safe default.',
112
115
  chooseGoalSuggestion: 'Choose a goal to get a suggestion.',
113
116
  required: '(required)',
@@ -130,7 +133,7 @@ export const DELETE_TEST = {
130
133
  cancel: 'Cancel',
131
134
  deleted: 'Test deleted.',
132
135
  title: (name)=>`Delete “${name}”?`,
133
- consequences: 'This permanently deletes the test and all its rounds and results.',
136
+ consequences: "This permanently deletes the test and all its rounds and results. You can't undo this.",
134
137
  alreadyDeleted: 'This test was already deleted.',
135
138
  checking: 'Checking what visitors will see…',
136
139
  checkFailed: "Couldn't check what visitors will see after deletion. You can still choose to delete this test.",
@@ -143,20 +146,23 @@ export const DELETE_TEST = {
143
146
  changedPages: (count)=>`${count} ${count === 1 ? 'page' : 'pages'} will change`,
144
147
  unreadablePages: (count, total)=>total === 1 ? "You can't open this page." : count === total ? "You can't open any of these pages." : `You can't open ${count} of these pages.`,
145
148
  pageWinner: 'These addresses will change where they send visitors:',
146
- content: 'Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.',
149
+ content: 'Deleting the test does not delete your page content. A Test block that used this test stays on its page and says the test was deleted.',
150
+ runningSteps: [
151
+ 'Stop the test.',
152
+ 'Archive the test.'
153
+ ],
147
154
  archiveFirst: 'You can delete this test after it is archived.',
148
155
  close: 'Close'
149
156
  };
150
157
  export function deleteStatusCopy(status, kind) {
151
158
  switch(status){
152
159
  case 'running':
153
- return 'Stop the test, then archive it before deleting it.';
160
+ return DELETE_TEST.archiveFirst;
154
161
  case 'stopped':
155
162
  return DELETE_TEST.archiveFirst;
156
163
  case 'decided':
157
164
  if (!kind) return `${DELETE_TEST.archiveFirst} Open the test to see the available archive options.`;
158
- if (kind === 'code') return `${DELETE_TEST.archiveFirst} To archive it, choose the action that confirms the developer has put the winner in the code, or choose ${ACTIONS_COPY.discard}. Type the confirmation for either choice.`;
159
- return `${DELETE_TEST.archiveFirst} Choose ${ACTIONS_COPY.makeContent} to keep the winner, or choose ${ACTIONS_COPY.discard} and type the confirmation. If every entry in the content report is updated or dismissed, choose ${ACTIONS_COPY.finish}.`;
165
+ return `${DELETE_TEST.archiveFirst} Use the archive controls on the test.`;
160
166
  default:
161
167
  return API_MESSAGES.deleteInvalidStatus;
162
168
  }
@@ -1,2 +1,5 @@
1
- /** Shared calendar date for admin copy, chart axes and tooltips. */
2
- export declare function formatDate(value: unknown): string;
1
+ export type DateFormatter = (value: unknown) => string;
2
+ export declare function createDateFormatter(timeZone?: string): DateFormatter;
3
+ /** Calendar date in the current environment's time zone. */
4
+ export declare const formatDate: DateFormatter;
5
+ export declare function relativeTime(value: string, now?: number, formatFallback?: DateFormatter): string;
@@ -1,10 +1,26 @@
1
- const formatter = new Intl.DateTimeFormat('en-GB', {
2
- day: 'numeric',
3
- month: 'short',
4
- year: 'numeric',
5
- timeZone: 'UTC'
1
+ export function createDateFormatter(timeZone) {
2
+ const formatter = new Intl.DateTimeFormat('en-US', {
3
+ month: 'short',
4
+ day: 'numeric',
5
+ year: 'numeric',
6
+ ...timeZone === undefined ? {} : {
7
+ timeZone
8
+ }
9
+ });
10
+ return (value)=>{
11
+ const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : null;
12
+ return date && Number.isFinite(date.valueOf()) ? formatter.format(date) : '—';
13
+ };
14
+ }
15
+ /** Calendar date in the current environment's time zone. */ export const formatDate = createDateFormatter();
16
+ const relative = new Intl.RelativeTimeFormat('en', {
17
+ numeric: 'always'
6
18
  });
7
- /** Shared calendar date for admin copy, chart axes and tooltips. */ export function formatDate(value) {
8
- const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : null;
9
- return date && Number.isFinite(date.valueOf()) ? formatter.format(date) : '—';
19
+ export function relativeTime(value, now = Date.now(), formatFallback = formatDate) {
20
+ const minutes = Math.max(0, Math.floor((now - Date.parse(value)) / 60_000));
21
+ if (!Number.isFinite(minutes)) return formatFallback(value);
22
+ if (minutes === 0) return 'just now';
23
+ if (minutes < 60) return relative.format(-minutes, 'minute');
24
+ if (minutes < 1440) return relative.format(-Math.floor(minutes / 60), 'hour');
25
+ return relative.format(-Math.floor(minutes / 1440), 'day');
10
26
  }
@@ -0,0 +1,6 @@
1
+ export declare function roundProgress(startedAt: unknown, duration: number | null | undefined, now: number, fallbackElapsedDays?: number): {
2
+ day: number | null;
3
+ plannedDays: number | null;
4
+ end: number | null;
5
+ daysToGo: number | null;
6
+ };
@@ -0,0 +1,15 @@
1
+ const dayMs = 86_400_000;
2
+ export function roundProgress(startedAt, duration, now, fallbackElapsedDays) {
3
+ const start = typeof startedAt === 'string' ? Date.parse(startedAt) : NaN;
4
+ const plannedDays = duration != null && Number.isFinite(duration) && duration > 0 ? duration : null;
5
+ const elapsed = Number.isFinite(start) ? (now - start) / dayMs : fallbackElapsedDays;
6
+ // The first 24 hours are Day 1. Countdown includes the part of today still ahead.
7
+ const day = elapsed != null && Number.isFinite(elapsed) ? Math.max(1, Math.floor(elapsed) + 1) : null;
8
+ const end = plannedDays !== null && Number.isFinite(start) ? start + plannedDays * dayMs : null;
9
+ return {
10
+ day: day !== null && plannedDays !== null ? Math.min(day, plannedDays) : day,
11
+ plannedDays,
12
+ end,
13
+ daysToGo: end !== null && Number.isFinite(now) ? Math.max(0, Math.ceil((end - now) / dayMs)) : null
14
+ };
15
+ }
@@ -0,0 +1,3 @@
1
+ import { type DateFormatter } from './date.js';
2
+ /** Use the same dates during SSR and hydration, then read the browser's time zone. */
3
+ export declare function useDateFormatter(): DateFormatter;
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { useSyncExternalStore } from 'react';
3
+ import { createDateFormatter, formatDate } from './date.js';
4
+ const formatUtcDate = createDateFormatter('UTC');
5
+ const subscribe = ()=>()=>{};
6
+ /** Use the same dates during SSR and hydration, then read the browser's time zone. */ export function useDateFormatter() {
7
+ return useSyncExternalStore(subscribe, ()=>formatDate, ()=>formatUtcDate);
8
+ }
@@ -24,7 +24,6 @@ export declare const VERDICT_LABELS: {
24
24
  'data-problem': string;
25
25
  'guardrail-failing': string;
26
26
  collecting: string;
27
- 'original-better': string;
28
27
  'worse-none-better': string;
29
28
  winner: string;
30
29
  mixed: string;
@@ -36,5 +35,5 @@ export declare const VERDICT_LABELS: {
36
35
  export declare function armLabel(key: string, storedLabel?: string): string;
37
36
  export declare function statusLabel(status: Status): string;
38
37
  export declare function phaseKindLabel(kind: 'test' | 'rollout'): string;
39
- export declare function verdictCodeLabel(code: VerdictCode): string;
38
+ export declare function verdictCodeLabel(code: VerdictCode, controlLabel?: string): string;
40
39
  export declare function kindLabel(kind: ExperimentKind): string;