@delmaredigital/payload-experiments 0.4.0-rc.4 → 0.4.0-rc.6

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 (123) hide show
  1. package/dist/admin/copy/newTest.d.ts +1 -1
  2. package/dist/admin/copy/newTest.js +1 -1
  3. package/dist/admin/surface/ResultsRoute.js +2 -10
  4. package/dist/admin/surface/newTest/NewTest.js +16 -18
  5. package/dist/admin/surface/newTest/PageWizard.js +10 -12
  6. package/dist/admin/surface/newTest/newTest.css +3 -1
  7. package/dist/admin/surface/results/ResultsHeader.js +15 -8
  8. package/dist/blocks/bindings.js +6 -13
  9. package/dist/blocks/placementLocale.d.ts +2 -0
  10. package/dist/blocks/placementLocale.js +16 -12
  11. package/dist/goals/fairness.d.ts +1 -1
  12. package/dist/goals/fairness.js +9 -7
  13. package/dist/hooks/blockRemovalRule.d.ts +2 -1
  14. package/dist/hooks/blockRemovalRule.js +27 -5
  15. package/dist/hooks/pageGuard.js +2 -2
  16. package/dist/puck/ExperimentPicker.d.ts +2 -1
  17. package/dist/puck/ExperimentPicker.js +34 -30
  18. package/dist/puck/ExperimentSlot.js +3 -1
  19. package/dist/puck/copy.d.ts +1 -0
  20. package/dist/puck/copy.js +1 -0
  21. package/dist/puck/editor/ConfigureTestDrawer.js +2 -2
  22. package/dist/puck/editor/CreateExperimentDrawer.d.ts +2 -1
  23. package/dist/puck/editor/CreateExperimentDrawer.js +24 -16
  24. package/dist/puck/editor/EditorControls.d.ts +1 -1
  25. package/dist/puck/editor/EditorControls.js +1 -1
  26. package/dist/puck/editor/ExperimentSlotEditor.js +624 -299
  27. package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
  28. package/dist/puck/editor/LeftoverVersions.js +97 -0
  29. package/dist/puck/editor/PlacementNotice.d.ts +8 -0
  30. package/dist/puck/editor/PlacementNotice.js +22 -0
  31. package/dist/puck/editor/QuickTestActions.d.ts +3 -0
  32. package/dist/puck/editor/QuickTestActions.js +50 -0
  33. package/dist/puck/editor/ResultsReadout.js +5 -0
  34. package/dist/puck/editor/VersionBuilder.d.ts +37 -12
  35. package/dist/puck/editor/VersionBuilder.js +273 -184
  36. package/dist/puck/editor/armWrites.d.ts +11 -2
  37. package/dist/puck/editor/armWrites.js +42 -3
  38. package/dist/puck/editor/armsCache.d.ts +1 -1
  39. package/dist/puck/editor/armsCache.js +2 -1
  40. package/dist/puck/editor/cloneSlot.d.ts +2 -0
  41. package/dist/puck/editor/cloneSlot.js +7 -0
  42. package/dist/puck/editor/copy.d.ts +35 -20
  43. package/dist/puck/editor/copy.js +35 -20
  44. package/dist/puck/editor/createTest.d.ts +3 -0
  45. package/dist/puck/editor/createTest.js +33 -0
  46. package/dist/puck/editor/editor.chrome.css +32 -14
  47. package/dist/puck/editor/editor.css +58 -17
  48. package/dist/puck/editor/editor.model.d.ts +1 -1
  49. package/dist/puck/editor/editor.model.js +2 -2
  50. package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
  51. package/dist/puck/editor/localPlacements.d.ts +4 -2
  52. package/dist/puck/editor/localPlacements.js +20 -18
  53. package/dist/puck/editor/outlineVersion.d.ts +5 -0
  54. package/dist/puck/editor/outlineVersion.js +36 -0
  55. package/dist/puck/editor/placementsCache.d.ts +33 -2
  56. package/dist/puck/editor/placementsCache.js +208 -33
  57. package/dist/puck/editor/sidebar.d.ts +8 -0
  58. package/dist/puck/editor/sidebar.js +74 -0
  59. package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
  60. package/dist/puck/editor/usePlacementNotice.js +14 -0
  61. package/dist/puck/visibility.d.ts +21 -0
  62. package/dist/puck/visibility.js +77 -0
  63. package/dist/server/recordContentChange.js +3 -1
  64. package/dist/server/resolveExperimentData.js +4 -1
  65. package/dist/testSurface/api.js +1 -1
  66. package/dist/testSurface/copy/common.d.ts +1 -1
  67. package/dist/testSurface/copy/common.js +3 -1
  68. package/dist/testSurface/copy/readiness.d.ts +18 -1
  69. package/dist/testSurface/copy/readiness.js +23 -1
  70. package/dist/testSurface/copy/testPage.d.ts +8 -6
  71. package/dist/testSurface/copy/testPage.js +8 -6
  72. package/dist/testSurface/readPreflight.d.ts +9 -0
  73. package/dist/testSurface/readPreflight.js +38 -0
  74. package/dist/testSurface/readinessRead.d.ts +50 -0
  75. package/dist/testSurface/readinessRead.js +46 -0
  76. package/dist/testSurface/results/results.css +1 -1
  77. package/dist/testSurface/results/results.model.d.ts +1 -1
  78. package/dist/testSurface/surface/contracts.d.ts +6 -2
  79. package/dist/testSurface/surface/editorPlacement.d.ts +21 -0
  80. package/dist/testSurface/surface/editorPlacement.js +60 -0
  81. package/dist/testSurface/surface/pageBlock/parts.js +13 -3
  82. package/dist/testSurface/surface/readiness/ActionDialogs.js +65 -41
  83. package/dist/testSurface/surface/readiness/Banner.d.ts +1 -4
  84. package/dist/testSurface/surface/readiness/Banner.js +106 -68
  85. package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
  86. package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
  87. package/dist/testSurface/surface/readiness/SaveStatus.d.ts +6 -2
  88. package/dist/testSurface/surface/readiness/SaveStatus.js +35 -22
  89. package/dist/testSurface/surface/readiness/parts.js +0 -2
  90. package/dist/testSurface/surface/readiness/readiness.model.d.ts +13 -0
  91. package/dist/testSurface/surface/readiness/readiness.model.js +51 -36
  92. package/dist/testSurface/surface/readiness/useTransition.d.ts +5 -2
  93. package/dist/testSurface/surface/readiness/useTransition.js +69 -7
  94. package/dist/testSurface/surface/test/AdvancedSection.js +1 -0
  95. package/dist/testSurface/surface/test/GoalSection.js +102 -74
  96. package/dist/testSurface/surface/test/LengthSection.d.ts +1 -1
  97. package/dist/testSurface/surface/test/LengthSection.js +2 -1
  98. package/dist/testSurface/surface/test/Rail.js +7 -4
  99. package/dist/testSurface/surface/test/ReadinessBar.js +1 -2
  100. package/dist/testSurface/surface/test/Section.d.ts +3 -1
  101. package/dist/testSurface/surface/test/Section.js +38 -6
  102. package/dist/testSurface/surface/test/TargetingSection.js +5 -0
  103. package/dist/testSurface/surface/test/TestSurface.d.ts +2 -1
  104. package/dist/testSurface/surface/test/TestSurface.js +68 -7
  105. package/dist/testSurface/surface/test/VersionsSection.js +1 -0
  106. package/dist/testSurface/surface/test/fields.d.ts +1 -3
  107. package/dist/testSurface/surface/test/fields.js +5 -35
  108. package/dist/testSurface/surface/test/testPage.css +12 -0
  109. package/dist/testSurface/surface/useTestDocument.d.ts +5 -2
  110. package/dist/testSurface/surface/useTestDocument.js +61 -46
  111. package/dist/testSurface/useReadinessPolling.d.ts +3 -0
  112. package/dist/testSurface/useReadinessPolling.js +24 -0
  113. package/dist/transitions/makeContent.js +24 -5
  114. package/dist/transitions/placements.js +23 -34
  115. package/dist/transitions/preflightData.js +1 -1
  116. package/dist/types/puck.d.ts +1 -0
  117. package/dist/ui/Card.d.ts +2 -1
  118. package/dist/ui/Card.js +4 -4
  119. package/dist/ui/Inputs.js +8 -5
  120. package/dist/ui/Tabs.d.ts +2 -2
  121. package/dist/ui/Tabs.js +33 -32
  122. package/dist/ui/ui.css +26 -3
  123. package/package.json +1 -1
