@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
@@ -0,0 +1,17 @@
1
+ import type { ActionTestApi, SurfaceProps } from '../surface/contracts.js';
2
+ import { type ExperimentAction } from './actions.model.js';
3
+ export declare function LifecycleButton({ action, reason, showReason, disabled, ariaDisabled, busy, onClick }: {
4
+ action: ExperimentAction;
5
+ reason?: string;
6
+ showReason?: boolean;
7
+ disabled?: boolean;
8
+ ariaDisabled?: boolean;
9
+ busy?: boolean;
10
+ onClick: () => void;
11
+ }): import("react").JSX.Element;
12
+ export declare function LifecycleDialog({ action, test, surface, onClose }: {
13
+ action: ExperimentAction;
14
+ test: ActionTestApi;
15
+ surface: SurfaceProps;
16
+ onClose: () => void;
17
+ }): import("react").JSX.Element;
@@ -0,0 +1,107 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from 'react';
4
+ import { Button } from '../../ui/Button.js';
5
+ import { AddMetricAction, AllocateAction, ConfirmAction } from '../surface/readiness/ActionDialogs.js';
6
+ import { ReleasePagesDialog } from '../surface/results/ReleasePages.js';
7
+ import { actionGroupLabel, availableActions } from './actions.model.js';
8
+ import { DecideDialog } from './DecideDialog.js';
9
+ export function LifecycleButton({ action, reason, showReason = true, disabled, ariaDisabled, busy, onClick }) {
10
+ const id = useId();
11
+ const help = showReason ? reason ?? action.hint : action.hint;
12
+ return /*#__PURE__*/ _jsxs("span", {
13
+ className: "xp-lifecycle-action",
14
+ children: [
15
+ /*#__PURE__*/ _jsx(Button, {
16
+ variant: action.tone === 'danger' ? 'danger' : action.tone === 'primary' ? 'primary' : 'secondary',
17
+ busy: busy,
18
+ disabled: disabled || !!reason,
19
+ "aria-disabled": ariaDisabled || undefined,
20
+ "aria-describedby": help ? id : undefined,
21
+ title: !showReason ? reason : undefined,
22
+ onClick: (event)=>{
23
+ if (ariaDisabled) return;
24
+ event.currentTarget.focus();
25
+ onClick();
26
+ },
27
+ children: action.label
28
+ }),
29
+ help ? /*#__PURE__*/ _jsx("span", {
30
+ className: "xp-ui-help",
31
+ id: id,
32
+ children: help
33
+ }) : null
34
+ ]
35
+ });
36
+ }
37
+ export function LifecycleDialog({ action, test, surface, onClose }) {
38
+ const [opened] = useState(test.doc);
39
+ const doc = test.doc ?? opened;
40
+ const decision = doc.decision;
41
+ const winner = actionGroupLabel(decision?.winnerArm ?? 'control', doc.arms.find((arm)=>arm.key === decision?.winnerArm)?.label);
42
+ const props = {
43
+ test,
44
+ surface,
45
+ onClose
46
+ };
47
+ const changed = !test.doc || doc.phase !== opened.phase || !availableActions({
48
+ ...doc,
49
+ decision,
50
+ canManage: surface.canManage,
51
+ canReadResults: surface.canReadResults
52
+ }).some((item)=>item.id === action.id);
53
+ if (action.id === 'decide') return /*#__PURE__*/ _jsx(DecideDialog, {
54
+ name: opened.name,
55
+ id: opened.id,
56
+ phase: opened.phase,
57
+ checks: test.preflight?.checks,
58
+ apiRoute: surface.apiRoute,
59
+ pending: test.statusReadPending,
60
+ unavailable: changed,
61
+ onClose: onClose,
62
+ onRefusal: ()=>{
63
+ void test.reload();
64
+ },
65
+ onSuccess: (result)=>{
66
+ test.acceptTransition?.({
67
+ doc: result
68
+ });
69
+ onClose();
70
+ void test.reload();
71
+ }
72
+ });
73
+ if (action.id === 'release-pages') return /*#__PURE__*/ _jsx(ReleasePagesDialog, {
74
+ name: opened.name,
75
+ id: opened.id,
76
+ phase: opened.phase,
77
+ apiRoute: surface.apiRoute,
78
+ disabled: test.statusReadPending || changed,
79
+ onClose: onClose,
80
+ onRefusal: (status)=>{
81
+ if ([
82
+ 401,
83
+ 403,
84
+ 404,
85
+ 409,
86
+ 422
87
+ ].includes(status)) void test.reload();
88
+ },
89
+ onSuccess: (doc)=>{
90
+ test.acceptTransition?.({
91
+ doc
92
+ });
93
+ void test.reload();
94
+ }
95
+ });
96
+ if (action.id === 'allocate') return /*#__PURE__*/ _jsx(AllocateAction, {
97
+ ...props
98
+ });
99
+ if (action.id === 'add-metric') return /*#__PURE__*/ _jsx(AddMetricAction, {
100
+ ...props
101
+ });
102
+ return /*#__PURE__*/ _jsx(ConfirmAction, {
103
+ ...props,
104
+ action: action,
105
+ winnerLabel: winner
106
+ });
107
+ }
@@ -145,7 +145,7 @@ export function MakeContentResult({ result, onRetry, busy = false, id, api, canM
145
145
  }) : null,
