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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/admin/MetricSourceSelect.js +10 -3
  2. package/dist/admin/copy/blocks.js +3 -3
  3. package/dist/admin/copy/goals.d.ts +15 -8
  4. package/dist/admin/copy/goals.js +18 -8
  5. package/dist/admin/copy/newTest.d.ts +3 -2
  6. package/dist/admin/copy/newTest.js +3 -2
  7. package/dist/admin/surface/SurfaceShell.d.ts +4 -2
  8. package/dist/admin/surface/SurfaceShell.js +25 -3
  9. package/dist/admin/surface/TestRowMenu.d.ts +7 -0
  10. package/dist/admin/surface/TestRowMenu.js +9 -2
  11. package/dist/admin/surface/TestsHome.js +8 -1
  12. package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
  13. package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
  14. package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
  15. package/dist/admin/surface/goals/GoalForm.js +280 -191
  16. package/dist/admin/surface/goals/GoalsList.js +102 -33
  17. package/dist/admin/surface/goals/data.d.ts +2 -0
  18. package/dist/admin/surface/goals/data.js +9 -0
  19. package/dist/admin/surface/goals/goals.css +3 -2
  20. package/dist/admin/surface/goals/goals.model.d.ts +2 -2
  21. package/dist/admin/surface/goals/goals.model.js +7 -12
  22. package/dist/admin/surface/home.model.d.ts +1 -0
  23. package/dist/admin/surface/home.model.js +5 -1
  24. package/dist/admin/surface/newTest/NewTest.js +56 -29
  25. package/dist/admin/surface/newTest/PageWizard.d.ts +3 -1
  26. package/dist/admin/surface/newTest/PageWizard.js +14 -14
  27. package/dist/admin/surface/newTest/newTest.css +3 -3
  28. package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
  29. package/dist/admin/surface/results/ResultsHeader.js +69 -41
  30. package/dist/admin/surface/surface.css +20 -1
  31. package/dist/admin/surface/test/TestPage.js +46 -34
  32. package/dist/admin/surface/useXpStepNav.d.ts +11 -0
  33. package/dist/admin/surface/useXpStepNav.js +14 -0
  34. package/dist/admin/views/TestsSurfaceClient.js +27 -3
  35. package/dist/blocks/createExperimentBlock.js +1 -1
  36. package/dist/blocks/formState.js +1 -1
  37. package/dist/collections/metrics.js +12 -5
  38. package/dist/collections/serialize.js +3 -2
  39. package/dist/db/snapshots.d.ts +1 -0
  40. package/dist/goals/sourceLabel.d.ts +2 -0
  41. package/dist/goals/sourceLabel.js +4 -0
  42. package/dist/plugin.js +51 -1
  43. package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
  44. package/dist/puck/editor/ExperimentSlotEditor.js +96 -43
  45. package/dist/puck/editor/QuickTestActions.d.ts +2 -2
  46. package/dist/puck/editor/QuickTestActions.js +42 -27
  47. package/dist/puck/editor/ResultsReadout.d.ts +3 -1
  48. package/dist/puck/editor/ResultsReadout.js +28 -16
  49. package/dist/puck/editor/VersionBuilder.d.ts +2 -1
  50. package/dist/puck/editor/VersionBuilder.js +14 -8
  51. package/dist/puck/editor/copy.d.ts +3 -3
  52. package/dist/puck/editor/copy.js +4 -4
  53. package/dist/puck/editor/editor.chrome.css +9 -1
  54. package/dist/puck/editor/editor.css +10 -1
  55. package/dist/puck/nestedTestCopy.js +1 -1
  56. package/dist/puck/slotConfig.d.ts +1 -1
  57. package/dist/puck/slotConfig.js +1 -1
  58. package/dist/results/analyse.d.ts +2 -0
  59. package/dist/results/analyse.js +2 -2
  60. package/dist/results/verdict.d.ts +1 -1
  61. package/dist/results/verdict.js +7 -6
  62. package/dist/server/runResults.js +2 -1
  63. package/dist/testSurface/PreviewLinks.d.ts +2 -1
  64. package/dist/testSurface/PreviewLinks.js +3 -3
  65. package/dist/testSurface/actions/DecideDialog.d.ts +3 -2
  66. package/dist/testSurface/actions/DecideDialog.js +21 -12
  67. package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
  68. package/dist/testSurface/actions/LifecycleAction.js +3 -1
  69. package/dist/testSurface/actions/actions.model.js +6 -5
  70. package/dist/testSurface/actions/decide.model.d.ts +1 -0
  71. package/dist/testSurface/actions/decide.model.js +1 -0
  72. package/dist/testSurface/allocation.model.js +6 -3
  73. package/dist/testSurface/copy/actions.d.ts +12 -9
  74. package/dist/testSurface/copy/actions.js +12 -9
  75. package/dist/testSurface/copy/advanced.d.ts +10 -0
  76. package/dist/testSurface/copy/advanced.js +10 -0
  77. package/dist/testSurface/copy/arms.d.ts +1 -1
  78. package/dist/testSurface/copy/arms.js +1 -1
  79. package/dist/testSurface/copy/audience.d.ts +4 -3
  80. package/dist/testSurface/copy/audience.js +5 -4
  81. package/dist/testSurface/copy/common.d.ts +2 -2
  82. package/dist/testSurface/copy/common.js +2 -2
  83. package/dist/testSurface/copy/metrics.d.ts +6 -0
  84. package/dist/testSurface/copy/metrics.js +8 -0
  85. package/dist/testSurface/copy/readiness.d.ts +3 -3
  86. package/dist/testSurface/copy/readiness.js +5 -5
  87. package/dist/testSurface/copy/recommendation.d.ts +4 -4
  88. package/dist/testSurface/copy/recommendation.js +4 -4
  89. package/dist/testSurface/copy/results.d.ts +13 -9
  90. package/dist/testSurface/copy/results.js +15 -9
  91. package/dist/testSurface/copy/review.d.ts +12 -9
  92. package/dist/testSurface/copy/review.js +13 -9
  93. package/dist/testSurface/copy/setting.d.ts +1 -2
  94. package/dist/testSurface/copy/setting.js +1 -2
  95. package/dist/testSurface/copy/surface.js +1 -1
  96. package/dist/testSurface/copy/testPage.d.ts +13 -9
  97. package/dist/testSurface/copy/testPage.js +16 -13
  98. package/dist/testSurface/format/date.d.ts +1 -0
  99. package/dist/testSurface/format/date.js +11 -0
  100. package/dist/testSurface/labels.d.ts +1 -2
  101. package/dist/testSurface/labels.js +2 -3
  102. package/dist/testSurface/lockedNotice.model.d.ts +2 -0
  103. package/dist/testSurface/lockedNotice.model.js +31 -0
  104. package/dist/testSurface/results/results.model.d.ts +3 -2
  105. package/dist/testSurface/results/results.model.js +10 -9
  106. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
  107. package/dist/testSurface/surface/pageBlock/parts.js +17 -7
  108. package/dist/testSurface/surface/pagePicker/PageCombobox.js +0 -5
  109. package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +1 -1
  110. package/dist/testSurface/surface/readiness/ActionDialogs.js +54 -33
  111. package/dist/testSurface/surface/readiness/Banner.d.ts +3 -1
  112. package/dist/testSurface/surface/readiness/Banner.js +86 -75
  113. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
  114. package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
  115. package/dist/testSurface/surface/readiness/readiness.model.js +1 -1
  116. package/dist/testSurface/surface/results/ResultsBody.d.ts +4 -1
  117. package/dist/testSurface/surface/results/ResultsBody.js +119 -80
  118. package/dist/testSurface/surface/results/recommendation.model.js +3 -3
  119. package/dist/testSurface/surface/setting/parts.js +31 -28
  120. package/dist/testSurface/surface/setting/setting.css +2 -1
  121. package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
  122. package/dist/testSurface/surface/test/GoalSection.js +11 -11
  123. package/dist/testSurface/surface/test/LengthSection.js +20 -13
  124. package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
  125. package/dist/testSurface/surface/test/PageHoldout.js +7 -7
  126. package/dist/testSurface/surface/test/ReadinessBar.d.ts +1 -1
  127. package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
  128. package/dist/testSurface/surface/test/Section.js +8 -0
  129. package/dist/testSurface/surface/test/TargetingSection.js +7 -2
  130. package/dist/testSurface/surface/test/VersionsSection.js +88 -68
  131. package/dist/testSurface/surface/test/fields.d.ts +4 -3
  132. package/dist/testSurface/surface/test/fields.js +10 -16
  133. package/dist/testSurface/surface/test/pageParts.js +3 -1
  134. package/dist/testSurface/surface/test/testPage.css +9 -1
  135. package/dist/testSurface/surfaceUrls.d.ts +1 -0
  136. package/dist/testSurface/surfaceUrls.js +4 -0
  137. package/dist/ui/Dialog.js +25 -0
  138. package/dist/ui/Inputs.js +0 -1
  139. package/dist/ui/ui.css +1 -0
  140. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
