@delmaredigital/payload-experiments 0.4.1 → 0.5.1

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 (310) 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/blocks/placementLocale.d.ts +14 -0
  22. package/dist/blocks/placementLocale.js +80 -13
  23. package/dist/blocks/placementPublication.d.ts +14 -0
  24. package/dist/blocks/placementPublication.js +24 -0
  25. package/dist/cohorts/build.d.ts +35 -0
  26. package/dist/cohorts/build.js +134 -0
  27. package/dist/cohorts/key.d.ts +12 -0
  28. package/dist/cohorts/key.js +15 -0
  29. package/dist/cohorts/maintenance.d.ts +10 -0
  30. package/dist/cohorts/maintenance.js +70 -0
  31. package/dist/cohorts/readiness.d.ts +30 -0
  32. package/dist/cohorts/readiness.js +54 -0
  33. package/dist/cohorts/readinessData.d.ts +29 -0
  34. package/dist/cohorts/readinessData.js +123 -0
  35. package/dist/cohorts/rule.d.ts +33 -0
  36. package/dist/cohorts/rule.js +50 -0
  37. package/dist/collections/cohortMembers.d.ts +4 -0
  38. package/dist/collections/cohortMembers.js +95 -0
  39. package/dist/collections/experiments/config.js +157 -7
  40. package/dist/collections/experiments/editability.js +10 -6
  41. package/dist/collections/experiments/lockHook.js +39 -20
  42. package/dist/collections/index.js +4 -1
  43. package/dist/collections/phases.js +4 -1
  44. package/dist/constants.d.ts +2 -0
  45. package/dist/constants.js +2 -0
  46. package/dist/db/adapter.d.ts +2 -1
  47. package/dist/db/adapter.js +17 -4
  48. package/dist/db/appends.d.ts +2 -1
  49. package/dist/db/appends.js +3 -2
  50. package/dist/db/bulkPlacementRemoval.d.ts +5 -0
  51. package/dist/db/bulkPlacementRemoval.js +7 -2
  52. package/dist/db/cohortMembership.d.ts +11 -0
  53. package/dist/db/cohortMembership.js +31 -0
  54. package/dist/db/cohortPool.d.ts +9 -0
  55. package/dist/db/cohortPool.js +53 -0
  56. package/dist/db/cohortTransactions.d.ts +3 -0
  57. package/dist/db/cohortTransactions.js +52 -0
  58. package/dist/db/cohorts.d.ts +72 -0
  59. package/dist/db/cohorts.js +280 -0
  60. package/dist/db/erase.d.ts +2 -0
  61. package/dist/db/erase.js +21 -2
  62. package/dist/db/events.d.ts +2 -0
  63. package/dist/db/events.js +8 -0
  64. package/dist/db/executor.d.ts +2 -0
  65. package/dist/db/executor.js +8 -0
  66. package/dist/db/locks.d.ts +7 -0
  67. package/dist/db/locks.js +13 -1
  68. package/dist/db/names.d.ts +95 -1
  69. package/dist/db/names.js +95 -1
  70. package/dist/db/occupancy.d.ts +21 -0
  71. package/dist/db/occupancy.js +46 -0
  72. package/dist/db/pageBindings.d.ts +2 -2
  73. package/dist/db/pageBindings.js +3 -3
  74. package/dist/db/pageOccupancy.d.ts +4 -4
  75. package/dist/db/pageOccupancy.js +13 -10
  76. package/dist/db/pgExecutor.d.ts +4 -0
  77. package/dist/db/pgExecutor.js +1 -1
  78. package/dist/db/placements.d.ts +6 -1
  79. package/dist/db/placements.js +27 -1
  80. package/dist/db/results.d.ts +5 -2
  81. package/dist/db/results.js +32 -5
  82. package/dist/db/slices.d.ts +9 -2
  83. package/dist/db/slices.js +15 -8
  84. package/dist/db/snapshots.d.ts +16 -1
  85. package/dist/db/snapshots.js +27 -2
  86. package/dist/db/sql.d.ts +2 -2
  87. package/dist/db/sql.js +1 -2
  88. package/dist/endpoints/cohortSources.d.ts +16 -0
  89. package/dist/endpoints/cohortSources.js +335 -0
  90. package/dist/endpoints/contentLocale.d.ts +1 -1
  91. package/dist/endpoints/duplicateOriginal.d.ts +1 -0
  92. package/dist/endpoints/events.js +82 -18
  93. package/dist/endpoints/index.js +45 -1
  94. package/dist/endpoints/pausedBy.d.ts +14 -0
  95. package/dist/endpoints/pausedBy.js +94 -0
  96. package/dist/endpoints/preflight.js +4 -1
  97. package/dist/endpoints/previewToken.js +2 -0
  98. package/dist/endpoints/results.d.ts +2 -2
  99. package/dist/endpoints/results.js +111 -3
  100. package/dist/endpoints/routeId.d.ts +2 -1
  101. package/dist/endpoints/routeId.js +6 -2
  102. package/dist/endpoints/summary.js +24 -1
  103. package/dist/endpoints/transitions.d.ts +7 -0
  104. package/dist/endpoints/transitions.js +50 -1
  105. package/dist/events/rows.d.ts +1 -1
  106. package/dist/events/rows.js +5 -3
  107. package/dist/exports/index.d.ts +2 -0
  108. package/dist/exports/index.js +1 -0
  109. package/dist/exports/runtimeProxy.d.ts +1 -0
  110. package/dist/exports/runtimeProxy.js +1 -0
  111. package/dist/hooks/blockRemovalRule.d.ts +1 -1
  112. package/dist/hooks/blockRemovalRule.js +12 -8
  113. package/dist/hooks/pageGuard.d.ts +7 -1
  114. package/dist/hooks/pageGuard.js +177 -4
  115. package/dist/hooks/puckNestedTests.d.ts +1 -1
  116. package/dist/hooks/puckNestedTests.js +3 -1
  117. package/dist/labels/status.d.ts +15 -0
  118. package/dist/labels/status.js +12 -0
  119. package/dist/manifest/compile.d.ts +15 -4
  120. package/dist/manifest/compile.js +91 -3
  121. package/dist/onInit.js +4 -6
  122. package/dist/options.d.ts +1 -0
  123. package/dist/options.js +10 -0
  124. package/dist/proxy/consentFallback.d.ts +1 -1
  125. package/dist/proxy/consentFallback.js +4 -4
  126. package/dist/proxy/control.d.ts +1 -1
  127. package/dist/proxy/control.js +2 -2
  128. package/dist/proxy/pageRewrite.d.ts +1 -1
  129. package/dist/proxy/pageRewrite.js +3 -2
  130. package/dist/proxy/resolve.js +76 -17
  131. package/dist/puck/ExperimentPicker.js +2 -1
  132. package/dist/puck/copy.d.ts +6 -5
  133. package/dist/puck/copy.js +3 -7
  134. package/dist/puck/editor/ExperimentSlotEditor.js +16 -5
  135. package/dist/puck/editor/QuickTestActions.js +7 -1
  136. package/dist/puck/editor/armWrites.js +6 -1
  137. package/dist/puck/editor/copy.d.ts +3 -0
  138. package/dist/puck/editor/copy.js +3 -0
  139. package/dist/puck/editor/editor.css +2 -1
  140. package/dist/puck/editor/editor.model.d.ts +2 -1
  141. package/dist/puck/editor/editor.model.js +2 -0
  142. package/dist/puck/editor/placementsCache.d.ts +1 -1
  143. package/dist/puck/editor/placementsCache.js +6 -3
  144. package/dist/results/analyse.d.ts +3 -1
  145. package/dist/results/analyse.js +20 -3
  146. package/dist/results/health.d.ts +11 -0
  147. package/dist/results/health.js +38 -0
  148. package/dist/results/power.d.ts +1 -1
  149. package/dist/results/power.js +1 -1
  150. package/dist/results/snapshot.d.ts +8 -2
  151. package/dist/results/snapshot.js +23 -1
  152. package/dist/results/unitValues.d.ts +48 -0
  153. package/dist/results/unitValues.js +166 -0
  154. package/dist/runtime/assign.d.ts +7 -3
  155. package/dist/runtime/assign.js +12 -4
  156. package/dist/runtime/cohortCookie.d.ts +15 -0
  157. package/dist/runtime/cohortCookie.js +72 -0
  158. package/dist/runtime/cohortLookup.d.ts +9 -0
  159. package/dist/runtime/cohortLookup.js +25 -0
  160. package/dist/runtime/eligibility.d.ts +11 -5
  161. package/dist/runtime/eligibility.js +33 -7
  162. package/dist/runtime/header.d.ts +1 -0
  163. package/dist/runtime/header.js +1 -1
  164. package/dist/runtime/proxyRuntime.js +5 -1
  165. package/dist/runtime/targeting.d.ts +3 -2
  166. package/dist/runtime/targeting.js +2 -1
  167. package/dist/sanitizeReadinessDetail.d.ts +2 -2
  168. package/dist/sanitizeReadinessDetail.js +41 -4
  169. package/dist/schedule/activeTime.d.ts +28 -0
  170. package/dist/schedule/activeTime.js +322 -0
  171. package/dist/schedule/ranges.d.ts +13 -0
  172. package/dist/schedule/ranges.js +11 -0
  173. package/dist/schedule/roundTime.d.ts +10 -0
  174. package/dist/schedule/roundTime.js +45 -0
  175. package/dist/schedule/types.d.ts +29 -0
  176. package/dist/schedule/types.js +1 -0
  177. package/dist/server/cohortLookup.d.ts +3 -0
  178. package/dist/server/cohortLookup.js +7 -0
  179. package/dist/server/eraseUser.d.ts +1 -0
  180. package/dist/server/getAssignments.js +63 -40
  181. package/dist/server/previewDraft.d.ts +1 -1
  182. package/dist/server/previewDraft.js +3 -2
  183. package/dist/server/recordContentChange.d.ts +1 -1
  184. package/dist/server/recordContentChange.js +42 -20
  185. package/dist/server/recordExposures.js +4 -2
  186. package/dist/server/runResults.js +97 -150
  187. package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
  188. package/dist/testSurface/actions/LifecycleAction.js +15 -5
  189. package/dist/testSurface/actions/actions.model.d.ts +13 -2
  190. package/dist/testSurface/actions/actions.model.js +38 -5
  191. package/dist/testSurface/api.d.ts +13 -1
  192. package/dist/testSurface/api.js +19 -0
  193. package/dist/testSurface/copy/actions.d.ts +13 -0
  194. package/dist/testSurface/copy/actions.js +13 -0
  195. package/dist/testSurface/copy/cohorts.d.ts +68 -0
  196. package/dist/testSurface/copy/cohorts.js +81 -0
  197. package/dist/testSurface/copy/common.d.ts +2 -3
  198. package/dist/testSurface/copy/common.js +4 -4
  199. package/dist/testSurface/copy/inputs.d.ts +3 -0
  200. package/dist/testSurface/copy/inputs.js +3 -0
  201. package/dist/testSurface/copy/readiness.d.ts +20 -6
  202. package/dist/testSurface/copy/readiness.js +42 -9
  203. package/dist/testSurface/copy/results.d.ts +1 -0
  204. package/dist/testSurface/copy/results.js +1 -0
  205. package/dist/testSurface/copy/schedule.d.ts +58 -0
  206. package/dist/testSurface/copy/schedule.js +150 -0
  207. package/dist/testSurface/copy/surface.d.ts +2 -0
  208. package/dist/testSurface/copy/surface.js +2 -0
  209. package/dist/testSurface/copy/testPage.d.ts +12 -2
  210. package/dist/testSurface/copy/testPage.js +17 -2
  211. package/dist/testSurface/format/roundProgress.d.ts +13 -1
  212. package/dist/testSurface/format/roundProgress.js +34 -5
  213. package/dist/testSurface/format/scheduleStatus.d.ts +34 -0
  214. package/dist/testSurface/format/scheduleStatus.js +93 -0
  215. package/dist/testSurface/format/useScheduleClock.d.ts +3 -0
  216. package/dist/testSurface/format/useScheduleClock.js +20 -0
  217. package/dist/testSurface/labels.d.ts +4 -9
  218. package/dist/testSurface/labels.js +2 -7
  219. package/dist/testSurface/lockedNotice.model.d.ts +2 -2
  220. package/dist/testSurface/lockedNotice.model.js +16 -3
  221. package/dist/testSurface/readPreflight.d.ts +3 -0
  222. package/dist/testSurface/readPreflight.js +14 -0
  223. package/dist/testSurface/readinessRead.d.ts +2 -2
  224. package/dist/testSurface/results/DataQualityPanel.js +7 -7
  225. package/dist/testSurface/results/results.model.d.ts +1 -1
  226. package/dist/testSurface/results/results.model.js +34 -6
  227. package/dist/testSurface/review/cohortEstimate.d.ts +11 -0
  228. package/dist/testSurface/review/cohortEstimate.js +32 -0
  229. package/dist/testSurface/surface/contracts.d.ts +2 -1
  230. package/dist/testSurface/surface/contracts.js +1 -0
  231. package/dist/testSurface/surface/editorPlacement.d.ts +1 -0
  232. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +3 -2
  233. package/dist/testSurface/surface/readiness/ActionDialogs.js +121 -32
  234. package/dist/testSurface/surface/readiness/Banner.js +29 -11
  235. package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -2
  236. package/dist/testSurface/surface/readiness/readiness.model.js +35 -5
  237. package/dist/testSurface/surface/readiness/useTransition.js +17 -5
  238. package/dist/testSurface/surface/results/ResultsBody.js +44 -8
  239. package/dist/testSurface/surface/results/useResults.d.ts +16 -1
  240. package/dist/testSurface/surface/results/useResults.js +17 -6
  241. package/dist/testSurface/surface/test/CohortRuleEditor.d.ts +16 -0
  242. package/dist/testSurface/surface/test/CohortRuleEditor.js +492 -0
  243. package/dist/testSurface/surface/test/LengthSection.js +26 -6
  244. package/dist/testSurface/surface/test/ScheduleDateInput.d.ts +4 -0
  245. package/dist/testSurface/surface/test/ScheduleDateInput.js +15 -0
  246. package/dist/testSurface/surface/test/ScheduleSection.d.ts +2 -0
  247. package/dist/testSurface/surface/test/ScheduleSection.js +322 -0
  248. package/dist/testSurface/surface/test/Section.js +1 -1
  249. package/dist/testSurface/surface/test/TargetingSection.js +306 -182
  250. package/dist/testSurface/surface/test/TestSurface.js +9 -0
  251. package/dist/testSurface/surface/test/fields.d.ts +2 -1
  252. package/dist/testSurface/surface/test/fields.js +3 -3
  253. package/dist/testSurface/surface/test/jumpToSection.d.ts +1 -1
  254. package/dist/testSurface/surface/test/jumpToSection.js +4 -4
  255. package/dist/testSurface/surface/test/testPage.css +26 -0
  256. package/dist/testSurface/surface/testDocument.model.d.ts +12 -1
  257. package/dist/testSurface/surface/testDocument.model.js +2 -1
  258. package/dist/testSurface/surface/useTestDocument.js +11 -4
  259. package/dist/testSurface/targeting/targeting.model.d.ts +2 -1
  260. package/dist/testSurface/targeting/targeting.model.js +1 -1
  261. package/dist/testSurface/useApi.d.ts +12 -0
  262. package/dist/transitions/addMetric.js +5 -2
  263. package/dist/transitions/allocate.js +6 -1
  264. package/dist/transitions/assertNoOverlap.d.ts +9 -0
  265. package/dist/transitions/assertNoOverlap.js +24 -0
  266. package/dist/transitions/buildCohorts.d.ts +10 -0
  267. package/dist/transitions/buildCohorts.js +68 -0
  268. package/dist/transitions/cancelSchedule.d.ts +4 -0
  269. package/dist/transitions/cancelSchedule.js +42 -0
  270. package/dist/transitions/checkStart.d.ts +17 -3
  271. package/dist/transitions/checkStart.js +20 -7
  272. package/dist/transitions/decide.js +40 -13
  273. package/dist/transitions/kernel.d.ts +3 -1
  274. package/dist/transitions/kernel.js +5 -2
  275. package/dist/transitions/pause.d.ts +4 -0
  276. package/dist/transitions/pause.js +35 -0
  277. package/dist/transitions/phaseRecord.d.ts +19 -2
  278. package/dist/transitions/phaseRecord.js +50 -11
  279. package/dist/transitions/placementInteractions.d.ts +7 -2
  280. package/dist/transitions/placementInteractions.js +9 -7
  281. package/dist/transitions/placements.d.ts +4 -3
  282. package/dist/transitions/placements.js +28 -14
  283. package/dist/transitions/preflightData.d.ts +11 -3
  284. package/dist/transitions/preflightData.js +134 -81
  285. package/dist/transitions/reschedule.d.ts +4 -0
  286. package/dist/transitions/reschedule.js +58 -0
  287. package/dist/transitions/resume.d.ts +4 -0
  288. package/dist/transitions/resume.js +32 -0
  289. package/dist/transitions/scheduledRound.d.ts +18 -0
  290. package/dist/transitions/scheduledRound.js +42 -0
  291. package/dist/transitions/start.d.ts +4 -0
  292. package/dist/transitions/start.js +139 -56
  293. package/dist/transitions/startReads.d.ts +14 -0
  294. package/dist/transitions/startReads.js +27 -0
  295. package/dist/transitions/stop.d.ts +10 -0
  296. package/dist/transitions/stop.js +35 -22
  297. package/dist/types/admin.d.ts +1 -1
  298. package/dist/types/contracts.d.ts +7 -1
  299. package/dist/types/endpoints.d.ts +72 -3
  300. package/dist/types/manifest.d.ts +9 -0
  301. package/dist/types/runtime.d.ts +5 -0
  302. package/dist/types/snapshot.d.ts +10 -0
  303. package/dist/types/status.d.ts +1 -0
  304. package/dist/types/status.js +1 -0
  305. package/dist/types/surface.d.ts +1 -0
  306. package/dist/ui/Feedback.d.ts +9 -6
  307. package/dist/ui/Feedback.js +10 -9
  308. package/dist/ui/SelectControl.js +1 -1
  309. package/dist/ui/ui.css +2 -1
  310. package/package.json +2 -2
