@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { readinessRead } from '../../readinessRead.js';
|
|
4
|
+
import { useRef, useState } from 'react';
|
|
5
|
+
import { Button } from '../../../ui/Button.js';
|
|
6
|
+
import { finishEditCopy, READINESS_COPY as C } from '../../copy/readiness.js';
|
|
7
|
+
export function actionWaitMessage(test) {
|
|
8
|
+
if (test.stale) return C.reloadFirst;
|
|
9
|
+
if (test.saving === 'saving') return C.saveFirst;
|
|
10
|
+
const draft = Object.values(test.fieldDrafts ?? {})[0];
|
|
11
|
+
return draft ? finishEditCopy(draft.label) : test.hasUnsaved ? C.finishEdits : undefined;
|
|
12
|
+
}
|
|
13
|
+
export function saveStatusMessage(test) {
|
|
14
|
+
return test.saving === 'saving' ? C.saving : test.hasUnsaved ? null : test.saving === 'saved' || test.saving === 'idle' ? C.saved : test.saving === 'error' && !test.stale ? test.errors._section ? C.saveGeneralError : C.saveError : null;
|
|
15
|
+
}
|
|
16
|
+
export function ReadinessReadStatus({ test, messageInBlockerList = false }) {
|
|
17
|
+
const inFlight = useRef(false);
|
|
18
|
+
const [retrying, setRetrying] = useState(false);
|
|
19
|
+
async function retry() {
|
|
20
|
+
if (inFlight.current || test.preflightPending) return;
|
|
21
|
+
inFlight.current = true;
|
|
22
|
+
setRetrying(true);
|
|
23
|
+
try {
|
|
24
|
+
await test.refreshPreflight();
|
|
25
|
+
} finally{
|
|
26
|
+
inFlight.current = false;
|
|
27
|
+
setRetrying(false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const read = test.preflightRead ?? (test.preflightError ? readinessRead(test) : undefined);
|
|
31
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
32
|
+
children: read?.message ? /*#__PURE__*/ _jsxs("div", {
|
|
33
|
+
children: [
|
|
34
|
+
!messageInBlockerList ? /*#__PURE__*/ _jsx("span", {
|
|
35
|
+
role: "alert",
|
|
36
|
+
children: read.message
|
|
37
|
+
}) : null,
|
|
38
|
+
' ',
|
|
39
|
+
read.retry ? /*#__PURE__*/ _jsx(Button, {
|
|
40
|
+
disabled: retrying || test.preflightPending,
|
|
41
|
+
onClick: ()=>{
|
|
42
|
+
void retry();
|
|
43
|
+
},
|
|
44
|
+
children: C.retry
|
|
45
|
+
}) : null
|
|
46
|
+
]
|
|
47
|
+
}) : null
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function SaveStatus(props) {
|
|
51
|
+
const state = 'test' in props ? props.test : props.save;
|
|
52
|
+
const message = saveStatusMessage(state);
|
|
53
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
54
|
+
className: "xp-save-status",
|
|
55
|
+
"aria-live": "polite",
|
|
56
|
+
children: [
|
|
57
|
+
message ? /*#__PURE__*/ _jsx("span", {
|
|
58
|
+
role: state.saving === 'error' ? 'alert' : 'status',
|
|
59
|
+
children: message
|
|
60
|
+
}) : null,
|
|
61
|
+
'test' in props ? /*#__PURE__*/ _jsx(ReadinessReadStatus, {
|
|
62
|
+
test: props.test,
|
|
63
|
+
messageInBlockerList: props.messageInBlockerList
|
|
64
|
+
}) : null
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import type { ReadinessCode, PreflightResult } from '../../../types/endpoints.js';
|
|
2
2
|
import type { SerializedFlagPoint } from '../../../types/admin.js';
|
|
3
3
|
import type { TestDocument } from '../testDocument.model.js';
|
|
4
|
-
import type { SurfaceProps } from '../contracts.js';
|
|
4
|
+
import type { ActionTestApi, SurfaceProps } from '../contracts.js';
|
|
5
5
|
import { type SectionId } from '../contracts.js';
|
|
6
6
|
export type ReadinessContext = Pick<TestDocument, 'arms' | 'unitType' | 'flagPoint'> & {
|
|
7
|
+
editorPage?: SurfaceProps['editorPage'];
|
|
8
|
+
editorPlacementMessage?: string;
|
|
7
9
|
collectionLabel?: string;
|
|
10
|
+
contentLocales?: PreflightResult['contentLocales'];
|
|
11
|
+
placements?: PreflightResult['placements'];
|
|
8
12
|
pagePlacements?: PreflightResult['pagePlacements'];
|
|
9
13
|
flagPoints?: readonly Pick<SerializedFlagPoint, 'id' | 'params'>[];
|
|
10
14
|
};
|
|
15
|
+
/** Saved content guidance uses the same page refresh as the placement notice. */
|
|
16
|
+
export declare function editorContentNotice(preflight: PreflightResult | null, ctx: ReadinessContext): string | undefined;
|
|
11
17
|
/** Exhaustive mapping of the checkStart ReadinessCode union, including all ten invariant checks. */
|
|
12
18
|
export declare const READINESS: Record<ReadinessCode, {
|
|
13
19
|
section: SectionId | 'header';
|
|
14
20
|
next(detail: unknown, ctx: ReadinessContext): string | null;
|
|
15
|
-
nextStep?: string | ((detail: unknown, ctx: ReadinessContext) => string);
|
|
21
|
+
nextStep?: string | ((detail: unknown, ctx: ReadinessContext) => string | undefined);
|
|
16
22
|
}>;
|
|
23
|
+
type ReadinessCaveat = {
|
|
24
|
+
key: string;
|
|
25
|
+
sentence: string;
|
|
26
|
+
href?: string;
|
|
27
|
+
emphasized?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function readinessCaveats({ doc, preflight, statusReadPending }: Pick<ActionTestApi, 'doc' | 'preflight' | 'statusReadPending'>, adminRoute: string): ReadinessCaveat[];
|
|
30
|
+
export declare function blockingSteps(preflight: PreflightResult | null, ctx: ReadinessContext): {
|
|
31
|
+
arm?: import("../../../types/contracts.js").ArmKey | undefined;
|
|
32
|
+
section: "header" | SectionId;
|
|
33
|
+
sentence: string;
|
|
34
|
+
code: ReadinessCode;
|
|
35
|
+
}[];
|
|
17
36
|
export declare function nextStep(preflight: PreflightResult | null, ctx: ReadinessContext): {
|
|
18
37
|
nextStep?: string | undefined;
|
|
19
38
|
arm?: import("../../../types/contracts.js").ArmKey | undefined;
|
|
@@ -21,11 +40,18 @@ export declare function nextStep(preflight: PreflightResult | null, ctx: Readine
|
|
|
21
40
|
sentence: string;
|
|
22
41
|
code: ReadinessCode;
|
|
23
42
|
} | null;
|
|
43
|
+
export declare function errorSection(path: string): SectionId | undefined;
|
|
44
|
+
export declare function sectionBlocked(test: {
|
|
45
|
+
preflight: PreflightResult | null;
|
|
46
|
+
errors?: Record<string, string>;
|
|
47
|
+
}, section: SectionId): boolean;
|
|
24
48
|
export declare function sectionDone(test: {
|
|
25
49
|
preflight: PreflightResult | null;
|
|
50
|
+
doc?: Pick<TestDocument, 'targeting'> | null;
|
|
26
51
|
}): Record<SectionId, boolean>;
|
|
27
52
|
export declare function displayDate(value: unknown): string | null;
|
|
28
53
|
export declare function daysRemaining(doc: TestDocument, now: number): number | null;
|
|
29
54
|
export declare function pageReadinessContext(doc: TestDocument, preflight: PreflightResult | null, surface: SurfaceProps): ReadinessContext;
|
|
30
55
|
/** First affected row in arm order; shared by the wizard and the test-page jump. */
|
|
31
56
|
export declare function readinessArm(code: ReadinessCode, detail: unknown, ctx: ReadinessContext): import("../../../types/contracts.js").ArmKey | undefined;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { nestedTestCopy } from '../../../puck/nestedTestCopy.js';
|
|
2
|
+
import { SURFACE_COPY } from '../../copy/surface.js';
|
|
3
|
+
import { formatDate } from '../../format/date.js';
|
|
4
|
+
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
5
|
+
import { duplicateVersionCopy, unpublishedPlacementsCopy, asymmetricGoalsCopy, placementUncheckedCopy, interactingTestsCopy, sameAddressCopy, identicalVersionCopy, unsupportedContentCopy, versionPageUnavailableCopy, versionPageUncheckedCopy, placementFailureCopy, pageInUseCopy, unpublishedPageCopy, READINESS_COPY as C, attributeNext, contentNext, draftContentNext, unsavedContentNext, partialContentNext, summaryContentNext, goalPeopleNext, parameterNext, placementNext, ruleNext, versionsNext } from '../../copy/readiness.js';
|
|
6
|
+
import { PLACEMENT_LANGUAGES, placementLanguageSuffix } from '../../copy/languages.js';
|
|
7
|
+
import { METRICS_COPY } from '../../copy/metrics.js';
|
|
8
|
+
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
9
|
+
import { hasBrowserWritablePrimary } from '../../readinessRead.js';
|
|
10
|
+
import { normalisePath } from '../../../runtime/normalisePath.js';
|
|
11
|
+
import { testPageCollection } from '../pagePicker/pagePicker.model.js';
|
|
12
|
+
import { SECTION_ORDER } from '../contracts.js';
|
|
13
|
+
const object = (value)=>value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
14
|
+
const first = (value)=>object(Array.isArray(value) ? value[0] : value);
|
|
15
|
+
const text = (value, fallback)=>typeof value === 'string' && value.trim() ? value.trim() : fallback;
|
|
16
|
+
const detailText = (value, fallback)=>typeof value === 'string' ? text(value, fallback) : text(first(value).message ?? first(value).detail, fallback);
|
|
17
|
+
const group = (key, ctx)=>{
|
|
18
|
+
const found = ctx.arms.find((item)=>item.key === key);
|
|
19
|
+
return found ? actionGroupLabel(found.key, found.label) : C.groupFallback;
|
|
20
|
+
};
|
|
21
|
+
const hasLanguages = (value)=>object(value).allLocales === true || Array.isArray(object(value).locales);
|
|
22
|
+
const detailRows = (detail)=>Array.isArray(detail) && detail.length && detail.some(hasLanguages) ? detail : [
|
|
23
|
+
first(detail)
|
|
24
|
+
];
|
|
25
|
+
const row = (section, next)=>({
|
|
26
|
+
section,
|
|
27
|
+
next
|
|
28
|
+
});
|
|
29
|
+
const versions = row('versions', (detail)=>versionsNext(detailText(detail, C.versionFallback)));
|
|
30
|
+
const samePage = (detail, page)=>detail.collection === page.collection && String(detail.id) === String(page.id);
|
|
31
|
+
const strings = (value)=>Array.isArray(value) ? value.filter((item)=>typeof item === 'string') : [];
|
|
32
|
+
function emptyContentGuidance(detail, ctx) {
|
|
33
|
+
const placements = Array.isArray(detail) ? detail.map(object) : [];
|
|
34
|
+
const versions = ctx.arms.filter((arm)=>arm.kind !== 'holdout' && arm.key !== 'holdout');
|
|
35
|
+
if (!placements.length) {
|
|
36
|
+
const { missing, draftReady } = object(detail);
|
|
37
|
+
const missingKeys = strings(missing);
|
|
38
|
+
const draftKeys = strings(draftReady);
|
|
39
|
+
const affected = versions.filter((arm)=>missingKeys.includes(arm.key));
|
|
40
|
+
const labels = affected.filter((arm)=>!draftKeys.includes(arm.key)).map((arm)=>group(arm.key, ctx));
|
|
41
|
+
const draftLabels = affected.filter((arm)=>draftKeys.includes(arm.key)).map((arm)=>group(arm.key, ctx));
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
sentence: summaryContentNext(labels, draftLabels) || C.summaryMissingVersionContent
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
const localeLabels = ctx.contentLocales?.labels ?? {};
|
|
49
|
+
const labelFor = (code)=>{
|
|
50
|
+
const label = localeLabels[code] ?? code;
|
|
51
|
+
return Object.values(localeLabels).filter((value)=>value === label).length > 1 ? PLACEMENT_LANGUAGES.labelWithCode(label, code) : label;
|
|
52
|
+
};
|
|
53
|
+
const namedPages = placements.some(hasLanguages) || new Set(placements.map((page)=>JSON.stringify([
|
|
54
|
+
page.collection,
|
|
55
|
+
page.id
|
|
56
|
+
]))).size > 1;
|
|
57
|
+
const guidance = placements.flatMap((page)=>{
|
|
58
|
+
const drafts = ctx.placements?.filter((row)=>row.detail === 'Draft' && samePage(page, row)) ?? [];
|
|
59
|
+
const live = ctx.editorPage && samePage(page, ctx.editorPage) ? ctx.editorPage.versionContent : undefined;
|
|
60
|
+
const localeCodes = strings(page.localeCodes);
|
|
61
|
+
const localized = hasLanguages(page);
|
|
62
|
+
const title = text(page.title, 'the page');
|
|
63
|
+
const suffix = placementLanguageSuffix({
|
|
64
|
+
allLocales: page.allLocales === true,
|
|
65
|
+
locales: strings(page.locales)
|
|
66
|
+
});
|
|
67
|
+
const baseTitle = suffix && title.endsWith(suffix) ? title.slice(0, -suffix.length) : title;
|
|
68
|
+
const published = object(page.slots);
|
|
69
|
+
return versions.flatMap((arm)=>{
|
|
70
|
+
const slot = arm.key;
|
|
71
|
+
if (slot === 'holdout' || Number(published[slot]) > 0) return [];
|
|
72
|
+
const label = group(arm.key, ctx);
|
|
73
|
+
const states = new Map();
|
|
74
|
+
for (const locale of localeCodes.length ? localeCodes : [
|
|
75
|
+
undefined
|
|
76
|
+
]){
|
|
77
|
+
const matching = drafts.filter((row)=>locale === undefined ? !localized && !hasLanguages(row) : row.localeCodes?.includes(locale));
|
|
78
|
+
const liveState = !localized || locale !== undefined && locale === ctx.contentLocales?.selected ? live?.[slot] : undefined;
|
|
79
|
+
const hasContent = (row)=>(row.slots?.[slot] ?? 0) > 0;
|
|
80
|
+
// Multiple blocks on a page all need content in the matching saved draft.
|
|
81
|
+
const savedFilled = matching.length > 0 && matching.every(hasContent);
|
|
82
|
+
const state = liveState === 'empty' || liveState === 'partial' ? liveState : savedFilled ? 'draft' : liveState === 'filled' ? 'editor' : matching.some((row)=>hasContent(row) || row.partlyFilledSlots?.includes(slot)) ? 'partial' : 'empty';
|
|
83
|
+
const labels = states.get(state) ?? [];
|
|
84
|
+
if (locale !== undefined) labels.push(labelFor(locale));
|
|
85
|
+
states.set(state, labels);
|
|
86
|
+
}
|
|
87
|
+
return [
|
|
88
|
+
...states
|
|
89
|
+
].map(([state, labels])=>{
|
|
90
|
+
const pageTitle = labels.length && (states.size > 1 || page.allLocales !== true) ? `${baseTitle}${placementLanguageSuffix({
|
|
91
|
+
locales: labels
|
|
92
|
+
})}` : title;
|
|
93
|
+
if (state === 'draft') return {
|
|
94
|
+
sentence: draftContentNext(label, pageTitle),
|
|
95
|
+
nextStep: C.publishPage
|
|
96
|
+
};
|
|
97
|
+
if (state === 'editor') return {
|
|
98
|
+
sentence: unsavedContentNext(label),
|
|
99
|
+
nextStep: C.saveAndPublishPage
|
|
100
|
+
};
|
|
101
|
+
if (state === 'partial') return {
|
|
102
|
+
sentence: partialContentNext(label, pageTitle)
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
sentence: contentNext(label, namedPages ? pageTitle : undefined)
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
if (!guidance.length) return [
|
|
111
|
+
{
|
|
112
|
+
sentence: C.addMissingVersionContent
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
return [
|
|
116
|
+
...new Map(guidance.map((item)=>[
|
|
117
|
+
item.sentence,
|
|
118
|
+
item
|
|
119
|
+
])).values()
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
/** Saved content guidance uses the same page refresh as the placement notice. */ export function editorContentNotice(preflight, ctx) {
|
|
123
|
+
const page = ctx.editorPage;
|
|
124
|
+
const detail = preflight?.checks.find((check)=>check.code === 'empty-slot' && !check.ok)?.detail;
|
|
125
|
+
if (!page || !Array.isArray(detail)) return;
|
|
126
|
+
return emptyContentGuidance(detail.filter((row)=>samePage(object(row), page)), ctx).find((item)=>item.nextStep)?.sentence;
|
|
127
|
+
}
|
|
128
|
+
/** Exhaustive mapping of the checkStart ReadinessCode union, including all ten invariant checks. */ export const READINESS = {
|
|
129
|
+
'make-content-unsupported': row('header', (detail)=>unsupportedContentCopy(text(detail, 'This page'))),
|
|
130
|
+
'goal-in-some-versions': {
|
|
131
|
+
...row('win', (detail)=>asymmetricGoalsCopy(detail)),
|
|
132
|
+
nextStep: 'Edit the versions'
|
|
133
|
+
},
|
|
134
|
+
'placement-unchecked': {
|
|
135
|
+
...row('versions', (detail)=>placementUncheckedCopy(text(object(detail).title ?? object(detail).path, 'This page'))),
|
|
136
|
+
nextStep: (detail)=>`Open ${text(object(detail).title ?? object(detail).path, 'the page')}`
|
|
137
|
+
},
|
|
138
|
+
'invalid-status': row('header', ()=>null),
|
|
139
|
+
'no-placements': row('what', (detail, ctx)=>ctx.editorPlacementMessage ?? (detail === undefined ? C.noPlacements : placementFailureCopy(detail))),
|
|
140
|
+
'placement-removed': row('what', ()=>C.placementRemoved),
|
|
141
|
+
'placement-unpublished': {
|
|
142
|
+
...row('versions', unpublishedPlacementsCopy),
|
|
143
|
+
nextStep: C.publishPage
|
|
144
|
+
},
|
|
145
|
+
'duplicate-version-row': {
|
|
146
|
+
...row('versions', (detail)=>detailRows(detail).map((value)=>duplicateVersionCopy(text(object(value).title, 'this page'))).join('\n')),
|
|
147
|
+
nextStep: (detail)=>detailRows(detail).map((value)=>`Edit ${text(object(value).title, 'this page')}`).join('\n')
|
|
148
|
+
},
|
|
149
|
+
'nested-tests': row('versions', (detail)=>nestedTestCopy.readiness(detail)),
|
|
150
|
+
'interacting-tests': {
|
|
151
|
+
...row('versions', (detail)=>interactingTestsCopy(text(first(detail).path, 'this page'), text(first(detail).status, 'running'), text(first(detail).name, 'another test'), first(detail).version === true)),
|
|
152
|
+
nextStep: (detail)=>`Open ${text(first(detail).name, 'the test')}${first(detail).version === true ? `\nEdit ${text(first(detail).path, 'this page')}` : ''}`
|
|
153
|
+
},
|
|
154
|
+
'empty-slot': {
|
|
155
|
+
...row('versions', (detail, ctx)=>emptyContentGuidance(detail, ctx).map((item)=>item.sentence).join('\n') || null),
|
|
156
|
+
nextStep: (detail, ctx)=>emptyContentGuidance(detail, ctx)[0]?.nextStep
|
|
157
|
+
},
|
|
158
|
+
'flag-no-point': row('what', ()=>C.noPoint),
|
|
159
|
+
'flag-params-invalid': row('versions', (detail, ctx)=>{
|
|
160
|
+
const issue = first(detail);
|
|
161
|
+
const point = ctx.flagPoints?.find((item)=>item.id === ctx.flagPoint);
|
|
162
|
+
const parameter = typeof issue.field === 'string' ? point?.params[issue.field]?.label ?? issue.field : C.parameterFallback;
|
|
163
|
+
return parameterNext(parameter, group(issue.arm, ctx));
|
|
164
|
+
}),
|
|
165
|
+
'flag-point-busy': row('what', ()=>C.busy),
|
|
166
|
+
'flag-placement-missing': row('versions', (detail, ctx)=>{
|
|
167
|
+
if (typeof detail === 'string') return placementFailureCopy(detail);
|
|
168
|
+
const value = object(detail);
|
|
169
|
+
const placement = first(value.placements);
|
|
170
|
+
const missing = Array.isArray(value.missing) ? value.missing[0] : undefined;
|
|
171
|
+
return placementNext(group(placement.arm ?? missing, ctx), detailText(typeof detail === 'string' ? detail : placement, ''));
|
|
172
|
+
}),
|
|
173
|
+
'no-primary-metric': row('win', ()=>C.noGoal),
|
|
174
|
+
'unknown-metric-source': row('win', ()=>C.unknownGoal),
|
|
175
|
+
'unit-source-mismatch': row('win', (_, ctx)=>goalPeopleNext(ctx.unitType === 'user' ? 'signed-in users' : 'visitors')),
|
|
176
|
+
'no-planned-duration': row('length', ()=>C.noDuration),
|
|
177
|
+
'no-reach-per-day': row('length', ()=>C.noReach),
|
|
178
|
+
'layer-full': row('versions', ()=>C.full),
|
|
179
|
+
'layer-unit-mismatch': row('header', ()=>C.differentPeople),
|
|
180
|
+
'page-in-use': {
|
|
181
|
+
...row('versions', (detail, ctx)=>{
|
|
182
|
+
const paths = object(detail).paths;
|
|
183
|
+
const path = text(Array.isArray(paths) ? paths[0] : undefined, 'this page');
|
|
184
|
+
return pageInUseCopy(path, pageArm(path, ctx)?.kind === 'variant');
|
|
185
|
+
}),
|
|
186
|
+
nextStep: C.choosePages
|
|
187
|
+
},
|
|
188
|
+
'page-no-targets': {
|
|
189
|
+
...row('versions', ()=>C.noTargets),
|
|
190
|
+
nextStep: 'Choose pages'
|
|
191
|
+
},
|
|
192
|
+
'unknown-collection': row('versions', ()=>"That page type isn't set up for tests."),
|
|
193
|
+
'version-identical': {
|
|
194
|
+
...row('versions', (detail, ctx)=>identicalVersionCopy(text(object(detail).path, object(detail).title ? `${group(object(detail).arm, ctx)} on ${text(object(detail).title, 'this page')}` : group(object(detail).arm, ctx)), group('control', ctx))),
|
|
195
|
+
nextStep: (detail, ctx)=>`Edit ${text(object(detail).path, group(object(detail).arm, ctx))}`
|
|
196
|
+
},
|
|
197
|
+
'version-same-address': {
|
|
198
|
+
...row('versions', (detail, ctx)=>sameAddressCopy(group(object(detail).arm, ctx), group(object(detail).otherArm, ctx), text(object(detail).path, 'this address'))),
|
|
199
|
+
nextStep: 'Choose pages'
|
|
200
|
+
},
|
|
201
|
+
'page-target-unpublished': {
|
|
202
|
+
...row('versions', (detail, ctx)=>{
|
|
203
|
+
const path = text(typeof detail === 'string' ? detail : object(detail).path, 'This page');
|
|
204
|
+
const arm = ctx.arms.find((item)=>item.key === object(detail).arm) ?? pageArm(path, ctx);
|
|
205
|
+
const placement = (arm ? ctx.pagePlacements?.find((entry)=>entry.arm === arm.key) : undefined) ?? ctx.pagePlacements?.find((entry)=>normalisePath(entry.path) === normalisePath(path));
|
|
206
|
+
return unpublishedPageCopy(path, ctx.pagePlacements && ctx.collectionLabel ? {
|
|
207
|
+
original: arm?.kind === 'control',
|
|
208
|
+
found: placement?.id != null && placement.published === false,
|
|
209
|
+
collection: ctx.collectionLabel
|
|
210
|
+
} : undefined);
|
|
211
|
+
}),
|
|
212
|
+
nextStep: C.choosePages
|
|
213
|
+
},
|
|
214
|
+
'page-targets-unchecked': row('versions', ()=>C.uncheckedPages),
|
|
215
|
+
'version-page-unavailable': row('versions', (detail)=>versionPageUnavailableCopy(text(detail, 'This page'))),
|
|
216
|
+
'version-page-unchecked': row('versions', (detail)=>versionPageUncheckedCopy(text(detail, 'This page'))),
|
|
217
|
+
'page-user-unit': row('header', ()=>C.pageVisitors),
|
|
218
|
+
'block-path-rule': {
|
|
219
|
+
...row('who', ()=>C.blockPathRule),
|
|
220
|
+
nextStep: C.removeRule
|
|
221
|
+
},
|
|
222
|
+
'invalid-targeting-rule': row('who', (detail)=>{
|
|
223
|
+
const attributes = object(detail).attributes;
|
|
224
|
+
return ruleNext(detailText(detail, Array.isArray(attributes) && attributes.length ? attributes.map(String).join(', ') : C.ruleFallback));
|
|
225
|
+
}),
|
|
226
|
+
'undeclared-targeting-key': row('who', (detail)=>{
|
|
227
|
+
const attributes = object(detail).attributes;
|
|
228
|
+
return attributeNext(text(Array.isArray(attributes) ? attributes[0] : object(detail).attribute, C.attributeFallback));
|
|
229
|
+
}),
|
|
230
|
+
'weights-total': versions,
|
|
231
|
+
'control-count': versions,
|
|
232
|
+
'control-first': versions,
|
|
233
|
+
'holdout-count': versions,
|
|
234
|
+
'holdout-last': versions,
|
|
235
|
+
'variant-count': versions,
|
|
236
|
+
'invalid-key': versions,
|
|
237
|
+
'duplicate-key': versions,
|
|
238
|
+
'slot-required': versions,
|
|
239
|
+
'duplicate-slot': versions
|
|
240
|
+
};
|
|
241
|
+
export function readinessCaveats({ doc, preflight, statusReadPending }, adminRoute) {
|
|
242
|
+
if (!doc || !preflight) return [];
|
|
243
|
+
const caveats = [];
|
|
244
|
+
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
245
|
+
if (setup) {
|
|
246
|
+
if (preflight.checks.some((check)=>check.code === 'page-targets-unchecked' && check.warning)) {
|
|
247
|
+
caveats.push({
|
|
248
|
+
key: 'page-targets-unchecked',
|
|
249
|
+
sentence: C.uncheckedPages
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (!statusReadPending && hasBrowserWritablePrimary(preflight, doc.metrics?.primary)) {
|
|
253
|
+
caveats.push({
|
|
254
|
+
key: 'browser-writable-primary',
|
|
255
|
+
sentence: METRICS_COPY.browserWritablePrimary,
|
|
256
|
+
emphasized: true
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
for (const [index, check] of preflight.checks.entries()){
|
|
261
|
+
if (!check.warning) continue;
|
|
262
|
+
const key = `${check.code}:${index}`;
|
|
263
|
+
if (check.code === 'placement-unchecked') {
|
|
264
|
+
const { title, href } = preflightPlacementLabel(check.detail, preflight, adminRoute);
|
|
265
|
+
caveats.push({
|
|
266
|
+
key,
|
|
267
|
+
sentence: placementUncheckedCopy(title),
|
|
268
|
+
href
|
|
269
|
+
});
|
|
270
|
+
} else if (check.code === 'goal-in-some-versions' || check.code === 'make-content-unsupported' || setup && check.code === 'version-identical') {
|
|
271
|
+
const sentence = READINESS[check.code].next(check.detail, doc);
|
|
272
|
+
if (sentence) caveats.push({
|
|
273
|
+
key,
|
|
274
|
+
sentence
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const [metricId, note] of new Map(preflight.goalNotes?.map((note)=>[
|
|
279
|
+
String(note.metricId),
|
|
280
|
+
note
|
|
281
|
+
]))){
|
|
282
|
+
caveats.push({
|
|
283
|
+
key: `goal-note:${metricId}`,
|
|
284
|
+
sentence: note.message,
|
|
285
|
+
emphasized: true
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return caveats;
|
|
289
|
+
}
|
|
290
|
+
export function blockingSteps(preflight, ctx) {
|
|
291
|
+
return [
|
|
292
|
+
'header',
|
|
293
|
+
...SECTION_ORDER
|
|
294
|
+
].flatMap((section)=>(preflight?.checks ?? []).flatMap((check)=>{
|
|
295
|
+
const mapping = Object.hasOwn(READINESS, check.code) ? READINESS[check.code] : undefined;
|
|
296
|
+
if (check.ok || (mapping?.section ?? 'what') !== section) return [];
|
|
297
|
+
const sentence = mapping ? mapping.next(check.detail, ctx) : SURFACE_COPY.next;
|
|
298
|
+
const arm = readinessArm(check.code, check.detail, ctx);
|
|
299
|
+
return sentence ? [
|
|
300
|
+
{
|
|
301
|
+
section,
|
|
302
|
+
sentence,
|
|
303
|
+
code: check.code,
|
|
304
|
+
...arm ? {
|
|
305
|
+
arm
|
|
306
|
+
} : {}
|
|
307
|
+
}
|
|
308
|
+
] : [];
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
export function nextStep(preflight, ctx) {
|
|
312
|
+
const next = blockingSteps(preflight, ctx)[0];
|
|
313
|
+
if (!next) return null;
|
|
314
|
+
const mapping = READINESS[next.code];
|
|
315
|
+
const detail = preflight?.checks.find((check)=>!check.ok && check.code === next.code)?.detail;
|
|
316
|
+
const action = mapping && (typeof mapping.nextStep === 'function' ? mapping.nextStep(detail, ctx) : mapping.nextStep);
|
|
317
|
+
return {
|
|
318
|
+
...next,
|
|
319
|
+
...action ? {
|
|
320
|
+
nextStep: action
|
|
321
|
+
} : {}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
export function errorSection(path) {
|
|
325
|
+
if ([
|
|
326
|
+
'name',
|
|
327
|
+
'hypothesis',
|
|
328
|
+
'flagPoint'
|
|
329
|
+
].some((field)=>path === field || path.startsWith(`${field}.`))) return 'what';
|
|
330
|
+
if (/^(arms|pageCollection|allocation)(\.|$)/.test(path)) return 'versions';
|
|
331
|
+
if (/^metrics(\.|$)/.test(path)) return 'win';
|
|
332
|
+
if (/^(targeting)(\.|$)/.test(path)) return 'who';
|
|
333
|
+
if (/^analysis\.(plannedDurationDays|reachPerDay)(\.|$)/.test(path)) return 'length';
|
|
334
|
+
if (/^(analysis|exposurePolicy|layer)(\.|$)/.test(path)) return 'advanced';
|
|
335
|
+
}
|
|
336
|
+
export function sectionBlocked(test, section) {
|
|
337
|
+
if (Object.keys(test.errors ?? {}).some((path)=>errorSection(path) === section)) return true;
|
|
338
|
+
return !!test.preflight?.checks.some((check)=>!check.ok && (Object.hasOwn(READINESS, check.code) ? READINESS[check.code].section : 'what') === section);
|
|
339
|
+
}
|
|
340
|
+
export function sectionDone(test) {
|
|
341
|
+
return Object.fromEntries(SECTION_ORDER.map((section)=>[
|
|
342
|
+
section,
|
|
343
|
+
section === 'who' && test.doc && !test.doc.targeting?.length ? false : test.preflight ? !test.preflight.checks.some((check)=>!check.ok && (Object.hasOwn(READINESS, check.code) ? READINESS[check.code].section : SECTION_ORDER[0]) === section) : section === 'advanced'
|
|
344
|
+
]));
|
|
345
|
+
}
|
|
346
|
+
export function displayDate(value) {
|
|
347
|
+
if (typeof value !== 'string' || !Number.isFinite(Date.parse(value))) return null;
|
|
348
|
+
return formatDate(value);
|
|
349
|
+
}
|
|
350
|
+
export function daysRemaining(doc, now) {
|
|
351
|
+
const days = doc.analysis?.plannedDurationDays;
|
|
352
|
+
const start = typeof doc.startedAt === 'string' ? Date.parse(doc.startedAt) : NaN;
|
|
353
|
+
return typeof days === 'number' && days > 0 && Number.isFinite(start) ? Math.max(0, Math.ceil(days - (now - start) / 86_400_000)) : null;
|
|
354
|
+
}
|
|
355
|
+
function pageArm(path, ctx) {
|
|
356
|
+
return ctx.arms.find((arm)=>arm.pageTarget && normalisePath(arm.pageTarget) === normalisePath(path));
|
|
357
|
+
}
|
|
358
|
+
export function pageReadinessContext(doc, preflight, surface) {
|
|
359
|
+
return {
|
|
360
|
+
...doc,
|
|
361
|
+
editorPage: surface.editorPage,
|
|
362
|
+
editorPlacementMessage: surface.editorPlacementMessage,
|
|
363
|
+
contentLocales: preflight?.contentLocales,
|
|
364
|
+
placements: preflight?.placements,
|
|
365
|
+
flagPoints: surface.flagPoints,
|
|
366
|
+
pagePlacements: preflight?.pagePlacements,
|
|
367
|
+
collectionLabel: testPageCollection(surface.pageCollections, doc, preflight?.pagePlacements)?.label
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
/** First affected row in arm order; shared by the wizard and the test-page jump. */ export function readinessArm(code, detail, ctx) {
|
|
371
|
+
if (code === 'version-same-address') return ctx.arms.find((arm)=>arm.key === object(detail).arm)?.key;
|
|
372
|
+
if (code === 'page-no-targets') return ctx.arms.find((arm)=>arm.kind !== 'holdout' && !arm.pageTarget)?.key;
|
|
373
|
+
const paths = code === 'page-in-use' ? object(detail).paths : code === 'page-target-unpublished' ? [
|
|
374
|
+
detail
|
|
375
|
+
] : [];
|
|
376
|
+
return ctx.arms.find((arm)=>arm.kind !== 'holdout' && arm.pageTarget && Array.isArray(paths) && paths.some((path)=>typeof path === 'string' && normalisePath(path) === normalisePath(arm.pageTarget)))?.key;
|
|
377
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiResult } from '../../api.js';
|
|
2
|
+
import type { ActionTestApi } from '../contracts.js';
|
|
3
|
+
import type { SurfaceProps } from '../contracts.js';
|
|
4
|
+
import type { ActionId } from '../../actions/actions.model.js';
|
|
5
|
+
/** The ref closes the gap before React renders the disabled button. */
|
|
6
|
+
export declare function useTransition(test: ActionTestApi, onSuccess?: () => void, surface?: SurfaceProps, keepRefusal?: boolean): {
|
|
7
|
+
busy: boolean;
|
|
8
|
+
checking: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
run: (kind: ActionId | "restart", request: () => Promise<ApiResult<unknown>>, { closeOnSuccess }?: {
|
|
11
|
+
closeOnSuccess?: boolean | undefined;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
clearError: () => void;
|
|
14
|
+
reloadRequired: boolean;
|
|
15
|
+
refreshAfterDismissal: () => void;
|
|
16
|
+
};
|