@delmaredigital/payload-experiments 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/README.md +9 -5
  2. package/dist/admin/blocks/model.js +2 -0
  3. package/dist/admin/copy/blocks.d.ts +1 -0
  4. package/dist/admin/copy/blocks.js +1 -0
  5. package/dist/admin/copy/status.d.ts +3 -0
  6. package/dist/admin/copy/status.js +3 -0
  7. package/dist/admin/placementStatus.model.js +3 -0
  8. package/dist/admin/status.model.d.ts +3 -2
  9. package/dist/admin/status.model.js +9 -3
  10. package/dist/admin/surface/ResultsRoute.js +2 -1
  11. package/dist/admin/surface/TestsHome.d.ts +2 -1
  12. package/dist/admin/surface/TestsHome.js +31 -11
  13. package/dist/admin/surface/TestsSurface.js +4 -0
  14. package/dist/admin/surface/home.model.d.ts +11 -6
  15. package/dist/admin/surface/home.model.js +19 -8
  16. package/dist/admin/surface/newTest/PageWizard.js +13 -3
  17. package/dist/admin/surface/results/ResultsHeader.js +43 -9
  18. package/dist/admin/surface/test/TestPage.js +11 -1
  19. package/dist/admin/useLayerUsage.d.ts +1 -1
  20. package/dist/admin/views/buildSurfaceProps.js +3 -0
  21. package/dist/cohorts/build.d.ts +35 -0
  22. package/dist/cohorts/build.js +134 -0
  23. package/dist/cohorts/key.d.ts +12 -0
  24. package/dist/cohorts/key.js +15 -0
  25. package/dist/cohorts/maintenance.d.ts +10 -0
  26. package/dist/cohorts/maintenance.js +70 -0
  27. package/dist/cohorts/readiness.d.ts +30 -0
  28. package/dist/cohorts/readiness.js +54 -0
  29. package/dist/cohorts/readinessData.d.ts +29 -0
  30. package/dist/cohorts/readinessData.js +123 -0
  31. package/dist/cohorts/rule.d.ts +33 -0
  32. package/dist/cohorts/rule.js +50 -0
  33. package/dist/collections/cohortMembers.d.ts +4 -0
  34. package/dist/collections/cohortMembers.js +95 -0
  35. package/dist/collections/experiments/config.js +157 -7
  36. package/dist/collections/experiments/editability.js +10 -6
  37. package/dist/collections/experiments/lockHook.js +39 -20
  38. package/dist/collections/index.js +4 -1
  39. package/dist/collections/phases.js +4 -1
  40. package/dist/constants.d.ts +2 -0
  41. package/dist/constants.js +2 -0
  42. package/dist/db/adapter.d.ts +1 -1
  43. package/dist/db/adapter.js +14 -4
  44. package/dist/db/appends.js +1 -1
  45. package/dist/db/cohortMembership.d.ts +11 -0
  46. package/dist/db/cohortMembership.js +31 -0
  47. package/dist/db/cohortPool.d.ts +9 -0
  48. package/dist/db/cohortPool.js +53 -0
  49. package/dist/db/cohortTransactions.d.ts +3 -0
  50. package/dist/db/cohortTransactions.js +52 -0
  51. package/dist/db/cohorts.d.ts +72 -0
  52. package/dist/db/cohorts.js +280 -0
  53. package/dist/db/erase.d.ts +2 -0
  54. package/dist/db/erase.js +21 -2
  55. package/dist/db/events.d.ts +2 -0
  56. package/dist/db/events.js +8 -0
  57. package/dist/db/executor.d.ts +2 -0
  58. package/dist/db/executor.js +8 -0
  59. package/dist/db/locks.d.ts +7 -0
  60. package/dist/db/locks.js +13 -1
  61. package/dist/db/names.d.ts +95 -1
  62. package/dist/db/names.js +95 -1
  63. package/dist/db/occupancy.d.ts +21 -0
  64. package/dist/db/occupancy.js +46 -0
  65. package/dist/db/pageOccupancy.d.ts +4 -4
  66. package/dist/db/pageOccupancy.js +13 -10
  67. package/dist/db/pgExecutor.d.ts +4 -0
  68. package/dist/db/pgExecutor.js +1 -1
  69. package/dist/db/placements.js +1 -1
  70. package/dist/db/results.d.ts +5 -2
  71. package/dist/db/results.js +32 -5
  72. package/dist/db/slices.d.ts +9 -2
  73. package/dist/db/slices.js +15 -8
  74. package/dist/db/snapshots.d.ts +16 -1
  75. package/dist/db/snapshots.js +27 -2
  76. package/dist/db/sql.d.ts +2 -2
  77. package/dist/db/sql.js +1 -2
  78. package/dist/endpoints/cohortSources.d.ts +16 -0
  79. package/dist/endpoints/cohortSources.js +335 -0
  80. package/dist/endpoints/contentLocale.d.ts +1 -1
  81. package/dist/endpoints/events.js +82 -18
  82. package/dist/endpoints/index.js +45 -1
  83. package/dist/endpoints/pausedBy.d.ts +14 -0
  84. package/dist/endpoints/pausedBy.js +94 -0
  85. package/dist/endpoints/preflight.js +4 -1
  86. package/dist/endpoints/previewToken.js +2 -0
  87. package/dist/endpoints/results.d.ts +2 -2
  88. package/dist/endpoints/results.js +111 -3
  89. package/dist/endpoints/routeId.d.ts +2 -1
  90. package/dist/endpoints/routeId.js +6 -2
  91. package/dist/endpoints/summary.js +24 -1
  92. package/dist/endpoints/transitions.d.ts +7 -0
  93. package/dist/endpoints/transitions.js +50 -1
  94. package/dist/events/rows.d.ts +1 -1
  95. package/dist/events/rows.js +5 -3
  96. package/dist/exports/index.d.ts +2 -0
  97. package/dist/exports/index.js +1 -0
  98. package/dist/exports/runtimeProxy.d.ts +1 -0
  99. package/dist/exports/runtimeProxy.js +1 -0
  100. package/dist/hooks/blockRemovalRule.js +7 -4
  101. package/dist/hooks/pageGuard.js +1 -1
  102. package/dist/labels/status.d.ts +15 -0
  103. package/dist/labels/status.js +12 -0
  104. package/dist/manifest/compile.d.ts +15 -4
  105. package/dist/manifest/compile.js +91 -3
  106. package/dist/onInit.js +4 -1
  107. package/dist/options.d.ts +1 -0
  108. package/dist/options.js +10 -0
  109. package/dist/proxy/consentFallback.d.ts +1 -1
  110. package/dist/proxy/consentFallback.js +4 -4
  111. package/dist/proxy/control.d.ts +1 -1
  112. package/dist/proxy/control.js +2 -2
  113. package/dist/proxy/pageRewrite.d.ts +1 -1
  114. package/dist/proxy/pageRewrite.js +3 -2
  115. package/dist/proxy/resolve.js +76 -17
  116. package/dist/puck/ExperimentPicker.js +2 -1
  117. package/dist/puck/copy.d.ts +6 -5
  118. package/dist/puck/copy.js +3 -7
  119. package/dist/puck/editor/ExperimentSlotEditor.js +16 -5
  120. package/dist/puck/editor/QuickTestActions.js +7 -1
  121. package/dist/puck/editor/armWrites.js +6 -1
  122. package/dist/puck/editor/copy.d.ts +3 -0
  123. package/dist/puck/editor/copy.js +3 -0
  124. package/dist/puck/editor/editor.css +2 -1
  125. package/dist/puck/editor/editor.model.d.ts +2 -1
  126. package/dist/puck/editor/editor.model.js +2 -0
  127. package/dist/puck/editor/placementsCache.d.ts +1 -1
  128. package/dist/puck/editor/placementsCache.js +6 -3
  129. package/dist/results/analyse.d.ts +3 -1
  130. package/dist/results/analyse.js +20 -3
  131. package/dist/results/health.d.ts +11 -0
  132. package/dist/results/health.js +38 -0
  133. package/dist/results/power.d.ts +1 -1
  134. package/dist/results/power.js +1 -1
  135. package/dist/results/snapshot.d.ts +8 -2
  136. package/dist/results/snapshot.js +23 -1
  137. package/dist/results/unitValues.d.ts +48 -0
  138. package/dist/results/unitValues.js +166 -0
  139. package/dist/runtime/assign.d.ts +7 -3
  140. package/dist/runtime/assign.js +12 -4
  141. package/dist/runtime/cohortCookie.d.ts +15 -0
  142. package/dist/runtime/cohortCookie.js +72 -0
  143. package/dist/runtime/cohortLookup.d.ts +9 -0
  144. package/dist/runtime/cohortLookup.js +25 -0
  145. package/dist/runtime/eligibility.d.ts +11 -5
  146. package/dist/runtime/eligibility.js +33 -7
  147. package/dist/runtime/header.d.ts +1 -0
  148. package/dist/runtime/header.js +1 -1
  149. package/dist/runtime/proxyRuntime.js +5 -1
  150. package/dist/runtime/targeting.d.ts +3 -2
  151. package/dist/runtime/targeting.js +2 -1
  152. package/dist/sanitizeReadinessDetail.d.ts +2 -2
  153. package/dist/sanitizeReadinessDetail.js +41 -4
  154. package/dist/schedule/activeTime.d.ts +28 -0
  155. package/dist/schedule/activeTime.js +322 -0
  156. package/dist/schedule/ranges.d.ts +13 -0
  157. package/dist/schedule/ranges.js +11 -0
  158. package/dist/schedule/roundTime.d.ts +10 -0
  159. package/dist/schedule/roundTime.js +45 -0
  160. package/dist/schedule/types.d.ts +29 -0
  161. package/dist/schedule/types.js +1 -0
  162. package/dist/server/cohortLookup.d.ts +3 -0
  163. package/dist/server/cohortLookup.js +7 -0
  164. package/dist/server/eraseUser.d.ts +1 -0
  165. package/dist/server/getAssignments.js +63 -40
  166. package/dist/server/previewDraft.d.ts +1 -1
  167. package/dist/server/previewDraft.js +3 -2
  168. package/dist/server/recordExposures.js +4 -2
  169. package/dist/server/runResults.js +97 -150
  170. package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
  171. package/dist/testSurface/actions/LifecycleAction.js +15 -5
  172. package/dist/testSurface/actions/actions.model.d.ts +13 -2
  173. package/dist/testSurface/actions/actions.model.js +38 -5
  174. package/dist/testSurface/api.d.ts +13 -1
  175. package/dist/testSurface/api.js +19 -0
  176. package/dist/testSurface/copy/actions.d.ts +13 -0
  177. package/dist/testSurface/copy/actions.js +13 -0
  178. package/dist/testSurface/copy/cohorts.d.ts +68 -0
  179. package/dist/testSurface/copy/cohorts.js +81 -0
  180. package/dist/testSurface/copy/common.d.ts +2 -3
  181. package/dist/testSurface/copy/common.js +4 -4
  182. package/dist/testSurface/copy/inputs.d.ts +3 -0
  183. package/dist/testSurface/copy/inputs.js +3 -0
  184. package/dist/testSurface/copy/readiness.d.ts +20 -6
  185. package/dist/testSurface/copy/readiness.js +42 -9
  186. package/dist/testSurface/copy/results.d.ts +1 -0
  187. package/dist/testSurface/copy/results.js +1 -0
  188. package/dist/testSurface/copy/schedule.d.ts +58 -0
  189. package/dist/testSurface/copy/schedule.js +150 -0
  190. package/dist/testSurface/copy/surface.d.ts +2 -0
  191. package/dist/testSurface/copy/surface.js +2 -0
  192. package/dist/testSurface/copy/testPage.d.ts +12 -2
  193. package/dist/testSurface/copy/testPage.js +17 -2
  194. package/dist/testSurface/format/roundProgress.d.ts +13 -1
  195. package/dist/testSurface/format/roundProgress.js +34 -5
  196. package/dist/testSurface/format/scheduleStatus.d.ts +34 -0
  197. package/dist/testSurface/format/scheduleStatus.js +93 -0
  198. package/dist/testSurface/format/useScheduleClock.d.ts +3 -0
  199. package/dist/testSurface/format/useScheduleClock.js +20 -0
  200. package/dist/testSurface/labels.d.ts +4 -9
  201. package/dist/testSurface/labels.js +2 -7
  202. package/dist/testSurface/lockedNotice.model.d.ts +2 -2
  203. package/dist/testSurface/lockedNotice.model.js +16 -3
  204. package/dist/testSurface/readPreflight.d.ts +3 -0
  205. package/dist/testSurface/readPreflight.js +14 -0
  206. package/dist/testSurface/readinessRead.d.ts +2 -2
  207. package/dist/testSurface/results/DataQualityPanel.js +7 -7
  208. package/dist/testSurface/results/results.model.d.ts +1 -1
  209. package/dist/testSurface/results/results.model.js +34 -6
  210. package/dist/testSurface/review/cohortEstimate.d.ts +11 -0
  211. package/dist/testSurface/review/cohortEstimate.js +32 -0
  212. package/dist/testSurface/surface/contracts.d.ts +2 -1
  213. package/dist/testSurface/surface/contracts.js +1 -0
  214. package/dist/testSurface/surface/editorPlacement.d.ts +1 -0
  215. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +3 -2
  216. package/dist/testSurface/surface/readiness/ActionDialogs.js +121 -32
  217. package/dist/testSurface/surface/readiness/Banner.js +29 -11
  218. package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -2
  219. package/dist/testSurface/surface/readiness/readiness.model.js +35 -5
  220. package/dist/testSurface/surface/readiness/useTransition.js +17 -5
  221. package/dist/testSurface/surface/results/ResultsBody.js +44 -8
  222. package/dist/testSurface/surface/results/useResults.d.ts +16 -1
  223. package/dist/testSurface/surface/results/useResults.js +17 -6
  224. package/dist/testSurface/surface/test/CohortRuleEditor.d.ts +16 -0
  225. package/dist/testSurface/surface/test/CohortRuleEditor.js +492 -0
  226. package/dist/testSurface/surface/test/LengthSection.js +26 -6
  227. package/dist/testSurface/surface/test/ScheduleDateInput.d.ts +4 -0
  228. package/dist/testSurface/surface/test/ScheduleDateInput.js +15 -0
  229. package/dist/testSurface/surface/test/ScheduleSection.d.ts +2 -0
  230. package/dist/testSurface/surface/test/ScheduleSection.js +322 -0
  231. package/dist/testSurface/surface/test/Section.js +1 -1
  232. package/dist/testSurface/surface/test/TargetingSection.js +306 -182
  233. package/dist/testSurface/surface/test/TestSurface.js +9 -0
  234. package/dist/testSurface/surface/test/fields.d.ts +2 -1
  235. package/dist/testSurface/surface/test/fields.js +3 -3
  236. package/dist/testSurface/surface/test/jumpToSection.d.ts +1 -1
  237. package/dist/testSurface/surface/test/jumpToSection.js +4 -4
  238. package/dist/testSurface/surface/test/testPage.css +26 -0
  239. package/dist/testSurface/surface/testDocument.model.d.ts +12 -1
  240. package/dist/testSurface/surface/testDocument.model.js +2 -1
  241. package/dist/testSurface/surface/useTestDocument.js +11 -4
  242. package/dist/testSurface/targeting/targeting.model.d.ts +2 -1
  243. package/dist/testSurface/targeting/targeting.model.js +1 -1
  244. package/dist/testSurface/useApi.d.ts +12 -0
  245. package/dist/transitions/addMetric.js +5 -2
  246. package/dist/transitions/allocate.js +6 -1
  247. package/dist/transitions/assertNoOverlap.d.ts +9 -0
  248. package/dist/transitions/assertNoOverlap.js +24 -0
  249. package/dist/transitions/buildCohorts.d.ts +10 -0
  250. package/dist/transitions/buildCohorts.js +68 -0
  251. package/dist/transitions/cancelSchedule.d.ts +4 -0
  252. package/dist/transitions/cancelSchedule.js +42 -0
  253. package/dist/transitions/checkStart.d.ts +17 -3
  254. package/dist/transitions/checkStart.js +20 -7
  255. package/dist/transitions/decide.js +35 -11
  256. package/dist/transitions/kernel.d.ts +3 -1
  257. package/dist/transitions/kernel.js +5 -2
  258. package/dist/transitions/pause.d.ts +4 -0
  259. package/dist/transitions/pause.js +35 -0
  260. package/dist/transitions/phaseRecord.d.ts +19 -2
  261. package/dist/transitions/phaseRecord.js +50 -11
  262. package/dist/transitions/placementInteractions.js +1 -1
  263. package/dist/transitions/preflightData.d.ts +11 -3
  264. package/dist/transitions/preflightData.js +134 -81
  265. package/dist/transitions/reschedule.d.ts +4 -0
  266. package/dist/transitions/reschedule.js +58 -0
  267. package/dist/transitions/resume.d.ts +4 -0
  268. package/dist/transitions/resume.js +32 -0
  269. package/dist/transitions/scheduledRound.d.ts +18 -0
  270. package/dist/transitions/scheduledRound.js +42 -0
  271. package/dist/transitions/start.d.ts +4 -0
  272. package/dist/transitions/start.js +136 -55
  273. package/dist/transitions/startReads.d.ts +14 -0
  274. package/dist/transitions/startReads.js +27 -0
  275. package/dist/transitions/stop.d.ts +10 -0
  276. package/dist/transitions/stop.js +35 -22
  277. package/dist/types/admin.d.ts +1 -1
  278. package/dist/types/contracts.d.ts +7 -1
  279. package/dist/types/endpoints.d.ts +72 -3
  280. package/dist/types/manifest.d.ts +9 -0
  281. package/dist/types/runtime.d.ts +5 -0
  282. package/dist/types/snapshot.d.ts +10 -0
  283. package/dist/types/status.d.ts +1 -0
  284. package/dist/types/status.js +1 -0
  285. package/dist/types/surface.d.ts +1 -0
  286. package/dist/ui/Feedback.d.ts +9 -6
  287. package/dist/ui/Feedback.js +10 -9
  288. package/dist/ui/SelectControl.js +1 -1
  289. package/dist/ui/ui.css +2 -1
  290. package/package.json +2 -2
