@delmaredigital/payload-experiments 0.4.0-rc.5 → 0.4.0-rc.7
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.
- package/dist/admin/blocks/BlockPanel.js +6 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +8 -4
- package/dist/admin/copy/blocks.d.ts +3 -2
- package/dist/admin/copy/blocks.js +7 -6
- package/dist/admin/copy/newTest.d.ts +1 -1
- package/dist/admin/copy/newTest.js +1 -1
- package/dist/admin/surface/ResultsRoute.js +2 -1
- package/dist/admin/surface/TestsHome.d.ts +2 -1
- package/dist/admin/surface/TestsHome.js +91 -37
- package/dist/admin/surface/TestsSurface.js +3 -0
- package/dist/admin/surface/home.model.d.ts +2 -0
- package/dist/admin/surface/newTest/NewTest.js +16 -18
- package/dist/admin/surface/newTest/PageWizard.js +1 -0
- package/dist/admin/surface/newTest/newTest.css +3 -1
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +11 -0
- package/dist/admin/views/buildSurfaceProps.js +10 -3
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +23 -7
- package/dist/blocks/placementLocale.js +221 -66
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.js +8 -4
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +206 -0
- package/dist/endpoints/index.js +7 -0
- package/dist/endpoints/pages.js +7 -3
- package/dist/endpoints/placementStatus.js +6 -1
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/index.d.ts +1 -1
- package/dist/goals/fairness.js +43 -34
- package/dist/hooks/blockRemovalRule.d.ts +4 -3
- package/dist/hooks/blockRemovalRule.js +33 -9
- package/dist/hooks/pageGuard.d.ts +3 -0
- package/dist/hooks/pageGuard.js +34 -24
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/lib/placementPages.d.ts +2 -1
- package/dist/lib/placementPages.js +10 -2
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +5 -1
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +37 -30
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +1 -0
- package/dist/puck/copy.js +1 -0
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +8 -4
- package/dist/puck/editor/ConfigureTestDrawer.js +4 -2
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +2 -1
- package/dist/puck/editor/CreateExperimentDrawer.js +24 -20
- package/dist/puck/editor/EditorControls.d.ts +1 -1
- package/dist/puck/editor/EditorControls.js +1 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +405 -394
- package/dist/puck/editor/LeftoverVersions.d.ts +4 -2
- package/dist/puck/editor/LeftoverVersions.js +23 -44
- package/dist/puck/editor/QuickTestActions.js +2 -2
- package/dist/puck/editor/VersionBuilder.d.ts +41 -13
- package/dist/puck/editor/VersionBuilder.js +461 -224
- package/dist/puck/editor/armWrites.d.ts +9 -2
- package/dist/puck/editor/armWrites.js +40 -2
- package/dist/puck/editor/armsCache.d.ts +1 -1
- package/dist/puck/editor/armsCache.js +2 -1
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/copy.d.ts +27 -26
- package/dist/puck/editor/copy.js +28 -26
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +138 -17
- package/dist/puck/editor/editor.css +156 -22
- package/dist/puck/editor/editor.model.d.ts +2 -1
- package/dist/puck/editor/editor.model.js +3 -3
- package/dist/puck/editor/experimentOutlinePlugin.js +1 -1
- package/dist/puck/editor/localPlacements.d.ts +5 -2
- package/dist/puck/editor/localPlacements.js +32 -18
- package/dist/puck/editor/placementsCache.d.ts +18 -12
- package/dist/puck/editor/placementsCache.js +52 -47
- package/dist/puck/editor/sidebar.d.ts +2 -6
- package/dist/puck/editor/sidebar.js +3 -6
- package/dist/puck/editor/usePlacementNotice.d.ts +1 -1
- package/dist/puck/editor/usePlacementNotice.js +4 -3
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/server/recordContentChange.js +37 -20
- package/dist/server/resolveExperimentData.js +6 -3
- package/dist/testSurface/PreviewLinks.js +6 -2
- package/dist/testSurface/api.d.ts +6 -3
- package/dist/testSurface/api.js +10 -6
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/testSurface/copy/common.d.ts +4 -0
- package/dist/testSurface/copy/common.js +8 -4
- package/dist/testSurface/copy/languages.d.ts +11 -0
- package/dist/testSurface/copy/languages.js +7 -0
- package/dist/testSurface/copy/readiness.d.ts +2 -1
- package/dist/testSurface/copy/readiness.js +2 -1
- package/dist/testSurface/copy/testPage.d.ts +28 -6
- package/dist/testSurface/copy/testPage.js +28 -6
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/testSurface/placements/placementLabels.d.ts +2 -0
- package/dist/testSurface/placements/placementLabels.js +2 -1
- package/dist/testSurface/results/results.css +1 -1
- package/dist/testSurface/results/results.model.d.ts +1 -1
- package/dist/testSurface/surface/contracts.d.ts +2 -0
- package/dist/testSurface/surface/editorPlacement.d.ts +5 -0
- package/dist/testSurface/surface/editorPlacement.js +18 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +2 -1
- package/dist/testSurface/surface/pageBlock/parts.js +24 -6
- package/dist/testSurface/surface/readiness/ActionDialogs.js +28 -34
- package/dist/testSurface/surface/readiness/readiness.model.js +9 -2
- package/dist/testSurface/surface/results/useResults.d.ts +4 -1
- package/dist/testSurface/surface/test/DeleteTest.d.ts +15 -0
- package/dist/testSurface/surface/test/DeleteTest.js +171 -0
- package/dist/testSurface/surface/test/GoalSection.js +101 -74
- package/dist/testSurface/surface/test/TestSurface.js +29 -9
- package/dist/testSurface/surface/test/fields.d.ts +1 -3
- package/dist/testSurface/surface/test/fields.js +5 -35
- package/dist/testSurface/surface/useTestDocument.d.ts +2 -1
- package/dist/testSurface/surface/useTestDocument.js +20 -4
- package/dist/testSurface/useApi.d.ts +4 -1
- package/dist/transitions/checkStart.d.ts +4 -1
- package/dist/transitions/checkStart.js +117 -14
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/makeContent.js +29 -9
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +33 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/placementInteractions.js +7 -4
- package/dist/transitions/placements.d.ts +26 -1
- package/dist/transitions/placements.js +239 -87
- package/dist/transitions/preflightData.d.ts +2 -1
- package/dist/transitions/preflightData.js +66 -3
- package/dist/transitions/start.js +4 -1
- package/dist/types/endpoints.d.ts +35 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/surface.d.ts +2 -0
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +7 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +0 -1
- package/dist/ui/Tabs.js +28 -40
- package/dist/ui/ui.css +18 -5
- package/package.json +3 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ArmSlot } from '../../types/puck.js';
|
|
2
2
|
import type { EditorExperiment } from './editor.model.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ArmWrites } from './VersionBuilder.js';
|
|
4
4
|
/** Page content stays editable even when it does not belong to the selected test. */
|
|
5
|
-
export declare function LeftoverVersions({ slots, experiment, writes, canManage, countBlocks, onDelete, onSelect }: {
|
|
5
|
+
export declare function LeftoverVersions({ slots, experiment, writes, canManage, countBlocks, onDelete, onSelect, active, dragging }: {
|
|
6
|
+
active: ArmSlot;
|
|
7
|
+
dragging: boolean;
|
|
6
8
|
slots: ArmSlot[];
|
|
7
9
|
experiment: EditorExperiment;
|
|
8
10
|
writes: ArmWrites;
|
|
@@ -6,45 +6,47 @@ import { Dialog } from '../../ui/Dialog.js';
|
|
|
6
6
|
import { slotLabels } from '../copy.js';
|
|
7
7
|
import { editorCopy as C } from './copy.js';
|
|
8
8
|
import { tabsFor } from './editor.model.js';
|
|
9
|
-
|
|
9
|
+
import { VersionCard } from './VersionBuilder.js';
|
|
10
|
+
import { addLeftoverArms } from './armWrites.js';
|
|
11
|
+
/** Page content stays editable even when it does not belong to the selected test. */ export function LeftoverVersions({ slots, experiment, writes, canManage, countBlocks, onDelete, onSelect, active, dragging }) {
|
|
10
12
|
const [deleting, setDeleting] = useState(null);
|
|
11
13
|
const versions = new Intl.ListFormat('en', {
|
|
12
14
|
style: 'long',
|
|
13
15
|
type: 'conjunction'
|
|
14
16
|
}).format(tabsFor(experiment).map((tab)=>tab.label));
|
|
15
|
-
const notice = (slot)=>/*#__PURE__*/ _jsxs(
|
|
17
|
+
const notice = (slot)=>/*#__PURE__*/ _jsxs(VersionCard, {
|
|
18
|
+
label: C.outsideTest(slotLabels[slot]),
|
|
19
|
+
openLabel: slotLabels[slot],
|
|
20
|
+
active: active === slot,
|
|
21
|
+
dragging: dragging,
|
|
22
|
+
onSelect: ()=>onSelect(slot),
|
|
16
23
|
children: [
|
|
24
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
25
|
+
className: "xp-slot-version-label",
|
|
26
|
+
children: C.outsideTest(slotLabels[slot])
|
|
27
|
+
}),
|
|
17
28
|
/*#__PURE__*/ _jsx("p", {
|
|
29
|
+
className: "xp-ui-help xp-slot-version-help",
|
|
18
30
|
children: C.orphan(slotLabels[slot], versions)
|
|
19
31
|
}),
|
|
20
32
|
/*#__PURE__*/ _jsxs("div", {
|
|
21
|
-
className: "xp-
|
|
33
|
+
className: "xp-slot-version-actions",
|
|
22
34
|
children: [
|
|
23
35
|
canManage && experiment.status === 'draft' ? /*#__PURE__*/ _jsx(Button, {
|
|
24
|
-
|
|
36
|
+
size: "sm",
|
|
37
|
+
"aria-disabled": writes.busy || undefined,
|
|
25
38
|
onClick: async ()=>{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
];
|
|
31
|
-
const holdout = next.findIndex((arm)=>arm.kind === 'holdout');
|
|
32
|
-
next.splice(holdout < 0 ? next.length : holdout, 0, {
|
|
33
|
-
key: slot,
|
|
34
|
-
slot,
|
|
35
|
-
kind: 'variant',
|
|
36
|
-
label: slotLabels[slot],
|
|
37
|
-
weight: 0
|
|
38
|
-
});
|
|
39
|
-
return next;
|
|
40
|
-
}, {
|
|
41
|
-
draftOnly: true
|
|
39
|
+
if (writes.busy) return;
|
|
40
|
+
const saved = await writes.write((arms)=>addLeftoverArms(arms, slot), {
|
|
41
|
+
draftOnly: true,
|
|
42
|
+
errorKey: `leftover:${slot}`
|
|
42
43
|
});
|
|
43
44
|
if (saved) onSelect(slot);
|
|
44
45
|
},
|
|
45
46
|
children: C.addLeftover
|
|
46
47
|
}) : null,
|
|
47
48
|
/*#__PURE__*/ _jsx(Button, {
|
|
49
|
+
size: "sm",
|
|
48
50
|
onClick: ()=>setDeleting(slot),
|
|
49
51
|
children: C.deleteContent
|
|
50
52
|
})
|
|
@@ -54,30 +56,7 @@ import { tabsFor } from './editor.model.js';
|
|
|
54
56
|
}, slot);
|
|
55
57
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
56
58
|
children: [
|
|
57
|
-
slots.
|
|
58
|
-
className: "xp-ui-banner xp-ui-banner--warning xp-slot-leftovers",
|
|
59
|
-
children: [
|
|
60
|
-
/*#__PURE__*/ _jsxs("summary", {
|
|
61
|
-
children: [
|
|
62
|
-
/*#__PURE__*/ _jsx("span", {
|
|
63
|
-
"aria-hidden": "true",
|
|
64
|
-
children: "⚠ "
|
|
65
|
-
}),
|
|
66
|
-
C.leftovers(slots.map((slot)=>slotLabels[slot]).join(', '))
|
|
67
|
-
]
|
|
68
|
-
}),
|
|
69
|
-
slots.map(notice)
|
|
70
|
-
]
|
|
71
|
-
}) : slots.map((slot)=>/*#__PURE__*/ _jsxs("div", {
|
|
72
|
-
className: "xp-ui-banner xp-ui-banner--warning xp-slot-leftovers",
|
|
73
|
-
children: [
|
|
74
|
-
/*#__PURE__*/ _jsx("span", {
|
|
75
|
-
"aria-hidden": "true",
|
|
76
|
-
children: "⚠"
|
|
77
|
-
}),
|
|
78
|
-
notice(slot)
|
|
79
|
-
]
|
|
80
|
-
}, slot)),
|
|
59
|
+
slots.map(notice),
|
|
81
60
|
deleting ? /*#__PURE__*/ _jsx(Dialog, {
|
|
82
61
|
open: true,
|
|
83
62
|
title: C.deleteContentTitle(slotLabels[deleting]),
|
|
@@ -15,7 +15,7 @@ import { createApi } from '../../testSurface/api.js';
|
|
|
15
15
|
const action = availableActions({
|
|
16
16
|
...doc,
|
|
17
17
|
canManage: surface.canManage
|
|
18
|
-
}).find((item)=>doc.status === 'draft' ? item.id === 'start' : doc.status === 'running' && item.id === 'stop');
|
|
18
|
+
}).find((item)=>doc.status === 'draft' || doc.status === 'stopped' ? item.id === 'start' : doc.status === 'running' && item.id === 'stop');
|
|
19
19
|
if (!action) return null;
|
|
20
20
|
const ready = !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
21
21
|
const showAction = action.id !== 'start' || readyToStart(test, surface.editorPlacementMessage) && !test.hasUnsaved;
|
|
@@ -29,7 +29,7 @@ import { createApi } from '../../testSurface/api.js';
|
|
|
29
29
|
disabled: transition.busy || confirm || test.hasUnsaved || action.id === 'start' && !ready,
|
|
30
30
|
busy: transition.busy,
|
|
31
31
|
onClick: ()=>{
|
|
32
|
-
if (action.id === 'start') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id));
|
|
32
|
+
if (action.id === 'start' && doc.status !== 'stopped') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id));
|
|
33
33
|
else setConfirm(true);
|
|
34
34
|
},
|
|
35
35
|
children: action.label
|
|
@@ -1,13 +1,44 @@
|
|
|
1
|
-
import { type ReactNode, type RefObject } from 'react';
|
|
1
|
+
import { type Dispatch, type ReactNode, type RefObject, type SetStateAction } from 'react';
|
|
2
2
|
import type { Arm, ArmKey } from '../../types/contracts.js';
|
|
3
3
|
import type { ArmSlot } from '../../types/puck.js';
|
|
4
4
|
import type { EditorExperiment } from './editor.model.js';
|
|
5
|
-
|
|
5
|
+
/** A pointer shortcut supplements the explicit, keyboard-accessible open marker. */
|
|
6
|
+
export declare function VersionCard({ label, openLabel, active, dragging, interactive, onSelect, children }: {
|
|
7
|
+
label: string;
|
|
8
|
+
openLabel?: string;
|
|
9
|
+
active: boolean;
|
|
10
|
+
dragging: boolean;
|
|
11
|
+
interactive?: boolean;
|
|
12
|
+
onSelect: () => void;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** Keep unavailable controls reachable, and explain an attempted edit in place. */
|
|
16
|
+
export declare function VersionLock({ message, children }: {
|
|
17
|
+
message?: string;
|
|
18
|
+
children: (noticeId?: string) => ReactNode;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
export declare function useArmWrites({ url, bindingKey, status, controlKeys, publish, isCurrent, onWrite, onSaved }: {
|
|
21
|
+
url: string;
|
|
22
|
+
bindingKey: string;
|
|
23
|
+
status?: EditorExperiment['status'];
|
|
24
|
+
controlKeys: string[];
|
|
25
|
+
publish: (doc: EditorExperiment) => EditorExperiment | void;
|
|
26
|
+
isCurrent: () => boolean;
|
|
27
|
+
onWrite: () => void;
|
|
28
|
+
onSaved?: () => void;
|
|
29
|
+
}): {
|
|
6
30
|
write: (transform: (arms: Arm[]) => Arm[], options?: {
|
|
7
31
|
draftOnly?: boolean;
|
|
32
|
+
onError?: (message: string) => void;
|
|
33
|
+
queue?: boolean;
|
|
34
|
+
cancelled?: () => boolean;
|
|
35
|
+
onStart?: () => void;
|
|
36
|
+
errorKey?: string;
|
|
8
37
|
}) => Promise<Arm[] | undefined>;
|
|
9
38
|
busy: boolean;
|
|
10
|
-
error: string
|
|
39
|
+
error: string;
|
|
40
|
+
errorFor: (key: string) => string | undefined;
|
|
41
|
+
clearError: (key: string) => void;
|
|
11
42
|
};
|
|
12
43
|
export type ArmWrites = ReturnType<typeof useArmWrites>;
|
|
13
44
|
export declare function AddVariant({ experiment, writes, onSelect }: {
|
|
@@ -15,16 +46,11 @@ export declare function AddVariant({ experiment, writes, onSelect }: {
|
|
|
15
46
|
writes: ArmWrites;
|
|
16
47
|
onSelect: (slot: ArmSlot) => void;
|
|
17
48
|
}): import("react").JSX.Element | null;
|
|
18
|
-
|
|
49
|
+
/** Always-visible editor for the saved version name. */
|
|
50
|
+
export declare function VersionName({ arm, writes, editable }: {
|
|
19
51
|
arm: EditorExperiment['arms'][number];
|
|
20
52
|
writes: ArmWrites;
|
|
21
53
|
editable: boolean;
|
|
22
|
-
running?: boolean;
|
|
23
|
-
open: boolean;
|
|
24
|
-
onOpenChange: (open: boolean) => void;
|
|
25
|
-
canCopy: boolean;
|
|
26
|
-
onCopy: (slot: ArmSlot) => void;
|
|
27
|
-
onRequestRemove: () => void;
|
|
28
54
|
}): import("react").JSX.Element;
|
|
29
55
|
export declare function RemoveVersion({ arm, writes, count, shared, onRemove, onClose }: {
|
|
30
56
|
arm: EditorExperiment['arms'][number];
|
|
@@ -35,14 +61,16 @@ export declare function RemoveVersion({ arm, writes, count, shared, onRemove, on
|
|
|
35
61
|
onClose: () => void;
|
|
36
62
|
}): import("react").JSX.Element;
|
|
37
63
|
export type WeightEdits = Partial<Record<ArmKey, string>>;
|
|
38
|
-
export declare function VersionWeights({ experiment, writes, edits, setEdits, groupId, splitIntent, editable, beforeSplit,
|
|
64
|
+
export declare function VersionWeights({ experiment, writes, edits, setEdits, groupId, splitIntent, editable, showSplit, beforeSplit, beforeActions, renderRow }: {
|
|
39
65
|
experiment: EditorExperiment;
|
|
40
66
|
writes: ArmWrites;
|
|
41
67
|
edits: WeightEdits;
|
|
42
|
-
setEdits:
|
|
68
|
+
setEdits: Dispatch<SetStateAction<WeightEdits>>;
|
|
43
69
|
groupId: string;
|
|
44
70
|
splitIntent: RefObject<boolean>;
|
|
45
71
|
editable?: boolean;
|
|
72
|
+
showSplit?: boolean;
|
|
46
73
|
beforeSplit?: ReactNode;
|
|
47
|
-
|
|
74
|
+
beforeActions?: ReactNode;
|
|
75
|
+
renderRow?: (arm: EditorExperiment['arms'][number], input: ReactNode) => ReactNode;
|
|
48
76
|
}): import("react").JSX.Element;
|