@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
@@ -2,16 +2,39 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { surfaceUrls } from '../../../testSurface/surfaceUrls.js';
4
4
  import { fetchAllDocs } from '../../../lib/fetchAllDocs.js';
5
- import { useEffect, useRef, useState } from 'react';
5
+ import { useEffect, useId, useRef, useState } from 'react';
6
6
  import { useRouter } from 'next/navigation.js';
7
7
  import { formatAdminURL } from 'payload/shared';
8
+ import { useXpStepNav } from '../useXpStepNav.js';
9
+ import { SURFACE_COPY } from '../../../testSurface/copy/surface.js';
10
+ import { PAGE_COPY } from '../../../testSurface/copy/pages.js';
8
11
  import { NEW_TEST_COPY as C } from '../../copy/newTest.js';
9
12
  import { CreateRefused, createTest } from '../../../puck/editor/createTest.js';
10
13
  import { PageWizard } from './PageWizard.js';
14
+ import { Button } from '../../../ui/Button.js';
15
+ import { TextInput, Textarea } from '../../../ui/Inputs.js';
16
+ import { PageCombobox } from '../../../testSurface/surface/pagePicker/PageCombobox.js';
11
17
  import { Select } from '../../../ui/Select.js';
12
18
  import './newTest.css';
13
- export function NewTest({ surface, pages }) {
19
+ export function NewTest({ surface, blockPageCollections = [] }) {
20
+ useXpStepNav([
21
+ {
22
+ label: SURFACE_COPY.title,
23
+ url: surfaceUrls.home(surface.adminRoute)
24
+ },
25
+ {
26
+ label: SURFACE_COPY.newTest
27
+ }
28
+ ]);
14
29
  const router = useRouter();
30
+ const id = useId();
31
+ const [blockCollection, setBlockCollection] = useState('');
32
+ const collection = blockPageCollections.find((entry)=>entry.slug === blockCollection) ?? blockPageCollections[0];
33
+ const supportsPuck = collection?.editors.includes('puck');
34
+ const supportsBlocks = collection?.editors.includes('blocks');
35
+ const supportsBothEditors = supportsPuck && supportsBlocks;
36
+ const puckLabelId = `${id}-puck-editor`;
37
+ const blocksLabelId = `${id}-blocks-editor`;
15
38
  const [step, setStep] = useState('kind');
16
39
  const [kind, setKind] = useState('flag');
17
40
  const [created, setCreated] = useState();
@@ -78,6 +101,7 @@ export function NewTest({ surface, pages }) {
78
101
  });
79
102
  if (kind === 'page') {
80
103
  setCreated(id);
104
+ inFlight.current = false;
81
105
  setPending(false);
82
106
  return;
83
107
  }
@@ -91,16 +115,36 @@ export function NewTest({ surface, pages }) {
91
115
  setPending(false);
92
116
  }
93
117
  }
