@delmaredigital/payload-experiments 0.2.0-rc.3 → 0.2.0-rc.5

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 (85) hide show
  1. package/README.md +22 -0
  2. package/dist/admin/PreviewLinks.js +8 -4
  3. package/dist/admin/TestsDashboardCards.d.ts +3 -0
  4. package/dist/admin/TestsDashboardCards.js +52 -0
  5. package/dist/admin/TestsNavLink.d.ts +3 -1
  6. package/dist/admin/TestsNavLink.js +62 -18
  7. package/dist/admin/actions/ConfirmDialog.d.ts +1 -0
  8. package/dist/admin/actions/ConfirmDialog.js +7 -5
  9. package/dist/admin/components/ChipsInput.d.ts +12 -0
  10. package/dist/admin/components/ChipsInput.js +96 -0
  11. package/dist/admin/components/RootViewMessage.d.ts +5 -0
  12. package/dist/admin/components/RootViewMessage.js +15 -0
  13. package/dist/admin/components/chipsInput.css +11 -0
  14. package/dist/admin/copy/audience.d.ts +4 -0
  15. package/dist/admin/copy/audience.js +4 -0
  16. package/dist/admin/copy/goals.d.ts +44 -0
  17. package/dist/admin/copy/goals.js +46 -0
  18. package/dist/admin/copy/review.d.ts +1 -0
  19. package/dist/admin/copy/review.js +1 -0
  20. package/dist/admin/copy/surface.d.ts +4 -0
  21. package/dist/admin/copy/surface.js +4 -0
  22. package/dist/admin/dashboard.css +35 -0
  23. package/dist/admin/paths.d.ts +1 -0
  24. package/dist/admin/paths.js +1 -0
  25. package/dist/admin/previewLinks.model.d.ts +9 -0
  26. package/dist/admin/previewLinks.model.js +34 -0
  27. package/dist/admin/results/ArmTable.js +2 -1
  28. package/dist/admin/results/CappedCell.js +2 -1
  29. package/dist/admin/results/CiChart.js +8 -7
  30. package/dist/admin/results/DataQualityPanel.js +3 -2
  31. package/dist/admin/results/VerdictCard.js +3 -2
  32. package/dist/admin/styles.css +8 -8
  33. package/dist/admin/styles.d.ts +1 -0
  34. package/dist/admin/styles.js +1 -0
  35. package/dist/admin/surface/SurfaceShell.d.ts +1 -0
  36. package/dist/admin/surface/SurfaceShell.js +1 -0
  37. package/dist/admin/surface/TestsHome.js +1 -1
  38. package/dist/admin/surface/TestsSurface.js +10 -1
  39. package/dist/admin/surface/goals/GoalForm.d.ts +7 -0
  40. package/dist/admin/surface/goals/GoalForm.js +470 -0
  41. package/dist/admin/surface/goals/GoalsBreadcrumb.d.ts +5 -0
  42. package/dist/admin/surface/goals/GoalsBreadcrumb.js +47 -0
  43. package/dist/admin/surface/goals/GoalsList.d.ts +6 -0
  44. package/dist/admin/surface/goals/GoalsList.js +135 -0
  45. package/dist/admin/surface/goals/data.d.ts +3 -0
  46. package/dist/admin/surface/goals/data.js +24 -0
  47. package/dist/admin/surface/goals/goals.css +15 -0
  48. package/dist/admin/surface/goals/goals.model.d.ts +30 -0
  49. package/dist/admin/surface/goals/goals.model.js +26 -0
  50. package/dist/admin/surface/newTest/newTest.css +6 -6
  51. package/dist/admin/surface/readiness/Banner.js +5 -4
  52. package/dist/admin/surface/results/ResultsBody.js +3 -2
  53. package/dist/admin/surface/setting/setting.css +11 -11
  54. package/dist/admin/surface/surface.css +29 -29
  55. package/dist/admin/surface/test/GoalSection.js +32 -1
  56. package/dist/admin/surface/test/TargetingSection.js +27 -10
  57. package/dist/admin/surface/test/VersionsSection.js +6 -5
  58. package/dist/admin/surface/test/testPage.css +12 -12
  59. package/dist/admin/targeting/targeting.model.d.ts +6 -1
  60. package/dist/admin/targeting/targeting.model.js +18 -2
  61. package/dist/admin/theme.css +44 -0
  62. package/dist/admin/theme.d.ts +50 -0
  63. package/dist/admin/theme.js +49 -0
  64. package/dist/admin/views/ExperimentsRootView.js +18 -18
  65. package/dist/collections/events.js +1 -0
  66. package/dist/collections/identities.js +1 -0
  67. package/dist/collections/layers.js +1 -0
  68. package/dist/collections/metricValidation.d.ts +3 -0
  69. package/dist/collections/metricValidation.js +9 -0
  70. package/dist/collections/metrics.js +4 -5
  71. package/dist/collections/phases.js +1 -0
  72. package/dist/collections/snapshots.js +1 -0
  73. package/dist/exports/adminClient.d.ts +1 -0
  74. package/dist/exports/adminClient.js +1 -0
  75. package/dist/globals/state.js +1 -0
  76. package/dist/plugin.js +8 -2
  77. package/dist/puck/editor/CreateExperimentDrawer.d.ts +1 -0
  78. package/dist/puck/editor/CreateExperimentDrawer.js +34 -25
  79. package/dist/puck/editor/ExperimentSlotEditor.d.ts +1 -0
  80. package/dist/puck/editor/ExperimentSlotEditor.js +137 -78
  81. package/dist/puck/editor/copy.d.ts +3 -1
  82. package/dist/puck/editor/copy.js +3 -1
  83. package/dist/puck/editor/editor.css +302 -0
  84. package/dist/types/surface.d.ts +2 -1
  85. package/package.json +2 -1