146
146
  editable && contentDone(docs) && onFinish ? /*#__PURE__*/ _jsx(Button, {
147
147
  "data-finish-archiving": true,
148
- variant: "primary",
148
+ variant: "danger",
149
149
  disabled: busy || pending,
150
150
  onClick: ()=>{
151
151
  void run(onFinish);
@@ -1,17 +1,18 @@
1
1
  import type { ExperimentKind, Status } from '../../types/contracts.js';
2
2
  import type { ArchiveBody, ContentReport } from '../../types/endpoints.js';
3
+ import { type PageReleaseDecision } from '../results/releasePages.model.js';
3
4
  export type ActionGroup = {
4
5
  key: string;
5
6
  label?: string;
6
7
  kind?: string;
7
8
  };
8
9
  export type { ContentReport } from '../../types/endpoints.js';
9
- export type ActionDecision = {
10
- winnerArm?: string | null;
10
+ export type ActionDecision = PageReleaseDecision & {
11
11
  holdoutReleasedAt?: string | null;
12
12
  contentReport?: ContentReport | null;
13
13
  };
14
- export type ActionId = 'start' | 'stop' | 'decide' | 'release-holdout' | 'make-content' | 'after-content' | 'archive' | 'discard' | 'hard-coded' | 'allocate' | 'add-metric';
14
+ export type ActionId = 'start' | 'stop' | 'decide' | 'release-holdout' | 'make-content' | 'after-content' | 'archive' | 'discard' | 'hard-coded' | 'allocate' | 'add-metric' | 'delete' | 'release-pages';
15
+ export declare function isDestructiveAction(id: ActionId): boolean;
15
16
  export type ExperimentAction = {
16
17
  id: ActionId;
17
18
  label: string;
@@ -19,17 +20,24 @@ export type ExperimentAction = {
19
20
  confirm: {
20
21
  title: string;
21
22
  body: string;
23
+ label?: string;
22
24
  phrase?: {
23
25
  action: 'discard' | 'hard-coded';
24
26
  };
25
27
  };
26
28
  archive?: ArchiveBody;
29
+ hint?: string;
30
+ unavailable?: string;
27
31
  };
28
32
  export declare function actionGroupLabel(key: string, storedLabel?: string): string;
29
- export declare function availableActions({ status, kind, arms, decision, canManage }: {
33
+ export declare function canDeleteTest(status: string): status is "draft" | "archived";
34
+ export declare function availableActions({ name, status, kind, arms, allocation, decision, canManage, canReadResults }: {
35
+ name?: string;
30
36
  status: Status;
31
37
  kind: ExperimentKind;
32
- arms: readonly ActionGroup[];
38
+ arms?: readonly ActionGroup[] | null;
39
+ allocation?: number;
33
40
  decision?: ActionDecision | null;
34
41
  canManage: boolean;
42
+ canReadResults?: boolean;
35
43
  }): ExperimentAction[];
@@ -1,18 +1,46 @@
1
1
  import { contentDone } from '../../contentDone.js';
2
2
  import { armLabel } from '../labels.js';
3
- import { ACTIONS_COPY as C, hardCodedLabel, makeContentCopy, releaseCopy } from '../copy/actions.js';
3
+ import { ACTIONS_COPY as C, actionTitle, archiveCopy, discardCopy, hardCodedLabel, makeContentCopy, releaseCopy, stopCopy } from '../copy/actions.js';
4
4
  import { REVIEW_COPY } from '../copy/review.js';
5
+ import { READINESS_COPY } from '../copy/readiness.js';
6
+ import { DELETE_TEST } from '../copy/testPage.js';
7
+ import { RESULTS_COPY } from '../copy/results.js';
8
+ import { canReleasePages } from '../results/releasePages.model.js';
9
+ const destructiveActions = new Set([
10
+ 'stop',
11
+ 'decide',
12
+ 'release-holdout',
13
+ 'make-content',
14
+ 'after-content',
15
+ 'archive',
16
+ 'discard',
17
+ 'hard-coded',
18
+ 'delete',
19
+ 'release-pages'
20
+ ]);
21
+ // Use destructive confirmation styling when an action permanently ends a round, ships or releases content, archives, or deletes.
22
+ export function isDestructiveAction(id) {
23
+ return destructiveActions.has(id);
24
+ }
5
25
  export function actionGroupLabel(key, storedLabel) {
6
26
  return storedLabel?.trim() || armLabel(key);
7
27
  }
8
- export function availableActions({ status, kind, arms, decision, canManage }) {
28
+ export function canDeleteTest(status) {
29
+ return status === 'draft' || status === 'archived';
30
+ }
31
+ export function availableActions({ name, status, kind, arms = [], allocation, decision, canManage, canReadResults = canManage }) {
9
32
  if (!canManage) return [];
10
- const action = (id, label, body, tone = 'secondary', archive, phrase)=>({
33
+ const action = (id, label, body, tone = 'secondary', archive, phrase)=>{
34
+ const confirmLabel = id === 'hard-coded' ? C.confirmPermanentWinner : label;
35
+ const titleKey = id === 'start' && status === 'stopped' ? 'restart' : id;
36
+ const titleLead = Object.hasOwn(C.titleLead, titleKey) ? C.titleLead[titleKey] : confirmLabel;
37
+ return {
11
38
  id,
12
39
  label,
13
40
  tone,
14
41
  confirm: {
15
- title: label,
42
+ title: name ? actionTitle(titleLead, name) : confirmLabel,
43
+ label: confirmLabel,
16
44
  body,
17
45
  ...phrase ? {
18
46
  phrase: {
@@ -23,30 +51,52 @@ export function availableActions({ status, kind, arms, decision, canManage }) {
23
51
  ...archive ? {
24
52
  archive
25
53
  } : {}
26
- });
54
+ };
55
+ };
27
56
  const start = action('start', status === 'stopped' ? C.restart : C.start, status === 'stopped' ? C.restartBody : C.startBody, 'primary');
28
- const decide = action('decide', C.decide, '', 'primary');
29
- if (status === 'draft') return [
30
- start
57
+ const control = actionGroupLabel('control', arms?.find((group)=>group.kind === 'control' || group.key === 'control')?.label);
58
+ const decide = canReadResults ? [
59
+ action('decide', C.decide, C.decideBody, 'primary')
60
+ ] : [];
61
+ const remove = action('delete', DELETE_TEST.action, DELETE_TEST.consequences, 'danger');
62
+ if (canDeleteTest(status)) return status === 'draft' ? [
63
+ start,
64
+ remove
65
+ ] : [
66
+ ...canReleasePages({
67
+ status,
68
+ kind,
69
+ decision
70
+ }) ? [
71
+ action('release-pages', RESULTS_COPY.releasePages, RESULTS_COPY.releasePagesBody)
72
+ ] : [],
73
+ remove
31
74
  ];
32
75
  if (status === 'running') return [
33
- action('stop', C.stop, C.stopBody, 'danger'),
34
- decide,
35
- action('allocate', REVIEW_COPY.raise, REVIEW_COPY.allocationBody),
36
- action('add-metric', REVIEW_COPY.addMetric, '')
76
+ ...decide,
77
+ action('add-metric', READINESS_COPY.addGoal, ''),
78
+ {
79
+ ...action('allocate', READINESS_COPY.allocate, REVIEW_COPY.allocationBody),
80
+ unavailable: allocation !== undefined && allocation >= 100 ? READINESS_COPY.everyone : undefined
81
+ },
82
+ action('stop', C.stop, stopCopy(control), 'danger')
37
83
  ];
38
84
  if (status === 'stopped') return [
39
85
  start,
40
- decide,
41
- action('archive', C.archive, C.archiveBody, 'secondary', {
42
- mode: 'stopped'
43
- })
86
+ ...decide,
87
+ {
88
+ ...action('archive', C.archive, archiveCopy(control), 'secondary', {
89
+ mode: 'stopped'
90
+ }),
91
+ hint: DELETE_TEST.archiveFirst
92
+ }
44
93
  ];
45
94
  if (status !== 'decided') return [];
46
- const winner = arms.find((group)=>group.key === decision?.winnerArm);
95
+ const groups = arms ?? [];
96
+ const winner = groups.find((group)=>group.key === decision?.winnerArm);
47
97
  const label = actionGroupLabel(decision?.winnerArm ?? 'control', winner?.label);
48
- const rolloutOpen = arms.some((group)=>group.key === 'holdout') && Boolean(decision?.winnerArm) && decision?.winnerArm !== 'control' && !decision?.holdoutReleasedAt;
49
- return [
98
+ const rolloutOpen = groups.some((group)=>group.key === 'holdout') && Boolean(decision?.winnerArm) && decision?.winnerArm !== 'control' && !decision?.holdoutReleasedAt;
99
+ const actions = [
50
100
  ...rolloutOpen ? [
51
101
  action('release-holdout', C.release, releaseCopy(label))
52
102
  ] : [],
@@ -58,13 +108,16 @@ export function availableActions({ status, kind, arms, decision, canManage }) {
58
108
  mode: 'after-content'
59
109
  })
60
110
  ] : [],
61
- action('discard', C.discard, C.discardBody, 'danger', {
111
+ action('discard', C.discard, discardCopy(control), 'danger', {
62
112
  mode: 'discard'
63
113
  }, 'discard'),
64
- ...kind === 'code' ? [
65
- action('hard-coded', hardCodedLabel(label), hardCodedLabel(label), 'primary', {
114
+ ...kind === 'code' && winner && winner.kind !== 'holdout' ? [
115
+ action('hard-coded', hardCodedLabel(label), C.hardCodedBody, 'primary', {
66
116
  mode: 'hard-coded'
67
117
  }, 'hard-coded')
68
118
  ] : []
69
119
  ];
120
+ const archiveOption = actions.find((item)=>item.id === 'after-content') ?? actions.find((item)=>item.archive || item.id === 'make-content');
121
+ if (archiveOption) archiveOption.hint = DELETE_TEST.archiveFirst;
122
+ return actions;
70
123
  }
@@ -12,6 +12,7 @@ export declare function decideState({ snapshot, arms, chosenArm, note, typed }:
12
12
  value: string;
13
13
  label: string;
14
14
  }[];
15
+ noEvidence: boolean;
15
16
  prefill: string | null;
16
17
  guarded: boolean;
17
18
  reason: string | null;
@@ -28,6 +28,7 @@ export function decideState({ snapshot, arms, chosenArm, note, typed }) {
28
28
  };
29
29
  return {
30
30
  options,
31
+ noEvidence: !snapshot || snapshot.exposures.total === 0,
31
32
  prefill: snapshot?.verdict.recommendedArm ?? null,
32
33
  guarded,
33
34
  reason,
@@ -4,10 +4,13 @@ const percent = (value)=>String(Math.round(value * 10) / 10);
4
4
  export function allocationSentence({ allocation, unitType, arms, layer, status }) {
5
5
  const groups = arms.filter((group)=>group.kind !== 'holdout');
6
6
  if (!groups.length || !Number.isFinite(allocation)) return '';
7
- const equal = groups.every((group)=>group.weight === groups[0].weight);
8
- const shares = equal ? eachVersion(percent(allocation * groups[0].weight / 100)) : groups.map((group)=>groupShare(percent(allocation * group.weight / 100), armLabel(group.key, group.label))).join(', ');
7
+ const control = groups.find((group)=>group.kind === 'control' || group.key === 'control');
8
+ const labelOf = (group)=>group.label?.trim() || armLabel(group.key);
9
+ const controlLabel = control ? labelOf(control) : armLabel('control');
10
+ const equal = groups.length > 1 && groups.every((group)=>group.weight === groups[0].weight);
11
+ const shares = equal ? eachVersion(percent(allocation * groups[0].weight / 100)) : groups.map((group)=>groupShare(percent(allocation * group.weight / 100), labelOf(group))).join(', ');
9
12
  const holdout = arms.find((group)=>group.kind === 'holdout');
10
- let sentence = participation(percent(allocation), peopleLabel[unitType], shares) + (holdout ? holdoutClause(percent(holdout.weight)) : '') + (allocation < 100 ? holdout ? holdoutRemainder : uncounted : '');
13
+ let sentence = participation(percent(allocation), peopleLabel[unitType], shares) + (holdout ? holdoutClause(percent(holdout.weight), controlLabel) : '') + (allocation < 100 ? holdout ? holdoutRemainder(controlLabel) : uncounted(controlLabel) : '');
11
14
  if ((holdout || layer || status === 'running') && !sentence.endsWith('.')) sentence += '.';
12
15
  if (layer) sentence += layerSentence(layer.name, layer.used, layer.free);
13
16
  return sentence;
@@ -1,5 +1,5 @@
1
1
  import type { DocId } from '../types/contracts.js';
2
- import type { DeleteImpactResult, WrapBlockBody, PagesResult, PlacementStatusBody, PlacementStatusResult, RestoreContentEntryBody, RestoreContentEntryResult, DismissContentEntryBody, DismissContentEntryResult, AddMetricBody, AllocateBody, ArchiveBody, DecideBody, MakeContentResult, AddMetricResult, ClickKeysResult, PreflightResult, PreviewTokenResult, RefusalCode, ResultsResponse, SummaryResponse, TransitionSuccess } from '../types/endpoints.js';
2
+ import type { CopyPagePlan, CopyPageResult, DeleteImpactResult, WrapBlockBody, PagesResult, PlacementStatusBody, PlacementStatusResult, RestoreContentEntryBody, RestoreContentEntryResult, DismissContentEntryBody, DismissContentEntryResult, AddMetricBody, AllocateBody, ArchiveBody, DecideBody, MakeContentResult, AddMetricResult, ClickKeysResult, PreflightResult, PreviewTokenResult, RefusalCode, ResultsResponse, SummaryResponse, TransitionSuccess } from '../types/endpoints.js';
3
3
  import { refusalMessage } from './copy/common.js';
4
4
  export type ApiResult<T> = {
5
5
  ok: true;
@@ -28,7 +28,10 @@ export declare function createApi(apiBase: string, contentLocale?: string): {
28
28
  q?: string;
29
29
  path?: string;
30
30
  page?: number;
31
+ mode?: "block";
31
32
  }, signal?: AbortSignal) => Promise<ApiResult<PagesResult>>;
33
+ previewPageCopy: (id: DocId, arm: string, signal?: AbortSignal) => Promise<ApiResult<CopyPagePlan>>;
34
+ makePageCopy: (id: DocId, arm: string, plan: CopyPagePlan) => Promise<ApiResult<CopyPageResult>>;
32
35
  placementStatus: (body: PlacementStatusBody) => Promise<ApiResult<PlacementStatusResult>>;
33
36
  start: (id: DocId, phase?: number) => Promise<ApiResult<TransitionSuccess>>;
34
37
  allocate: (id: DocId, body: AllocateBody, options?: RequestOptions) => Promise<ApiResult<TransitionSuccess>>;
@@ -1,3 +1,4 @@
1
+ import { XP_IF_UPDATED_AT_HEADER } from '../constants.js';
1
2
  import { contentLocaleURL } from './contentLocaleURL.js';
2
3
  import { API_MESSAGES, refusalMessage } from './copy/common.js';
3
4
  import { CONTENT_ENTRY_REFUSALS } from './copy/actions.js';
@@ -5,7 +6,7 @@ export function createApi(apiBase, contentLocale) {
5
6
  const collectionBase = `${apiBase.replace(/\/$/, '')}/xp-experiments`;
6
7
  const base = `${apiBase.replace(/\/$/, '')}/xp/experiments`;
7
8
  const route = (id, action)=>`${base}/${encodeURIComponent(id)}/${action}`;
8
- async function request(path, method, body, options, signal) {
9
+ async function request(path, method, body, options, signal, updatedAt) {
9
10
  try {
10
11
  const response = await fetch(path(), {
11
12
  method,
@@ -15,7 +16,10 @@ export function createApi(apiBase, contentLocale) {
15
16
  } : {},
16
17
  ...body === undefined ? {} : {
17
18
  headers: {
18
- 'Content-Type': 'application/json'
19
+ 'Content-Type': 'application/json',
20
+ ...updatedAt ? {
21
+ [XP_IF_UPDATED_AT_HEADER]: updatedAt
22
+ } : {}
19
23
  },
20
24
  body: JSON.stringify(body)
21
25
  }
@@ -91,18 +95,22 @@ export function createApi(apiBase, contentLocale) {
91
95
  }
92
96
  }),
93
97
  wrapBlock: (body)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/blocks/wrap`, 'POST', body),
94
- pages: (query, signal)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/pages?${new URLSearchParams({
95
- collection: query.collection,
96
- ...query.q ? {
97
- q: query.q
98
- } : {},
99
- ...query.path !== undefined ? {
100
- path: query.path
101
- } : {},
102
- ...query.page ? {
103
- page: String(query.page)
104
- } : {}
105
- })}`, 'GET', undefined, undefined, signal),
98
+ pages: (query, signal)=>request(()=>{
99
+ const params = new URLSearchParams({
100
+ collection: query.collection
101
+ });
102
+ if (query.q) params.set('q', query.q);
103
+ if (query.path !== undefined) params.set('path', query.path);
104
+ if (query.page) params.set('page', String(query.page));
105
+ if (query.mode) params.set('mode', query.mode);
106
+ if (contentLocale) params.set('locale', contentLocale);
107
+ return `${apiBase.replace(/\/$/, '')}/xp/pages?${params}`;
108
+ }, 'GET', undefined, undefined, signal),
109
+ previewPageCopy: (id, arm, signal)=>request(()=>`${route(id, 'duplicate-original')}?arm=${encodeURIComponent(arm)}`, 'GET', undefined, undefined, signal),
110
+ makePageCopy: (id, arm, plan)=>request(()=>route(id, 'duplicate-original'), 'POST', {
111
+ ...plan,
112
+ arm
113
+ }, undefined, undefined, plan.updatedAt),
106
114
  placementStatus: (body)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/placements/status`, 'POST', body),
107
115
  start: (id, phase)=>post(id, 'start', phase === undefined ? undefined : {
108
116
  phase
@@ -10,19 +10,35 @@ export declare const ACTIONS_COPY: {
10
10
  readonly finish: "Finish archiving";
11
11
  readonly archive: "Archive";
12
12
  readonly discard: "Discard winner";
13
- readonly startBody: "Start this test?";
14
- readonly restartBody: "Starting again begins a new round; results restart.";
15
- readonly stopBody: "Everyone will see the Original. Starting again begins a new round; results restart.";
16
- readonly original: "Everyone will see the Original.";
17
- readonly discardBody: "Everyone goes back to the Original. The decision note is kept.";
18
- readonly archiveBody: "Archive this test?";
19
- readonly finishBody: "The content has been updated. Finish archiving this test.";
13
+ readonly startBody: "The test will start showing versions to visitors and collecting results.";
14
+ readonly restartBody: "Visitors will start seeing test versions again. New results go into a new round, and earlier results are kept.";
15
+ readonly finishBody: "The updated content stays in place. The test moves to Archived and keeps its results. You can then delete it.";
16
+ readonly hardCodedBody: "The test moves to Archived and keeps its results. The site will use the version your developer made permanent. You can then delete the test.";
17
+ readonly confirmPermanentWinner: "Confirm permanent winner";
18
+ readonly titleLead: {
19
+ readonly restart: "Start a new round for";
20
+ readonly decide: "Decide the winner for";
21
+ readonly 'release-holdout': "Release the holdout for";
22
+ readonly 'make-content': "Make the winner permanent for";
23
+ readonly discard: "Discard the winner for";
24
+ readonly 'hard-coded': "Confirm the permanent winner for";
25
+ readonly allocate: "Let more people into";
26
+ readonly 'add-metric': "Add a goal to";
27
+ readonly 'release-pages': "Release pages for";
28
+ };
29
+ readonly decideBody: "Choose the version visitors should see going forward. The test round ends and its results are kept.";
30
+ readonly decideRoundMissing: "Couldn't find the versions from this round. Close this dialog and check the current round.";
31
+ readonly actionChanged: "This test changed. Close this dialog to see the current actions.";
20
32
  readonly noResults: "There are no results yet.";
21
- readonly noRecommendation: "The results don't recommend a group yet.";
22
- readonly different: "You chose a different group than the results recommend.";
23
- readonly group: "Group";
24
- readonly note: "Decision note";
33
+ readonly noRecommendation: "The results don't recommend a version yet.";
34
+ readonly different: "You chose a different version than the results recommend.";
35
+ readonly winningVersion: "Winning version";
36
+ readonly chooseVersion: "Choose a version";
37
+ readonly note: "Decision note (optional)";
38
+ readonly requiredNote: "Decision note (required for this choice)";
25
39
  readonly confirmation: "Confirmation";
40
+ readonly noEvidence: "No one has taken part yet, so there's nothing to compare. Deciding now picks a version without evidence.";
41
+ readonly decideAnyway: "Decide anyway";
26
42
  readonly typePhrase: "Type the following to confirm:";
27
43
  readonly cancel: "Cancel";
28
44
  readonly retry: "Retry";
@@ -33,7 +49,7 @@ export declare const ACTIONS_COPY: {
33
49
  readonly contentArchived: "The winner is now the content and the test is archived.";
34
50
  readonly dismissLabel: (page: string) => string;
35
51
  readonly undoLabel: (page: string) => string;
36
- readonly dismissHelp: "Dismiss a page you'll update by hand, then finish archiving.";
52
+ readonly dismissHelp: "Dismiss each page you plan to update by hand so you can finish archiving.";
37
53
  readonly contentEntryNotDecided: "This test isn't decided, so its pages can't be changed.";
38
54
  readonly contentEntryMissing: "This page is no longer in the list. Reload to see the current list.";
39
55
  readonly contentEntryDismissed: "This page was already dismissed.";
@@ -53,9 +69,15 @@ export declare const ACTIONS_COPY: {
53
69
  'update-failed': string;
54
70
  };
55
71
  readonly missingContent: "This page no longer exists; nothing to change.";
56
- readonly partial: "Some pages couldn't be updated. Fix them and retry.";
72
+ readonly partial: "Some pages still need changes.";
57
73
  };
58
- export declare const decideCopy: (winner: string, holdout: boolean, original: boolean) => string;
74
+ export declare const actionTitle: (action: string, test: string) => string;
75
+ export declare const actionTitleFor: (action: string, test: string) => string;
76
+ export declare const actionsForTest: (test: string) => string;
77
+ export declare const stopCopy: (control: string) => string;
78
+ export declare const discardCopy: (control: string) => string;
79
+ export declare const archiveCopy: (control: string) => string;
80
+ export declare const decideCopy: (winner: string, holdout: boolean, control: string, isControl: boolean) => string;
59
81
  export declare const releaseCopy: (winner: string) => string;
60
82
  export declare const makeContentCopy: (winner: string, kind: "block" | "page" | "flag") => string;
61
83
  export declare const hardCodedLabel: (winner: string) => string;
@@ -10,19 +10,35 @@ export const ACTIONS_COPY = {
10
10
  finish: 'Finish archiving',
11
11
  archive: 'Archive',
12
12
  discard: 'Discard winner',
13
- startBody: 'Start this test?',
14
- restartBody: 'Starting again begins a new round; results restart.',
15
- stopBody: 'Everyone will see the Original. Starting again begins a new round; results restart.',
16
- original: 'Everyone will see the Original.',
17
- discardBody: 'Everyone goes back to the Original. The decision note is kept.',
18
- archiveBody: 'Archive this test?',
19
- finishBody: 'The content has been updated. Finish archiving this test.',
13
+ startBody: 'The test will start showing versions to visitors and collecting results.',
14
+ restartBody: 'Visitors will start seeing test versions again. New results go into a new round, and earlier results are kept.',
15
+ finishBody: 'The updated content stays in place. The test moves to Archived and keeps its results. You can then delete it.',
16
+ hardCodedBody: 'The test moves to Archived and keeps its results. The site will use the version your developer made permanent. You can then delete the test.',
17
+ confirmPermanentWinner: 'Confirm permanent winner',
18
+ titleLead: {
19
+ restart: 'Start a new round for',
20
+ decide: 'Decide the winner for',
21
+ 'release-holdout': 'Release the holdout for',
22
+ 'make-content': 'Make the winner permanent for',
23
+ discard: 'Discard the winner for',
24
+ 'hard-coded': 'Confirm the permanent winner for',
25
+ allocate: 'Let more people into',
26
+ 'add-metric': 'Add a goal to',
27
+ 'release-pages': 'Release pages for'
28
+ },
29
+ decideBody: 'Choose the version visitors should see going forward. The test round ends and its results are kept.',
30
+ decideRoundMissing: "Couldn't find the versions from this round. Close this dialog and check the current round.",
31
+ actionChanged: 'This test changed. Close this dialog to see the current actions.',
20
32
  noResults: 'There are no results yet.',
21
- noRecommendation: "The results don't recommend a group yet.",
22
- different: 'You chose a different group than the results recommend.',
23
- group: 'Group',
24
- note: 'Decision note',
33
+ noRecommendation: "The results don't recommend a version yet.",
34
+ different: 'You chose a different version than the results recommend.',
35
+ winningVersion: 'Winning version',
36
+ chooseVersion: 'Choose a version',
37
+ note: 'Decision note (optional)',
38
+ requiredNote: 'Decision note (required for this choice)',
25
39
  confirmation: 'Confirmation',
40
+ noEvidence: "No one has taken part yet, so there's nothing to compare. Deciding now picks a version without evidence.",
41
+ decideAnyway: 'Decide anyway',
26
42
  typePhrase: 'Type the following to confirm:',
27
43
  cancel: 'Cancel',
28
44
  retry: 'Retry',
@@ -33,7 +49,7 @@ export const ACTIONS_COPY = {
33
49
  contentArchived: 'The winner is now the content and the test is archived.',
34
50
  dismissLabel: (page)=>`Dismiss ${page}`,
35
51
  undoLabel: (page)=>`Undo dismiss ${page}`,
36
- dismissHelp: "Dismiss a page you'll update by hand, then finish archiving.",
52
+ dismissHelp: "Dismiss each page you plan to update by hand so you can finish archiving.",
37
53
  contentEntryNotDecided: "This test isn't decided, so its pages can't be changed.",
38
54
  contentEntryMissing: 'This page is no longer in the list. Reload to see the current list.',
39
55
  contentEntryDismissed: 'This page was already dismissed.',
@@ -46,18 +62,24 @@ export const ACTIONS_COPY = {
46
62
  failed: 'Failed',
47
63
  contentReasons: {
48
64
  localized: "This page has more than one language; Make it the content can't publish it safely yet. Copy the winning version by hand.",
49
- locked: 'Someone is editing this page. Wait for them to finish, then retry.',
65
+ locked: 'Someone is editing this page. Retry when they finish.',
50
66
  forbidden: "You can't read or update this page. Ask someone with access to update it by hand. If it was deleted or moved to trash, discard the winner to archive this test.",
51
67
  'not-found': 'This page could not be found. Check whether it was deleted.',
52
- validation: "This page couldn't be saved automatically. Update it by hand, then retry.",
68
+ validation: "This page couldn't be saved automatically. Update it by hand.",
53
69
  'update-failed': "This page couldn't be updated this time. Retry; if it keeps happening, ask a developer."
54
70
  },
55
71
  missingContent: 'This page no longer exists; nothing to change.',
56
- partial: "Some pages couldn't be updated. Fix them and retry."
72
+ partial: "Some pages still need changes."
57
73
  };
58
- export const decideCopy = (winner, holdout, original)=>original ? ACTIONS_COPY.original : holdout ? `Everyone except the holdout will see ${winner}. The holdout keeps seeing the Original so we can measure the shipped change.` : `Everyone will see ${winner}.`;
74
+ export const actionTitle = (action, test)=>`${action} “${test}”?`;
75
+ export const actionTitleFor = (action, test)=>`${action} for “${test}”?`;
76
+ export const actionsForTest = (test)=>`Actions for ${test}`;
77
+ export const stopCopy = (control)=>`Visitors will go back to ${control}. The test stops collecting data and keeps its results. Starting again begins a new round.`;
78
+ export const discardCopy = (control)=>`Visitors go back to ${control}. The test moves to Archived and keeps its results and decision note. You can then delete it.`;
79
+ export const archiveCopy = (control)=>`The test moves out of the active list into Archived. It won't collect any more data, and visitors will keep seeing ${control}. You can still view the results or delete the test later. You can't restart it.`;
80
+ export const decideCopy = (winner, holdout, control, isControl)=>holdout && !isControl ? `Everyone except the holdout will see ${winner}. The holdout keeps seeing ${control} so we can measure the shipped change.` : `Everyone will see ${winner}.`;
59
81
  export const releaseCopy = (winner)=>`The holdout will see ${winner} too. Measuring since shipping ends.`;
60
- export const makeContentCopy = (winner, kind)=>kind === 'flag' ? `Saves ${winner}'s settings as the new defaults so the test can be archived.` : `Copies ${winner} into the page content so the test can be archived.`;
82
+ export const makeContentCopy = (winner, kind)=>kind === 'flag' ? `Saves ${winner}'s settings as the new defaults so the test can be archived.` : kind === 'page' ? `Archives the test and keeps serving ${winner} at the test's addresses. The pages and results are kept.` : `Copies ${winner} into the page content so the test can be archived.`;
61
83
  export const hardCodedLabel = (winner)=>`The developer has hard-coded ${winner}`;
62
84
  /** Old reports can contain host error text: never interpolate an unknown string. */ export const contentReportCopy = (reason, ok = false)=>reason === 'not-found' && ok ? ACTIONS_COPY.missingContent : ACTIONS_COPY.contentReasons[reason !== undefined && Object.hasOwn(ACTIONS_COPY.contentReasons, reason) ? reason : 'update-failed'];
63
85
  // Each dismiss/restore refusal code has its own sentence; server text is never shown.
@@ -45,6 +45,16 @@ export declare const ADVANCED_COPY: {
45
45
  readonly label: "Unit type";
46
46
  readonly help: "Count visitors or signed-in users, as chosen at creation.";
47
47
  };
48
+ readonly kinds: {
49
+ readonly block: "Page block";
50
+ readonly flag: "Setting";
51
+ readonly code: "Developer code";
52
+ readonly page: "Whole page";
53
+ };
54
+ readonly units: {
55
+ readonly visitor: "Each visitor";
56
+ readonly user: "Each signed-in user";
57
+ };
48
58
  readonly inheritedWindow: "Use each goal's window";
49
59
  readonly automaticTuning: "Automatic (5,000)";
50
60
  readonly sequential: "Sequential";