@delmaredigital/payload-experiments 0.4.0-rc.3 → 0.4.0-rc.5

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 (340) hide show
  1. package/dist/admin/LayerUsage.js +1 -1
  2. package/dist/admin/MetricSourceSelect.js +2 -2
  3. package/dist/admin/PlacementStatus.js +1 -1
  4. package/dist/admin/TestsDashboardCards.js +2 -2
  5. package/dist/admin/TestsNavLink.js +2 -2
  6. package/dist/admin/blocks/BlockPanel.js +3 -3
  7. package/dist/admin/blocks/TestBlockField.js +3 -3
  8. package/dist/admin/blocks/formApi.js +1 -1
  9. package/dist/admin/blocks/model.js +1 -1
  10. package/dist/admin/blocks/statusCache.js +1 -1
  11. package/dist/admin/components/RootViewMessage.js +1 -1
  12. package/dist/admin/copy/blocks.d.ts +2 -2
  13. package/dist/admin/copy/blocks.js +3 -2
  14. package/dist/admin/copy/goals.d.ts +5 -1
  15. package/dist/admin/copy/goals.js +9 -3
  16. package/dist/admin/goals/XpGoalField.js +155 -129
  17. package/dist/admin/goals/xpGoalField.css +2 -3
  18. package/dist/admin/status.model.js +1 -1
  19. package/dist/admin/surface/ResultsRoute.d.ts +2 -1
  20. package/dist/admin/surface/ResultsRoute.js +6 -13
  21. package/dist/admin/surface/SurfaceShell.js +2 -2
  22. package/dist/admin/surface/TestsHome.d.ts +1 -1
  23. package/dist/admin/surface/TestsHome.js +3 -3
  24. package/dist/admin/surface/TestsSurface.js +2 -2
  25. package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
  26. package/dist/admin/surface/goals/GoalForm.js +55 -7
  27. package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
  28. package/dist/admin/surface/goals/GoalsList.js +4 -4
  29. package/dist/admin/surface/goals/data.js +2 -2
  30. package/dist/admin/surface/goals/goals.css +7 -0
  31. package/dist/admin/surface/goals/goals.model.d.ts +11 -1
  32. package/dist/admin/surface/goals/goals.model.js +43 -0
  33. package/dist/admin/surface/home.model.d.ts +1 -1
  34. package/dist/admin/surface/home.model.js +5 -5
  35. package/dist/admin/surface/newTest/NewTest.d.ts +1 -1
  36. package/dist/admin/surface/newTest/NewTest.js +1 -1
  37. package/dist/admin/surface/newTest/PageWizard.d.ts +1 -1
  38. package/dist/admin/surface/newTest/PageWizard.js +23 -25
  39. package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
  40. package/dist/admin/surface/results/ResultsHeader.js +22 -15
  41. package/dist/admin/surface/test/TestPage.d.ts +1 -2
  42. package/dist/admin/surface/test/TestPage.js +45 -156
  43. package/dist/admin/views/ExperimentsRootView.js +1 -1
  44. package/dist/admin/views/TestsNavLinkServer.js +1 -1
  45. package/dist/admin/views/renderCollectionList.js +1 -1
  46. package/dist/admin/views/renderTestsSurface.js +1 -1
  47. package/dist/blocks/placementLocale.d.ts +21 -0
  48. package/dist/blocks/placementLocale.js +115 -0
  49. package/dist/collections/experiments/config.js +1 -1
  50. package/dist/collections/metrics.js +1 -1
  51. package/dist/db/bulkPlacementRemoval.d.ts +30 -0
  52. package/dist/db/bulkPlacementRemoval.js +107 -0
  53. package/dist/db/placements.d.ts +2 -0
  54. package/dist/db/placements.js +8 -0
  55. package/dist/endpoints/editorSurface.d.ts +3 -0
  56. package/dist/endpoints/editorSurface.js +31 -0
  57. package/dist/endpoints/index.js +28 -1
  58. package/dist/errors.d.ts +1 -0
  59. package/dist/errors.js +2 -0
  60. package/dist/fields/xpGoal.js +1 -1
  61. package/dist/goals/fairness.d.ts +1 -1
  62. package/dist/goals/fairness.js +1 -1
  63. package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
  64. package/dist/goals/picker/clickGoalPicker.model.js +20 -2
  65. package/dist/goals/picker/copy.d.ts +4 -2
  66. package/dist/goals/picker/copy.js +4 -2
  67. package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
  68. package/dist/goals/picker/useClickGoalPicker.js +4 -2
  69. package/dist/hooks/blockRemovalRule.d.ts +29 -0
  70. package/dist/hooks/blockRemovalRule.js +141 -0
  71. package/dist/hooks/pageGuard.d.ts +24 -2
  72. package/dist/hooks/pageGuard.js +178 -24
  73. package/dist/lib/placementPages.d.ts +9 -0
  74. package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +1 -4
  75. package/dist/onInit.js +22 -0
  76. package/dist/plugin.js +2 -1
  77. package/dist/puck/ExperimentPicker.js +25 -10
  78. package/dist/puck/copy.d.ts +4 -1
  79. package/dist/puck/copy.js +4 -1
  80. package/dist/puck/editor/ConfigureTestDrawer.d.ts +21 -0
  81. package/dist/puck/editor/ConfigureTestDrawer.js +147 -0
  82. package/dist/puck/editor/CreateExperimentDrawer.d.ts +11 -2
  83. package/dist/puck/editor/CreateExperimentDrawer.js +73 -9
  84. package/dist/puck/editor/EditorControls.d.ts +14 -0
  85. package/dist/puck/editor/EditorControls.js +99 -0
  86. package/dist/puck/editor/ExperimentSlotEditor.js +690 -79
  87. package/dist/puck/editor/LeftoverVersions.d.ts +13 -0
  88. package/dist/puck/editor/LeftoverVersions.js +115 -0
  89. package/dist/puck/editor/PlacementNotice.d.ts +8 -0
  90. package/dist/puck/editor/PlacementNotice.js +22 -0
  91. package/dist/puck/editor/QuickTestActions.d.ts +3 -0
  92. package/dist/puck/editor/QuickTestActions.js +50 -0
  93. package/dist/puck/editor/ResultsReadout.js +8 -5
  94. package/dist/puck/editor/VersionBuilder.d.ts +20 -6
  95. package/dist/puck/editor/VersionBuilder.js +80 -50
  96. package/dist/puck/editor/armWrites.d.ts +3 -1
  97. package/dist/puck/editor/armWrites.js +2 -1
  98. package/dist/puck/editor/armsCache.d.ts +3 -1
  99. package/dist/puck/editor/armsCache.js +20 -3
  100. package/dist/puck/editor/cloneSlot.d.ts +2 -0
  101. package/dist/puck/editor/cloneSlot.js +7 -0
  102. package/dist/puck/editor/copy.d.ts +42 -5
  103. package/dist/puck/editor/copy.js +43 -6
  104. package/dist/puck/editor/editor.chrome.css +44 -0
  105. package/dist/puck/editor/editor.css +68 -0
  106. package/dist/puck/editor/editor.model.d.ts +14 -0
  107. package/dist/puck/editor/editor.model.js +58 -1
  108. package/dist/puck/editor/editorSurface.d.ts +10 -0
  109. package/dist/puck/editor/editorSurface.js +65 -0
  110. package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
  111. package/dist/puck/editor/localPlacements.d.ts +2 -0
  112. package/dist/puck/editor/localPlacements.js +29 -0
  113. package/dist/puck/editor/outlineVersion.d.ts +5 -0
  114. package/dist/puck/editor/outlineVersion.js +36 -0
  115. package/dist/puck/editor/placementsCache.d.ts +50 -0
  116. package/dist/puck/editor/placementsCache.js +258 -0
  117. package/dist/puck/editor/sidebar.d.ts +12 -0
  118. package/dist/puck/editor/sidebar.js +77 -0
  119. package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
  120. package/dist/puck/editor/usePlacementNotice.js +14 -0
  121. package/dist/puck/editor/xpGoalPuckEditorField.js +109 -98
  122. package/dist/puck/experimentSlotField.d.ts +3 -0
  123. package/dist/puck/experimentSlotField.js +15 -4
  124. package/dist/{admin → testSurface}/actions/DecideDialog.d.ts +2 -1
  125. package/dist/{admin → testSurface}/actions/DecideDialog.js +6 -4
  126. package/dist/{admin → testSurface}/api.js +5 -6
  127. package/dist/{admin → testSurface}/copy/common.d.ts +3 -1
  128. package/dist/{admin → testSurface}/copy/common.js +5 -1
  129. package/dist/{admin → testSurface}/copy/readiness.d.ts +20 -1
  130. package/dist/{admin → testSurface}/copy/readiness.js +25 -1
  131. package/dist/{admin → testSurface}/copy/testPage.d.ts +4 -0
  132. package/dist/{admin → testSurface}/copy/testPage.js +8 -2
  133. package/dist/testSurface/format/adminURL.d.ts +7 -0
  134. package/dist/testSurface/format/adminURL.js +9 -0
  135. package/dist/{admin → testSurface}/placements/placementLabels.js +1 -1
  136. package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
  137. package/dist/testSurface/previewLinks.model.js +4 -0
  138. package/dist/testSurface/readPreflight.d.ts +9 -0
  139. package/dist/testSurface/readPreflight.js +38 -0
  140. package/dist/testSurface/readinessRead.d.ts +50 -0
  141. package/dist/testSurface/readinessRead.js +46 -0
  142. package/dist/testSurface/results/results.css +64 -0
  143. package/dist/{admin → testSurface}/surface/contracts.d.ts +7 -2
  144. package/dist/testSurface/surface/editorPlacement.d.ts +21 -0
  145. package/dist/testSurface/surface/editorPlacement.js +60 -0
  146. package/dist/{admin → testSurface}/surface/pageBlock/parts.js +19 -9
  147. package/dist/testSurface/surface/pagePicker/pagePicker.css +10 -0
  148. package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.js +37 -7
  149. package/dist/testSurface/surface/readiness/Banner.d.ts +2 -0
  150. package/dist/{admin → testSurface}/surface/readiness/Banner.js +106 -68
  151. package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
  152. package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
  153. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +9 -0
  154. package/dist/testSurface/surface/readiness/SaveStatus.js +66 -0
  155. package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
  156. package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +13 -0
  157. package/dist/{admin → testSurface}/surface/readiness/readiness.model.js +51 -36
  158. package/dist/{admin → testSurface}/surface/readiness/useTransition.d.ts +5 -2
  159. package/dist/testSurface/surface/readiness/useTransition.js +98 -0
  160. package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +2 -2
  161. package/dist/{admin → testSurface}/surface/results/ResultsBody.js +18 -11
  162. package/dist/testSurface/surface/setting/setting.css +17 -0
  163. package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +1 -0
  164. package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
  165. package/dist/{admin → testSurface}/surface/test/GoalSection.js +4 -2
  166. package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
  167. package/dist/{admin → testSurface}/surface/test/LengthSection.js +2 -1
  168. package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
  169. package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +1 -2
  170. package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
  171. package/dist/testSurface/surface/test/Section.js +80 -0
  172. package/dist/{admin → testSurface}/surface/test/TargetingSection.js +5 -0
  173. package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
  174. package/dist/testSurface/surface/test/TestSurface.js +213 -0
  175. package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
  176. package/dist/{admin → testSurface}/surface/test/VersionsSection.js +13 -6
  177. package/dist/testSurface/surface/test/testPage.css +104 -0
  178. package/dist/{admin → testSurface}/surface/useTestDocument.d.ts +9 -2
  179. package/dist/{admin → testSurface}/surface/useTestDocument.js +92 -46
  180. package/dist/{admin → testSurface}/surfaceUrls.js +1 -1
  181. package/dist/testSurface/useReadinessPolling.d.ts +3 -0
  182. package/dist/testSurface/useReadinessPolling.js +24 -0
  183. package/dist/transitions/placementInteractions.js +1 -1
  184. package/dist/transitions/placements.d.ts +27 -8
  185. package/dist/transitions/placements.js +77 -6
  186. package/dist/transitions/preflightData.js +1 -1
  187. package/dist/transitions/start.js +2 -2
  188. package/dist/types/endpoints.d.ts +1 -1
  189. package/dist/ui/Card.d.ts +2 -1
  190. package/dist/ui/Card.js +4 -4
  191. package/dist/ui/Dialog.d.ts +4 -1
  192. package/dist/ui/Dialog.js +41 -3
  193. package/dist/ui/Drawer.d.ts +10 -0
  194. package/dist/ui/Drawer.js +29 -0
  195. package/dist/ui/Tabs.d.ts +4 -3
  196. package/dist/ui/Tabs.js +47 -32
  197. package/dist/ui/ui.css +24 -0
  198. package/package.json +1 -1
  199. package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
  200. package/dist/admin/actions/ConfirmDialog.js +0 -149
  201. package/dist/admin/results/results.css +0 -64
  202. package/dist/admin/styles.css +0 -10
  203. package/dist/admin/styles.d.ts +0 -2
  204. package/dist/admin/styles.js +0 -3
  205. package/dist/admin/surface/pagePicker/pagePicker.css +0 -10
  206. package/dist/admin/surface/readiness/Banner.d.ts +0 -5
  207. package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
  208. package/dist/admin/surface/readiness/SaveStatus.js +0 -53
  209. package/dist/admin/surface/readiness/useTransition.js +0 -35
  210. package/dist/admin/surface/setting/setting.css +0 -17
  211. package/dist/admin/surface/test/GoalSection.d.ts +0 -2
  212. package/dist/admin/surface/test/LengthSection.d.ts +0 -2
  213. package/dist/admin/surface/test/Section.js +0 -48
  214. package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
  215. package/dist/admin/surface/test/testPage.css +0 -92
  216. /package/dist/{admin → testSurface}/PreviewLinks.d.ts +0 -0
  217. /package/dist/{admin → testSurface}/PreviewLinks.js +0 -0
  218. /package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +0 -0
  219. /package/dist/{admin → testSurface}/actions/MakeContentResult.js +0 -0
  220. /package/dist/{admin → testSurface}/actions/actions.model.d.ts +0 -0
  221. /package/dist/{admin → testSurface}/actions/actions.model.js +0 -0
  222. /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
  223. /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
  224. /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
  225. /package/dist/{admin → testSurface}/allocation.model.js +0 -0
  226. /package/dist/{admin → testSurface}/api.d.ts +0 -0
  227. /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
  228. /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
  229. /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
  230. /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
  231. /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
  232. /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
  233. /package/dist/{admin → testSurface}/copy/actions.d.ts +0 -0
  234. /package/dist/{admin → testSurface}/copy/actions.js +0 -0
  235. /package/dist/{admin → testSurface}/copy/advanced.d.ts +0 -0
  236. /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
  237. /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
  238. /package/dist/{admin → testSurface}/copy/arms.js +0 -0
  239. /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
  240. /package/dist/{admin → testSurface}/copy/audience.js +0 -0
  241. /package/dist/{admin → testSurface}/copy/metrics.d.ts +0 -0
  242. /package/dist/{admin → testSurface}/copy/metrics.js +0 -0
  243. /package/dist/{admin → testSurface}/copy/pages.d.ts +0 -0
  244. /package/dist/{admin → testSurface}/copy/pages.js +0 -0
  245. /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
  246. /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
  247. /package/dist/{admin → testSurface}/copy/results.d.ts +0 -0
  248. /package/dist/{admin → testSurface}/copy/results.js +0 -0
  249. /package/dist/{admin → testSurface}/copy/review.d.ts +0 -0
  250. /package/dist/{admin → testSurface}/copy/review.js +0 -0
  251. /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
  252. /package/dist/{admin → testSurface}/copy/setting.js +0 -0
  253. /package/dist/{admin → testSurface}/copy/surface.d.ts +0 -0
  254. /package/dist/{admin → testSurface}/copy/surface.js +0 -0
  255. /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
  256. /package/dist/{admin → testSurface}/format/date.js +0 -0
  257. /package/dist/{admin → testSurface}/labels.d.ts +0 -0
  258. /package/dist/{admin → testSurface}/labels.js +0 -0
  259. /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
  260. /package/dist/{admin → testSurface}/lockedNotice.model.js +0 -0
  261. /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
  262. /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
  263. /package/dist/{admin → testSurface}/placements/placementLabels.d.ts +0 -0
  264. /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
  265. /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
  266. /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
  267. /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
  268. /package/dist/{admin → testSurface}/reload.d.ts +0 -0
  269. /package/dist/{admin → testSurface}/reload.js +0 -0
  270. /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
  271. /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
  272. /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
  273. /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
  274. /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
  275. /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
  276. /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
  277. /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
  278. /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
  279. /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
  280. /package/dist/{admin → testSurface}/results/VerdictHero.d.ts +0 -0
  281. /package/dist/{admin → testSurface}/results/VerdictHero.js +0 -0
  282. /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
  283. /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
  284. /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
  285. /package/dist/{admin → testSurface}/results/format.js +0 -0
  286. /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
  287. /package/dist/{admin → testSurface}/results/legacy.js +0 -0
  288. /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
  289. /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
  290. /package/dist/{admin → testSurface}/results/results.model.d.ts +0 -0
  291. /package/dist/{admin → testSurface}/results/results.model.js +0 -0
  292. /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
  293. /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
  294. /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
  295. /package/dist/{admin → testSurface}/review/review.model.js +0 -0
  296. /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
  297. /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
  298. /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.js +0 -0
  299. /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
  300. /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.d.ts +0 -0
  301. /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.js +0 -0
  302. /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.d.ts +0 -0
  303. /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.js +0 -0
  304. /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +0 -0
  305. /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +0 -0
  306. /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +0 -0
  307. /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
  308. /package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +0 -0
  309. /package/dist/{admin → testSurface}/surface/results/ReleasePages.js +0 -0
  310. /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
  311. /package/dist/{admin → testSurface}/surface/results/recommendation.model.js +0 -0
  312. /package/dist/{admin → testSurface}/surface/results/useResults.d.ts +0 -0
  313. /package/dist/{admin → testSurface}/surface/results/useResults.js +0 -0
  314. /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
  315. /package/dist/{admin → testSurface}/surface/setting/parts.js +0 -0
  316. /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
  317. /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
  318. /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
  319. /package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +0 -0
  320. /package/dist/{admin → testSurface}/surface/test/PageHoldout.js +0 -0
  321. /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
  322. /package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +0 -0
  323. /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
  324. /package/dist/{admin → testSurface}/surface/test/fields.d.ts +0 -0
  325. /package/dist/{admin → testSurface}/surface/test/fields.js +0 -0
  326. /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
  327. /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
  328. /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
  329. /package/dist/{admin → testSurface}/surface/test/pageParts.js +0 -0
  330. /package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +0 -0
  331. /package/dist/{admin → testSurface}/surface/test/testPage.model.js +0 -0
  332. /package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +0 -0
  333. /package/dist/{admin → testSurface}/surface/testDocument.model.js +0 -0
  334. /package/dist/{admin → testSurface}/surfaceUrls.d.ts +0 -0
  335. /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
  336. /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
  337. /package/dist/{admin → testSurface}/theme.d.ts +0 -0
  338. /package/dist/{admin → testSurface}/theme.js +0 -0
  339. /package/dist/{admin → testSurface}/useApi.d.ts +0 -0
  340. /package/dist/{admin → testSurface}/useApi.js +0 -0