@@ -0,0 +1,34 @@
1
+ /** Preview URLs identify pages; counts use the most placements in any one version. */ export function previewPages(placements) {
2
+ const pages = new Map();
3
+ for (const placement of placements){
4
+ const key = `${placement.collection}\u0000${String(placement.id)}`;
5
+ const existing = pages.get(key);
6
+ if (existing) {
7
+ const { page, versions } = existing;
8
+ const count = (versions.get(placement.detail) ?? 0) + 1;
9
+ versions.set(placement.detail, count);
10
+ page.slotCount = Math.max(page.slotCount, count);
11
+ if (!page.url && placement.url) page.url = placement.url;
12
+ } else {
13
+ pages.set(key, {
14
+ page: {
15
+ key,
16
+ collection: placement.collection,
17
+ id: placement.id,
18
+ title: placement.title,
19
+ url: placement.url,
20
+ slotCount: 1
21
+ },
22
+ versions: new Map([
23
+ [
24
+ placement.detail,
25
+ 1
26
+ ]
27
+ ])
28
+ });
29
+ }
30
+ }
31
+ return [
32
+ ...pages.values()
33
+ ].map(({ page })=>page);
34
+ }
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { theme } from '../theme.js';
3
4
  import { RESULTS_COPY } from '../copy/results.js';
4
5
  import { CappedCell } from './CappedCell.js';
