@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
@@ -0,0 +1,21 @@
1
+ import { type PayloadRequest } from 'payload';
2
+ import type { DocId } from '../types/contracts.js';
3
+ /** Adapter rows retain locale maps; Start's Local API scan flattens these fields
4
+ * to req.locale (and req.fallbackLocale). Registrations name top-level fields.
5
+ * Match Payload afterRead/promise.js:50-89: [] is present, not a fallback.
6
+ */
7
+ export declare function placementLocaleContent(req: PayloadRequest, collection: string, doc: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
8
+ export interface PlacementLocaleView {
9
+ locale: string;
10
+ fallbackLocale: import('payload').TypedFallbackLocale;
11
+ }
12
+ export declare const placementDocumentKey: (collection: string, id: DocId, view: PlacementLocaleView) => string;
13
+ export type RemovedPlacementViews = Map<string, PlacementLocaleView[]>;
14
+ export declare function localeRequest(req: PayloadRequest, view: PlacementLocaleView): PayloadRequest;
15
+ /** Canonical views of registered content, without multiplying nonlocalized rows. */
16
+ export declare function placementLocaleViews(req: PayloadRequest, collection: string): PlacementLocaleView[];
17
+ /** Compare every locale view: a localized edit can also change fallback
18
+ * content in another locale. Whole-row removals replace every view with absence.
19
+ * The incoming hook document is already flattened to the writing locale.
20
+ */
21
+ export declare function removedPlacementViews(req: PayloadRequest, collection: string, before: Record<string, unknown> | undefined, after: Record<string, unknown>, removingPage: boolean): RemovedPlacementViews;
@@ -0,0 +1,115 @@
1
+ import { sanitizeFallbackLocale } from 'payload';
2
+ import { flattenTopLevelFields } from 'payload/shared';
3
+ import { puckCollections } from '../options.js';
4
+ import { placementSlugs } from './bindings.js';
5
+ import { isObject } from './model.js';
6
+ /** Adapter rows retain locale maps; Start's Local API scan flattens these fields
7
+ * to req.locale (and req.fallbackLocale). Registrations name top-level fields.
8
+ * Match Payload afterRead/promise.js:50-89: [] is present, not a fallback.
9
+ */ export function placementLocaleContent(req, collection, doc) {
10
+ const localization = req.payload.config.localization;
11
+ if (!doc || !localization || req.locale === 'all') return doc;
12
+ const config = req.payload.config.collections?.find((entry)=>entry.slug === collection);
13
+ if (!config) return doc;
14
+ const options = req.payload.config.custom.xp;
15
+ const names = new Set([
16
+ ...puckCollections(options).filter((entry)=>entry.slug === collection).map((entry)=>entry.field),
17
+ ...(options.blocks?.collections ?? []).filter((entry)=>entry.slug === collection).map((entry)=>entry.field)
18
+ ]);
19
+ const result = {
20
+ ...doc
21
+ };
22
+ const locale = req.locale || localization.defaultLocale;
23
+ const fallback = sanitizeFallbackLocale({
24
+ fallbackLocale: req.fallbackLocale ?? null,
25
+ locale,
26
+ localization
27
+ });
28
+ for (const field of flattenTopLevelFields(config.fields)){
29
+ if (!('name' in field) || typeof field.name !== 'string' || !names.has(field.name) || !('localized' in field) || !field.localized) continue;
30
+ const values = doc[field.name];
31
+ if (!isObject(values)) continue;
32
+ let value = values[locale];
33
+ if (value == null && fallback && fallback !== locale) {
34
+ for (const code of Array.isArray(fallback) ? fallback : [
35
+ fallback
36
+ ]){
37
+ if (values[code] != null && values[code] !== '') {
38
+ value = values[code];
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ result[field.name] = value;
44
+ }
45
+ return result;
46
+ }
47
+ export const placementDocumentKey = (collection, id, view)=>JSON.stringify([
48
+ collection,
49
+ String(id),
50
+ view
51
+ ]);
52
+ export function localeRequest(req, view) {
53
+ return {
54
+ ...req,
55
+ ...view
56
+ };
57
+ }
58
+ /** Canonical views of registered content, without multiplying nonlocalized rows. */ export function placementLocaleViews(req, collection) {
59
+ const localization = req.payload.config.localization;
60
+ const config = req.payload.config.collections?.find((entry)=>entry.slug === collection);
61
+ const options = req.payload.config.custom.xp;
62
+ const names = new Set([
63
+ ...puckCollections(options).filter((entry)=>entry.slug === collection).map((entry)=>entry.field),
64
+ ...(options.blocks?.collections ?? []).filter((entry)=>entry.slug === collection).map((entry)=>entry.field)
65
+ ]);
66
+ const localized = config && flattenTopLevelFields(config.fields).some((field)=>'name' in field && names.has(field.name) && 'localized' in field && field.localized);
67
+ return localization && localized ? localization.localeCodes.map((locale)=>({
68
+ locale,
69
+ fallbackLocale: sanitizeFallbackLocale({
70
+ fallbackLocale: null,
71
+ locale,
72
+ localization
73
+ })
74
+ })) : [
75
+ {
76
+ locale: '',
77
+ fallbackLocale: false
78
+ }
79
+ ];
80
+ }
81
+ /** Compare every locale view: a localized edit can also change fallback
82
+ * content in another locale. Whole-row removals replace every view with absence.
83
+ * The incoming hook document is already flattened to the writing locale.
84
+ */ export function removedPlacementViews(req, collection, before, after, removingPage) {
85
+ const result = new Map();
86
+ if (!before) return result;
87
+ const localization = req.payload.config.localization;
88
+ const config = req.payload.config.collections?.find((entry)=>entry.slug === collection);
89
+ const options = req.payload.config.custom.xp;
90
+ const fields = config ? flattenTopLevelFields(config.fields) : [];
91
+ const localized = fields.filter((field)=>'name' in field && 'localized' in field && field.localized);
92
+ // Keep the raw locale maps for unchanged languages when merging a partial,
93
+ // flattened main-row write back into the adapter baseline.
94
+ const rawAfter = {
95
+ ...after
96
+ };
97
+ if (localization && req.locale !== 'all') for (const field of localized){
98
+ if (!('name' in field) || typeof field.name !== 'string' || !(field.name in after)) continue;
99
+ const previousValue = before[field.name];
100
+ rawAfter[field.name] = {
101
+ ...isObject(previousValue) ? previousValue : {},
102
+ [req.locale || localization.defaultLocale]: after[field.name]
103
+ };
104
+ }
105
+ for (const view of placementLocaleViews(req, collection)){
106
+ const viewReq = localeRequest(req, view);
107
+ const previous = placementSlugs(options, collection, placementLocaleContent(viewReq, collection, before));
108
+ const next = removingPage ? [] : placementSlugs(options, collection, placementLocaleContent(viewReq, collection, rawAfter));
109
+ for (const slug of previous.filter((slug)=>!next.includes(slug)))result.set(slug, [
110
+ ...result.get(slug) ?? [],
111
+ view
112
+ ]);
113
+ }
114
+ return result;
115
+ }
@@ -1,4 +1,4 @@
1
- import { SURFACE_COPY } from '../../admin/copy/surface.js';
1
+ import { SURFACE_COPY } from '../../testSurface/copy/surface.js';
2
2
  import * as paths from '../../admin/paths.js';
3
3
  import { managedAccess } from '../access.js';
4
4
  import { serializeAttributeKeys, serializeFlagPoints } from '../serialize.js';
@@ -1,4 +1,4 @@
1
- import { SURFACE_COPY } from '../admin/copy/surface.js';
1
+ import { SURFACE_COPY } from '../testSurface/copy/surface.js';
2
2
  import { CLICK_KEY, isClickSource, validClickSource } from '../goals/key.js';
3
3
  import { XP_METRIC_SOURCE_SELECT, XP_GOALS_COLLECTION_LIST, XP_GOAL_EDIT_REDIRECT } from '../admin/paths.js';
4
4
  import { managedAccess } from './access.js';
@@ -0,0 +1,30 @@
1
+ import type { PayloadRequest, Where } from 'payload';
2
+ import { type PlacementLocaleView } from '../blocks/placementLocale.js';
3
+ import type { DocId } from '../types/contracts.js';
4
+ export interface BulkPlacementRemoval {
5
+ documents: Set<string>;
6
+ change?: {
7
+ collection: string;
8
+ data?: Record<string, unknown>;
9
+ draft: boolean;
10
+ deleting: boolean;
11
+ };
12
+ refusals: Map<string, string>;
13
+ }
14
+ export declare function usesBulkDocumentTransactions(req: PayloadRequest): boolean;
15
+ /** A distinct operation identity without copying the transaction/context. Native
16
+ * Request accessors and methods must use the original receiver.
17
+ */
18
+ export declare function placementOperationRequest(req: PayloadRequest, fields: Map<PropertyKey, unknown>, failed?: () => void): PayloadRequest;
19
+ /** Observe Payload's actual, access-filtered bulk selection before it dispatches
20
+ * any document hooks. This request-only proxy adds no reads and never replaces
21
+ * the shared adapter. Matching the original Where node avoids capturing nested
22
+ * access-hook reads. queryDrafts prefixes keys but preserves condition objects.
23
+ * Payload 3's update/delete operations select the entire set before Promise.all.
24
+ */
25
+ export declare function bulkPlacementRequest(req: PayloadRequest, collection: string, where: Where, data: Record<string, unknown> | undefined, draft: boolean, deleting: boolean, bulk: BulkPlacementRemoval): PayloadRequest;
26
+ /** Evaluate the common change against the published row seen under E, rather
27
+ * than a draft version or a selection snapshot from before the lock. */
28
+ export declare function bulkRemoves(bulk: BulkPlacementRemoval | undefined, req: PayloadRequest, collection: string, doc: Record<string, unknown> & {
29
+ id: DocId;
30
+ }, slug: string, view: PlacementLocaleView): boolean;
@@ -0,0 +1,107 @@
1
+ import { removedPlacementViews, placementDocumentKey } from '../blocks/placementLocale.js';
2
+ // Payload starts/ends a transaction per bulk document with this adapter option.
3
+ export function usesBulkDocumentTransactions(req) {
4
+ return req.payload.db.bulkOperationsSingleTransaction === true;
5
+ }
6
+ const operationRequestState = Symbol('xpPlacementRequestState');
7
+ /** A distinct operation identity without copying the transaction/context. Native
8
+ * Request accessors and methods must use the original receiver.
9
+ */ export function placementOperationRequest(req, fields, failed) {
10
+ const parent = req[operationRequestState];
11
+ const state = {
12
+ target: parent?.target ?? req,
13
+ failed: failed ?? parent?.failed
14
+ };
15
+ return new Proxy(req, {
16
+ deleteProperty (target, key) {
17
+ // Transaction deletion must reach the shared request without ending any
18
+ // ancestor operation. Extra wrappers of this operation inherit its cleanup.
19
+ if (key === 'transactionID') {
20
+ state.failed?.();
21
+ return Reflect.deleteProperty(state.target, key);
22
+ }
23
+ return Reflect.deleteProperty(target, key);
24
+ },
25
+ get (target, key) {
26
+ if (key === operationRequestState) return state;
27
+ if (fields.has(key)) return fields.get(key);
28
+ const value = Reflect.get(target, key, target);
29
+ return typeof Object.getOwnPropertyDescriptor(Request.prototype, key)?.value === 'function' ? value.bind(target) : value;
30
+ }
31
+ });
32
+ }
33
+ /** Observe Payload's actual, access-filtered bulk selection before it dispatches
34
+ * any document hooks. This request-only proxy adds no reads and never replaces
35
+ * the shared adapter. Matching the original Where node avoids capturing nested
36
+ * access-hook reads. queryDrafts prefixes keys but preserves condition objects.
37
+ * Payload 3's update/delete operations select the entire set before Promise.all.
38
+ */ export function bulkPlacementRequest(req, collection, where, data, draft, deleting, bulk) {
39
+ const config = req.payload.config.collections.find((entry)=>entry.slug === collection);
40
+ const draftOnly = draft && Boolean(config?.versions && config.versions.drafts) && data?._status !== 'published';
41
+ bulk.change = {
42
+ collection,
43
+ data,
44
+ draft: draftOnly,
45
+ deleting
46
+ };
47
+ let captured = false;
48
+ const matches = (value, expected, versions)=>{
49
+ if (value === expected) return true;
50
+ if (!versions) return false;
51
+ if (!value || !expected || typeof value !== 'object' || typeof expected !== 'object') return false;
52
+ const actual = value;
53
+ return Object.entries(expected).every(([key, condition])=>{
54
+ if (key === 'and' || key === 'or') return Array.isArray(actual[key]) && Array.isArray(condition) && condition.length === actual[key].length && condition.every((entry, i)=>matches(actual[key][i], entry, versions));
55
+ return actual[versions ? key === 'id' ? 'parent' : `version.${key}` : key] === condition;
56
+ }) && Object.keys(actual).length === Object.keys(expected).length;
57
+ };
58
+ const contains = (value, versions)=>matches(value, where, versions) || !!value && typeof value === 'object' && [
59
+ 'and',
60
+ 'or'
61
+ ].some((key)=>{
62
+ const children = value[key];
63
+ return Array.isArray(children) && children.some((child)=>contains(child, versions));
64
+ });
65
+ const database = new Proxy(req.payload.db, {
66
+ get (target, key, receiver) {
67
+ const method = Reflect.get(target, key, receiver);
68
+ if (key !== 'find' && key !== 'queryDrafts') return method;
69
+ return async (query)=>{
70
+ const selection = !captured && (key !== 'queryDrafts' || 'pagination' in query && query.pagination === false) && query.req === scoped && query.collection === collection && contains(query.where, key === 'queryDrafts');
71
+ const result = await method.call(target, query);
72
+ if (selection) {
73
+ captured = true;
74
+ for (const doc of result.docs)bulk.documents.add(JSON.stringify([
75
+ collection,
76
+ String(doc.id)
77
+ ]));
78
+ }
79
+ return result;
80
+ };
81
+ }
82
+ });
83
+ const payload = new Proxy(req.payload, {
84
+ get: (target, key, receiver)=>key === 'db' ? database : Reflect.get(target, key, receiver)
85
+ });
86
+ const scoped = placementOperationRequest(req, new Map([
87
+ [
88
+ 'payload',
89
+ payload
90
+ ]
91
+ ]));
92
+ return scoped;
93
+ }
94
+ /** Evaluate the common change against the published row seen under E, rather
95
+ * than a draft version or a selection snapshot from before the lock. */ export function bulkRemoves(bulk, req, collection, doc, slug, view) {
96
+ const change = bulk?.change;
97
+ if (!change || change.draft || change.collection !== collection || !bulk.documents.has(JSON.stringify([
98
+ collection,
99
+ String(doc.id)
100
+ ]))) return false;
101
+ const after = {
102
+ ...doc,
103
+ ...change.data
104
+ };
105
+ const views = removedPlacementViews(req, collection, doc, after, change.deleting || after.deletedAt != null || after._status === 'draft');
106
+ return (views.get(slug) ?? []).some((removed)=>placementDocumentKey(collection, doc.id, removed) === placementDocumentKey(collection, doc.id, view));
107
+ }
@@ -21,6 +21,8 @@ export interface PlacementTest {
21
21
  }
22
22
  /** Raw reads only: guard discovery includes every status, interaction checks filter under the locks. */
23
23
  export declare function placementTests(exec: Executor): Promise<PlacementTest[]>;
24
+ /** Indexed slug lookup for the removal guard; startable tests share E with Start before status is rechecked. */
25
+ export declare function removableBlockTests(exec: Executor, slugs: readonly string[]): Promise<Array<Pick<PlacementTest, 'id' | 'slug' | 'name' | 'status'>>>;
24
26
  /** §7.8: interacting-tests computes placement paths from published rows. */
25
27
  export declare function placementPathContent(req: PayloadRequest, collection: string, id: DocId): Promise<(Record<string, unknown> & {
26
28
  id: DocId;
@@ -14,6 +14,14 @@ import { qualifiedTable, quoteIdentifier as q } from './sql.js';
14
14
  placementDocs: row.placementDocs ?? null
15
15
  }));
16
16
  }
17
+ /** Indexed slug lookup for the removal guard; startable tests share E with Start before status is rechecked. */ export async function removableBlockTests(exec, slugs) {
18
+ const e = COLUMNS.experiments;
19
+ const { rows } = await exec.query(`SELECT ${q(e.id)} AS id, ${q(e.slug)} AS slug, ${q(e.name)} AS name, ${q(e.status)} AS status
20
+ FROM ${qualifiedTable(exec, TABLES.experiments)} WHERE ${q(e.slug)} = ANY($1::text[]) AND ${q(e.kind)} = 'block' AND ${q(e.status)} IN ('draft', 'stopped', 'running')`, [
21
+ slugs
22
+ ]);
23
+ return rows;
24
+ }
17
25
  /** §7.8: interacting-tests computes placement paths from published rows. */ export async function placementPathContent(req, collection, id) {
18
26
  return req.payload.db.findOne({
19
27
  collection,
@@ -0,0 +1,3 @@
1
+ import type { PayloadRequest } from 'payload';
2
+ /** The same request-scoped configuration the admin view sends this user. */
3
+ export declare function handleEditorSurface(req: PayloadRequest): Promise<Response>;
@@ -0,0 +1,31 @@
1
+ import { buildSurfaceProps } from '../admin/views/buildSurfaceProps.js';
2
+ /** The same request-scoped configuration the admin view sends this user. */ export async function handleEditorSurface(req) {
3
+ const props = await buildSurfaceProps({
4
+ req,
5
+ route: 'test',
6
+ searchParams: {}
7
+ }) ?? await buildSurfaceProps({
8
+ req,
9
+ route: 'results',
10
+ searchParams: {}
11
+ });
12
+ if (!props) return Response.json({
13
+ errors: [
14
+ {
15
+ code: 'forbidden',
16
+ message: 'Access denied'
17
+ }
18
+ ]
19
+ }, {
20
+ status: 403,
21
+ headers: {
22
+ 'Cache-Control': 'private, no-store'
23
+ }
24
+ });
25
+ const { route: _route, id: _id, pages: _pages, returnToTest: _return, ...surface } = props;
26
+ return Response.json(surface, {
27
+ headers: {
28
+ 'Cache-Control': 'private, no-store'
29
+ }
30
+ });
31
+ }
@@ -1,3 +1,4 @@
1
+ import { handleEditorSurface } from './editorSurface.js';
1
2
  import { handleClickKeys } from './clickKeys.js';
2
3
  import { createHmac, timingSafeEqual } from 'node:crypto';
3
4
  import { XP_MANIFEST_KEY_HEADER } from '../constants.js';
@@ -146,9 +147,15 @@ export const ROUTES = [
146
147
  path: '/xp/placements/status',
147
148
  access: 'manage',
148
149
  handler: handlePlacementStatus
150
+ },
151
+ {
152
+ method: 'get',
153
+ path: '/xp/editor-surface',
154
+ access: 'surface',
155
+ handler: handleEditorSurface
149
156
  }
150
157
  ];
151
- function error(status, code, message, detail) {
158
+ function endpointError(status, code, message, detail) {
152
159
  return Response.json({
153
160
  errors: [
154
161
  {
@@ -172,6 +179,11 @@ export function buildEndpoints(ctx) {
172
179
  const handlerContext = {
173
180
  options
174
181
  };
182
+ const error = (status, code, message, detail)=>{
183
+ const response = endpointError(status, code, message, detail);
184
+ if (route.access === 'surface') response.headers.set('Cache-Control', 'private, no-store');
185
+ return response;
186
+ };
175
187
  try {
176
188
  if (route.access === 'manage' || route.access === 'readResults') {
177
189
  if (!req.user) return error(401, 'unauthenticated', 'Authentication required');
@@ -179,6 +191,21 @@ export function buildEndpoints(ctx) {
179
191
  if (await access({
180
192
  req
181
193
  }) !== true) return error(403, 'forbidden', 'Access denied');
194
+ } else if (route.access === 'surface') {
195
+ if (!req.user) return error(401, 'unauthenticated', 'Authentication required');
196
+ // Match the admin surface: a failed host access check denies that permission.
197
+ const permits = async (access)=>{
198
+ try {
199
+ return await access({
200
+ req
201
+ }) === true;
202
+ } catch {
203
+ return false;
204
+ }
205
+ };
206
+ const manage = await permits(options.access.manage);
207
+ const read = options.access.readResults ? await permits(options.access.readResults) : manage;
208
+ if (!manage && !read) return error(403, 'forbidden', 'Access denied');
182
209
  } else if (route.access === 'manifestKey') {
183
210
  const secret = options.runtime.proxyRuntime.secrets[0];
184
211
  if (!secret) return error(401, 'unauthenticated', 'Invalid manifest key');
package/dist/errors.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare class XpRefusal extends Error {
22
22
  readonly detail: unknown | undefined;
23
23
  readonly status: 409 | 413 | 422 | 500 | 404;
24
24
  name: string;
25
+ readonly isOperational = true;
25
26
  readonly isPublic = true;
26
27
  constructor(code: RefusalCode, message: string, detail: unknown | undefined, status: 409 | 413 | 422 | 500 | 404, options?: ErrorOptions);
27
28
  }
package/dist/errors.js CHANGED
@@ -26,6 +26,8 @@ export class XpRefusal extends Error {
26
26
  detail;
27
27
  status;
28
28
  name = 'XpRefusal';
29
+ // Payload-compatible marker used by Puck's public-error response mapper.
30
+ isOperational = true;
29
31
  isPublic = true;
30
32
  constructor(code, message, detail, status, options){
31
33
  super(message, options), this.code = code, this.detail = detail, this.status = status;
@@ -6,7 +6,7 @@ import { validateClickGoal } from '../goals/validate.js';
6
6
  label: 'Click goal',
7
7
  type: 'text',
8
8
  admin: {
9
- description: 'Choose the short name of the click goal to count here.',
9
+ description: 'Choose the click goal to count here.',
10
10
  components: {
11
11
  Field: XP_GOAL_FIELD
12
12
  }
@@ -8,7 +8,14 @@ export type PickerStatus = 'loading' | 'ready' | 'not-manager' | 'error';
8
8
  export declare function goalSlug(name: string): string;
9
9
  export declare function clickGoalSlug(name: string): string;
10
10
  export declare function definedClickGoals(rows: readonly ClickGoal[]): ClickGoal[];
11
- export declare function undefinedClickKey(status: PickerStatus, goals: readonly ClickGoal[], value: string): boolean;
11
+ /** Keep legacy values visible without changing stored data during a read. */
12
+ export declare function clickGoalOptions(status: PickerStatus, goals: readonly ClickGoal[], value: string): {
13
+ options: {
14
+ value: string;
15
+ label: string;
16
+ }[];
17
+ missing: boolean;
18
+ };
12
19
  export declare function clickGoalBody(name: string, slug: string): {
13
20
  name: string;
14
21
  slug: string;
@@ -9,8 +9,26 @@ export function clickGoalSlug(name) {
9
9
  export function definedClickGoals(rows) {
10
10
  return rows.filter((row)=>isClickSource(row.source));
11
11
  }
12
- export function undefinedClickKey(status, goals, value) {
13
- return status === 'ready' && Boolean(value) && !goals.some((goal)=>goal.slug === value);
12
+ /** Keep legacy values visible without changing stored data during a read. */ export function clickGoalOptions(status, goals, value) {
13
+ const missing = status === 'ready' && Boolean(value) && !goals.some((goal)=>goal.slug === value);
14
+ const options = [
15
+ {
16
+ value: '',
17
+ label: C.none
18
+ },
19
+ ...goals.map((goal)=>({
20
+ value: goal.slug,
21
+ label: goal.name
22
+ }))
23
+ ];
24
+ if (value && !goals.some((goal)=>goal.slug === value)) options.push({
25
+ value,
26
+ label: missing ? `${value} (missing)` : value
27
+ });
28
+ return {
29
+ options,
30
+ missing
31
+ };
14
32
  }
15
33
  export function clickGoalBody(name, slug) {
16
34
  return {
@@ -1,7 +1,9 @@
1
1
  /** Shared by Payload's field and the Puck sidebar, without either UI dependency. */
2
2
  export declare const CLICK_GOAL_COPY: {
3
3
  readonly label: "Click goal";
4
- readonly choose: "Choose a click goal";
4
+ readonly none: "No click goal";
5
+ readonly loadError: "Couldn't load goals. Try again.";
6
+ readonly retry: "Try again";
5
7
  readonly newGoal: "+ New click goal";
6
8
  readonly title: "New click goal";
7
9
  readonly name: "Name";
@@ -9,7 +11,7 @@ export declare const CLICK_GOAL_COPY: {
9
11
  readonly advanced: "Advanced";
10
12
  readonly createGoal: "Create goal";
11
13
  readonly cancel: "Cancel";
12
- readonly undefinedKey: "No click goal has this name yet. Create it with \"+ New click goal\".";
14
+ readonly undefinedKey: "This click goal is missing. Choose another goal or “No click goal”.";
13
15
  readonly invalidKey: "Use a click goal short name.";
14
16
  readonly slugRule: "Use 1–64 lowercase letters, numbers, underscores or hyphens, starting with a letter or number.";
15
17
  readonly duplicateSlug: "Another goal already uses this short name. Change it under Advanced.";
@@ -1,6 +1,8 @@
1
1
  /** Shared by Payload's field and the Puck sidebar, without either UI dependency. */ export const CLICK_GOAL_COPY = {
2
2
  label: 'Click goal',
3
- choose: 'Choose a click goal',
3
+ none: 'No click goal',
4
+ loadError: "Couldn't load goals. Try again.",
5
+ retry: 'Try again',
4
6
  newGoal: '+ New click goal',
5
7
  title: 'New click goal',
6
8
  name: 'Name',
@@ -8,7 +10,7 @@
8
10
  advanced: 'Advanced',
9
11
  createGoal: 'Create goal',
10
12
  cancel: 'Cancel',
11
- undefinedKey: 'No click goal has this name yet. Create it with "+ New click goal".',
13
+ undefinedKey: 'This click goal is missing. Choose another goal or “No click goal”.',
12
14
  invalidKey: 'Use a click goal short name.',
13
15
  slugRule: 'Use 1–64 lowercase letters, numbers, underscores or hyphens, starting with a letter or number.',
14
16
  duplicateSlug: 'Another goal already uses this short name. Change it under Advanced.',
@@ -7,7 +7,7 @@ export declare function useClickGoalPicker(apiRoute: string, { enabled, onSelect
7
7
  status: PickerStatus;
8
8
  goals: ClickGoal[];
9
9
  canManage: boolean;
10
- undefinedKey: (value: string) => boolean;
10
+ retry: () => void;
11
11
  panel: {
12
12
  open: boolean;
13
13
  name: string;
@@ -2,7 +2,7 @@
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { fetchAllDocs } from '../../lib/fetchAllDocs.js';
4
4
  import { CLICK_KEY } from '../key.js';
5
- import { clickGoalBody, clickGoalCreateError, clickGoalSlug, definedClickGoals, undefinedClickKey } from './clickGoalPicker.model.js';
5
+ import { clickGoalBody, clickGoalCreateError, clickGoalSlug, definedClickGoals } from './clickGoalPicker.model.js';
6
6
  const goalLists = new Map();
7
7
  function publish(list, state) {
8
8
  // A read may finish after its last row unmounts and a new list has started.
@@ -180,7 +180,9 @@ const emptyPanel = ()=>({
180
180
  status,
181
181
  goals,
182
182
  canManage,
183
- undefinedKey: (value)=>undefinedClickKey(status, goals, value),
183
+ retry: ()=>{
184
+ loadGoals(api);
185
+ },
184
186
  panel,
185
187
  open: ()=>{
186
188
  if (canManage) setPanel({
@@ -0,0 +1,29 @@
1
+ import type { PayloadRequest } from 'payload';
2
+ import type { Executor } from '../db/executor.js';
3
+ import { type PlacementTest } from '../db/placements.js';
4
+ import { type BulkPlacementRemoval } from '../db/bulkPlacementRemoval.js';
5
+ import { type RemovedPlacementViews } from '../blocks/placementLocale.js';
6
+ import type { DocId } from '../types/contracts.js';
7
+ export type RemovalClaims = {
8
+ transaction: unknown;
9
+ tests: Map<string, Set<string>>;
10
+ counts?: Map<string, Map<string, number>>;
11
+ absent?: Set<string>;
12
+ };
13
+ export declare function releaseRemovalClaim(req: PayloadRequest, collection: string, id: DocId, ownKeys?: Map<string, Set<string>>): void;
14
+ /** A removal must have reached afterChange before a later write can restore it.
15
+ * A write merely retaining another locale cannot clear an in-flight removal.
16
+ */
17
+ export declare function observeUnpublishedRemoval(req: PayloadRequest, collection: string, id: DocId): void;
18
+ export declare function releaseRestoredRemovalClaims(req: PayloadRequest, collection: string, doc: Record<string, unknown> & {
19
+ id: DocId;
20
+ }, test: PlacementTest): void;
21
+ export declare const blockRemovalRule: {
22
+ prepare(req: PayloadRequest, collection: string, before: Record<string, unknown> | undefined, after: Record<string, unknown>, removingPage: boolean, exec?: Executor, tests?: readonly PlacementTest[]): Promise<{
23
+ views: RemovedPlacementViews;
24
+ affected: PlacementTest[];
25
+ }>;
26
+ discover(exec: Executor, removed: string[], tests?: readonly PlacementTest[]): Promise<PlacementTest[]>;
27
+ claim(req: PayloadRequest, transaction: unknown, affected: readonly PlacementTest[], collection: string, id: DocId, views: RemovedPlacementViews): RemovalClaims;
28
+ check(req: PayloadRequest, current: readonly PlacementTest[], affected: readonly PlacementTest[], collection: string, id: DocId, removingPage: boolean, views: RemovedPlacementViews, bulk?: BulkPlacementRemoval): Promise<void>;
29
+ };