+ import { holdoutContent } from '../../copy/audience.js';
5
+ import { actionGroupLabel } from '../../actions/actions.model.js';
4
6
  import { TEST_PAGE as C } from '../../copy/testPage.js';
5
7
  import { pageTargetIssue, setPageTarget, showsPageTarget } from '../../arms/pageTarget.model.js';
6
8
  import { normalisePath } from '../../../runtime/normalisePath.js';
@@ -21,7 +23,7 @@ export function VersionContent({ test, surface, armIndex }) {
21
23
  if (!arm || !doc) return null;
22
24
  if (!showsPageTarget(doc.kind, arm.kind)) return /*#__PURE__*/ _jsx("span", {
23
25
  className: "xp-content-chip",
24
- children: C.holdoutContent
26
+ children: holdoutContent(actionGroupLabel('control', test.doc?.arms.find((arm)=>arm.key === 'control')?.label))
25
27
  });
26
28
  const placement = test.preflight?.pagePlacements?.find((entry)=>entry.arm === arm.key && entry.collection === collection?.slug && entry.id != null && arm.pageTarget && normalisePath(entry.path) === normalisePath(arm.pageTarget));
27
29
  if (collection && !wasUsingAddress) {
@@ -32,7 +32,11 @@
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
- :where(.xp-test-surface) .xp-read-only p { margin-block: .5rem; }
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; }
37
+ :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; }
36
40
  :where(.xp-test-surface) .xp-field-error { color: var(--xp-error-text); }
