@delmaredigital/payload-experiments 0.4.0-rc.6 → 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/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/PageWizard.js +1 -0
- package/dist/admin/surface/newTest/newTest.css +1 -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 +3 -2
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +21 -7
- package/dist/blocks/placementLocale.js +218 -67
- 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 +38 -31
- package/dist/hooks/blockRemovalRule.d.ts +2 -2
- package/dist/hooks/blockRemovalRule.js +16 -14
- package/dist/hooks/pageGuard.d.ts +3 -0
- package/dist/hooks/pageGuard.js +33 -23
- 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.js +40 -37
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +8 -4
- package/dist/puck/editor/ConfigureTestDrawer.js +4 -2
- package/dist/puck/editor/ExperimentSlotEditor.js +135 -104
- package/dist/puck/editor/LeftoverVersions.d.ts +1 -1
- package/dist/puck/editor/LeftoverVersions.js +40 -43
- package/dist/puck/editor/VersionBuilder.d.ts +18 -1
- package/dist/puck/editor/VersionBuilder.js +217 -39
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/copy.d.ts +8 -1
- package/dist/puck/editor/copy.js +9 -1
- package/dist/puck/editor/editor.chrome.css +117 -3
- package/dist/puck/editor/editor.css +130 -8
- package/dist/puck/editor/editor.model.d.ts +2 -1
- package/dist/puck/editor/editor.model.js +2 -2
- package/dist/puck/editor/localPlacements.d.ts +1 -0
- package/dist/puck/editor/localPlacements.js +12 -0
- package/dist/puck/editor/placementsCache.d.ts +18 -12
- package/dist/puck/editor/placementsCache.js +52 -47
- 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 +2 -3
- package/dist/puck/visibility.js +11 -7
- package/dist/server/recordContentChange.js +34 -19
- package/dist/server/resolveExperimentData.js +2 -2
- 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 +1 -1
- package/dist/testSurface/copy/readiness.js +1 -1
- package/dist/testSurface/copy/testPage.d.ts +21 -0
- package/dist/testSurface/copy/testPage.js +21 -0
- 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/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/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/TestSurface.js +29 -9
- 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 +5 -4
- 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 +219 -56
- 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/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 +9 -9
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/ui.css +13 -5
- package/package.json +3 -2
package/dist/puck/slotConfig.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXPERIMENT_SLOT_TYPE } from '../types/puck.js';
|
|
1
2
|
import { createExperimentSlotField } from './experimentSlotField.js';
|
|
2
3
|
import { slotLabels } from './copy.js';
|
|
3
4
|
export const experimentSlotLabel = 'Experiment block';
|
|
@@ -6,19 +7,31 @@ export const experimentSlotFields = {
|
|
|
6
7
|
// Puck 0.24's defaultSlots prepends each slot, reversing declaration order in the outline.
|
|
7
8
|
variantC: {
|
|
8
9
|
type: 'slot',
|
|
9
|
-
label: slotLabels.variantC
|
|
10
|
+
label: slotLabels.variantC,
|
|
11
|
+
disallow: [
|
|
12
|
+
EXPERIMENT_SLOT_TYPE
|
|
13
|
+
]
|
|
10
14
|
},
|
|
11
15
|
variantB: {
|
|
12
16
|
type: 'slot',
|
|
13
|
-
label: slotLabels.variantB
|
|
17
|
+
label: slotLabels.variantB,
|
|
18
|
+
disallow: [
|
|
19
|
+
EXPERIMENT_SLOT_TYPE
|
|
20
|
+
]
|
|
14
21
|
},
|
|
15
22
|
variantA: {
|
|
16
23
|
type: 'slot',
|
|
17
|
-
label: slotLabels.variantA
|
|
24
|
+
label: slotLabels.variantA,
|
|
25
|
+
disallow: [
|
|
26
|
+
EXPERIMENT_SLOT_TYPE
|
|
27
|
+
]
|
|
18
28
|
},
|
|
19
29
|
control: {
|
|
20
30
|
type: 'slot',
|
|
21
|
-
label: slotLabels.control
|
|
31
|
+
label: slotLabels.control,
|
|
32
|
+
disallow: [
|
|
33
|
+
EXPERIMENT_SLOT_TYPE
|
|
34
|
+
]
|
|
22
35
|
}
|
|
23
36
|
};
|
|
24
37
|
export const experimentSlotDefaultProps = {
|
|
@@ -8,14 +8,13 @@ export type BlockVisibility = {
|
|
|
8
8
|
hidden: boolean;
|
|
9
9
|
hideOn: VisibilitySize[];
|
|
10
10
|
};
|
|
11
|
-
type PuckBlock = Record<string, unknown> & {
|
|
11
|
+
export type PuckBlock = Record<string, unknown> & {
|
|
12
12
|
type: string;
|
|
13
13
|
props: Record<string, unknown>;
|
|
14
14
|
};
|
|
15
15
|
/** Visit blocks with their ancestors' visibility, including legacy owner-id:zone edges.
|
|
16
16
|
* Orphan zones retain their historical discovery behavior and count as shown.
|
|
17
17
|
*/
|
|
18
|
-
export declare function walkVisiblePuck(data: unknown, visit: (block: PuckBlock, visibility: BlockVisibility) => void): void;
|
|
18
|
+
export declare function walkVisiblePuck(data: unknown, visit: (block: PuckBlock, visibility: BlockVisibility, ancestors: readonly PuckBlock[]) => void): void;
|
|
19
19
|
/** Identity-keyed index shared by discovery and the public resolver. */
|
|
20
20
|
export declare function puckVisibility(data: unknown): Map<object, BlockVisibility>;
|
|
21
|
-
export {};
|
package/dist/puck/visibility.js
CHANGED
|
@@ -44,9 +44,9 @@ export function fullyHidden(value) {
|
|
|
44
44
|
}
|
|
45
45
|
index(data);
|
|
46
46
|
const seen = new WeakSet();
|
|
47
|
-
function walk(value, inherited) {
|
|
47
|
+
function walk(value, inherited, ancestors) {
|
|
48
48
|
if (Array.isArray(value)) {
|
|
49
|
-
value.forEach((child)=>walk(child, inherited));
|
|
49
|
+
value.forEach((child)=>walk(child, inherited, ancestors));
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
if (!object(value) || seen.has(value)) return;
|
|
@@ -58,17 +58,21 @@ export function fullyHidden(value) {
|
|
|
58
58
|
hidden: inherited.hidden || fullyHidden(props._visibility),
|
|
59
59
|
hideOn: visibilitySizes.filter((size)=>inherited.hideOn.includes(size) || hiddenOnSizes(props._visibility).includes(size))
|
|
60
60
|
};
|
|
61
|
-
visit(value, visibility);
|
|
62
|
-
|
|
61
|
+
visit(value, visibility, ancestors);
|
|
62
|
+
ancestors = [
|
|
63
|
+
...ancestors,
|
|
64
|
+
value
|
|
65
|
+
];
|
|
66
|
+
if (typeof props.id === 'string') for (const content of zones.get(props.id) ?? [])walk(content, visibility, ancestors);
|
|
63
67
|
}
|
|
64
|
-
for (const [key, child] of Object.entries(value))if (value !== data || key !== 'zones' || !object(child)) walk(child, visibility);
|
|
68
|
+
for (const [key, child] of Object.entries(value))if (value !== data || key !== 'zones' || !object(child)) walk(child, visibility, ancestors);
|
|
65
69
|
}
|
|
66
70
|
const shown = {
|
|
67
71
|
hidden: false,
|
|
68
72
|
hideOn: []
|
|
69
73
|
};
|
|
70
|
-
walk(data, shown);
|
|
71
|
-
for (const root of roots)if (!owners.has(root.owner)) walk(root.content, shown);
|
|
74
|
+
walk(data, shown, []);
|
|
75
|
+
for (const root of roots)if (!owners.has(root.owner)) walk(root.content, shown, []);
|
|
72
76
|
}
|
|
73
77
|
/** Identity-keyed index shared by discovery and the public resolver. */ export function puckVisibility(data) {
|
|
74
78
|
const result = new Map();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { placementReader } from '../blocks/placementLocale.js';
|
|
2
|
+
import { puckExperimentSlug } from '../puck/experimentSlug.js';
|
|
1
3
|
import { puckVisibility } from '../puck/visibility.js';
|
|
2
4
|
import { EXPERIMENT_BLOCK_SLUG, hostBlocks } from '../blocks/model.js';
|
|
3
5
|
import { safeError } from '../log.js';
|
|
@@ -8,7 +10,7 @@ import { pageContentBindings } from '../db/pageBindings.js';
|
|
|
8
10
|
import { sortLockKeys } from '../db/locks.js';
|
|
9
11
|
import { normalisePath } from '../runtime/normalisePath.js';
|
|
10
12
|
import { comparableContent } from '../transitions/pageVersions.js';
|
|
11
|
-
import {
|
|
13
|
+
import { puckCollections } from '../options.js';
|
|
12
14
|
import { withTransition } from '../transitions/kernel.js';
|
|
13
15
|
import { normaliseContentRelationships } from './normaliseContentRelationships.js';
|
|
14
16
|
const slots = [
|
|
@@ -39,7 +41,7 @@ function bindings(data, puck) {
|
|
|
39
41
|
if (!object(value) || visibility?.get(value)?.hidden) return;
|
|
40
42
|
if (puck && value.type === 'ExperimentSlot' && object(value.props)) {
|
|
41
43
|
const props = value.props;
|
|
42
|
-
const slug =
|
|
44
|
+
const slug = puckExperimentSlug(props.experiment);
|
|
43
45
|
if (typeof slug === 'string' && slug) add('slug', slug, {
|
|
44
46
|
id: props.id,
|
|
45
47
|
...Object.fromEntries(slots.map((slot)=>[
|
|
@@ -104,9 +106,10 @@ async function auditContentChange({ doc, previousDoc, req, collection }) {
|
|
|
104
106
|
}
|
|
105
107
|
const options = req.payload.config.custom?.xp;
|
|
106
108
|
const registration = puckCollections(options ?? {}).find((entry)=>entry.slug === collection.slug);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const
|
|
109
|
+
const reader = placementReader(req, collection.slug, options ?? {});
|
|
110
|
+
const changesOne = (previous, current)=>{
|
|
111
|
+
const after = bindings(registration && object(current) ? current[registration.field] : current, Boolean(registration) && reader.read(object(current) ? current : undefined, 'localized').editor === 'puck');
|
|
112
|
+
const before = bindings(registration && object(previous) ? previous[registration.field] : previous, Boolean(registration) && reader.read(object(previous) ? previous : undefined, 'localized').editor === 'puck');
|
|
110
113
|
const blockRegistration = options?.blocks?.collections.find((entry)=>entry.slug === collection.slug);
|
|
111
114
|
for (const [row, found] of [
|
|
112
115
|
[
|
|
@@ -118,7 +121,7 @@ async function auditContentChange({ doc, previousDoc, req, collection }) {
|
|
|
118
121
|
after
|
|
119
122
|
]
|
|
120
123
|
]){
|
|
121
|
-
if (!blockRegistration || !object(row) ||
|
|
124
|
+
if (!blockRegistration || !object(row) || reader.read(row, 'localized').editor !== 'blocks') continue;
|
|
122
125
|
for (const block of hostBlocks(row[blockRegistration.field])){
|
|
123
126
|
if (block.blockType !== (blockRegistration.blockSlug ?? EXPERIMENT_BLOCK_SLUG) || typeof block.experiment !== 'string') continue;
|
|
124
127
|
const key = 'slug:' + block.experiment;
|
|
@@ -138,6 +141,9 @@ async function auditContentChange({ doc, previousDoc, req, collection }) {
|
|
|
138
141
|
])
|
|
139
142
|
].filter((key)=>!isDeepStrictEqual(before.get(key)?.contents, after.get(key)?.contents)).map((key)=>after.get(key) ?? before.get(key));
|
|
140
143
|
};
|
|
144
|
+
const changes = (previous, current, input)=>(input === 'all-locales' ? reader.documentViews : [
|
|
145
|
+
undefined
|
|
146
|
+
]).flatMap((view)=>changesOne(reader.read(object(previous) ? previous : undefined, input, view).doc, reader.read(object(current) ? current : undefined, input, view).doc));
|
|
141
147
|
// Include discovery reads in the savepoint: a SQL read error also aborts Postgres.
|
|
142
148
|
// An explicit host call must supply its afterChange request's transaction.
|
|
143
149
|
const executor = txExecutor(req);
|
|
@@ -154,11 +160,11 @@ async function auditContentChange({ doc, previousDoc, req, collection }) {
|
|
|
154
160
|
if (!current) throw new Error('The saved content row was not found.');
|
|
155
161
|
beforeRow = baseline.doc;
|
|
156
162
|
afterRow = current;
|
|
157
|
-
changed = changes(beforeRow, afterRow);
|
|
163
|
+
changed = changes(beforeRow, afterRow, 'all-locales');
|
|
158
164
|
} else {
|
|
159
165
|
beforeRow = normalise(previousDoc);
|
|
160
166
|
afterRow = normalise(doc);
|
|
161
|
-
changed = changes(beforeRow, afterRow);
|
|
167
|
+
changed = changes(beforeRow, afterRow, 'localized');
|
|
162
168
|
}
|
|
163
169
|
const experiments = new Map();
|
|
164
170
|
for (const binding of changed){
|
|
@@ -166,17 +172,26 @@ async function auditContentChange({ doc, previousDoc, req, collection }) {
|
|
|
166
172
|
if (experiment) experiments.set(String(experiment.id), experiment.id);
|
|
167
173
|
}
|
|
168
174
|
const page = options?.pages?.collections.find((entry)=>entry.slug === collection.slug);
|
|
169
|
-
if (page?.contentOf
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
if (page?.contentOf) {
|
|
176
|
+
const input = baseline || req.locale === 'all' ? 'all-locales' : 'localized';
|
|
177
|
+
const paths = new Set();
|
|
178
|
+
for (const view of input === 'all-locales' ? reader.documentViews : [
|
|
179
|
+
undefined
|
|
180
|
+
]){
|
|
181
|
+
const before = reader.read(object(beforeRow) ? beforeRow : undefined, input, view).doc;
|
|
182
|
+
const after = reader.read(object(afterRow) ? afterRow : undefined, input, view).doc;
|
|
183
|
+
if (isDeepStrictEqual(comparableContent(before ? page.contentOf(before) : undefined), comparableContent(after ? page.contentOf(after) : undefined))) continue;
|
|
184
|
+
for (const doc of [
|
|
185
|
+
before,
|
|
186
|
+
after
|
|
187
|
+
]){
|
|
188
|
+
const path = doc ? page.pathOf(doc) : null;
|
|
189
|
+
if (path !== null) paths.add(normalisePath(path));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (paths.size) for (const id of (await pageContentBindings(executor, collection.slug, sortLockKeys([
|
|
193
|
+
...paths
|
|
194
|
+
]))))experiments.set(String(id), id);
|
|
180
195
|
}
|
|
181
196
|
// Successful audit locks persist until commit; acquire multiple E locks in order.
|
|
182
197
|
for (const key of sortLockKeys([
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { puckExperimentSlug } from '../puck/experimentSlug.js';
|
|
1
2
|
import { puckVisibility } from '../puck/visibility.js';
|
|
2
3
|
import { manifestOf, suppressExposure } from './context.js';
|
|
3
4
|
export function resolveExperimentData(puckData, assignments) {
|
|
@@ -27,8 +28,7 @@ export function resolveExperimentData(puckData, assignments) {
|
|
|
27
28
|
delete clean.xpSlot;
|
|
28
29
|
delete clean.xpArm;
|
|
29
30
|
delete clean.xpExpose;
|
|
30
|
-
const
|
|
31
|
-
const slug = typeof ref?.slug === 'string' ? ref.slug : undefined;
|
|
31
|
+
const slug = puckExperimentSlug(props.experiment);
|
|
32
32
|
const assignment = slug && Object.hasOwn(assignments.bySlug, slug) ? assignments.bySlug[slug] : undefined;
|
|
33
33
|
const experiment = manifest?.experiments.find((e)=>e.slug === slug);
|
|
34
34
|
const arm = experiment?.arms.find((a)=>a.key === assignment?.arm);
|
|
@@ -5,6 +5,7 @@ import { Button } from '../ui/Button.js';
|
|
|
5
5
|
import { armLabel } from './labels.js';
|
|
6
6
|
import { useApi } from './useApi.js';
|
|
7
7
|
import { REVIEW_COPY as C } from './copy/review.js';
|
|
8
|
+
import { placementLabel } from './placementLabel.js';
|
|
8
9
|
import { TEST_PAGE } from './copy/testPage.js';
|
|
9
10
|
import { API_MESSAGES, refusalMessage } from './copy/common.js';
|
|
10
11
|
import { actionablePreviewPages } from './previewLinks.model.js';
|
|
@@ -55,15 +56,16 @@ export function PreviewLinks({ experimentId, placements, arms, flagPoint, apiRou
|
|
|
55
56
|
setBusy(false);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
const pages = actionablePreviewPages(placements, flagPoint);
|
|
58
60
|
return /*#__PURE__*/ _jsxs("div", {
|
|
59
61
|
className: "xp-preview-links",
|
|
60
62
|
children: [
|
|
61
|
-
|
|
63
|
+
pages.map((placement)=>/*#__PURE__*/ _jsxs("div", {
|
|
62
64
|
className: "xp-preview-row",
|
|
63
65
|
children: [
|
|
64
66
|
/*#__PURE__*/ _jsxs("p", {
|
|
65
67
|
children: [
|
|
66
|
-
placement
|
|
68
|
+
placementLabel(placement),
|
|
67
69
|
placement.slotCount > 1 ? ` ${C.placedTimes(placement.slotCount)}` : null
|
|
68
70
|
]
|
|
69
71
|
}),
|
|
@@ -73,6 +75,7 @@ export function PreviewLinks({ experimentId, placements, arms, flagPoint, apiRou
|
|
|
73
75
|
placement.url ? arms.filter((arm)=>arm.kind !== 'holdout' && arm.key !== 'holdout').map((arm)=>/*#__PURE__*/ _jsxs(Button, {
|
|
74
76
|
variant: "secondary",
|
|
75
77
|
size: "sm",
|
|
78
|
+
"aria-label": pages.length > 1 ? `${C.preview} ${arm.label?.trim() || armLabel(arm.key)}: ${placementLabel(placement)}` : undefined,
|
|
76
79
|
disabled: busy,
|
|
77
80
|
onClick: ()=>{
|
|
78
81
|
void preview(placement.url, arm.key);
|
|
@@ -87,6 +90,7 @@ export function PreviewLinks({ experimentId, placements, arms, flagPoint, apiRou
|
|
|
87
90
|
variant: "link",
|
|
88
91
|
size: "sm",
|
|
89
92
|
href: placement.editorUrl,
|
|
93
|
+
"aria-label": pages.length > 1 ? `${TEST_PAGE.editOnPage}: ${placementLabel(placement)}` : undefined,
|
|
90
94
|
children: TEST_PAGE.editOnPage
|
|
91
95
|
}) : null
|
|
92
96
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocId } from '../types/contracts.js';
|
|
2
|
-
import type { WrapBlockBody, PagesResult, PlacementStatusBody, PlacementStatusResult, RestoreContentEntryBody, RestoreContentEntryResult, DismissContentEntryBody, DismissContentEntryResult, AddMetricBody, AllocateBody, ArchiveBody, DecideBody, MakeContentResult, AddMetricResult, ClickKeysResult, PreflightResult, PreviewTokenResult, RefusalCode, ResultsResponse, SummaryResponse, TransitionSuccess } from '../types/endpoints.js';
|
|
2
|
+
import type { DeleteImpactResult, WrapBlockBody, PagesResult, PlacementStatusBody, PlacementStatusResult, RestoreContentEntryBody, RestoreContentEntryResult, DismissContentEntryBody, DismissContentEntryResult, AddMetricBody, AllocateBody, ArchiveBody, DecideBody, MakeContentResult, AddMetricResult, ClickKeysResult, PreflightResult, PreviewTokenResult, RefusalCode, ResultsResponse, SummaryResponse, TransitionSuccess } from '../types/endpoints.js';
|
|
3
3
|
import { refusalMessage } from './copy/common.js';
|
|
4
4
|
export type ApiResult<T> = {
|
|
5
5
|
ok: true;
|
|
@@ -12,14 +12,16 @@ export type ApiResult<T> = {
|
|
|
12
12
|
retryable: boolean;
|
|
13
13
|
};
|
|
14
14
|
type RequestOptions = NonNullable<Parameters<typeof refusalMessage>[3]>;
|
|
15
|
-
export declare function createApi(apiBase: string): {
|
|
15
|
+
export declare function createApi(apiBase: string, contentLocale?: string): {
|
|
16
16
|
findTestIdBySlug: (slug: string) => Promise<Extract<ApiResult<DocId>, {
|
|
17
17
|
ok: false;
|
|
18
18
|
}> | {
|
|
19
19
|
ok: true;
|
|
20
20
|
data: DocId;
|
|
21
21
|
}>;
|
|
22
|
-
deleteTest: (id: DocId
|
|
22
|
+
deleteTest: (id: DocId, { draft }?: {
|
|
23
|
+
draft?: boolean;
|
|
24
|
+
}) => Promise<ApiResult<unknown>>;
|
|
23
25
|
wrapBlock: (body: WrapBlockBody) => Promise<ApiResult<Record<string, unknown>>>;
|
|
24
26
|
pages: (query: {
|
|
25
27
|
collection: string;
|
|
@@ -40,6 +42,7 @@ export declare function createApi(apiBase: string): {
|
|
|
40
42
|
restoreContentEntry: (id: DocId, body: RestoreContentEntryBody) => Promise<ApiResult<RestoreContentEntryResult>>;
|
|
41
43
|
archive: (id: DocId, body: ArchiveBody) => Promise<ApiResult<TransitionSuccess>>;
|
|
42
44
|
clickKeys: (id: DocId) => Promise<ApiResult<ClickKeysResult>>;
|
|
45
|
+
deleteImpact: (id: DocId, signal?: AbortSignal) => Promise<ApiResult<DeleteImpactResult>>;
|
|
43
46
|
preflight: (id: DocId) => Promise<ApiResult<PreflightResult>>;
|
|
44
47
|
previewToken: (id: DocId, arm: string) => Promise<ApiResult<PreviewTokenResult>>;
|
|
45
48
|
results: (id: DocId, options?: {
|
package/dist/testSurface/api.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { contentLocaleURL } from './contentLocaleURL.js';
|
|
1
2
|
import { API_MESSAGES, refusalMessage } from './copy/common.js';
|
|
2
3
|
import { CONTENT_ENTRY_REFUSALS } from './copy/actions.js';
|
|
3
|
-
export function createApi(apiBase) {
|
|
4
|
+
export function createApi(apiBase, contentLocale) {
|
|
4
5
|
const collectionBase = `${apiBase.replace(/\/$/, '')}/xp-experiments`;
|
|
5
6
|
const base = `${apiBase.replace(/\/$/, '')}/xp/experiments`;
|
|
6
7
|
const route = (id, action)=>`${base}/${encodeURIComponent(id)}/${action}`;
|
|
@@ -83,11 +84,13 @@ export function createApi(apiBase) {
|
|
|
83
84
|
data: id
|
|
84
85
|
};
|
|
85
86
|
},
|
|
86
|
-
deleteTest: (id)=>request(()=>`${collectionBase}/${encodeURIComponent(id)}`, 'DELETE', undefined, {
|
|
87
|
-
notFound: API_MESSAGES.
|
|
88
|
-
|
|
87
|
+
deleteTest: (id, { draft = false } = {})=>request(()=>`${collectionBase}/${encodeURIComponent(id)}`, 'DELETE', undefined, {
|
|
88
|
+
notFound: API_MESSAGES.testAlreadyDeleted,
|
|
89
|
+
...draft ? {
|
|
90
|
+
forbidden: API_MESSAGES.testNoLongerDraft
|
|
91
|
+
} : {},
|
|
89
92
|
codes: {
|
|
90
|
-
'invalid-status': API_MESSAGES.testNoLongerDraft
|
|
93
|
+
'invalid-status': draft ? API_MESSAGES.testNoLongerDraft : API_MESSAGES.deleteInvalidStatus
|
|
91
94
|
}
|
|
92
95
|
}),
|
|
93
96
|
wrapBlock: (body)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/blocks/wrap`, 'POST', body),
|
|
@@ -116,7 +119,8 @@ export function createApi(apiBase) {
|
|
|
116
119
|
restoreContentEntry: (id, body)=>post(id, 'content-report/restore', body, CONTENT_ENTRY_REFUSALS),
|
|
117
120
|
archive: (id, body)=>post(id, 'archive', body),
|
|
118
121
|
clickKeys: (id)=>request(()=>route(id, 'click-keys'), 'GET'),
|
|
119
|
-
|
|
122
|
+
deleteImpact: (id, signal)=>request(()=>contentLocaleURL(route(id, 'delete-impact'), contentLocale), 'GET', undefined, undefined, signal),
|
|
123
|
+
preflight: (id)=>request(()=>contentLocaleURL(route(id, 'preflight'), contentLocale), 'GET'),
|
|
120
124
|
previewToken: (id, arm)=>request(()=>`${route(id, 'preview-token')}?arm=${encodeURIComponent(arm)}`, 'GET'),
|
|
121
125
|
results: (id, options = {})=>request(()=>{
|
|
122
126
|
const query = new URLSearchParams();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const API_MESSAGES: {
|
|
2
2
|
readonly testAlreadyDeleted: "This test was already deleted. Reload the page.";
|
|
3
|
+
readonly deleteInvalidStatus: "This test has changed and cannot be deleted now. Reload the page.";
|
|
3
4
|
readonly testNoLongerDraft: "This test is no longer a draft. Reload the page.";
|
|
4
5
|
readonly notFound: "This test no longer exists.";
|
|
5
6
|
readonly goalNotFound: "That goal no longer exists. Choose another goal.";
|
|
@@ -28,3 +29,6 @@ export declare function refusalMessage(code: string | undefined, status: number,
|
|
|
28
29
|
codes?: Readonly<Record<string, string>>;
|
|
29
30
|
fallback?: string;
|
|
30
31
|
}, detail?: unknown): string;
|
|
32
|
+
export declare const INPUT_COPY: {
|
|
33
|
+
readonly selectRequired: "Choose an option.";
|
|
34
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { unpublishedPlacementsCopy } from './readiness.js';
|
|
2
2
|
export const API_MESSAGES = {
|
|
3
3
|
testAlreadyDeleted: 'This test was already deleted. Reload the page.',
|
|
4
|
+
deleteInvalidStatus: 'This test has changed and cannot be deleted now. Reload the page.',
|
|
4
5
|
testNoLongerDraft: 'This test is no longer a draft. Reload the page.',
|
|
5
6
|
notFound: 'This test no longer exists.',
|
|
6
7
|
goalNotFound: 'That goal no longer exists. Choose another goal.',
|
|
@@ -24,14 +25,17 @@ export const LOCKED_MESSAGES = {
|
|
|
24
25
|
other: "Can't be changed in this state."
|
|
25
26
|
};
|
|
26
27
|
export function refusalMessage(code, status, message, options, detail) {
|
|
27
|
-
//
|
|
28
|
+
// Authorization takes priority over code copy; entry-specific 404s still name the missing entry.
|
|
28
29
|
const mapped = code && options?.codes && Object.hasOwn(options.codes, code) ? options.codes[code] : undefined;
|
|
29
|
-
if (mapped !== undefined) return mapped;
|
|
30
30
|
if (code === 'unauthenticated' || status === 401) return API_MESSAGES.unauthenticated;
|
|
31
|
-
if (code === '
|
|
31
|
+
if (code === 'forbidden' || status === 403) return options?.forbidden ?? API_MESSAGES.forbidden;
|
|
32
|
+
if (code === 'not-found' || status === 404) return mapped ?? options?.notFound ?? API_MESSAGES.notFound;
|
|
32
33
|
if (code === 'commit-unverified') return API_MESSAGES.commitUnverified;
|
|
33
34
|
if (code === 'not-implemented' || status === 501) return API_MESSAGES.notImplemented;
|
|
34
|
-
if (
|
|
35
|
+
if (mapped !== undefined) return mapped;
|
|
35
36
|
if (code === 'placement-unpublished') return unpublishedPlacementsCopy(detail);
|
|
36
37
|
return options?.fallback ?? (message || API_MESSAGES.failed);
|
|
37
38
|
}
|
|
39
|
+
export const INPUT_COPY = {
|
|
40
|
+
selectRequired: 'Choose an option.'
|
|
41
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared by server readiness checks and client placement lists. */
|
|
2
|
+
export declare const PLACEMENT_LANGUAGES: {
|
|
3
|
+
readonly allLocales: "All languages";
|
|
4
|
+
readonly locales: (names: string) => string;
|
|
5
|
+
};
|
|
6
|
+
export interface PlacementLanguages {
|
|
7
|
+
locales?: readonly string[];
|
|
8
|
+
allLocales?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Shared suffix for server findings, placement rows, and delete-impact details. */
|
|
11
|
+
export declare function placementLanguageSuffix({ locales, allLocales }: PlacementLanguages): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Shared by server readiness checks and client placement lists. */ export const PLACEMENT_LANGUAGES = {
|
|
2
|
+
allLocales: 'All languages',
|
|
3
|
+
locales: (names)=>`Languages: ${names}`
|
|
4
|
+
};
|
|
5
|
+
/** Shared suffix for server findings, placement rows, and delete-impact details. */ export function placementLanguageSuffix({ locales, allLocales }) {
|
|
6
|
+
return allLocales ? ` · ${PLACEMENT_LANGUAGES.allLocales}` : locales?.length ? ` · ${PLACEMENT_LANGUAGES.locales(locales.join(', '))}` : '';
|
|
7
|
+
}
|
|
@@ -71,7 +71,7 @@ export declare const placementFailureCopy: (reason: unknown) => "Couldn't check
|
|
|
71
71
|
export declare const fixFieldsNext: (name: string) => string;
|
|
72
72
|
export declare const nextCopy: (sentence: string) => string;
|
|
73
73
|
export declare const versionsNext: (detail: string) => string;
|
|
74
|
-
export declare const contentNext: (group: string) => string;
|
|
74
|
+
export declare const contentNext: (group: string, page?: string) => string;
|
|
75
75
|
export declare const parameterNext: (parameter: string, group: string) => string;
|
|
76
76
|
export declare const placementNext: (group: string, detail: string) => string;
|
|
77
77
|
export declare const goalPeopleNext: (people: string) => string;
|
|
@@ -68,7 +68,7 @@ const withoutPeriod = (value)=>value.trim().replace(/[.!?]+$/, '');
|
|
|
68
68
|
export const fixFieldsNext = (name)=>`Fix the highlighted fields in ${name}.`;
|
|
69
69
|
export const nextCopy = (sentence)=>`Next: ${sentence}`;
|
|
70
70
|
export const versionsNext = (detail)=>`Fix the versions: ${withoutPeriod(detail)}.`;
|
|
71
|
-
export const contentNext = (group)=>`Add content for ${group} on
|
|
71
|
+
export const contentNext = (group, page = 'the page')=>`Add content for ${group} on ${page}.`;
|
|
72
72
|
export const parameterNext = (parameter, group)=>`Set a value for ${parameter} on ${group}.`;
|
|
73
73
|
export const placementNext = (group, detail)=>`Add content for ${group} wherever this setting is used${detail.trim() ? `: ${withoutPeriod(detail)}` : ''}.`;
|
|
74
74
|
export const goalPeopleNext = (people)=>`This goal can't be measured for ${people}. Choose another goal.`;
|
|
@@ -107,3 +107,24 @@ export declare const NUMBER_COMPARISONS: {
|
|
|
107
107
|
readonly lte: "is at most";
|
|
108
108
|
};
|
|
109
109
|
export declare const placementCount: (count: number) => string;
|
|
110
|
+
export declare const DELETE_TEST: {
|
|
111
|
+
readonly blockWinner: (label: string) => string;
|
|
112
|
+
readonly currentSite: "This list reflects the site right now.";
|
|
113
|
+
readonly changedPages: (count: number) => string;
|
|
114
|
+
readonly unreadablePages: (count: number, total: number) => string;
|
|
115
|
+
readonly pageWinner: "These addresses will change where they send visitors:";
|
|
116
|
+
readonly content: "Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.";
|
|
117
|
+
readonly allLocales: "All languages";
|
|
118
|
+
readonly locales: (names: string) => string;
|
|
119
|
+
readonly action: "Delete test";
|
|
120
|
+
readonly cancel: "Cancel";
|
|
121
|
+
readonly deleted: "Test deleted.";
|
|
122
|
+
readonly title: (name: string) => string;
|
|
123
|
+
readonly consequences: "This permanently deletes the test and all its rounds and results.";
|
|
124
|
+
readonly alreadyDeleted: "This test was already deleted.";
|
|
125
|
+
readonly checking: "Checking what visitors will see…";
|
|
126
|
+
readonly checkFailed: "Couldn’t check what visitors will see after deletion. You can still choose to delete this test.";
|
|
127
|
+
readonly noEffect: "Deleting this test will not change what visitors see.";
|
|
128
|
+
readonly versionChange: (before: string, after: string) => string;
|
|
129
|
+
readonly morePages: (count: number) => string;
|
|
130
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PLACEMENT_LANGUAGES } from './languages.js';
|
|
1
2
|
const guardrailsShort = 'Must not get worse';
|
|
2
3
|
const secondaryShort = 'Also keep an eye on';
|
|
3
4
|
export const TEST_PAGE = {
|
|
@@ -109,3 +110,23 @@ export const NUMBER_COMPARISONS = {
|
|
|
109
110
|
lte: 'is at most'
|
|
110
111
|
};
|
|
111
112
|
export const placementCount = (count)=>` (placed ${count} times)`;
|
|
113
|
+
export const DELETE_TEST = {
|
|
114
|
+
action: 'Delete test',
|
|
115
|
+
cancel: 'Cancel',
|
|
116
|
+
deleted: 'Test deleted.',
|
|
117
|
+
title: (name)=>`Delete “${name}”?`,
|
|
118
|
+
consequences: 'This permanently deletes the test and all its rounds and results.',
|
|
119
|
+
alreadyDeleted: 'This test was already deleted.',
|
|
120
|
+
checking: 'Checking what visitors will see…',
|
|
121
|
+
checkFailed: "Couldn’t check what visitors will see after deletion. You can still choose to delete this test.",
|
|
122
|
+
noEffect: 'Deleting this test will not change what visitors see.',
|
|
123
|
+
versionChange: (before, after)=>`${before} → ${after}`,
|
|
124
|
+
morePages: (count)=>`${count} more ${count === 1 ? 'page' : 'pages'}.`,
|
|
125
|
+
...PLACEMENT_LANGUAGES,
|
|
126
|
+
blockWinner: (label)=>`On these pages, visitors will see ${label} again, or nothing where it is empty:`,
|
|
127
|
+
currentSite: 'This list reflects the site right now.',
|
|
128
|
+
changedPages: (count)=>`${count} ${count === 1 ? 'page' : 'pages'} will change`,
|
|
129
|
+
unreadablePages: (count, total)=>total === 1 ? "You can't open this page." : count === total ? "You can't open any of these pages." : `You can't open ${count} of these pages.`,
|
|
130
|
+
pageWinner: 'These addresses will change where they send visitors:',
|
|
131
|
+
content: 'Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.'
|
|
132
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
type Placement = PreflightResult['placements'][number];
|
|
3
|
+
/** Shared row identity. Legacy previews and edit links omit publication state;
|
|
4
|
+
* Binding already showed it on single-language sites. */
|
|
5
|
+
export declare function placementLabel(placement: Placement, showState?: boolean, states?: string[]): string;
|
|
6
|
+
/** A shared editor link describes the union of its rows, retaining their first page title. */
|
|
7
|
+
export declare function placementGroupLabel(placements: readonly Placement[], configuredLanguages?: readonly string[]): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { placementLanguageSuffix } from './copy/languages.js';
|
|
2
|
+
/** Shared row identity. Legacy previews and edit links omit publication state;
|
|
3
|
+
* Binding already showed it on single-language sites. */ export function placementLabel(placement, showState = Boolean(placement.allLocales || placement.locales?.length), states = [
|
|
4
|
+
placement.detail === 'Published' ? 'Published' : 'Draft'
|
|
5
|
+
]) {
|
|
6
|
+
return `${placement.title}${showState ? ` (${states.join(', ')})` : ''}${placementLanguageSuffix(placement)}`;
|
|
7
|
+
}
|
|
8
|
+
/** A shared editor link describes the union of its rows, retaining their first page title. */ export function placementGroupLabel(placements, configuredLanguages) {
|
|
9
|
+
const first = placements[0];
|
|
10
|
+
const locales = [
|
|
11
|
+
...new Set(placements.flatMap((row)=>row.locales ?? []))
|
|
12
|
+
];
|
|
13
|
+
const allLocales = placements.some((row)=>row.allLocales) || Boolean(configuredLanguages?.length && configuredLanguages.every((name)=>locales.includes(name)));
|
|
14
|
+
const states = [
|
|
15
|
+
...new Set(placements.map((row)=>row.detail === 'Published' ? 'Published' : 'Draft'))
|
|
16
|
+
];
|
|
17
|
+
return placementLabel({
|
|
18
|
+
...first,
|
|
19
|
+
locales,
|
|
20
|
+
...allLocales ? {
|
|
21
|
+
allLocales: true
|
|
22
|
+
} : {}
|
|
23
|
+
}, true, states);
|
|
24
|
+
}
|
|
@@ -7,5 +7,7 @@ export declare function resolvedPlacementLabel(value: unknown, match: {
|
|
|
7
7
|
id?: DocId | null;
|
|
8
8
|
title?: string;
|
|
9
9
|
editorUrl?: string;
|
|
10
|
+
locales?: string[];
|
|
11
|
+
allLocales?: true;
|
|
10
12
|
} | undefined, adminRoute: string): PlacementLabel;
|
|
11
13
|
export declare function preflightPlacementLabel(value: unknown, preflight: PreflightResult, adminRoute: string): PlacementLabel;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { placementLanguageSuffix } from '../copy/languages.js';
|
|
1
2
|
import { formatAdminURL } from '../format/adminURL.js';
|
|
2
3
|
import { placementDetail } from './placementLabels.model.js';
|
|
3
4
|
export { placementDetailKey, placementDetail, fallbackPlacementLabel } from './placementLabels.model.js';
|
|
@@ -5,7 +6,7 @@ export function resolvedPlacementLabel(value, match, adminRoute) {
|
|
|
5
6
|
const detail = placementDetail(value);
|
|
6
7
|
const id = match?.id ?? detail.id;
|
|
7
8
|
return {
|
|
8
|
-
title: match?.title?.trim() || detail.path || 'This page'
|
|
9
|
+
title: `${match?.title?.trim() || detail.path || 'This page'}${placementLanguageSuffix(match ?? {})}`,
|
|
9
10
|
...id != null && detail.collection ? {
|
|
10
11
|
href: match?.editorUrl || formatAdminURL({
|
|
11
12
|
adminRoute,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:where(.xp-test-surface) .xp-verdict-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--xp-space-3); margin-top: var(--xp-space-5); padding-top: var(--xp-space-4); border-top: 1px solid var(--xp-border); color: var(--xp-text-3); font: var(--xp-text-small); }
|
|
7
7
|
:where(.xp-test-surface) .xp-round-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
|
|
8
8
|
:where(.xp-test-surface) .xp-round-meta .xp-ui-field { display: flex; align-items: center; gap: var(--xp-space-2); margin: 0; min-width: 0; }
|
|
9
|
-
:where(.xp-test-surface) .xp-round-meta .xp-ui-
|
|
9
|
+
:where(.xp-test-surface) .xp-round-meta .xp-ui-combobox-wrap { width: auto; max-width: 100%; }
|
|
10
10
|
:where(.xp-test-surface) .xp-results-chips { display: flex; flex-wrap: wrap; gap: var(--xp-space-2); list-style: none; padding: 0; margin-bottom: 0; }
|
|
11
11
|
:where(.xp-test-surface) .xp-stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); overflow: hidden; }
|
|
12
12
|
:where(.xp-test-surface) .xp-stat-tile { padding: 20px; min-width: 0; }
|
|
@@ -17,6 +17,8 @@ export interface SurfaceProps {
|
|
|
17
17
|
editorPlacementMessage?: string;
|
|
18
18
|
adminRoute: string;
|
|
19
19
|
apiRoute: string;
|
|
20
|
+
contentLanguageLabels?: string[];
|
|
21
|
+
contentLocale?: string;
|
|
20
22
|
collectionTitles?: Record<string, string>;
|
|
21
23
|
userId?: string | number;
|
|
22
24
|
userCollection?: string;
|
|
@@ -19,3 +19,8 @@ export declare function sidebarReadinessBlockers(test: TestDocApi, surface: Surf
|
|
|
19
19
|
})[] | {
|
|
20
20
|
sentence: "Checking readiness…";
|
|
21
21
|
}[];
|
|
22
|
+
/** The local notice already names this pair. Keep other pairs and other pages. */
|
|
23
|
+
export declare function editorNestedChecks(checks: PreflightResult['checks'], page: NonNullable<SurfaceProps['editorPage']>, identity: {
|
|
24
|
+
outerSlug: string;
|
|
25
|
+
innerSlug: string;
|
|
26
|
+
}): PreflightResult['checks'];
|
|
@@ -58,3 +58,21 @@ export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from
|
|
|
58
58
|
}
|
|
59
59
|
] : blockers.filter((step)=>step.sentence !== notice);
|
|
60
60
|
}
|
|
61
|
+
/** The local notice already names this pair. Keep other pairs and other pages. */ export function editorNestedChecks(checks, page, identity) {
|
|
62
|
+
return checks.flatMap((check)=>{
|
|
63
|
+
if (check.code !== 'nested-tests' || check.ok || !Array.isArray(check.detail)) return [
|
|
64
|
+
check
|
|
65
|
+
];
|
|
66
|
+
const detail = check.detail.filter((value)=>{
|
|
67
|
+
if (!value || typeof value !== 'object') return true;
|
|
68
|
+
const pair = value;
|
|
69
|
+
return pair.collection !== page.collection || String(pair.id) !== String(page.id) || pair.outerSlug !== identity.outerSlug || pair.innerSlug !== identity.innerSlug;
|
|
70
|
+
});
|
|
71
|
+
return detail.length ? [
|
|
72
|
+
{
|
|
73
|
+
...check,
|
|
74
|
+
detail
|
|
75
|
+
}
|
|
76
|
+
] : [];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
2
|
+
import { placementLabel } from '../../placementLabel.js';
|
|
2
3
|
export function placementLine(placement) {
|
|
3
|
-
return `${C.onPage} ${
|
|
4
|
+
return `${C.onPage} ${placementLabel(placement, true)}`;
|
|
4
5
|
}
|
|
5
6
|
export function slotReady(placement, arm) {
|
|
6
7
|
const slot = arm.kind === 'holdout' ? 'control' : arm.slot;
|