@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
@@ -3,12 +3,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { SelectInput, useField } from '@payloadcms/ui';
4
4
  import { metricSourceHint, metricSourceOptions, sourceFor } from '../testSurface/metricSource.model.js';
5
5
  import { METRICS_COPY } from '../testSurface/copy/metrics.js';
6
+ import { goalSourceLabel } from '../goals/sourceLabel.js';
6
7
  export function MetricSourceSelect({ path, field, readOnly }) {
7
8
  const { value, setValue } = useField({
8
9
  path
9
10
  });
10
11
  const sources = field.admin?.custom?.sources ?? [];
11
- const hint = metricSourceHint(sourceFor(value, sources));
12
+ const source = sourceFor(value, sources);
13
+ const hint = metricSourceHint(source);
14
+ const options = metricSourceOptions(sources);
15
+ if (value && !source) options.push({
16
+ value,
17
+ label: goalSourceLabel(value)
18
+ });
12
19
  const locked = Boolean(readOnly || field.admin?.readOnly);
13
20
  return /*#__PURE__*/ _jsxs("div", {
14
21
  children: [
@@ -18,8 +25,8 @@ export function MetricSourceSelect({ path, field, readOnly }) {
18
25
  label: field.label ?? METRICS_COPY.source,
19
26
  description: field.admin?.description,
20
27
  required: field.required,
21
- options: metricSourceOptions(sources),
22
- value: sourceFor(value, sources)?.id ?? value ?? '',
28
+ options: options,
29
+ value: source?.id ?? value ?? '',
23
30
  readOnly: locked,
24
31
  onChange: (option)=>{
25
32
  if (!locked) setValue(option && !Array.isArray(option) ? option.value : null);
@@ -23,10 +23,10 @@ export const BLOCK_COPY = {
23
23
  neverDecided: 'Archived without a winner: this block shows the Original. Use Unwrap to replace it with the Original content.',
24
24
  running: "Running: visitors see different versions. Edit a version's tab to change it; the change is noted on the results.",
25
25
  stopped: 'Stopped: visitors see the Original.',
26
- archivedReplaceWhy: 'To keep the winner on this page without the test, replace the Experiment block.',
26
+ archivedReplaceWhy: 'To keep the winner on this page without the test, replace the Test block.',
27
27
  archivedReplaceSteps: [
28
28
  'Copy the winning content into ordinary page blocks.',
29
- 'Remove the Experiment block.'
29
+ 'Remove the Test block.'
30
30
  ],
31
31
  slotLabels: {
32
32
  control: 'Original',
@@ -57,7 +57,7 @@ export const blockDecidedUnwrap = {
57
57
  after: '.'
58
58
  };
59
59
  export const blockFinishedCopy = (winner, originalWon = false, emptyWinner = false)=>({
60
- before: emptyWinner ? 'Archived: the winner has no content here, so visitors see the Original. Unwrap leaves the page as visitors see it now. View the results on ' : originalWon ? `Archived: the Original won. This block shows ${winner}. Use Unwrap to keep its content without the Experiment block. View the results on ` : `Archived: this block keeps serving ${winner}, with the Original as a fallback if it is empty. View the results on `,
60
+ before: emptyWinner ? 'Archived: the winner has no content here, so visitors see the Original. Unwrap leaves the page as visitors see it now. View the results on ' : originalWon ? `Archived: the Original won. This block shows ${winner}. Use Unwrap to keep its content without the Test block. View the results on ` : `Archived: this block keeps serving ${winner}, with the Original as a fallback if it is empty. View the results on `,
61
61
  link: 'the test',
62
62
  after: '.'
63
63
  });
@@ -8,6 +8,7 @@ export declare const GOALS_COPY: {
8
8
  readonly name: "Name";
9
9
  readonly source: "Measured by";
10
10
  readonly directionColumn: "Better when";
11
+ readonly nameRequired: "Enter a name for this goal.";
11
12
  readonly direction: "Better when it goes";
12
13
  readonly increase: "More is better";
13
14
  readonly decrease: "Less is better";
@@ -25,18 +26,19 @@ export declare const GOALS_COPY: {
25
26
  readonly slugLocked: "The short name stays the same once a test uses this goal.";
26
27
  readonly sourceLocked: "What this goal measures stays the same once a test uses it.";
27
28
  readonly chooseSource: "Choose an outcome";
28
- readonly window: "Count results for (hours)";
29
+ readonly window: "Count results for (days)";
30
+ readonly windowError: "Enter a whole number of days, at least 1.";
29
31
  readonly minimum: "Minimum completions before deciding";
32
+ readonly minimumError: "Enter a number of at least 1.";
30
33
  readonly advanced: "Advanced";
31
34
  readonly capping: "Limit very large values";
32
35
  readonly capType: "Limit by";
33
- readonly capValue: "Limit value";
34
- readonly noCap: "No limit";
35
- readonly percentile: "Based on past amounts";
36
- readonly absolute: "Fixed amount";
37
- readonly capHelp: "For past amounts, enter a number such as 0.99 to limit only the largest 1%; or enter a fixed amount.";
36
+ readonly capValue: "Fixed amount";
37
+ readonly noCap: "Don't limit";
38
+ readonly absolute: "Limit to a fixed amount";
39
+ readonly fixedAmountError: "Enter an amount of zero or more.";
38
40
  readonly threshold: "Warn when it gets worse by (%)";
39
- readonly save: "Save";
41
+ readonly createGoal: "Create goal";
40
42
  readonly saving: "Saving…";
41
43
  readonly cancel: "Cancel";
42
44
  readonly remove: "Delete goal";
@@ -49,9 +51,13 @@ export declare const GOALS_COPY: {
49
51
  readonly notFound: "This goal no longer exists.";
50
52
  readonly backToTest: "Back to the test";
51
53
  readonly useGoal: "Use this goal";
52
- readonly open: "Open";
53
54
  readonly search: "Search goals";
54
55
  readonly clearSearch: "Clear search";
56
+ readonly roles: {
57
+ readonly primary: "Main goal";
58
+ readonly secondary: "Also tracked";
59
+ readonly guardrails: "Must not get worse";
60
+ };
55
61
  readonly fields: "Goal details";
56
62
  readonly deleteTitle: "Delete this goal?";
57
63
  readonly deleteBody: "This cannot be undone.";
@@ -64,3 +70,4 @@ export declare function goalInUse(count: number): string;
64
70
  export declare function goalDeleteLockedStart(count: number): string;
65
71
  export declare function goalsNoMatches(search: string): string;
66
72
  export declare function goalShowAll(count: number): string;
73
+ export declare function largestValues(quantile: string): string;
@@ -1,4 +1,5 @@
1
1
  import { CLICK_GOAL_COPY } from '../../goals/picker/copy.js';
2
+ import { percentileTail } from '../../testSurface/copy/metrics.js';
2
3
  export const GOALS_COPY = {
3
4
  slugRule: CLICK_GOAL_COPY.slugRule,
4
5
  duplicateSlug: CLICK_GOAL_COPY.duplicateSlug,
@@ -9,6 +10,7 @@ export const GOALS_COPY = {
9
10
  name: 'Name',
10
11
  source: 'Measured by',
11
12
  directionColumn: 'Better when',
13
+ nameRequired: 'Enter a name for this goal.',
12
14
  direction: 'Better when it goes',
13
15
  increase: 'More is better',
14
16
  decrease: 'Less is better',
@@ -26,18 +28,19 @@ export const GOALS_COPY = {
26
28
  slugLocked: 'The short name stays the same once a test uses this goal.',
27
29
  sourceLocked: 'What this goal measures stays the same once a test uses it.',
28
30
  chooseSource: 'Choose an outcome',
29
- window: 'Count results for (hours)',
31
+ window: 'Count results for (days)',
32
+ windowError: 'Enter a whole number of days, at least 1.',
30
33
  minimum: 'Minimum completions before deciding',
34
+ minimumError: 'Enter a number of at least 1.',
31
35
  advanced: 'Advanced',
32
36
  capping: 'Limit very large values',
33
37
  capType: 'Limit by',
34
- capValue: 'Limit value',
35
- noCap: 'No limit',
36
- percentile: 'Based on past amounts',
37
- absolute: 'Fixed amount',
38
- capHelp: 'For past amounts, enter a number such as 0.99 to limit only the largest 1%; or enter a fixed amount.',
38
+ capValue: 'Fixed amount',
39
+ noCap: "Don't limit",
40
+ absolute: 'Limit to a fixed amount',
41
+ fixedAmountError: 'Enter an amount of zero or more.',
39
42
  threshold: 'Warn when it gets worse by (%)',
40
- save: 'Save',
43
+ createGoal: 'Create goal',
41
44
  saving: 'Saving…',
42
45
  cancel: 'Cancel',
43
46
  remove: 'Delete goal',
@@ -50,9 +53,13 @@ export const GOALS_COPY = {
50
53
  notFound: 'This goal no longer exists.',
51
54
  backToTest: 'Back to the test',
52
55
  useGoal: 'Use this goal',
53
- open: 'Open',
54
56
  search: 'Search goals',
55
57
  clearSearch: 'Clear search',
58
+ roles: {
59
+ primary: 'Main goal',
60
+ secondary: 'Also tracked',
61
+ guardrails: 'Must not get worse'
62
+ },
56
63
  fields: 'Goal details',
57
64
  deleteTitle: 'Delete this goal?',
58
65
  deleteBody: 'This cannot be undone.',
@@ -75,3 +82,6 @@ export function goalsNoMatches(search) {
75
82
  export function goalShowAll(count) {
76
83
  return `Show all ${count}`;
77
84
  }
85
+ export function largestValues(quantile) {
86
+ return `Limit the largest ${percentileTail(Number(quantile))}%`;
87
+ }
@@ -16,8 +16,8 @@ export declare const NEW_TEST_COPY: {
16
16
  readonly blockMeaning: "Compare different versions of content on a page.";
17
17
  readonly settingMeaning: "Compare different choices for a setting on your site.";
18
18
  readonly unavailable: "A developer needs to set up pages or settings before you can create a test.";
19
- readonly handoff: "Set up a Puck block test from its page so you can place it on the canvas.";
20
- readonly handoffSteps: readonly ["Add an Experiment block in Puck.", "Choose Set up test in the sidebar."];
19
+ readonly handoff: "Open the page you want to test, then follow these steps in the editor.";
20
+ readonly handoffSteps: readonly ["Add a Test block to the page.", "Choose Set up test in the sidebar."];
21
21
  readonly chooseSetting: "Which setting do you want to test?";
22
22
  readonly people: "Count people as:";
23
23
  readonly visitors: "Visitors";
@@ -34,6 +34,7 @@ export declare const NEW_TEST_COPY: {
34
34
  readonly name: "Name";
35
35
  readonly hypothesis: "Why are you testing this? (optional)";
36
36
  readonly back: "Back";
37
+ readonly change: "Change";
37
38
  readonly next: "Next";
38
39
  readonly createTest: "Create";
39
40
  readonly creating: "Creating…";
@@ -16,9 +16,9 @@ export const NEW_TEST_COPY = {
16
16
  blockMeaning: 'Compare different versions of content on a page.',
17
17
  settingMeaning: 'Compare different choices for a setting on your site.',
18
18
  unavailable: 'A developer needs to set up pages or settings before you can create a test.',
19
- handoff: 'Set up a Puck block test from its page so you can place it on the canvas.',
19
+ handoff: 'Open the page you want to test, then follow these steps in the editor.',
20
20
  handoffSteps: [
21
- 'Add an Experiment block in Puck.',
21
+ 'Add a Test block to the page.',
22
22
  'Choose Set up test in the sidebar.'
23
23
  ],
24
24
  chooseSetting: 'Which setting do you want to test?',
@@ -37,6 +37,7 @@ export const NEW_TEST_COPY = {
37
37
  name: 'Name',
38
38
  hypothesis: 'Why are you testing this? (optional)',
39
39
  back: 'Back',
40
+ change: 'Change',
40
41
  next: 'Next',
41
42
  createTest: 'Create',
42
43
  creating: 'Creating…',
@@ -1,5 +1,5 @@
1
1
  import '../theme.css';
2
- import type { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import './surface.css';
4
4
  export interface SurfaceShellProps {
5
5
  adminRoute: string;
@@ -12,5 +12,7 @@ export interface SurfaceShellProps {
12
12
  status?: ReactNode;
13
13
  actions?: ReactNode;
14
14
  subtitle?: ReactNode;
15
+ className?: string;
16
+ dynamicTitle?: boolean;
15
17
  }
16
- export declare function SurfaceShell({ adminRoute, children, crumbs, title, status, actions, subtitle }: SurfaceShellProps): import("react").JSX.Element;
18
+ export declare function SurfaceShell({ adminRoute, children, crumbs, title, status, actions, subtitle, className, dynamicTitle }: SurfaceShellProps): import("react").JSX.Element;
@@ -1,18 +1,40 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import '../theme.css';
4
+ import { useContext, useEffect } from 'react';
4
5
  import { formatAdminURL } from 'payload/shared';
5
6
  import { Breadcrumb } from '../../ui/Breadcrumb.js';
6
7
  import { Button } from '../../ui/Button.js';
7
8
  import { SURFACE_COPY } from '../../testSurface/copy/surface.js';
9
+ import { XpStepNavContext } from './useXpStepNav.js';
8
10
  import './surface.css';
9
11
  export function SurfaceShell({ adminRoute, children, crumbs = [
10
12
  {
11
13
  label: SURFACE_COPY.title
12
14
  }
13
- ], title = SURFACE_COPY.title, status, actions, subtitle }) {
15
+ ], title = SURFACE_COPY.title, status, actions, subtitle, className, dynamicTitle = false }) {
16
+ const stepNav = useContext(XpStepNavContext);
17
+ const route = stepNav?.route;
18
+ const items = stepNav?.items.length && route !== 'home' && route !== 'goals' ? stepNav.items.map(({ label, url })=>({
19
+ label,
20
+ href: url
21
+ })) : crumbs;
22
+ // Custom view metadata is static in Payload 3. Use the name already loaded by the screen.
23
+ useEffect(()=>{
24
+ if (!dynamicTitle && route !== 'goal') return;
25
+ const previous = document.title;
26
+ const next = `${title} · ${SURFACE_COPY.title}`;
27
+ document.title = next;
28
+ return ()=>{
29
+ if (document.title === next) document.title = previous;
30
+ };
31
+ }, [
32
+ title,
33
+ dynamicTitle,
34
+ route
35
+ ]);
14
36
  return /*#__PURE__*/ _jsxs("div", {
15
- className: "xp-tests-surface xp-test-surface",
37
+ className: `xp-tests-surface xp-test-surface${className ? ` ${className}` : ''}`,
16
38
  "data-dialog-focus-scope": true,
17
39
  children: [
18
40
  /*#__PURE__*/ _jsxs("header", {
@@ -22,7 +44,7 @@ export function SurfaceShell({ adminRoute, children, crumbs = [
22
44
  className: "xp-tests-container xp-tests-shell-top",
23
45
  children: [
24
46
  /*#__PURE__*/ _jsx(Breadcrumb, {
25
- items: crumbs
47
+ items: items
26
48
  }),
27
49
  /*#__PURE__*/ _jsx(Button, {
28
50
  variant: "quiet",
@@ -4,3 +4,10 @@ export declare function TestRowMenu({ name, actions, onSelect }: {
4
4
  actions: ExperimentAction[];
5
5
  onSelect: (action: ExperimentAction) => void;
6
6
  }): import("react").JSX.Element;
7
+ export declare function RowMenu<T extends Pick<ExperimentAction, 'label' | 'tone' | 'unavailable' | 'hint'> & {
8
+ id: string;
9
+ }>({ label, actions, onSelect, }: {
10
+ label: string;
11
+ actions: T[];
12
+ onSelect: (action: T) => void;
13
+ }): import("react").JSX.Element;
@@ -4,6 +4,13 @@ import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { Button } from '../../ui/Button.js';
5
5
  import { actionsForTest } from '../../testSurface/copy/actions.js';
6
6
  export function TestRowMenu({ name, actions, onSelect }) {
7
+ return /*#__PURE__*/ _jsx(RowMenu, {
8
+ label: actionsForTest(name),
9
+ actions: actions,
10
+ onSelect: onSelect
11
+ });
12
+ }
13
+ export function RowMenu({ label, actions, onSelect }) {
7
14
  const root = useRef(null);
8
15
  const menu = useRef(null);
9
16
  const triggerId = useId();
@@ -49,7 +56,7 @@ export function TestRowMenu({ name, actions, onSelect }) {
49
56
  className: "xp-tests-row-menu-trigger",
50
57
  variant: "quiet",
51
58
  size: "sm",
52
- "aria-label": actionsForTest(name),
59
+ "aria-label": label,
53
60
  "aria-haspopup": "menu",
54
61
  "aria-expanded": open,
55
62
  "aria-controls": open ? menuId : undefined,
@@ -131,7 +138,7 @@ export function TestRowMenu({ name, actions, onSelect }) {
131
138
  tabIndex: -1,
132
139
  "aria-label": action.label,
133
140
  "aria-disabled": action.unavailable ? true : undefined,
134
- className: `xp-tests-menu-item${action.tone === 'danger' ? ' xp-tests-menu-item--danger' : ''}`,
141
+ className: `xp-tests-menu-item${action.tone === 'secondary' ? '' : ` xp-tests-menu-item--${action.tone}`}`,
135
142
  "aria-describedby": detail ? detailId : undefined,
136
143
  onClick: ()=>{
137
144
  if (action.unavailable) return;
@@ -17,6 +17,7 @@ import { sanitizeReadinessDetail } from '../../sanitizeReadinessDetail.js';
17
17
  import { groupTests, homeCard } from './home.model.js';
18
18
  import { availableActions } from '../../testSurface/actions/actions.model.js';
19
19
  import { LifecycleDialog } from '../../testSurface/actions/LifecycleAction.js';
20
+ import { useXpStepNav } from './useXpStepNav.js';
20
21
  import { TestRowMenu } from './TestRowMenu.js';
21
22
  import { useTestDocument } from '../../testSurface/surface/useTestDocument.js';
22
23
  import { ConfirmDialog } from '../../ui/Dialog.js';
@@ -35,13 +36,19 @@ const HOME_FIELDS = [
35
36
  'flagPoint',
36
37
  'updatedAt',
37
38
  'phase',
38
- 'allocation'
39
+ 'allocation',
40
+ 'startedAt'
39
41
  ];
40
42
  // Typecheck fails if HomeTest gains a field the list request does not select (Payload always returns id).
41
43
  const homeFieldsComplete = true;
42
44
  void homeFieldsComplete;
43
45
  const HOME_SELECT = HOME_FIELDS.map((field)=>`select[${field}]=true`).join('&');
44
46
  export function TestsHome({ adminRoute, apiRoute, contentLocale, canManage = false, canReadResults = true, crumbs, flagPoints }) {
47
+ useXpStepNav([
48
+ {
49
+ label: SURFACE_COPY.title
50
+ }
51
+ ]);
45
52
  const api = useMemo(()=>createApi(apiRoute), [
46
53
  apiRoute
47
54
  ]);
@@ -0,0 +1,7 @@
1
+ import type { Goal } from './goals.model.js';
2
+ export declare function DeleteGoalDialog({ goal, apiRoute, onClose, onDeleted }: {
3
+ goal: Goal;
4
+ apiRoute: string;
5
+ onClose(): void;
6
+ onDeleted(): void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRef, useState } from 'react';
4
+ import { ConfirmDialog } from '../../../ui/Dialog.js';
5
+ import { actionTitle } from '../../../testSurface/copy/actions.js';
6
+ import { GOALS_COPY as C } from '../../copy/goals.js';
7
+ import { deleteGoal } from './data.js';
8
+ export function DeleteGoalDialog({ goal, apiRoute, onClose, onDeleted }) {
9
+ const [busy, setBusy] = useState(false);
10
+ const [error, setError] = useState();
11
+ const inFlight = useRef(false);
12
+ async function remove() {
13
+ if (inFlight.current) return;
14
+ inFlight.current = true;
15
+ setBusy(true);
16
+ setError(undefined);
17
+ try {
18
+ await deleteGoal(apiRoute, goal.id);
19
+ onDeleted();
20
+ } catch (cause) {
21
+ setError(cause instanceof Error ? cause.message : C.deleteError);
22
+ inFlight.current = false;
23
+ setBusy(false);
24
+ }
25
+ }
26
+ return /*#__PURE__*/ _jsx(ConfirmDialog, {
27
+ open: true,
28
+ title: actionTitle(C.confirmDelete, goal.name),
29
+ onClose: onClose,
30
+ cancelLabel: C.cancel,
31
+ busy: busy,
32
+ busyLabel: C.deleting,
33
+ description: C.deleteBody,
34
+ error: error,
35
+ confirm: {
36
+ label: C.confirmDelete,
37
+ destructive: true,
38
+ disabled: busy,
39
+ onClick: remove
40
+ }
41
+ });
42
+ }
@@ -1,4 +1,5 @@
1
1
  import type { SurfaceProps } from '../../../testSurface/surface/contracts.js';
2
+ import '../../../ui/ui.css';
2
3
  import './goals.css';
3
4
  export declare function GoalForm({ surface, id, returnToTest }: {
4
5
  surface: SurfaceProps;