@@ -0,0 +1,38 @@
1
+ export const PREFLIGHT_TIMEOUT_MS = 15_000;
2
+ /** The answer must support both readiness and placement consumers. */ export function isPreflightResult(value) {
3
+ const data = value;
4
+ return !!data && Array.isArray(data.placements) && Array.isArray(data.checks) && data.checks.every((check)=>check && typeof check.code === 'string' && typeof check.ok === 'boolean');
5
+ }
6
+ /** Bound the response and body read, even when a producer ignores cancellation. */ export async function readPreflight(request, signal) {
7
+ const controller = new AbortController();
8
+ let timer;
9
+ let cancel;
10
+ const cancelled = new Promise((_, reject)=>{
11
+ cancel = ()=>{
12
+ clearTimeout(timer);
13
+ controller.abort();
14
+ reject(new Error('Readiness read cancelled'));
15
+ };
16
+ timer = setTimeout(cancel, PREFLIGHT_TIMEOUT_MS);
17
+ });
18
+ signal.addEventListener('abort', cancel, {
19
+ once: true
20
+ });
21
+ if (signal.aborted) cancel();
22
+ try {
23
+ return await Promise.race([
24
+ cancelled,
25
+ (async ()=>{
26
+ const response = await request(controller.signal);
27
+ const body = await response.json().catch(()=>undefined);
28
+ return {
29
+ response,
30
+ body
31
+ };
32
+ })()
33
+ ]);
34
+ } finally{
35
+ clearTimeout(timer);
36
+ signal.removeEventListener('abort', cancel);
37
+ }
38
+ }
@@ -0,0 +1,50 @@
1
+ import type { PreflightResult } from '../types/endpoints.js';
2
+ export type ReadinessRead = ReturnType<typeof classifyReadinessRead>;
3
+ /** One read policy for every surface. Pending retains this settled value verbatim. */
4
+ export declare function classifyReadinessRead(status: number, body?: unknown, failures?: number, context?: {
5
+ kind: 'document';
6
+ surface?: 'editor';
7
+ resultsOnly?: boolean;
8
+ } | {
9
+ kind: 'readiness' | 'where-used';
10
+ placementNotice?: boolean;
11
+ }): {
12
+ status: number;
13
+ loadState: "forbidden" | "error" | "missing" | "ready";
14
+ kind: string;
15
+ answer: PreflightResult | undefined;
16
+ message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
17
+ failed: boolean;
18
+ retry: boolean;
19
+ pollDelay: number | null;
20
+ };
21
+ /** Legacy callers can supply an answer; producers always supply the classified read. */
22
+ export declare function readinessRead(test: {
23
+ preflight: PreflightResult | null;
24
+ preflightError: string | null;
25
+ preflightRead?: ReadinessRead;
26
+ }): {
27
+ status: number;
28
+ loadState: "forbidden" | "error" | "missing" | "ready";
29
+ kind: string;
30
+ answer: PreflightResult | undefined;
31
+ message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
32
+ failed: boolean;
33
+ retry: boolean;
34
+ pollDelay: number | null;
35
+ };
36
+ /** Settled display is independent of a refresh in progress. */
37
+ export declare function readyToStart(test: {
38
+ preflight: PreflightResult | null;
39
+ preflightError: string | null;
40
+ preflightRead?: ReadinessRead;
41
+ }, placementMessage?: string): boolean;
42
+ /** Pending changes only the ability to fire Start, never the settled display. */
43
+ export declare function canStartTest(test: {
44
+ preflight: PreflightResult | null;
45
+ preflightError: string | null;
46
+ preflightRead?: ReadinessRead;
47
+ preflightPending: boolean;
48
+ hasUnsaved: boolean;
49
+ saving: string;
50
+ }, placementMessage?: string): boolean;
@@ -0,0 +1,46 @@
1
+ import { API_MESSAGES } from './copy/common.js';
2
+ import { PLACEMENT_FAILURE_COPY, READINESS_COPY, placementFailureCopy } from './copy/readiness.js';
3
+ import { TEST_PAGE } from './copy/testPage.js';
4
+ import { editorCopy } from '../puck/editor/copy.js';
5
+ import { pickerCopy } from '../puck/copy.js';
6
+ import { isPreflightResult } from './readPreflight.js';
7
+ /** One read policy for every surface. Pending retains this settled value verbatim. */ export function classifyReadinessRead(status, body, failures = 1, context = {
8
+ kind: 'readiness'
9
+ }) {
10
+ const document = context.kind === 'document';
11
+ const answer = !document && status === 200 && isPreflightResult(body) ? body : undefined;
12
+ const detail = answer?.checks.find((check)=>!check.ok && (check.code === 'no-placements' && check.detail !== undefined || check.code === 'flag-placement-missing' && typeof check.detail === 'string'))?.detail;
13
+ const kind = status === 401 ? 'signed-out' : status === 404 || detail === 'not-found' ? 'not-found' : status === 403 || detail === 'forbidden' ? 'no-access' : status === 400 || status === 501 ? 'permanent' : answer ? 'answered' : 'failed';
14
+ const failed = kind === 'failed' || kind === 'answered' && detail !== undefined;
15
+ const retry = failed;
16
+ const message = kind === 'signed-out' ? API_MESSAGES.unauthenticated : kind === 'not-found' ? answer ? PLACEMENT_FAILURE_COPY['not-found'] : document && context.surface === 'editor' ? pickerCopy.unavailable : API_MESSAGES.notFound : kind === 'no-access' ? document ? context.surface === 'editor' ? context.resultsOnly ? pickerCopy.resultsOnly : pickerCopy.forbidden : TEST_PAGE.forbidden : PLACEMENT_FAILURE_COPY.forbidden : kind === 'permanent' ? status === 501 ? API_MESSAGES.notImplemented : document ? context.surface === 'editor' ? editorCopy.loadError : TEST_PAGE.error : READINESS_COPY.invalidRequest : kind === 'failed' ? document ? context.surface === 'editor' ? editorCopy.loadError : TEST_PAGE.error : READINESS_COPY.checkError : detail !== undefined ? placementFailureCopy(detail) : undefined;
17
+ // Subscribers determine whether save/publish guidance is displayed. Its polling
18
+ // eligibility is classified here, alongside permanent and temporary failures.
19
+ const placementNotice = !document && (context.placementNotice ?? context.kind === 'where-used');
20
+ const pollDelay = retry ? [
21
+ 4_000,
22
+ 8_000,
23
+ 16_000,
24
+ 30_000
25
+ ][Math.min(Math.max(0, failures - 1), 3)] : kind === 'answered' && placementNotice ? 4_000 : null;
26
+ const loadState = kind === 'not-found' ? 'missing' : kind === 'signed-out' || kind === 'no-access' ? 'forbidden' : kind === 'failed' || kind === 'permanent' ? 'error' : 'ready';
27
+ return {
28
+ status,
29
+ loadState,
30
+ kind,
31
+ answer,
32
+ message,
33
+ failed,
34
+ retry,
35
+ pollDelay
36
+ };
37
+ }
38
+ /** Legacy callers can supply an answer; producers always supply the classified read. */ export function readinessRead(test) {
39
+ return test.preflightRead ?? classifyReadinessRead(test.preflightError ? 0 : 200, test.preflight);
40
+ }
41
+ /** Settled display is independent of a refresh in progress. */ export function readyToStart(test, placementMessage) {
42
+ return !!test.preflight && !placementMessage && readinessRead(test).kind === 'answered' && !test.preflightError && test.preflight.checks.every((check)=>check.ok);
43
+ }
44
+ /** Pending changes only the ability to fire Start, never the settled display. */ export function canStartTest(test, placementMessage) {
45
+ return readyToStart(test, placementMessage) && !test.preflightPending && !test.hasUnsaved && test.saving !== 'saving';
46
+ }
@@ -0,0 +1,64 @@
1
+ :where(.xp-test-surface) .xp-results { max-width: 1120px; display: grid; gap: var(--xp-space-8); min-width: 0; }
2
+ :where(.xp-test-surface) .xp-results h2, :where(.xp-test-surface) .xp-results h3, :where(.xp-test-surface) .xp-results p { margin: 0; }
3
+ :where(.xp-test-surface) .xp-verdict-hero { background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); padding: 28px; min-width: 0; }
4
+ :where(.xp-test-surface) .xp-verdict-hero h2 { font: var(--xp-text-display); letter-spacing: -0.01em; max-width: 36ch; }
5
+ :where(.xp-test-surface) .xp-verdict-hero p { margin-top: var(--xp-space-2); color: var(--xp-text-2); }
6
+ :where(.xp-test-surface) .xp-verdict-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--xp-space-3); margin-top: var(--xp-space-5); padding-top: var(--xp-space-4); border-top: 1px solid var(--xp-border); color: var(--xp-text-3); font: var(--xp-text-small); }
7
+ :where(.xp-test-surface) .xp-round-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
8
+ :where(.xp-test-surface) .xp-round-meta .xp-ui-field { display: flex; align-items: center; gap: var(--xp-space-2); margin: 0; min-width: 0; }
9
+ :where(.xp-test-surface) .xp-round-meta select { width: auto; max-width: 100%; }
10
+ :where(.xp-test-surface) .xp-results-chips { display: flex; flex-wrap: wrap; gap: var(--xp-space-2); list-style: none; padding: 0; margin-bottom: 0; }
11
+ :where(.xp-test-surface) .xp-stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); overflow: hidden; }
12
+ :where(.xp-test-surface) .xp-stat-tile { padding: 20px; min-width: 0; }
13
+ :where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 1px solid var(--xp-border); }
14
+ :where(.xp-test-surface) .xp-stat-tile-label, :where(.xp-test-surface) .xp-stat-tile-detail { font: var(--xp-text-small); color: var(--xp-text-2); }
15
+ :where(.xp-test-surface) .xp-stat-tile-value { margin-top: 6px; font: 600 32px/36px var(--xp-font); font-variant-numeric: tabular-nums; }
16
+ :where(.xp-test-surface) .xp-stat-tile-detail { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
17
+ :where(.xp-test-surface) .xp-results-block { min-width: 0; }
18
+ :where(.xp-test-surface) .xp-results-block-head { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
19
+ :where(.xp-test-surface) .xp-results-block-head h2 { font: var(--xp-text-title); }
20
+ :where(.xp-test-surface) .xp-results-block-meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--xp-text-2); }
21
+ :where(.xp-test-surface) .xp-data-table-frame { position: relative; min-width: 0; border-radius: var(--xp-radius-card); }
22
+ :where(.xp-test-surface) .xp-data-table-wrap { overflow-x: auto; overflow-y: auto; max-height: 70vh; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); }
23
+ :where(.xp-test-surface) .xp-data-table-wrap:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
24
+ /* Overlays stay visible above opaque sticky headers and the highlighted row. */
25
+ :where(.xp-test-surface) .xp-data-table-frame::before, :where(.xp-test-surface) .xp-data-table-frame::after { content: ''; position: absolute; top: 1px; bottom: 1px; width: var(--xp-space-6); z-index: 3; pointer-events: none; opacity: 0; }
26
+ :where(.xp-test-surface) .xp-data-table-frame::before { left: 1px; border-radius: var(--xp-radius-card) 0 0 var(--xp-radius-card); background: linear-gradient(to right, var(--xp-border-strong), transparent); }
27
+ :where(.xp-test-surface) .xp-data-table-frame::after { right: 1px; border-radius: 0 var(--xp-radius-card) var(--xp-radius-card) 0; background: linear-gradient(to left, var(--xp-border-strong), transparent); }
28
+ :where(.xp-test-surface) .xp-data-table-frame.has-left::before, :where(.xp-test-surface) .xp-data-table-frame.has-right::after { opacity: 1; }
29
+ :where(.xp-test-surface) .xp-data-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 14px/20px var(--xp-font); }
30
+ :where(.xp-test-surface) .xp-data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
31
+ :where(.xp-test-surface) .xp-data-table th, :where(.xp-test-surface) .xp-data-table td { padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid var(--xp-border); text-align: left; }
32
+ :where(.xp-test-surface) .xp-data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--xp-surface); font: var(--xp-text-small); color: var(--xp-text-2); }
33
+ :where(.xp-test-surface) .xp-data-table tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--xp-surface); }
34
+ :where(.xp-test-surface) .xp-data-table thead tr > :first-child { z-index: 2; }
35
+ :where(.xp-test-surface) .xp-data-table tbody th { font-weight: 400; }
36
+ :where(.xp-test-surface) .xp-data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
37
+ :where(.xp-test-surface) .xp-data-table .muted { color: var(--xp-text-3); }
38
+ :where(.xp-test-surface) .xp-data-table tr:last-child > * { border-bottom: 0; }
39
+ :where(.xp-test-surface) .xp-data-table tr.is-lead > * { background: var(--xp-surface-2); font-weight: 600; }
40
+ :where(.xp-test-surface) .xp-results-group { display: inline-flex; align-items: center; gap: 8px; }
41
+ :where(.xp-test-surface) .xp-results-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
42
+ :where(.xp-test-surface) .xp-results-panel { border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); min-width: 0; }
43
+ :where(.xp-test-surface) .xp-results-panel > summary { padding: 16px 20px; cursor: pointer; font: var(--xp-text-title); }
44
+ :where(.xp-test-surface) .xp-results-panel > summary:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
45
+ :where(.xp-test-surface) .xp-results-panel > summary .xp-quality-chip { margin-left: 12px; }
46
+ :where(.xp-test-surface) .xp-quality-row { padding: 14px 20px; border-top: 1px solid var(--xp-border); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; }
47
+ :where(.xp-test-surface) .xp-quality-row > :not(:first-child) { grid-column: 2; }
48
+ :where(.xp-test-surface) .xp-quality-row ul { margin: 0; padding-left: 20px; }
49
+ :where(.xp-test-surface) .xp-quality-detail, :where(.xp-test-surface) .xp-quality-next, :where(.xp-test-surface) .xp-results-cap-help { color: var(--xp-text-2); font: var(--xp-text-small); }
50
+ :where(.xp-test-surface) .xp-quality-chip { display: inline-flex; align-self: start; padding: 2px 8px; border-radius: var(--xp-radius-chip); font: var(--xp-text-small); color: var(--xp-success); background: var(--xp-success-bg); }
51
+ :where(.xp-test-surface) .xp-quality-chip--watch { color: var(--xp-warning); background: var(--xp-warning-bg); }
52
+ :where(.xp-test-surface) .xp-quality-chip--problem { color: var(--xp-error); background: var(--xp-error-bg); }
53
+ :where(.xp-test-surface) .xp-ci-chart { padding: 20px; overflow-x: auto; }
54
+ :where(.xp-test-surface) .xp-ci-chart svg { display: block; min-width: 560px; }
55
+ :where(.xp-test-surface) .xp-ci-chart ul { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; margin: 0; padding: 0; font: var(--xp-text-small); }
56
+ :where(.xp-test-surface) .xp-preview-links { display: grid; gap: 12px; }
57
+ :where(.xp-test-surface) .xp-preview-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--xp-border); padding-bottom: 12px; }
58
+ @media (max-width: 720px) {
59
+ :where(.xp-test-surface) .xp-stat-tiles { grid-template-columns: minmax(0, 1fr); }
60
+ :where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 0; border-top: 1px solid var(--xp-border); }
61
+ :where(.xp-test-surface) .xp-verdict-hero { padding: 20px; }
62
+ :where(.xp-test-surface) .xp-verdict-hero h2 { font-size: 24px; line-height: 30px; }
63
+ }
64
+ :where(.xp-test-surface) .xp-results-as-of { color: var(--xp-text-2); }
@@ -9,6 +9,12 @@ export declare const SECTION_ORDER: readonly SectionId[];
9
9
  export type TestDocApi = ReturnType<typeof useTestDocument>;
