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

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 (301) 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 +4 -3
  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 +13 -13
  39. package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
  40. package/dist/admin/surface/results/ResultsHeader.js +8 -8
  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/picker/clickGoalPicker.model.d.ts +8 -1
  62. package/dist/goals/picker/clickGoalPicker.model.js +20 -2
  63. package/dist/goals/picker/copy.d.ts +4 -2
  64. package/dist/goals/picker/copy.js +4 -2
  65. package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
  66. package/dist/goals/picker/useClickGoalPicker.js +4 -2
  67. package/dist/hooks/blockRemovalRule.d.ts +29 -0
  68. package/dist/hooks/blockRemovalRule.js +141 -0
  69. package/dist/hooks/pageGuard.d.ts +24 -2
  70. package/dist/hooks/pageGuard.js +178 -24
  71. package/dist/lib/placementPages.d.ts +9 -0
  72. package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +1 -4
  73. package/dist/onInit.js +22 -0
  74. package/dist/plugin.js +2 -1
  75. package/dist/puck/ExperimentPicker.js +25 -10
  76. package/dist/puck/copy.d.ts +4 -1
  77. package/dist/puck/copy.js +4 -1
  78. package/dist/puck/editor/ConfigureTestDrawer.d.ts +21 -0
  79. package/dist/puck/editor/ConfigureTestDrawer.js +147 -0
  80. package/dist/puck/editor/CreateExperimentDrawer.d.ts +11 -2
  81. package/dist/puck/editor/CreateExperimentDrawer.js +69 -9
  82. package/dist/puck/editor/EditorControls.d.ts +14 -0
  83. package/dist/puck/editor/EditorControls.js +99 -0
  84. package/dist/puck/editor/ExperimentSlotEditor.js +317 -51
  85. package/dist/puck/editor/ResultsReadout.js +3 -5
  86. package/dist/puck/editor/VersionBuilder.js +2 -2
  87. package/dist/puck/editor/armsCache.d.ts +3 -1
  88. package/dist/puck/editor/armsCache.js +20 -3
  89. package/dist/puck/editor/copy.d.ts +18 -2
  90. package/dist/puck/editor/copy.js +19 -3
  91. package/dist/puck/editor/editor.chrome.css +33 -0
  92. package/dist/puck/editor/editor.css +39 -0
  93. package/dist/puck/editor/editor.model.d.ts +14 -0
  94. package/dist/puck/editor/editor.model.js +58 -1
  95. package/dist/puck/editor/editorSurface.d.ts +10 -0
  96. package/dist/puck/editor/editorSurface.js +65 -0
  97. package/dist/puck/editor/localPlacements.d.ts +2 -0
  98. package/dist/puck/editor/localPlacements.js +29 -0
  99. package/dist/puck/editor/placementsCache.d.ts +19 -0
  100. package/dist/puck/editor/placementsCache.js +83 -0
  101. package/dist/puck/editor/xpGoalPuckEditorField.js +109 -98
  102. package/dist/puck/experimentSlotField.d.ts +3 -0
  103. package/dist/puck/experimentSlotField.js +15 -4
  104. package/dist/{admin → testSurface}/actions/DecideDialog.d.ts +2 -1
  105. package/dist/{admin → testSurface}/actions/DecideDialog.js +6 -4
  106. package/dist/{admin → testSurface}/api.js +4 -5
  107. package/dist/{admin → testSurface}/copy/common.d.ts +2 -0
  108. package/dist/{admin → testSurface}/copy/common.js +2 -0
  109. package/dist/{admin → testSurface}/copy/readiness.d.ts +3 -0
  110. package/dist/{admin → testSurface}/copy/readiness.js +3 -0
  111. package/dist/{admin → testSurface}/copy/testPage.d.ts +3 -0
  112. package/dist/{admin → testSurface}/copy/testPage.js +7 -2
  113. package/dist/testSurface/format/adminURL.d.ts +7 -0
  114. package/dist/testSurface/format/adminURL.js +9 -0
  115. package/dist/{admin → testSurface}/placements/placementLabels.js +1 -1
  116. package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
  117. package/dist/testSurface/previewLinks.model.js +4 -0
  118. package/dist/testSurface/results/results.css +64 -0
  119. package/dist/{admin → testSurface}/surface/contracts.d.ts +1 -0
  120. package/dist/{admin → testSurface}/surface/pageBlock/parts.js +6 -6
  121. package/dist/testSurface/surface/pagePicker/pagePicker.css +10 -0
  122. package/dist/{admin → testSurface}/surface/readiness/useTransition.js +1 -0
  123. package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +2 -2
  124. package/dist/{admin → testSurface}/surface/results/ResultsBody.js +18 -11
  125. package/dist/testSurface/surface/setting/setting.css +17 -0
  126. package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
  127. package/dist/{admin → testSurface}/surface/test/GoalSection.js +3 -2
  128. package/dist/testSurface/surface/test/TestSurface.d.ts +18 -0
  129. package/dist/testSurface/surface/test/TestSurface.js +152 -0
  130. package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
  131. package/dist/{admin → testSurface}/surface/test/VersionsSection.js +12 -6
  132. package/dist/testSurface/surface/test/testPage.css +92 -0
  133. package/dist/{admin → testSurface}/surface/useTestDocument.d.ts +5 -1
  134. package/dist/{admin → testSurface}/surface/useTestDocument.js +34 -3
  135. package/dist/{admin → testSurface}/surfaceUrls.js +1 -1
  136. package/dist/transitions/placementInteractions.js +1 -1
  137. package/dist/transitions/placements.d.ts +27 -8
  138. package/dist/transitions/placements.js +77 -6
  139. package/dist/transitions/start.js +2 -2
  140. package/dist/types/endpoints.d.ts +1 -1
  141. package/dist/ui/Dialog.d.ts +4 -1
  142. package/dist/ui/Dialog.js +41 -3
  143. package/dist/ui/Drawer.d.ts +10 -0
  144. package/dist/ui/Drawer.js +29 -0
  145. package/dist/ui/Tabs.d.ts +3 -3
  146. package/dist/ui/Tabs.js +35 -33
  147. package/dist/ui/ui.css +6 -0
  148. package/package.json +1 -1
  149. package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
  150. package/dist/admin/actions/ConfirmDialog.js +0 -149
  151. package/dist/admin/results/results.css +0 -64
  152. package/dist/admin/styles.css +0 -10
  153. package/dist/admin/styles.d.ts +0 -2
  154. package/dist/admin/styles.js +0 -3
  155. package/dist/admin/surface/pagePicker/pagePicker.css +0 -10
  156. package/dist/admin/surface/setting/setting.css +0 -17
  157. package/dist/admin/surface/test/GoalSection.d.ts +0 -2
  158. package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
  159. package/dist/admin/surface/test/testPage.css +0 -92
  160. /package/dist/{admin → testSurface}/PreviewLinks.d.ts +0 -0
  161. /package/dist/{admin → testSurface}/PreviewLinks.js +0 -0
  162. /package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +0 -0
  163. /package/dist/{admin → testSurface}/actions/MakeContentResult.js +0 -0
  164. /package/dist/{admin → testSurface}/actions/actions.model.d.ts +0 -0
  165. /package/dist/{admin → testSurface}/actions/actions.model.js +0 -0
  166. /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
  167. /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
  168. /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
  169. /package/dist/{admin → testSurface}/allocation.model.js +0 -0
  170. /package/dist/{admin → testSurface}/api.d.ts +0 -0
  171. /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
  172. /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
  173. /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
  174. /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
  175. /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
  176. /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
  177. /package/dist/{admin → testSurface}/copy/actions.d.ts +0 -0
  178. /package/dist/{admin → testSurface}/copy/actions.js +0 -0
  179. /package/dist/{admin → testSurface}/copy/advanced.d.ts +0 -0
  180. /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
  181. /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
  182. /package/dist/{admin → testSurface}/copy/arms.js +0 -0
  183. /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
  184. /package/dist/{admin → testSurface}/copy/audience.js +0 -0
  185. /package/dist/{admin → testSurface}/copy/metrics.d.ts +0 -0
  186. /package/dist/{admin → testSurface}/copy/metrics.js +0 -0
  187. /package/dist/{admin → testSurface}/copy/pages.d.ts +0 -0
  188. /package/dist/{admin → testSurface}/copy/pages.js +0 -0
  189. /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
  190. /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
  191. /package/dist/{admin → testSurface}/copy/results.d.ts +0 -0
  192. /package/dist/{admin → testSurface}/copy/results.js +0 -0
  193. /package/dist/{admin → testSurface}/copy/review.d.ts +0 -0
  194. /package/dist/{admin → testSurface}/copy/review.js +0 -0
  195. /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
  196. /package/dist/{admin → testSurface}/copy/setting.js +0 -0
  197. /package/dist/{admin → testSurface}/copy/surface.d.ts +0 -0
  198. /package/dist/{admin → testSurface}/copy/surface.js +0 -0
  199. /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
  200. /package/dist/{admin → testSurface}/format/date.js +0 -0
  201. /package/dist/{admin → testSurface}/labels.d.ts +0 -0
  202. /package/dist/{admin → testSurface}/labels.js +0 -0
  203. /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
  204. /package/dist/{admin → testSurface}/lockedNotice.model.js +0 -0
  205. /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
  206. /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
  207. /package/dist/{admin → testSurface}/placements/placementLabels.d.ts +0 -0
  208. /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
  209. /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
  210. /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
  211. /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
  212. /package/dist/{admin → testSurface}/reload.d.ts +0 -0
  213. /package/dist/{admin → testSurface}/reload.js +0 -0
  214. /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
  215. /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
  216. /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
  217. /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
  218. /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
  219. /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
  220. /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
  221. /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
  222. /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
  223. /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
  224. /package/dist/{admin → testSurface}/results/VerdictHero.d.ts +0 -0
  225. /package/dist/{admin → testSurface}/results/VerdictHero.js +0 -0
  226. /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
  227. /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
  228. /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
  229. /package/dist/{admin → testSurface}/results/format.js +0 -0
  230. /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
  231. /package/dist/{admin → testSurface}/results/legacy.js +0 -0
  232. /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
  233. /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
  234. /package/dist/{admin → testSurface}/results/results.model.d.ts +0 -0
  235. /package/dist/{admin → testSurface}/results/results.model.js +0 -0
  236. /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
  237. /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
  238. /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
  239. /package/dist/{admin → testSurface}/review/review.model.js +0 -0
  240. /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
  241. /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
  242. /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.js +0 -0
  243. /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
  244. /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.d.ts +0 -0
  245. /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.js +0 -0
  246. /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.d.ts +0 -0
  247. /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.js +0 -0
  248. /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +0 -0
  249. /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +0 -0
  250. /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +0 -0
  251. /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.js +0 -0
  252. /package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +0 -0
  253. /package/dist/{admin → testSurface}/surface/readiness/Banner.js +0 -0
  254. /package/dist/{admin → testSurface}/surface/readiness/SaveStatus.d.ts +0 -0
  255. /package/dist/{admin → testSurface}/surface/readiness/SaveStatus.js +0 -0
  256. /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
  257. /package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -0
  258. /package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +0 -0
  259. /package/dist/{admin → testSurface}/surface/readiness/readiness.model.js +0 -0
  260. /package/dist/{admin → testSurface}/surface/readiness/useTransition.d.ts +0 -0
  261. /package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +0 -0
  262. /package/dist/{admin → testSurface}/surface/results/ReleasePages.js +0 -0
  263. /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
  264. /package/dist/{admin → testSurface}/surface/results/recommendation.model.js +0 -0
  265. /package/dist/{admin → testSurface}/surface/results/useResults.d.ts +0 -0
  266. /package/dist/{admin → testSurface}/surface/results/useResults.js +0 -0
  267. /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
  268. /package/dist/{admin → testSurface}/surface/setting/parts.js +0 -0
  269. /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
  270. /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
  271. /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
  272. /package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +0 -0
  273. /package/dist/{admin → testSurface}/surface/test/LengthSection.d.ts +0 -0
  274. /package/dist/{admin → testSurface}/surface/test/LengthSection.js +0 -0
  275. /package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +0 -0
  276. /package/dist/{admin → testSurface}/surface/test/PageHoldout.js +0 -0
  277. /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
  278. /package/dist/{admin → testSurface}/surface/test/Rail.js +0 -0
  279. /package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +0 -0
  280. /package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +0 -0
  281. /package/dist/{admin → testSurface}/surface/test/Section.d.ts +0 -0
  282. /package/dist/{admin → testSurface}/surface/test/Section.js +0 -0
  283. /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
  284. /package/dist/{admin → testSurface}/surface/test/TargetingSection.js +0 -0
  285. /package/dist/{admin → testSurface}/surface/test/fields.d.ts +0 -0
  286. /package/dist/{admin → testSurface}/surface/test/fields.js +0 -0
  287. /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
  288. /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
  289. /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
  290. /package/dist/{admin → testSurface}/surface/test/pageParts.js +0 -0
  291. /package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +0 -0
  292. /package/dist/{admin → testSurface}/surface/test/testPage.model.js +0 -0
  293. /package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +0 -0
  294. /package/dist/{admin → testSurface}/surface/testDocument.model.js +0 -0
  295. /package/dist/{admin → testSurface}/surfaceUrls.d.ts +0 -0
  296. /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
  297. /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
  298. /package/dist/{admin → testSurface}/theme.d.ts +0 -0
  299. /package/dist/{admin → testSurface}/theme.js +0 -0
  300. /package/dist/{admin → testSurface}/useApi.d.ts +0 -0
  301. /package/dist/{admin → testSurface}/useApi.js +0 -0