@@ -1,13 +1,24 @@
1
- import type { ArmKind, DocId, ExperimentKind, ExposurePolicy, MetricSource, ResolvedOptions, Status } from './contracts.js';
1
+ import type { ArmKey, ArmKind, UnitType, DocId, ExperimentKind, ExposurePolicy, MetricSource, ResolvedOptions, Status } from './contracts.js';
2
2
  import type { ContentReportReason } from './reasons.js';
3
3
  import type { ArmSlot } from './puck.js';
4
4
  import type { ReadinessCode } from '../transitions/checkStart.js';
5
5
  export type { ReadinessCode } from '../transitions/checkStart.js';
6
6
  import type { Snapshot, VerdictCode } from './snapshot.js';
7
+ import type { CohortReadinessCode } from '../cohorts/readiness.js';
8
+ import type { RoundTiming } from '../schedule/types.js';
7
9
  export type ArmIssueCode = 'weights-total' | 'control-count' | 'control-first' | 'holdout-last' | 'holdout-count' | 'variant-count' | 'duplicate-key' | 'duplicate-slot' | 'slot-required' | 'invalid-key';
8
10
  /** Content-report dismiss/restore refusals (CORE-44). */
9
11
  export type ContentEntryRefusal = 'not-decided' | 'entry-not-found' | 'entry-ok' | 'entry-dismissed' | 'entry-not-dismissed';
