@delmaredigital/payload-experiments 0.4.0-rc.10 → 0.4.0-rc.11

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 (140) hide show
  1. package/dist/admin/MetricSourceSelect.js +10 -3
  2. package/dist/admin/copy/blocks.js +3 -3
  3. package/dist/admin/copy/goals.d.ts +15 -8
  4. package/dist/admin/copy/goals.js +18 -8
  5. package/dist/admin/copy/newTest.d.ts +3 -2
  6. package/dist/admin/copy/newTest.js +3 -2
  7. package/dist/admin/surface/SurfaceShell.d.ts +4 -2
  8. package/dist/admin/surface/SurfaceShell.js +25 -3
  9. package/dist/admin/surface/TestRowMenu.d.ts +7 -0
  10. package/dist/admin/surface/TestRowMenu.js +9 -2
  11. package/dist/admin/surface/TestsHome.js +8 -1
  12. package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
  13. package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
  14. package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
  15. package/dist/admin/surface/goals/GoalForm.js +280 -191
  16. package/dist/admin/surface/goals/GoalsList.js +102 -33
  17. package/dist/admin/surface/goals/data.d.ts +2 -0
  18. package/dist/admin/surface/goals/data.js +9 -0
  19. package/dist/admin/surface/goals/goals.css +3 -2
  20. package/dist/admin/surface/goals/goals.model.d.ts +2 -2
  21. package/dist/admin/surface/goals/goals.model.js +7 -12
  22. package/dist/admin/surface/home.model.d.ts +1 -0
  23. package/dist/admin/surface/home.model.js +5 -1
  24. package/dist/admin/surface/newTest/NewTest.js +56 -29
  25. package/dist/admin/surface/newTest/PageWizard.d.ts +3 -1
  26. package/dist/admin/surface/newTest/PageWizard.js +14 -14
  27. package/dist/admin/surface/newTest/newTest.css +3 -3
  28. package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
  29. package/dist/admin/surface/results/ResultsHeader.js +69 -41
  30. package/dist/admin/surface/surface.css +20 -1
  31. package/dist/admin/surface/test/TestPage.js +46 -34
  32. package/dist/admin/surface/useXpStepNav.d.ts +11 -0
  33. package/dist/admin/surface/useXpStepNav.js +14 -0
  34. package/dist/admin/views/TestsSurfaceClient.js +27 -3
  35. package/dist/blocks/createExperimentBlock.js +1 -1
  36. package/dist/blocks/formState.js +1 -1
  37. package/dist/collections/metrics.js +12 -5
  38. package/dist/collections/serialize.js +3 -2
  39. package/dist/db/snapshots.d.ts +1 -0
  40. package/dist/goals/sourceLabel.d.ts +2 -0
  41. package/dist/goals/sourceLabel.js +4 -0
  42. package/dist/plugin.js +51 -1
  43. package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
  44. package/dist/puck/editor/ExperimentSlotEditor.js +96 -43
  45. package/dist/puck/editor/QuickTestActions.d.ts +2 -2
  46. package/dist/puck/editor/QuickTestActions.js +42 -27
  47. package/dist/puck/editor/ResultsReadout.d.ts +3 -1
  48. package/dist/puck/editor/ResultsReadout.js +28 -16
  49. package/dist/puck/editor/VersionBuilder.d.ts +2 -1
  50. package/dist/puck/editor/VersionBuilder.js +14 -8
  51. package/dist/puck/editor/copy.d.ts +3 -3
  52. package/dist/puck/editor/copy.js +4 -4
  53. package/dist/puck/editor/editor.chrome.css +9 -1
  54. package/dist/puck/editor/editor.css +10 -1
  55. package/dist/puck/nestedTestCopy.js +1 -1
  56. package/dist/puck/slotConfig.d.ts +1 -1
  57. package/dist/puck/slotConfig.js +1 -1
  58. package/dist/results/analyse.d.ts +2 -0
  59. package/dist/results/analyse.js +2 -2
  60. package/dist/results/verdict.d.ts +1 -1
  61. package/dist/results/verdict.js +7 -6
  62. package/dist/server/runResults.js +2 -1
  63. package/dist/testSurface/PreviewLinks.d.ts +2 -1
  64. package/dist/testSurface/PreviewLinks.js +3 -3
  65. package/dist/testSurface/actions/DecideDialog.d.ts +3 -2
  66. package/dist/testSurface/actions/DecideDialog.js +21 -12
  67. package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
  68. package/dist/testSurface/actions/LifecycleAction.js +3 -1
  69. package/dist/testSurface/actions/actions.model.js +6 -5
  70. package/dist/testSurface/actions/decide.model.d.ts +1 -0
  71. package/dist/testSurface/actions/decide.model.js +1 -0
  72. package/dist/testSurface/allocation.model.js +6 -3
  73. package/dist/testSurface/copy/actions.d.ts +12 -9
  74. package/dist/testSurface/copy/actions.js +12 -9
  75. package/dist/testSurface/copy/advanced.d.ts +10 -0
  76. package/dist/testSurface/copy/advanced.js +10 -0
  77. package/dist/testSurface/copy/arms.d.ts +1 -1
  78. package/dist/testSurface/copy/arms.js +1 -1
  79. package/dist/testSurface/copy/audience.d.ts +4 -3
  80. package/dist/testSurface/copy/audience.js +5 -4
  81. package/dist/testSurface/copy/common.d.ts +2 -2
  82. package/dist/testSurface/copy/common.js +2 -2
  83. package/dist/testSurface/copy/metrics.d.ts +6 -0
  84. package/dist/testSurface/copy/metrics.js +8 -0
  85. package/dist/testSurface/copy/readiness.d.ts +3 -3
  86. package/dist/testSurface/copy/readiness.js +5 -5
  87. package/dist/testSurface/copy/recommendation.d.ts +4 -4
  88. package/dist/testSurface/copy/recommendation.js +4 -4
  89. package/dist/testSurface/copy/results.d.ts +13 -9
  90. package/dist/testSurface/copy/results.js +15 -9
  91. package/dist/testSurface/copy/review.d.ts +12 -9
  92. package/dist/testSurface/copy/review.js +13 -9
  93. package/dist/testSurface/copy/setting.d.ts +1 -2
  94. package/dist/testSurface/copy/setting.js +1 -2
  95. package/dist/testSurface/copy/surface.js +1 -1
  96. package/dist/testSurface/copy/testPage.d.ts +13 -9
  97. package/dist/testSurface/copy/testPage.js +16 -13
  98. package/dist/testSurface/format/date.d.ts +1 -0
  99. package/dist/testSurface/format/date.js +11 -0
  100. package/dist/testSurface/labels.d.ts +1 -2
  101. package/dist/testSurface/labels.js +2 -3
  102. package/dist/testSurface/lockedNotice.model.d.ts +2 -0
  103. package/dist/testSurface/lockedNotice.model.js +31 -0
  104. package/dist/testSurface/results/results.model.d.ts +3 -2
  105. package/dist/testSurface/results/results.model.js +10 -9
  106. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
  107. package/dist/testSurface/surface/pageBlock/parts.js +17 -7
  108. package/dist/testSurface/surface/pagePicker/PageCombobox.js +0 -5
  109. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +1 -1
  110. package/dist/testSurface/surface/readiness/ActionDialogs.js +54 -33
  111. package/dist/testSurface/surface/readiness/Banner.d.ts +3 -1
  112. package/dist/testSurface/surface/readiness/Banner.js +86 -75
  113. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
  114. package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
  115. package/dist/testSurface/surface/readiness/readiness.model.js +1 -1
  116. package/dist/testSurface/surface/results/ResultsBody.d.ts +4 -1
  117. package/dist/testSurface/surface/results/ResultsBody.js +119 -80
  118. package/dist/testSurface/surface/results/recommendation.model.js +3 -3
  119. package/dist/testSurface/surface/setting/parts.js +31 -28
  120. package/dist/testSurface/surface/setting/setting.css +2 -1
  121. package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
  122. package/dist/testSurface/surface/test/GoalSection.js +11 -11
  123. package/dist/testSurface/surface/test/LengthSection.js +20 -13
  124. package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
  125. package/dist/testSurface/surface/test/PageHoldout.js +7 -7
  126. package/dist/testSurface/surface/test/ReadinessBar.d.ts +1 -1
  127. package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
  128. package/dist/testSurface/surface/test/Section.js +8 -0
  129. package/dist/testSurface/surface/test/TargetingSection.js +7 -2
  130. package/dist/testSurface/surface/test/VersionsSection.js +88 -68
  131. package/dist/testSurface/surface/test/fields.d.ts +4 -3
  132. package/dist/testSurface/surface/test/fields.js +10 -16
  133. package/dist/testSurface/surface/test/pageParts.js +3 -1
  134. package/dist/testSurface/surface/test/testPage.css +9 -1
  135. package/dist/testSurface/surfaceUrls.d.ts +1 -0
  136. package/dist/testSurface/surfaceUrls.js +4 -0
  137. package/dist/ui/Dialog.js +25 -0
  138. package/dist/ui/Inputs.js +0 -1
  139. package/dist/ui/ui.css +1 -0
  140. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { READINESS_COPY, placementUncheckedCopy, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
2
2
  import { armLabel, phaseKindLabel, verdictCodeLabel } from '../labels.js';
3
- import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal } from '../copy/results.js';
3
+ import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal, verdictControlCopy } from '../copy/results.js';
4
4
  import { formatCI, formatCount, formatMetric, formatPercent, formatProbability } from './format.js';