@@ -1,6 +1,7 @@
1
1
  import { XP_IF_UPDATED_AT_HEADER } from '../constants.js';
2
2
  import { contentLocaleURL } from './contentLocaleURL.js';
3
3
  import { API_MESSAGES, refusalMessage } from './copy/common.js';
4
+ import { COHORT_REFUSALS } from './copy/cohorts.js';
4
5
  import { CONTENT_ENTRY_REFUSALS } from './copy/actions.js';
5
6
  export function createApi(apiBase, contentLocale) {
6
7
  const collectionBase = `${apiBase.replace(/\/$/, '')}/xp-experiments`;
@@ -106,6 +107,13 @@ export function createApi(apiBase, contentLocale) {
106
107
  if (contentLocale) params.set('locale', contentLocale);
107
108
  return `${apiBase.replace(/\/$/, '')}/xp/pages?${params}`;
108
109
  }, 'GET', undefined, undefined, signal),
110
+ cohortSources: (q, exclude, signal)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/cohort-sources?${new URLSearchParams({
111
+ q,
112
+ exclude: String(exclude)
113
+ })}`, 'GET', undefined, undefined, signal),
114
+ buildCohorts: (id)=>post(id, 'build-cohorts', {}, {
115
+ codes: COHORT_REFUSALS
116
+ }),
109
117
  previewPageCopy: (id, arm, signal)=>request(()=>`${route(id, 'duplicate-original')}?arm=${encodeURIComponent(arm)}`, 'GET', undefined, undefined, signal),
110
118
  makePageCopy: (id, arm, plan)=>request(()=>route(id, 'duplicate-original'), 'POST', {
111
119
  ...plan,
@@ -114,12 +122,22 @@ export function createApi(apiBase, contentLocale) {
114
122
  placementStatus: (body)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/placements/status`, 'POST', body),