94
- if (created !== undefined) return /*#__PURE__*/ _jsx(PageWizard, {
118
+ const changeKind = ()=>{
119
+ setError('');
120
+ setStep('kind');
121
+ };
122
+ const choice = step === 'block' ? C.block : kind === 'page' ? C.page : C.setting;
123
+ const kindChip = (busy = pending)=>/*#__PURE__*/ _jsxs("div", {
124
+ className: "xp-new-test-kind",
125
+ children: [
126
+ /*#__PURE__*/ _jsx("span", {
127
+ className: "xp-tests-kind",
128
+ children: choice
129
+ }),
130
+ /*#__PURE__*/ _jsx(Button, {
131
+ variant: "link",
132
+ size: "sm",
133
+ disabled: busy,
134
+ onClick: changeKind,
135
+ children: C.change
136
+ })
137
+ ]
138
+ });
139
+ if (created !== undefined && step === 'name' && kind === 'page') return /*#__PURE__*/ _jsx(PageWizard, {
95
140
  id: created,
96
- surface: surface
141
+ surface: surface,
142
+ kindChip: kindChip
97
143
  });
98
- const collections = [
99
- ...new Set(pages?.map((page)=>page.collection))
100
- ];
101
144
  return /*#__PURE__*/ _jsxs("div", {
102
145
  className: "xp-new-test",
103
146
  children: [
147
+ step !== 'kind' ? kindChip() : null,
104
148
  step === 'kind' ? /*#__PURE__*/ _jsxs(_Fragment, {
105
149
  children: [
106
150
  /*#__PURE__*/ _jsx("h2", {
@@ -109,25 +153,22 @@ export function NewTest({ surface, pages }) {
109
153
  /*#__PURE__*/ _jsxs("div", {
110
154
  className: "xp-new-test-cards",
111
155
  children: [
112
- pages !== undefined ? /*#__PURE__*/ _jsxs("button", {
156
+ collection ? /*#__PURE__*/ _jsxs("button", {
113
157
  type: "button",
114
- className: "xp-new-test-card",
158
+ className: "xp-ui-card xp-new-test-card",
115
159
  onClick: ()=>setStep('block'),
116
160
  children: [
117
161
  /*#__PURE__*/ _jsx("strong", {
118
162
  children: C.block
119
163
  }),
120
164
  /*#__PURE__*/ _jsx("span", {
121
- children: C.blockMeaning
122
- }),
123
- surface.admin?.descriptions?.block ? /*#__PURE__*/ _jsx("span", {
124
- children: surface.admin?.descriptions?.block
125
- }) : null
165
+ children: surface.admin?.descriptions?.block?.trim() || C.blockMeaning
166
+ })
126
167
  ]
127
168
  }) : null,
128
169
  surface.pageCollections?.length ? /*#__PURE__*/ _jsxs("button", {
129
170
  type: "button",
130
- className: "xp-new-test-card",
171
+ className: "xp-ui-card xp-new-test-card",
131
172
  onClick: ()=>{
132
173
  setKind('page');
133
174
  setStep('name');
@@ -137,16 +178,13 @@ export function NewTest({ surface, pages }) {
137
178
  children: C.page
138
179
  }),
139
180
  /*#__PURE__*/ _jsx("span", {
140
- children: C.pageMeaning
141
- }),
142
- surface.admin?.descriptions?.page ? /*#__PURE__*/ _jsx("span", {
143
- children: surface.admin?.descriptions?.page
144
- }) : null
181
+ children: surface.admin?.descriptions?.page?.trim() || C.pageMeaning
182
+ })
145
183
  ]
146
184
  }) : null,
147
185
  surface.flagPoints.length > 0 ? /*#__PURE__*/ _jsxs("button", {
148
186
  type: "button",
149
- className: "xp-new-test-card",
187
+ className: "xp-ui-card xp-new-test-card",
150
188
  onClick: ()=>{
151
189
  setKind('flag');
152
190
  setStep('setting');
@@ -156,16 +194,13 @@ export function NewTest({ surface, pages }) {
156
194
  children: C.setting
157
195
  }),
158
196
  /*#__PURE__*/ _jsx("span", {
159
- children: C.settingMeaning
160
- }),
161
- surface.admin?.descriptions?.setting ? /*#__PURE__*/ _jsx("span", {
162
- children: surface.admin?.descriptions.setting
163
- }) : null
197
+ children: surface.admin?.descriptions?.setting?.trim() || C.settingMeaning
198
+ })
164
199
  ]
165
200
  }) : null
166
201
  ]
167
202
  }),
168
- pages === undefined && !surface.flagPoints.length && !surface.pageCollections?.length ? /*#__PURE__*/ _jsx("p", {
203
+ !collection && !surface.flagPoints.length && !surface.pageCollections?.length ? /*#__PURE__*/ _jsx("p", {
169
204
  children: C.unavailable
170
205
  }) : null
171
206
  ]
@@ -174,41 +209,68 @@ export function NewTest({ surface, pages }) {
174
209
  /*#__PURE__*/ _jsx("h2", {
175
210
  children: C.block
176
211
  }),
177
- /*#__PURE__*/ _jsx("p", {
178
- children: C.handoff
179
- }),
180
- !pages?.length ? /*#__PURE__*/ _jsx("p", {
181
- children: C.noPages
182
- }) : collections.map((collection)=>{
183
- const group = pages.filter((page)=>page.collection === collection);
184
- return /*#__PURE__*/ _jsxs("section", {
185
- children: [
186
- /*#__PURE__*/ _jsx("h2", {
187
- children: group[0].collectionLabel
188
- }),
189
- /*#__PURE__*/ _jsx("ul", {
190
- children: group.map((page)=>/*#__PURE__*/ _jsxs("li", {
191
- children: [
192
- /*#__PURE__*/ _jsx("span", {
193
- children: page.title
194
- }),
195
- ' ',
196
- /*#__PURE__*/ _jsx("a", {
197
- href: page.editorUrl,
198
- children: C.open
199
- }),
200
- page.editor === 'blocks' ? /*#__PURE__*/ _jsx("p", {
201
- children: C.blocksHandoff
202
- }) : null
203
- ]
204
- }, `${typeof page.id}:${page.id}`))
205
- }),
206
- group.length === 50 ? /*#__PURE__*/ _jsx("p", {
207
- children: C.recentPages
208
- }) : null
209
- ]
210
- }, collection);
211
- })
212
+ collection ? /*#__PURE__*/ _jsxs(_Fragment, {
213
+ children: [
214
+ blockPageCollections.length > 1 ? /*#__PURE__*/ _jsx("div", {
215
+ className: "xp-new-test-collection",
216
+ children: /*#__PURE__*/ _jsx(Select, {
217
+ id: `${id}-page-type`,
218
+ label: C.pageType,
219
+ value: collection.slug,
220
+ onChange: (event)=>setBlockCollection(event.currentTarget.value),
221
+ children: blockPageCollections.map((entry)=>/*#__PURE__*/ _jsx("option", {
222
+ value: entry.slug,
223
+ children: entry.label
224
+ }, entry.slug))
225
+ })
226
+ }) : null,
227
+ /*#__PURE__*/ _jsxs("div", {
228
+ className: "xp-new-test-help",
229
+ children: [
230
+ supportsBothEditors ? /*#__PURE__*/ _jsx("p", {
231
+ children: C.mixedEditorHandoff
232
+ }) : null,
233
+ supportsPuck ? /*#__PURE__*/ _jsxs(_Fragment, {
234
+ children: [
235
+ supportsBothEditors ? /*#__PURE__*/ _jsx("p", {
236
+ id: puckLabelId,
237
+ children: C.pagesMarked(PAGE_COPY.puckEditor)
238
+ }) : /*#__PURE__*/ _jsx("p", {
239
+ children: C.handoff
240
+ }),
241
+ /*#__PURE__*/ _jsx("ol", {
242
+ "aria-labelledby": supportsBothEditors ? puckLabelId : undefined,
243
+ children: C.handoffSteps.map((step)=>/*#__PURE__*/ _jsx("li", {
244
+ children: step
245
+ }, step))
246
+ })
247
+ ]
248
+ }) : null,
249
+ supportsBothEditors ? /*#__PURE__*/ _jsxs(_Fragment, {
250
+ children: [
251
+ /*#__PURE__*/ _jsx("p", {
252
+ id: blocksLabelId,
253
+ children: C.pagesMarked(PAGE_COPY.blocksEditor)
254
+ }),
255
+ /*#__PURE__*/ _jsx("p", {
256
+ role: "group",
257
+ "aria-labelledby": blocksLabelId,
258
+ children: C.blocksHandoff
259
+ })
260
+ ]
261
+ }) : supportsBlocks ? /*#__PURE__*/ _jsx("p", {
262
+ children: C.blocksOnlyHandoff
263
+ }) : null
264
+ ]
265
+ }),
266
+ /*#__PURE__*/ _jsx(PageCombobox, {
267
+ collection: collection,
268
+ apiRoute: surface.apiRoute,
269
+ contentLocale: surface.contentLocale,
270
+ standalone: true
271
+ })
272
+ ]
273
+ }) : null
212
274
  ]
213
275
  }) : step === 'setting' ? /*#__PURE__*/ _jsxs(_Fragment, {
214
276
  children: [
@@ -313,8 +375,8 @@ export function NewTest({ surface, pages }) {
313
375
  children: [
314
376
  C.groupsError,
315
377
  ' ',
316
- /*#__PURE__*/ _jsx("button", {
317
- type: "button",
378
+ /*#__PURE__*/ _jsx(Button, {
379
+ size: "sm",
318
380
  onClick: ()=>setLayerRetry((value)=>value + 1),
319
381
  children: C.retry
320
382
  })
@@ -324,6 +386,8 @@ export function NewTest({ surface, pages }) {
324
386
  })
325
387
  ]
326
388
  }) : /*#__PURE__*/ _jsxs("form", {
389
+ id: `${id}-details`,
390
+ className: "xp-new-test-form",
327
391
  onSubmit: (event)=>{
328
392
  event.preventDefault();
329
393
  void submit();
@@ -332,58 +396,54 @@ export function NewTest({ surface, pages }) {
332
396
  /*#__PURE__*/ _jsx("h2", {
333
397
  children: C.nameQuestion
334
398
  }),
335
- /*#__PURE__*/ _jsxs("label", {
336
- children: [
337
- C.name,
338
- /*#__PURE__*/ _jsx("input", {
339
- required: true,
340
- value: name,
341
- disabled: pending,
342
- onChange: (event)=>setName(event.currentTarget.value)
343
- })
344
- ]
399
+ /*#__PURE__*/ _jsx(TextInput, {
400
+ id: `${id}-name`,
401
+ label: C.name,
402
+ required: true,
403
+ value: name,
404
+ disabled: pending,
405
+ onChange: (event)=>setName(event.currentTarget.value)
345
406
  }),
346
- /*#__PURE__*/ _jsxs("label", {
347
- children: [
348
- C.hypothesis,
349
- /*#__PURE__*/ _jsx("textarea", {
350
- value: hypothesis,
351
- disabled: pending,
352
- onChange: (event)=>setHypothesis(event.currentTarget.value)
353
- })
354
- ]
407
+ /*#__PURE__*/ _jsx(Textarea, {
408
+ id: `${id}-hypothesis`,
409
+ label: C.hypothesis,
410
+ value: hypothesis,
411
+ disabled: pending,
412
+ onChange: (event)=>setHypothesis(event.currentTarget.value)
355
413
  }),
356
414
  error ? /*#__PURE__*/ _jsx("p", {
357
415
  role: "alert",
358
416
  children: error
359
- }) : null,
360
- /*#__PURE__*/ _jsx("button", {
361
- type: "submit",
362
- disabled: pending || !name.trim(),
363
- children: pending ? C.creating : C.createTest
364
- })
417
+ }) : null
365
418
  ]
366
419
  }),
367
420
  /*#__PURE__*/ _jsxs("div", {
368
421
  className: "xp-new-test-actions",
369
422
  children: [
370
- /*#__PURE__*/ _jsx("button", {
371
- type: "button",
423
+ /*#__PURE__*/ _jsx(Button, {
424
+ variant: "secondary",
372
425
  disabled: pending,
373
426
  onClick: ()=>{
374
427
  if (step === 'kind') router.push(surfaceUrls.home(surface.adminRoute));
375
- else {
428
+ else if (step === 'name' && kind === 'flag') {
376
429
  setError('');
377
- setStep(step === 'name' && kind === 'flag' ? 'setting' : 'kind');
378
- }
430
+ setStep('setting');
431
+ } else changeKind();
379
432
  },
380
433
  children: C.back
381
434
  }),
382
- step === 'setting' ? /*#__PURE__*/ _jsx("button", {
383
- type: "button",
435
+ step === 'setting' ? /*#__PURE__*/ _jsx(Button, {
436
+ variant: "primary",
384
437
  disabled: !point,
385
438
  onClick: ()=>setStep('name'),
386
439
  children: C.next
440
+ }) : step === 'name' ? /*#__PURE__*/ _jsx(Button, {
441
+ type: "submit",
442
+ form: `${id}-details`,
443
+ variant: "primary",
444
+ busy: pending,
445
+ disabled: !name.trim(),
446
+ children: pending ? C.creating : C.createTest
387
447
  }) : null
388
448
  ]
389
449
  })
@@ -1,7 +1,10 @@
1
+ import { type ReactNode } from 'react';
1
2
  import type { DocId } from '../../../types/contracts.js';
2
3
  import type { SurfaceProps } from '../../../testSurface/surface/contracts.js';
4
+ import './newTest.css';
3
5
  /** One session stays mounted across Collection, all page steps and Review. */
4
- export declare function PageWizard({ id, surface }: {
6
+ export declare function PageWizard({ id, surface, kindChip }: {
5
7
  id: DocId;
6
8
  surface: SurfaceProps;
9
+ kindChip?: (busy: boolean) => ReactNode;
7
10
  }): import("react").JSX.Element;