5
5
  import { legacyMinimum, legacyRolloutLine, legacyTooFew } from './legacy.js';
6
6
  import { isLegacySnapshot } from './snapshot.js';
@@ -15,16 +15,17 @@ export function roundOptions(phases) {
15
15
  label: roundLabel(phase.phase, phaseKindLabel(phase.phaseKind))
16
16
  }));
17
17
  }
18
- export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel }) {
18
+ export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel, controlLabel }) {
19
+ const copy = (text)=>controlLabel ? verdictControlCopy(text, controlLabel) : text;
19
20
  if (isDecidedTestRound) return {
20
21
  title: decidedTitle(winnerLabel),
21
- finding: decisionSnapshot?.verdict.finding ?? null,
22
- detail: decisionSnapshot?.verdict.detail ?? null
22
+ finding: decisionSnapshot ? copy(decisionSnapshot.verdict.finding) : null,
23
+ detail: decisionSnapshot ? copy(decisionSnapshot.verdict.detail) : null
23
24
  };
24
25
  const { headline, detail, guardrailLine } = snapshot.verdict;
25
26
  return {
26
- headline,
27
- detail,
27
+ headline: copy(headline),
28
+ detail: copy(detail),
28
29
  ...guardrailLine === undefined ? {} : {
29
30
  guardrailLine
30
31
  }
@@ -76,7 +77,7 @@ export function armRows({ snapshot, phase, metricId }) {
76
77
  };
77
78
  if (group.kind === 'control' && snapshot.phaseKind === 'test') return {
78
79
  ...row,
79
- baseline: RESULTS_COPY.original
80
+ baseline: group.label
80
81
  };
81
82
  const comparison = metric?.comparisons.find((comparison)=>comparison.arm === group.key);
82
83
  if (!comparison) return row;
@@ -194,6 +195,6 @@ export function dataQuality(snapshot, ctx = {}) {
194
195
  });
195
196
  return items;
196
197
  }