37
41
 
38
42
  :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); }
@@ -46,6 +50,10 @@
46
50
  :where(.xp-test-surface) .xp-targeting-row, :where(.xp-test-surface) .xp-field-grid { grid-template-columns: 1fr; }
47
51
  }
48
52
 
53
+ :where(.xp-test-surface) .xp-version-rows.xp-version-rows--setting { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
54
+ :where(.xp-test-surface) .xp-version-rows--setting .xp-version-row { align-items: start; }
55
+ :where(.xp-test-surface) .xp-version-rows--setting .xp-setting-values { grid-column: 2; min-width: 0; }
56
+
49
57
  :where(.xp-test-surface) .xp-test-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: var(--xp-space-8); }
50
58
  :where(.xp-test-surface) .xp-test-content { display: grid; gap: var(--xp-space-8); min-width: 0; max-width: 760px; }
51
59
  :where(.xp-test-surface) .xp-test-rail { position: sticky; top: var(--xp-space-6); min-width: 0; }
@@ -2,6 +2,7 @@ type SurfaceQuery = Record<string, string | string[] | undefined>;
2
2
  export declare function surfaceQuery(query?: SurfaceQuery): string;
3
3
  export declare const surfaceUrls: {
4
4
  home: (adminRoute: string, query?: SurfaceQuery) => string;
5
+ newGoal: (adminRoute: string, query?: SurfaceQuery) => string;
5
6
  goals: (adminRoute: string, query?: SurfaceQuery) => string;
6
7
  };
7
8
  export {};
@@ -12,6 +12,10 @@ export const surfaceUrls = {
12
12
  adminRoute,
13
13
  path: `/collections/xp-experiments${surfaceQuery(query)}`
14
14
  }),