10
10
  /** Serialisable props the server root view passes to the surface (ADM-20). */
11
11
  export interface SurfaceProps {
12
+ /** Present only when configuring a block from its page editor. */
13
+ editorPage?: {
14
+ collection: string;
15
+ id: string;
16
+ };
17
+ editorPlacementMessage?: string;
12
18
  adminRoute: string;
13
19
  apiRoute: string;
14
20
  collectionTitles?: Record<string, string>;
@@ -35,12 +41,11 @@ export interface KindParts {
35
41
  /** The content cell of one version row in Section 2. */
36
42
  VersionContent: ComponentType<SectionProps & {
37
43
  armIndex: number;
44
+ summary?: boolean;
38
45
  }>;
39
46
  }
40
47
  /** Readiness pieces (ADM-23). */
41
48
  export interface ReadinessParts {
42
- /** Sticky-header banner incl. Start / status sentence. */
43
- Banner: ComponentType<SectionProps>;
44
49
  /** "Saving…" / "Saved" / error indicator for the header. */
45
50
  SaveStatus: ComponentType<{
46
51
  test: TestDocApi;
@@ -0,0 +1,21 @@
1
+ import type { PreflightResult } from '../../types/endpoints.js';
2
+ import type { Status } from '../../types/contracts.js';
3
+ import type { TestDocApi, SurfaceProps } from './contracts.js';
4
+ export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
5
+ /** Replace only the guidance represented by this page's local notice. */
6
+ export declare function editorPlacementChecks(checks: PreflightResult['checks'], page: NonNullable<SurfaceProps['editorPage']>): PreflightResult['checks'];
7
+ /** Editor context is a hint for guidance only; Start still runs server preflight. */
8
+ export declare function editorPlacementMessage(placements: PreflightResult['placements'] | undefined, page: SurfaceProps['editorPage'], status: Status | undefined): string | undefined;
9
+ /** Replace this page's checks once, retaining every other page's blocker. */
10
+ export declare function editorPreflight(answer: PreflightResult | null, surface: SurfaceProps, includeLocalBlocker?: boolean): PreflightResult | null;
11
+ /** Shared sidebar policy; the bounded list renders these steps verbatim. */
12
+ export declare function sidebarReadinessBlockers(test: TestDocApi, surface: SurfaceProps): ({
13
+ arm?: import("../../types/contracts.js").ArmKey | undefined;
14
+ section: "header" | import("./contracts.js").SectionId;
15
+ sentence: string;
16
+ code: import("../../transitions/checkStart.js").ReadinessCode;
17
+ } | {
18
+ sentence: "Wait for your changes to save.";
19
+ })[] | {
20
+ sentence: "Checking readiness…";
21
+ }[];
@@ -0,0 +1,60 @@
1
+ import { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
2
+ import { blockingSteps, pageReadinessContext } from './readiness/readiness.model.js';
3
+ import { READINESS_COPY } from '../copy/readiness.js';
4
+ export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
5
+ /** Replace only the guidance represented by this page's local notice. */ export function editorPlacementChecks(checks, page) {
6
+ return checks.flatMap((check)=>{
7
+ if (check.code === 'no-placements') return [];
8
+ if (check.code !== 'placement-unpublished' || check.ok) return [
9
+ check
10
+ ];
11
+ const detail = (Array.isArray(check.detail) ? check.detail : [
12
+ check.detail
13
+ ]).filter((value)=>{
14
+ if (!value || typeof value !== 'object') return true;
15
+ const row = value;
16
+ return row.collection !== page.collection || String(row.id) !== String(page.id);
17
+ });
18
+ return detail.length ? [
19
+ {
20
+ ...check,
21
+ detail
22
+ }
23
+ ] : [];
24
+ });
25
+ }
26
+ /** Editor context is a hint for guidance only; Start still runs server preflight. */ export function editorPlacementMessage(placements, page, status) {
27
+ if (!page || !placements || !status || status === 'decided' || status === 'archived') return;
28
+ const here = placements.filter((p)=>p.collection === page.collection && String(p.id) === String(page.id));
29
+ if (!here.length) return status === 'running' ? RUNNING_SAVE_PAGE : SAVE_PAGE;
30
+ if (!here.some((p)=>p.detail === 'Published')) return status === 'running' ? RUNNING_PUBLISH_PAGE : PUBLISH_PAGE;
31
+ }
32
+ /** Replace this page's checks once, retaining every other page's blocker. */ export function editorPreflight(answer, surface, includeLocalBlocker = true) {
33
+ return answer && surface.editorPlacementMessage && surface.editorPage ? {
34
+ ...answer,
35
+ checks: [
36
+ ...editorPlacementChecks(answer.checks, surface.editorPage),
37
+ ...includeLocalBlocker ? [
38
+ {
39
+ code: 'no-placements',
40
+ ok: false
41
+ }
42
+ ] : []
43
+ ]
44
+ } : answer;
45
+ }
46
+ /** Shared sidebar policy; the bounded list renders these steps verbatim. */ export function sidebarReadinessBlockers(test, surface) {
47
+ const answer = editorPreflight(test.preflight, surface, false);
48
+ const blockers = test.doc ? blockingSteps(answer, pageReadinessContext(test.doc, test.preflight, surface)) : [];
49
+ const notice = test.preflightRead?.message ?? surface.editorPlacementMessage;
50
+ return test.hasUnsaved ? [
51
+ {
52
+ sentence: READINESS_COPY.saveFirst
53
+ },
54
+ ...blockers
55
+ ] : !answer && !notice ? [
56
+ {
57
+ sentence: READINESS_COPY.checking
58
+ }
59
+ ] : blockers.filter((step)=>step.sentence !== notice);
60
+ }
@@ -1,16 +1,26 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Banner } from '../../../ui/Banner.js';
3
4
  import { Button } from '../../../ui/Button.js';
4
- import { previewPages } from '../../previewLinks.model.js';
5
+ import { placementPages } from '../../../lib/placementPages.js';
5
6
  import { TEST_PAGE as C, placementCount } from '../../copy/testPage.js';
6
7
  import { placementLine, slotReady } from './pageBlock.model.js';
7
- function Binding({ test }) {
8
+ function Binding({ test, surface }) {
8
9
  const placements = test.preflight?.placements ?? [];
9
10
  return /*#__PURE__*/ _jsx("div", {
10
11
  className: "xp-page-binding",
11
- children: placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
12
+ children: surface.editorPlacementMessage ? test.doc?.status === 'running' ? /*#__PURE__*/ _jsxs(Banner, {
13
+ tone: "warning",
12
14
  children: [
13
- previewPages(placements).map((placement)=>/*#__PURE__*/ _jsxs("p", {
15
+ /*#__PURE__*/ _jsx("span", {
16
+ "aria-hidden": "true",
17
+ children: "⚠ "
18
+ }),
19
+ surface.editorPlacementMessage
20
+ ]
21
+ }) : null : placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
22
+ children: [
23
+ placementPages(placements).map((placement)=>/*#__PURE__*/ _jsxs("p", {
14
24
  className: "xp-ui-button-group",
15
25
  children: [
16
26
  placementLine(placement),
@@ -28,12 +38,12 @@ function Binding({ test }) {
28
38
  children: C.editedOnPage
29
39
  })
30
40
  ]
31
- }) : /*#__PURE__*/ _jsx("p", {
41
+ }) : test.preflight?.checks.some((check)=>!check.ok && check.code === 'no-placements') ? null : /*#__PURE__*/ _jsx("p", {
32
42
  children: C.notPlaced
33
43
  })
34
44
  });
35
45
  }
36
- function VersionContent({ test, armIndex }) {
46
+ function VersionContent({ test, armIndex, summary }) {
37
47
  const arm = test.doc?.arms[armIndex];
38
48
  if (!arm) return null;
39
49
  if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
@@ -41,7 +51,7 @@ function VersionContent({ test, armIndex }) {
41
51
  children: C.holdoutContent
42
52
  });
43
53
  const placements = test.preflight?.placements ?? [];
44
- const pages = previewPages(placements);
54
+ const pages = placementPages(placements);
45
55
  const ready = placements.length > 0 && placements.every((placement)=>slotReady(placement, arm));
46
56
  return /*#__PURE__*/ _jsxs("div", {
47
57
  className: "xp-version-content",
@@ -52,13 +62,13 @@ function VersionContent({ test, armIndex }) {
52
62
  }),
53
63
  /*#__PURE__*/ _jsx("div", {
54
64
  className: "xp-ui-button-group",
55
- children: pages.filter((page)=>page.editorUrl).map((page)=>/*#__PURE__*/ _jsx(Button, {
65
+ children: !summary ? pages.filter((page)=>page.editorUrl).map((page)=>/*#__PURE__*/ _jsx(Button, {
56
66
  variant: "link",
57
67
  size: "sm",
58
68
  href: page.editorUrl,
59
69
  "aria-label": pages.length > 1 ? `${C.editOnPage}: ${page.title}` : undefined,
60
70
  children: C.editOnPage
61
- }, page.key))
71
+ }, page.key)) : null
62
72
  })
63
73
  ]
64
74
  });
@@ -0,0 +1,10 @@
1
+ :where(.xp-test-surface) .xp-page-combobox { position: relative; width: 100%; min-width: 0; }
2
+ :where(.xp-test-surface) .xp-page-combobox input { width: 100%; }
3
+ :where(.xp-test-surface) .xp-page-combobox-popup { position: absolute; inset-inline: 0; z-index: 5; max-height: 24rem; overflow-y: auto; background: var(--xp-surface); color: var(--xp-text); border: 1px solid var(--xp-border-strong); border-radius: var(--xp-radius-control); padding: var(--xp-space-1); }
4
+ :where(.xp-test-surface) .xp-page-option { position: relative; display: block; width: 100%; box-sizing: border-box; text-align: left; padding: var(--xp-space-3); padding-inline-end: var(--xp-space-6); border: 2px solid transparent; border-radius: var(--xp-radius-control); cursor: pointer; color: var(--xp-text); background: var(--xp-surface); overflow-wrap: anywhere; }
5
+ :where(.xp-test-surface) .xp-page-option-detail { display: block; color: var(--xp-text-2); font: var(--xp-text-small); }
6
+ :where(.xp-test-surface) .xp-page-option[aria-selected='true'] { border-color: var(--xp-accent); }
7
+ :where(.xp-test-surface) .xp-page-option-check { position: absolute; inset-inline-end: var(--xp-space-2); top: var(--xp-space-3); color: var(--xp-accent); }
8
+ :where(.xp-test-surface) .xp-page-option[data-active='true'] { background: var(--xp-surface-2); outline: 2px solid var(--xp-focus); outline-offset: -4px; }
9
+ :where(.xp-test-surface) .xp-page-option[aria-disabled='true'] { cursor: not-allowed; border-color: var(--xp-text-2); border-style: dashed; }
10
+ :where(.xp-test-surface) .xp-page-option[aria-disabled='true'] strong { font-weight: 400; }
@@ -1,5 +1,6 @@
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 '../../readinessRead.js';
3
4
  import { DocsResponseError, fetchAllDocs } from '../../../lib/fetchAllDocs.js';
4
5
  import { usePlacementLabels, placementDetailKey } from '../../placements/usePlacementLabels.js';
5
6
  import { placementUncheckedCopy } from '../../copy/readiness.js';
@@ -14,20 +15,21 @@ import { REVIEW_COPY as R } from '../../copy/review.js';
14
15
  import { READINESS_COPY as C } from '../../copy/readiness.js';
15
16
  import { API_MESSAGES, refusalMessage } from '../../copy/common.js';
16
17
  import { createApi } from '../../api.js';
18
+ import { blockingSteps, pageReadinessContext } from './readiness.model.js';
17
19
  import { useTransition } from './useTransition.js';
18
20
  /** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */ export function ConfirmAction({ test, surface, action, winnerLabel, onClose }) {
19
21
  const api = createApi(surface.apiRoute);
20
22
  const [typed, setTyped] = useState('');
21
23
  const [content, setContent] = useState(null);
22
24
  const [reportBusy, setReportBusy] = useState(false);
23
- const transition = useTransition(test, onClose);
25
+ const transition = useTransition(test, onClose, surface);
24
26
  const phrase = action.confirm.phrase ? expectedConfirm(action.confirm.phrase.action, winnerLabel) : null;
25
- const ready = action.id !== 'start' || Boolean(test.preflight && !test.preflightPending && !test.preflightError && test.preflight.checks.every((check)=>check.ok));
27
+ const ready = action.id !== 'start' || !transition.checking && canStartTest(test, surface.editorPlacementMessage);
26
28
  const enabled = ready && !transition.busy && !test.hasUnsaved && test.saving !== 'saving' && (!phrase || matchesConfirm(phrase, typed));
27
29
  async function submit(finish = false) {
28
30
  if (!enabled || !test.doc) return;
29
31
  const id = test.doc.id;
30
- await transition.run(async ()=>{
32
+ await transition.run(finish ? 'archive' : action.id === 'start' && test.doc.status === 'stopped' ? 'restart' : action.id, async ()=>{
31
33
  if (finish) return api.archive(id, {
32
34
  mode: 'after-content'
33
35
  });
@@ -105,11 +107,21 @@ import { useTransition } from './useTransition.js';
105
107
  }) : null
106
108
  ]
107
109
  }),
110
+ transition.busy ? /*#__PURE__*/ _jsx("p", {
111
+ role: "status",
112
+ children: C.changing
113
+ }) : null,
108
114
  transition.error ? /*#__PURE__*/ _jsx("p", {
109
115
  role: "alert",
110
116
  children: transition.error
111
117
  }) : null,
118
+ !content && (test.hasUnsaved || test.saving === 'saving') ? /*#__PURE__*/ _jsx("p", {
119
+ children: test.stale ? C.reloadFirst : C.saveFirst
120
+ }) : !content && action.id === 'start' && !readyToStart(test, surface.editorPlacementMessage) ? /*#__PURE__*/ _jsx("p", {
121
+ children: test.preflightError ? test.preflightError : test.doc ? blockingSteps(test.preflight, pageReadinessContext(test.doc, test.preflight, surface))[0]?.sentence ?? C.checking : C.checking
122
+ }) : null,
112
123
  !content ? /*#__PURE__*/ _jsx(Button, {
124
+ busy: transition.busy,
113
125
  disabled: !enabled,
114
126
  onClick: ()=>{
115
127
  void submit();
@@ -128,7 +140,7 @@ import { useTransition } from './useTransition.js';
128
140
  /** AllocateDialog's validation and copy, with data supplied by the test document. */ export function AllocateAction({ test, surface, onClose }) {
129
141
  const current = test.doc?.allocation ?? 100;
130
142
  const [value, setValue] = useState(String(Math.min(100, current + 1)));
131
- const transition = useTransition(test, onClose);
143
+ const transition = useTransition(test, onClose, surface);
132
144
  const allocation = Number(value);
133
145
  const valid = value.trim() !== '' && Number.isInteger(allocation) && allocation > current && allocation <= 100;
134
146
  const disabled = transition.busy || test.hasUnsaved || test.saving === 'saving';
@@ -157,18 +169,26 @@ import { useTransition } from './useTransition.js';
157
169
  })
158
170
  ]
159
171
  }),
172
+ test.hasUnsaved || test.saving === 'saving' ? /*#__PURE__*/ _jsx("p", {
173
+ children: test.stale ? C.reloadFirst : C.saveFirst
174
+ }) : null,
160
175
  !valid ? /*#__PURE__*/ _jsx("p", {
161
176
  children: R.allocationInvalid
162
177
  }) : null,
178
+ transition.busy ? /*#__PURE__*/ _jsx("p", {
179
+ role: "status",
180
+ children: C.changing
181
+ }) : null,
163
182
  transition.error ? /*#__PURE__*/ _jsx("p", {
164
183
  role: "alert",
165
184
  children: transition.error
166
185
  }) : null,
167
186
  /*#__PURE__*/ _jsx(Button, {
187
+ busy: transition.busy,
168
188
  disabled: disabled || !valid,
169
189
  onClick: ()=>{
170
190
  // Not-found can also mean the experiment is missing; use round copy for the missing phase record.
171
- if (valid && test.doc) void transition.run(()=>createApi(surface.apiRoute).allocate(test.doc.id, {
191
+ if (valid && test.doc) void transition.run('allocate', ()=>createApi(surface.apiRoute).allocate(test.doc.id, {
172
192
  allocation
173
193
  }, {
174
194
  notFound: API_MESSAGES.roundChanged
@@ -196,7 +216,7 @@ import { useTransition } from './useTransition.js';
196
216
  ...surface
197
217
  });
198
218
  const [role, setRole] = useState('secondary');
199
- const transition = useTransition(test, onClose);
219
+ const transition = useTransition(test, onClose, surface);
200
220
  useEffect(()=>{
201
221
  const controller = new AbortController();
202
222
  void (async ()=>{
@@ -296,15 +316,25 @@ import { useTransition } from './useTransition.js';
296
316
  !loading && !loadError && !available.length ? /*#__PURE__*/ _jsx("p", {
297
317
  children: R.noMetrics
298
318
  }) : null,
319
+ transition.busy ? /*#__PURE__*/ _jsx("p", {
320
+ role: "status",
321
+ children: C.changing
322
+ }) : null,
299
323
  loadError || transition.error ? /*#__PURE__*/ _jsx("p", {
300
324
  role: "alert",
301
325
  children: loadError ?? transition.error
302
326
  }) : null,
327
+ test.hasUnsaved || test.saving === 'saving' ? /*#__PURE__*/ _jsx("p", {
328
+ children: test.stale ? C.reloadFirst : C.saveFirst
329
+ }) : !loading && !loadError && available.length > 0 && !selected ? /*#__PURE__*/ _jsx("p", {
330
+ children: C.chooseGoalToAdd
331
+ }) : null,
303
332
  /*#__PURE__*/ _jsx(Button, {
333
+ busy: transition.busy,
304
334
  disabled: disabled || loading || !!loadError || !selected,
305
335
  onClick: ()=>{
306
336
  // Goal and phase lookups share not-found; prefer the more likely missing goal without reading server text.
307
- if (selected && test.doc) void transition.run(async ()=>{
337
+ if (selected && test.doc) void transition.run('add-metric', async ()=>{
308
338
  const result = await createApi(surface.apiRoute).addMetric(test.doc.id, {
309
339
  metric: selected.id,
310
340
  role
@@ -0,0 +1,2 @@
1
+ import type { SectionProps } from '../contracts.js';
2
+ export declare function ReadinessContent({ test, surface, resultsVersion }: SectionProps): import("react").JSX.Element;