197
- export function verdictLabel(snapshot) {
198
- return verdictCodeLabel(snapshot.verdict.code);
198
+ export function verdictLabel(snapshot, controlLabel) {
199
+ return verdictCodeLabel(snapshot.verdict.code, controlLabel);
199
200
  }
@@ -1,7 +1,7 @@
1
1
  import { TEST_PAGE as C } from '../../copy/testPage.js';
2
2
  import { placementLabel } from '../../placementLabel.js';
3
3
  export function placementLine(placement) {
4
- return `${C.onPage} ${placementLabel(placement, true)}`;
4
+ return `${C.onPage} ${placementLabel(placement, false)}`;
5
5
  }
6
6
  export function slotReady(placement, arm) {
7
7
  const slot = arm.kind === 'holdout' ? 'control' : arm.key;
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Banner } from '../../../ui/Banner.js';
4
+ import { holdoutContent } from '../../copy/audience.js';
5
+ import { actionGroupLabel } from '../../actions/actions.model.js';
4
6
  import { Button } from '../../../ui/Button.js';
5
7
  import { placementPages } from '../../../lib/placementPages.js';
6
8
  import { TEST_PAGE as C, placementCount } from '../../copy/testPage.js';
@@ -22,14 +24,21 @@ function Binding({ test, surface }) {
22
24
  ]
23
25
  }) : null : placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