@@ -1,4 +1,3 @@
1
- import '../../styles.js';
2
1
  import type { ReactNode } from 'react';
3
2
  import type { DocId } from '../../../types/contracts.js';
4
3
  import type { ResultsResponse } from '../../../types/endpoints.js';
@@ -13,8 +12,9 @@ type ResultsBodyProps = {
13
12
  renderPage?: (parts: ResultsPageParts) => ReactNode;
14
13
  id: DocId;
15
14
  surface: SurfaceProps;
15
+ onChanged?: (doc?: Record<string, unknown>) => void;
16
16
  onRecomputed?: () => void;
17
17
  onPagesReleased?: () => void;
18
18
  };
19
- export declare function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage }: ResultsBodyProps): import("react").JSX.Element;
19
+ export declare function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }: ResultsBodyProps): import("react").JSX.Element;
20
20
  export {};
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { theme } from '../../theme.js';
4
- import '../../styles.js';
5
4
  import { useEffect, useRef, useState } from 'react';
6
5
  import { Button } from '../../../ui/Button.js';
7
6
  import { Select } from '../../../ui/Inputs.js';
@@ -28,17 +27,18 @@ import { Banner } from '../../../ui/Banner.js';
28
27
  import { canReleasePages } from '../../results/releasePages.model.js';
