@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.
- package/dist/admin/copy/newTest.d.ts +1 -1
- package/dist/admin/copy/newTest.js +1 -1
- package/dist/admin/surface/ResultsRoute.js +2 -10
- package/dist/admin/surface/newTest/NewTest.js +16 -18
- package/dist/admin/surface/newTest/PageWizard.js +10 -12
- package/dist/admin/surface/newTest/newTest.css +3 -1
- package/dist/admin/surface/results/ResultsHeader.js +15 -8
- package/dist/blocks/bindings.js +6 -13
- package/dist/blocks/placementLocale.d.ts +2 -0
- package/dist/blocks/placementLocale.js +16 -12
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +9 -7
- package/dist/hooks/blockRemovalRule.d.ts +2 -1
- package/dist/hooks/blockRemovalRule.js +27 -5
- package/dist/hooks/pageGuard.js +2 -2
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +34 -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.js +2 -2
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +2 -1
- package/dist/puck/editor/CreateExperimentDrawer.js +24 -16
- package/dist/puck/editor/EditorControls.d.ts +1 -1
- package/dist/puck/editor/EditorControls.js +1 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +624 -299
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +97 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +3 -0
- package/dist/puck/editor/QuickTestActions.js +50 -0
- package/dist/puck/editor/ResultsReadout.js +5 -0
- package/dist/puck/editor/VersionBuilder.d.ts +37 -12
- package/dist/puck/editor/VersionBuilder.js +273 -184
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +42 -3
- package/dist/puck/editor/armsCache.d.ts +1 -1
- package/dist/puck/editor/armsCache.js +2 -1
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +35 -20
- package/dist/puck/editor/copy.js +35 -20
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +32 -14
- package/dist/puck/editor/editor.css +58 -17
- package/dist/puck/editor/editor.model.d.ts +1 -1
- package/dist/puck/editor/editor.model.js +2 -2
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +4 -2
- package/dist/puck/editor/localPlacements.js +20 -18
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +33 -2
- package/dist/puck/editor/placementsCache.js +208 -33
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +14 -0
- package/dist/puck/visibility.d.ts +21 -0
- package/dist/puck/visibility.js +77 -0
- package/dist/server/recordContentChange.js +3 -1
- package/dist/server/resolveExperimentData.js +4 -1
- package/dist/testSurface/api.js +1 -1
- package/dist/testSurface/copy/common.d.ts +1 -1
- package/dist/testSurface/copy/common.js +3 -1
- package/dist/testSurface/copy/readiness.d.ts +18 -1
- package/dist/testSurface/copy/readiness.js +23 -1
- package/dist/testSurface/copy/testPage.d.ts +8 -6
- package/dist/testSurface/copy/testPage.js +8 -6
- package/dist/testSurface/readPreflight.d.ts +9 -0
- package/dist/testSurface/readPreflight.js +38 -0
- package/dist/testSurface/readinessRead.d.ts +50 -0
- package/dist/testSurface/readinessRead.js +46 -0
- 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 +6 -2
- package/dist/testSurface/surface/editorPlacement.d.ts +21 -0
- package/dist/testSurface/surface/editorPlacement.js +60 -0
- package/dist/testSurface/surface/pageBlock/parts.js +13 -3
- package/dist/testSurface/surface/readiness/ActionDialogs.js +65 -41
- package/dist/testSurface/surface/readiness/Banner.d.ts +1 -4
- package/dist/testSurface/surface/readiness/Banner.js +106 -68
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +6 -2
- package/dist/testSurface/surface/readiness/SaveStatus.js +35 -22
- package/dist/testSurface/surface/readiness/parts.js +0 -2
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +13 -0
- package/dist/testSurface/surface/readiness/readiness.model.js +51 -36
- package/dist/testSurface/surface/readiness/useTransition.d.ts +5 -2
- package/dist/testSurface/surface/readiness/useTransition.js +69 -7
- package/dist/testSurface/surface/test/AdvancedSection.js +1 -0
- package/dist/testSurface/surface/test/GoalSection.js +102 -74
- package/dist/testSurface/surface/test/LengthSection.d.ts +1 -1
- package/dist/testSurface/surface/test/LengthSection.js +2 -1
- package/dist/testSurface/surface/test/Rail.js +7 -4
- package/dist/testSurface/surface/test/ReadinessBar.js +1 -2
- package/dist/testSurface/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +38 -6
- package/dist/testSurface/surface/test/TargetingSection.js +5 -0
- package/dist/testSurface/surface/test/TestSurface.d.ts +2 -1
- package/dist/testSurface/surface/test/TestSurface.js +68 -7
- package/dist/testSurface/surface/test/VersionsSection.js +1 -0
- package/dist/testSurface/surface/test/fields.d.ts +1 -3
- package/dist/testSurface/surface/test/fields.js +5 -35
- package/dist/testSurface/surface/test/testPage.css +12 -0
- package/dist/testSurface/surface/useTestDocument.d.ts +5 -2
- package/dist/testSurface/surface/useTestDocument.js +61 -46
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +24 -0
- package/dist/transitions/makeContent.js +24 -5
- package/dist/transitions/placements.js +23 -34
- package/dist/transitions/preflightData.js +1 -1
- package/dist/types/puck.d.ts +1 -0
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/Inputs.js +8 -5
- package/dist/ui/Tabs.d.ts +2 -2
- package/dist/ui/Tabs.js +33 -32
- package/dist/ui/ui.css +26 -3
- package/package.json +1 -1
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
import { checkArms } from '../../collections/experiments/armInvariants.js';
|
|
2
2
|
import { issueMessage } from '../../arms/copy.js';
|
|
3
|
-
import { totalWeight, withSlotsFor } from '../../arms/model.js';
|
|
3
|
+
import { addVariant, balanceWeight, removeArm, splitEvenly, totalWeight, withSlotsFor } from '../../arms/model.js';
|
|
4
4
|
import { XP_IF_UPDATED_AT_HEADER } from '../../constants.js';
|
|
5
|
+
import { slotLabels } from '../copy.js';
|
|
5
6
|
import { editorCopy, writeRefusal } from './copy.js';
|
|
6
7
|
export class ArmWriteError extends Error {
|
|
7
8
|
}
|
|
9
|
+
/** Refuse obsolete intents before a no-op can become a successful PATCH. */ export function removeVersionArms(arms, key) {
|
|
10
|
+
if (!arms.some((arm)=>arm.key === key && arm.kind !== 'control')) throw new ArmWriteError(editorCopy.staleEdit);
|
|
11
|
+
return splitEvenly(removeArm(arms, key));
|
|
12
|
+
}
|
|
13
|
+
export function addVersionArms(arms) {
|
|
14
|
+
const next = addVariant(arms, 'block');
|
|
15
|
+
if (next.length === arms.length) throw new ArmWriteError(editorCopy.staleEdit);
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
18
|
+
export function setVersionTraffic(arms, key, weight) {
|
|
19
|
+
if (!arms.some((arm)=>arm.key === key) || arms.length < 2) throw new ArmWriteError(editorCopy.staleEdit);
|
|
20
|
+
return balanceWeight(arms, key, weight);
|
|
21
|
+
}
|
|
22
|
+
export function renameVersionArms(arms, key, label) {
|
|
23
|
+
if (!arms.some((arm)=>arm.key === key)) throw new ArmWriteError(editorCopy.staleEdit);
|
|
24
|
+
return arms.map((arm)=>arm.key === key ? {
|
|
25
|
+
...arm,
|
|
26
|
+
label
|
|
27
|
+
} : arm);
|
|
28
|
+
}
|
|
29
|
+
export function addLeftoverArms(arms, slot) {
|
|
30
|
+
if (slot === 'control' || arms.some((arm)=>arm.key === slot) || !arms.some((arm)=>arm.kind === 'control') || arms.filter((arm)=>arm.kind === 'variant').length >= 3) throw new ArmWriteError(editorCopy.staleEdit);
|
|
31
|
+
const next = [
|
|
32
|
+
...arms
|
|
33
|
+
];
|
|
34
|
+
const holdout = next.findIndex((arm)=>arm.kind === 'holdout');
|
|
35
|
+
next.splice(holdout < 0 ? next.length : holdout, 0, {
|
|
36
|
+
key: slot,
|
|
37
|
+
slot,
|
|
38
|
+
kind: 'variant',
|
|
39
|
+
label: slotLabels[slot],
|
|
40
|
+
weight: 0
|
|
41
|
+
});
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
8
44
|
export async function readExperiment(url, signal) {
|
|
9
45
|
const response = await fetch(url, {
|
|
10
46
|
credentials: 'include',
|
|
@@ -31,9 +67,12 @@ export async function readExperiment(url, signal) {
|
|
|
31
67
|
].includes(value.status)) throw new ArmWriteError(editorCopy.lockedGeneric);
|
|
32
68
|
return value;
|
|
33
69
|
}
|
|
34
|
-
/** Each intent is applied to a fresh document, guarded by the collection's compare-and-set header. */ export async function writeArms(url, transform, publish) {
|
|
70
|
+
/** Each intent is applied to a fresh document, guarded by the collection's compare-and-set header. */ export async function writeArms(url, transform, publish, { draftOnly = false } = {}) {
|
|
35
71
|
const fresh = await readExperiment(`${url}?depth=0`);
|
|
36
|
-
publish(fresh);
|
|
72
|
+
const accepted = publish(fresh) ?? fresh;
|
|
73
|
+
// A later cache read can supersede this baseline before this GET finishes.
|
|
74
|
+
if (accepted.updatedAt !== fresh.updatedAt) throw new ArmWriteError(editorCopy.staleEdit);
|
|
75
|
+
if (draftOnly && fresh.status !== 'draft') throw new ArmWriteError(editorCopy.draftOnly);
|
|
37
76
|
if (fresh.status !== 'draft' && fresh.status !== 'stopped') throw new ArmWriteError(editorCopy.locked[fresh.status]);
|
|
38
77
|
if (!fresh.updatedAt || !Array.isArray(fresh.arms)) throw new ArmWriteError(editorCopy.writeUnreadable);
|
|
39
78
|
const arms = withSlotsFor(transform(fresh.arms), 'block');
|
|
@@ -9,7 +9,7 @@ export declare function acquireArms(testId: DocId): () => void;
|
|
|
9
9
|
/** Share the request, but abort it only after its last mounted consumer leaves. */
|
|
10
10
|
export declare function loadArms(testId: DocId, load: (signal: AbortSignal) => Promise<EditorExperiment>, signal: AbortSignal): Promise<EditorExperiment>;
|
|
11
11
|
export declare function subscribe(listener: () => void): () => void;
|
|
12
|
-
export declare function publishExperiment(testId: DocId, doc: EditorExperiment):
|
|
12
|
+
export declare function publishExperiment(testId: DocId, doc: EditorExperiment): EditorExperiment;
|
|
13
13
|
/** undefined means unknown. */
|
|
14
14
|
export declare function setArms(testId: DocId, arms: string[] | undefined): void;
|
|
15
15
|
export declare function useArms(testId: DocId | undefined): Arms | undefined;
|
|
@@ -71,13 +71,14 @@ export function publishExperiment(testId, doc) {
|
|
|
71
71
|
const previous = cache.get(String(testId))?.doc;
|
|
72
72
|
// Surface reads and chrome writes share this producer too. A GET that began
|
|
73
73
|
// before a save cannot overwrite its newer server timestamp when it finishes.
|
|
74
|
-
if (previous?.updatedAt && doc.updatedAt && Date.parse(previous.updatedAt) > Date.parse(doc.updatedAt)) return;
|
|
74
|
+
if (previous?.updatedAt && doc.updatedAt && Date.parse(previous.updatedAt) > Date.parse(doc.updatedAt)) return previous;
|
|
75
75
|
revisions.set(String(testId), (revisions.get(String(testId)) ?? 0) + 1);
|
|
76
76
|
cache.set(String(testId), {
|
|
77
77
|
arms: doc.arms.map((arm)=>arm.key),
|
|
78
78
|
doc
|
|
79
79
|
});
|
|
80
80
|
for (const listener of listeners)listener();
|
|
81
|
+
return doc;
|
|
81
82
|
}
|
|
82
83
|
/** undefined means unknown. */ export function setArms(testId, arms) {
|
|
83
84
|
revisions.set(String(testId), (revisions.get(String(testId)) ?? 0) + 1);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Slot } from '../../types/puck.js';
|
|
2
2
|
/** Clone JSON Puck slot data, refreshing component ids even inside nested slots. */
|
|
3
3
|
export declare function cloneSlot(slot: Slot): Slot;
|
|
4
|
+
/** Count the Puck blocks that will be removed, including nested version content. */
|
|
5
|
+
export declare function countSlotBlocks(value: unknown): number;
|
|
@@ -39,3 +39,10 @@ function freshId(type, used) {
|
|
|
39
39
|
}
|
|
40
40
|
return clone(slot);
|
|
41
41
|
}
|
|
42
|
+
/** Count the Puck blocks that will be removed, including nested version content. */ export function countSlotBlocks(value) {
|
|
43
|
+
if (!value || typeof value !== 'object') return 0;
|
|
44
|
+
if (Array.isArray(value)) return value.reduce((total, item)=>total + countSlotBlocks(item), 0);
|
|
45
|
+
const node = value;
|
|
46
|
+
const own = typeof node.type === 'string' && node.props && typeof node.props === 'object' ? 1 : 0;
|
|
47
|
+
return own + Object.values(node).reduce((total, item)=>total + countSlotBlocks(item), 0);
|
|
48
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const editorCopy: {
|
|
2
|
+
readonly hidden: "This block is hidden, so visitors won't see this test here.";
|
|
3
|
+
readonly hiddenOn: (sizes: string) => string;
|
|
2
4
|
readonly retrySetup: "Retry";
|
|
3
5
|
readonly controlsUnavailable: "Test controls couldn't load.";
|
|
4
6
|
readonly setupForbidden: "You don't have access to set up tests.";
|
|
@@ -14,25 +16,22 @@ export declare const editorCopy: {
|
|
|
14
16
|
readonly openInTab: "Open in a new tab";
|
|
15
17
|
readonly closeConfigure: "Close";
|
|
16
18
|
readonly selectBlock: "Select this test block";
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly draft: "This block shows the Original to everyone until the test starts.";
|
|
19
|
+
readonly deleted: "The test for this block was deleted.";
|
|
20
|
+
readonly unbound: "This Experiment block has no test yet.";
|
|
21
|
+
readonly draft: (label: string) => string;
|
|
21
22
|
readonly running: "Changing this content mid-test mixes two versions in one result";
|
|
22
23
|
readonly decided: (winner: string) => string;
|
|
23
24
|
readonly archived: "This test is archived; the winning content is shown to everyone.";
|
|
24
|
-
readonly copy:
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
25
|
+
readonly copy: (label?: string) => string;
|
|
26
|
+
readonly copyEmpty: (label?: string) => string;
|
|
27
|
+
readonly enterName: "Enter a name to create the test.";
|
|
28
|
+
readonly dropZone: (label: string) => string;
|
|
29
|
+
readonly replaceConfirm: (label: string, original?: string) => string;
|
|
27
30
|
readonly replace: "Replace";
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
31
|
+
readonly pageFallback: "Page";
|
|
32
|
+
readonly createLabel: "Set up test";
|
|
33
|
+
readonly existingTest: "Use an existing test";
|
|
30
34
|
readonly sharedTest: "This test is also used in another place. Changes here affect that test.";
|
|
31
|
-
readonly detach: "Remove the test from this block";
|
|
32
|
-
readonly detachTitle: "Remove the test from this block?";
|
|
33
|
-
readonly detachHelp: "Show the Original on this page? All version content stays in this block. The test and its results are kept. Save the page to keep this change.";
|
|
34
|
-
readonly stopToDetach: "Stop the test to remove it from this block.";
|
|
35
|
-
readonly detachRunningHelp: "Show the Original here? The test keeps running in its other place. All version content stays in this block. Save the page to keep this change.";
|
|
36
35
|
readonly createdUnbound: "The test was created, but this block changed or was removed. Open the test to continue.";
|
|
37
36
|
readonly creating: "Creating…";
|
|
38
37
|
readonly cancel: "Cancel";
|
|
@@ -40,18 +39,34 @@ export declare const editorCopy: {
|
|
|
40
39
|
readonly openTest: "Open the test";
|
|
41
40
|
readonly nameExists: "This name is too close to an existing test. Choose a different name.";
|
|
42
41
|
readonly createError: "Couldn't create the test. Try again.";
|
|
42
|
+
readonly savingVersions: "Saving version changes…";
|
|
43
|
+
readonly refreshing: "Refreshing results…";
|
|
43
44
|
readonly loading: "Loading test…";
|
|
44
45
|
readonly loadError: "Couldn't load this test. Try selecting it again.";
|
|
45
|
-
readonly orphan: (label: string) => string;
|
|
46
|
+
readonly orphan: (label: string, versions: string) => string;
|
|
47
|
+
readonly addLeftover: "Add to the test";
|
|
48
|
+
readonly deleteContent: "Delete its content";
|
|
49
|
+
readonly deleteContentTitle: (label: string) => string;
|
|
50
|
+
readonly deleteContentHelp: (label: string, count: number) => string;
|
|
51
|
+
readonly draftOnly: "Only draft tests can add this version. Use a different test to include it.";
|
|
52
|
+
readonly outsideTest: (label: string) => string;
|
|
46
53
|
readonly tabs: "Test versions";
|
|
47
54
|
readonly add: "Add variant";
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
55
|
+
readonly testGroup: "Test";
|
|
56
|
+
readonly versionsGroup: "Versions";
|
|
57
|
+
readonly moreGroup: "More";
|
|
58
|
+
readonly differentTest: "Use a different test";
|
|
59
|
+
readonly createAnother: "Create a test";
|
|
60
|
+
readonly readOnlyVersions: "You don't have permission to change this test's versions.";
|
|
61
|
+
readonly traffic: "Traffic (%)";
|
|
62
|
+
readonly saved: "Saved";
|
|
63
|
+
readonly removeVersion: "Remove version";
|
|
51
64
|
readonly emptyLabel: "Enter a name for this version.";
|
|
52
65
|
readonly remove: "Remove";
|
|
53
66
|
readonly removeTitle: (label: string) => string;
|
|
54
|
-
readonly removeHelp:
|
|
67
|
+
readonly removeHelp: (count: number) => string;
|
|
68
|
+
readonly removeShared: "This test is also used in another place. The version is removed from the test there too.";
|
|
69
|
+
readonly removeScopeUnknown: "If this test is used on other pages, the version is removed from the test there too.";
|
|
55
70
|
readonly removed: "Save the page to finish removing this version's content.";
|
|
56
71
|
readonly removeUncleared: "The version was removed from the test, but its content couldn't be cleared here. Delete it from the outline, then save the page.";
|
|
57
72
|
readonly lockedGeneric: "This test's versions can't change. View the test page for details.";
|
|
@@ -69,7 +84,7 @@ export declare const editorCopy: {
|
|
|
69
84
|
readonly writeNetwork: "Couldn't reach the server. Check your connection and try again.";
|
|
70
85
|
readonly writeUnreadable: "Couldn't read the server's response. Reload and try again.";
|
|
71
86
|
readonly collecting: "Collecting";
|
|
72
|
-
readonly resultsUnavailable: "Results aren't available here.";
|
|
87
|
+
readonly resultsUnavailable: "Results aren't available here. Try Refresh.";
|
|
73
88
|
readonly refresh: "Refresh";
|
|
74
89
|
readonly people: (label: string, count: string) => string;
|
|
75
90
|
};
|
package/dist/puck/editor/copy.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ARM_LABELS } from '../../labels/arms.js';
|
|
2
2
|
export const editorCopy = {
|
|
3
|
+
hidden: "This block is hidden, so visitors won't see this test here.",
|
|
4
|
+
hiddenOn: (sizes)=>`This block is hidden on ${sizes}. Visitors on ${sizes} are still counted in this test.`,
|
|
3
5
|
retrySetup: 'Retry',
|
|
4
6
|
controlsUnavailable: "Test controls couldn't load.",
|
|
5
7
|
setupForbidden: "You don't have access to set up tests.",
|
|
@@ -9,25 +11,22 @@ export const editorCopy = {
|
|
|
9
11
|
openInTab: 'Open in a new tab',
|
|
10
12
|
closeConfigure: 'Close',
|
|
11
13
|
selectBlock: 'Select this test block',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
draft: 'This block shows the Original to everyone until the test starts.',
|
|
14
|
+
deleted: 'The test for this block was deleted.',
|
|
15
|
+
unbound: 'This Experiment block has no test yet.',
|
|
16
|
+
draft: (label)=>`This block shows the ${label} to everyone until the test starts.`,
|
|
16
17
|
running: 'Changing this content mid-test mixes two versions in one result',
|
|
17
18
|
decided: (winner)=>`Decided: ${winner}. Use 'Make it the content' on the test to finish.`,
|
|
18
19
|
archived: 'This test is archived; the winning content is shown to everyone.',
|
|
19
|
-
copy:
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
copy: (label = ARM_LABELS.control)=>`Copy ${label} here`,
|
|
21
|
+
copyEmpty: (label = ARM_LABELS.control)=>`Add content to the ${label} before copying it.`,
|
|
22
|
+
enterName: 'Enter a name to create the test.',
|
|
23
|
+
dropZone: (label)=>`Drop ${label} content here`,
|
|
24
|
+
replaceConfirm: (label, original = ARM_LABELS.control)=>`${label} already has content. Replace it with a copy of the ${original}?`,
|
|
22
25
|
replace: 'Replace',
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
pageFallback: 'Page',
|
|
27
|
+
createLabel: 'Set up test',
|
|
28
|
+
existingTest: 'Use an existing test',
|
|
25
29
|
sharedTest: 'This test is also used in another place. Changes here affect that test.',
|
|
26
|
-
detach: 'Remove the test from this block',
|
|
27
|
-
detachTitle: 'Remove the test from this block?',
|
|
28
|
-
detachHelp: 'Show the Original on this page? All version content stays in this block. The test and its results are kept. Save the page to keep this change.',
|
|
29
|
-
stopToDetach: 'Stop the test to remove it from this block.',
|
|
30
|
-
detachRunningHelp: 'Show the Original here? The test keeps running in its other place. All version content stays in this block. Save the page to keep this change.',
|
|
31
30
|
createdUnbound: 'The test was created, but this block changed or was removed. Open the test to continue.',
|
|
32
31
|
creating: 'Creating…',
|
|
33
32
|
cancel: 'Cancel',
|
|
@@ -35,18 +34,34 @@ export const editorCopy = {
|
|
|
35
34
|
openTest: 'Open the test',
|
|
36
35
|
nameExists: "This name is too close to an existing test. Choose a different name.",
|
|
37
36
|
createError: "Couldn't create the test. Try again.",
|
|
37
|
+
savingVersions: 'Saving version changes…',
|
|
38
|
+
refreshing: 'Refreshing results…',
|
|
38
39
|
loading: 'Loading test…',
|
|
39
40
|
loadError: "Couldn't load this test. Try selecting it again.",
|
|
40
|
-
orphan: (label)=>`${label} has content
|
|
41
|
+
orphan: (label, versions)=>`${label} has content on this page, but the test only has ${versions}. Visitors never see it.`,
|
|
42
|
+
addLeftover: 'Add to the test',
|
|
43
|
+
deleteContent: 'Delete its content',
|
|
44
|
+
deleteContentTitle: (label)=>`Delete ${label} content?`,
|
|
45
|
+
deleteContentHelp: (label, count)=>`This deletes the ${count} ${count === 1 ? 'block' : 'blocks'} in ${label} from this page. Save the page to keep this change.`,
|
|
46
|
+
draftOnly: 'Only draft tests can add this version. Use a different test to include it.',
|
|
47
|
+
outsideTest: (label)=>`${label} · not in this test`,
|
|
41
48
|
tabs: 'Test versions',
|
|
42
49
|
add: 'Add variant',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
testGroup: 'Test',
|
|
51
|
+
versionsGroup: 'Versions',
|
|
52
|
+
moreGroup: 'More',
|
|
53
|
+
differentTest: 'Use a different test',
|
|
54
|
+
createAnother: 'Create a test',
|
|
55
|
+
readOnlyVersions: "You don't have permission to change this test's versions.",
|
|
56
|
+
traffic: 'Traffic (%)',
|
|
57
|
+
saved: 'Saved',
|
|
58
|
+
removeVersion: 'Remove version',
|
|
46
59
|
emptyLabel: 'Enter a name for this version.',
|
|
47
60
|
remove: 'Remove',
|
|
48
61
|
removeTitle: (label)=>`Remove ${label}?`,
|
|
49
|
-
removeHelp: 'This removes the version from the test and
|
|
62
|
+
removeHelp: (count)=>count === 0 ? 'This removes the version from the test.' : `This removes the version from the test and deletes its ${count} ${count === 1 ? 'block' : 'blocks'} from this page. Save the page to keep this change.`,
|
|
63
|
+
removeShared: 'This test is also used in another place. The version is removed from the test there too.',
|
|
64
|
+
removeScopeUnknown: 'If this test is used on other pages, the version is removed from the test there too.',
|
|
50
65
|
removed: "Save the page to finish removing this version's content.",
|
|
51
66
|
removeUncleared: "The version was removed from the test, but its content couldn't be cleared here. Delete it from the outline, then save the page.",
|
|
52
67
|
lockedGeneric: "This test's versions can't change. View the test page for details.",
|
|
@@ -64,7 +79,7 @@ export const editorCopy = {
|
|
|
64
79
|
writeNetwork: "Couldn't reach the server. Check your connection and try again.",
|
|
65
80
|
writeUnreadable: "Couldn't read the server's response. Reload and try again.",
|
|
66
81
|
collecting: 'Collecting',
|
|
67
|
-
resultsUnavailable: "Results aren't available here.",
|
|
82
|
+
resultsUnavailable: "Results aren't available here. Try Refresh.",
|
|
68
83
|
refresh: 'Refresh',
|
|
69
84
|
people: (label, count)=>`${label}: ${count} people`
|
|
70
85
|
};
|
|
@@ -5,3 +5,6 @@ export declare class CreateRefused extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
/** Shared lookup, complete draft creation and one retry for a racing slug collision. */
|
|
7
7
|
export declare function createTest(api: string, input: Omit<Parameters<typeof newTestBody>[0], 'slug'>): Promise<ExperimentRef>;
|
|
8
|
+
/** Choose a free display name before the existing slug/creation path. Called only by Set up test.
|
|
9
|
+
* Names are not unique: two editors may choose the same display name. Slugs are guarded separately. */
|
|
10
|
+
export declare function createBlockTest(api: string, pageTitle: string, arms: Parameters<typeof newTestBody>[0]['arms']): Promise<ExperimentRef>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchAllDocs } from '../../lib/fetchAllDocs.js';
|
|
1
2
|
import { editorCopy } from './copy.js';
|
|
2
3
|
import { isSlugCollision, newTestBody, slugify, slugCandidate } from './editor.model.js';
|
|
3
4
|
/** Only a server refusal may supply editor-facing error text. */ export class CreateRefused extends Error {
|
|
@@ -59,3 +60,35 @@ function refusalMessage(body) {
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
// Keep generated names readable and bounded, including the numbered suffix.
|
|
64
|
+
const NAME_MAX_LENGTH = 200;
|
|
65
|
+
function blockTestName(title, index) {
|
|
66
|
+
const suffix = index === 1 ? ' test' : ` test ${index}`;
|
|
67
|
+
// Do not leave half a surrogate pair at the title boundary.
|
|
68
|
+
return title.slice(0, NAME_MAX_LENGTH - suffix.length).replace(/[\uD800-\uDBFF]$/, '').trimEnd() + suffix;
|
|
69
|
+
}
|
|
70
|
+
/** Choose a free display name before the existing slug/creation path. Called only by Set up test.
|
|
71
|
+
* Names are not unique: two editors may choose the same display name. Slugs are guarded separately. */ export async function createBlockTest(api, pageTitle, arms) {
|
|
72
|
+
const title = pageTitle.trim() || editorCopy.pageFallback;
|
|
73
|
+
const base = blockTestName(title, 1);
|
|
74
|
+
// A short common prefix also matches candidates whose title is trimmed for a number.
|
|
75
|
+
const query = new URLSearchParams({
|
|
76
|
+
depth: '0',
|
|
77
|
+
'select[name]': 'true',
|
|
78
|
+
'where[name][like]': base.slice(0, 64).replace(/[\uD800-\uDBFF]$/, '')
|
|
79
|
+
});
|
|
80
|
+
const response = await fetchAllDocs(`${api}/xp-experiments?${query}`, {
|
|
81
|
+
credentials: 'include'
|
|
82
|
+
});
|
|
83
|
+
if (!response.ok) throw new CreateRefused(refusalMessage(response.body));
|
|
84
|
+
const taken = new Set(response.docs.map((doc)=>doc.name));
|
|
85
|
+
for(let index = 1;; index++){
|
|
86
|
+
const name = blockTestName(title, index);
|
|
87
|
+
if (!taken.has(name)) return createTest(api, {
|
|
88
|
+
name,
|
|
89
|
+
kind: 'block',
|
|
90
|
+
unitType: 'visitor',
|
|
91
|
+
arms
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
.xp-slot-header {
|
|
20
20
|
display: flex;
|
|
21
|
-
flex-wrap:
|
|
21
|
+
flex-wrap: nowrap;
|
|
22
22
|
align-items: center;
|
|
23
23
|
gap: var(--xp-space-2);
|
|
24
24
|
cursor: pointer;
|
|
@@ -39,7 +39,11 @@
|
|
|
39
39
|
color: var(--xp-text);
|
|
40
40
|
font: inherit;
|
|
41
41
|
font-weight: 600;
|
|
42
|
-
|
|
42
|
+
min-width: 0;
|
|
43
|
+
flex: 1;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
text-overflow: ellipsis;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
.xp-slot-editor > .xp-ui-tabs > .xp-ui-tabs-header {
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
gap: var(--xp-space-4);
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
.xp-slot-confirm {
|
|
101
|
+
.xp-slot-copy-confirm {
|
|
98
102
|
padding: var(--xp-space-2) var(--xp-space-3);
|
|
99
103
|
border: 1px solid var(--xp-warning);
|
|
100
104
|
border-radius: var(--xp-radius);
|
|
@@ -114,16 +118,6 @@
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
.xp-slot-editor .xp-ui-tabs-header { display: flex; flex-wrap: wrap; align-items: stretch; }
|
|
117
|
-
.xp-slot-version-actions { display: contents; }
|
|
118
|
-
.xp-slot-version-anchor { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--xp-border); }
|
|
119
|
-
.xp-slot-version-rename { flex: 1 0 100%; min-width: 0; padding-top: var(--xp-space-2); }
|
|
120
|
-
.xp-slot-version-menu {
|
|
121
|
-
position: absolute; top: 100%; inset-inline-end: 0; z-index: 5;
|
|
122
|
-
display: grid; min-width: 180px; padding: var(--xp-space-2);
|
|
123
|
-
box-shadow: 0 8px 24px var(--xp-overlay);
|
|
124
|
-
background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius);
|
|
125
|
-
}
|
|
126
|
-
.xp-slot-version-menu .xp-ui-button { justify-content: start; }
|
|
127
121
|
.xp-slot-weight-inputs, .xp-slot-people { display: flex; flex-wrap: wrap; gap: var(--xp-space-3); }
|
|
128
122
|
.xp-slot-weight-inputs { align-items: flex-start; }
|
|
129
123
|
.xp-slot-weight-inputs .xp-ui-field { flex: 1 1 120px; max-width: 200px; }
|
|
@@ -138,7 +132,8 @@
|
|
|
138
132
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-error { color: var(--xp-error); }
|
|
139
133
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-help { color: var(--xp-text-2); }
|
|
140
134
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-field label { color: var(--xp-text); }
|
|
141
|
-
[class*="_PuckFields"] .xp-puck-field .xp-ui-button:disabled
|
|
135
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button:disabled,
|
|
136
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button[aria-disabled='true'] {
|
|
142
137
|
opacity: 1;
|
|
143
138
|
background: var(--xp-surface-3);
|
|
144
139
|
border-color: var(--xp-border-strong);
|
|
@@ -166,3 +161,26 @@
|
|
|
166
161
|
.xp-configure-panel .xp-version-rows { grid-template-columns: minmax(0, 1fr) var(--xp-version-share-width-mobile); }
|
|
167
162
|
.xp-configure-panel .xp-version-content, .xp-configure-panel .xp-version-remove { grid-column: 1 / -1; }
|
|
168
163
|
.xp-configure-panel .xp-version-grid-head > :nth-child(n+3) { display: none; }
|
|
164
|
+
|
|
165
|
+
.xp-slot-editor .xp-ui-tabbar { flex: 1 1 auto; min-width: 0; }
|
|
166
|
+
|
|
167
|
+
.xp-slot-sidebar { display: grid; gap: var(--xp-space-4); }
|
|
168
|
+
.xp-slot-sidebar section, .xp-slot-sidebar section > div { display: grid; gap: var(--xp-space-3); }
|
|
169
|
+
.xp-slot-sidebar .xp-slot-weight-inputs { display: grid; }
|
|
170
|
+
.xp-slot-sidebar .xp-slot-weight-inputs .xp-ui-field { max-width: none; flex: 1 1 100%; }
|
|
171
|
+
|
|
172
|
+
/* Grid stretching must not turn a status chip into a full-width bar. */
|
|
173
|
+
.xp-slot-sidebar .xp-ui-status { justify-self: start; width: max-content; }
|
|
174
|
+
.xp-slot-sidebar fieldset { min-width: 0; }
|
|
175
|
+
.xp-slot-sidebar .xp-slot-version-group[data-active='true'] { border-inline-start: 3px solid var(--xp-focus); }
|
|
176
|
+
.xp-slot-sidebar .xp-slot-version-name { display: flex; align-items: end; gap: var(--xp-space-2); }
|
|
177
|
+
.xp-slot-sidebar .xp-slot-version-name > .xp-ui-field { flex: 1; min-width: 0; }
|
|
178
|
+
|
|
179
|
+
.xp-slot-header .xp-ui-status { flex: none; }
|
|
180
|
+
|
|
181
|
+
.xp-slot-title-sentence {
|
|
182
|
+
white-space: normal;
|
|
183
|
+
overflow: visible;
|
|
184
|
+
overflow-wrap: anywhere;
|
|
185
|
+
text-overflow: clip;
|
|
186
|
+
}
|
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
.xp-ui-button--sm { height: 30px; padding: 0 10px; font-size: 13px; }
|
|
274
274
|
.xp-ui-button--link { height: auto; min-height: 0; padding-inline: 0; color: var(--xp-accent-text); text-decoration: var(--xp-accent-text-decoration); }
|
|
275
275
|
.xp-ui-button--link:hover { text-decoration: underline; }
|
|
276
|
-
.xp-ui-button:disabled, .xp-ui-button[aria-disabled='true'], .xp-ui-input:disabled, .xp-ui-toggle:disabled { opacity: .5; cursor: not-allowed; }
|
|
276
|
+
.xp-ui-button:disabled, .xp-ui-button[aria-disabled='true'], .xp-ui-input:disabled, .xp-ui-input[aria-disabled='true'], .xp-ui-toggle:disabled { opacity: .5; cursor: not-allowed; }
|
|
277
277
|
.xp-ui-button:focus-visible, .xp-ui-input:focus-visible, .xp-ui-toggle:focus-visible, .xp-ui-tab:focus-visible, .xp-ui-tabpanel:focus-visible, .xp-ui-breadcrumb a:focus-visible, .xp-ui-dialog:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
278
278
|
.xp-ui-field { min-width: 0; max-width: 100%; display: grid; gap: 6px; color: var(--xp-text); font: var(--xp-text-body); }
|
|
279
279
|
.xp-ui-field > label { font-weight: 500; }
|
|
@@ -282,7 +282,10 @@
|
|
|
282
282
|
.xp-ui-input:hover { border-color: var(--xp-text-3); }
|
|
283
283
|
.xp-ui-input[aria-invalid='true'] { border-color: var(--xp-error); }
|
|
284
284
|
.xp-ui-input--number { text-align: right; font-variant-numeric: tabular-nums; }
|
|
285
|
-
|
|
285
|
+
/* The same token-based dropdown chrome in the admin and isolated editor. */
|
|
286
|
+
.xp-ui-select-wrap { display: block; position: relative; min-width: 0; }
|
|
287
|
+
.xp-ui-select-wrap::after { content: ''; position: absolute; inset-inline-end: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--xp-text-2); border-bottom: 2px solid var(--xp-text-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
|
|
288
|
+
.xp-ui-select { cursor: pointer; appearance: none; padding-inline-end: 36px; }
|
|
286
289
|
.xp-ui-help { margin: 0; color: var(--xp-text-2); font: var(--xp-text-small); }
|
|
287
290
|
.xp-ui-error { margin: 0; color: var(--xp-error); font: var(--xp-text-small); }
|
|
288
291
|
.xp-ui-toggle { appearance: none; display: inline-block; width: 32px; height: 20px; margin: 0; padding: 2px; border-radius: 20px; border: 1px solid var(--xp-border-strong); background: var(--xp-surface-3); cursor: pointer; transition: background-color var(--xp-motion); }
|
|
@@ -298,7 +301,7 @@
|
|
|
298
301
|
.xp-ui-section-body { padding: 20px; }
|
|
299
302
|
.xp-ui-tabs { color: var(--xp-text); font: var(--xp-text-body); }
|
|
300
303
|
.xp-ui-tablist { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--xp-border); }
|
|
301
|
-
.xp-ui-tab { appearance: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 12px; background: transparent; color: var(--xp-text-2); font: var(--xp-text-body); cursor: pointer; }
|
|
304
|
+
.xp-ui-tab { min-width: 0; max-width: 100%; overflow-wrap: anywhere; white-space: normal; appearance: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 12px; background: transparent; color: var(--xp-text-2); font: var(--xp-text-body); cursor: pointer; }
|
|
302
305
|
.xp-ui-tab[aria-selected='true'] { color: var(--xp-accent-text); text-decoration: var(--xp-accent-text-decoration); border-bottom-color: var(--xp-accent-text); font-weight: 600; }
|
|
303
306
|
.xp-ui-tab:disabled { opacity: .5; cursor: not-allowed; }
|
|
304
307
|
.xp-ui-tabpanel { padding-block: 16px; }
|
|
@@ -361,6 +364,26 @@
|
|
|
361
364
|
.xp-ui-drawer > .xp-ui-dialog-header h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; font: var(--xp-text-title); }
|
|
362
365
|
.xp-ui-drawer-body { min-height: 0; overflow: auto; overscroll-behavior: contain; flex: 1; background: var(--xp-bg); }
|
|
363
366
|
|
|
367
|
+
.xp-ui-section--blocked { border-color: var(--xp-error-border); }
|
|
368
|
+
.xp-ui-section--blocked .xp-ui-section-number, .xp-ui-section--blocked .xp-ui-section-complete { color: var(--xp-error); border-color: var(--xp-error-border); }
|
|
369
|
+
.xp-ui-section--complete .xp-ui-section-complete { color: var(--xp-success); }
|
|
370
|
+
.xp-ui-section--complete .xp-ui-section-number { color: var(--xp-success); border-color: var(--xp-success); }
|
|
371
|
+
.xp-ui-section--blocked h2:focus { outline-color: var(--xp-error); }
|
|
372
|
+
|
|
373
|
+
.xp-ui-section--blocked .xp-ui-section-complete { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--xp-error-border); border-radius: 50%; }
|
|
374
|
+
|
|
375
|
+
/* Actions sit beside each tab visually and outside the tablist's owned roles. */
|
|
376
|
+
.xp-ui-tabbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--xp-border); }
|
|
377
|
+
.xp-ui-tabbar > .xp-ui-tablist { display: contents; }
|
|
378
|
+
|
|
379
|
+
/* One blocker-list format in the admin footer and the Puck sidebar. */
|
|
380
|
+
.xp-readiness__blockers, .xp-readiness__blockers a { color: var(--xp-error); }
|
|
381
|
+
.xp-readiness__blockers ul { margin: 0; padding-inline-start: var(--xp-space-4); }
|
|
382
|
+
.xp-readiness__blockers li { white-space: pre-line; }
|
|
383
|
+
|
|
384
|
+
.xp-other-goals summary { cursor: pointer; font-weight: 600; }
|
|
385
|
+
.xp-other-goal-list { display: grid; gap: var(--xp-space-3); padding-block: var(--xp-space-3); }
|
|
386
|
+
|
|
364
387
|
/* Shared UI controls are assembled into editor.css for the isolated canvas. */
|
|
365
388
|
.xp-slot-editor {
|
|
366
389
|
min-width: 0;
|
|
@@ -381,7 +404,7 @@
|
|
|
381
404
|
|
|
382
405
|
.xp-slot-header {
|
|
383
406
|
display: flex;
|
|
384
|
-
flex-wrap:
|
|
407
|
+
flex-wrap: nowrap;
|
|
385
408
|
align-items: center;
|
|
386
409
|
gap: var(--xp-space-2);
|
|
387
410
|
cursor: pointer;
|
|
@@ -402,7 +425,11 @@
|
|
|
402
425
|
color: var(--xp-text);
|
|
403
426
|
font: inherit;
|
|
404
427
|
font-weight: 600;
|
|
405
|
-
|
|
428
|
+
min-width: 0;
|
|
429
|
+
flex: 1;
|
|
430
|
+
white-space: nowrap;
|
|
431
|
+
overflow: hidden;
|
|
432
|
+
text-overflow: ellipsis;
|
|
406
433
|
}
|
|
407
434
|
|
|
408
435
|
.xp-slot-editor > .xp-ui-tabs > .xp-ui-tabs-header {
|
|
@@ -457,7 +484,7 @@
|
|
|
457
484
|
gap: var(--xp-space-4);
|
|
458
485
|
}
|
|
459
486
|
|
|
460
|
-
.xp-slot-confirm {
|
|
487
|
+
.xp-slot-copy-confirm {
|
|
461
488
|
padding: var(--xp-space-2) var(--xp-space-3);
|
|
462
489
|
border: 1px solid var(--xp-warning);
|
|
463
490
|
border-radius: var(--xp-radius);
|
|
@@ -477,16 +504,6 @@
|
|
|
477
504
|
}
|
|
478
505
|
|
|
479
506
|
.xp-slot-editor .xp-ui-tabs-header { display: flex; flex-wrap: wrap; align-items: stretch; }
|
|
480
|
-
.xp-slot-version-actions { display: contents; }
|
|
481
|
-
.xp-slot-version-anchor { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--xp-border); }
|
|
482
|
-
.xp-slot-version-rename { flex: 1 0 100%; min-width: 0; padding-top: var(--xp-space-2); }
|
|
483
|
-
.xp-slot-version-menu {
|
|
484
|
-
position: absolute; top: 100%; inset-inline-end: 0; z-index: 5;
|
|
485
|
-
display: grid; min-width: 180px; padding: var(--xp-space-2);
|
|
486
|
-
box-shadow: 0 8px 24px var(--xp-overlay);
|
|
487
|
-
background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius);
|
|
488
|
-
}
|
|
489
|
-
.xp-slot-version-menu .xp-ui-button { justify-content: start; }
|
|
490
507
|
.xp-slot-weight-inputs, .xp-slot-people { display: flex; flex-wrap: wrap; gap: var(--xp-space-3); }
|
|
491
508
|
.xp-slot-weight-inputs { align-items: flex-start; }
|
|
492
509
|
.xp-slot-weight-inputs .xp-ui-field { flex: 1 1 120px; max-width: 200px; }
|
|
@@ -501,7 +518,8 @@
|
|
|
501
518
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-error { color: var(--xp-error); }
|
|
502
519
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-help { color: var(--xp-text-2); }
|
|
503
520
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-field label { color: var(--xp-text); }
|
|
504
|
-
[class*="_PuckFields"] .xp-puck-field .xp-ui-button:disabled
|
|
521
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button:disabled,
|
|
522
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button[aria-disabled='true'] {
|
|
505
523
|
opacity: 1;
|
|
506
524
|
background: var(--xp-surface-3);
|
|
507
525
|
border-color: var(--xp-border-strong);
|
|
@@ -529,3 +547,26 @@
|
|
|
529
547
|
.xp-configure-panel .xp-version-rows { grid-template-columns: minmax(0, 1fr) var(--xp-version-share-width-mobile); }
|
|
530
548
|
.xp-configure-panel .xp-version-content, .xp-configure-panel .xp-version-remove { grid-column: 1 / -1; }
|
|
531
549
|
.xp-configure-panel .xp-version-grid-head > :nth-child(n+3) { display: none; }
|
|
550
|
+
|
|
551
|
+
.xp-slot-editor .xp-ui-tabbar { flex: 1 1 auto; min-width: 0; }
|
|
552
|
+
|
|
553
|
+
.xp-slot-sidebar { display: grid; gap: var(--xp-space-4); }
|
|
554
|
+
.xp-slot-sidebar section, .xp-slot-sidebar section > div { display: grid; gap: var(--xp-space-3); }
|
|
555
|
+
.xp-slot-sidebar .xp-slot-weight-inputs { display: grid; }
|
|
556
|
+
.xp-slot-sidebar .xp-slot-weight-inputs .xp-ui-field { max-width: none; flex: 1 1 100%; }
|
|
557
|
+
|
|
558
|
+
/* Grid stretching must not turn a status chip into a full-width bar. */
|
|
559
|
+
.xp-slot-sidebar .xp-ui-status { justify-self: start; width: max-content; }
|
|
560
|
+
.xp-slot-sidebar fieldset { min-width: 0; }
|
|
561
|
+
.xp-slot-sidebar .xp-slot-version-group[data-active='true'] { border-inline-start: 3px solid var(--xp-focus); }
|
|
562
|
+
.xp-slot-sidebar .xp-slot-version-name { display: flex; align-items: end; gap: var(--xp-space-2); }
|
|
563
|
+
.xp-slot-sidebar .xp-slot-version-name > .xp-ui-field { flex: 1; min-width: 0; }
|
|
564
|
+
|
|
565
|
+
.xp-slot-header .xp-ui-status { flex: none; }
|
|
566
|
+
|
|
567
|
+
.xp-slot-title-sentence {
|
|
568
|
+
white-space: normal;
|
|
569
|
+
overflow: visible;
|
|
570
|
+
overflow-wrap: anywhere;
|
|
571
|
+
text-overflow: clip;
|
|
572
|
+
}
|
|
@@ -14,7 +14,7 @@ export declare function tabsFor(experiment?: Pick<EditorExperiment, 'arms'> | nu
|
|
|
14
14
|
slot: ArmSlot;
|
|
15
15
|
label: string;
|
|
16
16
|
}>;
|
|
17
|
-
export declare function bannerFor(status?: Status | null, winner?: string): string;
|
|
17
|
+
export declare function bannerFor(status?: Status | null, winner?: string, original?: string): string;
|
|
18
18
|
/** Preserve the block's populated slots and the current test's versions, without carrying test settings. */
|
|
19
19
|
export declare function armsFromBlock(experiment: Pick<EditorExperiment, 'arms'>, content: Partial<Record<ArmSlot, unknown>>): Arm[];
|
|
20
20
|
/** The host's Payload Puck editor route identifies the saved document, including in an iframe. */
|
|
@@ -15,11 +15,11 @@ export function tabsFor(experiment) {
|
|
|
15
15
|
}
|
|
16
16
|
]).sort((a, b)=>Number(b.slot === 'control') - Number(a.slot === 'control'));
|
|
17
17
|
}
|
|
18
|
-
export function bannerFor(status, winner = editorCopy.labels.control) {
|
|
18
|
+
export function bannerFor(status, winner = editorCopy.labels.control, original = editorCopy.labels.control) {
|
|
19
19
|
switch(status){
|
|
20
20
|
case 'draft':
|
|
21
21
|
case 'stopped':
|
|
22
|
-
return editorCopy.draft;
|
|
22
|
+
return editorCopy.draft(original);
|
|
23
23
|
case 'running':
|
|
24
24
|
return editorCopy.running;
|
|
25
25
|
case 'decided':
|