@delmaredigital/payload-experiments 0.4.0-rc.9 → 0.4.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 (254) hide show
  1. package/README.md +2 -8
  2. package/dist/admin/MetricSourceSelect.js +10 -3
  3. package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
  4. package/dist/admin/blocks/BlockPanel.d.ts +1 -0
  5. package/dist/admin/blocks/BlockPanel.js +75 -29
  6. package/dist/admin/blocks/model.js +5 -4
  7. package/dist/admin/copy/blocks.d.ts +14 -11
  8. package/dist/admin/copy/blocks.js +33 -22
  9. package/dist/admin/copy/goals.d.ts +15 -8
  10. package/dist/admin/copy/goals.js +18 -8
  11. package/dist/admin/copy/newTest.d.ts +10 -7
  12. package/dist/admin/copy/newTest.js +14 -7
  13. package/dist/admin/copy/status.d.ts +1 -1
  14. package/dist/admin/copy/status.js +2 -1
  15. package/dist/admin/pageCollections.d.ts +1 -0
  16. package/dist/admin/pageCollections.js +3 -0
  17. package/dist/admin/placementStatus.model.js +5 -3
  18. package/dist/admin/status.model.d.ts +1 -0
  19. package/dist/admin/status.model.js +2 -1
  20. package/dist/admin/surface/ResultsRoute.js +4 -8
  21. package/dist/admin/surface/SurfaceShell.d.ts +4 -2
  22. package/dist/admin/surface/SurfaceShell.js +28 -3
  23. package/dist/admin/surface/TestRowMenu.d.ts +13 -0
  24. package/dist/admin/surface/TestRowMenu.js +163 -0
  25. package/dist/admin/surface/TestsHome.d.ts +4 -3
  26. package/dist/admin/surface/TestsHome.js +186 -47
  27. package/dist/admin/surface/TestsSurface.js +2 -1
  28. package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
  29. package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
  30. package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
  31. package/dist/admin/surface/goals/GoalForm.js +280 -198
  32. package/dist/admin/surface/goals/GoalsList.js +102 -33
  33. package/dist/admin/surface/goals/data.d.ts +2 -0
  34. package/dist/admin/surface/goals/data.js +9 -0
  35. package/dist/admin/surface/goals/goals.css +3 -2
  36. package/dist/admin/surface/goals/goals.model.d.ts +2 -2
  37. package/dist/admin/surface/goals/goals.model.js +7 -12
  38. package/dist/admin/surface/home.model.d.ts +15 -8
  39. package/dist/admin/surface/home.model.js +22 -18
  40. package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
  41. package/dist/admin/surface/newTest/NewTest.js +156 -96
  42. package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
  43. package/dist/admin/surface/newTest/PageWizard.js +93 -68
  44. package/dist/admin/surface/newTest/newTest.css +28 -11
  45. package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
  46. package/dist/admin/surface/results/ResultsHeader.js +90 -63
  47. package/dist/admin/surface/surface.css +29 -0
  48. package/dist/admin/surface/test/TestPage.js +46 -38
  49. package/dist/admin/surface/useXpStepNav.d.ts +11 -0
  50. package/dist/admin/surface/useXpStepNav.js +14 -0
  51. package/dist/admin/views/TestsSurfaceClient.js +27 -3
  52. package/dist/admin/views/buildSurfaceProps.js +18 -66
  53. package/dist/arms/copy.d.ts +13 -3
  54. package/dist/arms/copy.js +5 -4
  55. package/dist/blocks/createExperimentBlock.js +1 -1
  56. package/dist/blocks/formState.js +1 -1
  57. package/dist/collections/experiments/armInvariants.js +8 -5
  58. package/dist/collections/metrics.js +12 -5
  59. package/dist/collections/serialize.js +3 -2
  60. package/dist/db/pageCopies.d.ts +5 -0
  61. package/dist/db/pageCopies.js +31 -0
  62. package/dist/db/snapshots.d.ts +1 -0
  63. package/dist/endpoints/duplicateOriginal.d.ts +38 -0
  64. package/dist/endpoints/duplicateOriginal.js +414 -0
  65. package/dist/endpoints/editorSurface.js +1 -1
  66. package/dist/endpoints/index.js +20 -0
  67. package/dist/endpoints/pages.js +245 -66
  68. package/dist/endpoints/placementStatus.js +1 -0
  69. package/dist/endpoints/results.js +3 -0
  70. package/dist/endpoints/testVersion.d.ts +2 -0
  71. package/dist/endpoints/testVersion.js +38 -0
  72. package/dist/endpoints/transitions.js +4 -5
  73. package/dist/exports/index.d.ts +1 -1
  74. package/dist/goals/picker/copy.js +1 -1
  75. package/dist/goals/sourceLabel.d.ts +2 -0
  76. package/dist/goals/sourceLabel.js +4 -0
  77. package/dist/hooks/trackPageCopies.d.ts +11 -0
  78. package/dist/hooks/trackPageCopies.js +7 -0
  79. package/dist/labels/arms.d.ts +3 -0
  80. package/dist/labels/arms.js +8 -0
  81. package/dist/options.d.ts +2 -0
  82. package/dist/options.js +18 -2
  83. package/dist/plugin.js +56 -2
  84. package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
  85. package/dist/puck/editor/ConfigureTestDrawer.js +36 -26
  86. package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
  87. package/dist/puck/editor/ExperimentSlotEditor.js +219 -106
  88. package/dist/puck/editor/LeftoverVersions.js +17 -32
  89. package/dist/puck/editor/QuickTestActions.d.ts +2 -2
  90. package/dist/puck/editor/QuickTestActions.js +44 -34
  91. package/dist/puck/editor/ResultsReadout.d.ts +3 -1
  92. package/dist/puck/editor/ResultsReadout.js +28 -16
  93. package/dist/puck/editor/VersionBuilder.d.ts +4 -2
  94. package/dist/puck/editor/VersionBuilder.js +42 -63
  95. package/dist/puck/editor/armWrites.js +1 -1
  96. package/dist/puck/editor/copy.d.ts +10 -6
  97. package/dist/puck/editor/copy.js +22 -12
  98. package/dist/puck/editor/editor.chrome.css +9 -8
  99. package/dist/puck/editor/editor.css +14 -9
  100. package/dist/puck/editor/placementsCache.d.ts +1 -1
  101. package/dist/puck/editor/placementsCache.js +9 -17
  102. package/dist/puck/editor/usePageSaveReadiness.d.ts +1 -4
  103. package/dist/puck/editor/usePageSaveReadiness.js +18 -21
  104. package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
  105. package/dist/puck/editor/usePlacementNotice.js +4 -5
  106. package/dist/puck/nestedTestCopy.js +2 -2
  107. package/dist/puck/slotConfig.d.ts +1 -1
  108. package/dist/puck/slotConfig.js +1 -1
  109. package/dist/results/analyse.d.ts +2 -0
  110. package/dist/results/analyse.js +2 -2
  111. package/dist/results/verdict.d.ts +4 -4
  112. package/dist/results/verdict.js +13 -10
  113. package/dist/server/runResults.js +2 -1
  114. package/dist/testSurface/PreviewLinks.d.ts +2 -1
  115. package/dist/testSurface/PreviewLinks.js +3 -3
  116. package/dist/testSurface/actions/DecideDialog.d.ts +7 -4
  117. package/dist/testSurface/actions/DecideDialog.js +71 -59
  118. package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
  119. package/dist/testSurface/actions/LifecycleAction.js +107 -0
  120. package/dist/testSurface/actions/MakeContentResult.js +1 -1
  121. package/dist/testSurface/actions/actions.model.d.ts +13 -5
  122. package/dist/testSurface/actions/actions.model.js +75 -22
  123. package/dist/testSurface/actions/decide.model.d.ts +1 -0
  124. package/dist/testSurface/actions/decide.model.js +1 -0
  125. package/dist/testSurface/allocation.model.js +6 -3
  126. package/dist/testSurface/api.d.ts +4 -1
  127. package/dist/testSurface/api.js +22 -14
  128. package/dist/testSurface/copy/actions.d.ts +36 -14
  129. package/dist/testSurface/copy/actions.js +39 -17
  130. package/dist/testSurface/copy/advanced.d.ts +10 -0
  131. package/dist/testSurface/copy/advanced.js +10 -0
  132. package/dist/testSurface/copy/arms.d.ts +1 -1
  133. package/dist/testSurface/copy/arms.js +1 -1
  134. package/dist/testSurface/copy/audience.d.ts +4 -3
  135. package/dist/testSurface/copy/audience.js +5 -4
  136. package/dist/testSurface/copy/common.d.ts +6 -6
  137. package/dist/testSurface/copy/common.js +6 -6
  138. package/dist/testSurface/copy/metrics.d.ts +6 -0
  139. package/dist/testSurface/copy/metrics.js +8 -0
  140. package/dist/testSurface/copy/pages.d.ts +67 -7
  141. package/dist/testSurface/copy/pages.js +74 -7
  142. package/dist/testSurface/copy/readiness.d.ts +8 -6
  143. package/dist/testSurface/copy/readiness.js +19 -10
  144. package/dist/testSurface/copy/recommendation.d.ts +1 -22
  145. package/dist/testSurface/copy/recommendation.js +2 -22
  146. package/dist/testSurface/copy/results.d.ts +16 -10
  147. package/dist/testSurface/copy/results.js +19 -11
  148. package/dist/testSurface/copy/review.d.ts +13 -10
  149. package/dist/testSurface/copy/review.js +14 -10
  150. package/dist/testSurface/copy/setting.d.ts +1 -2
  151. package/dist/testSurface/copy/setting.js +1 -2
  152. package/dist/testSurface/copy/surface.d.ts +11 -2
  153. package/dist/testSurface/copy/surface.js +14 -11
  154. package/dist/testSurface/copy/testPage.d.ts +16 -10
  155. package/dist/testSurface/copy/testPage.js +24 -18
  156. package/dist/testSurface/format/date.d.ts +5 -2
  157. package/dist/testSurface/format/date.js +24 -8
  158. package/dist/testSurface/format/roundProgress.d.ts +6 -0
  159. package/dist/testSurface/format/roundProgress.js +15 -0
  160. package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
  161. package/dist/testSurface/format/useDateFormatter.js +8 -0
  162. package/dist/testSurface/labels.d.ts +1 -2
  163. package/dist/testSurface/labels.js +2 -3
  164. package/dist/testSurface/lockedNotice.model.d.ts +2 -0
  165. package/dist/testSurface/lockedNotice.model.js +31 -0
  166. package/dist/testSurface/readPreflight.d.ts +0 -1
  167. package/dist/testSurface/readPreflight.js +0 -1
  168. package/dist/testSurface/results/CiChart.js +2 -1
  169. package/dist/testSurface/results/DataTable.d.ts +1 -1
  170. package/dist/testSurface/results/DataTable.js +4 -3
  171. package/dist/testSurface/results/VerdictHero.d.ts +1 -1
  172. package/dist/testSurface/results/legacy.d.ts +0 -5
  173. package/dist/testSurface/results/legacy.js +0 -14
  174. package/dist/testSurface/results/results.css +2 -2
  175. package/dist/testSurface/results/results.model.d.ts +8 -3
  176. package/dist/testSurface/results/results.model.js +25 -21
  177. package/dist/testSurface/results/snapshot.d.ts +2 -0
  178. package/dist/testSurface/results/snapshot.js +3 -0
  179. package/dist/testSurface/surface/contracts.d.ts +6 -1
  180. package/dist/testSurface/surface/editorPlacement.d.ts +1 -1
  181. package/dist/testSurface/surface/editorPlacement.js +1 -1
  182. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
  183. package/dist/testSurface/surface/pageBlock/parts.js +25 -12
  184. package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
  185. package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
  186. package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
  187. package/dist/testSurface/surface/pagePicker/PageCombobox.js +298 -209
  188. package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
  189. package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
  190. package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
  191. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +5 -3
  192. package/dist/testSurface/surface/readiness/ActionDialogs.js +213 -207
  193. package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
  194. package/dist/testSurface/surface/readiness/Banner.js +109 -148
  195. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
  196. package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
  197. package/dist/testSurface/surface/readiness/readiness.model.d.ts +14 -5
  198. package/dist/testSurface/surface/readiness/readiness.model.js +62 -12
  199. package/dist/testSurface/surface/readiness/useTransition.d.ts +3 -1
  200. package/dist/testSurface/surface/readiness/useTransition.js +49 -8
  201. package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -3
  202. package/dist/testSurface/surface/results/ReleasePages.js +41 -41
  203. package/dist/testSurface/surface/results/ResultsBody.d.ts +7 -2
  204. package/dist/testSurface/surface/results/ResultsBody.js +170 -110
  205. package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
  206. package/dist/testSurface/surface/results/recommendation.model.js +15 -59
  207. package/dist/testSurface/surface/results/useResults.d.ts +6 -2
  208. package/dist/testSurface/surface/setting/parts.js +31 -28
  209. package/dist/testSurface/surface/setting/setting.css +2 -1
  210. package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
  211. package/dist/testSurface/surface/test/DeleteTest.d.ts +5 -1
  212. package/dist/testSurface/surface/test/DeleteTest.js +63 -55
  213. package/dist/testSurface/surface/test/GoalSection.js +11 -11
  214. package/dist/testSurface/surface/test/LengthSection.js +21 -13
  215. package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
  216. package/dist/testSurface/surface/test/PageHoldout.js +7 -7
  217. package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
  218. package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
  219. package/dist/testSurface/surface/test/Section.js +8 -0
  220. package/dist/testSurface/surface/test/TargetingSection.js +7 -2
  221. package/dist/testSurface/surface/test/TestSurface.js +17 -43
  222. package/dist/testSurface/surface/test/VersionsSection.js +93 -70
  223. package/dist/testSurface/surface/test/fields.d.ts +4 -3
  224. package/dist/testSurface/surface/test/fields.js +10 -16
  225. package/dist/testSurface/surface/test/pageParts.js +13 -7
  226. package/dist/testSurface/surface/test/testPage.css +9 -2
  227. package/dist/testSurface/surface/useTestDocument.d.ts +1 -3
  228. package/dist/testSurface/surface/useTestDocument.js +110 -52
  229. package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
  230. package/dist/testSurface/surface/watchTestDocument.js +181 -0
  231. package/dist/testSurface/surfaceUrls.d.ts +1 -0
  232. package/dist/testSurface/surfaceUrls.js +4 -0
  233. package/dist/testSurface/useApi.d.ts +3 -0
  234. package/dist/transitions/addMetric.d.ts +1 -1
  235. package/dist/transitions/addMetric.js +5 -1
  236. package/dist/transitions/kernel.d.ts +2 -0
  237. package/dist/transitions/kernel.js +1 -1
  238. package/dist/transitions/pageAddress.d.ts +6 -0
  239. package/dist/transitions/pageAddress.js +71 -0
  240. package/dist/transitions/pageVersions.d.ts +1 -1
  241. package/dist/transitions/preflightData.js +10 -2
  242. package/dist/transitions/start.d.ts +1 -1
  243. package/dist/transitions/start.js +8 -5
  244. package/dist/types/armKey.d.ts +2 -0
  245. package/dist/types/armKey.js +1 -0
  246. package/dist/types/contracts.d.ts +11 -1
  247. package/dist/types/endpoints.d.ts +38 -9
  248. package/dist/types/endpoints.js +1 -1
  249. package/dist/types/surface.d.ts +7 -9
  250. package/dist/ui/Dialog.d.ts +21 -2
  251. package/dist/ui/Dialog.js +101 -4
  252. package/dist/ui/Inputs.js +0 -1
  253. package/dist/ui/ui.css +5 -1
  254. package/package.json +2 -2
