@delmaredigital/payload-experiments 0.5.2 → 0.5.3

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.
@@ -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';
@@ -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;
@@ -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.",
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.3",
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",
@@ -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
- }