@@ -10,7 +10,7 @@ import { TEST_PAGE } from '../../testSurface/copy/testPage.js';
10
10
  import { readSurface, useEditorSurface } from './editorSurface.js';
11
11
  import { editorCopy as C } from './copy.js';
12
12
  import { publishExperiment } from './armsCache.js';
13
- import { publishPlacements } from './placementsCache.js';
13
+ import { readEditorPreflight } from './placementsCache.js';
14
14
  import './editor.css';
15
15
  export function ConfigureTestDrawer({ id, routes, onClose }) {
16
16
  const [title, setTitle] = useState(C.configure);
@@ -67,7 +67,7 @@ export function ConfigureTestDrawer({ id, routes, onClose }) {
67
67
  embedded: true,
68
68
  onTitleChange: setTitle,
69
69
  onDocument: (doc)=>publishExperiment(id, doc),
70
- onPreflight: (preflight)=>publishPlacements(routes.api, id, preflight.placements)
70
+ requestPreflight: (signal, supersede)=>readEditorPreflight(routes.api, id, signal, supersede)
71
71
  }) : /*#__PURE__*/ _jsxs("div", {
72
72
  role: state.error ? 'alert' : 'status',
73
73
  children: [
@@ -2,7 +2,8 @@ import type { resolvePuckRoutes } from '../routes.js';
2
2
  import type { ExperimentRef } from '../../types/puck.js';
3
3
  import type { Arm } from '../../types/contracts.js';
4
4
  import './editor.css';
5
- export declare function CreateExperimentDrawer({ onCreate, onClose, initialName, arms, label, onPendingChange }: {
5
+ export declare function CreateExperimentDrawer({ onCreate, onClose, initialName, arms, label, onPendingChange, created }: {
6
+ created?: ExperimentRef;
6
7
  initialName?: string;
7
8
  arms?: Arm[] | (() => Promise<Arm[]>);
8
9
  label?: string;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useId, useRef, useState } from 'react';
4
4
  import { Dialog } from '../../ui/Dialog.js';
5
5
  import { TextInput } from '../../ui/TextInput.js';
@@ -11,14 +11,14 @@ import { CreateRefused, createTest } from './createTest.js';
11
11
  import { editorCopy } from './copy.js';
12
12
  import { invalidatePlacements } from './placementsCache.js';
13
13
  import './editor.css';
14
- export function CreateExperimentDrawer({ onCreate, onClose, initialName = '', arms, label = editorCopy.createLabel, onPendingChange }) {
14
+ export function CreateExperimentDrawer({ onCreate, onClose, initialName = '', arms, label = editorCopy.createAnother, onPendingChange, created }) {
15
15
  const { api, admin } = usePuckRoutes();
16
16
  const nameId = useId();
17
17
  const [name, setName] = useState(initialName);
18
18
  const inFlight = useRef(false);
19
19
  const [pending, setPending] = useState(false);
20
20
  const [error, setError] = useState('');
21
- const [unbound, setUnbound] = useState();
21
+ const [unbound, setUnbound] = useState(created);
22
22
  async function submitNew() {
23
23
  if (inFlight.current || !name.trim()) return;
24
24
  inFlight.current = true;
@@ -64,28 +64,36 @@ export function CreateExperimentDrawer({ onCreate, onClose, initialName = '', ar
64
64
  })
65
65
  ]
66
66
  }) : null,
67
- /*#__PURE__*/ _jsx(TextInput, {
68
- id: nameId,
69
- label: editorCopy.name,
70
- value: name,
71
- disabled: pending,
72
- onChange: (event)=>setName(event.currentTarget.value)
73
- }),
74
- error ? /*#__PURE__*/ _jsx(Banner, {
75
- tone: "error",
76
- children: error
67
+ !unbound ? /*#__PURE__*/ _jsxs(_Fragment, {
68
+ children: [
69
+ /*#__PURE__*/ _jsx(TextInput, {
70
+ id: nameId,
71
+ label: editorCopy.name,
72
+ value: name,
73
+ disabled: pending,
74
+ onChange: (event)=>setName(event.currentTarget.value)
75
+ }),
76
+ error ? /*#__PURE__*/ _jsx(Banner, {
77
+ tone: "error",
78
+ children: error
79
+ }) : null,
80
+ !name.trim() ? /*#__PURE__*/ _jsx("p", {
81
+ className: "xp-ui-help",
82
+ children: editorCopy.enterName
83
+ }) : null
84
+ ]
77
85
  }) : null,
78
86
  /*#__PURE__*/ _jsxs("div", {
79
87
  className: "xp-ui-button-group",
80
88
  children: [
81
- /*#__PURE__*/ _jsx(Button, {
89
+ !unbound ? /*#__PURE__*/ _jsx(Button, {
82
90
  variant: "primary",
83
- disabled: pending || !!unbound || !name.trim(),
91
+ disabled: pending || !name.trim(),
84
92
  onClick: ()=>{
85
93
  void submitNew();
86
94
  },
87
95
  children: pending ? editorCopy.creating : label
88
- }),
96
+ }) : null,
89
97
  /*#__PURE__*/ _jsx(Button, {
90
98
  disabled: pending,
91
99
  onClick: onClose,
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- export declare const CONTROL_SELECTOR = "button, a, label, input, select, textarea, [role=\"tab\"], [role=\"menu\"], [role=\"listbox\"], dialog, [role=\"dialog\"], [contenteditable=\"true\"]";
2
+ export declare const CONTROL_SELECTOR = "button, a, summary, label, input, select, textarea, [role=\"tab\"], [role=\"menu\"], [role=\"listbox\"], dialog, [role=\"dialog\"], [contenteditable=\"true\"]";
3
3
  /** Give React a delegation boundary before Puck's native component click listeners.
4
4
  * A normal React onClick runs too late: native child/parent selection already ran.
5
5
  * The portal target is this chrome element in the canvas's ownerDocument, so
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { registerOverlayPortal, useGetPuck } from '@puckeditor/core';
4
4
  import { useEffect, useRef, useState } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
- export const CONTROL_SELECTOR = 'button, a, label, input, select, textarea, [role="tab"], [role="menu"], [role="listbox"], dialog, [role="dialog"], [contenteditable="true"]';
6
+ export const CONTROL_SELECTOR = 'button, a, summary, label, input, select, textarea, [role="tab"], [role="menu"], [role="listbox"], dialog, [role="dialog"], [contenteditable="true"]';
7
7
  /** Give React a delegation boundary before Puck's native component click listeners.
8
8
  * A normal React onClick runs too late: native child/parent selection already ran.
9
9
  * The portal target is this chrome element in the canvas's ownerDocument, so