29
28
  import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
30
29
  import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
31
- export function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage }) {
30
+ export function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }) {
32
31
  // A different test owns an independent selection and action lifecycle.
33
32
  return /*#__PURE__*/ _jsx(ResultsContent, {
34
33
  id: id,
35
34
  surface: surface,
36
35
  onRecomputed: onRecomputed,
37
36
  onPagesReleased: onPagesReleased,
38
- renderPage: renderPage
37
+ renderPage: renderPage,
38
+ onChanged: onChanged
39
39
  }, `${surface.apiRoute}/${id}`);
40
40
  }
41
- function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage }) {
41
+ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }) {
42
42
  const results = useResults(id, surface);
43
43
  const { api, doc, round, phases, state, data } = results;
44
44
  const manage = surface.canManage && surface.canReadResults;
@@ -382,7 +382,11 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
382
382
  id: id,
383
383
  arms: phase.arms,
384
384
  checks: checks,
385
- onClose: ()=>setDeciding(false)
385
+ onClose: ()=>setDeciding(false),
386
+ onSuccess: onChanged ? (doc)=>{
387
+ setDeciding(false);
388
+ onChanged(doc);
389
+ } : undefined
386
390
  }) : null,
387
391
  releasing && manage ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
388
392
  id: id,
@@ -396,12 +400,15 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
396
400
  }) : null
397
401
  ]
398
402
  });
399
- return renderPage ? renderPage({
400
- children: content,
401
- actions,
402
- released,
403
- data
404
- }) : content;
403
+ return /*#__PURE__*/ _jsx("div", {
404
+ className: "xp-test-surface",
405
+ children: renderPage ? renderPage({
406
+ children: content,
407
+ actions,
408
+ released,
409
+ data
410
+ }) : content
411
+ });
405
412
  }
