@delmaredigital/payload-experiments 0.5.2 → 0.5.4

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 (34) hide show
  1. package/dist/admin/paths.d.ts +0 -4
  2. package/dist/admin/paths.js +0 -4
  3. package/dist/admin/surface/newTest/PageWizard.d.ts +1 -0
  4. package/dist/admin/surface/newTest/PageWizard.js +15 -8
  5. package/dist/admin/surface/newTest/newTest.css +4 -0
  6. package/dist/admin/theme.css +0 -2
  7. package/dist/exports/adminClient.d.ts +0 -2
  8. package/dist/exports/adminClient.js +0 -2
  9. package/dist/exports/adminRsc.d.ts +0 -2
  10. package/dist/exports/adminRsc.js +0 -2
  11. package/dist/puck/editor/editor.css +0 -6
  12. package/dist/schedule/activeTime.d.ts +1 -1
  13. package/dist/schedule/activeTime.js +2 -2
  14. package/dist/testSurface/copy/surface.d.ts +0 -3
  15. package/dist/testSurface/copy/surface.js +0 -3
  16. package/dist/testSurface/copy/testPage.d.ts +1 -0
  17. package/dist/testSurface/copy/testPage.js +1 -0
  18. package/dist/testSurface/surface/readiness/SaveStatus.js +1 -1
  19. package/dist/testSurface/surface/test/CohortRuleEditor.js +4 -3
  20. package/dist/testSurface/surface/test/GoalSection.js +7 -8
  21. package/dist/testSurface/surface/test/LengthSection.js +3 -5
  22. package/dist/testSurface/surface/test/PageHoldout.js +1 -0
  23. package/dist/testSurface/surface/test/ScheduleDateInput.js +1 -1
  24. package/dist/testSurface/surface/test/testPage.css +26 -6
  25. package/package.json +2 -2
  26. package/dist/admin/TestsDashboardCards.d.ts +0 -4
  27. package/dist/admin/TestsDashboardCards.js +0 -48
  28. package/dist/admin/TestsNavLink.d.ts +0 -6
  29. package/dist/admin/TestsNavLink.js +0 -68
  30. package/dist/admin/dashboard.css +0 -35
  31. package/dist/admin/views/CollectionListRedirect.d.ts +0 -3
  32. package/dist/admin/views/CollectionListRedirect.js +0 -8
  33. package/dist/admin/views/TestsNavLinkServer.d.ts +0 -3
  34. package/dist/admin/views/TestsNavLinkServer.js +0 -43
@@ -2,12 +2,8 @@ export declare const XP_METRIC_SOURCE_SELECT = "@delmaredigital/payload-experime
2
2
  export declare const XP_LAYER_USAGE = "@delmaredigital/payload-experiments/admin/client#LayerUsage";
3
3
  export declare const XP_ARM_SELECT = "@delmaredigital/payload-experiments/admin/client#ArmSelectField";
4
4
  export declare const XP_TESTS_VIEW = "@delmaredigital/payload-experiments/admin/rsc#ExperimentsRootView";
5
- export declare const XP_TESTS_LIST_REDIRECT = "@delmaredigital/payload-experiments/admin/rsc#CollectionListRedirect";
6
5
  export declare const XP_TEST_EDIT_REDIRECT = "@delmaredigital/payload-experiments/admin/rsc#CollectionEditRedirect";
7
- export declare const XP_TESTS_NAV_LINK = "@delmaredigital/payload-experiments/admin/rsc#TestsNavLinkServer";
8
- export declare const XP_TESTS_NAV_CLIENT = "@delmaredigital/payload-experiments/admin/client#TestsNavLink";
9
6
  export declare const XP_TESTS_SURFACE = "@delmaredigital/payload-experiments/admin/client#TestsSurface";
10
- export declare const XP_TESTS_DASHBOARD_CARDS = "@delmaredigital/payload-experiments/admin/client#TestsDashboardCards";
11
7
  export declare const XP_PLACEMENT_STATUS = "@delmaredigital/payload-experiments/admin/client#PlacementStatus";
12
8
  export declare const XP_TEST_BLOCK = "@delmaredigital/payload-experiments/admin/client#TestBlockField";
13
9
  export declare const XP_BLOCK_STATUS = "@delmaredigital/payload-experiments/admin/client#BlockStatusField";
@@ -2,12 +2,8 @@ export const XP_METRIC_SOURCE_SELECT = '@delmaredigital/payload-experiments/admi
2
2
  export const XP_LAYER_USAGE = '@delmaredigital/payload-experiments/admin/client#LayerUsage';
3
3
  export const XP_ARM_SELECT = '@delmaredigital/payload-experiments/admin/client#ArmSelectField';
4
4
  export const XP_TESTS_VIEW = '@delmaredigital/payload-experiments/admin/rsc#ExperimentsRootView';
5
- export const XP_TESTS_LIST_REDIRECT = '@delmaredigital/payload-experiments/admin/rsc#CollectionListRedirect';
6
5
  export const XP_TEST_EDIT_REDIRECT = '@delmaredigital/payload-experiments/admin/rsc#CollectionEditRedirect';
7
- export const XP_TESTS_NAV_LINK = '@delmaredigital/payload-experiments/admin/rsc#TestsNavLinkServer';
8
- export const XP_TESTS_NAV_CLIENT = '@delmaredigital/payload-experiments/admin/client#TestsNavLink';
9
6
  export const XP_TESTS_SURFACE = '@delmaredigital/payload-experiments/admin/client#TestsSurface';