@@ -6,6 +6,7 @@ import { readinessParts } from '../readiness/parts.js';
6
6
  import { SectionCard } from '../../../ui/SectionCard.js';
7
7
  import { SECTION_ORDER } from '../contracts.js';
8
8
  import { fixFieldsNext } from '../../copy/readiness.js';
9
+ import { sectionLockNotice } from '../../lockedNotice.model.js';
9
10
  import { TEST_PAGE as C } from '../../copy/testPage.js';
10
11
  export function Section({ test, sectionId, children, surface }) {
11
12
  const hasAdvancedError = Object.keys(test.errors).some((path)=>path.startsWith('analysis.') && ![
@@ -18,6 +19,11 @@ export function Section({ test, sectionId, children, surface }) {
18
19
  setPrevHasAdvancedError(hasAdvancedError);
19
20
  if (hasAdvancedError) setOpen(true);
20
21
  }
22
+ const reason = test.doc && sectionLockNotice(test.doc.status, sectionId);
23
+ const notice = reason ? /*#__PURE__*/ _jsx("p", {
24
+ className: "xp-ui-help xp-section-lock",
25
+ children: reason
26
+ }) : null;
21
27
  const setup = test.doc?.status === 'draft' || test.doc?.status === 'stopped';
22
28
  const blocked = setup && sectionBlocked(test, sectionId);
23
29
  const blockers = setup && test.doc ? blockingSteps(test.preflight, surface ? pageReadinessContext(test.doc, test.preflight, surface) : test.doc).filter((step)=>step.section === sectionId) : [];
@@ -58,6 +64,7 @@ export function Section({ test, sectionId, children, surface }) {
58
64
  /*#__PURE__*/ _jsxs("div", {
59
65
  className: "xp-ui-section-body",
60
66
  children: [
67
+ notice,
61
68
  children,
62
69
  blockerLines
63
70
  ]
@@ -73,6 +80,7 @@ export function Section({ test, sectionId, children, surface }) {
73
80
  headingId: `title-${sectionId}`,
74
81
  className: "xp-test-section",
75
82
  children: [
83
+ notice,
76
84
  children,
77
85
  blockerLines
78
86
  ]
@@ -6,7 +6,7 @@ import { ChipsInput } from '../../../ui/ChipsInput.js';
6
6
  import { AUDIENCE_COPY } from '../../copy/audience.js';
7
7
  import { coerceValue, emptyListHint, humaniseAttribute, opLabel, opsFor, readListValue, readTargetingRules, valueInput } from '../../targeting/targeting.model.js';
8
8
  import { TEST_PAGE as C, NUMBER_COMPARISONS } from '../../copy/testPage.js';
9
- import { CheckboxList, FieldErrors, reasonFor, save, SavedValueChanged, SelectEdit, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
9
+ import { CheckboxList, FieldErrors, ReadOnly, reasonFor, save, SavedValueChanged, SelectEdit, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
10
10
  import { Section } from './Section.js';
11
11
  export function TargetingSection({ test, surface }) {
12
12
  const id = useId();
@@ -244,6 +244,10 @@ function TargetingChips({ test, draftKey, id, label, values, reason, onCommit })
244
244
  if (text !== draft.value || !draft.dirty) draft.change(text);
245
245
  draft.submit(()=>onCommit(next));
246
246
  };
247
+ if (reason && !draft.dirty) return /*#__PURE__*/ _jsx(ReadOnly, {
248
+ label: C.value,
249
+ value: values.join(', ')
250
+ });
247
251
  const choiceId = choice ? `${id}-new-value` : undefined;
248
252
  return /*#__PURE__*/ _jsxs(_Fragment, {
249
253
  children: [
@@ -252,7 +256,7 @@ function TargetingChips({ test, draftKey, id, label, values, reason, onCommit })
252
256
  label: C.value,
253
257
  value: values,
254
258
  disabled: locked,
255
- description: reason ?? AUDIENCE_COPY.listDescription,
259
+ description: reason ? undefined : AUDIENCE_COPY.listDescription,
256
260
  placeholder: AUDIENCE_COPY.listPlaceholder,
257
261
  onChange: onCommit,
258
262
  draft: {
@@ -267,6 +271,7 @@ function TargetingChips({ test, draftKey, id, label, values, reason, onCommit })
267
271
  id: choiceId,
268
272
  value: saved,
269
273
  reason: reason,
274
+ showReason: false,
270
275
  conflict: draft.conflict,
271
276
  announce: announcement,
272
277
  onKeep: !locked ? ()=>commit(draft.value, true) : undefined,
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { DeleteTest } from './DeleteTest.js';
4
- import { surfaceUrls } from '../../surfaceUrls.js';
3
+ import { DeleteTestAction } from './DeleteTest.js';
5
4
  import { useEffect, useState, useRef } from 'react';
6
5
  import { useTestDocument } from '../useTestDocument.js';
7
6
  import { API_MESSAGES } from '../../copy/common.js';
8
- import { DELETE_TEST, TEST_PAGE as C } from '../../copy/testPage.js';
7
+ import { TEST_PAGE as C } from '../../copy/testPage.js';
9
8
  import { pageBlockParts } from '../pageBlock/parts.js';
10
9
  import { settingParts } from '../setting/parts.js';
11
10
  import { pageParts } from './pageParts.js';
@@ -31,20 +30,10 @@ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded
31
30
  const documentState = useTestDocument(id, {
32
31
  apiRoute: surface.apiRoute,
33
32
  contentLocale: surface.contentLocale,
34
- refetchPreflightOnFocus: true,
35
- refetchDocumentOnFocus: true,
36
- ...!surface.canManage ? {
37
- enabled: false
38
- } : {},
39
- ...onDocument ? {
40
- onDocument
41
- } : {},
42
- ...onPreflight ? {
43
- onPreflight
44
- } : {},
45
- ...requestPreflight ? {
46
- requestPreflight
47
- } : {}
33
+ enabled: surface.canManage,
34
+ onDocument,
35
+ onPreflight,
36
+ requestPreflight
48
37
  });
49
38
  const [placementRead, setPlacementRead] = useState();
50
39
  const placementKey = JSON.stringify([
@@ -97,14 +86,18 @@ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded
97
86
  value: preflight.placements
98
87
  };
99
88
  const placements = !placementFailed && !sharedDocument.preflightError && lastPlacements.current?.key === placementKey ? lastPlacements.current.value : undefined;
100
- const editorPage = embedded ? currentPuckDocument(window.location.pathname, surface.adminRoute, placements) ?? surface.editorPage : surface.editorPage;
89
+ const editorDocument = embedded ? currentPuckDocument(window.location.pathname, surface.adminRoute, placements) : undefined;
90
+ const editorPage = editorDocument ? {
91
+ ...editorDocument,
92
+ versionContent: surface.editorPage?.versionContent
93
+ } : surface.editorPage;
101
94
  const message = editorPlacementMessage(placements, editorPage, documentState.doc?.status);
102
95
  surface = {
103
96
  ...surface,
104
97
  editorPage,
105
98
  editorPlacementMessage: message
106
99
  };
107
- usePlacementNotice(surface.apiRoute, id, watching ? sharedDocument.preflightError ?? (placementFailed ? placementReadError(surface.apiRoute, id, surface.contentLocale) : message) : undefined, surface.contentLocale, watching);
100
+ usePlacementNotice(surface.apiRoute, id, watching ? sharedDocument.preflightError ?? (placementFailed ? placementReadError(surface.apiRoute, id, surface.contentLocale) : message) : undefined, surface.contentLocale);
108
101
  const setup = documentState.doc?.status === 'draft' || documentState.doc?.status === 'stopped';
109
102
  const test = setup ? {
110
103
  ...sharedDocument,
@@ -248,26 +241,8 @@ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded
248
241
  /*#__PURE__*/ _jsx(AdvancedSection, {
249
242
  ...props
250
243
  }),
251
- !embedded ? /*#__PURE__*/ _jsxs("div", {
252
- children: [
253
- /*#__PURE__*/ _jsx(DeleteTest, {
254
- test: test.doc,
255
- canManage: surface.canManage && !test.statusReadPending,
256
- apiRoute: surface.apiRoute,
257
- contentLocale: surface.contentLocale,
258
- onStatusChanged: ()=>{
259
- void test.reload();
260
- },
261
- onDeleted: (outcome)=>{
262
- window.location.assign(surfaceUrls.home(surface.adminRoute, {
263
- deleted: outcome
264
- }));
265
- }
266
- }, test.doc.id),
267
- !test.statusReadPending && (test.doc.status === 'stopped' || test.doc.status === 'decided') ? /*#__PURE__*/ _jsx("p", {
268
- children: DELETE_TEST.archiveFirst
269
- }) : null
270
- ]
244
+ !embedded ? /*#__PURE__*/ _jsx(DeleteTestAction, {
245
+ ...props
271
246
  }) : null,
272
247
  embedded && surface.canReadResults && test.doc.status !== 'draft' ? /*#__PURE__*/ _jsx(ResultsBody, {
273
248
  documentVersion: `${test.doc.phase}/${test.doc.status}`,
@@ -275,10 +250,8 @@ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded
275
250
  statusReadPending: test.statusReadPending,
276
251
  id: id,
277
252
  surface: surface,
278
- onChanged: (doc)=>{
279
- test.acceptTransition?.({
280
- doc
281
- });
253
+ onChanged: (transition)=>{
254
+ if (transition) test.acceptTransition?.(transition);
282
255
  void test.reload();
283
256
  }
284
257
  }) : null
@@ -288,6 +261,7 @@ export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded
288
261
  }),
289
262
  /*#__PURE__*/ _jsx(ReadinessBar, {
290
263
  ...props,
264
+ embedded: embedded,
291
265
  onHeightChange: setBarHeight
292
266
  })
293
267
  ]
@@ -1,11 +1,13 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useId, useState } from 'react';
4
4
  import { Button } from '../../../ui/Button.js';
5
5
  import { Range } from '../../../ui/Inputs.js';
6
6
  import { TEST_PAGE as C } from '../../copy/testPage.js';
7
+ import { actionGroupLabel } from '../../actions/actions.model.js';
7
8
  import { ARMS_COPY, GROUP_LABELS, issueMessage } from '../../copy/arms.js';
8
9
  import { addHoldoutArm, addVariant, issuesByRow, removeArm, splitEvenly, totalWeight, withSlotsFor } from '../../arms/arms.model.js';
10
+ import { LOCKED_MESSAGES } from '../../copy/common.js';
9
11
  import { allocationSentence } from '../../allocation.model.js';
10
12
  import { balanceWeight, orderedVersions, trafficShares, trafficSplit } from './testPage.model.js';
11
13
  import { FieldErrors, ReadOnly, reasonFor, save, SavedValueChanged, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
@@ -31,10 +33,12 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
31
33
  const allocationConflict = allocationEdit.dirty && !allocationEdit.saving && (allocationEdit.conflict || allocationEdit.retry || allocationReason) ? `${id}-new-value` : undefined;
32
34
  if (weightEdit && (weightEdit.split !== split || test.mountDraft && !test.fieldDrafts?.[`share:${weightEdit.key}`])) setWeightEdit(null);
33
35
  const reason = reasonFor(test, 'arms');
36
+ const setting = doc.kind === 'flag' || doc.kind === 'code';
34
37
  const live = weightEdit && !reason ? balanceWeight(doc.arms, weightEdit.key, weightEdit.weight) : doc.arms;
35
38
  const ordered = orderedVersions(live);
36
39
  const shares = trafficShares(ordered.map((row)=>row.arm));
37
40
  const issues = issuesByRow(doc.kind === 'block' ? withSlotsFor(live, 'block') : live, doc.kind);
41
+ const controlLabel = live.find((arm)=>arm.kind === 'control')?.label;
38
42
  const update = (transform)=>save(test, 'arms', ()=>({
39
43
  arms: withSlotsFor(transform(test.doc.arms), test.doc.kind)
40
44
  }));
@@ -60,12 +64,8 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
60
64
  contentOnCanvas ? /*#__PURE__*/ _jsx("p", {
61
65
  children: C.editVersionsOnCanvas
62
66
  }) : null,
63
- reason ? /*#__PURE__*/ _jsx("p", {
64
- className: "xp-ui-help",
65
- children: reason
66
- }) : null,
67
67
  /*#__PURE__*/ _jsxs("div", {
68
- className: "xp-version-rows",
68
+ className: `xp-version-rows${setting ? ' xp-version-rows--setting' : ''}`,
69
69
  children: [
70
70
  /*#__PURE__*/ _jsxs("div", {
71
71
  className: "xp-version-grid-head",
@@ -74,53 +74,80 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
74
74
  /*#__PURE__*/ _jsx("span", {
75
75
  children: C.label
76
76
  }),
77
- /*#__PURE__*/ _jsx("span", {
78
- children: C.weight
79
- }),
80
- /*#__PURE__*/ _jsx("span", {}),
81
- /*#__PURE__*/ _jsx("span", {})
77
+ setting ? /*#__PURE__*/ _jsx("span", {
78
+ children: C.valueColumn
79
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
80
+ children: [
81
+ /*#__PURE__*/ _jsx("span", {
82
+ children: C.weight
83
+ }),
84
+ /*#__PURE__*/ _jsx("span", {}),
85
+ /*#__PURE__*/ _jsx("span", {})
86
+ ]
87
+ })
82
88
  ]
83
89
  }),
84
- ordered.filter(({ arm })=>doc.kind !== 'page' || arm.kind !== 'holdout').map(({ arm, index })=>/*#__PURE__*/ _jsxs("article", {
90
+ ordered.filter(({ arm })=>doc.kind !== 'page' || arm.kind !== 'holdout').map(({ arm, index })=>{
91
+ const fieldLabel = arm.kind === 'control' ? actionGroupLabel(arm.key, arm.label) : GROUP_LABELS[arm.key];
92
+ const name = contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
93
+ children: arm.label
94
+ }) : /*#__PURE__*/ _jsx(TextEdit, {
95
+ test: test,
96
+ label: `${fieldLabel}: ${C.label}`,
97
+ draftKey: `${GROUP_LABELS[arm.key]}: ${C.label}`,
98
+ value: arm.label,
99
+ reason: reason,
100
+ hideLabel: true,
101
+ onCommit: (label)=>update((arms)=>arms.map((current)=>current.key === arm.key ? {
102
+ ...current,
103
+ label
104
+ } : current))
105
+ });
106
+ const weight = /*#__PURE__*/ _jsx(TextEdit, {
107
+ test: test,
108
+ draftKey: `share:${arm.key}`,
109
+ label: `${fieldLabel}: ${C.weight}`,
110
+ type: "number",
111
+ min: 0,
112
+ max: 100,
113
+ value: doc.arms[index].weight,
114
+ preview: weightEdit?.key !== arm.key ? arm.weight : undefined,
115
+ scope: split,
116
+ reason: reason,
117
+ hideLabel: !setting,
118
+ isValid: (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) >= 0 && Number(raw) <= 100,
119
+ invalidMessage: C.invalidShare,
120
+ onDraft: (value)=>setWeightEdit(value === null ? null : {
121
+ split,
122
+ key: arm.key,
123
+ weight: Number(value)
124
+ }),
125
+ onCommit: (value)=>update((arms)=>balanceWeight(arms, arm.key, Number(value)))
126
+ });
127
+ const remove = !reason && !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
128
+ variant: "quiet",
129
+ size: "sm",
130
+ onClick: ()=>update((arms)=>splitEvenly(removeArm(arms, arm.key))),
131
+ children: C.remove
132
+ }) : null;
133
+ return /*#__PURE__*/ _jsxs("article", {
85
134
  className: "xp-version-row",
86
135
  id: `xp-version-${arm.key}`,
136
+ "aria-label": arm.label,
87
137
  tabIndex: -1,
88
138
  children: [
89
- contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
90
- children: arm.label
91
- }) : /*#__PURE__*/ _jsx(TextEdit, {
92
- test: test,
93
- label: `${GROUP_LABELS[arm.key]}: ${C.label}`,
94
- value: arm.label,
95
- reason: reason,
96
- hideLabel: true,
97
- disabled: Boolean(reason),
98
- onCommit: (label)=>update((arms)=>arms.map((current)=>current.key === arm.key ? {
99
- ...current,
100
- label
101
- } : current))
102
- }),
103
- /*#__PURE__*/ _jsx(TextEdit, {
104
- test: test,
105
- draftKey: `share:${arm.key}`,
106
- label: `${GROUP_LABELS[arm.key]}: ${C.weight}`,
107
- type: "number",
108
- min: 0,
109
- max: 100,
110
- value: doc.arms[index].weight,
111
- preview: weightEdit?.key !== arm.key ? arm.weight : undefined,
112
- scope: split,
113
- reason: reason,
114
- hideLabel: true,
115
- disabled: Boolean(reason),
116
- isValid: (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) >= 0 && Number(raw) <= 100,
117
- invalidMessage: C.invalidShare,
118
- onDraft: (value)=>setWeightEdit(value === null ? null : {
119
- split,
120
- key: arm.key,
121
- weight: Number(value)
122
- }),
123
- onCommit: (value)=>update((arms)=>balanceWeight(arms, arm.key, Number(value)))
139
+ setting ? /*#__PURE__*/ _jsxs("div", {
140
+ className: "xp-setting-version-name",
141
+ children: [
142
+ name,
143
+ !reason || test.fieldDrafts?.[`share:${arm.key}`] ? weight : null,
144
+ remove
145
+ ]
146
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
147
+ children: [
148
+ name,
149
+ weight
150
+ ]
124
151
  }),
125
152
  /*#__PURE__*/ _jsx(parts.VersionContent, {
126
153
  test: test,
@@ -128,27 +155,21 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
128
155
  armIndex: index,
129
156
  summary: contentOnCanvas
130
157
  }),
131
- /*#__PURE__*/ _jsx("div", {
158
+ !setting && !reason ? /*#__PURE__*/ _jsx("div", {
132
159
  className: "xp-ui-button-group xp-version-remove",
133
- children: !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
134
- variant: "quiet",
135
- size: "sm",
136
- disabled: Boolean(reason),
137
- title: reason ?? undefined,
138
- onClick: ()=>update((arms)=>splitEvenly(removeArm(arms, arm.key))),
139
- children: C.remove
140
- }) : null
141
- }),
160
+ children: remove
161
+ }) : null,
142
162
  issues.rows[index]?.map((issue, i)=>/*#__PURE__*/ _jsx("p", {
143
163
  role: "alert",
144
- children: issueMessage(issue, totalWeight(live))
164
+ children: issueMessage(issue, totalWeight(live), controlLabel)
145
165
  }, i)),
146
166
  /*#__PURE__*/ _jsx(FieldErrors, {
147
167
  test: test,
148
168
  path: `arms.${index}`
149
169
  })
150
170
  ]
151
- }, arm.key))
171
+ }, arm.key);
172
+ })
152
173
  ]
153
174
  }),
154
175
  /*#__PURE__*/ _jsx("div", {
@@ -178,34 +199,32 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
178
199
  ]
179
200
  }, arm.key))
180
201
  }),
181
- /*#__PURE__*/ _jsx("p", {
202
+ !reason ? /*#__PURE__*/ _jsx("p", {
182
203
  className: "xp-ui-help",
183
204
  children: C.balanceHelp
184
- }),
205
+ }) : null,
185
206
  issues.form.map((issue, i)=>/*#__PURE__*/ _jsx("p", {
186
207
  role: "alert",
187
- children: issueMessage(issue, totalWeight(live))
208
+ children: issueMessage(issue, totalWeight(live), controlLabel)
188
209
  }, i)),
189
210
  test.errors.arms ? /*#__PURE__*/ _jsx("p", {
190
211
  role: "alert",
191
212
  children: test.errors.arms
192
213
  }) : null,
193
- !contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
214
+ !reason && !contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
194
215
  className: "xp-section-actions xp-ui-button-group",
195
- title: reason ?? undefined,
196
216
  children: [
197
217
  /*#__PURE__*/ _jsx(Button, {
198
- disabled: Boolean(reason) || doc.arms.filter((arm)=>arm.kind === 'variant').length >= 3,
218
+ disabled: doc.arms.filter((arm)=>arm.kind === 'variant').length >= 3,
199
219
  onClick: ()=>update((arms)=>addVariant(arms, doc.kind)),
200
220
  children: C.addVersion
201
221
  }),
202
222
  doc.kind !== 'page' ? /*#__PURE__*/ _jsx(Button, {
203
- disabled: Boolean(reason) || doc.arms.some((arm)=>arm.kind === 'holdout'),
223
+ disabled: doc.arms.some((arm)=>arm.kind === 'holdout'),
204
224
  onClick: ()=>update(addHoldoutArm),
205
225
  children: C.addHoldout
206
226
  }) : null,
207
227
  /*#__PURE__*/ _jsx(Button, {
208
- disabled: Boolean(reason),
209
228
  onClick: ()=>update(splitEvenly),
210
229
  children: C.split
211
230
  })
@@ -213,12 +232,11 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
213
232
  }) : null,
214
233
  doc.kind !== 'page' && doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
215
234
  className: "xp-ui-help",
216
- children: ARMS_COPY.holdout
235
+ children: ARMS_COPY.holdout(actionGroupLabel('control', doc.arms.find((arm)=>arm.key === 'control')?.label))
217
236
  }) : null,
218
237
  allocationReason && !allocationEdit.dirty ? /*#__PURE__*/ _jsx(ReadOnly, {
219
238
  label: C.allocation,
220
- value: `${doc.allocation}%`,
221
- reason: allocationReason
239
+ value: `${doc.allocation}%`
222
240
  }) : /*#__PURE__*/ _jsx(Range, {
223
241
  id: id,
224
242
  label: C.allocation,
@@ -259,11 +277,16 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
259
277
  id: allocationConflict,
260
278
  value: `${doc.allocation}%`,
261
279
  reason: allocationReason,
280
+ showReason: false,
262
281
  conflict: allocationEdit.conflict,
263
282
  announce: announcement,
264
283
  onKeep: !allocationReason && !test.stale ? ()=>commitAllocation(true) : undefined,
265
284
  onDiscard: allocationEdit.discard
266
285
  }) : null,
286
+ doc.status === 'running' ? /*#__PURE__*/ _jsx("p", {
287
+ className: "xp-ui-help",
288
+ children: doc.allocation >= 100 ? C.everyoneMatches : LOCKED_MESSAGES.runningAllocation
289
+ }) : null,
267
290
  /*#__PURE__*/ _jsx("p", {
268
291
  children: allocationSentence({
269
292
  allocation: allocationReason ? doc.allocation : allocation,
@@ -8,11 +8,11 @@ export declare function FieldErrors({ test, path }: {
8
8
  test: TestDocApi;
9
9
  path: string;
10
10
  }): import("react").JSX.Element;
11
- export declare function ReadOnly({ label, value, reason, labelAction }: {
11
+ export declare function ReadOnly({ label, value, labelAction, hideLabel }: {
12
12
  label: string;
13
13
  value: ReactNode;
14
- reason: string | null;
15
14
  labelAction?: ReactNode;
15
+ hideLabel?: boolean;
16
16
  }): import("react").JSX.Element;
17
17
  export declare function useFieldDraft(test: TestDocApi, key: string, label: string, saved: string, scope?: string): {
18
18
  value: string;
@@ -24,10 +24,11 @@ export declare function useFieldDraft(test: TestDocApi, key: string, label: stri
24
24
  submit(save: () => boolean | void): void;
25
25
  discard(): void;
26
26
  };
27
- export declare function SavedValueChanged({ id, value, reason, conflict, announce, onKeep, onDiscard }: {
27
+ export declare function SavedValueChanged({ id, value, reason, showReason, conflict, announce, onKeep, onDiscard }: {
28
28
  id: string;
29
29
  value: string;
30
30
  reason?: string | null;
31
+ showReason?: boolean;
31
32
  conflict: boolean;
32
33
  announce: number;
33
34
  onKeep?: () => void;
@@ -24,12 +24,11 @@ export function FieldErrors({ test, path }) {
24
24
  }, key))
25
25
  });
26
26
  }
27
- export function ReadOnly({ label, value, reason, labelAction }) {
27
+ export function ReadOnly({ label, value, labelAction, hideLabel }) {
28
28
  return /*#__PURE__*/ _jsxs("div", {
29
29
  className: "xp-read-only",
30
- title: reason ?? undefined,
31
30
  children: [
32
- /*#__PURE__*/ _jsxs("div", {
31
+ !hideLabel ? /*#__PURE__*/ _jsxs("div", {
33
32
  className: "xp-ui-field-label",
34
33
  children: [
35
34
  /*#__PURE__*/ _jsx("strong", {
@@ -37,13 +36,10 @@ export function ReadOnly({ label, value, reason, labelAction }) {
37
36
  }),
38
37
  labelAction
39
38
  ]
40
- }),
39
+ }) : null,
41
40
  /*#__PURE__*/ _jsx("p", {
42
41
  children: value
43
- }),
44
- reason ? /*#__PURE__*/ _jsx("small", {
45
- children: reason
46
- }) : null
42
+ })
47
43
  ]
48
44
  });
49
45
  }
@@ -80,7 +76,7 @@ export function useFieldDraft(test, key, label, saved, scope) {
80
76
  }
81
77
  };
82
78
  }
83
- export function SavedValueChanged({ id, value, reason, conflict, announce, onKeep, onDiscard }) {
79
+ export function SavedValueChanged({ id, value, reason, showReason = true, conflict, announce, onKeep, onDiscard }) {
84
80
  return /*#__PURE__*/ _jsx("div", {
85
81
  id: id,
86
82
  className: "xp-field-draft-notice",
@@ -104,7 +100,7 @@ export function SavedValueChanged({ id, value, reason, conflict, announce, onKee
104
100
  }),
105
101
  children: /*#__PURE__*/ _jsxs("span", {
106
102
  children: [
107
- reason ?? (conflict ? C.savedValueChanged : null),
103
+ reason ? showReason ? reason : null : conflict ? C.savedValueChanged : null,
108
104
  ' ',
109
105
  onKeep && conflict ? C.conflictChoice : C.draftNotSaved,
110
106
  ' ',
@@ -158,15 +154,14 @@ export function SavedValueChanged({ id, value, reason, conflict, announce, onKee
158
154
  edit.submit(()=>onCommit(draft));
159
155
  onDraft?.(null);
160
156
  };
161
- if (reason && !disabled && !edit.dirty) return /*#__PURE__*/ _jsx(ReadOnly, {
157
+ if (reason && !edit.dirty) return /*#__PURE__*/ _jsx(ReadOnly, {
162
158
  label: label,
163
- value: value === '' && placeholder ? placeholder : value,
164
- reason: reason
159
+ hideLabel: hideLabel,
160
+ value: value === '' && placeholder ? placeholder : value
165
161
  });
166
162
  const Input = multiline ? Textarea : type === 'number' ? NumberInput : TextInput;
167
163
  return /*#__PURE__*/ _jsxs("div", {
168
164
  className: hideLabel ? 'xp-grid-field' : undefined,
169
- title: reason ?? undefined,
170
165
  children: [
171
166
  /*#__PURE__*/ _jsx(Input, {
172
167
  id: id,
@@ -206,6 +201,7 @@ export function SavedValueChanged({ id, value, reason, conflict, announce, onKee
206
201
  id: choiceId,
207
202
  value: String(value),
208
203
  reason: reason,
204
+ showReason: false,
209
205
  conflict: edit.conflict,
210
206
  announce: announcement,
211
207
  onKeep: !locked && !test.stale && !error ? ()=>commit(true) : undefined,
@@ -220,7 +216,6 @@ export function SelectEdit({ label, value, options, groups, reason, onCommit, re
220
216
  if (reason) {
221
217
  return /*#__PURE__*/ _jsx(ReadOnly, {
222
218
  label: label,
223
- reason: reason,
224
219
  labelAction: labelAction,
225
220
  value: readOnlyValue ?? options.find((o)=>o.value === value)?.label ?? value
226
221
  });
@@ -250,7 +245,6 @@ export function CheckboxList({ label, value, options, reason, onToggle, readOnly
250
245
  const id = useId();
251
246
  if (reason) return /*#__PURE__*/ _jsx(ReadOnly, {
252
247
  label: label,
253
- reason: reason,
254
248
  value: readOnlyValue ?? value.map((v)=>options.find((o)=>o.value === v)?.label ?? v).join(', ')
255
249
  });
256
250
  return /*#__PURE__*/ _jsx(UICheckboxList, {
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
+ import { holdoutContent } from '../../copy/audience.js';
5
+ import { actionGroupLabel } from '../../actions/actions.model.js';
4
6
  import { TEST_PAGE as C } from '../../copy/testPage.js';
5
7
  import { pageTargetIssue, setPageTarget, showsPageTarget } from '../../arms/pageTarget.model.js';
6
8
  import { normalisePath } from '../../../runtime/normalisePath.js';
@@ -21,7 +23,7 @@ export function VersionContent({ test, surface, armIndex }) {
21
23
  if (!arm || !doc) return null;
22
24
  if (!showsPageTarget(doc.kind, arm.kind)) return /*#__PURE__*/ _jsx("span", {
23
25
  className: "xp-content-chip",
24
- children: C.holdoutContent
26
+ children: holdoutContent(actionGroupLabel('control', test.doc?.arms.find((arm)=>arm.key === 'control')?.label))
25
27
  });
26
28
  const placement = test.preflight?.pagePlacements?.find((entry)=>entry.arm === arm.key && entry.collection === collection?.slug && entry.id != null && arm.pageTarget && normalisePath(entry.path) === normalisePath(arm.pageTarget));
27
29
  if (collection && !wasUsingAddress) {
@@ -29,15 +31,16 @@ export function VersionContent({ test, surface, armIndex }) {
29
31
  collection: collection,
30
32
  test: test,
31
33
  armKey: arm.key,
32
- apiRoute: surface.apiRoute
33
- });
34
+ apiRoute: surface.apiRoute,
35
+ contentLocale: surface.contentLocale
36
+ }, `${collection.slug}-${arm.key}`);
34
37
  return /*#__PURE__*/ _jsxs("div", {
35
38
  className: "xp-version-content xp-version-content--page",
36
39
  children: [
37
40
  /*#__PURE__*/ _jsx("strong", {
38
41
  children: P.where
39
42
  }),
40
- placement?.id != null ? /*#__PURE__*/ _jsxs("div", {
43
+ placement?.id != null && (arm.kind !== 'variant' || placement.published || doc.status !== 'draft' && doc.status !== 'stopped') ? /*#__PURE__*/ _jsxs("div", {
41
44
  children: [
42
45
  placement.editorUrl ? /*#__PURE__*/ _jsx("a", {
43
46
  href: placement.editorUrl,
@@ -55,9 +58,12 @@ export function VersionContent({ test, surface, armIndex }) {
55
58
  ]
56
59
  }) : null,
57
60
  arm.kind === 'variant' ? /*#__PURE__*/ _jsx(CopyRoute, {
58
- collection: collection
59
- }) : null,
60
- picker,
61
+ collection: collection,
62
+ arm: arm,
63
+ test: test,
64
+ surface: surface,
65
+ children: picker
66
+ }, `${collection.slug}/${arm.key}`) : picker,
61
67
  /*#__PURE__*/ _jsx(FieldErrors, {
62
68
  test: test,
63
69
  path: `arms.${armIndex}.pageTarget`