@delmaredigital/payload-experiments 0.4.0-rc.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +9 -15
  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 +7 -6
  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 +12 -10
  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 +224 -52
  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 +99 -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 +98 -66
  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 +2 -2
  57. package/dist/collections/experiments/armInvariants.js +8 -5
  58. package/dist/collections/experiments/config.js +8 -3
  59. package/dist/collections/experiments/deleteGuard.js +2 -2
  60. package/dist/collections/experiments/lockHook.js +21 -2
  61. package/dist/collections/experiments/pickSlug.js +2 -0
  62. package/dist/collections/metrics.js +12 -5
  63. package/dist/collections/metricsGuards.js +2 -0
  64. package/dist/collections/serialize.js +8 -6
  65. package/dist/constants.d.ts +1 -0
  66. package/dist/constants.js +1 -0
  67. package/dist/db/adapter.d.ts +9 -1
  68. package/dist/db/adapter.js +77 -1
  69. package/dist/db/delete.d.ts +1 -1
  70. package/dist/db/delete.js +2 -4
  71. package/dist/db/events.d.ts +9 -0
  72. package/dist/db/events.js +42 -8
  73. package/dist/db/executor.d.ts +7 -1
  74. package/dist/db/executor.js +7 -3
  75. package/dist/db/pageCopies.d.ts +5 -0
  76. package/dist/db/pageCopies.js +31 -0
  77. package/dist/db/results.d.ts +5 -1
  78. package/dist/db/results.js +21 -5
  79. package/dist/db/snapshots.d.ts +2 -0
  80. package/dist/endpoints/deleteImpact.js +2 -1
  81. package/dist/endpoints/duplicateOriginal.d.ts +38 -0
  82. package/dist/endpoints/duplicateOriginal.js +414 -0
  83. package/dist/endpoints/editorSurface.js +1 -1
  84. package/dist/endpoints/events.js +103 -39
  85. package/dist/endpoints/index.js +22 -8
  86. package/dist/endpoints/pages.js +245 -66
  87. package/dist/endpoints/placementStatus.js +8 -4
  88. package/dist/endpoints/results.d.ts +1 -1
  89. package/dist/endpoints/results.js +9 -2
  90. package/dist/endpoints/routeId.d.ts +2 -2
  91. package/dist/endpoints/routeId.js +11 -5
  92. package/dist/endpoints/summary.js +46 -12
  93. package/dist/endpoints/testVersion.d.ts +2 -0
  94. package/dist/endpoints/testVersion.js +38 -0
  95. package/dist/endpoints/transitions.js +41 -29
  96. package/dist/errors.d.ts +4 -0
  97. package/dist/errors.js +6 -0
  98. package/dist/events/request.d.ts +6 -2
  99. package/dist/events/request.js +35 -8
  100. package/dist/events/rows.d.ts +1 -1
  101. package/dist/events/rows.js +24 -8
  102. package/dist/events/writable.d.ts +9 -0
  103. package/dist/events/writable.js +13 -0
  104. package/dist/exports/index.d.ts +1 -1
  105. package/dist/exports/rsc.d.ts +1 -0
  106. package/dist/exports/rsc.js +1 -0
  107. package/dist/goals/fairness.js +2 -2
  108. package/dist/goals/picker/copy.js +1 -1
  109. package/dist/goals/sourceLabel.d.ts +2 -0
  110. package/dist/goals/sourceLabel.js +4 -0
  111. package/dist/hooks/hostHook.js +6 -2
  112. package/dist/hooks/pageGuard.js +4 -0
  113. package/dist/hooks/trackPageCopies.d.ts +11 -0
  114. package/dist/hooks/trackPageCopies.js +7 -0
  115. package/dist/labels/arms.d.ts +3 -0
  116. package/dist/labels/arms.js +8 -0
  117. package/dist/lib/fetchAllDocs.d.ts +1 -1
  118. package/dist/manifest/compile.js +8 -5
  119. package/dist/onInit.js +14 -0
  120. package/dist/options.d.ts +2 -0
  121. package/dist/options.js +23 -2
  122. package/dist/plugin.js +56 -2
  123. package/dist/proxy/pageNavigation.d.ts +4 -0
  124. package/dist/proxy/pageNavigation.js +28 -0
  125. package/dist/proxy/resolve.js +52 -25
  126. package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
  127. package/dist/puck/editor/ConfigureTestDrawer.js +40 -29
  128. package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
  129. package/dist/puck/editor/ExperimentSlotEditor.js +376 -139
  130. package/dist/puck/editor/LeftoverVersions.js +17 -32
  131. package/dist/puck/editor/QuickTestActions.d.ts +6 -3
  132. package/dist/puck/editor/QuickTestActions.js +55 -33
  133. package/dist/puck/editor/ResultsReadout.d.ts +4 -1
  134. package/dist/puck/editor/ResultsReadout.js +28 -15
  135. package/dist/puck/editor/VersionBuilder.d.ts +17 -4
  136. package/dist/puck/editor/VersionBuilder.js +175 -112
  137. package/dist/puck/editor/armWrites.js +2 -2
  138. package/dist/puck/editor/armsCache.js +1 -3
  139. package/dist/puck/editor/copy.d.ts +14 -7
  140. package/dist/puck/editor/copy.js +26 -13
  141. package/dist/puck/editor/editor.chrome.css +10 -8
  142. package/dist/puck/editor/editor.css +15 -9
  143. package/dist/puck/editor/editor.model.d.ts +1 -0
  144. package/dist/puck/editor/placementsCache.d.ts +4 -0
  145. package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
  146. package/dist/puck/editor/usePageSaveReadiness.js +31 -0
  147. package/dist/puck/nestedTestCopy.js +2 -2
  148. package/dist/puck/slotConfig.d.ts +1 -1
  149. package/dist/puck/slotConfig.js +1 -1
  150. package/dist/results/aggregate.d.ts +6 -3
  151. package/dist/results/aggregate.js +9 -9
  152. package/dist/results/analyse.d.ts +2 -0
  153. package/dist/results/analyse.js +2 -2
  154. package/dist/results/health.d.ts +8 -0
  155. package/dist/results/health.js +28 -0
  156. package/dist/results/identityCredit.d.ts +1 -0
  157. package/dist/results/identityCredit.js +4 -1
  158. package/dist/results/verdict.d.ts +4 -4
  159. package/dist/results/verdict.js +15 -11
  160. package/dist/runtime/cookie.d.ts +10 -2
  161. package/dist/runtime/cookie.js +38 -6
  162. package/dist/runtime/cookieOptions.d.ts +6 -0
  163. package/dist/runtime/cookieOptions.js +14 -0
  164. package/dist/runtime/proxyRuntime.d.ts +1 -0
  165. package/dist/runtime/proxyRuntime.js +18 -8
  166. package/dist/runtime/signing.d.ts +1 -0
  167. package/dist/runtime/signing.js +5 -0
  168. package/dist/sanitizeReadinessDetail.d.ts +2 -2
  169. package/dist/sanitizeReadinessDetail.js +20 -2
  170. package/dist/server/getAssignments.js +11 -10
  171. package/dist/server/recordContentChange.d.ts +1 -1
  172. package/dist/server/recordContentChange.js +11 -2
  173. package/dist/server/resolveExperimentBlocks.js +2 -4
  174. package/dist/server/resolveExperimentData.js +2 -5
  175. package/dist/server/runResults.js +54 -15
  176. package/dist/server/startExperiment.d.ts +20 -0
  177. package/dist/server/startExperiment.js +70 -0
  178. package/dist/server/trackConversion.js +10 -13
  179. package/dist/testSurface/PreviewLinks.d.ts +2 -1
  180. package/dist/testSurface/PreviewLinks.js +3 -3
  181. package/dist/testSurface/actions/DecideDialog.d.ts +10 -4
  182. package/dist/testSurface/actions/DecideDialog.js +93 -63
  183. package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
  184. package/dist/testSurface/actions/LifecycleAction.js +107 -0
  185. package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
  186. package/dist/testSurface/actions/MakeContentResult.js +10 -2
  187. package/dist/testSurface/actions/actions.model.d.ts +13 -5
  188. package/dist/testSurface/actions/actions.model.js +75 -22
  189. package/dist/testSurface/actions/decide.model.d.ts +1 -0
  190. package/dist/testSurface/actions/decide.model.js +1 -0
  191. package/dist/testSurface/allocation.model.js +6 -3
  192. package/dist/testSurface/api.d.ts +9 -6
  193. package/dist/testSurface/api.js +43 -23
  194. package/dist/testSurface/copy/actions.d.ts +37 -14
  195. package/dist/testSurface/copy/actions.js +40 -17
  196. package/dist/testSurface/copy/advanced.d.ts +10 -0
  197. package/dist/testSurface/copy/advanced.js +10 -0
  198. package/dist/testSurface/copy/arms.d.ts +1 -1
  199. package/dist/testSurface/copy/arms.js +1 -1
  200. package/dist/testSurface/copy/audience.d.ts +4 -3
  201. package/dist/testSurface/copy/audience.js +5 -4
  202. package/dist/testSurface/copy/common.d.ts +8 -6
  203. package/dist/testSurface/copy/common.js +8 -6
  204. package/dist/testSurface/copy/languages.d.ts +1 -0
  205. package/dist/testSurface/copy/languages.js +1 -0
  206. package/dist/testSurface/copy/metrics.d.ts +7 -0
  207. package/dist/testSurface/copy/metrics.js +9 -0
  208. package/dist/testSurface/copy/pages.d.ts +67 -7
  209. package/dist/testSurface/copy/pages.js +74 -7
  210. package/dist/testSurface/copy/readiness.d.ts +20 -7
  211. package/dist/testSurface/copy/readiness.js +36 -10
  212. package/dist/testSurface/copy/recommendation.d.ts +1 -22
  213. package/dist/testSurface/copy/recommendation.js +2 -22
  214. package/dist/testSurface/copy/results.d.ts +21 -12
  215. package/dist/testSurface/copy/results.js +24 -13
  216. package/dist/testSurface/copy/review.d.ts +13 -10
  217. package/dist/testSurface/copy/review.js +14 -10
  218. package/dist/testSurface/copy/setting.d.ts +1 -2
  219. package/dist/testSurface/copy/setting.js +1 -2
  220. package/dist/testSurface/copy/surface.d.ts +11 -2
  221. package/dist/testSurface/copy/surface.js +14 -11
  222. package/dist/testSurface/copy/testPage.d.ts +36 -12
  223. package/dist/testSurface/copy/testPage.js +53 -16
  224. package/dist/testSurface/format/date.d.ts +5 -2
  225. package/dist/testSurface/format/date.js +24 -8
  226. package/dist/testSurface/format/roundProgress.d.ts +6 -0
  227. package/dist/testSurface/format/roundProgress.js +15 -0
  228. package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
  229. package/dist/testSurface/format/useDateFormatter.js +8 -0
  230. package/dist/testSurface/labels.d.ts +1 -2
  231. package/dist/testSurface/labels.js +2 -3
  232. package/dist/testSurface/lockedNotice.model.d.ts +2 -0
  233. package/dist/testSurface/lockedNotice.model.js +31 -0
  234. package/dist/testSurface/readPreflight.d.ts +4 -0
  235. package/dist/testSurface/readPreflight.js +6 -0
  236. package/dist/testSurface/readinessRead.d.ts +3 -0
  237. package/dist/testSurface/readinessRead.js +4 -0
  238. package/dist/testSurface/results/CiChart.js +2 -1
  239. package/dist/testSurface/results/DataTable.d.ts +1 -1
  240. package/dist/testSurface/results/DataTable.js +4 -3
  241. package/dist/testSurface/results/VerdictHero.d.ts +3 -2
  242. package/dist/testSurface/results/VerdictHero.js +5 -1
  243. package/dist/testSurface/results/legacy.d.ts +0 -5
  244. package/dist/testSurface/results/legacy.js +0 -14
  245. package/dist/testSurface/results/results.css +2 -2
  246. package/dist/testSurface/results/results.model.d.ts +9 -4
  247. package/dist/testSurface/results/results.model.js +31 -23
  248. package/dist/testSurface/results/snapshot.d.ts +2 -0
  249. package/dist/testSurface/results/snapshot.js +3 -0
  250. package/dist/testSurface/surface/contracts.d.ts +13 -1
  251. package/dist/testSurface/surface/editorPlacement.d.ts +3 -3
  252. package/dist/testSurface/surface/editorPlacement.js +2 -2
  253. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +3 -3
  254. package/dist/testSurface/surface/pageBlock/parts.js +25 -12
  255. package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
  256. package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
  257. package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
  258. package/dist/testSurface/surface/pagePicker/PageCombobox.js +300 -197
  259. package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
  260. package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
  261. package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
  262. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +9 -5
  263. package/dist/testSurface/surface/readiness/ActionDialogs.js +241 -230
  264. package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
  265. package/dist/testSurface/surface/readiness/Banner.js +113 -141
  266. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +8 -4
  267. package/dist/testSurface/surface/readiness/SaveStatus.js +23 -22
  268. package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -6
  269. package/dist/testSurface/surface/readiness/readiness.model.js +168 -21
  270. package/dist/testSurface/surface/readiness/useTransition.d.ts +6 -4
  271. package/dist/testSurface/surface/readiness/useTransition.js +57 -14
  272. package/dist/testSurface/surface/results/ReleasePages.d.ts +6 -3
  273. package/dist/testSurface/surface/results/ReleasePages.js +42 -41
  274. package/dist/testSurface/surface/results/ResultsBody.d.ts +11 -4
  275. package/dist/testSurface/surface/results/ResultsBody.js +221 -118
  276. package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
  277. package/dist/testSurface/surface/results/recommendation.model.js +15 -59
  278. package/dist/testSurface/surface/results/useResults.d.ts +13 -8
  279. package/dist/testSurface/surface/results/useResults.js +3 -2
  280. package/dist/testSurface/surface/setting/parts.js +89 -46
  281. package/dist/testSurface/surface/setting/setting.css +2 -1
  282. package/dist/testSurface/surface/test/AdvancedSection.js +11 -4
  283. package/dist/testSurface/surface/test/DeleteTest.d.ts +10 -2
  284. package/dist/testSurface/surface/test/DeleteTest.js +173 -74
  285. package/dist/testSurface/surface/test/GoalSection.js +18 -14
  286. package/dist/testSurface/surface/test/LengthSection.js +24 -13
  287. package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
  288. package/dist/testSurface/surface/test/PageHoldout.js +11 -8
  289. package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
  290. package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
  291. package/dist/testSurface/surface/test/Section.js +8 -0
  292. package/dist/testSurface/surface/test/TargetingSection.js +82 -12
  293. package/dist/testSurface/surface/test/TestSurface.js +73 -37
  294. package/dist/testSurface/surface/test/VersionsSection.js +141 -91
  295. package/dist/testSurface/surface/test/fields.d.ts +32 -6
  296. package/dist/testSurface/surface/test/fields.js +166 -52
  297. package/dist/testSurface/surface/test/pageParts.js +27 -12
  298. package/dist/testSurface/surface/test/testPage.css +9 -2
  299. package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
  300. package/dist/testSurface/surface/test/testPage.model.js +6 -0
  301. package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
  302. package/dist/testSurface/surface/testDocument.model.js +4 -1
  303. package/dist/testSurface/surface/useTestDocument.d.ts +21 -5
  304. package/dist/testSurface/surface/useTestDocument.js +472 -167
  305. package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
  306. package/dist/testSurface/surface/watchTestDocument.js +181 -0
  307. package/dist/testSurface/surfaceUrls.d.ts +1 -0
  308. package/dist/testSurface/surfaceUrls.js +4 -0
  309. package/dist/testSurface/useApi.d.ts +8 -5
  310. package/dist/testSurface/useOnTestReturn.d.ts +2 -0
  311. package/dist/testSurface/useOnTestReturn.js +27 -0
  312. package/dist/testSurface/useReadinessPolling.js +3 -1
  313. package/dist/transitions/addMetric.d.ts +2 -5
  314. package/dist/transitions/addMetric.js +5 -1
  315. package/dist/transitions/allocate.d.ts +2 -2
  316. package/dist/transitions/allocate.js +3 -1
  317. package/dist/transitions/archive.d.ts +1 -1
  318. package/dist/transitions/archive.js +3 -2
  319. package/dist/transitions/checkStart.d.ts +1 -0
  320. package/dist/transitions/checkStart.js +17 -6
  321. package/dist/transitions/decide.d.ts +1 -1
  322. package/dist/transitions/decide.js +5 -3
  323. package/dist/transitions/deleteExperiment.d.ts +2 -2
  324. package/dist/transitions/deleteExperiment.js +17 -7
  325. package/dist/transitions/kernel.d.ts +4 -0
  326. package/dist/transitions/kernel.js +9 -4
  327. package/dist/transitions/makeContent.d.ts +2 -1
  328. package/dist/transitions/makeContent.js +12 -8
  329. package/dist/transitions/nestedPlacementNames.d.ts +2 -2
  330. package/dist/transitions/nestedPlacementNames.js +4 -5
  331. package/dist/transitions/pageAddress.d.ts +6 -0
  332. package/dist/transitions/pageAddress.js +71 -0
  333. package/dist/transitions/pageVersions.d.ts +1 -1
  334. package/dist/transitions/phaseRecord.d.ts +2 -0
  335. package/dist/transitions/phaseRecord.js +5 -0
  336. package/dist/transitions/placementInteractions.d.ts +3 -3
  337. package/dist/transitions/placementInteractions.js +8 -7
  338. package/dist/transitions/placements.d.ts +2 -0
  339. package/dist/transitions/placements.js +5 -5
  340. package/dist/transitions/preflightData.d.ts +3 -2
  341. package/dist/transitions/preflightData.js +77 -43
  342. package/dist/transitions/releaseHoldout.d.ts +2 -1
  343. package/dist/transitions/releaseHoldout.js +3 -1
  344. package/dist/transitions/releasePages.d.ts +2 -1
  345. package/dist/transitions/releasePages.js +3 -1
  346. package/dist/transitions/resolveCaps.d.ts +2 -4
  347. package/dist/transitions/start.d.ts +7 -9
  348. package/dist/transitions/start.js +75 -39
  349. package/dist/transitions/startReads.d.ts +7 -0
  350. package/dist/transitions/startReads.js +28 -0
  351. package/dist/transitions/stop.d.ts +2 -1
  352. package/dist/transitions/stop.js +3 -2
  353. package/dist/types/armKey.d.ts +2 -0
  354. package/dist/types/armKey.js +1 -0
  355. package/dist/types/contracts.d.ts +17 -4
  356. package/dist/types/endpoints.d.ts +89 -17
  357. package/dist/types/endpoints.js +1 -1
  358. package/dist/types/runtime.d.ts +15 -9
  359. package/dist/types/snapshot.d.ts +2 -0
  360. package/dist/types/surface.d.ts +7 -9
  361. package/dist/ui/ChipsInput.d.ts +8 -1
  362. package/dist/ui/ChipsInput.js +17 -4
  363. package/dist/ui/Dialog.d.ts +21 -2
  364. package/dist/ui/Dialog.js +101 -4
  365. package/dist/ui/Inputs.js +0 -1
  366. package/dist/ui/ui.css +5 -1
  367. package/package.json +2 -2