115
123
  start: (id, phase)=>post(id, 'start', phase === undefined ? undefined : {
116
124
  phase
125
+ }, {
126
+ codes: COHORT_REFUSALS
117
127
  }),
118
128
  allocate: (id, body, options)=>post(id, 'allocate', body, options),
119
129
  addMetric: (id, body, options)=>post(id, 'add-metric', body, options),
120
130
  stop: (id, phase)=>post(id, 'stop', phase === undefined ? undefined : {
121
131
  phase
122
132
  }),
133
+ pause: (id, body)=>post(id, 'pause', body),
134
+ resume: (id, phase)=>post(id, 'resume', {
135
+ phase
136
+ }),
137
+ reschedule: (id, body)=>post(id, 'reschedule', body),
138
+ cancelSchedule: (id, phase)=>post(id, 'cancel-schedule', {
139
+ phase
140
+ }),
123
141
  decide: (id, body)=>post(id, 'decide', body),
124
142
  releaseHoldout: (id, phase)=>post(id, 'release-holdout', phase === undefined ? undefined : {
125
143
  phase
@@ -150,6 +168,7 @@ export function createApi(apiBase, contentLocale) {
150
168
  return `${route(id, 'results')}${qs ? `?${qs}` : ''}`;
151
169
  }, 'GET', undefined, options),
152
170
  recompute: (id)=>post(id, 'recompute'),
171
+ pausedBy: (signal)=>request(()=>`${base}/paused-by`, 'GET', undefined, undefined, signal),
153
172
  summary: async (ids)=>{
154
173
  const data = {};
155
174
  // Wire format: comma-separated ids, each URI-encoded; at most 100 per request.
@@ -5,6 +5,18 @@ export declare const ACTIONS_COPY: {
5
5
  readonly restart: "Start a new round";
6
6
  readonly stop: "Stop";
7
7
  readonly decide: "Decide";
8
+ readonly schedule: "Schedule";
9
+ readonly pause: "Pause";
10
+ readonly resume: "Resume";
11
+ readonly reschedule: "Change end date";
12
+ readonly cancelSchedule: "Cancel schedule";
13
+ readonly pauseReason: "Reason for pausing (optional)";
14
+ readonly pauseCount: (count: number, limit: number) => string;
15
+ readonly pauseBody: "Everyone will see the Original until you resume. Results keep counting from where they stopped.";
16
+ readonly resumeBody: "Visitors in this test will see their version again.";
17
+ readonly resumeEndedBody: "The scheduled end has passed. Confirming will stop this round and keep its results.";
18
+ readonly rescheduleBody: "Set a new end date and time, or leave it blank to run without an end date.";
19
+ readonly cancelScheduleBody: "The scheduled round will be removed. Any earlier results will be kept.";
8
20
  readonly release: "Release holdout";
9
21
  readonly makeContent: "Make it the content";
10
22
  readonly finish: "Finish archiving";
@@ -72,6 +84,7 @@ export declare const ACTIONS_COPY: {
72
84
  readonly partial: "Some pages still need changes.";
73
85
  };
74
86
  export declare const actionTitle: (action: string, test: string) => string;
87
+ export declare const scheduleStartCopy: (date: string, recurring?: boolean) => string;
75
88
  export declare const actionTitleFor: (action: string, test: string) => string;
76
89
  export declare const actionsForTest: (test: string) => string;
77
90
  export declare const stopCopy: (control: string) => string;
@@ -5,6 +5,18 @@ export const ACTIONS_COPY = {
5
5
  restart: 'Start a new round',
6
6
  stop: 'Stop',
7
7
  decide: 'Decide',
8
+ schedule: 'Schedule',
9
+ pause: 'Pause',
10
+ resume: 'Resume',
11
+ reschedule: 'Change end date',
12
+ cancelSchedule: 'Cancel schedule',
13
+ pauseReason: 'Reason for pausing (optional)',
14
+ pauseCount: (count, limit)=>`${count} of ${limit} characters`,
15
+ pauseBody: 'Everyone will see the Original until you resume. Results keep counting from where they stopped.',
16
+ resumeBody: 'Visitors in this test will see their version again.',
17
+ resumeEndedBody: 'The scheduled end has passed. Confirming will stop this round and keep its results.',
18
+ rescheduleBody: 'Set a new end date and time, or leave it blank to run without an end date.',
19
+ cancelScheduleBody: 'The scheduled round will be removed. Any earlier results will be kept.',
8
20
  release: 'Release holdout',
9
21
  makeContent: 'Make it the content',
10
22
  finish: 'Finish archiving',
@@ -72,6 +84,7 @@ export const ACTIONS_COPY = {
72
84
  partial: "Some pages still need changes."
73
85
  };
74
86
  export const actionTitle = (action, test)=>`${action} “${test}”?`;
87
+ export const scheduleStartCopy = (date, recurring = false)=>recurring ? `The schedule starts on ${date}. Visitors will see test versions during your recurring hours.` : `Visitors will start seeing test versions on ${date}.`;
75
88
  export const actionTitleFor = (action, test)=>`${action} for “${test}”?`;
76
89
  export const actionsForTest = (test)=>`Actions for ${test}`;
77
90
  export const stopCopy = (control)=>`Visitors will go back to ${control}. The test stops collecting data and keeps its results. Starting again begins a new round.`;
@@ -0,0 +1,68 @@
1
+ import type { ArmKey } from '../../types/contracts.js';
2
+ import type { CohortRule } from '../../cohorts/rule.js';
3
+ export declare const COHORT_COPY: {
4
+ readonly invalid: "Check the earlier test, round, versions and goal for this audience.";
5
+ readonly cycle: "An earlier test in this audience also depends on this test.";
6
+ readonly open: "To use people who didn't complete a goal, wait until 24 hours after the earlier round ends.";
7
+ readonly lookup: "Ask your developer to enable audiences from earlier tests.";
8
+ readonly noExposures: "No one has seen this test in its first hour. If your site's proxy doesn't look up audiences from earlier tests, every visitor sees the Original: check that `lookupCohorts` is set in the proxy runtime.";
9
+ readonly timeout: "This audience needs more time. Build the audience, then start the test.";
10
+ readonly source: "Choose an earlier test.";
11
+ readonly self: "Choose a different test.";
12
+ readonly arms: "Choose at least one version.";
13
+ readonly goal: "Choose whether people completed the goal.";
14
+ readonly round: "Enter a positive whole round number.";
15
+ readonly unavailable: "Audience from an earlier test";
16
+ };
17
+ export declare function cohortRuleSummary(rule: CohortRule, names?: {
18
+ experiment?: string;
19
+ arms?: Partial<Record<ArmKey, string>>;
20
+ goal?: string;
21
+ }): string;
22
+ export declare const COHORT_EDITOR: {
23
+ readonly add: "Add people from an earlier test";
24
+ readonly test: "Test";
25
+ readonly search: "Search earlier tests";
26
+ readonly invalidSearch: "Enter a valid search or test ID.";
27
+ readonly noAttributes: "No visitor attributes are available for rules.";
28
+ readonly loading: "Loading tests…";
29
+ readonly empty: "No earlier tests are available.";
30
+ readonly noMatches: "No earlier tests match your search.";
31
+ readonly searchError: "Couldn't load earlier tests.";
32
+ readonly round: "Round";
33
+ readonly chooseTestFirst: "Choose a test first";
34
+ readonly draftLabel: "Earlier-test audience";
35
+ readonly versions: "Versions";
36
+ readonly outcome: "Outcome";
37
+ readonly any: "Any outcome";
38
+ readonly completed: "Completed it";
39
+ readonly notCompleted: "Didn't complete it";
40
+ readonly participation: "Include or exclude";
41
+ readonly include: "Only these people";
42
+ readonly exclude: "Everyone except these people";
43
+ readonly noEstimate: "Size shows after the first results run.";
44
+ readonly tooSmall: "This audience may be too small to reach a reliable answer.";
45
+ readonly build: "Build the audience";
46
+ readonly progress: "Building the audience… this can take up to a minute";
47
+ readonly whoTookPart: "Who took part";
48
+ readonly singularExit: "1 person left this audience after they first saw the test. They stay in the results, and saw the Original afterwards.";
49
+ };
50
+ export declare const cohortRoundCount: (count: number) => string;
51
+ export declare const latestCohortRound: (round: number | null) => string;
52
+ /** Dates read in the site's time zone (the schedule default), else the browser's. */
53
+ export declare function cohortRoundLabel({ phase, startedAt, endedAt }: {
54
+ phase: number;
55
+ startedAt: string;
56
+ endedAt: string | null;
57
+ }, timeZone?: string): string;
58
+ export declare const cohortGrowth: (name: string) => string;
59
+ export declare const cohortSizeLabel: (size: number, include: boolean) => string;
60
+ export declare const cohortReviewLabel: (size: number) => string;
61
+ export declare const cohortExitsLabel: (size: number) => string;
62
+ export declare const COHORT_REFUSALS: {
63
+ readonly 'cohort-source-invalid': "Check the earlier test, round, versions and goal for this audience.";
64
+ readonly 'cohort-cycle': "An earlier test in this audience also depends on this test.";
65
+ readonly 'cohort-source-open': "To use people who didn't complete a goal, wait until 24 hours after the earlier round ends.";
66
+ readonly 'cohort-lookup-missing': "Ask your developer to enable audiences from earlier tests.";
67
+ readonly 'cohort-build-timeout': "This audience needs more time. Build the audience, then start the test.";
68
+ };
@@ -0,0 +1,81 @@
1
+ import { GROUP_LABELS } from './arms.js';
2
+ export const COHORT_COPY = {
3
+ invalid: 'Check the earlier test, round, versions and goal for this audience.',
4
+ cycle: 'An earlier test in this audience also depends on this test.',
5
+ open: "To use people who didn't complete a goal, wait until 24 hours after the earlier round ends.",
6
+ lookup: 'Ask your developer to enable audiences from earlier tests.',
7
+ noExposures: "No one has seen this test in its first hour. If your site's proxy doesn't look up audiences from earlier tests, every visitor sees the Original: check that `lookupCohorts` is set in the proxy runtime.",
8
+ timeout: 'This audience needs more time. Build the audience, then start the test.',
9
+ source: 'Choose an earlier test.',
10
+ self: 'Choose a different test.',
11
+ arms: 'Choose at least one version.',
12
+ goal: 'Choose whether people completed the goal.',
13
+ round: 'Enter a positive whole round number.',
14
+ unavailable: 'Audience from an earlier test'
15
+ };
16
+ const versionList = new Intl.ListFormat('en-US', {
17
+ type: 'disjunction'
18
+ });
19
+ export function cohortRuleSummary(rule, names = {}) {
20
+ const audience = rule.include ? 'People who saw' : 'Excluding people who saw';
21
+ const versions = rule.arms.map((arm)=>names.arms?.[arm] ?? (arm === 'control' ? 'the Original' : GROUP_LABELS[arm]));
22
+ const round = rule.phase === 'latest' ? 'latest round' : `round ${rule.phase}`;
23
+ const goal = rule.goal ? ` and ${rule.goal.completed ? 'completed' : "didn't complete"} ${names.goal ?? 'the selected goal'}` : '';
24
+ return `${audience} ${versionList.format(versions)} in ${names.experiment ?? 'an earlier test'} (${round})${goal}`;
25
+ }
26
+ const audienceCount = new Intl.NumberFormat('en-US', {
27
+ maximumSignificantDigits: 2
28
+ });
29
+ const exitCount = new Intl.NumberFormat('en-US');
30
+ export const COHORT_EDITOR = {
31
+ add: 'Add people from an earlier test',
32
+ test: 'Test',
33
+ search: 'Search earlier tests',
34
+ invalidSearch: 'Enter a valid search or test ID.',
35
+ noAttributes: 'No visitor attributes are available for rules.',
36
+ loading: 'Loading tests…',
37
+ empty: 'No earlier tests are available.',
38
+ noMatches: 'No earlier tests match your search.',
39
+ searchError: "Couldn't load earlier tests.",
40
+ round: 'Round',
41
+ chooseTestFirst: 'Choose a test first',
42
+ draftLabel: 'Earlier-test audience',
43
+ versions: 'Versions',
44
+ outcome: 'Outcome',
45
+ any: 'Any outcome',
46
+ completed: 'Completed it',
47
+ notCompleted: "Didn't complete it",
48
+ participation: 'Include or exclude',
49
+ include: 'Only these people',
50
+ exclude: 'Everyone except these people',
51
+ noEstimate: 'Size shows after the first results run.',
52
+ tooSmall: 'This audience may be too small to reach a reliable answer.',
53
+ build: 'Build the audience',
54
+ progress: 'Building the audience… this can take up to a minute',
55
+ whoTookPart: 'Who took part',
56
+ singularExit: '1 person left this audience after they first saw the test. They stay in the results, and saw the Original afterwards.'
57
+ };
58
+ export const cohortRoundCount = (count)=>count === 1 ? '1 round' : `${count} rounds`;
59
+ export const latestCohortRound = (round)=>round == null ? 'Latest round' : `Latest round (round ${round})`;
60
+ /** Dates read in the site's time zone (the schedule default), else the browser's. */ export function cohortRoundLabel({ phase, startedAt, endedAt }, timeZone) {
61
+ const roundDate = new Intl.DateTimeFormat('en-US', {
62
+ month: 'short',
63
+ day: 'numeric',
64
+ ...timeZone ? {
65
+ timeZone
66
+ } : {}
67
+ });
68
+ const from = roundDate.format(new Date(startedAt));
69
+ return `Round ${phase} · ${from}${endedAt ? `–${roundDate.format(new Date(endedAt))}` : ''}`;
70
+ }
71
+ export const cohortGrowth = (name)=>`This group grows while ${name} runs.`;
72
+ export const cohortSizeLabel = (size, include)=>include ? `About ${audienceCount.format(size)} people` : `Leaves out about ${audienceCount.format(size)} people`;
73
+ export const cohortReviewLabel = (size)=>`Only about ${audienceCount.format(size)} people can take part.`;
74
+ export const cohortExitsLabel = (size)=>size === 1 ? COHORT_EDITOR.singularExit : `${exitCount.format(size)} people left this audience after they first saw the test. They stay in the results, and saw the Original afterwards.`;
75
+ export const COHORT_REFUSALS = {
76
+ 'cohort-source-invalid': COHORT_COPY.invalid,
77
+ 'cohort-cycle': COHORT_COPY.cycle,
78
+ 'cohort-source-open': COHORT_COPY.open,
79
+ 'cohort-lookup-missing': COHORT_COPY.lookup,
80
+ 'cohort-build-timeout': COHORT_COPY.timeout
81
+ };
@@ -19,6 +19,8 @@ export declare const API_MESSAGES: {
19
19
  export declare const LOCKED_MESSAGES: {
20
20
  readonly creation: "Set when the test was created.";
21
21
  readonly running: "Locked while the test is running. Stop the test to change this.";
22
+ readonly paused: "Locked while the test is paused. Stop the test to change this.";
23
+ readonly scheduled: "Cancel the schedule to change this.";
22
24
  readonly runningAllocation: "To include more people, use \"Let more people in\" at the bottom of the page. To include fewer, stop the test; the change applies when you start it again.";
23
25
  readonly runningMetrics: "Use \"Add a goal\" to track another goal. The main goal is fixed for this round.";
24
26
  readonly decided: "Locked after the decision.";
@@ -31,6 +33,3 @@ export declare function refusalMessage(code: string | undefined, status: number,
31
33
  codes?: Readonly<Record<string, string>>;
32
34
  fallback?: string;
33
35
  }, detail?: unknown): string;
34
- export declare const INPUT_COPY: {
35
- readonly selectRequired: "Choose an option.";
36
- };
@@ -1,4 +1,4 @@
1
- import { unpublishedPlacementsCopy } from './readiness.js';
1
+ import { occupancyMessage, unpublishedPlacementsCopy } from './readiness.js';
2
2
  export const API_MESSAGES = {
3
3
  testAlreadyDeleted: 'This test was already deleted. Reload the page.',
4
4
  deleteInvalidStatus: 'Only draft and archived tests can be deleted. Open the test to see how to archive it.',
@@ -20,6 +20,8 @@ export const API_MESSAGES = {
20
20
  export const LOCKED_MESSAGES = {
21
21
  creation: 'Set when the test was created.',
22
22
  running: 'Locked while the test is running. Stop the test to change this.',
23
+ paused: 'Locked while the test is paused. Stop the test to change this.',
24
+ scheduled: 'Cancel the schedule to change this.',
23
25
  runningAllocation: 'To include more people, use "Let more people in" at the bottom of the page. To include fewer, stop the test; the change applies when you start it again.',
24
26
  runningMetrics: 'Use "Add a goal" to track another goal. The main goal is fixed for this round.',
25
27
  decided: 'Locked after the decision.',
@@ -35,9 +37,7 @@ export function refusalMessage(code, status, message, options, detail) {
35
37
  if (code === 'commit-unverified') return API_MESSAGES.commitUnverified;
36
38
  if (code === 'not-implemented' || status === 501) return API_MESSAGES.notImplemented;
37
39
  if (mapped !== undefined) return mapped;
40
+ if (code === 'occupied-in-range') return occupancyMessage(detail) ?? message ?? API_MESSAGES.failed;
38
41
  if (code === 'placement-unpublished') return unpublishedPlacementsCopy(detail);
39
42
  return options?.fallback ?? (message || API_MESSAGES.failed);
40
43
  }
41
- export const INPUT_COPY = {
42
- selectRequired: 'Choose an option.'
43
- };
@@ -0,0 +1,3 @@
1
+ export declare const INPUT_COPY: {
2
+ readonly selectRequired: "Choose an option.";
3
+ };
@@ -0,0 +1,3 @@
1
+ export const INPUT_COPY = {
2
+ selectRequired: 'Choose an option.'
3
+ };
@@ -1,3 +1,4 @@
1
+ import type { OccupiedInRangeDetail } from '../../types/endpoints.js';
1
2
  export declare const PLACEMENT_FAILURE_COPY: {
2
3
  readonly 'placements-failed': "Couldn't check where this test is used. Try again.";
3
4
  readonly forbidden: "You don't have permission to check where this test is used.";
@@ -67,6 +68,19 @@ export declare const READINESS_COPY: {
67
68
  };
68
69
  export declare const unsupportedContentCopy: (page: string) => string;
69
70
  export declare const pageInUseCopy: (path: string, version?: boolean, label?: string) => string;
71
+ export declare function occupiedInRangeCopy(detail: Pick<OccupiedInRangeDetail, 'otherTestName' | 'from' | 'place' | 'timeZone'>, place?: "page" | "setting" | "traffic group"): string;
72
+ export declare function occupancyMessage(value?: unknown): string | undefined;
73
+ export declare const scheduleOccupancyCopy: {
74
+ readonly invalidStart: "Choose a valid start time.";
75
+ readonly pastEnd: "Choose an end time after the test starts.";
76
+ readonly timeZone: "Choose a valid time zone for this schedule.";
77
+ readonly windows: "Choose at least one day for each time window.";
78
+ readonly notLive: "This test has not gone live. You can cancel a scheduled start before it goes live.";
79
+ readonly notPausable: "A rollout cannot be paused.";
80
+ readonly paused: "Resume this test before changing how many people take part.";
81
+ readonly reschedulePast: "Choose an end time in the future and after the test starts.";
82
+ readonly scheduleStarted: "You can only cancel a schedule before the test goes live and before anyone has taken part.";
83
+ };
70
84
  export declare const unpublishedPageCopy: (path: string, context?: {
71
85
  original: boolean;
72
86
  found: boolean;
@@ -90,13 +104,13 @@ export declare const attributeNext: (attribute: string) => string;
90
104
  export declare const firstStartOnlyCopy: (status: string) => string;
91
105
  export declare const stoppedCopy: (date: string | null) => string;
92
106
  export declare const decidedCopy: (date: string | null, winner: string) => string;
93
- export declare const runningCopy: (date: string | null, people: number | null, days: number | null) => string;
94
- export declare const lastBlockPlacementCopy: (name: string, removingPage?: boolean) => string;
95
- export declare const hiddenBlockPlacementCopy: (name: string) => string;
96
- export declare const bulkBlockRemovalCopy: (name: string) => string;
97
- export declare const pendingBlockRemovalCopy: (name: string) => string;
107
+ export declare const runningCopy: (date: string | null, people: number | null, days: number | null, weekends?: number | null) => string;
108
+ export declare const lastBlockPlacementCopy: (name: string, removingPage?: boolean, status?: string) => string;
109
+ export declare const hiddenBlockPlacementCopy: (name: string, status?: string) => string;
110
+ export declare const bulkBlockRemovalCopy: (name: string, status?: string) => string;
111
+ export declare const pendingBlockRemovalCopy: (name: string, status?: string) => string;
98
112
  /** After archive the guard protects the winner and the Original; only the winner page is "the winner". */
99
- export declare const pageGuardCopy: (name: string, status: "running" | "decided" | "archived", role?: "winner" | "original") => string;
113
+ export declare const pageGuardCopy: (name: string, status: "running" | "paused" | "decided" | "archived", role?: "winner" | "original") => string;
100
114
  export declare const versionPageUnavailableCopy: (path: string, status?: string) => string;
101
115
  export declare const versionPageUncheckedCopy: (path: string, status?: string) => string;
102
116
  export declare const sameAddressCopy: (label: string, other: string, path: string) => string;
@@ -1,3 +1,4 @@
1
+ import { isValidTimeZone } from '../../schedule/activeTime.js';
1
2
  import { controlVersionName } from '../../labels/arms.js';
2
3
  export const PLACEMENT_FAILURE_COPY = {
3
4
  'placements-failed': "Couldn't check where this test is used. Try again.",
@@ -69,6 +70,37 @@ export const READINESS_COPY = {
69
70
  };
70
71
  export const unsupportedContentCopy = (page)=>`${page} has more than one language, so Make it the content isn't available for it; you'll copy the winning version by hand.`;
71
72
  export const pageInUseCopy = (path, version = false, label)=>version ? `${path} is already in another running or decided test. Make a new copy of ${controlVersionName(label)} for this version, or finish that test first.` : `Another running or decided test already uses ${path}. Choose a different page, or finish that test first.`;
73
+ export function occupiedInRangeCopy(detail, place = detail.place ?? 'page') {
74
+ const zone = detail.timeZone && isValidTimeZone(detail.timeZone) ? detail.timeZone : 'UTC';
75
+ const from = new Intl.DateTimeFormat('en-US', {
76
+ timeZone: zone,
77
+ month: 'short',
78
+ day: 'numeric'
79
+ }).format(new Date(detail.from));
80
+ return `${detail.otherTestName} uses this ${place} from ${from}.`;
81
+ }
82
+ export function occupancyMessage(value) {
83
+ if (!value || typeof value !== 'object') return undefined;
84
+ const { otherTestName, from, place, timeZone } = value;
85
+ if (typeof otherTestName !== 'string' || !otherTestName.trim() || typeof from !== 'string' || !Number.isFinite(Date.parse(from))) return undefined;
86
+ return occupiedInRangeCopy({
87
+ otherTestName,
88
+ from,
89
+ timeZone,
90
+ place: place === 'setting' || place === 'traffic group' ? place : 'page'
91
+ });
92
+ }
93
+ export const scheduleOccupancyCopy = {
94
+ invalidStart: 'Choose a valid start time.',
95
+ pastEnd: 'Choose an end time after the test starts.',
96
+ timeZone: 'Choose a valid time zone for this schedule.',
97
+ windows: 'Choose at least one day for each time window.',
98
+ notLive: 'This test has not gone live. You can cancel a scheduled start before it goes live.',
99
+ notPausable: 'A rollout cannot be paused.',
100
+ paused: 'Resume this test before changing how many people take part.',
101
+ reschedulePast: 'Choose an end time in the future and after the test starts.',
102
+ scheduleStarted: 'You can only cancel a schedule before the test goes live and before anyone has taken part.'
103
+ };
72
104
  export const unpublishedPageCopy = (path, context, label)=>!context ? `${path} isn't a published page yet. Publish it, or choose another page.` : context.original ? `${path} isn't published, so it can't be ${controlVersionName(label)}. Publish it, or choose another page.` : context.found ? `${path} is still a draft. Publish it in ${context.collection} to get it ready for the test.` : `${path} isn't published yet, or no page has that address. Publish it in ${context.collection}, or choose another page.`;
73
105
  /** Old responses may include raw host errors; unknown strings use authored copy. */ export const placementFailureCopy = (reason)=>PLACEMENT_FAILURE_COPY[typeof reason === 'string' && Object.hasOwn(PLACEMENT_FAILURE_COPY, reason) ? reason : 'placements-failed'];
74
106
  const withoutPeriod = (value)=>value.trim().replace(/[.!?]+$/, '');
@@ -94,28 +126,29 @@ export const attributeNext = (attribute)=>`Remove the rule on ${attribute}: it i
94
126
  export const firstStartOnlyCopy = (status)=>`Only a draft that has never started can start this way. The test is currently ${status === 'draft' ? 'a draft' : status}.`;
95
127
  export const stoppedCopy = (date)=>`Stopped${date ? ` ${date}` : ''}. You can edit the versions, goal, audience or length. Starting again resets the results.`;
96
128
  export const decidedCopy = (date, winner)=>`Decided${date ? ` ${date}` : ''}: ${winner}.`;
97
- function daysToGoCopy(days) {
129
+ function daysToGoCopy(days, weekends) {
98
130
  if (days === null) return null;
99
131
  if (days === 0) return 'past the planned end';
100
132
  if (days === 1) return 'last planned day';
133
+ if (weekends !== null) return `about ${weekends} ${weekends === 1 ? 'weekend' : 'weekends'} to go`;
101
134
  return `about ${days} days to go`;
102
135
  }
103
- export const runningCopy = (date, people, days)=>[
136
+ export const runningCopy = (date, people, days, weekends = null)=>[
104
137
  date ? `Running since ${date}` : READINESS_COPY.running,
105
138
  people === null ? null : `${people.toLocaleString('en-US')} people so far`,
106
- daysToGoCopy(days)
139
+ daysToGoCopy(days, weekends)
107
140
  ].filter(Boolean).join(' · ');
108
- export const lastBlockPlacementCopy = (name, removingPage = false)=>removingPage ? `“${name}” is running and this page is the only published place it appears. Stop the test first.` : `“${name}” is running and this is the only published place it appears. Stop the test, or keep its block on this page.`;
109
- export const hiddenBlockPlacementCopy = (name)=>`“${name}” is running and this is the only published place it appears. Stop the test first, or keep its block visible on this page.`;
110
- export const bulkBlockRemovalCopy = (name)=>`“${name}” is running and the pages in this change are the only published places it appears. Stop the test first.`;
111
- export const pendingBlockRemovalCopy = (name)=>`“${name}” is running and the pages in this change are the only published places it appears. Stop the test first, or change these pages one at a time.`;
112
- /** After archive the guard protects the winner and the Original; only the winner page is "the winner". */ export const pageGuardCopy = (name, status, role = 'winner')=>status === 'archived' ? role === 'original' ? `This page's address now shows the winner of the finished test "${name}". Use "Release pages" on the test to free it.` : `This page is shown at other addresses because the finished test "${name}" made it the winner. Use "Release pages" on the test to free it.` : status === 'decided' ? `This page is part of the decided test "${name}". Choose "Make it the content" or "Discard winner" on the test before you delete, rename or unpublish it.` : `This page is part of the running test "${name}". Stop the test before you delete, rename or unpublish it.`;
141
+ export const lastBlockPlacementCopy = (name, removingPage = false, status = 'running')=>removingPage ? `“${name}” is ${status} and this page is the only published place it appears. Stop the test first.` : `“${name}” is ${status} and this is the only published place it appears. Stop the test, or keep its block on this page.`;
142
+ export const hiddenBlockPlacementCopy = (name, status = 'running')=>`“${name}” is ${status} and this is the only published place it appears. Stop the test first, or keep its block visible on this page.`;
143
+ export const bulkBlockRemovalCopy = (name, status = 'running')=>`“${name}” is ${status} and the pages in this change are the only published places it appears. Stop the test first.`;
144
+ export const pendingBlockRemovalCopy = (name, status = 'running')=>`“${name}” is ${status} and the pages in this change are the only published places it appears. Stop the test first, or change these pages one at a time.`;
145
+ /** After archive the guard protects the winner and the Original; only the winner page is "the winner". */ export const pageGuardCopy = (name, status, role = 'winner')=>status === 'archived' ? role === 'original' ? `This page's address now shows the winner of the finished test "${name}". Use "Release pages" on the test to free it.` : `This page is shown at other addresses because the finished test "${name}" made it the winner. Use "Release pages" on the test to free it.` : status === 'decided' ? `This page is part of the decided test "${name}". Choose "Make it the content" or "Discard winner" on the test before you delete, rename or unpublish it.` : `This page is part of the ${status} test "${name}". Stop the test before you delete, rename or unpublish it.`;
113
146
  export const versionPageUnavailableCopy = (path, status = 'running')=>`${path} isn't published, so visitors assigned to it see an error. Republish it, or ${status === 'decided' ? 'discard the winner' : 'stop the test'}.`;
114
147
  export const versionPageUncheckedCopy = (path, status = 'running')=>`Couldn't check whether ${path} is published. Check that it is still published, or ${status === 'decided' ? 'discard the winner' : 'stop the test'}.`;
115
148
  export const sameAddressCopy = (label, other, path)=>`${label} has the same address (${path}) as ${other}. Choose a different page.`;
116
149
  export const identicalVersionCopy = (version, control)=>`${version} looks the same as ${control}, so the test would compare nothing. Change it before you start.`;
117
150
  /** Keep named actions aligned with the actual transition buttons. */ export function placementGuardCopy(page, block, preExisting) {
118
- const action = (test)=>test.status === 'running' ? `stop ${test.name}` : `choose "Make it the content" or "Discard winner" on ${test.name}`;
151
+ const action = (test)=>test.status === 'running' || test.status === 'paused' ? `stop ${test.name}` : `choose "Make it the content" or "Discard winner" on ${test.name}`;
119
152
  return preExisting ? `This page is in two tests that change it, ${page.name} and ${block.name}. Before you publish, ${action(page)} or ${action(block)}.` : `This page is part of the ${page.status} test ${page.name}, so a block from another test can't be added to it. Finish one of the tests first.`;
120
153
  }
121
154
  export function interactingTestsCopy(page, state, name, version = false) {
@@ -107,6 +107,7 @@ export declare const shippingTitle: (winner: string) => string;
107
107
  export declare const keepRunningTo: (date: string) => string;
108
108
  export declare const pastPlannedEnd: (date: string) => string;
109
109
  export declare const moreDays: (days: string) => string;
110
+ export declare const moreWeekends: (weekends: string) => string;
110
111
  export declare const collectingCopy: (n: string, minimum: string, conversions: string, conversionMinimum: string) => string;
111
112
  export declare const uncappedTotal: (total: string) => string;
112
113
  export declare const cappedCount: (count: string, cap: string) => string;
@@ -108,6 +108,7 @@ export const shippingTitle = (winner)=>`Since shipping ${winner}`;
108
108
  export const keepRunningTo = (date)=>`Keep running to the planned end (${date}).`;
109
109
  export const pastPlannedEnd = (date)=>`The planned end was ${date}.`;
110
110
  export const moreDays = (days)=>`At this traffic, a clear answer needs about ${days} more ${days === '1' ? 'day' : 'days'}.`;
111
+ export const moreWeekends = (weekends)=>`At this traffic, a clear answer needs about ${weekends} more ${weekends === '1' ? 'weekend' : 'weekends'}.`;
111
112
  export const collectingCopy = (n, minimum, conversions, conversionMinimum)=>`${n} of ${minimum} people, ${conversions} of ${conversionMinimum} conversions`;
112
113
  export const uncappedTotal = (total)=>`Total ${total} (not capped)`;
113
114
  export const cappedCount = (count, cap)=>`${count} capped at ${cap}`;
@@ -0,0 +1,58 @@
1
+ import type { ScheduleWindow, Weekday } from '../../schedule/types.js';
2
+ export declare const SCHEDULE_COPY: {
3
+ readonly heading: "When it runs";
4
+ readonly start: "Start date and time (optional)";
5
+ readonly end: "End date and time (optional)";
6
+ readonly savedStart: "Start date and time";
7
+ readonly savedEnd: "End date and time";
8
+ readonly timeZone: "Time zone";
9
+ readonly zoneHelp: "Dates and times use this time zone. Changing it keeps the clock times you entered.";
10
+ readonly chooseZone: "Choose a time zone";
11
+ readonly windows: "Recurring hours";
12
+ readonly windowHelp: "Add hours to run only on selected days. Leave this empty to run at all hours.";
13
+ readonly window: (index: number) => string;
14
+ readonly add: "Add hours";
15
+ readonly remove: (index: number) => string;
16
+ readonly weekdays: "Weekdays";
17
+ readonly weekends: "Weekends";
18
+ readonly days: Record<Weekday, string>;
19
+ readonly fullDays: {
20
+ readonly mon: "Monday";
21
+ readonly tue: "Tuesday";
22
+ readonly wed: "Wednesday";
23
+ readonly thu: "Thursday";
24
+ readonly fri: "Friday";
25
+ readonly sat: "Saturday";
26
+ readonly sun: "Sunday";
27
+ };
28
+ readonly from: "From";
29
+ readonly to: "To";
30
+ readonly overnight: "Ends the next morning";
31
+ readonly save: "Save schedule";
32
+ readonly discard: "Discard schedule edits";
33
+ readonly changed: "The saved schedule changed. Discard your edits to see the latest schedule.";
34
+ readonly invalidTime: "Choose a date and time that exists in this time zone.";
35
+ readonly invalidHours: "Enter a start and end time for each window.";
36
+ readonly noZone: "Choose a time zone to set dates and recurring hours.";
37
+ readonly allHours: "at all hours";
38
+ readonly noSchedule: "Runs at all hours once started.";
39
+ readonly starts: (date: string) => string;
40
+ readonly off: (date: string) => string;
41
+ readonly on: (date: string) => string;
42
+ readonly onNow: "On now";
43
+ readonly offNow: "Off now";
44
+ readonly ended: (date: string) => string;
45
+ readonly paused: (progress: string, date?: string, reason?: string, name?: string) => string;
46
+ readonly day: (day: number, planned: number | null) => string;
47
+ };
48
+ export declare function scheduleZoneName(timeZone: string, at: Date): string;
49
+ export declare function scheduleDate(at: Date, timeZone: string, date?: 'day' | 'weekday' | 'time', now?: Date): string;
50
+ export declare function scheduleSummary({ startAt, endAt, timeZone, windows }: {
51
+ startAt?: string | null;
52
+ endAt?: string | null;
53
+ timeZone: string;
54
+ windows: ScheduleWindow[];
55
+ }, now: Date): string;
56
+ export declare function scheduleWindowsCopy(windows: ScheduleWindow[], timeZone: string, at: Date): string;
57
+ export declare const schedulePopulationCopy: (summary: string) => string;
58
+ export declare const pausedShareCopy: (days: number) => string;