@delmaredigital/payload-experiments 0.4.0-rc.6 → 0.4.0-rc.9
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/README.md +12 -12
- 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 +9 -5
- package/dist/admin/copy/blocks.d.ts +3 -2
- package/dist/admin/copy/blocks.js +8 -7
- package/dist/admin/surface/ResultsRoute.js +18 -11
- package/dist/admin/surface/TestsHome.d.ts +2 -1
- package/dist/admin/surface/TestsHome.js +131 -44
- 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 +9 -2
- package/dist/admin/surface/newTest/newTest.css +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +11 -6
- package/dist/admin/surface/test/TestPage.js +3 -3
- 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/formState.js +1 -1
- 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/collections/experiments/config.js +8 -3
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +5 -4
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.js +8 -4
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +1 -0
- 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 +207 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +9 -8
- package/dist/endpoints/pages.js +7 -3
- package/dist/endpoints/placementStatus.js +13 -5
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/transitions.js +37 -24
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +6 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- 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/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- 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/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +3 -0
- package/dist/hooks/pageGuard.js +37 -23
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- 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 +13 -6
- package/dist/onInit.js +14 -0
- package/dist/options.js +5 -0
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/ExperimentPicker.js +40 -37
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +8 -4
- package/dist/puck/editor/ConfigureTestDrawer.js +5 -2
- package/dist/puck/editor/ExperimentSlotEditor.js +313 -158
- package/dist/puck/editor/LeftoverVersions.d.ts +1 -1
- package/dist/puck/editor/LeftoverVersions.js +40 -43
- package/dist/puck/editor/QuickTestActions.d.ts +5 -2
- package/dist/puck/editor/QuickTestActions.js +16 -4
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +2 -1
- package/dist/puck/editor/VersionBuilder.d.ts +31 -3
- package/dist/puck/editor/VersionBuilder.js +336 -74
- package/dist/puck/editor/armWrites.js +1 -1
- package/dist/puck/editor/armsCache.js +1 -3
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/copy.d.ts +12 -2
- package/dist/puck/editor/copy.js +13 -2
- package/dist/puck/editor/editor.chrome.css +118 -3
- package/dist/puck/editor/editor.css +131 -8
- package/dist/puck/editor/editor.model.d.ts +3 -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 +22 -12
- package/dist/puck/editor/placementsCache.js +62 -49
- package/dist/puck/editor/usePageSaveReadiness.d.ts +9 -0
- package/dist/puck/editor/usePageSaveReadiness.js +34 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
- package/dist/puck/editor/usePlacementNotice.js +6 -4
- 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/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.js +2 -1
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +20 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +45 -21
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +4 -7
- package/dist/server/runResults.js +52 -14
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/testSurface/PreviewLinks.js +6 -2
- package/dist/testSurface/actions/DecideDialog.d.ts +4 -1
- package/dist/testSurface/actions/DecideDialog.js +32 -14
- package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
- package/dist/testSurface/actions/MakeContentResult.js +9 -1
- package/dist/testSurface/api.d.ts +11 -8
- package/dist/testSurface/api.js +27 -11
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/testSurface/copy/actions.d.ts +1 -0
- package/dist/testSurface/copy/actions.js +1 -0
- package/dist/testSurface/copy/common.d.ts +6 -0
- package/dist/testSurface/copy/common.js +11 -5
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/testSurface/copy/metrics.d.ts +1 -0
- package/dist/testSurface/copy/metrics.js +1 -0
- package/dist/testSurface/copy/readiness.d.ts +13 -2
- package/dist/testSurface/copy/readiness.js +19 -2
- package/dist/testSurface/copy/results.d.ts +5 -2
- package/dist/testSurface/copy/results.js +5 -2
- package/dist/testSurface/copy/testPage.d.ts +40 -1
- package/dist/testSurface/copy/testPage.js +53 -1
- 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/readPreflight.d.ts +5 -0
- package/dist/testSurface/readPreflight.js +7 -0
- package/dist/testSurface/readinessRead.d.ts +3 -0
- package/dist/testSurface/readinessRead.js +4 -0
- package/dist/testSurface/results/VerdictHero.d.ts +2 -1
- package/dist/testSurface/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +1 -1
- package/dist/testSurface/results/results.model.d.ts +1 -1
- package/dist/testSurface/results/results.model.js +6 -2
- package/dist/testSurface/surface/contracts.d.ts +10 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +7 -2
- package/dist/testSurface/surface/editorPlacement.js +19 -1
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +4 -3
- package/dist/testSurface/surface/pageBlock/parts.js +24 -6
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +20 -6
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +4 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.js +39 -34
- package/dist/testSurface/surface/readiness/Banner.js +23 -12
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +4 -3
- package/dist/testSurface/surface/readiness/SaveStatus.js +15 -15
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +6 -1
- package/dist/testSurface/surface/readiness/readiness.model.js +116 -12
- package/dist/testSurface/surface/readiness/useTransition.d.ts +4 -4
- package/dist/testSurface/surface/readiness/useTransition.js +12 -10
- package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -2
- package/dist/testSurface/surface/results/ReleasePages.js +5 -4
- package/dist/testSurface/surface/results/ResultsBody.d.ts +4 -2
- package/dist/testSurface/surface/results/ResultsBody.js +86 -43
- package/dist/testSurface/surface/results/useResults.d.ts +11 -7
- package/dist/testSurface/surface/results/useResults.js +3 -2
- package/dist/testSurface/surface/setting/parts.js +58 -18
- package/dist/testSurface/surface/test/AdvancedSection.js +1 -0
- package/dist/testSurface/surface/test/DeleteTest.d.ts +19 -0
- package/dist/testSurface/surface/test/DeleteTest.js +262 -0
- package/dist/testSurface/surface/test/GoalSection.js +7 -3
- package/dist/testSurface/surface/test/LengthSection.js +3 -0
- package/dist/testSurface/surface/test/PageHoldout.js +4 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +1 -1
- package/dist/testSurface/surface/test/TargetingSection.js +77 -12
- package/dist/testSurface/surface/test/TestSurface.js +97 -15
- package/dist/testSurface/surface/test/VersionsSection.js +56 -29
- package/dist/testSurface/surface/test/fields.d.ts +29 -4
- package/dist/testSurface/surface/test/fields.js +159 -39
- package/dist/testSurface/surface/test/pageParts.js +14 -5
- package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
- package/dist/testSurface/surface/test/testPage.model.js +6 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
- package/dist/testSurface/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +23 -4
- package/dist/testSurface/surface/useTestDocument.js +425 -162
- package/dist/testSurface/useApi.d.ts +9 -6
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.js +3 -1
- package/dist/transitions/addMetric.d.ts +1 -4
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +5 -1
- package/dist/transitions/checkStart.js +130 -16
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +5 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +2 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +17 -12
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +15 -11
- package/dist/transitions/placements.d.ts +28 -1
- package/dist/transitions/placements.js +223 -60
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +126 -37
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +70 -34
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +6 -3
- package/dist/types/endpoints.d.ts +86 -9
- package/dist/types/endpoints.js +1 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +2 -0
- package/dist/ui/Button.js +2 -2
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- 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
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { TestsSurfaceProps } from '../../types/surface.js';
|
|
3
3
|
import type { SerializedAttributeKeys, SerializedFlagPoint, SerializedMetricSource } from '../../types/admin.js';
|
|
4
|
+
import type { ArmSlot } from '../../types/puck.js';
|
|
4
5
|
import type { useTestDocument } from './useTestDocument.js';
|
|
5
6
|
/** Sections of the test page, in readiness order (surface spec §6.2, §8). */
|
|
6
7
|
export type SectionId = 'what' | 'versions' | 'win' | 'who' | 'length' | 'advanced';
|
|
7
8
|
export declare const SECTION_ORDER: readonly SectionId[];
|
|
8
9
|
/** The data layer's return value; every section takes it as `test`. */
|
|
9
|
-
|
|
10
|
+
type DocumentApi = ReturnType<typeof useTestDocument>;
|
|
11
|
+
type FieldLifecycle = Pick<DocumentApi, 'mountDraft' | 'submitDraft' | 'syncDocument'>;
|
|
12
|
+
export type TestDocApi = Omit<DocumentApi, keyof FieldLifecycle> & Partial<FieldLifecycle>;
|
|
13
|
+
/** Quick actions have a document reader and transition handlers, with no field editor. */
|
|
14
|
+
export type ActionTestApi = Omit<TestDocApi, 'stage' | 'commit' | 'choosePage' | 'chosenPages' | 'mountDraft' | 'submitDraft' | 'trackDraft' | 'syncDocument'>;
|
|
10
15
|
/** Serialisable props the server root view passes to the surface (ADM-20). */
|
|
11
16
|
export interface SurfaceProps {
|
|
12
17
|
/** Present only when configuring a block from its page editor. */
|
|
13
18
|
editorPage?: {
|
|
14
19
|
collection: string;
|
|
15
20
|
id: string;
|
|
21
|
+
versionContent?: Partial<Record<ArmSlot, 'filled' | 'partial' | 'empty'>>;
|
|
16
22
|
};
|
|
17
23
|
editorPlacementMessage?: string;
|
|
18
24
|
adminRoute: string;
|
|
19
25
|
apiRoute: string;
|
|
26
|
+
contentLanguageLabels?: string[];
|
|
27
|
+
contentLocale?: string;
|
|
20
28
|
collectionTitles?: Record<string, string>;
|
|
21
29
|
userId?: string | number;
|
|
22
30
|
userCollection?: string;
|
|
@@ -53,3 +61,4 @@ export interface ReadinessParts {
|
|
|
53
61
|
/** Check-circle state per section, from preflight. */
|
|
54
62
|
sectionDone(test: TestDocApi): Record<SectionId, boolean>;
|
|
55
63
|
}
|
|
64
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PreflightResult } from '../../types/endpoints.js';
|
|
2
2
|
import type { Status } from '../../types/contracts.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ActionTestApi, SurfaceProps } from './contracts.js';
|
|
4
4
|
export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
|
|
5
5
|
/** Replace only the guidance represented by this page's local notice. */
|
|
6
6
|
export declare function editorPlacementChecks(checks: PreflightResult['checks'], page: NonNullable<SurfaceProps['editorPage']>): PreflightResult['checks'];
|
|
@@ -9,7 +9,7 @@ export declare function editorPlacementMessage(placements: PreflightResult['plac
|
|
|
9
9
|
/** Replace this page's checks once, retaining every other page's blocker. */
|
|
10
10
|
export declare function editorPreflight(answer: PreflightResult | null, surface: SurfaceProps, includeLocalBlocker?: boolean): PreflightResult | null;
|
|
11
11
|
/** Shared sidebar policy; the bounded list renders these steps verbatim. */
|
|
12
|
-
export declare function sidebarReadinessBlockers(test:
|
|
12
|
+
export declare function sidebarReadinessBlockers(test: ActionTestApi, surface: SurfaceProps): ({
|
|
13
13
|
arm?: import("../../types/contracts.js").ArmKey | undefined;
|
|
14
14
|
section: "header" | import("./contracts.js").SectionId;
|
|
15
15
|
sentence: 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'];
|
|
@@ -47,7 +47,7 @@ export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from
|
|
|
47
47
|
const answer = editorPreflight(test.preflight, surface, false);
|
|
48
48
|
const blockers = test.doc ? blockingSteps(answer, pageReadinessContext(test.doc, test.preflight, surface)) : [];
|
|
49
49
|
const notice = test.preflightRead?.message ?? surface.editorPlacementMessage;
|
|
50
|
-
return test.
|
|
50
|
+
return test.saving === 'saving' ? [
|
|
51
51
|
{
|
|
52
52
|
sentence: READINESS_COPY.saveFirst
|
|
53
53
|
},
|
|
@@ -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,8 +1,9 @@
|
|
|
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
|
-
const slot = arm.kind === 'holdout' ? 'control' : arm.
|
|
7
|
-
return
|
|
7
|
+
const slot = arm.kind === 'holdout' ? 'control' : arm.key;
|
|
8
|
+
return slot !== 'holdout' && (placement.slots?.[slot] ?? 0) > 0;
|
|
8
9
|
}
|
|
@@ -5,8 +5,10 @@ import { Button } from '../../../ui/Button.js';
|
|
|
5
5
|
import { placementPages } from '../../../lib/placementPages.js';
|
|
6
6
|
import { TEST_PAGE as C, placementCount } from '../../copy/testPage.js';
|
|
7
7
|
import { placementLine, slotReady } from './pageBlock.model.js';
|
|
8
|
+
import { placementLabel, placementGroupLabel } from '../../placementLabel.js';
|
|
8
9
|
function Binding({ test, surface }) {
|
|
9
10
|
const placements = test.preflight?.placements ?? [];
|
|
11
|
+
const pages = placementPages(placements);
|
|
10
12
|
return /*#__PURE__*/ _jsx("div", {
|
|
11
13
|
className: "xp-page-binding",
|
|
12
14
|
children: surface.editorPlacementMessage ? test.doc?.status === 'running' ? /*#__PURE__*/ _jsxs(Banner, {
|
|
@@ -20,7 +22,7 @@ function Binding({ test, surface }) {
|
|
|
20
22
|
]
|
|
21
23
|
}) : null : placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
22
24
|
children: [
|
|
23
|
-
|
|
25
|
+
pages.map((placement)=>/*#__PURE__*/ _jsxs("p", {
|
|
24
26
|
className: "xp-ui-button-group",
|
|
25
27
|
children: [
|
|
26
28
|
placementLine(placement),
|
|
@@ -30,6 +32,7 @@ function Binding({ test, surface }) {
|
|
|
30
32
|
variant: "link",
|
|
31
33
|
size: "sm",
|
|
32
34
|
href: placement.editorUrl,
|
|
35
|
+
"aria-label": pages.length > 1 ? `${C.openPage}: ${placementLabel(placement, true)}` : undefined,
|
|
33
36
|
children: C.openPage
|
|
34
37
|
}) : null
|
|
35
38
|
]
|
|
@@ -43,7 +46,7 @@ function Binding({ test, surface }) {
|
|
|
43
46
|
})
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
|
-
function VersionContent({ test, armIndex, summary }) {
|
|
49
|
+
function VersionContent({ test, surface, armIndex, summary }) {
|
|
47
50
|
const arm = test.doc?.arms[armIndex];
|
|
48
51
|
if (!arm) return null;
|
|
49
52
|
if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
|
|
@@ -52,6 +55,15 @@ function VersionContent({ test, armIndex, summary }) {
|
|
|
52
55
|
});
|
|
53
56
|
const placements = test.preflight?.placements ?? [];
|
|
54
57
|
const pages = placementPages(placements);
|
|
58
|
+
const localized = pages.some((page)=>page.allLocales || page.locales?.length);
|
|
59
|
+
const editPages = new Map();
|
|
60
|
+
for (const page of pages){
|
|
61
|
+
if (!page.editorUrl) continue;
|
|
62
|
+
const key = localized ? page.editorUrl : page.key;
|
|
63
|
+
const group = editPages.get(key) ?? [];
|
|
64
|
+
group.push(page);
|
|
65
|
+
editPages.set(key, group);
|
|
66
|
+
}
|
|
55
67
|
const ready = placements.length > 0 && placements.every((placement)=>slotReady(placement, arm));
|
|
56
68
|
return /*#__PURE__*/ _jsxs("div", {
|
|
57
69
|
className: "xp-version-content",
|
|
@@ -62,13 +74,19 @@ function VersionContent({ test, armIndex, summary }) {
|
|
|
62
74
|
}),
|
|
63
75
|
/*#__PURE__*/ _jsx("div", {
|
|
64
76
|
className: "xp-ui-button-group",
|
|
65
|
-
children: !summary ?
|
|
77
|
+
children: !summary ? [
|
|
78
|
+
...editPages.values()
|
|
79
|
+
].map((group)=>{
|
|
80
|
+
const page = group[0];
|
|
81
|
+
const label = localized ? `${C.editOnPage}: ${placementGroupLabel(group, surface.contentLanguageLabels)}` : C.editOnPage;
|
|
82
|
+
return /*#__PURE__*/ _jsx(Button, {
|
|
66
83
|
variant: "link",
|
|
67
84
|
size: "sm",
|
|
68
85
|
href: page.editorUrl,
|
|
69
|
-
"aria-label": pages.length > 1 ? `${C.editOnPage}: ${page.title}` : undefined,
|
|
70
|
-
children:
|
|
71
|
-
}, page.key)
|
|
86
|
+
"aria-label": localized ? label : pages.length > 1 ? `${C.editOnPage}: ${page.title}` : undefined,
|
|
87
|
+
children: label
|
|
88
|
+
}, page.key);
|
|
89
|
+
}) : null
|
|
72
90
|
})
|
|
73
91
|
]
|
|
74
92
|
});
|
|
@@ -83,6 +83,16 @@ const display = (row)=>`${row.title ? `${row.title} · ` : ''}${row.path ?? ''}$
|
|
|
83
83
|
const [error, setError] = useState('');
|
|
84
84
|
const revision = useRef(0);
|
|
85
85
|
const firstNew = useRef(null);
|
|
86
|
+
const [resultsCollection, setResultsCollection] = useState(collection.slug);
|
|
87
|
+
if (resultsCollection !== collection.slug) {
|
|
88
|
+
setResultsCollection(collection.slug);
|
|
89
|
+
setPage(1);
|
|
90
|
+
setReveal(8);
|
|
91
|
+
setRows([]);
|
|
92
|
+
setMore(false);
|
|
93
|
+
setActive(null);
|
|
94
|
+
firstNew.current = null;
|
|
95
|
+
}
|
|
86
96
|
const locked = reasonFor(test, 'arms');
|
|
87
97
|
const saving = test.saving === 'saving';
|
|
88
98
|
const blocked = Boolean(locked || saving);
|
|
@@ -245,14 +255,14 @@ const display = (row)=>`${row.title ? `${row.title} · ` : ''}${row.path ?? ''}$
|
|
|
245
255
|
role: "combobox",
|
|
246
256
|
"aria-autocomplete": "list",
|
|
247
257
|
autoComplete: "off",
|
|
248
|
-
"aria-expanded": open,
|
|
258
|
+
"aria-expanded": open && !locked,
|
|
249
259
|
"aria-controls": `${id}-list`,
|
|
250
|
-
"aria-activedescendant": open && activeKey ? `${id}-option-${activeKey}` : undefined,
|
|
260
|
+
"aria-activedescendant": open && !locked && activeKey ? `${id}-option-${activeKey}` : undefined,
|
|
251
261
|
placeholder: C.choose,
|
|
252
262
|
value: open ? search : value,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
"aria-
|
|
263
|
+
readOnly: blocked,
|
|
264
|
+
"aria-disabled": blocked || undefined,
|
|
265
|
+
"aria-describedby": locked ? `${id}-lock` : undefined,
|
|
256
266
|
onClick: ()=>show(),
|
|
257
267
|
onBlur: (event)=>{
|
|
258
268
|
if (!root.current?.contains(event.relatedTarget)) close();
|
|
@@ -311,7 +321,11 @@ const display = (row)=>`${row.title ? `${row.title} · ` : ''}${row.path ?? ''}$
|
|
|
311
321
|
}
|
|
312
322
|
}
|
|
313
323
|
}),
|
|
314
|
-
|
|
324
|
+
locked ? /*#__PURE__*/ _jsx("p", {
|
|
325
|
+
id: `${id}-lock`,
|
|
326
|
+
children: locked
|
|
327
|
+
}) : null,
|
|
328
|
+
open && !locked ? /*#__PURE__*/ _jsxs("div", {
|
|
315
329
|
className: "xp-page-combobox-popup",
|
|
316
330
|
children: [
|
|
317
331
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ActionTestApi, SurfaceProps } from '../contracts.js';
|
|
2
2
|
import type { ExperimentAction } from '../../actions/actions.model.js';
|
|
3
|
-
type Props =
|
|
3
|
+
type Props = {
|
|
4
|
+
test: ActionTestApi;
|
|
5
|
+
surface: SurfaceProps;
|
|
4
6
|
onClose(): void;
|
|
5
7
|
};
|
|
6
8
|
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */
|
|
@@ -16,50 +16,58 @@ import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
|
16
16
|
import { API_MESSAGES, refusalMessage } from '../../copy/common.js';
|
|
17
17
|
import { createApi } from '../../api.js';
|
|
18
18
|
import { blockingSteps, pageReadinessContext } from './readiness.model.js';
|
|
19
|
+
import { actionWaitMessage } from './SaveStatus.js';
|
|
19
20
|
import { useTransition } from './useTransition.js';
|
|
20
21
|
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */ export function ConfirmAction({ test, surface, action, winnerLabel, onClose }) {
|
|
21
22
|
const api = createApi(surface.apiRoute);
|
|
23
|
+
const [openedPhase] = useState(test.doc?.phase);
|
|
22
24
|
const [typed, setTyped] = useState('');
|
|
23
25
|
const [content, setContent] = useState(null);
|
|
24
26
|
const [reportBusy, setReportBusy] = useState(false);
|
|
25
27
|
const transition = useTransition(test, onClose, surface);
|
|
28
|
+
const wait = action.id === 'start' ? actionWaitMessage(test) : undefined;
|
|
26
29
|
const phrase = action.confirm.phrase ? expectedConfirm(action.confirm.phrase.action, winnerLabel) : null;
|
|
27
30
|
const ready = action.id !== 'start' || !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
28
|
-
const enabled = ready && !
|
|
31
|
+
const enabled = ready && !test.statusReadPending && !transition.busy && !wait && (!phrase || matchesConfirm(phrase, typed));
|
|
29
32
|
async function submit(finish = false) {
|
|
30
33
|
if (!enabled || !test.doc) return;
|
|
31
|
-
const id = test.doc
|
|
34
|
+
const { id, phase } = test.doc;
|
|
32
35
|
await transition.run(finish ? 'archive' : action.id === 'start' && test.doc.status === 'stopped' ? 'restart' : action.id, async ()=>{
|
|
33
36
|
if (finish) return api.archive(id, {
|
|
34
|
-
mode: 'after-content'
|
|
37
|
+
mode: 'after-content',
|
|
38
|
+
phase
|
|
35
39
|
});
|
|
36
40
|
if (action.archive) return api.archive(id, {
|
|
37
41
|
...action.archive,
|
|
42
|
+
phase,
|
|
38
43
|
...phrase ? {
|
|
39
44
|
confirmation: typed.trim()
|
|
40
45
|
} : {}
|
|
41
46
|
});
|
|
42
|
-
if (action.id === 'start') return api.start(id);
|
|
43
|
-
if (action.id === 'stop') return api.stop(id);
|
|
44
|
-
if (action.id === 'release-holdout') return api.releaseHoldout(id);
|
|
45
|
-
const result = await api.makeContent(id);
|
|
47
|
+
if (action.id === 'start') return api.start(id, openedPhase);
|
|
48
|
+
if (action.id === 'stop') return api.stop(id, openedPhase);
|
|
49
|
+
if (action.id === 'release-holdout') return api.releaseHoldout(id, phase);
|
|
50
|
+
const result = await api.makeContent(id, phase);
|
|
46
51
|
if (result.ok && result.data) {
|
|
47
52
|
setContent(result.data);
|
|
48
53
|
return result;
|
|
49
54
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
if (result.ok) {
|
|
56
|
+
await test.reload();
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
status: 0,
|
|
60
|
+
retryable: true,
|
|
61
|
+
message: API_MESSAGES.unreadable
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
56
65
|
}, {
|
|
57
|
-
|
|
66
|
+
closeOnSuccess: finish || action.id !== 'make-content'
|
|
58
67
|
});
|
|
59
68
|
}
|
|
60
69
|
function close() {
|
|
61
70
|
if (transition.busy || reportBusy) return;
|
|
62
|
-
if (content) void test.reload();
|
|
63
71
|
onClose();
|
|
64
72
|
}
|
|
65
73
|
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
@@ -77,9 +85,13 @@ import { useTransition } from './useTransition.js';
|
|
|
77
85
|
isDecided: (content.doc?.status ?? test.doc?.status) === 'decided',
|
|
78
86
|
onRetry: ()=>submit(),
|
|
79
87
|
onFinish: ()=>submit(true),
|
|
80
|
-
busy: transition.busy,
|
|
88
|
+
busy: transition.busy || test.statusReadPending,
|
|
81
89
|
onBusyChange: setReportBusy,
|
|
82
|
-
onActionStart: transition.clearError
|
|
90
|
+
onActionStart: transition.clearError,
|
|
91
|
+
onDocumentChange: async (result)=>{
|
|
92
|
+
if (result.ok) test.acceptTransition?.(result.data);
|
|
93
|
+
await test.reload();
|
|
94
|
+
}
|
|
83
95
|
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
84
96
|
children: [
|
|
85
97
|
/*#__PURE__*/ _jsx("p", {
|
|
@@ -115,8 +127,8 @@ import { useTransition } from './useTransition.js';
|
|
|
115
127
|
role: "alert",
|
|
116
128
|
children: transition.error
|
|
117
129
|
}) : null,
|
|
118
|
-
!content &&
|
|
119
|
-
children:
|
|
130
|
+
!content && wait ? /*#__PURE__*/ _jsx("p", {
|
|
131
|
+
children: wait
|
|
120
132
|
}) : !content && action.id === 'start' && !readyToStart(test, surface.editorPlacementMessage) ? /*#__PURE__*/ _jsx("p", {
|
|
121
133
|
children: test.preflightError ? test.preflightError : test.doc ? blockingSteps(test.preflight, pageReadinessContext(test.doc, test.preflight, surface))[0]?.sentence ?? C.checking : C.checking
|
|
122
134
|
}) : null,
|
|
@@ -139,11 +151,12 @@ import { useTransition } from './useTransition.js';
|
|
|
139
151
|
}
|
|
140
152
|
/** AllocateDialog's validation and copy, with data supplied by the test document. */ export function AllocateAction({ test, surface, onClose }) {
|
|
141
153
|
const current = test.doc?.allocation ?? 100;
|
|
154
|
+
const [openedPhase] = useState(test.doc?.phase);
|
|
142
155
|
const [value, setValue] = useState(String(Math.min(100, current + 1)));
|
|
143
156
|
const transition = useTransition(test, onClose, surface);
|
|
144
157
|
const allocation = Number(value);
|
|
145
158
|
const valid = value.trim() !== '' && Number.isInteger(allocation) && allocation > current && allocation <= 100;
|
|
146
|
-
const disabled = transition.busy || test.
|
|
159
|
+
const disabled = transition.busy || test.statusReadPending;
|
|
147
160
|
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
148
161
|
open: true,
|
|
149
162
|
dismissible: !transition.busy,
|
|
@@ -169,9 +182,6 @@ import { useTransition } from './useTransition.js';
|
|
|
169
182
|
})
|
|
170
183
|
]
|
|
171
184
|
}),
|
|
172
|
-
test.hasUnsaved || test.saving === 'saving' ? /*#__PURE__*/ _jsx("p", {
|
|
173
|
-
children: test.stale ? C.reloadFirst : C.saveFirst
|
|
174
|
-
}) : null,
|
|
175
185
|
!valid ? /*#__PURE__*/ _jsx("p", {
|
|
176
186
|
children: R.allocationInvalid
|
|
177
187
|
}) : null,
|
|
@@ -189,7 +199,8 @@ import { useTransition } from './useTransition.js';
|
|
|
189
199
|
onClick: ()=>{
|
|
190
200
|
// Not-found can also mean the experiment is missing; use round copy for the missing phase record.
|
|
191
201
|
if (valid && test.doc) void transition.run('allocate', ()=>createApi(surface.apiRoute).allocate(test.doc.id, {
|
|
192
|
-
allocation
|
|
202
|
+
allocation,
|
|
203
|
+
phase: openedPhase
|
|
193
204
|
}, {
|
|
194
205
|
notFound: API_MESSAGES.roundChanged
|
|
195
206
|
}));
|
|
@@ -244,10 +255,9 @@ import { useTransition } from './useTransition.js';
|
|
|
244
255
|
].filter((id)=>id != null).map(String));
|
|
245
256
|
const available = metrics.filter((item)=>!attached.has(String(item.id)));
|
|
246
257
|
const selected = available.find((item)=>String(item.id) === metric);
|
|
247
|
-
const disabled = transition.busy || test.
|
|
258
|
+
const disabled = transition.busy || test.statusReadPending;
|
|
248
259
|
function close() {
|
|
249
260
|
if (transition.busy) return;
|
|
250
|
-
if (warnings) void test.reload();
|
|
251
261
|
onClose();
|
|
252
262
|
}
|
|
253
263
|
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
@@ -318,9 +328,7 @@ import { useTransition } from './useTransition.js';
|
|
|
318
328
|
role: "alert",
|
|
319
329
|
children: loadError ?? transition.error
|
|
320
330
|
}) : null,
|
|
321
|
-
|
|
322
|
-
children: test.stale ? C.reloadFirst : C.saveFirst
|
|
323
|
-
}) : !loading && !loadError && available.length > 0 && !selected ? /*#__PURE__*/ _jsx("p", {
|
|
331
|
+
!loading && !loadError && available.length > 0 && !selected ? /*#__PURE__*/ _jsx("p", {
|
|
324
332
|
children: C.chooseGoalToAdd
|
|
325
333
|
}) : null,
|
|
326
334
|
/*#__PURE__*/ _jsx(Button, {
|
|
@@ -337,14 +345,11 @@ import { useTransition } from './useTransition.js';
|
|
|
337
345
|
});
|
|
338
346
|
if (result.ok) {
|
|
339
347
|
if (result.data?.warnings?.length) setWarnings(result.data.warnings);
|
|
340
|
-
else
|
|
341
|
-
await test.reload();
|
|
342
|
-
onClose();
|
|
343
|
-
}
|
|
348
|
+
else onClose();
|
|
344
349
|
}
|
|
345
350
|
return result;
|
|
346
351
|
}, {
|
|
347
|
-
|
|
352
|
+
closeOnSuccess: false
|
|
348
353
|
});
|
|
349
354
|
},
|
|
350
355
|
children: C.addGoal
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { canStartTest, readyToStart } from '../../readinessRead.js';
|
|
3
|
+
import { canStartTest, hasBrowserWritablePrimary, readyToStart } from '../../readinessRead.js';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
|
-
import { SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
6
|
+
import { actionWaitMessage, SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
7
7
|
import { jumpToSection } from '../test/jumpToSection.js';
|
|
8
8
|
import { actionGroupLabel, availableActions } from '../../actions/actions.model.js';
|
|
9
9
|
import { createApi } from '../../api.js';
|
|
10
10
|
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
11
11
|
import { READINESS_COPY as C, decidedCopy, fixFieldsNext, runningCopy, stoppedCopy } from '../../copy/readiness.js';
|
|
12
|
+
import { METRICS_COPY } from '../../copy/metrics.js';
|
|
12
13
|
import { READINESS, daysRemaining, displayDate, blockingSteps, pageReadinessContext, errorSection } from './readiness.model.js';
|
|
13
14
|
import { AddMetricAction, AllocateAction, ConfirmAction } from './ActionDialogs.js';
|
|
14
15
|
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
@@ -63,13 +64,13 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
63
64
|
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
64
65
|
const ready = readyToStart(test, surface.editorPlacementMessage);
|
|
65
66
|
const startEnabled = !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
66
|
-
const
|
|
67
|
+
const wait = setup ? actionWaitMessage(test) : undefined;
|
|
67
68
|
const blockers = [
|
|
68
69
|
...readinessBlockers
|
|
69
70
|
];
|
|
70
|
-
if (
|
|
71
|
+
if (wait && !test.stale) blockers.unshift({
|
|
71
72
|
section: 'header',
|
|
72
|
-
sentence:
|
|
73
|
+
sentence: wait,
|
|
73
74
|
code: 'unsaved'
|
|
74
75
|
});
|
|
75
76
|
else if (!test.preflight && !test.preflightError) blockers.unshift({
|
|
@@ -90,7 +91,7 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
90
91
|
sentence: test.stale ? C.reloadFirst : C.reloadAfterError,
|
|
91
92
|
code: 'save-error'
|
|
92
93
|
});
|
|
93
|
-
const startReason = blockers[0]?.sentence ?? test.preflightError ?? (!ready ? C.checking : undefined);
|
|
94
|
+
const startReason = wait ?? blockers[0]?.sentence ?? test.preflightError ?? (!ready ? C.checking : undefined);
|
|
94
95
|
const actions = availableActions({
|
|
95
96
|
status: doc.status,
|
|
96
97
|
kind: doc.kind,
|
|
@@ -105,13 +106,23 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
105
106
|
label: C.allocate
|
|
106
107
|
} : action);
|
|
107
108
|
const action = actions.find((item)=>item.id === selected);
|
|
108
|
-
const sentence = transition.busy ? C.changing : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
|
|
109
|
+
const sentence = test.statusReadPending ? C.checking : transition.busy ? C.changing : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
|
|
109
110
|
return /*#__PURE__*/ _jsxs("div", {
|
|
110
111
|
className: `xp-readiness xp-readiness--${setup && ready && !blockers.length && !transition.busy ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
|
|
111
112
|
children: [
|
|
112
113
|
setup && test.preflight?.checks.some((check)=>check.code === 'page-targets-unchecked' && check.warning) ? /*#__PURE__*/ _jsx("p", {
|
|
113
114
|
children: C.uncheckedPages
|
|
114
115
|
}) : null,
|
|
116
|
+
!test.statusReadPending && setup && hasBrowserWritablePrimary(test.preflight, doc.metrics?.primary) ? /*#__PURE__*/ _jsxs("p", {
|
|
117
|
+
className: "xp-readiness__warning",
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ _jsx("span", {
|
|
120
|
+
"aria-hidden": "true",
|
|
121
|
+
children: "⚠ "
|
|
122
|
+
}),
|
|
123
|
+
METRICS_COPY.browserWritablePrimary
|
|
124
|
+
]
|
|
125
|
+
}) : null,
|
|
115
126
|
test.preflight?.checks.filter((check)=>check.code === 'make-content-unsupported' && check.warning).map((check)=>/*#__PURE__*/ _jsx("p", {
|
|
116
127
|
children: READINESS[check.code].next(check.detail, doc)
|
|
117
128
|
}, check.code)),
|
|
@@ -142,7 +153,7 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
142
153
|
note.message
|
|
143
154
|
]
|
|
144
155
|
}, note.metricId)),
|
|
145
|
-
doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
156
|
+
!test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
146
157
|
children: stoppedCopy(displayDate(doc.stoppedAt))
|
|
147
158
|
}) : null,
|
|
148
159
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -179,13 +190,13 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
179
190
|
}),
|
|
180
191
|
/*#__PURE__*/ _jsx("div", {
|
|
181
192
|
className: "xp-readiness__actions",
|
|
182
|
-
children: actions.map((item)=>{
|
|
183
|
-
const reason = item.id === 'start' ? startReason :
|
|
193
|
+
children: !test.statusReadPending && actions.map((item)=>{
|
|
194
|
+
const reason = item.id === 'start' ? startReason : item.id === 'allocate' && doc.allocation >= 100 ? C.everyone : undefined;
|
|
184
195
|
const disabled = transition.busy || !!selected || !!reason || item.id === 'start' && !startEnabled;
|
|
185
196
|
return /*#__PURE__*/ _jsxs("span", {
|
|
186
197
|
title: reason,
|
|
187
198
|
children: [
|
|
188
|
-
reason && item.id !== 'start' ? /*#__PURE__*/ _jsx("span", {
|
|
199
|
+
reason && reason !== wait && item.id !== 'start' ? /*#__PURE__*/ _jsx("span", {
|
|
189
200
|
className: "xp-readiness-action-reason",
|
|
190
201
|
children: reason
|
|
191
202
|
}) : null,
|
|
@@ -195,7 +206,7 @@ export function ReadinessContent({ test, surface, resultsVersion }) {
|
|
|
195
206
|
disabled: disabled,
|
|
196
207
|
onClick: ()=>{
|
|
197
208
|
if (disabled) return;
|
|
198
|
-
if (item.id === 'start' && doc.status === 'draft') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id));
|
|
209
|
+
if (item.id === 'start' && doc.status === 'draft') void transition.run('start', ()=>createApi(surface.apiRoute).start(doc.id, doc.phase));
|
|
199
210
|
else setSelected(item.id);
|
|
200
211
|
},
|
|
201
212
|
children: item.label
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ActionTestApi } from '../contracts.js';
|
|
2
|
+
export declare function actionWaitMessage(test: Pick<ActionTestApi, 'stale' | 'hasUnsaved' | 'saving' | 'fieldDrafts'>): string | undefined;
|
|
3
|
+
export declare function saveStatusMessage(test: ActionTestApi): string | null;
|
|
3
4
|
type Props = {
|
|
4
|
-
test:
|
|
5
|
+
test: ActionTestApi;
|
|
5
6
|
messageInBlockerList?: boolean;
|
|
6
7
|
};
|
|
7
8
|
export declare function ReadinessReadStatus({ test, messageInBlockerList }: Props): import("react").JSX.Element;
|
|
@@ -3,15 +3,21 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { readinessRead } from '../../readinessRead.js';
|
|
4
4
|
import { useRef, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
|
-
import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
6
|
+
import { finishEditCopy, READINESS_COPY as C } from '../../copy/readiness.js';
|
|
7
|
+
export function actionWaitMessage(test) {
|
|
8
|
+
if (test.stale) return C.reloadFirst;
|
|
9
|
+
if (test.saving === 'saving') return C.saveFirst;
|
|
10
|
+
const draft = Object.values(test.fieldDrafts ?? {})[0];
|
|
11
|
+
return draft ? finishEditCopy(draft.label) : test.hasUnsaved ? C.finishEdits : undefined;
|
|
12
|
+
}
|
|
7
13
|
export function saveStatusMessage(test) {
|
|
8
|
-
return test.saving === 'saving' ? C.saving : test.saving === 'saved' || test.saving === 'idle' ? C.saved : test.saving === 'error' && !test.stale ? test.errors._section ? C.saveGeneralError : C.saveError : null;
|
|
14
|
+
return test.saving === 'saving' ? C.saving : test.hasUnsaved ? null : test.saving === 'saved' || test.saving === 'idle' ? C.saved : test.saving === 'error' && !test.stale ? test.errors._section ? C.saveGeneralError : C.saveError : null;
|
|
9
15
|
}
|
|
10
16
|
export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
|
|
11
17
|
const inFlight = useRef(false);
|
|
12
18
|
const [retrying, setRetrying] = useState(false);
|
|
13
19
|
async function retry() {
|
|
14
|
-
if (inFlight.current || test.preflightPending
|
|
20
|
+
if (inFlight.current || test.preflightPending) return;
|
|
15
21
|
inFlight.current = true;
|
|
16
22
|
setRetrying(true);
|
|
17
23
|
try {
|
|
@@ -30,18 +36,12 @@ export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
|
|
|
30
36
|
children: read.message
|
|
31
37
|
}) : null,
|
|
32
38
|
' ',
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children:
|
|
39
|
-
disabled: retrying || test.preflightPending || test.hasUnsaved || test.saving === 'saving',
|
|
40
|
-
onClick: ()=>{
|
|
41
|
-
void retry();
|
|
42
|
-
},
|
|
43
|
-
children: C.retry
|
|
44
|
-
})
|
|
39
|
+
read.retry ? /*#__PURE__*/ _jsx(Button, {
|
|
40
|
+
disabled: retrying || test.preflightPending,
|
|
41
|
+
onClick: ()=>{
|
|
42
|
+
void retry();
|
|
43
|
+
},
|
|
44
|
+
children: C.retry
|
|
45
45
|
}) : null
|
|
46
46
|
]
|
|
47
47
|
}) : null
|
|
@@ -4,16 +4,21 @@ import type { TestDocument } from '../testDocument.model.js';
|
|
|
4
4
|
import type { SurfaceProps } from '../contracts.js';
|
|
5
5
|
import { type SectionId } from '../contracts.js';
|
|
6
6
|
export type ReadinessContext = Pick<TestDocument, 'arms' | 'unitType' | 'flagPoint'> & {
|
|
7
|
+
editorPage?: SurfaceProps['editorPage'];
|
|
7
8
|
editorPlacementMessage?: string;
|
|
8
9
|
collectionLabel?: string;
|
|
10
|
+
contentLocales?: PreflightResult['contentLocales'];
|
|
11
|
+
placements?: PreflightResult['placements'];
|
|
9
12
|
pagePlacements?: PreflightResult['pagePlacements'];
|
|
10
13
|
flagPoints?: readonly Pick<SerializedFlagPoint, 'id' | 'params'>[];
|
|
11
14
|
};
|
|
15
|
+
/** Saved content guidance uses the same page refresh as the placement notice. */
|
|
16
|
+
export declare function editorContentNotice(preflight: PreflightResult | null, ctx: ReadinessContext): string | undefined;
|
|
12
17
|
/** Exhaustive mapping of the checkStart ReadinessCode union, including all ten invariant checks. */
|
|
13
18
|
export declare const READINESS: Record<ReadinessCode, {
|
|
14
19
|
section: SectionId | 'header';
|
|
15
20
|
next(detail: unknown, ctx: ReadinessContext): string | null;
|
|
16
|
-
nextStep?: string | ((detail: unknown, ctx: ReadinessContext) => string);
|
|
21
|
+
nextStep?: string | ((detail: unknown, ctx: ReadinessContext) => string | undefined);
|
|
17
22
|
}>;
|
|
18
23
|
export declare function blockingSteps(preflight: PreflightResult | null, ctx: ReadinessContext): {
|
|
19
24
|
arm?: import("../../../types/contracts.js").ArmKey | undefined;
|