10
- export type RefusalCode = ArmIssueCode | 'copy-unavailable' | 'copy-not-enabled' | 'copy-no-access' | 'copy-unique-field' | 'copy-orphaned' | 'transaction-lost' | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | 'invalid-status' | 'first-start-only' | 'stale-draft' | 'stale-edit' | 'round-changed' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
12
+ export type OccupiedInRangeDetail = {
13
+ otherTestId: DocId;
14
+ otherTestName: string;
15
+ from: string;
16
+ to: string | null;
17
+ place?: 'page' | 'setting' | 'traffic group';
18
+ timeZone?: string;
19
+ };
20
+ type ScheduleRefusal = 'not-live' | 'not-pausable' | 'paused' | 'schedule-invalid' | 'reschedule-past' | 'schedule-started';
21
+ export type RefusalCode = ArmIssueCode | CohortReadinessCode | 'cohort-build-timeout' | 'copy-unavailable' | 'copy-not-enabled' | 'copy-no-access' | 'copy-unique-field' | 'copy-orphaned' | 'transaction-lost' | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'occupied-in-range' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | ScheduleRefusal | 'invalid-status' | 'first-start-only' | 'stale-draft' | 'stale-edit' | 'round-changed' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
11
22
  export type ErrorEnvelope = {
12
23
  errors: Array<{
13
24
  code: RefusalCode;
@@ -60,6 +71,12 @@ export type AddMetricBody = RoundBody & {
60
71
  export type RoundBody = {
61
72
  phase?: number;
62
73
  };
74
+ export type PauseBody = RoundBody & {
75
+ reason?: string;
76
+ };
77
+ export type RescheduleBody = RoundBody & {
78
+ endAt: string | null;
79
+ };
63
80
  export type AllocateBody = RoundBody & {
64
81
  allocation: number;
65
82
  };
@@ -93,18 +110,30 @@ export type MakeContentResult = TransitionSuccess & {
93
110
  dismissedBy?: string | null;
94
111
  }>;
95
112
  };
113
+ export type PauseAttribution = {
114
+ name: string;
115
+ pausedAt: string | null;
116
+ };
96
117
  export type PreflightResult = {
97
118
  /** Saved document version used for these checks. */
98
119
  document?: {
99
120
  status: Status;
100
121
  phase?: number;
101
122
  updatedAt?: string;
123
+ pausedAt?: string | null;
102
124
  };
125
+ pauseAttribution?: PauseAttribution;
126
+ pauseLookupSkipped?: true;
103
127
  /** Content language selection and labels when block placements are localized. */
104
128
  contentLocales?: {
105
129
  selected: string;
106
130
  labels: Record<string, string>;
107
131
  };
132
+ cohortSources?: CohortSourceOption[];
133
+ cohortSummaries?: Array<{
134
+ rule: import('../cohorts/rule.js').CohortRule;
135
+ summary: string;
136
+ }>;
108
137
  goalNotes?: Array<{
109
138
  metricId: DocId;
110
139
  message: string;
@@ -149,6 +178,8 @@ export type PreflightResult = {
149
178
  days: 28;
150
179
  } | null;
151
180
  trafficPerDay: number | null;
181
+ scheduleTimeZone?: string;
182
+ timing?: RoundTiming;
152
183
  estimate: {
153
184
  weeks: number;
154
185
  plannedDurationDays: number;
@@ -156,15 +187,50 @@ export type PreflightResult = {
156
187
  feasible: boolean;
157
188
  } | null;
158
189
  };
190
+ export interface CohortEstimate {
191
+ computedAt: string;
192
+ perArm: Partial<Record<ArmKey, {
193
+ exposed: number;
194
+ converters: Record<string, number>;
195
+ }>>;
196
+ }
197
+ export interface CohortSourceRound {
198
+ /** null: the manager cannot read this test's rounds (xp-phases access), so only "Latest round" is offered. */
199
+ phase: number | null;
200
+ startedAt: string | null;
201
+ endedAt: string | null;
202
+ closedAt: string | null;
203
+ arms: Array<{
204
+ key: ArmKey;
205
+ label: string;
206
+ kind: ArmKind;
207
+ }>;
208
+ goals: Array<{
209
+ metricId: DocId;
210
+ name: string;
211
+ }>;
212
+ estimate?: CohortEstimate;
213
+ }
214
+ export interface CohortSourceOption {
215
+ id: DocId;
216
+ name: string;
217
+ status: Status | 'scheduled';
218
+ unitType: UnitType;
219
+ rounds: CohortSourceRound[];
220
+ }
221
+ export type CohortSourcesResult = {
222
+ docs: CohortSourceOption[];
223
+ };
159
224
  export type PreviewTokenResult = {
160
225
  token: string;
161
226
  };
162
- export interface PhaseSummary {
227
+ export interface PhaseSummary extends RoundTiming {
163
228
  phase: number;
164
229
  phaseKind: 'test' | 'rollout';
165
230
  startedAt: string;
166
231
  endedAt: string | null;
167
232
  plannedDurationDays?: number;
233
+ cohortSummaries?: string[];
168
234
  arms: Array<{
169
235
  key: string;
170
236
  label: string;
@@ -211,6 +277,9 @@ export type SummaryResponse = Record<DocId, {
211
277
  detail?: unknown;
212
278
  };
213
279
  health?: import('./snapshot.js').SnapshotHealth[];
280
+ timing?: RoundTiming & {
281
+ phase: number;
282
+ };
214
283
  exposures: number;
215
284
  days: number;
216
285
  verdict: {
@@ -1,4 +1,5 @@
1
1
  import type { Arm, DocId, ExposurePolicy, ExperimentKind, TargetingRule, UnitType } from './contracts.js';
2
+ import type { ActiveSpec } from '../schedule/types.js';
2
3
  export interface FlagDefault {
3
4
  winnerArm: string;
4
5
  params: Record<string, unknown>;
@@ -31,10 +32,18 @@ export interface ManifestExperiment {
31
32
  targeting: Array<TargetingRule & {
32
33
  type: 'string' | 'number' | 'boolean';
33
34
  }>;
35
+ cohorts?: Array<{
36
+ key: string;
37
+ include: boolean;
38
+ sourceClosedAt: string | null;
39
+ }>;
34
40
  layer?: {
35
41
  slug: string;
36
42
  slices: number[];
37
43
  };
44
+ active?: ActiveSpec;
45
+ /** Lower bound for requests validated after the most recent resume. */
46
+ resumedAt?: string;
38
47
  exposurePolicy: ExposurePolicy;
39
48
  winnerArm?: string;
40
49
  holdoutKey?: string;
@@ -2,6 +2,7 @@ import type { Payload } from 'payload';
2
2
  import type { NextRequest } from 'next/server';
3
3
  import type { Attributes } from './contracts.js';
4
4
  import type { Manifest } from './manifest.js';
5
+ import type { CohortLookup } from '../runtime/cohortLookup.js';
5
6
  type CookieOptions = {
6
7
  name?: string;
7
8
  maxAgeDays?: number;
@@ -20,6 +21,7 @@ export interface ExperimentsProxyRuntimeOptions {
20
21
  loadManifest?: (opts?: {
21
22
  ifRevision?: number;
22
23
  }) => Promise<Manifest | 'not-modified' | null>;
24
+ lookupCohorts?: CohortLookup;
23
25
  getUnit?: (req: NextRequest) => {
24
26
  userId?: string;
25
27
  attributes: Attributes;
@@ -31,6 +33,8 @@ export interface ExperimentsProxyRuntimeOptions {
31
33
  }>;
32
34
  }
33
35
  export interface ExperimentsProxyRuntime {
36
+ /** @internal Clock shared by assignment and exposure validation. */
37
+ readonly now?: () => Date;
34
38
  readonly secrets: readonly string[];
35
39
  readonly apiRoute: string;
36
40
  readonly rateLimitUnit: ExperimentsProxyRuntimeOptions['rateLimitUnit'];
@@ -39,6 +43,7 @@ export interface ExperimentsProxyRuntime {
39
43
  maxAgeDays: number;
40
44
  };
41
45
  readonly loadManifest?: ExperimentsProxyRuntimeOptions['loadManifest'];
46
+ readonly lookupCohorts?: CohortLookup;
42
47
  readonly getUnit?: ExperimentsProxyRuntimeOptions['getUnit'];
43
48
  }
44
49
  export interface ExperimentsServerRuntimeOptions<TUser extends {
@@ -14,6 +14,14 @@ export type SnapshotHealth = {
14
14
  };
15
15
  } | {
16
16
  code: 'rapid-browser-events';
17
+ } | {
18
+ code: 'cohort-no-exposures';
19
+ } | {
20
+ code: 'paused-share';
21
+ pausedDays: number;
22
+ } | {
23
+ code: 'schedule-population';
24
+ summary: string;
17
25
  };
18
26
  import type { GaussianPrior } from '@delmaredigital/experiments-stats';
19
27
  import type { DocId, MetricSource } from './contracts.js';
@@ -34,6 +42,7 @@ export interface Snapshot {
34
42
  alpha: number;
35
43
  alphaAdjusted: number;
36
44
  k: number;
45
+ activeDays?: number;
37
46
  params: {
38
47
  sequentialTuningParameter: number;
39
48
  prior: GaussianPrior;
@@ -56,6 +65,7 @@ export interface Snapshot {
56
65
  total: number;
57
66
  perArm: Record<string, number>;
58
67
  excludedMultiArm: number;
68
+ cohortExits: number;
59
69
  multiArmShare: number;
60
70
  armMismatch: number;
61
71
  identityConflictShare: number;
@@ -0,0 +1 @@
1
+ export type Status = 'draft' | 'running' | 'paused' | 'stopped' | 'decided' | 'archived';
@@ -0,0 +1 @@
1
+ export { };
@@ -11,6 +11,7 @@ export interface TestsSurfaceProps {
11
11
  returnToTest?: string;
12
12
  adminRoute: string;
13
13
  apiRoute: string;
14
+ timeZone?: string;
14
15
  contentLanguageLabels?: string[];
15
16
  contentLocale?: string;
16
17
  collectionTitles?: Record<string, string>;
@@ -1,17 +1,20 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import './ui.css';
3
3
  export declare const statusLabels: {
4
- readonly draft: "Draft";
5
4
  readonly ready: "Ready";
6
- readonly running: "Running";
7
5
  readonly 'needs-attention': "Needs attention";
8
- readonly decided: "Decided";
9
- readonly archived: "Archived";
10
- readonly stopped: "Stopped";
6
+ readonly draft: string;
7
+ readonly running: string;
8
+ readonly stopped: string;
9
+ readonly decided: string;
10
+ readonly archived: string;
11
+ readonly scheduled: string;
12
+ readonly paused: string;
11
13
  };
12
14
  export type UIStatus = keyof typeof statusLabels;
13
- export declare function StatusChip({ status }: {
15
+ export declare function StatusChip({ status, startedAt }: {
14
16
  status: UIStatus;
17
+ startedAt?: string | null;
15
18
  }): import("react").JSX.Element;
16
19
  export declare function Banner({ tone, children, action }: {
17
20
  tone?: 'info' | 'warning' | 'error';
@@ -1,18 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { STATUS_LABELS, displayStatus } from '../labels/status.js';
2
3
  import './ui.css';
3
4
  export const statusLabels = {
4
- draft: 'Draft',
5
+ ...STATUS_LABELS,
5
6
  ready: 'Ready',
6
- running: 'Running',
7
- 'needs-attention': 'Needs attention',
8
- decided: 'Decided',
9
- archived: 'Archived',
10
- stopped: 'Stopped'
7
+ 'needs-attention': 'Needs attention'
11
8
  };
12
- export function StatusChip({ status }) {
9
+ export function StatusChip({ status, startedAt }) {
10
+ const shown = status === 'running' ? displayStatus({
11
+ status,
12
+ startedAt
13
+ }) : status;
13
14
  return /*#__PURE__*/ _jsx("span", {
14
- className: `xp-ui-status xp-ui-status--${status}`,
15
- children: statusLabels[status]
15
+ className: `xp-ui-status xp-ui-status--${shown}`,
16
+ children: statusLabels[shown]
16
17
  });
17
18
  }
18
19
  export function Banner({ tone = 'info', children, action }) {
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Children, isValidElement, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
- import { INPUT_COPY } from '../testSurface/copy/common.js';
5
+ import { INPUT_COPY } from '../testSurface/copy/inputs.js';
6
6
  function optionText(children) {
7
7
  return Children.toArray(children).map((child)=>/*#__PURE__*/ isValidElement(child) ? optionText(child.props.children) : String(child)).join('');
8
8
  }
package/dist/ui/ui.css CHANGED
@@ -55,7 +55,8 @@
55
55
  .xp-ui-tabpanel { padding-block: 16px; }
56
56
  .xp-ui-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--xp-radius-chip); border: 1px solid var(--xp-border-strong); background: var(--xp-surface-2); color: var(--xp-text-2); font: 500 12px/18px var(--xp-font); white-space: nowrap; }
57
57
  .xp-ui-status--running, .xp-ui-status--ready { background: var(--xp-success-bg); color: var(--xp-success); border-color: var(--xp-success-border); }
58
- .xp-ui-status--needs-attention { background: var(--xp-warning-bg); color: var(--xp-warning); border-color: var(--xp-warning-border); }
58
+ .xp-ui-status--needs-attention, .xp-ui-status--paused { background: var(--xp-warning-bg); color: var(--xp-warning); border-color: var(--xp-warning-border); }
59
+ .xp-ui-status--scheduled { color: var(--xp-accent-text); }
59
60
  .xp-ui-status--decided { background: var(--xp-text); color: var(--xp-surface); border-color: var(--xp-text); }
60
61
  .xp-ui-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-control); background: var(--xp-surface-2); color: var(--xp-text); font: var(--xp-text-body); }
61
62
  .xp-ui-banner p, .xp-ui-empty p { margin: 0; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delmaredigital/payload-experiments",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "No-code A/B testing for Payload CMS and Next.js: block, page and flag experiments with holdouts, layers, exposure logging and honest statistics inside the admin — no vendor",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -125,7 +125,7 @@
125
125
  "bugs": {
126
126
  "url": "https://github.com/delmaredigital/payload-experiments/issues"
127
127
  },
128
- "homepage": "https://delmaredigital.com/developers",
128
+ "homepage": "https://plugins.delmaredigital.com/docs/experiments",
129
129
  "devDependencies": {
130
130
  "@delmaredigital/payload-puck": "0.12.5",
131
131
  "payload": "^3.90.2",