406
413
  function MetricTable({ metric, snapshot, phase, leader }) {
407
414
  const rows = armRows({
@@ -0,0 +1,17 @@
1
+ :where(.xp-test-surface) .xp-setting-values { display: grid; gap: var(--xp-space-3); }
2
+ :where(.xp-test-surface) .xp-setting-value { white-space: pre-wrap; }
3
+ :where(.xp-test-surface) .xp-setting-lock { color: var(--xp-text-muted); }
4
+ :where(.xp-test-surface) .xp-setting-parameter fieldset { border: 0; padding: 0; margin: 0; }
5
+ :where(.xp-test-surface) .xp-setting-segments { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
6
+ :where(.xp-test-surface) .xp-setting-segments label { position: relative; }
7
+ :where(.xp-test-surface) .xp-setting-segments input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
8
+ :where(.xp-test-surface) .xp-setting-segments span {
9
+ display: block;
10
+ padding: 0.5rem 0.8rem;
11
+ border: 1px solid var(--xp-border);
12
+ border-radius: var(--xp-radius);
13
+ background: var(--xp-input-bg);
14
+ color: var(--xp-text);
15
+ }
16
+ :where(.xp-test-surface) .xp-setting-segments input:checked + span { background: var(--xp-accent-subtle); border-color: var(--xp-accent); }
17
+ :where(.xp-test-surface) .xp-setting-segments input:focus-visible + span { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
@@ -0,0 +1,4 @@
1
+ import type { SectionProps } from '../contracts.js';
2
+ export declare function GoalSection({ test, surface, embedded }: SectionProps & {
3
+ embedded?: boolean;
4
+ }): import("react").JSX.Element;
@@ -12,7 +12,7 @@ import { sourceFor } from '../../metricSource.model.js';
12
12
  import { reviewView } from '../../review/review.model.js';
13
13
  import { CheckboxList, FieldErrors, reasonFor, save, SelectEdit } from './fields.js';
14
14
  import { Section } from './Section.js';
15
- export function GoalSection({ test, surface }) {
15
+ export function GoalSection({ test, surface, embedded = false }) {
16
16
  const api = useMemo(()=>createApi(surface.apiRoute), [
17
17
  surface.apiRoute
18
18
  ]);
@@ -83,7 +83,7 @@ export function GoalSection({ test, surface }) {
83
83
  ]);
84
84
  const reason = reasonFor(test, 'metrics');
85
85
  useEffect(()=>{
86
- if (!loaded) return;
86
+ if (embedded || !loaded) return;
87
87
  const url = new URL(window.location.href);
88
88
  const goalId = url.searchParams.get('goal');
89
89
  if (goalId == null) return;
@@ -101,6 +101,7 @@ export function GoalSection({ test, surface }) {
101
101
  }));
102
102
  }
103
103
  }, [
104
+ embedded,
104
105
  loaded,
105
106
  metrics,
106
107
  reason,
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { DocId } from '../../../types/contracts.js';
3
+ import type { SurfaceProps, TestDocApi } from '../contracts.js';
4
+ import type { TestDocument } from '../testDocument.model.js';
5
+ import type { PreflightResult } from '../../../types/endpoints.js';
6
+ import './testPage.css';
7
+ export declare function TestSurface({ id, surface, onTitleChange, renderFrame, embedded, onDocument, onPreflight }: {
8
+ id: DocId;
9
+ surface: SurfaceProps;
10
+ onTitleChange?: (title: string) => void;
11
+ embedded?: boolean;
12
+ renderFrame?: (content: {
13
+ test: TestDocApi;
14
+ children: ReactNode;
15
+ }) => ReactNode;
16
+ onDocument?: (doc: TestDocument) => void;
17
+ onPreflight?: (preflight: PreflightResult) => void;
18
+ }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
@@ -0,0 +1,152 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from 'react';
4
+ import { useTestDocument } from '../useTestDocument.js';
5
+ import { TEST_PAGE as C } from '../../copy/testPage.js';
6
+ import { pageBlockParts } from '../pageBlock/parts.js';
7
+ import { settingParts } from '../setting/parts.js';
8
+ import { pageParts } from './pageParts.js';
9
+ import { Section } from './Section.js';
10
+ import { Hypothesis, TestName } from './fields.js';
11
+ import { VersionsSection } from './VersionsSection.js';
12
+ import { GoalSection } from './GoalSection.js';
13
+ import { TargetingSection } from './TargetingSection.js';
14
+ import { LengthSection } from './LengthSection.js';
15
+ import { AdvancedSection } from './AdvancedSection.js';
16
+ import { Button } from '../../../ui/Button.js';
17
+ import { Banner } from '../../../ui/Feedback.js';
18
+ import { Rail } from './Rail.js';
19
+ import { ReadinessBar } from './ReadinessBar.js';
20
+ import { ResultsBody } from '../results/ResultsBody.js';
21
+ import './testPage.css';
22
+ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded = false, onDocument, onPreflight }) {
23
+ const [barHeight, setBarHeight] = useState();
24
+ const test = useTestDocument(id, {
25
+ apiRoute: surface.apiRoute,
26
+ refetchPreflightOnFocus: true,
27
+ ...!surface.canManage ? {
28
+ enabled: false
29
+ } : {},
30
+ ...onDocument ? {
31
+ onDocument
32
+ } : {},
33
+ ...onPreflight ? {
34
+ onPreflight
35
+ } : {}
36
+ });
37
+ useEffect(()=>{
38
+ if (test.doc?.name) onTitleChange?.(test.doc.name);
39
+ }, [
40
+ test.doc?.name,
41
+ onTitleChange
42
+ ]);
43
+ const frame = (body)=>{
44
+ const children = /*#__PURE__*/ _jsx("div", {
45
+ className: "xp-test-surface",
46
+ children: body
47
+ });
48
+ return renderFrame ? renderFrame({
49
+ test,
50
+ children
51
+ }) : children;
52
+ };
53
+ // Results readers have no permission to load the manager-only test/preflight.
54
+ if (!surface.canManage) return frame(/*#__PURE__*/ _jsx(ResultsBody, {
55
+ id: id,
56
+ surface: surface
57
+ }));
58
+ if (test.loadState !== 'ready' || !test.doc) return frame(/*#__PURE__*/ _jsxs("div", {
59
+ className: "xp-test-page",
60
+ role: test.loadState === 'error' ? 'alert' : 'status',
61
+ children: [
62
+ /*#__PURE__*/ _jsx("p", {
63
+ children: test.loadState === 'forbidden' ? C.forbidden : test.loadState === 'missing' ? C.missing : test.loadState === 'error' ? C.error : C.loading
64
+ }),
65
+ test.loadState === 'error' ? /*#__PURE__*/ _jsx(Button, {
66
+ onClick: ()=>void test.reload(),
67
+ children: C.retry
68
+ }) : null
69
+ ]
70
+ }));
71
+ const parts = test.doc.kind === 'block' ? pageBlockParts : test.doc.kind === 'page' ? pageParts : settingParts;
72
+ const props = {
73
+ test,
74
+ surface
75
+ };
76
+ return frame(/*#__PURE__*/ _jsxs("div", {
77
+ className: "xp-test-page xp-test-page--setup",
78
+ style: {
79
+ paddingBottom: embedded || barHeight === undefined ? undefined : `${barHeight}px`
80
+ },
81
+ children: [
82
+ /*#__PURE__*/ _jsxs("div", {
83
+ className: "xp-test-layout",
84
+ children: [
85
+ /*#__PURE__*/ _jsx(Rail, {
86
+ test: test
87
+ }),
88
+ /*#__PURE__*/ _jsxs("div", {
89
+ className: "xp-test-content",
90
+ children: [
91
+ test.errors._section ? /*#__PURE__*/ _jsx(Banner, {
92
+ tone: "error",
93
+ action: test.stale ? /*#__PURE__*/ _jsx(Button, {
94
+ onClick: ()=>void test.reload(),
95
+ children: C.reload
96
+ }) : undefined,
97
+ children: test.errors._section
98
+ }) : null,
99
+ /*#__PURE__*/ _jsxs(Section, {
100
+ test: test,
101
+ sectionId: "what",
102
+ children: [
103
+ /*#__PURE__*/ _jsx(TestName, {
104
+ ...props
105
+ }),
106
+ /*#__PURE__*/ _jsx(parts.Binding, {
107
+ ...props
108
+ }),
109
+ /*#__PURE__*/ _jsx(Hypothesis, {
110
+ ...props
111
+ })
112
+ ]
113
+ }),
114
+ /*#__PURE__*/ _jsx(VersionsSection, {
115
+ ...props,
116
+ parts: parts,
117
+ contentOnCanvas: embedded
118
+ }),
119
+ /*#__PURE__*/ _jsx(GoalSection, {
120
+ ...props,
121
+ embedded: embedded
122
+ }),
123
+ /*#__PURE__*/ _jsx(TargetingSection, {
124
+ ...props
125
+ }),
126
+ /*#__PURE__*/ _jsx(LengthSection, {
127
+ ...props
128
+ }),
129
+ /*#__PURE__*/ _jsx(AdvancedSection, {
130
+ ...props
131
+ }),
132
+ embedded && surface.canReadResults && test.doc.status !== 'draft' ? /*#__PURE__*/ _jsx(ResultsBody, {
133
+ id: id,
134
+ surface: surface,
135
+ onChanged: (doc)=>{
136
+ test.acceptTransition?.({
137
+ doc
138
+ });
139
+ void test.reload();
140
+ }
141
+ }, `${test.doc.id}/${test.doc.phase}/${test.doc.status}`) : null
142
+ ]
143
+ })
144
+ ]
145
+ }),
146
+ /*#__PURE__*/ _jsx(ReadinessBar, {
147
+ ...props,
148
+ onHeightChange: setBarHeight
149
+ })
150
+ ]
151
+ }));
152
+ }
@@ -0,0 +1,5 @@
1
+ import type { KindParts, SectionProps } from '../contracts.js';
2
+ export declare function VersionsSection({ test, surface, parts, contentOnCanvas }: SectionProps & {
3
+ parts: KindParts;
4
+ contentOnCanvas?: boolean;
5
+ }): import("react").JSX.Element;
@@ -20,7 +20,7 @@ const COLOURS = {
20
20
  variantC: 'var(--xp-series-c)',
21
21
  holdout: 'var(--xp-series-muted)'
22
22
  };
23
- export function VersionsSection({ test, surface, parts }) {
23
+ export function VersionsSection({ test, surface, parts, contentOnCanvas = false }) {
24
24
  const id = useId();
25
25
  const doc = test.doc;
26
26
  const [weightEdit, setWeightEdit] = useState(null);
@@ -54,6 +54,9 @@ export function VersionsSection({ test, surface, parts }) {
54
54
  doc.kind === 'page' && testPageCollection(surface.pageCollections, doc, test.preflight?.pagePlacements)?.contentChecks === false ? /*#__PURE__*/ _jsx("p", {
55
55
  children: PAGE_COPY.contentChecksOff
56
56
  }) : null,
57
+ contentOnCanvas ? /*#__PURE__*/ _jsx("p", {
58
+ children: C.editVersionsOnCanvas
59
+ }) : null,
57
60
  reason ? /*#__PURE__*/ _jsx("p", {
58
61
  className: "xp-ui-help",
59
62
  children: reason
@@ -80,7 +83,9 @@ export function VersionsSection({ test, surface, parts }) {
80
83
  id: `xp-version-${arm.key}`,
81
84
  tabIndex: -1,
82
85
  children: [
83
- /*#__PURE__*/ _jsx(TextEdit, {
86
+ contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
87
+ children: arm.label
88
+ }) : /*#__PURE__*/ _jsx(TextEdit, {
84
89
  label: `${GROUP_LABELS[arm.key]}: ${C.label}`,
85
90
  value: arm.label,
86
91
  reason: reason,
@@ -111,11 +116,12 @@ export function VersionsSection({ test, surface, parts }) {
111
116
  /*#__PURE__*/ _jsx(parts.VersionContent, {
112
117
  test: test,
113
118
  surface: surface,
114
- armIndex: index
119
+ armIndex: index,
120
+ summary: contentOnCanvas
115
121
  }),
116
122
  /*#__PURE__*/ _jsx("div", {
117
123
  className: "xp-ui-button-group xp-version-remove",
118
- children: arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
124
+ children: !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
119
125
  variant: "quiet",
120
126
  size: "sm",
121
127
  disabled: Boolean(reason),
@@ -175,7 +181,7 @@ export function VersionsSection({ test, surface, parts }) {
175
181
  role: "alert",
176
182
  children: test.errors.arms
177
183
  }) : null,
178
- /*#__PURE__*/ _jsxs("div", {
184
+ !contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
179
185
  className: "xp-section-actions xp-ui-button-group",
180
186
  title: reason ?? undefined,
181
187
  children: [
@@ -195,7 +201,7 @@ export function VersionsSection({ test, surface, parts }) {
195
201
  children: C.split
196
202
  })
197
203
  ]
198
- }),
204
+ }) : null,
199
205
  doc.kind !== 'page' && doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
200
206
  className: "xp-ui-help",
201
207
  children: ARMS_COPY.holdout
@@ -0,0 +1,92 @@
1
+ :where(.xp-test-surface) .xp-test-page { color: var(--xp-text); background: var(--xp-bg); max-width: 90rem; margin: 0 auto; padding: 1.5rem; }
2
+ :where(.xp-test-surface) .xp-test-page--setup { min-width: 0; padding: 0 0 160px; }
3
+ :where(.xp-test-surface) .xp-test-header { position: sticky; top: 0; z-index: 10; background: var(--xp-bg); padding: 1rem 0; border-bottom: 1px solid var(--xp-border); }
4
+ :where(.xp-test-surface) .xp-header-meta, :where(.xp-test-surface) .xp-section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-block: 1rem; }
5
+ :where(.xp-test-surface) .xp-kind-chip, :where(.xp-test-surface) .xp-status-pill { border: 1px solid var(--xp-border-strong); border-radius: 1rem; padding: .25rem .75rem; }
6
+ :where(.xp-test-surface) .xp-status-pill--success, :where(.xp-test-surface) .xp-content-ready, :where(.xp-test-surface) .xp-section-check--done { color: var(--xp-success-text); }
7
+ :where(.xp-test-surface) .xp-content-empty, :where(.xp-test-surface) .xp-status-pill--warning { color: var(--xp-warning-text); }
8
+ :where(.xp-test-surface) .xp-test-section, :where(.xp-test-surface) .xp-test-advanced { scroll-margin-top: var(--xp-space-6); }
9
+ :where(.xp-test-surface) .xp-version-rows { display: grid; grid-template-columns: minmax(0, 1.3fr) var(--xp-version-share-width) minmax(var(--xp-version-state-width), 1fr) var(--xp-version-remove-width); gap: var(--xp-space-3); align-items: center; }
10
+ :where(.xp-test-surface) .xp-version-row, :where(.xp-test-surface) .xp-version-grid-head { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; gap: var(--xp-space-3); align-items: center; }
11
+ :where(.xp-test-surface) .xp-version-grid-head { margin-bottom: var(--xp-space-2); font: var(--xp-text-small); color: var(--xp-text-2); }
12
+ :where(.xp-test-surface) .xp-version-row > .xp-field-error, :where(.xp-test-surface) .xp-version-row > [role=alert] { grid-column: 1 / -1; }
13
+ :where(.xp-test-surface) .xp-version-remove { grid-column: 4; }
14
+ :where(.xp-test-surface) .xp-grid-field .xp-ui-field { margin: 0; }
15
+ :where(.xp-test-surface) .xp-grid-field .xp-ui-field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
16
+ :where(.xp-test-surface) .xp-version-content { display: flex; flex-wrap: nowrap; gap: var(--xp-space-2); align-items: center; min-width: 0; }
17
+ :where(.xp-test-surface) .xp-version-content .xp-ui-button { white-space: nowrap; }
18
+ :where(.xp-test-surface) .xp-version-content--page { flex-direction: column; align-items: stretch; gap: var(--xp-space-3); }
19
+ :where(.xp-test-surface) .xp-copy-route ol { list-style: decimal; padding-inline-start: var(--xp-space-6); }
20
+ :where(.xp-test-surface) .xp-content-chip { flex-shrink: 0; display: inline-flex; width: fit-content; border-radius: var(--xp-radius-chip); padding: var(--xp-space-half) var(--xp-space-2); font: var(--xp-text-small); background: var(--xp-surface-2); color: var(--xp-text-2); }
21
+ :where(.xp-test-surface) .xp-content-chip.xp-content-ready { background: var(--xp-success-bg); color: var(--xp-success); }
22
+ :where(.xp-test-surface) .xp-content-chip.xp-content-empty { background: var(--xp-warning-bg); color: var(--xp-warning); }
23
+ :where(.xp-test-surface) .xp-traffic-bar { display: flex; height: var(--xp-space-2); gap: var(--xp-space-half); margin-block: var(--xp-space-5) var(--xp-space-3); overflow: hidden; border-radius: var(--xp-space-1); }
24
+ :where(.xp-test-surface) .xp-traffic-bar > span { display: block; }
25
+ :where(.xp-test-surface) .xp-split-legend { display: flex; flex-wrap: wrap; gap: var(--xp-space-4); font: var(--xp-text-small); color: var(--xp-text-2); }
26
+ :where(.xp-test-surface) .xp-split-legend i { display: inline-block; width: var(--xp-legend-key-size); height: var(--xp-legend-key-size); border-radius: var(--xp-legend-key-radius); margin-right: var(--xp-space-one-half); }
27
+ :where(.xp-test-surface) .xp-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--xp-space-4); }
28
+ :where(.xp-test-surface) .xp-test-advanced .xp-field-grid { padding-top: var(--xp-space-4); }
29
+ :where(.xp-test-surface) .xp-field-grid > div { min-width: 0; }
30
+ :where(.xp-test-surface) .xp-field-grid p, :where(.xp-test-surface) .xp-page-binding p { color: var(--xp-text-2); font: var(--xp-text-small); }
31
+ :where(.xp-test-surface) .xp-read-only code { font-family: var(--xp-mono); overflow-wrap: anywhere; }
32
+ :where(.xp-test-surface) .xp-ui-checkbox-list { display: flex; flex-wrap: wrap; gap: var(--xp-space-2) var(--xp-space-4); }
33
+ :where(.xp-test-surface) .xp-duration-suggestion { align-items: center; margin-top: var(--xp-space-4); }
34
+ :where(.xp-test-surface) .xp-read-only { padding-block: .5rem; }
35
+ :where(.xp-test-surface) .xp-read-only p { margin-block: .5rem; }
36
+ :where(.xp-test-surface) .xp-field-error { color: var(--xp-error-text); }
37
+
38
+ :where(.xp-test-surface) .xp-targeting-row { display: grid; grid-template-columns: var(--xp-targeting-attribute-width) var(--xp-targeting-comparison-width) minmax(0, 1fr); align-items: start; gap: var(--xp-space-3); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-control); padding: var(--xp-space-4); margin-bottom: var(--xp-space-4); }
39
+ :where(.xp-test-surface) .xp-targeting-row > .xp-ui-button-group, :where(.xp-test-surface) .xp-targeting-row > p { grid-column: 1 / -1; }
40
+ @media (max-width: 720px) {
41
+ :where(.xp-test-surface) .xp-version-rows { grid-template-columns: minmax(0, 1fr) var(--xp-version-share-width-mobile); }
42
+ :where(.xp-test-surface) .xp-version-content { flex-wrap: wrap; }
43
+ :where(.xp-test-surface) .xp-version-remove:empty { display: none; }
44
+ :where(.xp-test-surface) .xp-version-content, :where(.xp-test-surface) .xp-setting-values, :where(.xp-test-surface) .xp-version-remove { grid-column: 1 / -1; }
45
+ :where(.xp-test-surface) .xp-version-grid-head > :nth-child(n+3) { display: none; }
46
+ :where(.xp-test-surface) .xp-targeting-row, :where(.xp-test-surface) .xp-field-grid { grid-template-columns: 1fr; }
47
+ }
48
+
49
+ :where(.xp-test-surface) .xp-test-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: var(--xp-space-8); }
50
+ :where(.xp-test-surface) .xp-test-content { display: grid; gap: var(--xp-space-8); min-width: 0; max-width: 760px; }
51
+ :where(.xp-test-surface) .xp-test-rail { position: sticky; top: var(--xp-space-6); min-width: 0; }
52
+ :where(.xp-test-surface) .xp-test-rail-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--xp-space-1); }
53
+ :where(.xp-test-surface) .xp-test-rail-item { display: flex; align-items: center; gap: var(--xp-space-2); padding: var(--xp-space-2); border-radius: var(--xp-radius-control); color: var(--xp-text-2); text-decoration: none; font: var(--xp-text-small); }
54
+ :where(.xp-test-surface) .xp-test-rail-item:hover, :where(.xp-test-surface) .xp-test-rail-item.is-active { background: var(--xp-surface-2); color: var(--xp-text); }
55
+ :where(.xp-test-surface) .xp-test-rail-item.is-active { font-weight: 600; }
56
+ :where(.xp-test-surface) .xp-test-rail-item--advanced { margin-top: var(--xp-space-3); color: var(--xp-text-3); }
57
+ :where(.xp-test-surface) .xp-test-rail-mark { flex: none; color: var(--xp-text-3); }
58
+ :where(.xp-test-surface) .xp-test-rail-mark--done { color: var(--xp-success); }
59
+ :where(.xp-test-surface) .xp-test-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
60
+ :where(.xp-test-surface) .xp-test-rail-item:focus-visible, :where(.xp-test-surface) .xp-test-advanced > summary:focus-visible, :where(.xp-test-surface) .xp-test-content h2:focus { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
61
+ :where(.xp-test-surface) .xp-test-advanced { border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); }
62
+ :where(.xp-test-surface) .xp-test-advanced > summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--xp-space-3); padding: var(--xp-space-4) var(--xp-space-5); color: var(--xp-text-2); }
63
+ :where(.xp-test-surface) .xp-test-advanced > summary h2 { margin: 0; font: var(--xp-text-body); }
64
+ :where(.xp-test-surface) .xp-test-advanced[open] > summary { border-bottom: 1px solid var(--xp-border); }
65
+ :where(.xp-test-surface) .xp-test-readiness-bar { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; background: var(--xp-surface); border-top: 1px solid var(--xp-border); }
66
+ :where(.xp-test-surface) .xp-readiness { color: var(--xp-text); background: var(--xp-surface); padding: var(--xp-space-4); border: 1px solid var(--xp-border-strong); border-radius: var(--xp-radius-control); }
67
+ :where(.xp-test-surface) .xp-readiness--ready:not(.xp-readiness--bar) { background: var(--xp-success-bg); }
68
+ :where(.xp-test-surface) .xp-readiness--bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--xp-space-2) var(--xp-space-4); padding-block: var(--xp-space-3); min-height: 64px; border: 0; border-radius: 0; }
69
+ :where(.xp-test-surface) .xp-readiness__state { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
70
+ :where(.xp-test-surface) .xp-readiness__state p, :where(.xp-test-surface) .xp-readiness--bar > p { margin: 0; }
71
+ :where(.xp-test-surface) .xp-readiness__state > p { font-weight: 500; white-space: pre-line; }
72
+ :where(.xp-test-surface) .xp-readiness--bar .xp-save-status, :where(.xp-test-surface) .xp-readiness__separator { color: var(--xp-text-3); font: var(--xp-text-small); }
73
+ :where(.xp-test-surface) .xp-readiness__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--xp-space-2); }
74
+ :where(.xp-test-surface) .xp-readiness--bar > .xp-readiness__actions { grid-column: 2; grid-row: 1 / span 3; justify-content: flex-end; }
75
+ @media (max-width: 960px) {
76
+ :where(.xp-test-surface) .xp-test-layout { grid-template-columns: minmax(0, 1fr); gap: var(--xp-space-5); }
77
+ :where(.xp-test-surface) .xp-test-rail { top: 0; z-index: 2; background: var(--xp-bg); padding-block: var(--xp-space-2); border-bottom: 1px solid var(--xp-border); }
78
+ :where(.xp-test-surface) .xp-test-rail-list { flex-direction: row; overflow-x: auto; }
79
+ :where(.xp-test-surface) .xp-test-rail-item { white-space: nowrap; }
80
+ :where(.xp-test-surface) .xp-test-rail-item--advanced { margin-top: 0; }
81
+ :where(.xp-test-surface) .xp-test-content { max-width: none; }
82
+ :where(.xp-test-surface) .xp-test-section, :where(.xp-test-surface) .xp-test-advanced { scroll-margin-top: 64px; }
83
+ }
84
+ @media (max-width: 720px) {
85
+ :where(.xp-test-surface) .xp-readiness--bar { grid-template-columns: minmax(0, 1fr); }
86
+ /* The sentence wraps under the save state here, so a trailing separator would dangle. */
87
+ :where(.xp-test-surface) .xp-readiness--bar .xp-readiness__separator { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
88
+ :where(.xp-test-surface) .xp-readiness--bar > .xp-readiness__actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
89
+ }
90
+
91
+ :where(.xp-test-surface) .xp-ui-checkbox-list > .xp-ui-field:has(input[type="search"]) { flex-basis: 100%; }
92
+ :where(.xp-test-surface) .xp-targeting-row .xp-ui-chips { margin-block: 0; }
@@ -2,9 +2,12 @@ import type { Arm, DocId } from '../../types/contracts.js';
2
2
  import type { PreflightResult } from '../../types/endpoints.js';
3
3
  import type { TestDocument, TestDocumentPatch } from './testDocument.model.js';
4
4
  /** Section data only: staging never saves. Call commit on blur or a section action. */
5
- export declare function useTestDocument(id: DocId, { apiRoute, refetchPreflightOnFocus }: {
5
+ export declare function useTestDocument(id: DocId, { apiRoute, refetchPreflightOnFocus, enabled, onDocument, onPreflight }: {
6
6
  apiRoute: string;
7
7
  refetchPreflightOnFocus?: boolean;
8
+ enabled?: boolean;
9
+ onDocument?: (doc: TestDocument) => void;
10
+ onPreflight?: (preflight: PreflightResult) => void;
8
11
  }): {
9
12
  stage: (partial: TestDocumentPatch) => void;
10
13
  commit: () => Promise<void>;
@@ -33,4 +36,5 @@ export declare function useTestDocument(id: DocId, { apiRoute, refetchPreflightO
33
36
  stale: boolean;
34
37
  /** Path-specific validation errors; _section is the fallback for a section-wide refusal. */
35
38
  errors: Record<string, string>;
39
+ acceptTransition?: (result: unknown) => void;
36
40
  };
@@ -65,7 +65,15 @@ function stage(session, partial) {
65
65
  if (!session.queue.length) session.view.saving = 'idle';
66
66
  session.publish();
67
67
  }
68
- /** Section data only: staging never saves. Call commit on blur or a section action. */ export function useTestDocument(id, { apiRoute, refetchPreflightOnFocus = false }) {
68
+ /** Section data only: staging never saves. Call commit on blur or a section action. */ export function useTestDocument(id, { apiRoute, refetchPreflightOnFocus = false, enabled = true, onDocument, onPreflight }) {
69
+ const observers = useRef({
70
+ onDocument,
71
+ onPreflight
72
+ });
73
+ observers.current = {
74
+ onDocument,
75
+ onPreflight
76
+ };
69
77
  const base = apiRoute.replace(/\/$/, '');
70
78
  const documentId = String(id);
71
79
  const key = JSON.stringify([
@@ -81,6 +89,7 @@ function stage(session, partial) {
81
89
  }));
82
90
  const [reloadCount, setReloadCount] = useState(0);
83
91
  useEffect(()=>{
92
+ if (!enabled) return;
84
93
  const controller = new AbortController();
85
94
  const session = {
86
95
  key,
@@ -141,6 +150,7 @@ function stage(session, partial) {
141
150
  if (revision !== preflightRevision) return;
142
151
  session.preflightLoading = false;
143
152
  if (data) {
153
+ observers.current.onPreflight?.(data);
144
154
  session.view.preflight = data;
145
155
  session.view.preflightError = null;
146
156
  if (initial) session.view.loadState = 'ready';
@@ -235,13 +245,17 @@ function stage(session, partial) {
235
245
  ...patch,
236
246
  updatedAt: undefined
237
247
  };
248
+ if (readable) observers.current.onDocument?.(doc);
238
249
  saved = true;
239
250
  // Keep readiness pending even while recovering an unreadable successful PATCH body.
240
251
  session.preflightReads++;
241
252
  session.publish();
242
253
  session.view.errors = clearErrors(session.view.errors, patch);
243
254
  delete session.view.errors._section;
244
- if (!readable && !controller.signal.aborted) session.saved = await readDocument();
255
+ if (!readable && !controller.signal.aborted) {
256
+ session.saved = await readDocument();
257
+ observers.current.onDocument?.(session.saved);
258
+ }
245
259
  }
246
260
  }
247
261
  } catch (error) {
@@ -299,6 +313,7 @@ function stage(session, partial) {
299
313
  if (controller.signal.aborted) return;
300
314
  if (doc.id == null || !doc.status) throw new Error(API_MESSAGES.unreadable);
301
315
  session.saved = doc;
316
+ observers.current.onDocument?.(doc);
302
317
  await refreshPreflight(true);
303
318
  if (controller.signal.aborted) return;
304
319
  session.publish();
@@ -334,7 +349,8 @@ function stage(session, partial) {
334
349
  key,
335
350
  base,
336
351
  documentId,
337
- reloadCount
352
+ reloadCount,
353
+ enabled
338
354
  ]);
339
355
  const stagePartial = useCallback((partial)=>{
340
356
  const session = current.current;
@@ -404,7 +420,22 @@ function stage(session, partial) {
404
420
  key,
405
421
  commit
406
422
  ]);
423
+ // Transition responses outlive this mount just like submitted PATCHes. Publish
424
+ // their authoritative document before attempting a mount-dependent reload.
425
+ const transitionActions = {
426
+ acceptTransition (result) {
427
+ const doc = result?.doc;
428
+ if (!doc || doc.id == null || !doc.status || !Array.isArray(doc.arms) || String(doc.id) !== documentId) return;
429
+ observers.current.onDocument?.(doc);
430
+ const session = current.current;
431
+ if (session?.key === key && !session.controller.signal.aborted) {
432
+ session.saved = doc;
433
+ session.publish();
434
+ }
435
+ }
436
+ };
407
437
  return {
438
+ ...transitionActions,
408
439
  ...state.key === key ? state.view : initialView(),
409
440
  stage: stagePartial,
410
441
  commit,
@@ -1,4 +1,4 @@
1
- import { formatAdminURL } from 'payload/shared';
1
+ import { formatAdminURL } from './format/adminURL.js';
2
2
  export function surfaceQuery(query = {}) {
3
3
  const params = new URLSearchParams();
4
4
  for (const [key, value] of Object.entries(query)){
@@ -2,7 +2,7 @@ import { placementPathContent, placementTests } from '../db/placements.js';
2
2
  import { lockPagePaths } from '../db/locks.js';
3
3
  import { normalisePath } from '../runtime/normalisePath.js';
4
4
  import { scanBlockPlacements } from './placements.js';
5
- import { interactingTestsCopy } from '../admin/copy/readiness.js';
5
+ import { interactingTestsCopy } from '../testSurface/copy/readiness.js';
6
6
  import { XpRefusal } from '../errors.js';
7
7
  import { pageTargetPaths } from './checkStart.js';
8
8
  export async function detached(req, fn) {