5
6
  export function ArmTable({ rows, caption, method, metricKind }) {
@@ -10,7 +11,7 @@ export function ArmTable({ rows, caption, method, metricKind }) {
10
11
  return /*#__PURE__*/ _jsx("div", {
11
12
  className: "xp-arm-table",
12
13
  style: {
13
- color: 'var(--theme-text)',
14
+ color: theme.color.text,
14
15
  overflowX: 'auto'
15
16
  },
16
17
  children: /*#__PURE__*/ _jsxs("table", {
@@ -1,10 +1,11 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { theme } from '../theme.js';
3
4
  export function CappedCell({ model }) {
4
5
  return /*#__PURE__*/ _jsxs("div", {
5
6
  className: "xp-capped-cell",
6
7
  style: {
7
- color: 'var(--theme-text)'
8
+ color: theme.color.text
8
9
  },
9
10
  children: [
10
11
  /*#__PURE__*/ _jsx("span", {
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { theme } from '../theme.js';
3
4
  import { RESULTS_COPY as C, chartSummary, contentChangeTitle } from '../copy/results.js';
4
5
  import { chartModel } from './chart.model.js';
5
6
  import { formatPercent } from './format.js';
6
7
  const colors = [
7
- 'var(--theme-elevation-800)',
8
- 'var(--theme-elevation-600)',
9
- 'var(--theme-elevation-400)'
8
+ theme.color.textStrong,
9
+ theme.color.textMuted,
10
+ theme.color.borderAccent
10
11
  ];
11
12
  const date = (t)=>new Intl.DateTimeFormat('en-US', {
12
13
  dateStyle: 'medium',
@@ -28,7 +29,7 @@ export function CiChart({ series, metricId, metricName, phase, contentChanges })
28
29
  return /*#__PURE__*/ _jsxs("section", {
29
30
  className: "xp-ci-chart",
30
31
  style: {
31
- color: 'var(--theme-text)'
32
+ color: theme.color.text
32
33
  },
33
34
  children: [
34
35
  /*#__PURE__*/ _jsx("h2", {
@@ -50,7 +51,7 @@ export function CiChart({ series, metricId, metricName, phase, contentChanges })
50
51
  x2: 680,
51
52
  y1: y(0),
52
53
  y2: y(0),
53
- stroke: "var(--theme-elevation-500)",
54
+ stroke: theme.color.accent,
54
55
  strokeDasharray: "4 4"
55
56
  }),
56
57
  [
@@ -146,7 +147,7 @@ export function CiChart({ series, metricId, metricName, phase, contentChanges })
146
147
  x2: x(marker.t),
147
148
  y1: 20,
148
149
  y2: 230,
149
- stroke: "var(--theme-text)",
150
+ stroke: theme.color.text,
150
151
  strokeDasharray: "2 4"
151
152
  })
152
153
  ]
@@ -156,7 +157,7 @@ export function CiChart({ series, metricId, metricName, phase, contentChanges })
156
157
  /*#__PURE__*/ _jsx("ul", {
157
158
  children: model.variants.map((variant, index)=>/*#__PURE__*/ _jsxs("li", {
158
159
  style: {
159
- color: 'var(--theme-text)'
160
+ color: theme.color.text
160
161
  },
161
162
  children: [
162
163
  /*#__PURE__*/ _jsx("span", {
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { theme } from '../theme.js';
3
4
  import { RESULTS_COPY } from '../copy/results.js';
4
5
  export function DataQualityPanel({ items }) {
5
6
  if (items.length === 0) return null;
@@ -7,8 +8,8 @@ export function DataQualityPanel({ items }) {
7
8
  className: "xp-data-quality",
8
9
  "aria-label": RESULTS_COPY.quality,
9
10
  style: {
10
- color: 'var(--theme-text)',
11
- background: 'var(--theme-elevation-50)',
11
+ color: theme.color.text,
12
+ background: theme.color.surface,
12
13
  padding: '1rem'
13
14
  },
14
15
  children: [
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { theme } from '../theme.js';
3
4
  export function VerdictCard({ model, guardrails = [], power, collecting, sinceShipping }) {
4
5
  return /*#__PURE__*/ _jsxs("section", {
5
6
  className: "xp-verdict-card",
6
7
  style: {
7
- color: 'var(--theme-text)',
8
- background: 'var(--theme-elevation-50)',
8
+ color: theme.color.text,
9
+ background: theme.color.surface,
9
10
  padding: '1rem'
10
11
  },
11
12
  children: [
@@ -1,10 +1,10 @@
1
1
  /* Admin styles for the experiments plugin; loaded by src/admin/styles.ts. */
2
2
  .xp-status-pill { font-weight: 600; }
3
- .xp-status-pill--neutral { background: var(--theme-elevation-150); color: var(--theme-elevation-800); }
4
- .xp-status-pill--success { background: var(--theme-success-150); color: var(--theme-success-850); }
5
- .xp-status-pill--warning { background: var(--theme-warning-150); color: var(--theme-warning-850); }
6
- .xp-status-pill--info { background: var(--theme-elevation-200); color: var(--theme-elevation-900); }
7
- .xp-status-pill--muted { background: var(--theme-elevation-100); color: var(--theme-elevation-600); }
8
- .xp-locked-notice, .xp-notice { padding: 0.75rem; border-inline-start: 3px solid var(--theme-elevation-400); background: var(--theme-elevation-50); color: var(--theme-elevation-800); }
9
- .xp-notice--warning { border-color: var(--theme-warning-500); background: var(--theme-warning-100); }
10
- .xp-notice--error { border-color: var(--theme-error-500); background: var(--theme-error-100); }
3
+ .xp-status-pill--neutral { background: var(--xp-border); color: var(--xp-text-strong); }
4
+ .xp-status-pill--success { background: var(--xp-success-bg); color: var(--xp-success-text-strong); }
5
+ .xp-status-pill--warning { background: var(--xp-warning-bg); color: var(--xp-warning-text-strong); }
6
+ .xp-status-pill--info { background: var(--xp-border-strong); color: var(--xp-text-emphasis); }
7
+ .xp-status-pill--muted { background: var(--xp-surface-raised); color: var(--xp-text-muted); }
8
+ .xp-locked-notice, .xp-notice { padding: 0.75rem; border-inline-start: 3px solid var(--xp-border-accent); background: var(--xp-surface); color: var(--xp-text-strong); }
9
+ .xp-notice--warning { border-color: var(--xp-warning); background: var(--xp-warning-surface); }
10
+ .xp-notice--error { border-color: var(--xp-error); background: var(--xp-error-surface); }
@@ -1 +1,2 @@
1
+ import './theme.css';
1
2
  import './styles.css';
@@ -1,2 +1,3 @@
1
1
  // Load admin styles from mounted components so barrels stay free of side effects.
2
+ import './theme.css';
2
3
  import './styles.css';
@@ -1,3 +1,4 @@
1
+ import '../theme.css';
1
2
  import type { ReactNode } from 'react';
2
3
  import './surface.css';
3
4
  export declare function SurfaceShell({ adminRoute, children }: {
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import '../theme.css';
3
4
  import { Link } from '@payloadcms/ui';
4
5
  import { formatAdminURL } from 'payload/shared';
5
6
  import { SURFACE_COPY } from '../copy/surface.js';
@@ -91,7 +91,7 @@ export function TestsHome({ adminRoute, apiRoute }) {
91
91
  /*#__PURE__*/ _jsx(Link, {
92
92
  href: formatAdminURL({
93
93
  adminRoute,
94
- path: '/collections/xp-metrics'
94
+ path: '/experiments/goals'
95
95
  }),
96
96
  children: SURFACE_COPY.goals
97
97
  })
@@ -4,6 +4,8 @@ import { NewTest } from './newTest/NewTest.js';
4
4
  import { TestPage } from './test/TestPage.js';
5
5
  import { ResultsRoute } from './ResultsRoute.js';
6
6
  import { SurfaceShell } from './SurfaceShell.js';
7
+ import { GoalForm } from './goals/GoalForm.js';
8
+ import { GoalsList } from './goals/GoalsList.js';
7
9
  import { TestsHome } from './TestsHome.js';
8
10
  export function TestsSurface(props) {
9
11
  const surface = {
@@ -22,7 +24,14 @@ export function TestsSurface(props) {
22
24
  children: props.route === 'home' ? /*#__PURE__*/ _jsx(TestsHome, {
23
25
  adminRoute: props.adminRoute,
24
26
  apiRoute: props.apiRoute
25
- }) : props.route === 'new' ? /*#__PURE__*/ _jsx(NewTest, {
27
+ }) : props.route === 'goals' ? /*#__PURE__*/ _jsx(GoalsList, {
28
+ surface: surface,
29
+ returnToTest: props.returnToTest
30
+ }) : props.route === 'goalNew' || props.route === 'goal' ? /*#__PURE__*/ _jsx(GoalForm, {
31
+ surface: surface,
32
+ id: props.route === 'goal' ? props.id : undefined,
33
+ returnToTest: props.returnToTest
34
+ }, props.route === 'goalNew' ? 'new' : props.id) : props.route === 'new' ? /*#__PURE__*/ _jsx(NewTest, {
26
35
  surface: surface,
27
36
  pages: props.pages
28
37
  }) : props.id === undefined ? null : props.route === 'test' ? /*#__PURE__*/ _jsx(TestPage, {
@@ -0,0 +1,7 @@
1
+ import type { SurfaceProps } from '../contracts.js';
2
+ import './goals.css';
3
+ export declare function GoalForm({ surface, id, returnToTest }: {
4
+ surface: SurfaceProps;
5
+ id?: string;
6
+ returnToTest?: string;
7
+ }): import("react").JSX.Element;