@@ -3,35 +3,40 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useEffect, useState } from 'react';
4
4
  import { useRouter } from 'next/navigation.js';
5
5
  import { formatAdminURL } from 'payload/shared';
6
- import { canStartTest, readyToStart } from '../../../testSurface/readinessRead.js';
6
+ import { canStartTest, hasBrowserWritablePrimary, readyToStart } from '../../../testSurface/readinessRead.js';
7
7
  import { useTestDocument } from '../../../testSurface/surface/useTestDocument.js';
8
8
  import { CopyRoute } from '../../../testSurface/surface/pagePicker/CopyRoute.js';
9
9
  import { PageCombobox } from '../../../testSurface/surface/pagePicker/PageCombobox.js';
10
10
  import { testPageCollection, controlFirst } from '../../../testSurface/surface/pagePicker/pagePicker.model.js';
11
11
  import { NEW_TEST_COPY as C } from '../../copy/newTest.js';
12
12
  import { READINESS_COPY } from '../../../testSurface/copy/readiness.js';
13
+ import { METRICS_COPY } from '../../../testSurface/copy/metrics.js';
13
14
  import { TEST_PAGE } from '../../../testSurface/copy/testPage.js';
14
15
  import { SURFACE_COPY } from '../../../testSurface/copy/surface.js';
