@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,372 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { canStartTest, readyToStart } from '../../readinessRead.js';
|
|
4
|
+
import { DocsResponseError, fetchAllDocs } from '../../../lib/fetchAllDocs.js';
|
|
5
|
+
import { usePlacementLabels, placementDetailKey } from '../../placements/usePlacementLabels.js';
|
|
6
|
+
import { placementUncheckedCopy } from '../../copy/readiness.js';
|
|
7
|
+
import { useEffect, useId, useState } from 'react';
|
|
8
|
+
import { TextInput, Select } from '../../../ui/Inputs.js';
|
|
9
|
+
import { ConfirmDialog } from '../../../ui/Dialog.js';
|
|
10
|
+
import { isDestructiveAction } from '../../actions/actions.model.js';
|
|
11
|
+
import { MakeContentResult } from '../../actions/MakeContentResult.js';
|
|
12
|
+
import { expectedConfirm, matchesConfirm } from '../../../transitions/confirmPhrases.js';
|
|
13
|
+
import { ACTIONS_COPY as A, actionTitle, addMetricWarningCopy } from '../../copy/actions.js';
|
|
14
|
+
import { REVIEW_COPY as R } from '../../copy/review.js';
|
|
15
|
+
import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
16
|
+
import { API_MESSAGES, refusalMessage } from '../../copy/common.js';
|
|
17
|
+
import { createApi } from '../../api.js';
|
|
18
|
+
import { blockingSteps, pageReadinessContext, readinessCaveats } from './readiness.model.js';
|
|
19
|
+
import { actionWaitMessage } from './SaveStatus.js';
|
|
20
|
+
import { surfaceUrls } from '../../surfaceUrls.js';
|
|
21
|
+
import { Button } from '../../../ui/Button.js';
|
|
22
|
+
import { useTransition } from './useTransition.js';
|
|
23
|
+
export function dialogTitle(label, test) {
|
|
24
|
+
return test.doc?.name ? actionTitle(label, test.doc.name) : label;
|
|
25
|
+
}
|
|
26
|
+
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */ export function ConfirmAction({ test, surface, action, winnerLabel, onClose, onSuccess }) {
|
|
27
|
+
const api = createApi(surface.apiRoute);
|
|
28
|
+
const [openedPhase] = useState(test.doc?.phase);
|
|
29
|
+
const [openedStatus] = useState(test.doc?.status);
|
|
30
|
+
const confirmationId = useId();
|
|
31
|
+
const [typed, setTyped] = useState('');
|
|
32
|
+
const [content, setContent] = useState(null);
|
|
33
|
+
const [reportBusy, setReportBusy] = useState(false);
|
|
34
|
+
const transition = useTransition(test, ()=>{
|
|
35
|
+
onClose();
|
|
36
|
+
onSuccess?.();
|
|
37
|
+
}, surface, true);
|
|
38
|
+
const changed = test.doc?.phase !== openedPhase || test.doc?.status !== openedStatus;
|
|
39
|
+
const wait = action.id === 'start' ? actionWaitMessage(test) : undefined;
|
|
40
|
+
const phrase = action.confirm.phrase ? expectedConfirm(action.confirm.phrase.action, winnerLabel) : null;
|
|
41
|
+
const ready = action.id !== 'start' || !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
42
|
+
const blocker = action.id === 'start' && !readyToStart(test, surface.editorPlacementMessage) ? test.preflightError ?? (test.doc ? blockingSteps(test.preflight, pageReadinessContext(test.doc, test.preflight, surface))[0]?.sentence : undefined) ?? C.checking : undefined;
|
|
43
|
+
const startMessage = wait ?? blocker;
|
|
44
|
+
const enabled = surface.canManage && !changed && ready && !test.statusReadPending && !transition.busy && !transition.reloadRequired && !wait && (!phrase || matchesConfirm(phrase, typed));
|
|
45
|
+
async function submit(finish = false) {
|
|
46
|
+
if (!enabled || !test.doc) return;
|
|
47
|
+
const { id } = test.doc;
|
|
48
|
+
const phase = openedPhase;
|
|
49
|
+
await transition.run(finish ? 'archive' : action.id === 'start' && test.doc.status === 'stopped' ? 'restart' : action.id, async ()=>{
|
|
50
|
+
if (finish) return api.archive(id, {
|
|
51
|
+
mode: 'after-content',
|
|
52
|
+
phase
|
|
53
|
+
});
|
|
54
|
+
if (action.archive) return api.archive(id, {
|
|
55
|
+
...action.archive,
|
|
56
|
+
phase,
|
|
57
|
+
...phrase ? {
|
|
58
|
+
confirmation: typed.trim()
|
|
59
|
+
} : {}
|
|
60
|
+
});
|
|
61
|
+
if (action.id === 'start') return api.start(id, openedPhase);
|
|
62
|
+
if (action.id === 'stop') return api.stop(id, openedPhase);
|
|
63
|
+
if (action.id === 'release-holdout') return api.releaseHoldout(id, phase);
|
|
64
|
+
const result = await api.makeContent(id, phase);
|
|
65
|
+
if (result.ok && result.data) {
|
|
66
|
+
setContent(result.data);
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
if (result.ok) {
|
|
70
|
+
test.acceptTransition?.(undefined);
|
|
71
|
+
await test.reload();
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
status: 0,
|
|
75
|
+
retryable: true,
|
|
76
|
+
message: API_MESSAGES.unreadable
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}, {
|
|
81
|
+
closeOnSuccess: finish || action.id !== 'make-content'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function close() {
|
|
85
|
+
if (transition.busy || reportBusy) return;
|
|
86
|
+
onClose();
|
|
87
|
+
transition.refreshAfterDismissal();
|
|
88
|
+
}
|
|
89
|
+
const label = action.confirm.label ?? action.label;
|
|
90
|
+
const caveats = action.id === 'start' ? readinessCaveats(test, surface.adminRoute) : [];
|
|
91
|
+
const description = caveats.length ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ _jsx("p", {
|
|
94
|
+
children: action.confirm.body
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsx("ul", {
|
|
97
|
+
children: caveats.map(({ key, sentence, href })=>/*#__PURE__*/ _jsx("li", {
|
|
98
|
+
children: href && !transition.busy ? /*#__PURE__*/ _jsx("a", {
|
|
99
|
+
href: href,
|
|
100
|
+
children: sentence
|
|
101
|
+
}) : sentence
|
|
102
|
+
}, key))
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
}) : action.confirm.body;
|
|
106
|
+
return /*#__PURE__*/ _jsxs(ConfirmDialog, {
|
|
107
|
+
title: action.confirm.title === label ? dialogTitle(label, test) : action.confirm.title,
|
|
108
|
+
onClose: close,
|
|
109
|
+
description: content ? undefined : description,
|
|
110
|
+
busy: transition.busy || reportBusy,
|
|
111
|
+
busyLabel: C.changing,
|
|
112
|
+
cancelLabel: content ? A.done : A.cancel,
|
|
113
|
+
error: transition.error ?? (changed && !transition.busy && !content ? A.actionChanged : null),
|
|
114
|
+
confirm: content ? undefined : {
|
|
115
|
+
label,
|
|
116
|
+
disabled: !enabled,
|
|
117
|
+
destructive: isDestructiveAction(action.id),
|
|
118
|
+
onClick: ()=>submit()
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
content ? /*#__PURE__*/ _jsx(MakeContentResult, {
|
|
122
|
+
result: content,
|
|
123
|
+
id: test.doc?.id,
|
|
124
|
+
api: api,
|
|
125
|
+
canManage: surface.canManage,
|
|
126
|
+
isDecided: (content.doc?.status ?? test.doc?.status) === 'decided',
|
|
127
|
+
onRetry: ()=>submit(),
|
|
128
|
+
onFinish: ()=>submit(true),
|
|
129
|
+
busy: transition.busy || test.statusReadPending,
|
|
130
|
+
onBusyChange: setReportBusy,
|
|
131
|
+
onActionStart: transition.clearError,
|
|
132
|
+
onDocumentChange: async (result)=>{
|
|
133
|
+
if (result.ok) test.acceptTransition?.(result.data);
|
|
134
|
+
await test.reload();
|
|
135
|
+
}
|
|
136
|
+
}) : /*#__PURE__*/ _jsx(_Fragment, {
|
|
137
|
+
children: phrase ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
138
|
+
children: [
|
|
139
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
140
|
+
children: [
|
|
141
|
+
A.typePhrase,
|
|
142
|
+
" ",
|
|
143
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
144
|
+
children: phrase
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
149
|
+
id: confirmationId,
|
|
150
|
+
label: A.confirmation,
|
|
151
|
+
value: typed,
|
|
152
|
+
readOnly: transition.busy,
|
|
153
|
+
onChange: (event)=>setTyped(event.target.value)
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
}) : null
|
|
157
|
+
}),
|
|
158
|
+
!content && startMessage && startMessage !== transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
159
|
+
children: startMessage
|
|
160
|
+
}) : null
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** AllocateDialog's validation and copy, with data supplied by the test document. */ export function AllocateAction({ test, surface, onClose }) {
|
|
165
|
+
const current = test.doc?.allocation ?? 100;
|
|
166
|
+
const [openedPhase] = useState(test.doc?.phase);
|
|
167
|
+
const [value, setValue] = useState(String(Math.min(100, current + 1)));
|
|
168
|
+
const transition = useTransition(test, onClose, surface, true);
|
|
169
|
+
const allocation = Number(value);
|
|
170
|
+
const valid = value.trim() !== '' && Number.isInteger(allocation) && allocation > current && allocation <= 100;
|
|
171
|
+
const changed = test.doc?.status !== 'running' || test.doc?.phase !== openedPhase;
|
|
172
|
+
const disabled = transition.busy || test.statusReadPending || changed || transition.reloadRequired;
|
|
173
|
+
return /*#__PURE__*/ _jsxs(ConfirmDialog, {
|
|
174
|
+
title: dialogTitle(A.titleLead.allocate, test),
|
|
175
|
+
description: R.allocationBody,
|
|
176
|
+
onClose: ()=>{
|
|
177
|
+
onClose();
|
|
178
|
+
transition.refreshAfterDismissal();
|
|
179
|
+
},
|
|
180
|
+
busy: transition.busy,
|
|
181
|
+
busyLabel: C.changing,
|
|
182
|
+
cancelLabel: A.cancel,
|
|
183
|
+
error: transition.error ?? (changed && !transition.busy ? A.actionChanged : null),
|
|
184
|
+
confirm: {
|
|
185
|
+
label: C.allocate,
|
|
186
|
+
disabled: disabled || !valid,
|
|
187
|
+
onClick: ()=>{
|
|
188
|
+
if (valid && test.doc) return transition.run('allocate', ()=>createApi(surface.apiRoute).allocate(test.doc.id, {
|
|
189
|
+
allocation,
|
|
190
|
+
phase: openedPhase
|
|
191
|
+
}, {
|
|
192
|
+
notFound: API_MESSAGES.roundChanged
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
children: [
|
|
197
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
198
|
+
children: [
|
|
199
|
+
C.participation,
|
|
200
|
+
/*#__PURE__*/ _jsx("input", {
|
|
201
|
+
type: "number",
|
|
202
|
+
min: current + 1,
|
|
203
|
+
max: 100,
|
|
204
|
+
step: 1,
|
|
205
|
+
value: value,
|
|
206
|
+
disabled: disabled,
|
|
207
|
+
onChange: (event)=>setValue(event.target.value)
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
!valid ? /*#__PURE__*/ _jsx("p", {
|
|
212
|
+
children: R.allocationInvalid
|
|
213
|
+
}) : null
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/** AddMetricDialog adapter; the current round’s main goal is fixed. */ export function AddMetricAction({ test, surface, onClose }) {
|
|
218
|
+
const [openedPhase] = useState(test.doc?.phase);
|
|
219
|
+
const [metrics, setMetrics] = useState([]);
|
|
220
|
+
const [loading, setLoading] = useState(true);
|
|
221
|
+
const [loadError, setLoadError] = useState(null);
|
|
222
|
+
const [metric, setMetric] = useState('');
|
|
223
|
+
const [warnings, setWarnings] = useState(null);
|
|
224
|
+
const placementLabels = usePlacementLabels({
|
|
225
|
+
details: (warnings ?? []).filter((warning)=>warning.code === 'placement-unchecked').map((warning)=>warning.detail),
|
|
226
|
+
preflight: test.preflight,
|
|
227
|
+
...surface
|
|
228
|
+
});
|
|
229
|
+
const [role, setRole] = useState('secondary');
|
|
230
|
+
const transition = useTransition(test, onClose, surface, true);
|
|
231
|
+
useEffect(()=>{
|
|
232
|
+
const controller = new AbortController();
|
|
233
|
+
void (async ()=>{
|
|
234
|
+
try {
|
|
235
|
+
const response = await fetchAllDocs(`${surface.apiRoute.replace(/\/$/, '')}/xp-metrics?depth=0`, {
|
|
236
|
+
credentials: 'include',
|
|
237
|
+
signal: controller.signal
|
|
238
|
+
});
|
|
239
|
+
if (!response.ok) throw new Error(refusalMessage(undefined, response.status));
|
|
240
|
+
if (!controller.signal.aborted) setMetrics(response.docs);
|
|
241
|
+
} catch (cause) {
|
|
242
|
+
if (!controller.signal.aborted) setLoadError(cause instanceof DocsResponseError ? API_MESSAGES.unreadable : cause instanceof Error ? cause.message : API_MESSAGES.network);
|
|
243
|
+
} finally{
|
|
244
|
+
if (!controller.signal.aborted) setLoading(false);
|
|
245
|
+
}
|
|
246
|
+
})();
|
|
247
|
+
return ()=>controller.abort();
|
|
248
|
+
}, [
|
|
249
|
+
surface.apiRoute
|
|
250
|
+
]);
|
|
251
|
+
const attached = new Set([
|
|
252
|
+
test.doc?.metrics?.primary,
|
|
253
|
+
...test.doc?.metrics?.secondary ?? [],
|
|
254
|
+
...test.doc?.metrics?.guardrails ?? []
|
|
255
|
+
].filter((id)=>id != null).map(String));
|
|
256
|
+
const available = metrics.filter((item)=>!attached.has(String(item.id)));
|
|
257
|
+
const empty = !loading && !loadError && !available.length;
|
|
258
|
+
const selected = available.find((item)=>String(item.id) === metric);
|
|
259
|
+
const changed = test.doc?.status !== 'running' || test.doc?.phase !== openedPhase;
|
|
260
|
+
const disabled = transition.busy || test.statusReadPending || changed || transition.reloadRequired && transition.error !== API_MESSAGES.goalNotFound;
|
|
261
|
+
function close() {
|
|
262
|
+
if (transition.busy) return;
|
|
263
|
+
onClose();
|
|
264
|
+
transition.refreshAfterDismissal();
|
|
265
|
+
}
|
|
266
|
+
return /*#__PURE__*/ _jsx(ConfirmDialog, {
|
|
267
|
+
title: C.addGoal,
|
|
268
|
+
description: warnings || empty ? undefined : C.addMetric,
|
|
269
|
+
onClose: close,
|
|
270
|
+
busy: transition.busy,
|
|
271
|
+
busyLabel: C.changing,
|
|
272
|
+
cancelLabel: warnings ? A.done : A.cancel,
|
|
273
|
+
error: warnings ? undefined : loadError ?? transition.error ?? (changed ? A.actionChanged : null),
|
|
274
|
+
confirm: warnings || empty ? undefined : {
|
|
275
|
+
label: C.addGoal,
|
|
276
|
+
disabled: disabled || loading || !!loadError || !selected,
|
|
277
|
+
onClick: ()=>{
|
|
278
|
+
// Goal and phase lookups share not-found; prefer the more likely missing goal without reading server text.
|
|
279
|
+
if (selected && test.doc) return transition.run('add-metric', async ()=>{
|
|
280
|
+
const result = await createApi(surface.apiRoute).addMetric(test.doc.id, {
|
|
281
|
+
metric: selected.id,
|
|
282
|
+
role,
|
|
283
|
+
phase: openedPhase
|
|
284
|
+
}, {
|
|
285
|
+
notFound: API_MESSAGES.goalNotFound
|
|
286
|
+
});
|
|
287
|
+
if (result.ok) {
|
|
288
|
+
if (result.data?.warnings?.length) setWarnings(result.data.warnings);
|
|
289
|
+
else onClose();
|
|
290
|
+
}
|
|
291
|
+
return result;
|
|
292
|
+
}, {
|
|
293
|
+
closeOnSuccess: false
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
children: warnings ? warnings.map((warning, index)=>{
|
|
298
|
+
const placement = warning.code === 'placement-unchecked' ? placementLabels.get(placementDetailKey(warning.detail)) : undefined;
|
|
299
|
+
return /*#__PURE__*/ _jsx("p", {
|
|
300
|
+
children: placement ? placement.href ? /*#__PURE__*/ _jsx("a", {
|
|
301
|
+
href: placement.href,
|
|
302
|
+
children: placementUncheckedCopy(placement.title)
|
|
303
|
+
}) : placementUncheckedCopy(placement.title) : addMetricWarningCopy(warning)
|
|
304
|
+
}, index);
|
|
305
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
306
|
+
children: [
|
|
307
|
+
loading ? /*#__PURE__*/ _jsx("p", {
|
|
308
|
+
role: "status",
|
|
309
|
+
children: R.loadingMetrics
|
|
310
|
+
}) : null,
|
|
311
|
+
empty ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
312
|
+
children: [
|
|
313
|
+
/*#__PURE__*/ _jsx("p", {
|
|
314
|
+
children: metrics.length ? R.allMetricsAttached : R.noMetrics
|
|
315
|
+
}),
|
|
316
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
317
|
+
href: surfaceUrls.newGoal(surface.adminRoute, {
|
|
318
|
+
return: test.doc ? String(test.doc.id) : undefined
|
|
319
|
+
}),
|
|
320
|
+
children: R.createGoal
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
324
|
+
children: [
|
|
325
|
+
/*#__PURE__*/ _jsxs(Select, {
|
|
326
|
+
id: "xp-add-goal-metric",
|
|
327
|
+
label: R.metric,
|
|
328
|
+
value: metric,
|
|
329
|
+
disabled: disabled || loading,
|
|
330
|
+
onChange: (event)=>setMetric(event.target.value),
|
|
331
|
+
children: [
|
|
332
|
+
/*#__PURE__*/ _jsx("option", {
|
|
333
|
+
value: "",
|
|
334
|
+
children: R.chooseMetric
|
|
335
|
+
}),
|
|
336
|
+
available.map((item)=>/*#__PURE__*/ _jsx("option", {
|
|
337
|
+
value: String(item.id),
|
|
338
|
+
children: item.name
|
|
339
|
+
}, item.id))
|
|
340
|
+
]
|
|
341
|
+
}),
|
|
342
|
+
/*#__PURE__*/ _jsxs(Select, {
|
|
343
|
+
id: "xp-add-goal-role",
|
|
344
|
+
label: R.role,
|
|
345
|
+
value: role,
|
|
346
|
+
disabled: disabled,
|
|
347
|
+
onChange: (event)=>setRole(event.target.value),
|
|
348
|
+
children: [
|
|
349
|
+
/*#__PURE__*/ _jsx("option", {
|
|
350
|
+
value: "primary",
|
|
351
|
+
disabled: true,
|
|
352
|
+
children: R.primary
|
|
353
|
+
}),
|
|
354
|
+
/*#__PURE__*/ _jsx("option", {
|
|
355
|
+
value: "secondary",
|
|
356
|
+
children: R.supporting
|
|
357
|
+
}),
|
|
358
|
+
/*#__PURE__*/ _jsx("option", {
|
|
359
|
+
value: "guardrail",
|
|
360
|
+
children: R.guardrail
|
|
361
|
+
})
|
|
362
|
+
]
|
|
363
|
+
})
|
|
364
|
+
]
|
|
365
|
+
}),
|
|
366
|
+
!loading && !loadError && available.length > 0 && !selected ? /*#__PURE__*/ _jsx("p", {
|
|
367
|
+
children: C.chooseGoalToAdd
|
|
368
|
+
}) : null
|
|
369
|
+
]
|
|
370
|
+
})
|
|
371
|
+
});
|
|
372
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
1
2
|
import type { SectionProps } from '../contracts.js';
|
|
2
|
-
export declare function
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export declare function ReadinessContent({ test, surface, resultsVersion, embedded, barRef }: SectionProps & {
|
|
4
|
+
embedded?: boolean;
|
|
5
|
+
barRef?: Ref<HTMLDivElement>;
|
|
5
6
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { canStartTest, readyToStart } from '../../readinessRead.js';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { Button } from '../../../ui/Button.js';
|
|
6
|
+
import { actionWaitMessage, SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
7
|
+
import { jumpToSection } from '../test/jumpToSection.js';
|
|
8
|
+
import { actionGroupLabel, availableActions } from '../../actions/actions.model.js';
|
|
9
|
+
import { createApi } from '../../api.js';
|
|
10
|
+
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
11
|
+
import { READINESS_COPY as C, decidedCopy, fixFieldsNext, runningCopy, stoppedCopy } from '../../copy/readiness.js';
|
|
12
|
+
import { daysRemaining, displayDate, blockingSteps, pageReadinessContext, errorSection, readinessCaveats } from './readiness.model.js';
|
|
13
|
+
import { LifecycleButton, LifecycleDialog } from '../../actions/LifecycleAction.js';
|
|
14
|
+
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
15
|
+
import { BlockerList } from './BlockerList.js';
|
|
16
|
+
export function ReadinessContent({ test, surface, resultsVersion, embedded = false, barRef }) {
|
|
17
|
+
const [selected, setSelected] = useState(null);
|
|
18
|
+
const [audience, setAudience] = useState();
|
|
19
|
+
const doc = test.doc;
|
|
20
|
+
const people = audience?.phase === doc.phase ? audience?.people ?? null : null;
|
|
21
|
+
useEffect(()=>{
|
|
22
|
+
let active = true;
|
|
23
|
+
// Refreshes retain the last count for this round while loading.
|
|
24
|
+
if (surface.canReadResults && doc.status === 'running') {
|
|
25
|
+
void Promise.resolve().then(()=>active ? createApi(surface.apiRoute).summary([
|
|
26
|
+
doc.id
|
|
27
|
+
]) : undefined).then((result)=>{
|
|
28
|
+
if (!result?.ok) return;
|
|
29
|
+
const count = result.data?.[doc.id]?.exposures;
|
|
30
|
+
if (active && typeof count === 'number' && Number.isFinite(count)) setAudience({
|
|
31
|
+
phase: doc.phase,
|
|
32
|
+
people: count
|
|
33
|
+
});
|
|
34
|
+
}).catch(()=>{});
|
|
35
|
+
}
|
|
36
|
+
return ()=>{
|
|
37
|
+
active = false;
|
|
38
|
+
};
|
|
39
|
+
}, [
|
|
40
|
+
doc.id,
|
|
41
|
+
doc.status,
|
|
42
|
+
doc.phase,
|
|
43
|
+
surface.apiRoute,
|
|
44
|
+
surface.canReadResults,
|
|
45
|
+
resultsVersion
|
|
46
|
+
]);
|
|
47
|
+
const decision = doc.decision;
|
|
48
|
+
const winner = actionGroupLabel(decision?.winnerArm ?? 'control', doc.arms.find((item)=>item.key === decision?.winnerArm)?.label);
|
|
49
|
+
const labelledPreflight = test.preflight ? {
|
|
50
|
+
...test.preflight,
|
|
51
|
+
checks: test.preflight.checks.map((check)=>check.code === 'placement-unchecked' ? {
|
|
52
|
+
...check,
|
|
53
|
+
detail: {
|
|
54
|
+
...check.detail,
|
|
55
|
+
title: preflightPlacementLabel(check.detail, test.preflight, surface.adminRoute).title
|
|
56
|
+
}
|
|
57
|
+
} : check)
|
|
58
|
+
} : null;
|
|
59
|
+
const readinessBlockers = blockingSteps(labelledPreflight, pageReadinessContext(doc, test.preflight, surface));
|
|
60
|
+
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
61
|
+
const ready = readyToStart(test, surface.editorPlacementMessage);
|
|
62
|
+
const startEnabled = canStartTest(test, surface.editorPlacementMessage);
|
|
63
|
+
const wait = setup ? actionWaitMessage(test) : undefined;
|
|
64
|
+
const blockers = [
|
|
65
|
+
...readinessBlockers
|
|
66
|
+
];
|
|
67
|
+
if (wait && !test.stale) blockers.unshift({
|
|
68
|
+
section: 'header',
|
|
69
|
+
sentence: wait,
|
|
70
|
+
code: 'unsaved'
|
|
71
|
+
});
|
|
72
|
+
else if (!test.preflight && !test.preflightError) blockers.unshift({
|
|
73
|
+
section: 'header',
|
|
74
|
+
sentence: C.checking,
|
|
75
|
+
code: 'checking'
|
|
76
|
+
});
|
|
77
|
+
const errorSections = [
|
|
78
|
+
...new Set(Object.keys(test.errors).filter((path)=>path !== '_section').map((path)=>errorSection(path) ?? 'what'))
|
|
79
|
+
];
|
|
80
|
+
for (const section of errorSections.reverse())blockers.unshift({
|
|
81
|
+
section,
|
|
82
|
+
sentence: test.stale ? C.reloadFirst : fixFieldsNext(TEST_PAGE.sections[section]),
|
|
83
|
+
code: `validation:${section}`
|
|
84
|
+
});
|
|
85
|
+
if (test.errors._section || test.stale) blockers.unshift({
|
|
86
|
+
section: 'what',
|
|
87
|
+
sentence: test.stale ? C.reloadFirst : C.reloadAfterError,
|
|
88
|
+
code: 'save-error'
|
|
89
|
+
});
|
|
90
|
+
const startReason = wait ?? blockers[0]?.sentence ?? test.preflightError ?? (!ready ? C.checking : undefined);
|
|
91
|
+
const actions = availableActions({
|
|
92
|
+
...doc,
|
|
93
|
+
decision,
|
|
94
|
+
canManage: surface.canManage,
|
|
95
|
+
canReadResults: surface.canReadResults
|
|
96
|
+
}).filter((action)=>action.id !== 'delete' && (!embedded || ![
|
|
97
|
+
'decide',
|
|
98
|
+
'release-pages'
|
|
99
|
+
].includes(action.id)));
|
|
100
|
+
const sentence = test.statusReadPending ? C.checking : setup ? ready && !blockers.length ? C.ready : null : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
|
|
101
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ _jsx("div", {
|
|
104
|
+
ref: barRef,
|
|
105
|
+
className: "xp-test-readiness-bar",
|
|
106
|
+
role: "region",
|
|
107
|
+
"aria-label": C.label,
|
|
108
|
+
"data-dialog-background": true,
|
|
109
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
110
|
+
className: `xp-readiness xp-readiness--${setup && ready && !blockers.length ? 'ready' : 'neutral'} xp-readiness--bar xp-tests-container`,
|
|
111
|
+
children: [
|
|
112
|
+
readinessCaveats(test, surface.adminRoute).map(({ key, sentence, href, emphasized })=>/*#__PURE__*/ _jsxs("p", {
|
|
113
|
+
className: emphasized ? 'xp-readiness__warning' : undefined,
|
|
114
|
+
children: [
|
|
115
|
+
emphasized ? /*#__PURE__*/ _jsx("span", {
|
|
116
|
+
"aria-hidden": "true",
|
|
117
|
+
children: "⚠ "
|
|
118
|
+
}) : null,
|
|
119
|
+
href ? /*#__PURE__*/ _jsx("a", {
|
|
120
|
+
href: href,
|
|
121
|
+
children: sentence
|
|
122
|
+
}) : sentence
|
|
123
|
+
]
|
|
124
|
+
}, key)),
|
|
125
|
+
!test.statusReadPending && doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
126
|
+
children: stoppedCopy(displayDate(doc.stoppedAt))
|
|
127
|
+
}) : null,
|
|
128
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
129
|
+
className: "xp-readiness__state",
|
|
130
|
+
children: [
|
|
131
|
+
/*#__PURE__*/ _jsx(SaveStatus, {
|
|
132
|
+
test: test,
|
|
133
|
+
messageInBlockerList: setup && !!test.preflight && !test.preflightError
|
|
134
|
+
}),
|
|
135
|
+
sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
|
|
136
|
+
className: "xp-readiness__separator",
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
children: "·"
|
|
139
|
+
}) : null,
|
|
140
|
+
sentence ? /*#__PURE__*/ _jsx("p", {
|
|
141
|
+
role: "status",
|
|
142
|
+
children: sentence
|
|
143
|
+
}) : null,
|
|
144
|
+
setup ? /*#__PURE__*/ _jsx(BlockerList, {
|
|
145
|
+
steps: blockers,
|
|
146
|
+
renderSentence: (_, index)=>{
|
|
147
|
+
const step = blockers[index];
|
|
148
|
+
return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
|
|
149
|
+
href: `#section-${step.section}`,
|
|
150
|
+
onClick: (event)=>{
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
if (step.section !== 'header') jumpToSection(step.section, step.arm);
|
|
153
|
+
},
|
|
154
|
+
children: step.sentence
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}) : null
|
|
158
|
+
]
|
|
159
|
+
}),
|
|
160
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
161
|
+
className: "xp-readiness__actions",
|
|
162
|
+
children: [
|
|
163
|
+
setup && readinessBlockers.length > 0 && !test.preflightRead?.message && !test.statusReadPending ? /*#__PURE__*/ _jsx(Button, {
|
|
164
|
+
variant: "quiet",
|
|
165
|
+
disabled: test.preflightPending || !!selected,
|
|
166
|
+
onClick: ()=>{
|
|
167
|
+
void test.refreshPreflight(true);
|
|
168
|
+
},
|
|
169
|
+
children: C.refresh
|
|
170
|
+
}) : null,
|
|
171
|
+
actions.map((item)=>{
|
|
172
|
+
if (test.statusReadPending) return null;
|
|
173
|
+
const reason = item.id === 'start' ? startReason : item.unavailable;
|
|
174
|
+
return /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
175
|
+
action: embedded && item.hint ? {
|
|
176
|
+
...item,
|
|
177
|
+
hint: undefined
|
|
178
|
+
} : item,
|
|
179
|
+
reason: reason,
|
|
180
|
+
showReason: item.id !== 'start',
|
|
181
|
+
disabled: item.id === 'start' && !startEnabled,
|
|
182
|
+
onClick: ()=>setSelected(item)
|
|
183
|
+
}, item.id);
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
selected ? /*#__PURE__*/ _jsx(LifecycleDialog, {
|
|
191
|
+
test: test,
|
|
192
|
+
surface: surface,
|
|
193
|
+
action: selected,
|
|
194
|
+
onClose: ()=>setSelected(null)
|
|
195
|
+
}) : null
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../../../ui/ui.css';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
/** The footer and sidebar show the same bounded list, including other pages. */
|
|
4
|
+
export declare function BlockerList({ steps, renderSentence }: {
|
|
5
|
+
steps: readonly {
|
|
6
|
+
sentence: string;
|
|
7
|
+
}[];
|
|
8
|
+
renderSentence?: (step: {
|
|
9
|
+
sentence: string;
|
|
10
|
+
}, index: number) => ReactNode;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import '../../../ui/ui.css';
|
|
4
|
+
import { READINESS_COPY, moreBlockers } from '../../copy/readiness.js';
|
|
5
|
+
/** The footer and sidebar show the same bounded list, including other pages. */ export function BlockerList({ steps, renderSentence = (step)=>step.sentence }) {
|
|
6
|
+
return steps.length ? /*#__PURE__*/ _jsxs("div", {
|
|
7
|
+
className: "xp-readiness__blockers",
|
|
8
|
+
role: "status",
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
11
|
+
children: READINESS_COPY.beforeStart
|
|
12
|
+
}),
|
|
13
|
+
/*#__PURE__*/ _jsxs("ul", {
|
|
14
|
+
children: [
|
|
15
|
+
steps.slice(0, 3).map((step, index)=>/*#__PURE__*/ _jsxs("li", {
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ _jsx("span", {
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: "⊗ "
|
|
20
|
+
}),
|
|
21
|
+
renderSentence(step, index)
|
|
22
|
+
]
|
|
23
|
+
}, index)),
|
|
24
|
+
steps.length > 3 ? /*#__PURE__*/ _jsx("li", {
|
|
25
|
+
children: moreBlockers(steps.length - 3)
|
|
26
|
+
}) : null
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
}) : null;
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionTestApi } from '../contracts.js';
|
|
2
|
+
export declare function actionWaitMessage(test: Pick<ActionTestApi, 'stale' | 'hasUnsaved' | 'saving' | 'fieldDrafts'>): string | undefined;
|
|
3
|
+
type SaveState = Pick<ActionTestApi, 'saving' | 'hasUnsaved' | 'stale' | 'errors'>;
|
|
4
|
+
export declare function saveStatusMessage(test: SaveState): string | null;
|
|
5
|
+
type Props = {
|
|
6
|
+
test: ActionTestApi;
|
|
7
|
+
messageInBlockerList?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function ReadinessReadStatus({ test, messageInBlockerList }: Props): import("react").JSX.Element;
|
|
10
|
+
export declare function SaveStatus(props: Props | {
|
|
11
|
+
save: SaveState;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export {};
|