@delmaredigital/payload-experiments 0.3.0-rc.4 → 0.4.0-rc.10
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 +293 -688
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +4 -4
- package/dist/admin/PlacementStatus.d.ts +3 -0
- package/dist/admin/PlacementStatus.js +54 -0
- 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 +5 -0
- package/dist/admin/blocks/BlockPanel.js +245 -0
- package/dist/admin/blocks/TestBlockField.d.ts +5 -0
- package/dist/admin/blocks/TestBlockField.js +163 -0
- package/dist/admin/blocks/formApi.d.ts +46 -0
- package/dist/admin/blocks/formApi.js +159 -0
- package/dist/admin/blocks/inject.d.ts +7 -0
- package/dist/admin/blocks/inject.js +42 -0
- package/dist/admin/blocks/model.d.ts +18 -0
- package/dist/admin/blocks/model.js +49 -0
- package/dist/admin/blocks/statusCache.d.ts +9 -0
- package/dist/admin/blocks/statusCache.js +92 -0
- package/dist/admin/blocks/useBlockForm.d.ts +17 -0
- package/dist/admin/blocks/useBlockForm.js +46 -0
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +47 -0
- package/dist/admin/copy/blocks.js +72 -0
- package/dist/admin/copy/goals.d.ts +8 -1
- package/dist/admin/copy/goals.js +14 -4
- package/dist/admin/copy/newTest.d.ts +13 -4
- package/dist/admin/copy/newTest.js +16 -4
- package/dist/admin/goals/XpGoalField.d.ts +4 -0
- package/dist/admin/goals/XpGoalField.js +194 -0
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +11 -0
- package/dist/admin/pageCollections.js +23 -0
- package/dist/admin/paths.d.ts +9 -0
- package/dist/admin/paths.js +9 -0
- package/dist/admin/placementStatus.model.d.ts +2 -0
- package/dist/admin/placementStatus.model.js +19 -0
- 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.js +5 -2
- package/dist/admin/surface/TestRowMenu.d.ts +6 -0
- package/dist/admin/surface/TestRowMenu.js +156 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +298 -59
- package/dist/admin/surface/TestsSurface.js +13 -8
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +159 -85
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +7 -6
- package/dist/admin/surface/goals/data.js +6 -3
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +12 -3
- package/dist/admin/surface/goals/goals.model.js +43 -2
- package/dist/admin/surface/home.model.d.ts +9 -8
- package/dist/admin/surface/home.model.js +28 -23
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +146 -101
- package/dist/admin/surface/newTest/PageWizard.d.ts +8 -0
- package/dist/admin/surface/newTest/PageWizard.js +244 -0
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +58 -57
- package/dist/admin/surface/surface.css +10 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +42 -161
- 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 +28 -133
- 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 +11 -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.d.ts +3 -0
- package/dist/blocks/bindings.js +28 -0
- package/dist/blocks/createExperimentBlock.d.ts +6 -0
- package/dist/blocks/createExperimentBlock.js +77 -0
- package/dist/blocks/formState.d.ts +31 -0
- package/dist/blocks/formState.js +146 -0
- package/dist/blocks/model.d.ts +41 -0
- package/dist/blocks/model.js +34 -0
- 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/client/ExperimentGroup.d.ts +6 -0
- package/dist/client/ExperimentGroup.js +9 -0
- package/dist/client/ExperimentsProvider.js +20 -4
- package/dist/client/clickGoals.d.ts +4 -0
- package/dist/client/clickGoals.js +43 -0
- package/dist/collections/experiments/config.js +29 -10
- package/dist/collections/experiments/deleteGuard.d.ts +2 -1
- package/dist/collections/experiments/deleteGuard.js +14 -3
- package/dist/collections/experiments/editability.js +4 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.d.ts +2 -0
- package/dist/collections/experiments/pickSlug.js +10 -0
- package/dist/collections/labels.d.ts +3 -0
- package/dist/collections/labels.js +20 -0
- package/dist/collections/metrics.js +28 -6
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/phases.js +1 -0
- package/dist/collections/serialize.js +12 -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.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/clickGoals.d.ts +9 -0
- package/dist/db/clickGoals.js +22 -0
- package/dist/db/delete.d.ts +2 -1
- package/dist/db/delete.js +3 -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/locks.d.ts +8 -0
- package/dist/db/locks.js +27 -4
- package/dist/db/names.d.ts +4 -0
- package/dist/db/names.js +4 -0
- package/dist/db/pageBindings.d.ts +4 -0
- package/dist/db/pageBindings.js +17 -0
- package/dist/db/pageBusy.d.ts +2 -0
- package/dist/db/pageBusy.js +10 -0
- package/dist/db/pageContent.d.ts +10 -0
- package/dist/db/pageContent.js +79 -0
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +35 -0
- package/dist/db/placements.js +62 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/slugs.d.ts +8 -0
- package/dist/db/slugs.js +40 -0
- package/dist/db/snapshots.d.ts +7 -0
- package/dist/db/snapshots.js +8 -5
- package/dist/endpoints/clickKeys.d.ts +5 -0
- package/dist/endpoints/clickKeys.js +17 -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 +106 -39
- package/dist/endpoints/index.js +85 -9
- package/dist/endpoints/pages.d.ts +5 -0
- package/dist/endpoints/pages.js +303 -0
- package/dist/endpoints/placementStatus.d.ts +6 -0
- package/dist/endpoints/placementStatus.js +246 -0
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/readBody.d.ts +2 -0
- package/dist/endpoints/readBody.js +24 -0
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +10 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -5
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/endpoints/wrapBlock.d.ts +6 -0
- package/dist/endpoints/wrapBlock.js +76 -0
- package/dist/errors.d.ts +7 -2
- package/dist/errors.js +11 -3
- 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 +25 -7
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +6 -1
- package/dist/exports/adminClient.js +6 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/blocks.d.ts +2 -0
- package/dist/exports/blocks.js +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +1 -0
- package/dist/exports/index.d.ts +6 -1
- package/dist/exports/index.js +3 -0
- package/dist/exports/puck.d.ts +3 -1
- package/dist/exports/puck.js +2 -0
- package/dist/exports/puckEditor.d.ts +3 -0
- package/dist/exports/puckEditor.js +2 -0
- package/dist/exports/rsc.d.ts +4 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/fields/xpGoal.d.ts +3 -0
- package/dist/fields/xpGoal.js +16 -0
- package/dist/globals/state.js +10 -0
- package/dist/goals/cache.d.ts +3 -0
- package/dist/goals/cache.js +35 -0
- package/dist/goals/fairness.d.ts +40 -0
- package/dist/goals/fairness.js +209 -0
- package/dist/goals/key.d.ts +4 -0
- package/dist/goals/key.js +3 -0
- package/dist/goals/picker/clickGoalPicker.model.d.ts +36 -0
- package/dist/goals/picker/clickGoalPicker.model.js +63 -0
- package/dist/goals/picker/copy.d.ts +20 -0
- package/dist/goals/picker/copy.js +24 -0
- package/dist/goals/picker/useClickGoalPicker.d.ts +30 -0
- package/dist/goals/picker/useClickGoalPicker.js +222 -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 +30 -1
- package/dist/hooks/pageGuard.js +337 -107
- 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 +65 -0
- package/dist/options.d.ts +4 -0
- package/dist/options.js +62 -1
- package/dist/plugin.js +56 -44
- 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 +6 -1
- package/dist/puck/copy.js +6 -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.js +951 -179
- 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 +57 -0
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +10 -6
- package/dist/puck/editor/VersionBuilder.d.ts +66 -12
- package/dist/puck/editor/VersionBuilder.js +554 -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 +64 -19
- package/dist/puck/editor/copy.js +72 -20
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +192 -19
- package/dist/puck/editor/editor.css +329 -24
- package/dist/puck/editor/editor.model.d.ts +21 -3
- package/dist/puck/editor/editor.model.js +67 -7
- 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/integration.d.ts +10 -0
- package/dist/puck/editor/integration.js +30 -0
- 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.d.ts +7 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +153 -0
- 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/integration.d.ts +6 -0
- package/dist/puck/integration.js +21 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/puck/xpGoalField.d.ts +3 -0
- package/dist/puck/xpGoalField.js +6 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +12 -0
- package/dist/results/health.js +55 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/snapshot.js +15 -2
- 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 +63 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/pageKindSeoContract.d.ts +27 -0
- package/dist/server/pageKindSeoContract.js +80 -0
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +88 -12
- package/dist/server/resolveExperimentBlocks.d.ts +5 -0
- package/dist/server/resolveExperimentBlocks.js +52 -0
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +104 -25
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/toClientAssignments.js +2 -1
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +8 -4
- package/dist/testSurface/actions/DecideDialog.d.ts +16 -0
- package/dist/{admin → testSurface}/actions/DecideDialog.js +79 -56
- package/dist/testSurface/actions/LifecycleAction.d.ts +16 -0
- package/dist/testSurface/actions/LifecycleAction.js +105 -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 +122 -0
- package/dist/testSurface/api.d.ts +60 -0
- package/dist/testSurface/api.js +167 -0
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +30 -8
- package/dist/{admin → testSurface}/copy/actions.js +40 -11
- package/dist/{admin → testSurface}/copy/common.d.ts +13 -4
- package/dist/{admin → testSurface}/copy/common.js +18 -8
- 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 +1 -0
- package/dist/{admin → testSurface}/copy/metrics.js +1 -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 +59 -6
- package/dist/testSurface/copy/readiness.js +136 -0
- package/dist/{admin → testSurface}/copy/results.d.ts +7 -3
- package/dist/{admin → testSurface}/copy/results.js +7 -3
- package/dist/{admin → testSurface}/copy/review.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/review.js +1 -1
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +13 -10
- package/dist/{admin → testSurface}/copy/testPage.d.ts +56 -7
- package/dist/testSurface/copy/testPage.js +165 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/metricSource.model.d.ts +2 -0
- package/dist/{admin → testSurface}/metricSource.model.js +4 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/testSurface/placements/placementLabels.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.js +22 -0
- package/dist/testSurface/placements/placementLabels.model.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.model.js +12 -0
- package/dist/testSurface/placements/usePlacementLabels.d.ts +12 -0
- package/dist/testSurface/placements/usePlacementLabels.js +102 -0
- 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/DataQualityPanel.js +4 -1
- 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 -0
- package/dist/{admin → testSurface}/results/results.model.js +14 -6
- package/dist/{admin → testSurface}/surface/contracts.d.ts +23 -8
- 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/{admin → testSurface}/surface/pageBlock/parts.js +39 -11
- 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 +503 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +29 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +40 -0
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +8 -4
- package/dist/testSurface/surface/readiness/ActionDialogs.js +351 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +2 -3
- package/dist/testSurface/surface/readiness/Banner.js +187 -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 +10 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +66 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +57 -0
- 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/testSurface/surface/results/ReleasePages.d.ts +19 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +43 -47
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +129 -46
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +36 -9
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +58 -18
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/testSurface/surface/test/AdvancedSection.js +169 -0
- 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/testSurface/surface/test/GoalSection.js +341 -0
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +6 -2
- package/dist/testSurface/surface/test/PageHoldout.d.ts +3 -0
- package/dist/testSurface/surface/test/PageHoldout.js +70 -0
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +2 -3
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +80 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +82 -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/{admin → testSurface}/surface/test/VersionsSection.js +81 -40
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +40 -8
- package/dist/testSurface/surface/test/fields.js +306 -0
- package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/jumpToSection.js +4 -3
- package/dist/testSurface/surface/test/pageParts.d.ts +5 -0
- package/dist/testSurface/surface/test/pageParts.js +106 -0
- package/dist/testSurface/surface/test/testPage.css +103 -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 +4 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +6 -2
- 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 +7 -0
- package/dist/testSurface/surfaceUrls.js +19 -0
- package/dist/testSurface/useApi.d.ts +60 -0
- package/dist/testSurface/useApi.js +8 -0
- 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 +4 -6
- package/dist/transitions/addMetric.js +33 -2
- 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 +18 -1
- package/dist/transitions/checkStart.js +207 -9
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +30 -3
- package/dist/transitions/deleteExperiment.d.ts +5 -3
- package/dist/transitions/deleteExperiment.js +43 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +13 -4
- package/dist/transitions/makeContent.d.ts +7 -1
- package/dist/transitions/makeContent.js +74 -22
- 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/pageCollection.d.ts +10 -0
- package/dist/transitions/pageCollection.js +20 -0
- package/dist/transitions/pageVersions.d.ts +10 -0
- package/dist/transitions/pageVersions.js +46 -0
- package/dist/transitions/phaseRecord.d.ts +3 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +40 -0
- package/dist/transitions/placementInteractions.js +98 -0
- package/dist/transitions/placements.d.ts +58 -4
- package/dist/transitions/placements.js +391 -21
- package/dist/transitions/preflightData.d.ts +7 -5
- package/dist/transitions/preflightData.js +269 -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 +3 -4
- package/dist/transitions/resolveCaps.js +6 -2
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +112 -31
- 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/admin.d.ts +1 -1
- package/dist/types/assignments.d.ts +1 -0
- package/dist/types/contracts.d.ts +30 -3
- package/dist/types/endpoints.d.ts +204 -13
- package/dist/types/index.d.ts +3 -0
- package/dist/types/puck.d.ts +8 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +19 -4
- package/dist/types/surface.d.ts +20 -7
- 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 +116 -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 +7 -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 +49 -5
- package/package.json +9 -1
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -18
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -9
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/api.d.ts +0 -38
- package/dist/admin/api.js +0 -99
- package/dist/admin/copy/readiness.js +0 -71
- package/dist/admin/copy/testPage.js +0 -100
- 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/readiness/ActionDialogs.js +0 -302
- package/dist/admin/surface/readiness/Banner.js +0 -166
- 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.d.ts +0 -24
- package/dist/admin/surface/readiness/readiness.model.js +0 -123
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/results/ReleasePages.d.ts +0 -14
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/AdvancedSection.js +0 -160
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/GoalSection.js +0 -228
- 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/fields.js +0 -184
- package/dist/admin/surface/test/pageParts.d.ts +0 -2
- package/dist/admin/surface/test/pageParts.js +0 -45
- package/dist/admin/surface/test/testPage.css +0 -90
- package/dist/admin/surface/useTestDocument.d.ts +0 -23
- package/dist/admin/surface/useTestDocument.js +0 -377
- package/dist/admin/useApi.d.ts +0 -35
- package/dist/admin/useApi.js +0 -10
- /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/allocation.model.js +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}/copy/advanced.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
- /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/arms.js +0 -0
- /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/audience.js +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
- /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/setting.js +0 -0
- /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
- /package/dist/{admin → testSurface}/format/date.js +0 -0
- /package/dist/{admin → testSurface}/labels.d.ts +0 -0
- /package/dist/{admin → testSurface}/labels.js +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.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/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/results/recommendation.model.js +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}/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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DocId } from '../../types/contracts.js';
|
|
2
|
+
import type { PreflightResult } from '../../types/endpoints.js';
|
|
3
|
+
export { placementDetailKey, placementDetail, fallbackPlacementLabel } from './placementLabels.model.js';
|
|
4
|
+
export type { PlacementLabel } from './placementLabels.model.js';
|
|
5
|
+
import type { PlacementLabel } from './placementLabels.model.js';
|
|
6
|
+
export declare function resolvedPlacementLabel(value: unknown, match: {
|
|
7
|
+
id?: DocId | null;
|
|
8
|
+
title?: string;
|
|
9
|
+
editorUrl?: string;
|
|
10
|
+
locales?: string[];
|
|
11
|
+
allLocales?: true;
|
|
12
|
+
} | undefined, adminRoute: string): PlacementLabel;
|
|
13
|
+
export declare function preflightPlacementLabel(value: unknown, preflight: PreflightResult, adminRoute: string): PlacementLabel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { placementLanguageSuffix } from '../copy/languages.js';
|
|
2
|
+
import { formatAdminURL } from '../format/adminURL.js';
|
|
3
|
+
import { placementDetail } from './placementLabels.model.js';
|
|
4
|
+
export { placementDetailKey, placementDetail, fallbackPlacementLabel } from './placementLabels.model.js';
|
|
5
|
+
export function resolvedPlacementLabel(value, match, adminRoute) {
|
|
6
|
+
const detail = placementDetail(value);
|
|
7
|
+
const id = match?.id ?? detail.id;
|
|
8
|
+
return {
|
|
9
|
+
title: `${match?.title?.trim() || detail.path || 'This page'}${placementLanguageSuffix(match ?? {})}`,
|
|
10
|
+
...id != null && detail.collection ? {
|
|
11
|
+
href: match?.editorUrl || formatAdminURL({
|
|
12
|
+
adminRoute,
|
|
13
|
+
path: `/collections/${encodeURIComponent(detail.collection)}/${encodeURIComponent(String(id))}`
|
|
14
|
+
})
|
|
15
|
+
} : {}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function preflightPlacementLabel(value, preflight, adminRoute) {
|
|
19
|
+
const detail = placementDetail(value);
|
|
20
|
+
const match = detail.collection ? detail.id != null ? preflight.placements.find((item)=>item.collection === detail.collection && String(item.id) === String(detail.id)) : typeof detail.path === 'string' ? preflight.pagePlacements?.find((item)=>item.collection === detail.collection && item.path === detail.path) : undefined : undefined;
|
|
21
|
+
return resolvedPlacementLabel(value, match, adminRoute);
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DocId } from '../../types/contracts.js';
|
|
2
|
+
export type PlacementDetail = {
|
|
3
|
+
collection?: string;
|
|
4
|
+
id?: DocId;
|
|
5
|
+
path?: string;
|
|
6
|
+
};
|
|
7
|
+
export type PlacementLabel = {
|
|
8
|
+
title: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const placementDetail: (detail: unknown) => PlacementDetail;
|
|
12
|
+
export declare function placementDetailKey(value: unknown): string;
|
|
13
|
+
export declare const fallbackPlacementLabel: (value: unknown) => PlacementLabel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const placementDetail = (detail)=>detail && typeof detail === 'object' && !Array.isArray(detail) ? detail : {};
|
|
2
|
+
export function placementDetailKey(value) {
|
|
3
|
+
const detail = placementDetail(value);
|
|
4
|
+
return JSON.stringify([
|
|
5
|
+
detail.collection,
|
|
6
|
+
detail.id == null ? null : String(detail.id),
|
|
7
|
+
detail.path
|
|
8
|
+
]);
|
|
9
|
+
}
|
|
10
|
+
export const fallbackPlacementLabel = (value)=>({
|
|
11
|
+
title: placementDetail(value).path || 'This page'
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PreflightResult } from '../../types/endpoints.js';
|
|
2
|
+
import type { PlacementLabel } from './placementLabels.js';
|
|
3
|
+
export { placementDetailKey } from './placementLabels.js';
|
|
4
|
+
/** The view owns a cache, including misses, so repeated warnings never repeat reads. */
|
|
5
|
+
export declare function usePlacementLabels({ details, preflight, apiRoute, adminRoute, canManage, collectionTitles }: {
|
|
6
|
+
details: unknown[];
|
|
7
|
+
preflight?: PreflightResult | null;
|
|
8
|
+
apiRoute: string;
|
|
9
|
+
adminRoute: string;
|
|
10
|
+
canManage: boolean;
|
|
11
|
+
collectionTitles?: Record<string, string>;
|
|
12
|
+
}): Map<string, PlacementLabel>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { createApi } from '../api.js';
|
|
4
|
+
import { placementDetail, placementDetailKey, preflightPlacementLabel, resolvedPlacementLabel } from './placementLabels.js';
|
|
5
|
+
export { placementDetailKey } from './placementLabels.js';
|
|
6
|
+
/** The view owns a cache, including misses, so repeated warnings never repeat reads. */ export function usePlacementLabels({ details, preflight, apiRoute, adminRoute, canManage, collectionTitles }) {
|
|
7
|
+
const titlesSignature = JSON.stringify(collectionTitles);
|
|
8
|
+
const cache = useMemo(()=>new Map(), [
|
|
9
|
+
apiRoute,
|
|
10
|
+
adminRoute,
|
|
11
|
+
titlesSignature
|
|
12
|
+
]);
|
|
13
|
+
const mounted = useRef(true);
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
mounted.current = true;
|
|
16
|
+
return ()=>{
|
|
17
|
+
mounted.current = false;
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
const [, refresh] = useState(0);
|
|
21
|
+
const signature = JSON.stringify(details.map(placementDetail));
|
|
22
|
+
useEffect(()=>{
|
|
23
|
+
if (!canManage || preflight) return;
|
|
24
|
+
const pending = [
|
|
25
|
+
...new Map(JSON.parse(signature).map((detail)=>[
|
|
26
|
+
placementDetailKey(detail),
|
|
27
|
+
detail
|
|
28
|
+
])).values()
|
|
29
|
+
].filter((detail)=>!cache.has(placementDetailKey(detail)));
|
|
30
|
+
const blocks = new Map();
|
|
31
|
+
const jobs = [];
|
|
32
|
+
const save = (value, label)=>{
|
|
33
|
+
cache.set(placementDetailKey(value), label);
|
|
34
|
+
};
|
|
35
|
+
for (const value of pending){
|
|
36
|
+
const detail = placementDetail(value);
|
|
37
|
+
// Reserve immediately: repeated renders do not issue duplicate requests.
|
|
38
|
+
save(value, resolvedPlacementLabel(value, undefined, adminRoute));
|
|
39
|
+
if (!detail.collection) continue;
|
|
40
|
+
if (detail.id != null) {
|
|
41
|
+
blocks.set(detail.collection, [
|
|
42
|
+
...blocks.get(detail.collection) ?? [],
|
|
43
|
+
value
|
|
44
|
+
]);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (!detail.path) continue;
|
|
48
|
+
jobs.push(createApi(apiRoute).pages({
|
|
49
|
+
collection: detail.collection,
|
|
50
|
+
path: detail.path
|
|
51
|
+
}).then((result)=>{
|
|
52
|
+
if (result.ok) save(value, resolvedPlacementLabel(value, result.data?.docs[0], adminRoute));
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
for (const [collection, values] of blocks)jobs.push((async ()=>{
|
|
56
|
+
try {
|
|
57
|
+
const ids = [
|
|
58
|
+
...new Set(values.map((value)=>String(placementDetail(value).id)))
|
|
59
|
+
];
|
|
60
|
+
const query = new URLSearchParams({
|
|
61
|
+
'where[id][in]': ids.join(','),
|
|
62
|
+
depth: '0',
|
|
63
|
+
limit: String(ids.length)
|
|
64
|
+
});
|
|
65
|
+
const response = await fetch(`${apiRoute.replace(/\/$/, '')}/${encodeURIComponent(collection)}?${query}`, {
|
|
66
|
+
credentials: 'include'
|
|
67
|
+
});
|
|
68
|
+
if (!response.ok) return;
|
|
69
|
+
const data = await response.json();
|
|
70
|
+
const titleField = collectionTitles?.[collection];
|
|
71
|
+
for (const value of values){
|
|
72
|
+
const doc = data.docs?.find((doc)=>String(doc.id) === String(placementDetail(value).id));
|
|
73
|
+
if (doc) save(value, resolvedPlacementLabel(value, {
|
|
74
|
+
id: placementDetail(value).id,
|
|
75
|
+
title: titleField && typeof doc[titleField] === 'string' ? doc[titleField] : undefined
|
|
76
|
+
}, adminRoute));
|
|
77
|
+
}
|
|
78
|
+
} catch {}
|
|
79
|
+
})());
|
|
80
|
+
void Promise.all(jobs).then(()=>{
|
|
81
|
+
if (mounted.current && jobs.length) refresh((value)=>value + 1);
|
|
82
|
+
});
|
|
83
|
+
}, [
|
|
84
|
+
signature,
|
|
85
|
+
preflight,
|
|
86
|
+
apiRoute,
|
|
87
|
+
adminRoute,
|
|
88
|
+
canManage,
|
|
89
|
+
collectionTitles,
|
|
90
|
+
cache
|
|
91
|
+
]);
|
|
92
|
+
return new Map(details.map((detail)=>{
|
|
93
|
+
const label = preflight ? preflightPlacementLabel(detail, preflight, adminRoute) : cache.get(placementDetailKey(detail)) ?? resolvedPlacementLabel(detail, undefined, adminRoute);
|
|
94
|
+
// Results-only readers may not be able to open the collection, so they get the name without a link.
|
|
95
|
+
return [
|
|
96
|
+
placementDetailKey(detail),
|
|
97
|
+
canManage ? label : {
|
|
98
|
+
title: label.title
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -41,7 +41,10 @@ export function DataQualityPanel({ items, problem = false }) {
|
|
|
41
41
|
}) : null,
|
|
42
42
|
/*#__PURE__*/ _jsx("p", {
|
|
43
43
|
className: "xp-quality-next",
|
|
44
|
-
children: item.
|
|
44
|
+
children: item.href ? /*#__PURE__*/ _jsx("a", {
|
|
45
|
+
href: item.href,
|
|
46
|
+
children: item.nextStep
|
|
47
|
+
}) : item.nextStep
|
|
45
48
|
})
|
|
46
49
|
]
|
|
47
50
|
}, item.id)) : /*#__PURE__*/ _jsx("p", {
|
|
@@ -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); }
|
|
@@ -2,6 +2,7 @@ import type { DocId, Status } from '../../types/contracts.js';
|
|
|
2
2
|
import type { PhaseSummary, ResultsResponse } from '../../types/endpoints.js';
|
|
3
3
|
import type { Snapshot } from '../../types/snapshot.js';
|
|
4
4
|
import { type DisplaySnapshot } from './snapshot.js';
|
|
5
|
+
import type { PlacementLabel } from '../placements/placementLabels.model.js';
|
|
5
6
|
type Metric = Snapshot['metrics'][number];
|
|
6
7
|
type Arm = Metric['perArm'][number];
|
|
7
8
|
type Decision = {
|
|
@@ -88,6 +89,7 @@ interface RoundLineInput {
|
|
|
88
89
|
}
|
|
89
90
|
export declare function powerLine({ snapshot, phaseKind, status }: RoundLineInput): string | null;
|
|
90
91
|
export interface ResultsContext {
|
|
92
|
+
placementLabels?: Map<string, PlacementLabel>;
|
|
91
93
|
status?: string;
|
|
92
94
|
phase?: PhaseSummary;
|
|
93
95
|
minExposuresPerArm?: number;
|
|
@@ -102,6 +104,7 @@ export interface DataQualityItem {
|
|
|
102
104
|
message: string;
|
|
103
105
|
detail?: string;
|
|
104
106
|
nextStep: string;
|
|
107
|
+
href?: string;
|
|
105
108
|
shares?: string[];
|
|
106
109
|
}
|
|
107
110
|
export declare function dataQuality(snapshot: DisplaySnapshot, ctx?: ResultsContext): DataQualityItem[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { READINESS_COPY, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
|
|
1
|
+
import { READINESS_COPY, placementUncheckedCopy, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
|
|
2
2
|
import { armLabel, phaseKindLabel, verdictCodeLabel } from '../labels.js';
|
|
3
3
|
import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, metricUnavailable, moreDays, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal } 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';
|
|
7
|
+
import { placementDetailKey } from '../placements/placementLabels.model.js';
|
|
7
8
|
export function defaultRound({ phases, decision, status }) {
|
|
8
9
|
if ((status === 'decided' || status === 'archived') && decision) return decision.phase;
|
|
9
10
|
return phases.reduce((latest, phase)=>latest === null || phase.phase > latest ? phase.phase : latest, null);
|
|
@@ -131,11 +132,18 @@ function smallest(values) {
|
|
|
131
132
|
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));
|
|
132
133
|
}
|
|
133
134
|
export function dataQuality(snapshot, ctx = {}) {
|
|
134
|
-
const items = (snapshot.health ?? []).map((item)=>
|
|
135
|
-
id:
|
|
136
|
-
message:
|
|
137
|
-
nextStep:
|
|
138
|
-
}
|
|
135
|
+
const items = (snapshot.health ?? []).map((item)=>item.code === 'rapid-browser-events' ? {
|
|
136
|
+
id: item.code,
|
|
137
|
+
message: RESULTS_COPY.rapidBrowserEvents,
|
|
138
|
+
nextStep: RESULTS_COPY.rapidBrowserEventsNext
|
|
139
|
+
} : {
|
|
140
|
+
id: item.code === 'placement-unchecked' ? `${item.code}:${JSON.stringify(item.detail)}` : `${item.code}:${'path' in item ? item.path : item.metricId}`,
|
|
141
|
+
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,
|
|
142
|
+
...item.code === 'placement-unchecked' ? {
|
|
143
|
+
href: ctx.placementLabels?.get(placementDetailKey(item.detail))?.href
|
|
144
|
+
} : {},
|
|
145
|
+
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)
|
|
146
|
+
});
|
|
139
147
|
// Test snapshots store null by design; only rollout snapshots record the shipped winner.
|
|
140
148
|
if (!isLegacySnapshot(snapshot) && snapshot.phaseKind === 'rollout' && snapshot.winnerArm === null) items.push({
|
|
141
149
|
id: 'missing-winner',
|
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { TestsSurfaceProps } from '../../types/surface.js';
|
|
2
3
|
import type { SerializedAttributeKeys, SerializedFlagPoint, SerializedMetricSource } from '../../types/admin.js';
|
|
4
|
+
import type { ArmSlot } from '../../types/puck.js';
|
|
3
5
|
import type { useTestDocument } from './useTestDocument.js';
|
|
4
6
|
/** Sections of the test page, in readiness order (surface spec §6.2, §8). */
|
|
5
7
|
export type SectionId = 'what' | 'versions' | 'win' | 'who' | 'length' | 'advanced';
|
|
6
8
|
export declare const SECTION_ORDER: readonly SectionId[];
|
|
7
9
|
/** The data layer's return value; every section takes it as `test`. */
|
|
8
|
-
|
|
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'>;
|
|
9
15
|
/** Serialisable props the server root view passes to the surface (ADM-20). */
|
|
10
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;
|
|
11
24
|
adminRoute: string;
|
|
12
25
|
apiRoute: string;
|
|
26
|
+
contentLanguageLabels?: string[];
|
|
27
|
+
contentLocale?: string;
|
|
28
|
+
collectionTitles?: Record<string, string>;
|
|
29
|
+
userId?: string | number;
|
|
30
|
+
userCollection?: string;
|
|
13
31
|
canManage: boolean;
|
|
14
32
|
canReadResults: boolean;
|
|
15
33
|
isAdmin: boolean;
|
|
16
34
|
flagPoints: SerializedFlagPoint[];
|
|
17
35
|
attributeKeys: SerializedAttributeKeys;
|
|
18
36
|
metricSources: SerializedMetricSource[];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
document?: string;
|
|
22
|
-
setting?: string;
|
|
23
|
-
};
|
|
37
|
+
pageCollections?: TestsSurfaceProps['pageCollections'];
|
|
38
|
+
admin?: TestsSurfaceProps['admin'];
|
|
24
39
|
}
|
|
25
40
|
export interface SectionProps {
|
|
26
41
|
test: TestDocApi;
|
|
@@ -34,12 +49,11 @@ export interface KindParts {
|
|
|
34
49
|
/** The content cell of one version row in Section 2. */
|
|
35
50
|
VersionContent: ComponentType<SectionProps & {
|
|
36
51
|
armIndex: number;
|
|
52
|
+
summary?: boolean;
|
|
37
53
|
}>;
|
|
38
54
|
}
|
|
39
55
|
/** Readiness pieces (ADM-23). */
|
|
40
56
|
export interface ReadinessParts {
|
|
41
|
-
/** Sticky-header banner incl. Start / status sentence. */
|
|
42
|
-
Banner: ComponentType<SectionProps>;
|
|
43
57
|
/** "Saving…" / "Saved" / error indicator for the header. */
|
|
44
58
|
SaveStatus: ComponentType<{
|
|
45
59
|
test: TestDocApi;
|
|
@@ -47,3 +61,4 @@ export interface ReadinessParts {
|
|
|
47
61
|
/** Check-circle state per section, from preflight. */
|
|
48
62
|
sectionDone(test: TestDocApi): Record<SectionId, boolean>;
|
|
49
63
|
}
|
|
64
|
+
export {};
|