15
16
  import { pageStepCopy } from '../../../testSurface/copy/pages.js';
16
17
  import { READINESS, nextStep, pageReadinessContext, readinessArm } from '../../../testSurface/surface/readiness/readiness.model.js';
17
18
  import { FieldErrors } from '../../../testSurface/surface/test/fields.js';
18
- import { SaveStatus } from '../../../testSurface/surface/readiness/SaveStatus.js';
19
- import { createApi } from '../../../testSurface/api.js';
20
- import { useTransition } from '../../../testSurface/surface/readiness/useTransition.js';
21
- /** One session stays mounted across Collection, all page steps and Review. */ export function PageWizard({ id, surface }) {
19
+ import { actionWaitMessage, SaveStatus } from '../../../testSurface/surface/readiness/SaveStatus.js';
20
+ import { availableActions } from '../../../testSurface/actions/actions.model.js';
21
+ import { ConfirmAction } from '../../../testSurface/surface/readiness/ActionDialogs.js';
22
+ import { Button } from '../../../ui/Button.js';
23
+ import { Banner } from '../../../ui/Feedback.js';
24
+ import { Select } from '../../../ui/Select.js';
25
+ import './newTest.css';
26
+ /** One session stays mounted across Collection, all page steps and Review. */ export function PageWizard({ id, surface, kindChip }) {
22
27
  const router = useRouter();
23
28
  const collections = surface.pageCollections ?? [];
29
+ const [copying, setCopying] = useState(false);
30
+ const [confirmation, setConfirmation] = useState(null);
24
31
  const [step, setStep] = useState(collections.length > 1 ? 'collection' : 'control');
25
32
  const test = useTestDocument(id, {
26
33
  apiRoute: surface.apiRoute,
27
- contentLocale: surface.contentLocale,
28
- refetchPreflightOnFocus: step === 'review'
34
+ contentLocale: surface.contentLocale
29
35
  });
30
36
  const testUrl = formatAdminURL({
31
37
  adminRoute: surface.adminRoute,
32
38
  path: `/experiments/${encodeURIComponent(String(id))}`
33
39
  });
34
- const transition = useTransition(test, ()=>router.push(testUrl), surface);
35
40
  useEffect(()=>{
36
41
  if (step === 'review') void test.refreshPreflight();
37
42
  }, [
@@ -49,13 +54,11 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
49
54
  role: "alert",
50
55
  children: test.preflightRead?.message ?? TEST_PAGE.error
51
56
  }),
52
- test.preflightRead?.retry ? /*#__PURE__*/ _jsx("button", {
53
- type: "button",
57
+ test.preflightRead?.retry ? /*#__PURE__*/ _jsx(Button, {
54
58
  onClick: ()=>void test.reload(),
55
59
  children: TEST_PAGE.retry
56
60
  }) : null,
57
- /*#__PURE__*/ _jsx("button", {
58
- type: "button",
61
+ /*#__PURE__*/ _jsx(Button, {
59
62
  onClick: leave,
60
63
  children: C.backToTest
61
64
  })
@@ -74,8 +77,12 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
74
77
  const arm = arms.find((item)=>item.key === step);
75
78
  const ctx = pageReadinessContext(doc, test.preflight, surface);
76
79
  const next = nextStep(test.preflight, ctx);
77
- const ready = readyToStart(test);
78
- const busy = test.hasUnsaved || test.saving === 'saving' || transition.busy;
80
+ const ready = readyToStart(test, surface.editorPlacementMessage);
81
+ const start = ready ? availableActions({
82
+ ...doc,
83
+ canManage: surface.canManage
84
+ }).find((action)=>action.id === 'start') : undefined;
85
+ const busy = test.hasUnsaved || test.saving === 'saving' || copying;
79
86
  const jump = (section, key)=>{
80
87
  if (section === 'versions') setStep(key ?? arms.find((item)=>!item.pageTarget)?.key ?? 'control');
81
88
  else router.push(`${testUrl}#section-${section}`);
@@ -84,46 +91,57 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
84
91
  collection: collection,
85
92
  test: test,
86
93
  armKey: arm.key,
87
- apiRoute: surface.apiRoute
94
+ apiRoute: surface.apiRoute,
95
+ contentLocale: surface.contentLocale,
96
+ standalone: true
88
97
  }, `${collection.slug}/${arm.key}`) : null;
89
98
  return /*#__PURE__*/ _jsxs("div", {
90
99
  className: "xp-new-test xp-page-wizard",
91
100
  children: [
92
- /*#__PURE__*/ _jsx("h2", {
93
- children: step === 'collection' ? C.collection : step === 'review' ? C.review : arm?.kind === 'control' ? C.original : pageStepCopy(arm?.label ?? '')
94
- }),
95
- /*#__PURE__*/ _jsx(SaveStatus, {
96
- test: test,
97
- messageInBlockerList: step === 'review' && !!test.preflight && !test.preflightError
101
+ kindChip?.(busy),
102
+ /*#__PURE__*/ _jsxs("div", {
103
+ className: "xp-page-wizard-heading",
104
+ children: [
105
+ /*#__PURE__*/ _jsx("h2", {
106
+ children: step === 'collection' ? C.collection : step === 'review' ? C.review : arm?.kind === 'control' ? C.original : pageStepCopy(arm?.label ?? '')
107
+ }),
108
+ /*#__PURE__*/ _jsx(SaveStatus, {
109
+ test: test,
110
+ messageInBlockerList: step === 'review' && !!test.preflight && !test.preflightError
111
+ })
112
+ ]
98
113
  }),
99
114
  test.errors._section ? /*#__PURE__*/ _jsx("p", {
100
115
  role: "alert",
101
116
  children: test.errors._section
102
117
  }) : null,
103
- step === 'collection' ? /*#__PURE__*/ _jsxs("fieldset", {
104
- children: [
105
- /*#__PURE__*/ _jsx("legend", {
106
- children: C.collection
107
- }),
108
- collections.map((entry)=>/*#__PURE__*/ _jsxs("label", {
109
- children: [
110
- /*#__PURE__*/ _jsx("input", {
111
- type: "radio",
112
- name: "page-collection",
113
- checked: doc.pageCollection === entry.slug,
114
- disabled: busy,
115
- onChange: ()=>{
116
- test.stage({
117
- pageCollection: entry.slug
118
- });
119
- void test.commit();
120
- }
121
- }),
122
- entry.label
123
- ]
124
- }, entry.slug))
125
- ]
126
- }) : step === 'review' ? /*#__PURE__*/ _jsxs(_Fragment, {
118
+ step === 'collection' ? /*#__PURE__*/ _jsx("div", {
119
+ className: "xp-new-test-collection",
120
+ children: /*#__PURE__*/ _jsxs(Select, {
121
+ id: "xp-wizard-page-type",
122
+ label: C.pageType,
123
+ value: doc.pageCollection ?? '',
124
+ disabled: busy,
125
+ onChange: (event)=>{
126
+ test.stage({
127
+ pageCollection: event.currentTarget.value
128
+ });
129
+ void test.commit();
130
+ },
131
+ children: [
132
+ /*#__PURE__*/ _jsx("option", {
133
+ value: "",
134
+ disabled: true,
135
+ children: C.choosePageType
136
+ }),
137
+ collections.map((entry)=>/*#__PURE__*/ _jsx("option", {
138
+ value: entry.slug,
139
+ children: entry.label
140
+ }, entry.slug))
141
+ ]
142
+ })
143
+ }) : step === 'review' ? /*#__PURE__*/ _jsxs("div", {
144
+ className: "xp-page-wizard-review",
127
145
  children: [
128
146
  /*#__PURE__*/ _jsx("ul", {
129
147
  children: test.preflight?.checks.map((check, index)=>{
@@ -136,8 +154,7 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
136
154
  return sentence && !check.ok ? /*#__PURE__*/ _jsxs("li", {
137
155
  children: [
138
156
  sentence,
139
- label ? /*#__PURE__*/ _jsx("button", {
140
- type: "button",
157
+ label ? /*#__PURE__*/ _jsx(Button, {
141
158
  onClick: ()=>jump(row.section, readinessArm(check.code, check.detail, ctx)),
142
159
  children: label
143
160
  }) : null
@@ -145,34 +162,38 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
145
162
  }, `${check.code}/${index}`) : null;
146
163
  })
147
164
  }),
165
+ !test.statusReadPending && hasBrowserWritablePrimary(test.preflight, doc.metrics?.primary) ? /*#__PURE__*/ _jsx(Banner, {
166
+ tone: "warning",
167
+ children: METRICS_COPY.browserWritablePrimary
168
+ }) : null,
148
169
  ready ? /*#__PURE__*/ _jsx("p", {
149
170
  children: READINESS_COPY.ready
150
171
  }) : null,
151
- /*#__PURE__*/ _jsx("button", {
152
- type: "button",
153
- disabled: busy || test.preflightPending || !test.preflight || ready && (!canStartTest(test) || transition.checking),
154
- onClick: ()=>{
155
- if (ready) void transition.run('start', ()=>createApi(surface.apiRoute).start(id));
156
- else if (next) jump(next.section, next.arm);
157
- },
158
- children: ready ? C.start : C.finishSetup
159
- }),
160
- transition.error ? /*#__PURE__*/ _jsx("p", {
161
- role: "alert",
162
- children: transition.error
172
+ confirmation ? /*#__PURE__*/ _jsx(ConfirmAction, {
173
+ test: test,
174
+ surface: surface,
175
+ action: confirmation,
176
+ winnerLabel: "",
177
+ onClose: ()=>setConfirmation(null),
178
+ onSuccess: leave
163
179
  }) : null
164
180
  ]
165
181
  }) : arm?.kind === 'control' ? /*#__PURE__*/ _jsxs(_Fragment, {
166
182
  children: [
167
183
  /*#__PURE__*/ _jsx("p", {
184
+ className: "xp-new-test-help",
168
185
  children: C.originalHelp
169
186
  }),
170
187
  picker
171
188
  ]
172
- }) : collection ? /*#__PURE__*/ _jsx(CopyRoute, {
189
+ }) : collection && arm ? /*#__PURE__*/ _jsx(CopyRoute, {
173
190
  collection: collection,
191
+ arm: arm,
192
+ test: test,
193
+ surface: surface,
194
+ onBusy: setCopying,
174
195
  children: picker
175
- }) : null,
196
+ }, `${collection.slug}/${arm?.key}`) : null,
176
197
  arm ? /*#__PURE__*/ _jsx(FieldErrors, {
177
198
  test: test,
178
199
  path: `arms.${doc.arms.findIndex((item)=>item.key === arm.key)}.pageTarget`
@@ -180,8 +201,8 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
180
201
  /*#__PURE__*/ _jsxs("div", {
181
202
  className: "xp-new-test-actions",
182
203
  children: [
183
- /*#__PURE__*/ _jsx("button", {
184
- type: "button",
204
+ /*#__PURE__*/ _jsx(Button, {
205
+ variant: "secondary",
185
206
  disabled: busy,
186
207
  onClick: ()=>{
187
208
  const previous = steps[steps.indexOf(step) - 1];
@@ -190,18 +211,28 @@ import { useTransition } from '../../../testSurface/surface/readiness/useTransit
190
211
  },
191
212
  children: C.back
192
213
  }),
193
- /*#__PURE__*/ _jsx("button", {
194
- type: "button",
214
+ /*#__PURE__*/ _jsx(Button, {
215
+ variant: "quiet",
195
216
  disabled: busy,
196
217
  onClick: leave,
197
218
  children: C.backToTest
198
219
  }),
199
- step !== 'review' ? /*#__PURE__*/ _jsx("button", {
200
- type: "button",
220
+ step !== 'review' ? /*#__PURE__*/ _jsx(Button, {
221
+ variant: "primary",
201
222
  disabled: busy || step === 'collection' && !collection,
202
223
  onClick: ()=>setStep(steps[steps.indexOf(step) + 1] ?? 'review'),
203
224
  children: C.next
204
- }) : null
225
+ }) : /*#__PURE__*/ _jsx(Button, {
226
+ variant: "primary",
227
+ disabled: busy || test.preflightPending || !test.preflight || test.statusReadPending || ready && (!start || !canStartTest(test, surface.editorPlacementMessage) || !!actionWaitMessage(test)),
228
+ onClick: (event)=>{
229
+ if (start) {
230
+ event.currentTarget.focus();
231
+ setConfirmation(start);
232
+ } else if (next) jump(next.section, next.arm);
233
+ },
234
+ children: start?.label ?? C.finishSetup
235
+ })
205
236
  ]
206
237
  }),
207
238
  test.errors.pageCollection ? /*#__PURE__*/ _jsx("p", {
@@ -1,11 +1,28 @@
1
- .xp-new-test { max-width: 60rem; padding: var(--xp-space-4); color: var(--xp-text); }
2
- .xp-new-test-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--xp-space-4); }
3
- .xp-new-test-card { display: flex; flex-direction: column; gap: .75rem; padding: 1.5rem; border: 1px solid var(--xp-border-strong); border-radius: .5rem; background: var(--xp-surface); color: var(--xp-text); text-align: left; cursor: pointer; font: inherit; }
4
- .xp-new-test-card strong { font-size: 1.25rem; }
5
- .xp-new-test-card:hover { background: var(--xp-surface-raised); }
6
- .xp-new-test label { display: block; margin-block: .75rem; }
7
- .xp-new-test input:not([type=radio]), .xp-new-test textarea { display: block; width: 100%; max-width: 36rem; padding: .5rem; color: var(--xp-text); background: var(--xp-input-bg); border: 1px solid var(--xp-input-border); font: inherit; }
8
- .xp-new-test-choice span { display: block; margin-left: 1.5rem; }
9
- .xp-new-test-actions { display: flex; gap: 1rem; margin-top: var(--xp-space-4); }
10
-
11
- .xp-new-test .xp-ui-combobox-wrap { max-width: 36rem; }
1
+ .xp-new-test { display: grid; gap: var(--xp-space-4); color: var(--xp-text); font: var(--xp-text-body); }
2
+ .xp-new-test h2 { margin: 0; font: var(--xp-text-title); }
3
+ .xp-new-test p { margin: 0; }
4
+ .xp-new-test-form { display: grid; gap: var(--xp-space-4); max-width: 36rem; }
5
+ .xp-new-test-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--xp-space-3); }
6
+ .xp-new-test-card {
7
+ display: grid; align-content: start; gap: var(--xp-space-2); padding: var(--xp-space-5); text-align: start; cursor: pointer;
8
+ }
9
+ .xp-new-test-card strong { font: var(--xp-text-title); }
10
+ .xp-new-test-card span { color: var(--xp-text-2); }
11
+ .xp-new-test-card:hover { border-color: var(--xp-border-strong); background: var(--xp-surface-2); }
12
+ .xp-new-test-card:focus-visible, .xp-new-test :is(summary, input[type='radio']):focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
13
+ .xp-new-test fieldset { display: grid; gap: var(--xp-space-2); min-width: 0; margin: 0; padding: var(--xp-space-3) var(--xp-space-4); border: 1px solid var(--xp-border-strong); border-radius: var(--xp-radius-control); }
14
+ .xp-new-test fieldset label { cursor: pointer; }
15
+ .xp-new-test input[type='radio'] { margin-inline: 0 var(--xp-space-2); accent-color: var(--xp-accent); }
16
+ .xp-new-test-choice span { display: block; margin-inline-start: var(--xp-space-6); color: var(--xp-text-2); }
17
+ .xp-new-test summary { cursor: pointer; margin-bottom: var(--xp-space-2); }
18
+ .xp-new-test-kind, .xp-new-test-actions { display: flex; gap: var(--xp-space-2); align-items: center; }
19
+ .xp-new-test-actions > .xp-ui-button--primary { margin-inline-start: auto; }
20
+ .xp-new-test-collection { max-width: 16rem; }
21
+ .xp-new-test-help { color: var(--xp-text-2); max-width: 65ch; }
22
+ .xp-page-wizard-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--xp-space-2) var(--xp-space-4); }
23
+ .xp-page-wizard-heading .xp-save-status { color: var(--xp-text-2); font: var(--xp-text-small); }
24
+ .xp-page-wizard-heading .xp-save-status [role='alert'] { color: var(--xp-error); }
25
+ .xp-page-wizard .xp-copy-route { display: grid; gap: var(--xp-space-3); }
26
+ .xp-page-wizard .xp-copy-route ol { margin-block: 0; }
27
+ .xp-page-wizard-review { display: grid; gap: var(--xp-space-3); }
28
+ .xp-page-wizard-review > .xp-ui-button { justify-self: start; }
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { ResultsResponse } from '../../../types/endpoints.js';
3
3
  import type { SectionProps } from '../../../testSurface/surface/contracts.js';
4
4
  import type { ResultsPageParts } from '../../../testSurface/surface/results/ResultsBody.js';
5
- export declare function ResultsHeader({ test, surface, resultsVersion, children, actions, released }: SectionProps & ResultsPageParts): import("react").JSX.Element;
5
+ export declare function ResultsHeader({ test, surface, resultsVersion, children, roundActions, editOnPage, refresh, released }: SectionProps & ResultsPageParts): import("react").JSX.Element;
6
6
  export declare function ReaderResultsShell({ surface, children, data }: {
7
7
  surface: SectionProps['surface'];
8
8
  children: ReactNode;
@@ -1,25 +1,31 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { canStartTest, readyToStart } from '../../../testSurface/readinessRead.js';
3
+ import { canStartTest, hasBrowserWritablePrimary, readyToStart } from '../../../testSurface/readinessRead.js';
4
4
  import { BlockerList } from '../../../testSurface/surface/readiness/BlockerList.js';
5
5
  import { ReadinessReadStatus } from '../../../testSurface/surface/readiness/SaveStatus.js';
6
6
  import { surfaceUrls } from '../../../testSurface/surfaceUrls.js';
7
- import { useEffect, useState } from 'react';
7
+ import { Fragment, useEffect, useState } from 'react';
8
8
  import { formatAdminURL } from 'payload/shared';
9
+ import { useXpStepNav } from '../useXpStepNav.js';
9
10
  import { SurfaceShell } from '../SurfaceShell.js';
10
11
  import { Button } from '../../../ui/Button.js';
11
12
  import { Banner, StatusChip } from '../../../ui/Feedback.js';
12
13
  import { createApi } from '../../../testSurface/api.js';
13
14
  import { availableActions, actionGroupLabel } from '../../../testSurface/actions/actions.model.js';
14
- import { AllocateAction, ConfirmAction } from '../../../testSurface/surface/readiness/ActionDialogs.js';
15
+ import { LifecycleButton, LifecycleDialog } from '../../../testSurface/actions/LifecycleAction.js';
16
+ import { DeleteTestAction } from '../../../testSurface/surface/test/DeleteTest.js';
15
17
  import { READINESS, daysRemaining, displayDate, blockingSteps, pageReadinessContext } from '../../../testSurface/surface/readiness/readiness.model.js';
16
18
  import { READINESS_COPY as R, runningCopy, stoppedCopy, decidedCopy } from '../../../testSurface/copy/readiness.js';
19
+ import { useDateFormatter } from '../../../testSurface/format/useDateFormatter.js';
17
20
  import { RESULTS_COPY as C } from '../../../testSurface/copy/results.js';
21
+ import { METRICS_COPY } from '../../../testSurface/copy/metrics.js';
18
22
  import { TEST_PAGE } from '../../../testSurface/copy/testPage.js';
19
- export function ResultsHeader({ test, surface, resultsVersion, children, actions, released }) {
23
+ export function ResultsHeader({ test, surface, resultsVersion, children, roundActions, editOnPage, refresh, released }) {
24
+ const formatDate = useDateFormatter();
20
25
  const doc = test.doc;
21
26
  const [selected, setSelected] = useState(null);
22
- const [people, setPeople] = useState(null);
27
+ const [audience, setAudience] = useState();
28
+ const people = audience?.phase === doc.phase ? audience?.people ?? null : null;
23
29
  useEffect(()=>{
24
30
  let active = true;
25
31
  if (surface.canReadResults && doc.status === 'running') {
@@ -27,7 +33,10 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
27
33
  doc.id
28
34
  ]).then((result)=>{
29
35
  const count = result.ok ? result.data?.[doc.id]?.exposures : undefined;
30
- if (active && typeof count === 'number' && Number.isFinite(count)) setPeople(count);
36
+ if (active && typeof count === 'number' && Number.isFinite(count)) setAudience({
37
+ phase: doc.phase,
38
+ people: count
39
+ });
31
40
  }).catch(()=>{});
32
41
  }
33
42
  return ()=>{
@@ -36,6 +45,7 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
36
45
  }, [
37
46
  doc.id,
38
47
  doc.status,
48
+ doc.phase,
39
49
  surface.apiRoute,
40
50
  surface.canReadResults,
41
51
  resultsVersion
@@ -43,56 +53,62 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
43
53
  const decision = doc.decision;
44
54
  const winner = actionGroupLabel(decision?.winnerArm ?? 'control', doc.arms.find((item)=>item.key === decision?.winnerArm)?.label);
45
55
  const available = availableActions({
46
- status: doc.status,
47
- kind: doc.kind,
48
- arms: doc.arms,
56
+ ...doc,
49
57
  decision,
50
- canManage: surface.canManage
51
- }).filter((action)=>doc.status === 'running' ? [
52
- 'allocate',
53
- 'stop'
54
- ].includes(action.id) : action.id !== 'decide').sort((a, b)=>doc.status === 'running' ? [
55
- 'allocate',
56
- 'stop'
57
- ].indexOf(a.id) - [
58
- 'allocate',
59
- 'stop'
60
- ].indexOf(b.id) : 0);
58
+ canManage: surface.canManage,
59
+ canReadResults: surface.canReadResults
60
+ });
61
61
  const setup = doc.status === 'draft' || doc.status === 'stopped';
62
62
  const blockers = blockingSteps(test.preflight, pageReadinessContext(doc, test.preflight, surface));
63
63
  const ready = readyToStart(test);
64
64
  const startReason = test.preflightError ?? blockers[0]?.sentence ?? (!ready ? R.checking : undefined);
65
- const action = available.find((item)=>item.id === selected);
66
- const sentence = doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'stopped' ? stoppedCopy(displayDate(doc.stoppedAt)) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : doc.status === 'archived' ? R.archived : null;
65
+ const sentence = test.statusReadPending ? R.checking : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt, formatDate), people, daysRemaining(doc, Date.now())) : doc.status === 'stopped' ? stoppedCopy(displayDate(doc.stoppedAt, formatDate)) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt, formatDate), winner) : doc.status === 'archived' ? R.archived : null;
67
66
  const testURL = formatAdminURL({
68
67
  adminRoute: surface.adminRoute,
69
68
  path: `/experiments/${encodeURIComponent(String(doc.id))}`
70
69
  });
70
+ const pageEditors = [
71
+ ...new Set(test.preflight?.pagePlacements?.flatMap((page)=>page.editorUrl ? [
72
+ page.editorUrl
73
+ ] : []) ?? [])
74
+ ];
75
+ const pageEditor = pageEditors.length ? /*#__PURE__*/ _jsx(Button, {
76
+ size: "sm",
77
+ href: pageEditors.length === 1 ? pageEditors[0] : `${testURL}#section-versions`,
78
+ children: TEST_PAGE.editOnPage
79
+ }) : null;
80
+ const crumbs = [
81
+ {
82
+ label: C.tests,
83
+ url: surfaceUrls.home(surface.adminRoute)
84
+ },
85
+ {
86
+ label: doc.name,
87
+ url: testURL
88
+ },
89
+ {
90
+ label: C.results
91
+ }
92
+ ];
93
+ useXpStepNav(crumbs);
71
94
  return /*#__PURE__*/ _jsxs(SurfaceShell, {
72
95
  adminRoute: surface.adminRoute,
73
96
  title: doc.name,
74
- crumbs: [
75
- {
76
- label: C.tests,
77
- href: surface.canManage ? surfaceUrls.home(surface.adminRoute) : undefined
78
- },
79
- {
80
- label: doc.name,
81
- href: testURL
82
- },
83
- {
84
- label: C.results
85
- }
86
- ],
97
+ dynamicTitle: true,
98
+ className: "xp-results-shell",
99
+ crumbs: crumbs.map(({ label, url })=>({
100
+ label,
101
+ href: url
102
+ })),
87
103
  status: /*#__PURE__*/ _jsxs(_Fragment, {
88
104
  children: [
89
105
  /*#__PURE__*/ _jsx("span", {
90
106
  className: "xp-tests-kind",
91
107
  children: TEST_PAGE.kinds[doc.kind]
92
108
  }),
93
- /*#__PURE__*/ _jsx(StatusChip, {
109
+ !test.statusReadPending ? /*#__PURE__*/ _jsx(StatusChip, {
94
110
  status: doc.status
95
- })
111
+ }) : null
96
112
  ]
97
113
  }),
98
114
  subtitle: /*#__PURE__*/ _jsxs(_Fragment, {
@@ -109,21 +125,31 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
109
125
  ]
110
126
  }),
111
127
  actions: /*#__PURE__*/ _jsxs("div", {
112
- className: "xp-ui-button-group",
128
+ className: "xp-results-header-actions xp-ui-button-group",
113
129
  children: [
114
130
  /*#__PURE__*/ _jsx(Button, {
115
- variant: "quiet",
131
+ size: "sm",
116
132
  href: testURL,
117
133
  children: C.backToSetup
118
134
  }),
119
- available.map((item)=>/*#__PURE__*/ _jsx(Button, {
120
- variant: item.tone === 'danger' ? 'danger' : 'secondary',
121
- disabled: item.id === 'start' && !canStartTest(test) || !!selected || test.hasUnsaved || test.saving === 'saving' || item.id === 'allocate' && doc.allocation >= 100,
122
- title: item.id === 'start' ? startReason : item.id === 'allocate' && doc.allocation >= 100 ? R.everyone : undefined,
123
- onClick: ()=>setSelected(item.id),
124
- children: item.id === 'allocate' ? R.allocate : item.label
125
- }, item.id)),
126
- actions
135
+ editOnPage ?? pageEditor,
136
+ refresh,
137
+ !test.statusReadPending && available.map((item)=>{
138
+ if (item.id === 'decide' || item.id === 'release-pages') return /*#__PURE__*/ _jsx(Fragment, {
139
+ children: roundActions[item.id]
140
+ }, item.id);
141
+ if (item.id === 'delete') return /*#__PURE__*/ _jsx(DeleteTestAction, {
142
+ test: test,
143
+ surface: surface
144
+ }, item.id);
145
+ return /*#__PURE__*/ _jsx(LifecycleButton, {
146
+ action: item,
147
+ disabled: item.id === 'start' && !canStartTest(test),
148
+ reason: item.id === 'start' ? startReason : item.unavailable,
149
+ showReason: item.id !== 'start',
150
+ onClick: ()=>setSelected(item)
151
+ }, item.id);
152
+ })
127
153
  ]
128
154
  }),
129
155
  children: [
@@ -138,16 +164,15 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
138
164
  setup ? /*#__PURE__*/ _jsx(BlockerList, {
139
165
  steps: blockers
140
166
  }) : null,
167
+ !test.statusReadPending && setup && hasBrowserWritablePrimary(test.preflight, doc.metrics?.primary) ? /*#__PURE__*/ _jsx(Banner, {
168
+ tone: "warning",
169
+ children: METRICS_COPY.browserWritablePrimary
170
+ }) : null,
141
171
  children,
142
- action?.id === 'allocate' ? /*#__PURE__*/ _jsx(AllocateAction, {
172
+ selected ? /*#__PURE__*/ _jsx(LifecycleDialog, {
143
173
  test: test,
144
174
  surface: surface,
145
- onClose: ()=>setSelected(null)
146
- }) : action ? /*#__PURE__*/ _jsx(ConfirmAction, {
147
- test: test,
148
- surface: surface,
149
- action: action,
150
- winnerLabel: winner,
175
+ action: selected,
151
176
  onClose: ()=>setSelected(null)
152
177
  }) : null
153
178
  ]
@@ -156,21 +181,28 @@ export function ResultsHeader({ test, surface, resultsVersion, children, actions
156
181
  export function ReaderResultsShell({ surface, children, data }) {
157
182
  // CORE-48 sends a missing name as an empty string.
158
183
  const title = data?.experiment?.name?.trim() || C.test;
184
+ const crumbs = [
185
+ {
186
+ label: C.tests,
187
+ url: surface.canManage ? surfaceUrls.home(surface.adminRoute) : undefined
188
+ },
189
+ {
190
+ label: title
191
+ },
192
+ {
193
+ label: C.results
194
+ }
195
+ ];
196
+ useXpStepNav(crumbs);
159
197
  return /*#__PURE__*/ _jsx(SurfaceShell, {
160
198
  adminRoute: surface.adminRoute,
161
199
  title: title,
162
- crumbs: [
163
- {
164
- label: C.tests,
165
- href: surface.canManage ? surfaceUrls.home(surface.adminRoute) : undefined
166
- },
167
- {
168
- label: title
169
- },
170
- {
171
- label: C.results
172
- }
173
- ],
200
+ dynamicTitle: Boolean(data?.experiment?.name?.trim()),
201
+ className: "xp-results-shell",
202
+ crumbs: crumbs.map(({ label, url })=>({
203
+ label,
204
+ href: url
205
+ })),
174
206
  children: children
175
207
  });
176
208
  }
@@ -32,6 +32,17 @@
32
32
  .xp-tests-kind { display: inline-flex; align-items: center; height: 22px; padding-inline: var(--xp-space-2); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-chip); color: var(--xp-text-2); font: 500 12px/18px var(--xp-font); white-space: nowrap; }
33
33
  .xp-tests-row-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--xp-space-1) 14px; margin-top: var(--xp-space-1); color: var(--xp-text-2); font: 400 14px/20px var(--xp-font); }
34
34
  .xp-tests-row-action { justify-self: end; }
35
+ .xp-tests-row-actions { position: relative; align-items: center; }
36
+ .xp-tests-row-menu-trigger { width: 36px; padding-inline: 0; }
37
+ .xp-tests-row-menu-items { position: absolute; inset-inline-end: 0; top: calc(100% + var(--xp-space-1)); z-index: 2; display: grid; width: min(16rem, calc(100vw - 2rem)); padding: var(--xp-space-1); border: 1px solid var(--xp-border-strong); border-radius: var(--xp-radius-control); background: var(--xp-surface); }
38
+ .xp-tests-menu-item { display: grid; min-height: 36px; padding: var(--xp-space-2); text-align: start; font: var(--xp-text-body); color: var(--xp-text); background: transparent; border: 0; border-radius: var(--xp-radius-control); cursor: pointer; }
39
+ .xp-tests-menu-item--primary { color: var(--xp-accent-fg); background: var(--xp-accent); }
40
+ .xp-tests-menu-item--primary:hover, .xp-tests-menu-item--primary:focus-visible { background: var(--xp-accent-hover); }
41
+ .xp-tests-menu-item--danger { color: var(--xp-error); }
42
+ .xp-tests-menu-item[aria-disabled='true'] { cursor: not-allowed; }
43
+ .xp-tests-menu-item:not(.xp-tests-menu-item--primary):is(:hover, :focus-visible) { background: var(--xp-surface-2); }
44
+ .xp-tests-menu-item:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: -2px; }
45
+ .xp-tests-menu-item > .xp-ui-help { margin: 0; }
35
46
  .xp-tests-health { display: inline-flex; align-items: center; gap: 7px; font: 500 13px/18px var(--xp-font); }
36
47
  .xp-tests-health::before { content: ''; width: var(--xp-space-2); height: var(--xp-space-2); border-radius: 50%; flex: none; }
37
48
  .xp-tests-health--red::before { background: var(--xp-error); }
@@ -52,6 +63,7 @@
52
63
  .xp-tests-search { width: 100%; }
53
64
  .xp-tests-row { grid-template-columns: minmax(0, 1fr); }
54
65
  .xp-tests-row-action { justify-self: start; }
66
+ .xp-tests-row-menu-items { inset-inline: 0 auto; }
55
67
  }
56
68
  /* Existing screens retain their controls until their design-system lanes. */
57
69
  .xp-tests-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--xp-space-4); margin-bottom: var(--xp-space-6); }
@@ -62,3 +74,20 @@
62
74
  .xp-tests-shell-heading { min-width: 0; }
63
75
  .xp-tests-shell-subtitle { margin-top: var(--xp-space-2); color: var(--xp-text-2); font: var(--xp-text-small); }
64
76
  .xp-tests-shell-subtitle p { margin: 0; }
77
+
78
+ .xp-results-header-actions { align-items: flex-start; }
79
+ .xp-results-refresh { display: flex; align-items: center; gap: var(--xp-space-2); }
80
+ .xp-results-refresh > .xp-ui-help { margin: 0; white-space: nowrap; }
81
+ @media (min-width: 900px) {
82
+ .xp-results-shell .xp-tests-shell-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--xp-space-2) var(--xp-space-4); }
83
+ .xp-results-shell .xp-tests-shell-heading { display: contents; }
84
+ .xp-results-shell .xp-tests-shell-title { grid-row: 1; grid-column: 1; }
85
+ .xp-results-shell .xp-tests-shell-actions { grid-row: 1; grid-column: 2; }
86
+ .xp-results-shell .xp-tests-shell-subtitle { grid-row: 2; grid-column: 1 / -1; margin: 0; }
87
+ .xp-results-header-actions { flex-wrap: nowrap; }
88
+ .xp-results-header-actions .xp-ui-button { white-space: nowrap; }
89
+ }
90
+ @media (max-width: 899px) {
91
+ .xp-results-shell .xp-tests-shell-main { flex-direction: column; gap: var(--xp-space-3); }
92
+ .xp-results-shell .xp-tests-shell-actions { justify-content: flex-start; }
93
+ }