10
- export const XP_TESTS_DASHBOARD_CARDS = '@delmaredigital/payload-experiments/admin/client#TestsDashboardCards';
11
7
  export const XP_PLACEMENT_STATUS = '@delmaredigital/payload-experiments/admin/client#PlacementStatus';
12
8
  export const XP_TEST_BLOCK = '@delmaredigital/payload-experiments/admin/client#TestBlockField';
13
9
  export const XP_BLOCK_STATUS = '@delmaredigital/payload-experiments/admin/client#BlockStatusField';
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { DocId } from '../../../types/contracts.js';
3
3
  import type { SurfaceProps } from '../../../testSurface/surface/contracts.js';
4
+ import '../../../testSurface/surface/test/testPage.css';
4
5
  import './newTest.css';
5
6
  /** One session stays mounted across Collection, all page steps and Review. */
6
7
  export declare function PageWizard({ id, surface, kindChip }: {
@@ -24,6 +24,7 @@ import { LifecycleDialog } from '../../../testSurface/actions/LifecycleAction.js
24
24
  import { Button } from '../../../ui/Button.js';
25
25
  import { Banner } from '../../../ui/Feedback.js';
26
26
  import { Select } from '../../../ui/Select.js';
27
+ import '../../../testSurface/surface/test/testPage.css';
27
28
  import './newTest.css';
28
29
  /** One session stays mounted across Collection, all page steps and Review. */ export function PageWizard({ id, surface, kindChip }) {
29
30
  const router = useRouter();
@@ -155,6 +156,7 @@ import './newTest.css';
155
156
  surface: surface
156
157
  }),
157
158
  /*#__PURE__*/ _jsx("ul", {
159
+ className: "xp-page-wizard-checks",
158
160
  children: test.preflight?.checks.map((check, index)=>{
159
161
  if (!Object.hasOwn(READINESS, check.code)) return check.ok ? null : /*#__PURE__*/ _jsx("li", {
160
162
  children: SURFACE_COPY.next
@@ -162,14 +164,19 @@ import './newTest.css';
162
164
  const row = READINESS[check.code];
163
165
  const sentence = row.next(check.detail, ctx);
164
166
  const label = typeof row.nextStep === 'function' ? row.nextStep(check.detail, ctx) : row.nextStep;
165
- return sentence && !check.ok ? /*#__PURE__*/ _jsxs("li", {
166
- children: [
167
- sentence,
168
- label ? /*#__PURE__*/ _jsx(Button, {
169
- onClick: ()=>jump(row.section, readinessArm(check.code, check.detail, ctx)),
170
- children: label
171
- }) : null
172
- ]
167
+ return sentence && !check.ok ? /*#__PURE__*/ _jsx("li", {
168
+ children: /*#__PURE__*/ _jsxs("div", {
169
+ className: "xp-ui-button-group",
170
+ children: [
171
+ /*#__PURE__*/ _jsx("span", {
172
+ children: sentence
173
+ }),
174
+ label ? /*#__PURE__*/ _jsx(Button, {
175
+ onClick: ()=>jump(row.section, readinessArm(check.code, check.detail, ctx)),
176
+ children: label
177
+ }) : null
178
+ ]
179
+ })
173
180
  }, `${check.code}/${index}`) : null;
174
181
  })
175
182
  }),
@@ -16,6 +16,7 @@
16
16
  .xp-new-test-choice span { display: block; margin-inline-start: var(--xp-space-6); color: var(--xp-text-2); }
17
17
  .xp-new-test summary { cursor: pointer; margin-bottom: var(--xp-space-2); }
18
18
  .xp-new-test-kind, .xp-new-test-actions { display: flex; gap: var(--xp-space-2); align-items: center; }
19
+ .xp-new-test-actions { flex-wrap: wrap; }
19
20
  .xp-new-test-actions > .xp-ui-button--primary { margin-inline-start: auto; }
20
21
  .xp-new-test-collection { max-width: 16rem; }
21
22
  .xp-new-test-help { color: var(--xp-text-2); max-width: 65ch; }
@@ -26,3 +27,6 @@
26
27
  .xp-page-wizard .xp-copy-route ol { margin-block: 0; }
27
28
  .xp-page-wizard-review { display: grid; gap: var(--xp-space-3); }
28
29
  .xp-page-wizard-review > .xp-ui-button { justify-self: start; }
30
+ .xp-page-wizard-checks { display: grid; gap: var(--xp-space-2); margin-block: 0; overflow-wrap: anywhere; }
31
+ .xp-page-wizard-checks:empty { display: none; }
32
+ .xp-page-wizard-checks > li > .xp-ui-button-group { align-items: center; gap: var(--xp-space-2); }
@@ -87,8 +87,6 @@
87
87
  --xp-error-text: var(--xp-error);
88
88
  --xp-radius: var(--xp-radius-control);
89
89
  --xp-radius-large: var(--xp-radius-card);
90
- --xp-dash-card-gap: 12px;
91
- --xp-dash-card-gap-small: 8px;
92
90
  --xp-font-body: var(--xp-font);
93
91
  --xp-font-size-small: 13px;
94
92
  --xp-font-size-body: 15px;
@@ -2,9 +2,7 @@ export { XP_IF_UPDATED_AT_HEADER } from '../constants.js';
2
2
  export { LayerUsage } from '../admin/LayerUsage.js';
3
3
  export { MetricSourceSelect } from '../admin/MetricSourceSelect.js';
4
4
  export { ArmSelectField } from '../admin/armSelect/ArmSelectField.js';
5
- export { TestsNavLink } from '../admin/TestsNavLink.js';
6
5
  export { TestsSurface } from '../admin/views/TestsSurfaceClient.js';
7
- export { TestsDashboardCards } from '../admin/TestsDashboardCards.js';
8
6
  export { PlacementStatus } from '../admin/PlacementStatus.js';
9
7
  export { wrapExperimentBlock, syncExperimentSlots, copyOriginalIntoVersion, unwrapExperimentBlock, findRegisteredBlocksField } from '../blocks/formState.js';
10
8
  export { TestBlockField } from '../admin/blocks/TestBlockField.js';
@@ -3,9 +3,7 @@ export { XP_IF_UPDATED_AT_HEADER } from '../constants.js';
3
3
  export { LayerUsage } from '../admin/LayerUsage.js';
4
4
  export { MetricSourceSelect } from '../admin/MetricSourceSelect.js';
5
5
  export { ArmSelectField } from '../admin/armSelect/ArmSelectField.js';
6
- export { TestsNavLink } from '../admin/TestsNavLink.js';
7
6
  export { TestsSurface } from '../admin/views/TestsSurfaceClient.js';
8
- export { TestsDashboardCards } from '../admin/TestsDashboardCards.js';
9
7
  export { PlacementStatus } from '../admin/PlacementStatus.js';
10
8
  export { wrapExperimentBlock, syncExperimentSlots, copyOriginalIntoVersion, unwrapExperimentBlock, findRegisteredBlocksField } from '../blocks/formState.js';
11
9
  export { TestBlockField } from '../admin/blocks/TestBlockField.js';
@@ -1,7 +1,5 @@
1
1
  export { ExperimentsRootView } from '../admin/views/ExperimentsRootView.js';
2
- export { CollectionListRedirect } from '../admin/views/CollectionListRedirect.js';
3
2
  export { CollectionEditRedirect } from '../admin/views/CollectionEditRedirect.js';
4
- export { TestsNavLinkServer } from '../admin/views/TestsNavLinkServer.js';
5
3
  export { TestsCollectionListView } from '../admin/views/TestsCollectionListView.js';
6
4
  export { GoalsCollectionListView } from '../admin/views/GoalsCollectionListView.js';
7
5
  export { GoalEditRedirect } from '../admin/views/GoalEditRedirect.js';
@@ -1,7 +1,5 @@
1
1
  export { ExperimentsRootView } from '../admin/views/ExperimentsRootView.js';
2
- export { CollectionListRedirect } from '../admin/views/CollectionListRedirect.js';
3
2
  export { CollectionEditRedirect } from '../admin/views/CollectionEditRedirect.js';
4
- export { TestsNavLinkServer } from '../admin/views/TestsNavLinkServer.js';
5
3
  export { TestsCollectionListView } from '../admin/views/TestsCollectionListView.js';
6
4
  export { GoalsCollectionListView } from '../admin/views/GoalsCollectionListView.js';
7
5
  export { GoalEditRedirect } from '../admin/views/GoalEditRedirect.js';
@@ -78,8 +78,6 @@
78
78
  --xp-error-text: #a63030;
79
79
  --xp-radius: 8px;
80
80
  --xp-radius-large: 12px;
81
- --xp-dash-card-gap: 12px;
82
- --xp-dash-card-gap-small: 8px;
83
81
  --xp-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
84
82
  --xp-font-size-small: 13px;
85
83
  --xp-font-size-body: 15px;
@@ -165,8 +163,6 @@
165
163
  --xp-error-text: #f09494;
166
164
  --xp-radius: 8px;
167
165
  --xp-radius-large: 12px;
168
- --xp-dash-card-gap: 12px;
169
- --xp-dash-card-gap-small: 8px;
170
166
  --xp-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
171
167
  --xp-font-size-small: 13px;
172
168
  --xp-font-size-body: 15px;
@@ -251,8 +247,6 @@
251
247
  --xp-error-text: #a63030;
252
248
  --xp-radius: 8px;
253
249
  --xp-radius-large: 12px;
254
- --xp-dash-card-gap: 12px;
255
- --xp-dash-card-gap-small: 8px;
256
250
  --xp-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
257
251
  --xp-font-size-small: 13px;
258
252
  --xp-font-size-body: 15px;
@@ -8,7 +8,7 @@ export declare function isValidTimeZone(tz: string): boolean;
8
8
  export declare function isActive(spec: ActiveSpec, pauses: PauseInterval[], now: Date): boolean;
9
9
  export declare function inactiveIntervals(spec: ActiveSpec, pauses: Pauses, range: DateRange): DateRange[];
10
10
  export declare function activeDays(spec: ActiveSpec, pauses: Pauses, range: DateRange): number;
11
- /** Wall-clock input for an instant, independent of the browser's time zone. */
11
+ /** Wall-clock input to the minute, independent of the browser's time zone. */
12
12
  export declare function formatLocalDateTime(value: string | null | undefined, timeZone: string): string;
13
13
  /** Choose the first occurrence of a repeated clock time and refuse nonexistent times. */
14
14
  export declare function parseLocalDateTime(value: string, timeZone: string): string | null;
@@ -222,10 +222,10 @@ function localDateSpans(timeZone, date) {
222
222
  to: date + DAY - segment.offset
223
223
  })).filter((span)=>span.from < span.to);
224
224
  }
225
- /** Wall-clock input for an instant, independent of the browser's time zone. */ export function formatLocalDateTime(value, timeZone) {
225
+ /** Wall-clock input to the minute, independent of the browser's time zone. */ export function formatLocalDateTime(value, timeZone) {
226
226
  const instant = Date.parse(value ?? '');
227
227
  if (!Number.isFinite(instant)) return '';
228
- return new Date(instant + offsetAt(formatterFor(timeZone), instant)).toISOString().slice(0, -1);
228
+ return new Date(instant + offsetAt(formatterFor(timeZone), instant)).toISOString().slice(0, -8);
229
229
  }
230
230
  /** Choose the first occurrence of a repeated clock time and refuse nonexistent times. */ export function parseLocalDateTime(value, timeZone) {
231
231
  const clock = Date.parse(`${value}Z`);
@@ -6,9 +6,6 @@ export declare const SURFACE_COPY: {
6
6
  readonly goals: "Goals";
7
7
  readonly search: "Search tests";
8
8
  readonly navAllTests: "All tests";
9
- readonly navGoals: "Goals";
10
- readonly dashShowTests: "Show all tests";
11
- readonly dashShowGoals: "Show all goals";
12
9
  readonly backToAdmin: "Back to admin";
13
10
  readonly notInstalled: "The Tests screen isn't installed yet. Run `payload generate:importmap` and reload.";
14
11
  readonly noAccess: "You don't have access to tests.";
@@ -7,9 +7,6 @@ export const SURFACE_COPY = {
7
7
  goals: 'Goals',
8
8
  search: 'Search tests',
9
9
  navAllTests: 'All tests',
10
- navGoals: 'Goals',
11
- dashShowTests: 'Show all tests',
12
- dashShowGoals: 'Show all goals',
13
10
  backToAdmin: 'Back to admin',
14
11
  notInstalled: "The Tests screen isn't installed yet. Run `payload generate:importmap` and reload.",
15
12
  noAccess: "You don't have access to tests.",
@@ -114,6 +114,7 @@ export declare const TEST_PAGE: {
114
114
  readonly endDate: "Planned end date";
115
115
  readonly noSuggestion: "Enter a daily number above to get a suggestion. 4 weeks is a safe default.";
116
116
  readonly chooseGoalSuggestion: "Choose a goal to get a suggestion.";
117
+ readonly insufficientGoalData: "There isn't enough past data for this goal to suggest a length yet. 4 weeks is a safe default.";
117
118
  readonly required: "(required)";
118
119
  readonly apply: "Apply";
119
120
  readonly infeasible: "This may need more people than are available.";
@@ -116,6 +116,7 @@ export const TEST_PAGE = {
116
116
  endDate: 'Planned end date',
117
117
  noSuggestion: 'Enter a daily number above to get a suggestion. 4 weeks is a safe default.',
118
118
  chooseGoalSuggestion: 'Choose a goal to get a suggestion.',
119
+ insufficientGoalData: "There isn't enough past data for this goal to suggest a length yet. 4 weeks is a safe default.",
119
120
  required: '(required)',
120
121
  apply: 'Apply',
121
122
  infeasible: 'This may need more people than are available.'
@@ -30,12 +30,12 @@ export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
30
30
  const read = test.preflightRead ?? (test.preflightError ? readinessRead(test) : undefined);
31
31
  return /*#__PURE__*/ _jsx(_Fragment, {
32
32
  children: read?.message ? /*#__PURE__*/ _jsxs("div", {
33
+ className: "xp-ui-button-group",
33
34
  children: [
34
35
  !messageInBlockerList ? /*#__PURE__*/ _jsx("span", {
35
36
  role: "alert",
36
37
  children: read.message
37
38
  }) : null,
38
- ' ',
39
39
  read.retry ? /*#__PURE__*/ _jsx(Button, {
40
40
  disabled: retrying || test.preflightPending,
41
41
  onClick: ()=>{
@@ -465,11 +465,12 @@ export function CohortRuleEditor({ test, surface, index, pending = false, draftI
465
465
  role: "status",
466
466
  children: C.loading
467
467
  }) : !result.rows ? /*#__PURE__*/ _jsxs("div", {
468
- className: "xp-page-message",
468
+ className: "xp-page-message xp-ui-button-group",
469
469
  role: "alert",
470
470
  children: [
471
- C.searchError,
472
- ' ',
471
+ /*#__PURE__*/ _jsx("span", {
472
+ children: C.searchError
473
+ }),
473
474
  /*#__PURE__*/ _jsx(Button, {
474
475
  size: "sm",
475
476
  onClick: ()=>{
@@ -219,17 +219,16 @@ export function GoalSection({ test, surface, embedded = false }) {
219
219
  test: test,
220
220
  sectionId: "win",
221
221
  children: [
222
- failed ? /*#__PURE__*/ _jsxs("p", {
222
+ failed ? /*#__PURE__*/ _jsxs("div", {
223
223
  role: "alert",
224
+ className: "xp-goal-retry xp-ui-button-group",
224
225
  children: [
225
- C.goalsError,
226
- " ",
227
226
  /*#__PURE__*/ _jsx("span", {
228
- className: "xp-ui-button-group",
229
- children: /*#__PURE__*/ _jsx(Button, {
230
- onClick: ()=>setAttempt((n)=>n + 1),
231
- children: C.retry
232
- })
227
+ children: C.goalsError
228
+ }),
229
+ /*#__PURE__*/ _jsx(Button, {
230
+ onClick: ()=>setAttempt((n)=>n + 1),
231
+ children: C.retry
233
232
  })
234
233
  ]
235
234
  }) : null,
@@ -15,6 +15,7 @@ export function LengthSection({ test, surface }) {
15
15
  const reason = reasonFor(test, 'analysis');
16
16
  const days = doc.analysis?.plannedDurationDays ?? 28;
17
17
  const suggestion = !reason ? durationSuggestion(test.preflight, days) : null;
18
+ const noEstimateHint = doc.analysis?.reachPerDay == null ? C.noSuggestion : doc.metrics?.primary == null ? C.chooseGoalSuggestion : C.insufficientGoalData;
18
19
  const windows = doc.schedule?.windows ?? [];
19
20
  const week = activeWeek(windows);
20
21
  const zone = doc.schedule?.timeZone || surface.timeZone || test.preflight?.scheduleTimeZone;
@@ -61,13 +62,10 @@ export function LengthSection({ test, surface }) {
61
62
  type: "number",
62
63
  min: 1,
63
64
  reason: reason,
65
+ help: !reason ? C.reachHelp : undefined,
64
66
  required: required && !reason,
65
67
  onCommit: (value)=>change('reachPerDay', value)
66
68
  }),
67
- !reason ? /*#__PURE__*/ _jsx("p", {
68
- className: "xp-ui-help",
69
- children: C.reachHelp
70
- }) : null,
71
69
  /*#__PURE__*/ _jsx(FieldErrors, {
72
70
  test: test,
73
71
  path: "analysis.reachPerDay"
@@ -120,7 +118,7 @@ export function LengthSection({ test, surface }) {
120
118
  }) : null
121
119
  ]
122
120
  }) : !reason && !test.preflight?.estimate ? /*#__PURE__*/ _jsx("p", {
123
- children: doc.analysis?.reachPerDay == null ? C.noSuggestion : C.chooseGoalSuggestion
121
+ children: noEstimateHint
124
122
  }) : null,
125
123
  test.errors.analysis ? /*#__PURE__*/ _jsx("p", {
126
124
  role: "alert",
@@ -14,6 +14,7 @@ import { Button } from '../../../ui/Button.js';
14
14
  const reason = reasonFor(test, 'arms');
15
15
  if (reason && !arm) return null;
16
16
  return /*#__PURE__*/ _jsxs("div", {
17
+ className: "xp-page-holdout",
17
18
  children: [
18
19
  arm ? /*#__PURE__*/ _jsxs(_Fragment, {
19
20
  children: [
@@ -9,7 +9,7 @@ export function ScheduleDateInput({ timeZone, ...props }) {
9
9
  ...props,
10
10
  id: id,
11
11
  type: "datetime-local",
12
- step: "0.001",
12
+ step: "60",
13
13
  help: timeZone || C.noZone
14
14
  });
15
15
  }
@@ -24,19 +24,34 @@
24
24
  :where(.xp-test-surface) .xp-traffic-bar > span { display: block; }
25
25
  :where(.xp-test-surface) .xp-split-legend { display: flex; flex-wrap: wrap; gap: var(--xp-space-4); font: var(--xp-text-small); color: var(--xp-text-2); }
26
26
  :where(.xp-test-surface) .xp-split-legend i { display: inline-block; width: var(--xp-legend-key-size); height: var(--xp-legend-key-size); border-radius: var(--xp-legend-key-radius); margin-right: var(--xp-space-one-half); }
27
- :where(.xp-test-surface) .xp-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--xp-space-4); }
27
+ :where(.xp-test-surface, #section-schedule) .xp-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--xp-space-4); }
28
28
  :where(.xp-test-surface) .xp-test-advanced .xp-field-grid { padding-top: var(--xp-space-4); }
29
- :where(.xp-test-surface) .xp-field-grid > div { min-width: 0; }
29
+ :where(.xp-test-surface, #section-schedule) .xp-field-grid > div { min-width: 0; }
30
30
  :where(.xp-test-surface) .xp-field-grid p, :where(.xp-test-surface) .xp-page-binding p { color: var(--xp-text-2); font: var(--xp-text-small); }
31
31
  :where(.xp-test-surface) .xp-read-only code { font-family: var(--xp-mono); overflow-wrap: anywhere; }
32
32
  :where(.xp-test-surface) .xp-ui-checkbox-list { display: flex; flex-wrap: wrap; gap: var(--xp-space-2) var(--xp-space-4); }
33
33
  :where(.xp-test-surface) .xp-duration-suggestion { align-items: center; margin-top: var(--xp-space-4); }
34
34
  :where(.xp-test-surface) .xp-read-only { padding-block: .5rem; }
35
35
  :where(.xp-test-surface) .xp-read-only p { margin-block: .5rem; color: var(--xp-text); font: var(--xp-text-body); }
36
- :where(.xp-test-surface) .xp-section-lock { margin-block: 0; }
36
+ :where(.xp-test-surface) .xp-section-lock { margin-block: 0 var(--xp-space-2); }
37
+ :where(#section-what, #section-schedule) > .xp-ui-section-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--xp-space-4); }
38
+ :where(#section-what, #section-schedule) > .xp-ui-section-body > p { margin-block: 0; }
39
+ :where(.xp-test-surface) .xp-field-draft-notice { margin-block-start: var(--xp-space-2); }
40
+ :where(.xp-test-surface) .xp-test-blocker:not(:first-child) { margin-block-start: var(--xp-space-2); }
41
+ :where(#section-what, #section-schedule) > .xp-ui-section-body > .xp-test-blocker { margin-block: 0; }
37
42
  :where(.xp-test-surface) .xp-page-binding-row { align-items: center; }
38
- :where(.xp-test-surface) .xp-page-binding { margin-block-end: var(--xp-space-4); }
39
- :where(.xp-test-surface) .xp-page-binding > .xp-ui-help { margin-block: var(--xp-space-2) 0; }
43
+ :where(.xp-test-surface) .xp-page-binding, :where(.xp-test-surface) .xp-page-holdout { display: grid; gap: var(--xp-space-2); }
44
+ :where(.xp-test-surface) .xp-page-binding:empty { display: none; }
45
+ :where(.xp-test-surface) .xp-page-binding > p { margin-block: 0; }
46
+ :where(.xp-test-surface) .xp-page-holdout > .xp-ui-button { justify-self: start; }
47
+ :where(.xp-test-surface) .xp-split-legend + .xp-ui-help,
48
+ :where(.xp-test-surface) .xp-section-actions ~ .xp-ui-help + :is(.xp-ui-field, .xp-read-only),
49
+ :where(#section-who) > .xp-ui-section-body > .xp-ui-help + .xp-ui-button-group,
50
+ :where(#section-length) .xp-field-grid + p,
51
+ :where(.xp-test-surface) .xp-ui-dialog > .xp-ui-field + .xp-ui-field { margin-block-start: var(--xp-space-2); }
52
+ :where(.xp-test-surface) .xp-goal-retry, :where(.xp-test-surface) .xp-cohort-row .xp-page-message[role='alert'] { align-items: center; }
53
+ :where(.xp-test-surface) .xp-goal-retry { margin-block-end: var(--xp-space-2); }
54
+ :where(.xp-test-surface) .xp-other-goals { margin-block-start: var(--xp-space-4); }
40
55
  :where(.xp-test-surface) .xp-field-error { color: var(--xp-error-text); }
41
56
 
42
57
  :where(.xp-test-surface) .xp-targeting-row { display: grid; grid-template-columns: var(--xp-targeting-attribute-width) var(--xp-targeting-comparison-width) minmax(0, 1fr); align-items: start; gap: var(--xp-space-3); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-control); padding: var(--xp-space-4); margin-bottom: var(--xp-space-4); }
@@ -47,7 +62,7 @@
47
62
  :where(.xp-test-surface) .xp-version-remove:empty { display: none; }
48
63
  :where(.xp-test-surface) .xp-version-content, :where(.xp-test-surface) .xp-setting-values, :where(.xp-test-surface) .xp-version-remove { grid-column: 1 / -1; }
49
64
  :where(.xp-test-surface) .xp-version-grid-head > :nth-child(n+3) { display: none; }
50
- :where(.xp-test-surface) .xp-targeting-row, :where(.xp-test-surface) .xp-field-grid { grid-template-columns: 1fr; }
65
+ :where(.xp-test-surface) .xp-targeting-row, :where(.xp-test-surface, #section-schedule) .xp-field-grid { grid-template-columns: minmax(0, 1fr); }
51
66
  }
52
67
 
53
68
  :where(.xp-test-surface) .xp-version-rows.xp-version-rows--setting { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@@ -77,6 +92,9 @@
77
92
  :where(.xp-test-surface) .xp-readiness__state { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
78
93
  :where(.xp-test-surface) .xp-readiness__state p, :where(.xp-test-surface) .xp-readiness--bar > p { margin: 0; }
79
94
  :where(.xp-test-surface) .xp-readiness__state > p { font-weight: 500; white-space: pre-line; }
95
+ :where(.xp-test-surface) .xp-readiness__blockers ul { display: grid; gap: var(--xp-space-1); margin-block-start: var(--xp-space-1); }
96
+ .xp-save-status > .xp-ui-button-group { align-items: center; }
97
+ .xp-save-status > .xp-ui-button-group:not(:first-child):not(:empty) { margin-block-start: var(--xp-space-1); }
80
98
  :where(.xp-test-surface) .xp-readiness--bar .xp-save-status, :where(.xp-test-surface) .xp-readiness__separator { color: var(--xp-text-3); font: var(--xp-text-small); }
81
99
  :where(.xp-test-surface) .xp-readiness__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--xp-space-2); }
82
100
  :where(.xp-test-surface) .xp-readiness--bar > .xp-readiness__actions { grid-column: 2; grid-row: 1 / span 3; justify-content: flex-end; }
@@ -115,6 +133,7 @@
115
133
  justify-items: start;
116
134
  min-inline-size: 0;
117
135
  }
136
+ .xp-schedule-windows > h3 { margin: 0; font: var(--xp-text-body); font-weight: 600; }
118
137
  .xp-schedule-window {
119
138
  width: 100%;
120
139
  padding: .875rem;
@@ -132,6 +151,7 @@
132
151
  .xp-cohort-row p { margin-block: 0; }
133
152
  .xp-cohort-row .xp-cohort-options { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
134
153
  .xp-cohort-options legend { padding: 0; margin-block-end: var(--xp-space-2); }
154
+ .xp-cohort-options > .xp-ui-button-group + p { margin-block-start: var(--xp-space-2); }
135
155
  .xp-cohort-row .xp-ui-button[aria-pressed] { border-radius: 999px; }
136
156
  .xp-cohort-row .xp-ui-button[aria-pressed='true'] { background: var(--xp-text); border-color: var(--xp-text); color: var(--xp-surface); }
137
157
  .xp-cohort-row .xp-page-option { flex-wrap: wrap; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delmaredigital/payload-experiments",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "No-code A/B testing for Payload CMS and Next.js: block, page and flag experiments with holdouts, layers, exposure logging and honest statistics inside the admin — no vendor",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -149,7 +149,7 @@
149
149
  "yaml": "2.9.1"
150
150
  },
151
151
  "scripts": {
152
- "build": "swc ./src -d ./dist --strip-leading-paths --config-file ../../.swcrc && tsc -p tsconfig.build.json && copyfiles -u 1 \"src/**/*.css\" dist",
152
+ "build": "swc ./src -d ./dist --strip-leading-paths --config-file ../../.swcrc && tsc -p tsconfig.build.json && node scripts/copy-css.mjs",
153
153
  "dev": "swc ./src -d ./dist --strip-leading-paths --config-file ../../.swcrc --watch",
154
154
  "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.test.json",
155
155
  "check:esm": "node scripts/check-node-esm.mjs",
@@ -1,4 +0,0 @@
1
- import './theme.css';
2
- import './dashboard.css';
3
- /** @deprecated Retained for existing import maps until 0.5.0. */
4
- export declare function TestsDashboardCards(): import("react").JSX.Element | null;
@@ -1,48 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { surfaceUrls } from '../testSurface/surfaceUrls.js';
4
- import './theme.css';
5
- import './dashboard.css';
6
- import { Card, useAuth, useConfig } from '@payloadcms/ui';
7
- import { SURFACE_COPY } from '../testSurface/copy/surface.js';
8
- /** @deprecated Retained for existing import maps until 0.5.0. */ export function TestsDashboardCards() {
9
- const { config } = useConfig();
10
- const { permissions } = useAuth();
11
- const testPermissions = permissions?.collections?.['xp-experiments'];
12
- const canManage = testPermissions?.update === true;
13
- if (!canManage) return null;
14
- return /*#__PURE__*/ _jsxs("section", {
15
- className: "xp-dash-group",
16
- "aria-labelledby": "xp-dash-title",
17
- children: [
18
- /*#__PURE__*/ _jsx("h2", {
19
- className: "xp-dash-label",
20
- id: "xp-dash-title",
21
- children: SURFACE_COPY.title
22
- }),
23
- /*#__PURE__*/ _jsxs("ul", {
24
- className: "xp-dash-card-list",
25
- children: [
26
- /*#__PURE__*/ _jsx("li", {
27
- children: /*#__PURE__*/ _jsx(Card, {
28
- title: SURFACE_COPY.navAllTests,
29
- titleAs: "h3",
30
- buttonAriaLabel: SURFACE_COPY.dashShowTests,
31
- href: surfaceUrls.home(config.routes.admin),
32
- id: "card-xp-tests"
33
- })
34
- }),
35
- /*#__PURE__*/ _jsx("li", {
36
- children: /*#__PURE__*/ _jsx(Card, {
37
- title: SURFACE_COPY.navGoals,
38
- titleAs: "h3",
39
- buttonAriaLabel: SURFACE_COPY.dashShowGoals,
40
- href: surfaceUrls.goals(config.routes.admin),
41
- id: "card-xp-goals"
42
- })
43
- })
44
- ]
45
- })
46
- ]
47
- });
48
- }
@@ -1,6 +0,0 @@
1
- import './theme.css';
2
- /** @deprecated Retained for existing import maps until 0.5.0. */
3
- declare function TestsNav({ isOpen }: {
4
- isOpen?: boolean;
5
- }): import("react").JSX.Element | null;
6
- export { TestsNav as TestsNavLink };
@@ -1,68 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { surfaceUrls } from '../testSurface/surfaceUrls.js';
4
- import './theme.css';
5
- import { Link, NavGroup, useAuth, useConfig } from '@payloadcms/ui';
6
- import { usePathname } from 'next/navigation.js';
7
- import { SURFACE_COPY } from '../testSurface/copy/surface.js';
8
- /** @deprecated Retained for existing import maps until 0.5.0. */ function TestsNav({ isOpen = true }) {
9
- const { config } = useConfig();
10
- const { permissions } = useAuth();
11
- const pathname = usePathname();
12
- const href = surfaceUrls.home(config.routes.admin);
13
- const goalsHref = surfaceUrls.goals(config.routes.admin);
14
- const base = href.replace(/\/$/, '');
15
- const goalsBase = goalsHref.replace(/\/$/, '');
16
- const goalsActive = pathname === goalsBase || Boolean(pathname?.startsWith(`${goalsBase}/`));
17
- const testsActive = !goalsActive && (pathname === base || Boolean(pathname?.startsWith(`${base}/`)));
18
- const testPermissions = permissions?.collections?.['xp-experiments'];
19
- const canManage = testPermissions?.update === true;
20
- if (!canManage) return null;
21
- const entries = [
22
- {
23
- id: 'nav-xp-tests',
24
- href,
25
- label: SURFACE_COPY.navAllTests,
26
- active: testsActive
27
- },
28
- {
29
- id: 'nav-xp-goals',
30
- href: goalsHref,
31
- label: SURFACE_COPY.navGoals,
32
- active: goalsActive
33
- }
34
- ];
35
- return /*#__PURE__*/ _jsx(NavGroup, {
36
- label: SURFACE_COPY.title,
37
- isOpen: isOpen,
38
- children: entries.map((entry)=>{
39
- const props = {
40
- className: 'nav__link',
41
- id: entry.id,
42
- 'aria-current': entry.active ? 'page' : undefined
43
- };
44
- const content = /*#__PURE__*/ _jsxs(_Fragment, {
45
- children: [
46
- entry.active ? /*#__PURE__*/ _jsx("div", {
47
- className: "nav__link-indicator"
48
- }) : null,
49
- /*#__PURE__*/ _jsx("span", {
50
- className: "nav__link-label",
51
- children: entry.label
52
- })
53
- ]
54
- });
55
- return pathname === entry.href ? /*#__PURE__*/ _jsx("div", {
56
- ...props,
57
- children: content
58
- }, entry.id) : /*#__PURE__*/ _jsx(Link, {
59
- ...props,
60
- href: entry.href,
61
- prefetch: false,
62
- children: content
63
- }, entry.id);
64
- })
65
- });
66
- }
67
- // Preserve the existing import-map key.
68
- export { TestsNav as TestsNavLink };
@@ -1,35 +0,0 @@
1
- .xp-dash-group {
2
- display: flex;
3
- flex-direction: column;
4
- gap: var(--xp-space-4);
5
- margin-bottom: var(--xp-space-4);
6
- }
7
-
8
- .xp-dash-label { margin: 0; }
9
-
10
- .xp-dash-card-list {
11
- padding: 0;
12
- margin: 0;
13
- list-style: none;
14
- display: grid;
15
- grid-template-columns: repeat(5, 1fr);
16
- gap: var(--xp-dash-card-gap);
17
- }
18
-
19
- .xp-dash-card-list .card { height: 100%; }
20
-
21
- @media (max-width: 1440px) {
22
- .xp-dash-card-list { grid-template-columns: repeat(4, 1fr); }
23
- }
24
-
25
- @media (max-width: 1024px) {
26
- .xp-dash-card-list { grid-template-columns: repeat(2, 1fr); }
27
- }
28
-
29
- @media (max-width: 768px) {
30
- .xp-dash-card-list { gap: var(--xp-dash-card-gap-small); }
31
- }
32
-
33
- @media (max-width: 400px) {
34
- .xp-dash-card-list { grid-template-columns: repeat(1, 1fr); }
35
- }
@@ -1,3 +0,0 @@
1
- import type { ListViewServerProps } from 'payload';
2
- /** @deprecated Retained for existing import maps until 0.5.0. */
3
- export declare function CollectionListRedirect({ payload }: Pick<ListViewServerProps, 'payload'>): void;
@@ -1,8 +0,0 @@
1
- import { formatAdminURL } from 'payload/shared';
2
- import { redirect } from 'next/navigation.js';
3
- /** @deprecated Retained for existing import maps until 0.5.0. */ export function CollectionListRedirect({ payload }) {
4
- redirect(formatAdminURL({
5
- adminRoute: payload.config.routes.admin,
6
- path: '/experiments'
7
- }));
8
- }
@@ -1,3 +0,0 @@
1
- import type { ServerProps } from 'payload';
2
- /** @deprecated Retained for existing import maps until 0.5.0. */
3
- export declare function TestsNavLinkServer({ payload, user, permissions }: Pick<ServerProps, 'payload' | 'user' | 'permissions'>): Promise<string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
@@ -1,43 +0,0 @@
1
- import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
2
- import { SURFACE_COPY } from '../../testSurface/copy/surface.js';
3
- import { XP_TESTS_NAV_CLIENT } from '../paths.js';
4
- /** @deprecated Retained for existing import maps until 0.5.0. */ export async function TestsNavLinkServer({ payload, user, permissions }) {
5
- const testPermissions = permissions?.collections?.['xp-experiments'];
6
- if (!user?.collection || testPermissions?.update !== true) return null;
7
- const result = await payload.find({
8
- collection: 'payload-preferences',
9
- where: {
10
- and: [
11
- {
12
- key: {
13
- equals: 'nav'
14
- }
15
- },
16
- {
17
- 'user.relationTo': {
18
- equals: user.collection
19
- }
20
- },
21
- {
22
- 'user.value': {
23
- equals: user.id
24
- }
25
- }
26
- ]
27
- },
28
- limit: 1,
29
- pagination: false,
30
- depth: 0,
31
- user,
32
- overrideAccess: false
33
- });
34
- const value = result.docs[0]?.value;
35
- // Resolve the CSS-bearing client boundary through Payload's public import map.
36
- return RenderServerComponent({
37
- Component: XP_TESTS_NAV_CLIENT,
38
- importMap: payload.importMap,
39
- clientProps: {
40
- isOpen: value?.groups?.[SURFACE_COPY.title]?.open ?? true
41
- }
42
- });
43
- }