@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.11
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 +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +12 -5
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +129 -37
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.d.ts +3 -0
- package/dist/admin/blocks/formApi.js +10 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +10 -6
- package/dist/admin/blocks/statusCache.d.ts +2 -0
- package/dist/admin/blocks/statusCache.js +12 -3
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +21 -1
- package/dist/admin/copy/blocks.js +40 -6
- package/dist/admin/copy/goals.d.ts +21 -9
- package/dist/admin/copy/goals.js +28 -11
- package/dist/admin/copy/newTest.d.ts +7 -7
- package/dist/admin/copy/newTest.js +10 -7
- package/dist/admin/goals/XpGoalField.d.ts +2 -0
- package/dist/admin/goals/XpGoalField.js +156 -114
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/paths.d.ts +3 -0
- package/dist/admin/paths.js +3 -0
- package/dist/admin/placementStatus.model.js +1 -1
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +29 -4
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +273 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +2 -1
- package/dist/admin/surface/goals/GoalForm.js +342 -212
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +107 -37
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +11 -2
- package/dist/admin/surface/goals/goals.css +9 -1
- package/dist/admin/surface/goals/goals.model.d.ts +12 -2
- package/dist/admin/surface/goals/goals.model.js +39 -1
- package/dist/admin/surface/home.model.d.ts +10 -8
- package/dist/admin/surface/home.model.js +27 -22
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +149 -118
- package/dist/admin/surface/newTest/PageWizard.d.ts +5 -2
- package/dist/admin/surface/newTest/PageWizard.js +115 -80
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +3 -3
- package/dist/admin/surface/results/ResultsHeader.js +115 -83
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +44 -152
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +18 -165
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +35 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/collections/experiments/config.js +17 -8
- 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/metrics.js +28 -9
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- 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.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- 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/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -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/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +57 -9
- package/dist/endpoints/pages.js +247 -64
- 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/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -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/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- 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/fields/xpGoal.js +3 -15
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +44 -35
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +27 -2
- package/dist/hooks/pageGuard.js +213 -45
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +36 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +70 -21
- 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.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +5 -1
- package/dist/puck/copy.js +5 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +1007 -182
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -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 +6 -0
- package/dist/puck/editor/QuickTestActions.js +72 -0
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +35 -19
- package/dist/puck/editor/VersionBuilder.d.ts +67 -12
- package/dist/puck/editor/VersionBuilder.js +560 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +65 -20
- package/dist/puck/editor/copy.js +73 -21
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +200 -20
- package/dist/puck/editor/editor.css +338 -25
- package/dist/puck/editor/editor.model.d.ts +17 -1
- package/dist/puck/editor/editor.model.js +61 -4
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +105 -86
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -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 +2 -2
- package/dist/puck/slotConfig.js +18 -5
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- 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.d.ts +1 -1
- package/dist/results/verdict.js +9 -7
- 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 +22 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +48 -22
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +9 -5
- package/dist/testSurface/actions/DecideDialog.d.ts +17 -0
- package/dist/testSurface/actions/DecideDialog.js +222 -0
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +123 -0
- package/dist/{admin → testSurface}/actions/decide.model.d.ts +1 -0
- package/dist/{admin → testSurface}/actions/decide.model.js +1 -0
- package/dist/{admin → testSurface}/allocation.model.js +6 -3
- package/dist/{admin → testSurface}/api.d.ts +20 -7
- package/dist/{admin → testSurface}/api.js +72 -22
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +37 -14
- package/dist/{admin → testSurface}/copy/actions.js +40 -17
- package/dist/{admin → testSurface}/copy/advanced.d.ts +10 -0
- package/dist/{admin → testSurface}/copy/advanced.js +10 -0
- package/dist/{admin → testSurface}/copy/arms.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/arms.js +1 -1
- package/dist/{admin → testSurface}/copy/audience.d.ts +4 -3
- package/dist/{admin → testSurface}/copy/audience.js +5 -4
- package/dist/{admin → testSurface}/copy/common.d.ts +15 -6
- package/dist/{admin → testSurface}/copy/common.js +20 -10
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +18 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +40 -6
- package/dist/{admin → testSurface}/copy/readiness.js +54 -9
- package/dist/{admin → testSurface}/copy/recommendation.d.ts +4 -4
- package/dist/{admin → testSurface}/copy/recommendation.js +4 -4
- package/dist/{admin → testSurface}/copy/results.d.ts +19 -12
- package/dist/{admin → testSurface}/copy/results.js +21 -12
- package/dist/testSurface/copy/review.d.ts +20 -0
- package/dist/testSurface/copy/review.js +21 -0
- package/dist/{admin → testSurface}/copy/setting.d.ts +1 -2
- package/dist/{admin → testSurface}/copy/setting.js +1 -2
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +14 -11
- package/dist/{admin → testSurface}/copy/testPage.d.ts +61 -12
- package/dist/testSurface/copy/testPage.js +168 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/format/date.d.ts +1 -0
- package/dist/testSurface/format/date.js +21 -0
- package/dist/{admin → testSurface}/labels.d.ts +1 -2
- package/dist/{admin → testSurface}/labels.js +2 -3
- package/dist/{admin → testSurface}/lockedNotice.model.d.ts +2 -0
- package/dist/{admin → testSurface}/lockedNotice.model.js +31 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/{admin → testSurface}/placements/placementLabels.d.ts +2 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +3 -2
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.d.ts +3 -2
- package/dist/{admin → testSurface}/results/results.model.js +16 -11
- package/dist/{admin → testSurface}/surface/contracts.d.ts +17 -3
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/testSurface/surface/pageBlock/parts.js +107 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +498 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +372 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +4 -3
- package/dist/testSurface/surface/readiness/Banner.js +198 -0
- 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 +13 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +67 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +28 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +6 -3
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +40 -40
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +11 -4
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +207 -104
- package/dist/{admin → testSurface}/surface/results/recommendation.model.js +3 -3
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +26 -8
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +18 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +12 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +119 -89
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +25 -14
- package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +11 -8
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +4 -11
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +88 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +87 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/testSurface/surface/test/VersionsSection.js +301 -0
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +33 -9
- package/dist/testSurface/surface/test/fields.js +300 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +30 -44
- package/dist/testSurface/surface/test/testPage.css +111 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +3 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +8 -0
- package/dist/testSurface/surfaceUrls.js +23 -0
- package/dist/{admin → testSurface}/useApi.d.ts +21 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- 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 +6 -1
- package/dist/transitions/checkStart.js +133 -17
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +6 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +41 -17
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -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 +16 -12
- package/dist/transitions/placements.d.ts +54 -8
- package/dist/transitions/placements.js +304 -81
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +137 -40
- 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 +72 -35
- 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 +15 -3
- package/dist/types/endpoints.d.ts +121 -17
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +9 -9
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +141 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +6 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +50 -5
- package/package.json +3 -2
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -10
- package/dist/admin/actions/DecideDialog.js +0 -190
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/copy/metrics.js +0 -9
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/review.d.ts +0 -17
- package/dist/admin/copy/review.js +0 -17
- package/dist/admin/copy/testPage.js +0 -104
- package/dist/admin/format/date.js +0 -10
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/pageBlock/parts.js +0 -69
- package/dist/admin/surface/pagePicker/CopyRoute.d.ts +0 -6
- package/dist/admin/surface/pagePicker/CopyRoute.js +0 -53
- package/dist/admin/surface/pagePicker/PagePicker.d.ts +0 -10
- package/dist/admin/surface/pagePicker/PagePicker.js +0 -172
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -337
- package/dist/admin/surface/readiness/Banner.js +0 -190
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.js +0 -205
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/VersionsSection.js +0 -247
- package/dist/admin/surface/test/fields.js +0 -216
- package/dist/admin/surface/test/testPage.css +0 -97
- package/dist/admin/surface/useTestDocument.d.ts +0 -32
- package/dist/admin/surface/useTestDocument.js +0 -415
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -1,4 +1,35 @@
|
|
|
1
|
+
import { EDITABLE_BY_STATUS } from '../collections/experiments/editability.js';
|
|
1
2
|
import { LOCKED_MESSAGES } from './copy/common.js';
|
|
3
|
+
const sectionFields = {
|
|
4
|
+
what: [
|
|
5
|
+
'name',
|
|
6
|
+
'hypothesis',
|
|
7
|
+
'flagPoint',
|
|
8
|
+
'pageCollection'
|
|
9
|
+
],
|
|
10
|
+
versions: [
|
|
11
|
+
'arms'
|
|
12
|
+
],
|
|
13
|
+
win: [
|
|
14
|
+
'metrics'
|
|
15
|
+
],
|
|
16
|
+
who: [
|
|
17
|
+
'targeting',
|
|
18
|
+
'allocation'
|
|
19
|
+
],
|
|
20
|
+
length: [
|
|
21
|
+
'analysis'
|
|
22
|
+
],
|
|
23
|
+
advanced: [
|
|
24
|
+
'analysis',
|
|
25
|
+
'exposurePolicy'
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
export function sectionLockNotice(status, section) {
|
|
29
|
+
const fields = sectionFields[section];
|
|
30
|
+
if (fields.some((field)=>EDITABLE_BY_STATUS[status].includes(field))) return null;
|
|
31
|
+
return lockedReason(status, fields[0], EDITABLE_BY_STATUS);
|
|
32
|
+
}
|
|
2
33
|
export function lockedReason(status, field, table) {
|
|
3
34
|
if ([
|
|
4
35
|
'slug',
|
|
@@ -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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { placementLanguageSuffix } from '../copy/languages.js';
|
|
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';
|
|
4
5
|
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,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
import { type PreviewPage } from '../lib/placementPages.js';
|
|
2
3
|
type Placement = PreflightResult['placements'][number];
|
|
3
|
-
type PreviewPage = Placement & {
|
|
4
|
-
key: string;
|
|
5
|
-
slotCount: number;
|
|
6
|
-
};
|
|
7
|
-
/** Preview URLs identify pages; counts use the most placements in any one version. */
|
|
8
|
-
export declare function previewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
9
4
|
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */
|
|
10
5
|
export declare function actionablePreviewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
11
6
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { placementPages } from '../lib/placementPages.js';
|
|
2
|
+
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */ export function actionablePreviewPages(placements, flagPoint) {
|
|
3
|
+
return placementPages(placements, flagPoint).filter((page)=>page.url || page.editorUrl);
|
|
4
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
export declare const PREFLIGHT_TIMEOUT_MS = 15000;
|
|
3
|
+
type DocumentVersion = NonNullable<PreflightResult['document']>;
|
|
4
|
+
export declare function statusOrRoundChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
|
|
5
|
+
export declare function documentChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
|
|
6
|
+
/** The answer must support both readiness and placement consumers. */
|
|
7
|
+
export declare function isPreflightResult(value: unknown): value is PreflightResult;
|
|
8
|
+
/** Bound the response and body read, even when a producer ignores cancellation. */
|
|
9
|
+
export declare function readPreflight(request: (signal: AbortSignal) => Promise<Response>, signal: AbortSignal): Promise<{
|
|
10
|
+
response: Response;
|
|
11
|
+
body: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const PREFLIGHT_TIMEOUT_MS = 15_000;
|
|
2
|
+
export function statusOrRoundChanged(answer, current) {
|
|
3
|
+
return !!answer && (answer.status !== current.status || answer.phase !== undefined && answer.phase !== current.phase);
|
|
4
|
+
}
|
|
5
|
+
export function documentChanged(answer, current) {
|
|
6
|
+
return statusOrRoundChanged(answer, current) || answer?.updatedAt !== undefined && answer.updatedAt !== current.updatedAt;
|
|
7
|
+
}
|
|
8
|
+
/** The answer must support both readiness and placement consumers. */ export function isPreflightResult(value) {
|
|
9
|
+
const data = value;
|
|
10
|
+
return !!data && Array.isArray(data.placements) && Array.isArray(data.checks) && data.checks.every((check)=>check && typeof check.code === 'string' && typeof check.ok === 'boolean');
|
|
11
|
+
}
|
|
12
|
+
/** Bound the response and body read, even when a producer ignores cancellation. */ export async function readPreflight(request, signal) {
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
let timer;
|
|
15
|
+
let cancel;
|
|
16
|
+
const cancelled = new Promise((_, reject)=>{
|
|
17
|
+
cancel = ()=>{
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
controller.abort();
|
|
20
|
+
reject(new Error('Readiness read cancelled'));
|
|
21
|
+
};
|
|
22
|
+
timer = setTimeout(cancel, PREFLIGHT_TIMEOUT_MS);
|
|
23
|
+
});
|
|
24
|
+
signal.addEventListener('abort', cancel, {
|
|
25
|
+
once: true
|
|
26
|
+
});
|
|
27
|
+
if (signal.aborted) cancel();
|
|
28
|
+
try {
|
|
29
|
+
return await Promise.race([
|
|
30
|
+
cancelled,
|
|
31
|
+
(async ()=>{
|
|
32
|
+
const response = await request(controller.signal);
|
|
33
|
+
const body = await response.json().catch(()=>undefined);
|
|
34
|
+
return {
|
|
35
|
+
response,
|
|
36
|
+
body
|
|
37
|
+
};
|
|
38
|
+
})()
|
|
39
|
+
]);
|
|
40
|
+
} finally{
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
signal.removeEventListener('abort', cancel);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
import type { DocId } from '../types/contracts.js';
|
|
3
|
+
export type ReadinessRead = ReturnType<typeof classifyReadinessRead>;
|
|
4
|
+
/** One read policy for every surface. Pending retains this settled value verbatim. */
|
|
5
|
+
export declare function classifyReadinessRead(status: number, body?: unknown, failures?: number, context?: {
|
|
6
|
+
kind: 'document';
|
|
7
|
+
surface?: 'editor';
|
|
8
|
+
resultsOnly?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'readiness' | 'where-used';
|
|
11
|
+
placementNotice?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
status: number;
|
|
14
|
+
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
15
|
+
kind: string;
|
|
16
|
+
answer: PreflightResult | undefined;
|
|
17
|
+
message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
|
|
18
|
+
failed: boolean;
|
|
19
|
+
retry: boolean;
|
|
20
|
+
pollDelay: number | null;
|
|
21
|
+
};
|
|
22
|
+
/** Legacy callers can supply an answer; producers always supply the classified read. */
|
|
23
|
+
export declare function readinessRead(test: {
|
|
24
|
+
preflight: PreflightResult | null;
|
|
25
|
+
preflightError: string | null;
|
|
26
|
+
preflightRead?: ReadinessRead;
|
|
27
|
+
}): {
|
|
28
|
+
status: number;
|
|
29
|
+
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
30
|
+
kind: string;
|
|
31
|
+
answer: PreflightResult | undefined;
|
|
32
|
+
message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
|
|
33
|
+
failed: boolean;
|
|
34
|
+
retry: boolean;
|
|
35
|
+
pollDelay: number | null;
|
|
36
|
+
};
|
|
37
|
+
/** Settled display is independent of a refresh in progress. */
|
|
38
|
+
export declare function readyToStart(test: {
|
|
39
|
+
preflight: PreflightResult | null;
|
|
40
|
+
preflightError: string | null;
|
|
41
|
+
preflightRead?: ReadinessRead;
|
|
42
|
+
}, placementMessage?: string): boolean;
|
|
43
|
+
/** A pending edit can change the selected goal before the next readiness response. */
|
|
44
|
+
export declare function hasBrowserWritablePrimary(preflight: PreflightResult | null, primary: DocId | null | undefined): boolean;
|
|
45
|
+
/** Pending changes only the ability to fire Start, never the settled display. */
|
|
46
|
+
export declare function canStartTest(test: {
|
|
47
|
+
preflight: PreflightResult | null;
|
|
48
|
+
preflightError: string | null;
|
|
49
|
+
preflightRead?: ReadinessRead;
|
|
50
|
+
preflightPending: boolean;
|
|
51
|
+
hasUnsaved: boolean;
|
|
52
|
+
saving: string;
|
|
53
|
+
}, placementMessage?: string): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { API_MESSAGES } from './copy/common.js';
|
|
2
|
+
import { PLACEMENT_FAILURE_COPY, READINESS_COPY, placementFailureCopy } from './copy/readiness.js';
|
|
3
|
+
import { TEST_PAGE } from './copy/testPage.js';
|
|
4
|
+
import { editorCopy } from '../puck/editor/copy.js';
|
|
5
|
+
import { pickerCopy } from '../puck/copy.js';
|
|
6
|
+
import { isPreflightResult } from './readPreflight.js';
|
|
7
|
+
/** One read policy for every surface. Pending retains this settled value verbatim. */ export function classifyReadinessRead(status, body, failures = 1, context = {
|
|
8
|
+
kind: 'readiness'
|
|
9
|
+
}) {
|
|
10
|
+
const document = context.kind === 'document';
|
|
11
|
+
const answer = !document && status === 200 && isPreflightResult(body) ? body : undefined;
|
|
12
|
+
const detail = answer?.checks.find((check)=>!check.ok && (check.code === 'no-placements' && check.detail !== undefined || check.code === 'flag-placement-missing' && typeof check.detail === 'string'))?.detail;
|
|
13
|
+
const kind = status === 401 ? 'signed-out' : status === 404 || detail === 'not-found' ? 'not-found' : status === 403 || detail === 'forbidden' ? 'no-access' : status === 400 || status === 501 ? 'permanent' : answer ? 'answered' : 'failed';
|
|
14
|
+
const failed = kind === 'failed' || kind === 'answered' && detail !== undefined;
|
|
15
|
+
const retry = failed;
|
|
16
|
+
const message = kind === 'signed-out' ? API_MESSAGES.unauthenticated : kind === 'not-found' ? answer ? PLACEMENT_FAILURE_COPY['not-found'] : document && context.surface === 'editor' ? pickerCopy.unavailable : API_MESSAGES.notFound : kind === 'no-access' ? document ? context.surface === 'editor' ? context.resultsOnly ? pickerCopy.resultsOnly : pickerCopy.forbidden : TEST_PAGE.forbidden : PLACEMENT_FAILURE_COPY.forbidden : kind === 'permanent' ? status === 501 ? API_MESSAGES.notImplemented : document ? context.surface === 'editor' ? editorCopy.loadError : TEST_PAGE.error : READINESS_COPY.invalidRequest : kind === 'failed' ? document ? context.surface === 'editor' ? editorCopy.loadError : TEST_PAGE.error : READINESS_COPY.checkError : detail !== undefined ? placementFailureCopy(detail) : undefined;
|
|
17
|
+
// Subscribers determine whether save/publish guidance is displayed. Its polling
|
|
18
|
+
// eligibility is classified here, alongside permanent and temporary failures.
|
|
19
|
+
const placementNotice = !document && (context.placementNotice ?? context.kind === 'where-used');
|
|
20
|
+
const pollDelay = retry ? [
|
|
21
|
+
4_000,
|
|
22
|
+
8_000,
|
|
23
|
+
16_000,
|
|
24
|
+
30_000
|
|
25
|
+
][Math.min(Math.max(0, failures - 1), 3)] : kind === 'answered' && placementNotice ? 4_000 : null;
|
|
26
|
+
const loadState = kind === 'not-found' ? 'missing' : kind === 'signed-out' || kind === 'no-access' ? 'forbidden' : kind === 'failed' || kind === 'permanent' ? 'error' : 'ready';
|
|
27
|
+
return {
|
|
28
|
+
status,
|
|
29
|
+
loadState,
|
|
30
|
+
kind,
|
|
31
|
+
answer,
|
|
32
|
+
message,
|
|
33
|
+
failed,
|
|
34
|
+
retry,
|
|
35
|
+
pollDelay
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Legacy callers can supply an answer; producers always supply the classified read. */ export function readinessRead(test) {
|
|
39
|
+
return test.preflightRead ?? classifyReadinessRead(test.preflightError ? 0 : 200, test.preflight);
|
|
40
|
+
}
|
|
41
|
+
/** Settled display is independent of a refresh in progress. */ export function readyToStart(test, placementMessage) {
|
|
42
|
+
return !!test.preflight && !placementMessage && readinessRead(test).kind === 'answered' && !test.preflightError && test.preflight.checks.every((check)=>check.ok);
|
|
43
|
+
}
|
|
44
|
+
/** A pending edit can change the selected goal before the next readiness response. */ export function hasBrowserWritablePrimary(preflight, primary) {
|
|
45
|
+
const reported = preflight?.browserWritablePrimaryId;
|
|
46
|
+
return reported != null && primary != null && String(reported) === String(primary);
|
|
47
|
+
}
|
|
48
|
+
/** Pending changes only the ability to fire Start, never the settled display. */ export function canStartTest(test, placementMessage) {
|
|
49
|
+
return readyToStart(test, placementMessage) && !test.preflightPending && !test.hasUnsaved && test.saving !== 'saving';
|
|
50
|
+
}
|
|
@@ -8,6 +8,7 @@ export interface VerdictHeroProps {
|
|
|
8
8
|
sinceShipping?: string | null;
|
|
9
9
|
meta?: ReactNode;
|
|
10
10
|
recommendation?: string;
|
|
11
|
+
browserWritablePrimary?: boolean;
|
|
11
12
|
}
|
|
12
13
|
import './results.css';
|
|
13
|
-
export declare function VerdictHero({ model, guardrails, power, collecting, sinceShipping, meta, recommendation }: VerdictHeroProps): import("react").JSX.Element;
|
|
14
|
+
export declare function VerdictHero({ model, guardrails, power, collecting, sinceShipping, meta, recommendation, browserWritablePrimary }: VerdictHeroProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { METRICS_COPY } from '../copy/metrics.js';
|
|
3
4
|
import './results.css';
|
|
4
|
-
export function VerdictHero({ model, guardrails = [], power, collecting, sinceShipping, meta, recommendation }) {
|
|
5
|
+
export function VerdictHero({ model, guardrails = [], power, collecting, sinceShipping, meta, recommendation, browserWritablePrimary }) {
|
|
5
6
|
return /*#__PURE__*/ _jsxs("section", {
|
|
6
7
|
className: "xp-verdict-hero",
|
|
7
8
|
children: [
|
|
@@ -25,6 +26,9 @@ export function VerdictHero({ model, guardrails = [], power, collecting, sinceSh
|
|
|
25
26
|
className: "xp-collecting",
|
|
26
27
|
children: collecting
|
|
27
28
|
}) : null,
|
|
29
|
+
browserWritablePrimary ? /*#__PURE__*/ _jsx("p", {
|
|
30
|
+
children: METRICS_COPY.browserWritablePrimary
|
|
31
|
+
}) : null,
|
|
28
32
|
recommendation ? /*#__PURE__*/ _jsx("p", {
|
|
29
33
|
className: "xp-recommendation",
|
|
30
34
|
children: recommendation
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
:where(.xp-test-surface) .xp-results { max-width: 1120px; display: grid; gap: var(--xp-space-8); min-width: 0; }
|
|
2
|
+
:where(.xp-test-surface) .xp-results h2, :where(.xp-test-surface) .xp-results h3, :where(.xp-test-surface) .xp-results p { margin: 0; }
|
|
3
|
+
:where(.xp-test-surface) .xp-verdict-hero { background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); padding: 28px; min-width: 0; }
|
|
4
|
+
:where(.xp-test-surface) .xp-verdict-hero h2 { font: var(--xp-text-display); letter-spacing: -0.01em; max-width: 36ch; }
|
|
5
|
+
:where(.xp-test-surface) .xp-verdict-hero p { margin-top: var(--xp-space-2); color: var(--xp-text-2); }
|
|
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
|
+
:where(.xp-test-surface) .xp-round-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
|
|
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-combobox-wrap { width: auto; max-width: 100%; }
|
|
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
|
+
: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
|
+
:where(.xp-test-surface) .xp-stat-tile { padding: 20px; min-width: 0; }
|
|
13
|
+
:where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 1px solid var(--xp-border); }
|
|
14
|
+
:where(.xp-test-surface) .xp-stat-tile-label, :where(.xp-test-surface) .xp-stat-tile-detail { font: var(--xp-text-small); color: var(--xp-text-2); }
|
|
15
|
+
:where(.xp-test-surface) .xp-stat-tile-value { margin-top: 6px; font: 600 32px/36px var(--xp-font); font-variant-numeric: tabular-nums; }
|
|
16
|
+
:where(.xp-test-surface) .xp-stat-tile-detail { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
|
|
17
|
+
:where(.xp-test-surface) .xp-results-block { min-width: 0; }
|
|
18
|
+
:where(.xp-test-surface) .xp-results-block-head { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
|
19
|
+
:where(.xp-test-surface) .xp-results-block-head h2 { font: var(--xp-text-title); }
|
|
20
|
+
:where(.xp-test-surface) .xp-results-block-meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--xp-text-2); }
|
|
21
|
+
:where(.xp-test-surface) .xp-data-table-frame { position: relative; min-width: 0; border-radius: var(--xp-radius-card); }
|
|
22
|
+
:where(.xp-test-surface) .xp-data-table-wrap { overflow-x: auto; overflow-y: auto; max-height: 70vh; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); }
|
|
23
|
+
:where(.xp-test-surface) .xp-data-table-wrap:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
24
|
+
/* Overlays stay visible above opaque sticky headers and the highlighted row. */
|
|
25
|
+
:where(.xp-test-surface) .xp-data-table-frame::before, :where(.xp-test-surface) .xp-data-table-frame::after { content: ''; position: absolute; top: 1px; bottom: 1px; width: var(--xp-space-6); z-index: 3; pointer-events: none; opacity: 0; }
|
|
26
|
+
:where(.xp-test-surface) .xp-data-table-frame::before { left: 1px; border-radius: var(--xp-radius-card) 0 0 var(--xp-radius-card); background: linear-gradient(to right, var(--xp-border-strong), transparent); }
|
|
27
|
+
:where(.xp-test-surface) .xp-data-table-frame::after { right: 1px; border-radius: 0 var(--xp-radius-card) var(--xp-radius-card) 0; background: linear-gradient(to left, var(--xp-border-strong), transparent); }
|
|
28
|
+
:where(.xp-test-surface) .xp-data-table-frame.has-left::before, :where(.xp-test-surface) .xp-data-table-frame.has-right::after { opacity: 1; }
|
|
29
|
+
:where(.xp-test-surface) .xp-data-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 14px/20px var(--xp-font); }
|
|
30
|
+
:where(.xp-test-surface) .xp-data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
|
|
31
|
+
:where(.xp-test-surface) .xp-data-table th, :where(.xp-test-surface) .xp-data-table td { padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid var(--xp-border); text-align: left; }
|
|
32
|
+
:where(.xp-test-surface) .xp-data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--xp-surface); font: var(--xp-text-small); color: var(--xp-text-2); }
|
|
33
|
+
:where(.xp-test-surface) .xp-data-table tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--xp-surface); }
|
|
34
|
+
:where(.xp-test-surface) .xp-data-table thead tr > :first-child { z-index: 2; }
|
|
35
|
+
:where(.xp-test-surface) .xp-data-table tbody th { font-weight: 400; }
|
|
36
|
+
:where(.xp-test-surface) .xp-data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
37
|
+
:where(.xp-test-surface) .xp-data-table .muted { color: var(--xp-text-3); }
|
|
38
|
+
:where(.xp-test-surface) .xp-data-table tr:last-child > * { border-bottom: 0; }
|
|
39
|
+
:where(.xp-test-surface) .xp-data-table tr.is-lead > * { background: var(--xp-surface-2); font-weight: 600; }
|
|
40
|
+
:where(.xp-test-surface) .xp-results-group { display: inline-flex; align-items: center; gap: 8px; }
|
|
41
|
+
:where(.xp-test-surface) .xp-results-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
|
|
42
|
+
:where(.xp-test-surface) .xp-results-panel { border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); min-width: 0; }
|
|
43
|
+
:where(.xp-test-surface) .xp-results-panel > summary { padding: 16px 20px; cursor: pointer; font: var(--xp-text-title); }
|
|
44
|
+
:where(.xp-test-surface) .xp-results-panel > summary:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
45
|
+
:where(.xp-test-surface) .xp-results-panel > summary .xp-quality-chip { margin-left: 12px; }
|
|
46
|
+
:where(.xp-test-surface) .xp-quality-row { padding: 14px 20px; border-top: 1px solid var(--xp-border); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; }
|
|
47
|
+
:where(.xp-test-surface) .xp-quality-row > :not(:first-child) { grid-column: 2; }
|
|
48
|
+
:where(.xp-test-surface) .xp-quality-row ul { margin: 0; padding-left: 20px; }
|
|
49
|
+
:where(.xp-test-surface) .xp-quality-detail, :where(.xp-test-surface) .xp-quality-next, :where(.xp-test-surface) .xp-results-cap-help { color: var(--xp-text-2); font: var(--xp-text-small); }
|
|
50
|
+
:where(.xp-test-surface) .xp-quality-chip { display: inline-flex; align-self: start; padding: 2px 8px; border-radius: var(--xp-radius-chip); font: var(--xp-text-small); color: var(--xp-success); background: var(--xp-success-bg); }
|
|
51
|
+
:where(.xp-test-surface) .xp-quality-chip--watch { color: var(--xp-warning); background: var(--xp-warning-bg); }
|
|
52
|
+
:where(.xp-test-surface) .xp-quality-chip--problem { color: var(--xp-error); background: var(--xp-error-bg); }
|
|
53
|
+
:where(.xp-test-surface) .xp-ci-chart { padding: 20px; overflow-x: auto; }
|
|
54
|
+
:where(.xp-test-surface) .xp-ci-chart svg { display: block; min-width: 560px; }
|
|
55
|
+
:where(.xp-test-surface) .xp-ci-chart ul { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; margin: 0; padding: 0; font: var(--xp-text-small); }
|
|
56
|
+
:where(.xp-test-surface) .xp-preview-links { display: grid; gap: 12px; }
|
|
57
|
+
:where(.xp-test-surface) .xp-preview-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--xp-border); padding-bottom: 12px; }
|
|
58
|
+
@media (max-width: 720px) {
|
|
59
|
+
:where(.xp-test-surface) .xp-stat-tiles { grid-template-columns: minmax(0, 1fr); }
|
|
60
|
+
:where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 0; border-top: 1px solid var(--xp-border); }
|
|
61
|
+
:where(.xp-test-surface) .xp-verdict-hero { padding: 20px; }
|
|
62
|
+
:where(.xp-test-surface) .xp-verdict-hero h2 { font-size: 24px; line-height: 30px; }
|
|
63
|
+
}
|
|
64
|
+
:where(.xp-test-surface) .xp-results-as-of { color: var(--xp-text-2); }
|
|
@@ -26,7 +26,8 @@ export type VerdictCardModel = {
|
|
|
26
26
|
detail: string;
|
|
27
27
|
guardrailLine?: string;
|
|
28
28
|
};
|
|
29
|
-
export declare function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel }: {
|
|
29
|
+
export declare function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel, controlLabel }: {
|
|
30
|
+
controlLabel?: string;
|
|
30
31
|
snapshot: DisplaySnapshot;
|
|
31
32
|
decisionSnapshot?: DisplaySnapshot;
|
|
32
33
|
isDecidedTestRound: boolean;
|
|
@@ -108,5 +109,5 @@ export interface DataQualityItem {
|
|
|
108
109
|
shares?: string[];
|
|
109
110
|
}
|
|
110
111
|
export declare function dataQuality(snapshot: DisplaySnapshot, ctx?: ResultsContext): DataQualityItem[];
|
|
111
|
-
export declare function verdictLabel(snapshot: DisplaySnapshot): string;
|
|
112
|
+
export declare function verdictLabel(snapshot: DisplaySnapshot, controlLabel?: string): string;
|
|
112
113
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { READINESS_COPY, placementUncheckedCopy, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
|
|
2
2
|
import { armLabel, phaseKindLabel, verdictCodeLabel } from '../labels.js';
|
|
3
|
-
import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal } from '../copy/results.js';
|
|
3
|
+
import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal, verdictControlCopy } from '../copy/results.js';
|
|
4
4
|
import { formatCI, formatCount, formatMetric, formatPercent, formatProbability } from './format.js';
|
|
5
5
|
import { legacyMinimum, legacyRolloutLine, legacyTooFew } from './legacy.js';
|
|
6
6
|
import { isLegacySnapshot } from './snapshot.js';
|
|
@@ -15,16 +15,17 @@ export function roundOptions(phases) {
|
|
|
15
15
|
label: roundLabel(phase.phase, phaseKindLabel(phase.phaseKind))
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
|
-
export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel }) {
|
|
18
|
+
export function verdictCard({ snapshot, decisionSnapshot, isDecidedTestRound, winnerLabel, controlLabel }) {
|
|
19
|
+
const copy = (text)=>controlLabel ? verdictControlCopy(text, controlLabel) : text;
|
|
19
20
|
if (isDecidedTestRound) return {
|
|
20
21
|
title: decidedTitle(winnerLabel),
|
|
21
|
-
finding: decisionSnapshot
|
|
22
|
-
detail: decisionSnapshot
|
|
22
|
+
finding: decisionSnapshot ? copy(decisionSnapshot.verdict.finding) : null,
|
|
23
|
+
detail: decisionSnapshot ? copy(decisionSnapshot.verdict.detail) : null
|
|
23
24
|
};
|
|
24
25
|
const { headline, detail, guardrailLine } = snapshot.verdict;
|
|
25
26
|
return {
|
|
26
|
-
headline,
|
|
27
|
-
detail,
|
|
27
|
+
headline: copy(headline),
|
|
28
|
+
detail: copy(detail),
|
|
28
29
|
...guardrailLine === undefined ? {} : {
|
|
29
30
|
guardrailLine
|
|
30
31
|
}
|
|
@@ -76,7 +77,7 @@ export function armRows({ snapshot, phase, metricId }) {
|
|
|
76
77
|
};
|
|
77
78
|
if (group.kind === 'control' && snapshot.phaseKind === 'test') return {
|
|
78
79
|
...row,
|
|
79
|
-
baseline:
|
|
80
|
+
baseline: group.label
|
|
80
81
|
};
|
|
81
82
|
const comparison = metric?.comparisons.find((comparison)=>comparison.arm === group.key);
|
|
82
83
|
if (!comparison) return row;
|
|
@@ -132,14 +133,18 @@ function smallest(values) {
|
|
|
132
133
|
return collectingCopy(formatCount(smallest(keys.map((key)=>snapshot.exposures.perArm[key]))), formatCount(isLegacySnapshot(snapshot) ? legacyMinimum(snapshot, ctx) : snapshot.minExposuresPerArm), formatCount(smallest(keys.map((key)=>primary?.perArm.find((arm)=>arm.arm === key)?.converters))), formatCount(primary ? snapshot.params.minSampleSizes[primary.metricId] : undefined));
|
|
133
134
|
}
|
|
134
135
|
export function dataQuality(snapshot, ctx = {}) {
|
|
135
|
-
const items = (snapshot.health ?? []).map((item)=>
|
|
136
|
+
const items = (snapshot.health ?? []).map((item)=>item.code === 'rapid-browser-events' ? {
|
|
137
|
+
id: item.code,
|
|
138
|
+
message: RESULTS_COPY.rapidBrowserEvents,
|
|
139
|
+
nextStep: RESULTS_COPY.rapidBrowserEventsNext
|
|
140
|
+
} : {
|
|
136
141
|
id: item.code === 'placement-unchecked' ? `${item.code}:${JSON.stringify(item.detail)}` : `${item.code}:${'path' in item ? item.path : item.metricId}`,
|
|
137
142
|
message: item.code === 'placement-unchecked' ? placementUncheckedCopy(ctx.placementLabels?.get(placementDetailKey(item.detail))?.title ?? item.detail.path ?? 'This page') : item.code === 'goal-in-some-versions' ? `${item.name} now appears in some versions but not all, so this result is no longer a fair comparison. Add it to every version, or remove it.` : READINESS_COPY.needsAttention,
|
|
138
143
|
...item.code === 'placement-unchecked' ? {
|
|
139
144
|
href: ctx.placementLabels?.get(placementDetailKey(item.detail))?.href
|
|
140
145
|
} : {},
|
|
141
146
|
nextStep: item.code === 'placement-unchecked' ? `Open ${ctx.placementLabels?.get(placementDetailKey(item.detail))?.title ?? item.detail.path ?? 'the page'}` : item.code === 'goal-in-some-versions' ? 'Edit the versions' : item.code === 'version-page-unavailable' ? versionPageUnavailableCopy(item.path, ctx.status) : versionPageUncheckedCopy(item.path, ctx.status)
|
|
142
|
-
})
|
|
147
|
+
});
|
|
143
148
|
// Test snapshots store null by design; only rollout snapshots record the shipped winner.
|
|
144
149
|
if (!isLegacySnapshot(snapshot) && snapshot.phaseKind === 'rollout' && snapshot.winnerArm === null) items.push({
|
|
145
150
|
id: 'missing-winner',
|
|
@@ -190,6 +195,6 @@ export function dataQuality(snapshot, ctx = {}) {
|
|
|
190
195
|
});
|
|
191
196
|
return items;
|
|
192
197
|
}
|
|
193
|
-
export function verdictLabel(snapshot) {
|
|
194
|
-
return verdictCodeLabel(snapshot.verdict.code);
|
|
198
|
+
export function verdictLabel(snapshot, controlLabel) {
|
|
199
|
+
return verdictCodeLabel(snapshot.verdict.code, controlLabel);
|
|
195
200
|
}
|
|
@@ -1,16 +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 {
|
|
17
|
+
/** Present only when configuring a block from its page editor. */
|
|
18
|
+
editorPage?: {
|
|
19
|
+
collection: string;
|
|
20
|
+
id: string;
|
|
21
|
+
versionContent?: Partial<Record<ArmSlot, 'filled' | 'partial' | 'empty'>>;
|
|
22
|
+
};
|
|
23
|
+
editorPlacementMessage?: string;
|
|
12
24
|
adminRoute: string;
|
|
13
25
|
apiRoute: string;
|
|
26
|
+
contentLanguageLabels?: string[];
|
|
27
|
+
contentLocale?: string;
|
|
14
28
|
collectionTitles?: Record<string, string>;
|
|
15
29
|
userId?: string | number;
|
|
16
30
|
userCollection?: string;
|
|
@@ -35,12 +49,11 @@ export interface KindParts {
|
|
|
35
49
|
/** The content cell of one version row in Section 2. */
|
|
36
50
|
VersionContent: ComponentType<SectionProps & {
|
|
37
51
|
armIndex: number;
|
|
52
|
+
summary?: boolean;
|
|
38
53
|
}>;
|
|
39
54
|
}
|
|
40
55
|
/** Readiness pieces (ADM-23). */
|
|
41
56
|
export interface ReadinessParts {
|
|
42
|
-
/** Sticky-header banner incl. Start / status sentence. */
|
|
43
|
-
Banner: ComponentType<SectionProps>;
|
|
44
57
|
/** "Saving…" / "Saved" / error indicator for the header. */
|
|
45
58
|
SaveStatus: ComponentType<{
|
|
46
59
|
test: TestDocApi;
|
|
@@ -48,3 +61,4 @@ export interface ReadinessParts {
|
|
|
48
61
|
/** Check-circle state per section, from preflight. */
|
|
49
62
|
sectionDone(test: TestDocApi): Record<SectionId, boolean>;
|
|
50
63
|
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PreflightResult } from '../../types/endpoints.js';
|
|
2
|
+
import type { Status } from '../../types/contracts.js';
|
|
3
|
+
import type { ActionTestApi, SurfaceProps } from './contracts.js';
|
|
4
|
+
export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
|
|
5
|
+
/** Replace only the guidance represented by this page's local notice. */
|
|
6
|
+
export declare function editorPlacementChecks(checks: PreflightResult['checks'], page: NonNullable<SurfaceProps['editorPage']>): PreflightResult['checks'];
|
|
7
|
+
/** Editor context is a hint for guidance only; Start still runs server preflight. */
|
|
8
|
+
export declare function editorPlacementMessage(placements: PreflightResult['placements'] | undefined, page: SurfaceProps['editorPage'], status: Status | undefined): string | undefined;
|
|
9
|
+
/** Replace this page's checks once, retaining every other page's blocker. */
|
|
10
|
+
export declare function editorPreflight(answer: PreflightResult | null, surface: SurfaceProps, includeLocalBlocker?: boolean): PreflightResult | null;
|
|
11
|
+
/** Shared sidebar policy; the bounded list renders these steps verbatim. */
|
|
12
|
+
export declare function sidebarReadinessBlockers(test: ActionTestApi, surface: SurfaceProps): ({
|
|
13
|
+
arm?: import("../../types/contracts.js").ArmKey | undefined;
|
|
14
|
+
section: "header" | import("./contracts.js").SectionId;
|
|
15
|
+
sentence: string;
|
|
16
|
+
code: import("../../transitions/checkStart.js").ReadinessCode;
|
|
17
|
+
} | {
|
|
18
|
+
sentence: "Wait for your changes to save.";
|
|
19
|
+
})[] | {
|
|
20
|
+
sentence: "Checking readiness…";
|
|
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'];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
|
|
2
|
+
import { blockingSteps, pageReadinessContext } from './readiness/readiness.model.js';
|
|
3
|
+
import { READINESS_COPY } from '../copy/readiness.js';
|
|
4
|
+
export { SAVE_PAGE, PUBLISH_PAGE, RUNNING_PUBLISH_PAGE, RUNNING_SAVE_PAGE } from '../copy/readiness.js';
|
|
5
|
+
/** Replace only the guidance represented by this page's local notice. */ export function editorPlacementChecks(checks, page) {
|
|
6
|
+
return checks.flatMap((check)=>{
|
|
7
|
+
if (check.code === 'no-placements') return [];
|
|
8
|
+
if (check.code !== 'placement-unpublished' || check.ok) return [
|
|
9
|
+
check
|
|
10
|
+
];
|
|
11
|
+
const detail = (Array.isArray(check.detail) ? check.detail : [
|
|
12
|
+
check.detail
|
|
13
|
+
]).filter((value)=>{
|
|
14
|
+
if (!value || typeof value !== 'object') return true;
|
|
15
|
+
const row = value;
|
|
16
|
+
return row.collection !== page.collection || String(row.id) !== String(page.id);
|
|
17
|
+
});
|
|
18
|
+
return detail.length ? [
|
|
19
|
+
{
|
|
20
|
+
...check,
|
|
21
|
+
detail
|
|
22
|
+
}
|
|
23
|
+
] : [];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Editor context is a hint for guidance only; Start still runs server preflight. */ export function editorPlacementMessage(placements, page, status) {
|
|
27
|
+
if (!page || !placements || !status || status === 'decided' || status === 'archived') return;
|
|
28
|
+
const here = placements.filter((p)=>p.collection === page.collection && String(p.id) === String(page.id));
|
|
29
|
+
if (!here.length) return status === 'running' ? RUNNING_SAVE_PAGE : SAVE_PAGE;
|
|
30
|
+
if (!here.some((p)=>p.detail === 'Published')) return status === 'running' ? RUNNING_PUBLISH_PAGE : PUBLISH_PAGE;
|
|
31
|
+
}
|
|
32
|
+
/** Replace this page's checks once, retaining every other page's blocker. */ export function editorPreflight(answer, surface, includeLocalBlocker = true) {
|
|
33
|
+
return answer && surface.editorPlacementMessage && surface.editorPage ? {
|
|
34
|
+
...answer,
|
|
35
|
+
checks: [
|
|
36
|
+
...editorPlacementChecks(answer.checks, surface.editorPage),
|
|
37
|
+
...includeLocalBlocker ? [
|
|
38
|
+
{
|
|
39
|
+
code: 'no-placements',
|
|
40
|
+
ok: false
|
|
41
|
+
}
|
|
42
|
+
] : []
|
|
43
|
+
]
|
|
44
|
+
} : answer;
|
|
45
|
+
}
|
|
46
|
+
/** Shared sidebar policy; the bounded list renders these steps verbatim. */ export function sidebarReadinessBlockers(test, surface) {
|
|
47
|
+
const answer = editorPreflight(test.preflight, surface, false);
|
|
48
|
+
const blockers = test.doc ? blockingSteps(answer, pageReadinessContext(test.doc, test.preflight, surface)) : [];
|
|
49
|
+
const notice = test.preflightRead?.message ?? surface.editorPlacementMessage;
|
|
50
|
+
return test.saving === 'saving' ? [
|
|
51
|
+
{
|
|
52
|
+
sentence: READINESS_COPY.saveFirst
|
|
53
|
+
},
|
|
54
|
+
...blockers
|
|
55
|
+
] : !answer && !notice ? [
|
|
56
|
+
{
|
|
57
|
+
sentence: READINESS_COPY.checking
|
|
58
|
+
}
|
|
59
|
+
] : blockers.filter((step)=>step.sentence !== notice);
|
|
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
|
+
}
|