15
+ newGoal: (adminRoute, query)=>formatAdminURL({
16
+ adminRoute,
17
+ path: `/experiments/goals/new${surfaceQuery(query)}`
18
+ }),
15
19
  goals: (adminRoute, query)=>formatAdminURL({
16
20
  adminRoute,
17
21
  path: `/collections/xp-metrics${surfaceQuery(query)}`
package/dist/ui/Dialog.js CHANGED
@@ -3,6 +3,29 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useEffect, useId, useRef } from 'react';
4
4
  import { Button } from './Button.js';
5
5
  import './ui.css';
6
+ const modalBackgrounds = new WeakMap();
7
+ function inertBackground(dialog) {
8
+ const elements = [
9
+ ...dialog.ownerDocument.querySelectorAll('[data-dialog-background]')
10
+ ].filter((element)=>!element.contains(dialog));
11
+ for (const element of elements){
12
+ const state = modalBackgrounds.get(element) ?? {
13
+ dialogs: 0,
14
+ wasInert: element.hasAttribute('inert')
15
+ };
16
+ state.dialogs++;
17
+ modalBackgrounds.set(element, state);
18
+ element.setAttribute('inert', '');
19
+ }
20
+ return ()=>{
21
+ for (const element of elements){
22
+ const state = modalBackgrounds.get(element);
23
+ if (--state.dialogs > 0) continue;
24
+ if (!state.wasInert) element.removeAttribute('inert');
25
+ modalBackgrounds.delete(element);
26
+ }
27
+ };
28
+ }
6
29
  function focusable(node) {
7
30
  return [
8
31
  ...node.querySelectorAll('button, a[href], input, select, textarea, [tabindex]')
@@ -53,6 +76,7 @@ function focusable(node) {
53
76
  doc.addEventListener('pointerup', up, true);
54
77
  doc.addEventListener('pointercancel', cancel, true);
55
78
  node.showModal();
79
+ const restoreBackground = inertBackground(node);
56
80
  const elements = focusable(node);
57
81
  const preferred = initialFocus === 'cancel' ? elements.find((element)=>element.hasAttribute('data-dialog-cancel')) : undefined;
58
82
  (preferred ?? elements[0] ?? node).focus();
@@ -60,6 +84,7 @@ function focusable(node) {
60
84
  doc.removeEventListener('pointerdown', down, true);
61
85
  doc.removeEventListener('pointerup', up, true);
62
86
  doc.removeEventListener('pointercancel', cancel, true);
87
+ restoreBackground();
63
88
  node.close();
64
89
  if (previous?.isConnected) previous.focus();
65
90
  if (doc.activeElement === doc.body && scope?.isConnected) {
package/dist/ui/Inputs.js CHANGED
@@ -85,7 +85,6 @@ export function Select({ label, labelAction, help, error, ...props }) {
85
85
  labelAction: labelAction,
86
86
  children: /*#__PURE__*/ _jsx(SelectControl, {
87
87
  ...props,
88
- "aria-labelledby": props['aria-labelledby'] ?? (props['aria-label'] ? undefined : `${props.id}-label`),
89
88
  "aria-invalid": Boolean(error) || props['aria-invalid'] || undefined,
90
89
  "aria-describedby": described(field, props['aria-describedby'])
91
90
  })
package/dist/ui/ui.css CHANGED
@@ -70,6 +70,7 @@
70
70
  .xp-ui-breadcrumb [aria-current] { color: var(--xp-text); }
71
71
  .xp-ui-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 24px; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); color: var(--xp-text); font: var(--xp-text-body); box-shadow: 0 16px 48px var(--xp-overlay); }
72
72
  .xp-ui-dialog h2 { margin: 0 0 16px; font: var(--xp-text-title); overflow-wrap: anywhere; }
73
+ .xp-ui-dialog > [id]:has(+ :is(.xp-ui-field, .xp-ui-banner)), .xp-ui-dialog > .xp-ui-banner:has(+ .xp-ui-field) { margin-block-end: var(--xp-space-4); }
73
74
  .xp-ui-dialog::backdrop { background: var(--xp-overlay); }
74
75
  .xp-ui-chips { width: 100%; max-width: 100%; min-width: 0; display: grid; gap: var(--xp-space-2); margin-block: var(--xp-space-4); color: var(--xp-text); font-family: var(--xp-font-body); }
75
76
  .xp-ui-chips-control { width: 100%; max-width: 100%; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-1); padding: var(--xp-space-2); border: 1px solid var(--xp-border-control); border-radius: var(--xp-radius); background: var(--xp-input-bg); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delmaredigital/payload-experiments",
3
- "version": "0.4.0-rc.10",
3
+ "version": "0.4.0-rc.11",
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",