24
26
  children: [
25
- pages.map((placement)=>/*#__PURE__*/ _jsxs("p", {
26
- className: "xp-ui-button-group",
27
+ pages.map((placement)=>/*#__PURE__*/ _jsxs("div", {
28
+ className: "xp-page-binding-row xp-ui-button-group",
27
29
  children: [
28
- placementLine(placement),
29
- placement.slotCount > 1 ? placementCount(placement.slotCount) : null,
30
- ' ',
30
+ /*#__PURE__*/ _jsxs("span", {
31
+ children: [
32
+ placementLine(placement),
33
+ placement.slotCount > 1 ? placementCount(placement.slotCount) : null
34
+ ]
35
+ }),
36
+ /*#__PURE__*/ _jsx("span", {
37
+ className: "xp-content-chip",
38
+ children: placement.detail === 'Published' ? C.published : C.draft
39
+ }),
31
40
  placement.editorUrl ? /*#__PURE__*/ _jsx(Button, {
32
- variant: "link",
41
+ variant: "secondary",
33
42
  size: "sm",
34
43
  href: placement.editorUrl,
35
44
  "aria-label": pages.length > 1 ? `${C.openPage}: ${placementLabel(placement, true)}` : undefined,
@@ -38,6 +47,7 @@ function Binding({ test, surface }) {
38
47
  ]
39
48
  }, placement.key)),
40
49
  /*#__PURE__*/ _jsx("p", {
50
+ className: "xp-ui-help",
41
51
  children: C.editedOnPage
42
52
  })
43
53
  ]
@@ -51,7 +61,7 @@ function VersionContent({ test, surface, armIndex, summary }) {
51
61
  if (!arm) return null;
52
62
  if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
53
63
  className: "xp-content-chip",
54
- children: C.holdoutContent
64
+ children: holdoutContent(actionGroupLabel('control', test.doc?.arms.find((arm)=>arm.key === 'control')?.label))
55
65
  });
56
66
  const placements = test.preflight?.placements ?? [];
57
67
  const pages = placementPages(placements);
@@ -316,7 +316,6 @@ function RowDetails({ row, reason, editor, now }) {
316
316
  value: open ? search : value,
317
317
  readOnly: blocked,
318
318
  "aria-disabled": blocked || undefined,
319
- "aria-describedby": locked ? `${id}-lock` : undefined,
320
319
  onClick: ()=>show(),
321
320
  onPaste: (event)=>{
322
321
  if (blocked || open) return;
@@ -374,10 +373,6 @@ function RowDetails({ row, reason, editor, now }) {
374
373
  }
375
374
  }
376
375
  }),
377
- locked ? /*#__PURE__*/ _jsx("p", {
378
- id: `${id}-lock`,
379
- children: locked
380
- }) : null,
381
376
  visible ? /*#__PURE__*/ _jsxs("div", {
382
377
  className: "xp-page-combobox-popup",
383
378
  children: [
@@ -14,6 +14,6 @@ export declare function ConfirmAction({ test, surface, action, winnerLabel, onCl
14
14
  }): import("react").JSX.Element;
15
15
  /** AllocateDialog's validation and copy, with data supplied by the test document. */
16
16
  export declare function AllocateAction({ test, surface, onClose }: Props): import("react").JSX.Element;
17
- /** AddMetricDialog adapter; the primary goal is deliberately absent from the role picker. */
17
+ /** AddMetricDialog adapter; the current round’s main goal is fixed. */
18
18
  export declare function AddMetricAction({ test, surface, onClose }: Props): import("react").JSX.Element;
19
19
  export {};
@@ -17,6 +17,8 @@ import { API_MESSAGES, refusalMessage } from '../../copy/common.js';
17
17
  import { createApi } from '../../api.js';
18
18
  import { blockingSteps, pageReadinessContext, readinessCaveats } from './readiness.model.js';
19
19
  import { actionWaitMessage } from './SaveStatus.js';
20
+ import { surfaceUrls } from '../../surfaceUrls.js';
21
+ import { Button } from '../../../ui/Button.js';
20
22
  import { useTransition } from './useTransition.js';
21
23
  export function dialogTitle(label, test) {
22
24
  return test.doc?.name ? actionTitle(label, test.doc.name) : label;
@@ -212,7 +214,7 @@ export function dialogTitle(label, test) {
212
214
  ]
213
215
  });
214
216
  }
215
- /** AddMetricDialog adapter; the primary goal is deliberately absent from the role picker. */ export function AddMetricAction({ test, surface, onClose }) {
217
+ /** AddMetricDialog adapter; the current round’s main goal is fixed. */ export function AddMetricAction({ test, surface, onClose }) {
216
218
  const [openedPhase] = useState(test.doc?.phase);
217
219
  const [metrics, setMetrics] = useState([]);
218
220
  const [loading, setLoading] = useState(true);
@@ -252,6 +254,7 @@ export function dialogTitle(label, test) {
252
254
  ...test.doc?.metrics?.guardrails ?? []
253
255
  ].filter((id)=>id != null).map(String));
254
256
  const available = metrics.filter((item)=>!attached.has(String(item.id)));
257
+ const empty = !loading && !loadError && !available.length;
255
258
  const selected = available.find((item)=>String(item.id) === metric);
256
259
  const changed = test.doc?.status !== 'running' || test.doc?.phase !== openedPhase;
257
260
  const disabled = transition.busy || test.statusReadPending || changed || transition.reloadRequired && transition.error !== API_MESSAGES.goalNotFound;
@@ -261,14 +264,14 @@ export function dialogTitle(label, test) {
261
264
  transition.refreshAfterDismissal();
262
265
  }
263
266
  return /*#__PURE__*/ _jsx(ConfirmDialog, {
264
- title: dialogTitle(A.titleLead['add-metric'], test),
265
- description: warnings ? undefined : C.addMetric,
267
+ title: C.addGoal,
268
+ description: warnings || empty ? undefined : C.addMetric,
266
269
  onClose: close,
267
270
  busy: transition.busy,
268
271
  busyLabel: C.changing,
269
272
  cancelLabel: warnings ? A.done : A.cancel,
270
273
  error: warnings ? undefined : loadError ?? transition.error ?? (changed ? A.actionChanged : null),
271
- confirm: warnings ? undefined : {
274
+ confirm: warnings || empty ? undefined : {
272
275
  label: C.addGoal,
273
276
  disabled: disabled || loading || !!loadError || !selected,
274
277
  onClick: ()=>{
@@ -305,43 +308,61 @@ export function dialogTitle(label, test) {
305
308
  role: "status",
306
309
  children: R.loadingMetrics
307
310
  }) : null,
308
- /*#__PURE__*/ _jsxs(Select, {
309
- id: "xp-add-goal-role",
310
- label: R.role,
311
- value: role,
312
- disabled: disabled,
313
- onChange: (event)=>setRole(event.target.value),
311
+ empty ? /*#__PURE__*/ _jsxs(_Fragment, {
314
312
  children: [
315
- /*#__PURE__*/ _jsx("option", {
316
- value: "secondary",
317
- children: R.supporting
313
+ /*#__PURE__*/ _jsx("p", {
314
+ children: metrics.length ? R.allMetricsAttached : R.noMetrics
318
315
  }),
319
- /*#__PURE__*/ _jsx("option", {
320
- value: "guardrail",
321
- children: R.guardrail
316
+ /*#__PURE__*/ _jsx(Button, {
317
+ href: surfaceUrls.newGoal(surface.adminRoute, {
318
+ return: test.doc ? String(test.doc.id) : undefined
319
+ }),
320
+ children: R.createGoal
322
321
  })
323
322
  ]
324
- }),
325
- /*#__PURE__*/ _jsxs(Select, {
326
- id: "xp-add-goal-metric",
327
- label: R.metric,
328
- value: metric,
329
- disabled: disabled || loading,
330
- onChange: (event)=>setMetric(event.target.value),
323
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
331
324
  children: [
332
- /*#__PURE__*/ _jsx("option", {
333
- value: "",
334
- children: R.chooseMetric
325
+ /*#__PURE__*/ _jsxs(Select, {
326
+ id: "xp-add-goal-metric",
327
+ label: R.metric,
328
+ value: metric,
329
+ disabled: disabled || loading,
330
+ onChange: (event)=>setMetric(event.target.value),
331
+ children: [
332
+ /*#__PURE__*/ _jsx("option", {
333
+ value: "",
334
+ children: R.chooseMetric
335
+ }),
336
+ available.map((item)=>/*#__PURE__*/ _jsx("option", {
337
+ value: String(item.id),
338
+ children: item.name
339
+ }, item.id))
340
+ ]
335
341
  }),
336
- available.map((item)=>/*#__PURE__*/ _jsx("option", {
337
- value: String(item.id),
338
- children: item.name
339
- }, item.id))
342
+ /*#__PURE__*/ _jsxs(Select, {
343
+ id: "xp-add-goal-role",
344
+ label: R.role,
345
+ value: role,
346
+ disabled: disabled,
347
+ onChange: (event)=>setRole(event.target.value),
348
+ children: [
349
+ /*#__PURE__*/ _jsx("option", {
350
+ value: "primary",
351
+ disabled: true,
352
+ children: R.primary
353
+ }),
354
+ /*#__PURE__*/ _jsx("option", {
355
+ value: "secondary",
356
+ children: R.supporting
357
+ }),
358
+ /*#__PURE__*/ _jsx("option", {
359
+ value: "guardrail",
360
+ children: R.guardrail
361
+ })
362
+ ]
363
+ })
340
364
  ]
341
365
  }),
342
- !loading && !loadError && !available.length ? /*#__PURE__*/ _jsx("p", {
343
- children: R.noMetrics
344
- }) : null,
345
366
  !loading && !loadError && available.length > 0 && !selected ? /*#__PURE__*/ _jsx("p", {
346
367
  children: C.chooseGoalToAdd
347
368
  }) : null
@@ -1,4 +1,6 @@
1
+ import { type Ref } from 'react';
1
2
  import type { SectionProps } from '../contracts.js';
2
- export declare function ReadinessContent({ test, surface, resultsVersion, embedded }: SectionProps & {
3
+ export declare function ReadinessContent({ test, surface, resultsVersion, embedded, barRef }: SectionProps & {
3
4
  embedded?: boolean;
5
+ barRef?: Ref<HTMLDivElement>;
4
6
  }): import("react").JSX.Element;
@@ -1,5 +1,5 @@
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 { canStartTest, readyToStart } from '../../readinessRead.js';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { Button } from '../../../ui/Button.js';
@@ -13,7 +13,7 @@ import { daysRemaining, displayDate, blockingSteps, pageReadinessContext, errorS
13
13
  import { LifecycleButton, LifecycleDialog } from '../../actions/LifecycleAction.js';
14
14
  import { preflightPlacementLabel } from '../../placements/placementLabels.js';
15
15
  import { BlockerList } from './BlockerList.js';
16
- export function ReadinessContent({ test, surface, resultsVersion, embedded = false }) {
16
+ export function ReadinessContent({ test, surface, resultsVersion, embedded = false, barRef }) {
17
17
  const [selected, setSelected] = useState(null);
18
18
  const [audience, setAudience] = useState();
19
19
  const doc = test.doc;
@@ -98,83 +98,94 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
98
98
  'release-pages'
99
99
  ].includes(action.id)));
100
100
  const sentence = test.statusReadPending ? C.checking : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
101
- return /*#__PURE__*/ _jsxs("div", {
102
- className: `xp-readiness xp-readiness--${setup && ready && !blockers.length ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
101
+ return /*#__PURE__*/ _jsxs(_Fragment, {
103
102
  children: [
104
- readinessCaveats(test, surface.adminRoute).map(({ key, sentence, href, emphasized })=>/*#__PURE__*/ _jsxs("p", {
105
- className: emphasized ? 'xp-readiness__warning' : undefined,
103
+ /*#__PURE__*/ _jsx("div", {
104
+ ref: barRef,
105
+ className: "xp-test-readiness-bar",
106
+ role: "region",
107
+ "aria-label": C.label,
108
+ "data-dialog-background": true,
109
+ children: /*#__PURE__*/ _jsxs("div", {
110
+ className: `xp-readiness xp-readiness--${setup && ready && !blockers.length ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
106
111
  children: [
107
- emphasized ? /*#__PURE__*/ _jsx("span", {
108
- "aria-hidden": "true",
109
- children: "⚠ "
112
+ readinessCaveats(test, surface.adminRoute).map(({ key, sentence, href, emphasized })=>/*#__PURE__*/ _jsxs("p", {
113
+ className: emphasized ? 'xp-readiness__warning' : undefined,
114
+ children: [
115
+ emphasized ? /*#__PURE__*/ _jsx("span", {
116
+ "aria-hidden": "true",
117
+ children: "⚠ "
118
+ }) : null,
119
+ href ? /*#__PURE__*/ _jsx("a", {
120
+ href: href,
121
+ children: sentence
122
+ }) : sentence
123
+ ]
124
+ }, key)),
125
+ !test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
126
+ children: stoppedCopy(displayDate(doc.stoppedAt))
110
127
  }) : null,
111
- href ? /*#__PURE__*/ _jsx("a", {
112
- href: href,
113
- children: sentence
114
- }) : sentence
128
+ /*#__PURE__*/ _jsxs("div", {
129
+ className: "xp-readiness__state",
130
+ children: [
131
+ /*#__PURE__*/ _jsx(SaveStatus, {
132
+ test: test,
133
+ messageInBlockerList: setup && !!test.preflight && !test.preflightError
134
+ }),
135
+ sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
136
+ className: "xp-readiness__separator",
137
+ "aria-hidden": "true",
138
+ children: "·"
139
+ }) : null,
140
+ sentence ? /*#__PURE__*/ _jsx("p", {
141
+ role: "status",
142
+ children: sentence
143
+ }) : null,
144
+ setup ? /*#__PURE__*/ _jsx(BlockerList, {
145
+ steps: blockers,
146
+ renderSentence: (_, index)=>{
147
+ const step = blockers[index];
148
+ return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
149
+ href: `#section-${step.section}`,
150
+ onClick: (event)=>{
151
+ event.preventDefault();
152
+ if (step.section !== 'header') jumpToSection(step.section, step.arm);
153
+ },
154
+ children: step.sentence
155
+ });
156
+ }
157
+ }) : null
158
+ ]
159
+ }),
160
+ /*#__PURE__*/ _jsxs("div", {
161
+ className: "xp-readiness__actions",
162
+ children: [
163
+ setup && readinessBlockers.length > 0 && !test.preflightRead?.message && !test.statusReadPending ? /*#__PURE__*/ _jsx(Button, {
164
+ variant: "quiet",
165
+ disabled: test.preflightPending || !!selected,
166
+ onClick: ()=>{
167
+ void test.refreshPreflight(true);
168
+ },
169
+ children: C.refresh
170
+ }) : null,
171
+ actions.map((item)=>{
172
+ if (test.statusReadPending) return null;
173
+ const reason = item.id === 'start' ? startReason : item.unavailable;
174
+ return /*#__PURE__*/ _jsx(LifecycleButton, {
175
+ action: embedded && item.hint ? {
176
+ ...item,
177
+ hint: undefined
178
+ } : item,
179
+ reason: reason,
180
+ showReason: item.id !== 'start',
181
+ disabled: item.id === 'start' && !startEnabled,
182
+ onClick: ()=>setSelected(item)
183
+ }, item.id);
184
+ })
185
+ ]
186
+ })
115
187
  ]
116
- }, key)),
117
- !test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
118
- children: stoppedCopy(displayDate(doc.stoppedAt))
119
- }) : null,
120
- /*#__PURE__*/ _jsxs("div", {
121
- className: "xp-readiness__state",
122
- children: [
123
- /*#__PURE__*/ _jsx(SaveStatus, {
124
- test: test,
125
- messageInBlockerList: setup && !!test.preflight && !test.preflightError
126
- }),
127
- sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
128
- className: "xp-readiness__separator",
129
- "aria-hidden": "true",
130
- children: "·"
131
- }) : null,
132
- sentence ? /*#__PURE__*/ _jsx("p", {
133
- role: "status",
134
- children: sentence
135
- }) : null,
136
- setup ? /*#__PURE__*/ _jsx(BlockerList, {
137
- steps: blockers,
138
- renderSentence: (_, index)=>{
139
- const step = blockers[index];
140
- return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
141
- href: `#section-${step.section}`,
142
- onClick: (event)=>{
143
- event.preventDefault();
144
- if (step.section !== 'header') jumpToSection(step.section, step.arm);
145
- },
146
- children: step.sentence
147
- });
148
- }
149
- }) : null
150
- ]
151
- }),
152
- /*#__PURE__*/ _jsxs("div", {
153
- className: "xp-readiness__actions",
154
- children: [
155
- setup && readinessBlockers.length > 0 && !test.preflightRead?.message && !test.statusReadPending ? /*#__PURE__*/ _jsx(Button, {
156
- variant: "quiet",
157
- disabled: test.preflightPending || !!selected,
158
- onClick: ()=>{
159
- void test.refreshPreflight(true);
160
- },
161
- children: C.refresh
162
- }) : null,
163
- actions.map((item)=>{
164
- if (test.statusReadPending) return null;
165
- const reason = item.id === 'start' ? startReason : item.unavailable;
166
- return /*#__PURE__*/ _jsx(LifecycleButton, {
167
- action: embedded && item.hint ? {
168
- ...item,
169
- hint: undefined
170
- } : item,
171
- reason: reason,
172
- showReason: item.id !== 'start',
173
- disabled: item.id === 'start' && !startEnabled,
174
- onClick: ()=>setSelected(item)
175
- }, item.id);
176
- })
177
- ]
188
+ })
178
189
  }),
179
190
  selected ? /*#__PURE__*/ _jsx(LifecycleDialog, {
180
191
  test: test,
@@ -1,10 +1,13 @@
1
1
  import type { ActionTestApi } from '../contracts.js';
2
2
  export declare function actionWaitMessage(test: Pick<ActionTestApi, 'stale' | 'hasUnsaved' | 'saving' | 'fieldDrafts'>): string | undefined;
3
- export declare function saveStatusMessage(test: ActionTestApi): string | null;
3
+ type SaveState = Pick<ActionTestApi, 'saving' | 'hasUnsaved' | 'stale' | 'errors'>;
4
+ export declare function saveStatusMessage(test: SaveState): string | null;
4
5
  type Props = {
5
6
  test: ActionTestApi;
6
7
  messageInBlockerList?: boolean;
7
8
  };
8
9
  export declare function ReadinessReadStatus({ test, messageInBlockerList }: Props): import("react").JSX.Element;
9
- export declare function SaveStatus({ test, messageInBlockerList }: Props): import("react").JSX.Element;
10
+ export declare function SaveStatus(props: Props | {
11
+ save: SaveState;
12
+ }): import("react").JSX.Element;
10
13
  export {};
@@ -47,20 +47,21 @@ export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
47
47
  }) : null
48
48
  });
49
49
  }
50
- export function SaveStatus({ test, messageInBlockerList }) {
51
- const message = saveStatusMessage(test);
50
+ export function SaveStatus(props) {
51
+ const state = 'test' in props ? props.test : props.save;
52
+ const message = saveStatusMessage(state);
52
53
  return /*#__PURE__*/ _jsxs("div", {
53
54
  className: "xp-save-status",
54
55
  "aria-live": "polite",
55
56
  children: [
56
57
  message ? /*#__PURE__*/ _jsx("span", {
57
- role: test.saving === 'error' ? 'alert' : 'status',
58
+ role: state.saving === 'error' ? 'alert' : 'status',
58
59
  children: message
59
60
  }) : null,
60
- /*#__PURE__*/ _jsx(ReadinessReadStatus, {
61
- test: test,
62
- messageInBlockerList: messageInBlockerList
63
- })
61
+ 'test' in props ? /*#__PURE__*/ _jsx(ReadinessReadStatus, {
62
+ test: props.test,
63
+ messageInBlockerList: props.messageInBlockerList
64
+ }) : null
64
65
  ]
65
66
  });
66
67
  }
@@ -191,7 +191,7 @@ function emptyContentGuidance(detail, ctx) {
191
191
  },
192
192
  'unknown-collection': row('versions', ()=>"That page type isn't set up for tests."),
193
193
  'version-identical': {
194
- ...row('versions', (detail, ctx)=>identicalVersionCopy(text(object(detail).path, object(detail).title ? `${group(object(detail).arm, ctx)} on ${text(object(detail).title, 'this page')}` : group(object(detail).arm, ctx)))),
194
+ ...row('versions', (detail, ctx)=>identicalVersionCopy(text(object(detail).path, object(detail).title ? `${group(object(detail).arm, ctx)} on ${text(object(detail).title, 'this page')}` : group(object(detail).arm, ctx)), group('control', ctx))),
195
195
  nextStep: (detail, ctx)=>`Edit ${text(object(detail).path, group(object(detail).arm, ctx))}`
196
196
  },
197
197
  'version-same-address': {
@@ -2,9 +2,12 @@ import type { ReactNode } from 'react';
2
2
  import type { DocId } from '../../../types/contracts.js';
3
3
  import type { ResultsResponse } from '../../../types/endpoints.js';
4
4
  import type { SurfaceProps } from '../contracts.js';
5
+ import { type ActionId } from '../../actions/actions.model.js';
5
6
  export type ResultsPageParts = {
6
7
  children: ReactNode;
7
- actions: ReactNode;
8
+ roundActions: Partial<Record<ActionId, ReactNode>>;
9
+ editOnPage: ReactNode;
10
+ refresh: ReactNode;
8
11
  released: ReactNode;
9
12
  data?: ResultsResponse;
10
13
  };