@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +2 -2
- 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 +6 -1
- package/dist/admin/copy/goals.js +10 -3
- package/dist/admin/copy/newTest.d.ts +6 -7
- package/dist/admin/copy/newTest.js +9 -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.js +5 -2
- package/dist/admin/surface/TestRowMenu.d.ts +6 -0
- package/dist/admin/surface/TestRowMenu.js +156 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +266 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +95 -54
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +5 -4
- package/dist/admin/surface/goals/data.js +2 -2
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +11 -1
- package/dist/admin/surface/goals/goals.model.js +43 -0
- package/dist/admin/surface/home.model.d.ts +9 -8
- package/dist/admin/surface/home.model.js +22 -21
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +98 -94
- package/dist/admin/surface/newTest/PageWizard.d.ts +2 -1
- package/dist/admin/surface/newTest/PageWizard.js +111 -76
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +58 -54
- package/dist/admin/surface/surface.css +10 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +42 -162
- 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 +11 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/formState.js +1 -1
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +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 +16 -4
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +5 -4
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.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 +1 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/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/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 +19 -20
- 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.js +951 -179
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +57 -0
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +10 -6
- package/dist/puck/editor/VersionBuilder.d.ts +66 -12
- package/dist/puck/editor/VersionBuilder.js +554 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +64 -19
- package/dist/puck/editor/copy.js +72 -20
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +191 -19
- package/dist/puck/editor/editor.css +328 -24
- 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 +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.js +2 -1
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +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 +52 -14
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.js +6 -2
- package/dist/testSurface/actions/DecideDialog.d.ts +16 -0
- package/dist/{admin → testSurface}/actions/DecideDialog.js +78 -55
- package/dist/testSurface/actions/LifecycleAction.d.ts +16 -0
- package/dist/testSurface/actions/LifecycleAction.js +105 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +122 -0
- package/dist/{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 +28 -8
- package/dist/{admin → testSurface}/copy/actions.js +31 -11
- package/dist/{admin → testSurface}/copy/common.d.ts +13 -4
- package/dist/{admin → testSurface}/copy/common.js +18 -8
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +1 -0
- package/dist/{admin → testSurface}/copy/metrics.js +1 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +38 -4
- package/dist/{admin → testSurface}/copy/readiness.js +52 -7
- package/dist/{admin → testSurface}/copy/results.d.ts +6 -3
- package/dist/{admin → testSurface}/copy/results.js +6 -3
- package/dist/{admin → testSurface}/copy/review.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/review.js +1 -1
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +13 -10
- package/dist/{admin → testSurface}/copy/testPage.d.ts +53 -8
- package/dist/testSurface/copy/testPage.js +165 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/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.js +6 -2
- 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/{admin → testSurface}/surface/pageBlock/parts.js +39 -11
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +503 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{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 +8 -4
- package/dist/testSurface/surface/readiness/ActionDialogs.js +351 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +2 -3
- package/dist/testSurface/surface/readiness/Banner.js +187 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +10 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +66 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{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 +7 -3
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +108 -44
- 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 +58 -18
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +2 -0
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +116 -86
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +5 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +4 -1
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +2 -3
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +80 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +82 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/{admin → testSurface}/surface/test/VersionsSection.js +69 -35
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +30 -7
- package/dist/testSurface/surface/test/fields.js +306 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +27 -43
- package/dist/testSurface/surface/test/testPage.css +103 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +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 +7 -0
- package/dist/testSurface/surfaceUrls.js +19 -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 +116 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +7 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +49 -5
- package/package.json +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/actions.model.js +0 -70
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/testPage.js +0 -104
- 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/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/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}/PreviewLinks.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/allocation.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
- /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/arms.js +0 -0
- /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/audience.js +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
- /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/setting.js +0 -0
- /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
- /package/dist/{admin → testSurface}/format/date.js +0 -0
- /package/dist/{admin → testSurface}/labels.d.ts +0 -0
- /package/dist/{admin → testSurface}/labels.js +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.js +0 -0
- /package/dist/{admin → testSurface}/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/results.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { Button } from '../../../ui/Button.js';
|
|
5
|
-
import { SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
6
|
-
import { jumpToSection } from '../test/jumpToSection.js';
|
|
7
|
-
import { actionGroupLabel, availableActions } from '../../actions/actions.model.js';
|
|
8
|
-
import { createApi } from '../../api.js';
|
|
9
|
-
import { READINESS_COPY as C, decidedCopy, nextCopy, runningCopy, stoppedCopy } from '../../copy/readiness.js';
|
|
10
|
-
import { READINESS, daysRemaining, displayDate, nextStep, pageReadinessContext } from './readiness.model.js';
|
|
11
|
-
import { AddMetricAction, AllocateAction, ConfirmAction } from './ActionDialogs.js';
|
|
12
|
-
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
13
|
-
import { placementUncheckedCopy } from '../../copy/readiness.js';
|
|
14
|
-
import { useTransition } from './useTransition.js';
|
|
15
|
-
const RUNNING_ACTIONS = [
|
|
16
|
-
'stop',
|
|
17
|
-
'add-metric',
|
|
18
|
-
'allocate'
|
|
19
|
-
];
|
|
20
|
-
export function Banner(props) {
|
|
21
|
-
return props.test.doc ? /*#__PURE__*/ _jsx(ReadinessContent, {
|
|
22
|
-
...props
|
|
23
|
-
}, `${props.test.doc.id}/${props.test.doc.status}`) : null;
|
|
24
|
-
}
|
|
25
|
-
export function ReadinessContent({ test, surface, resultsVersion, bar = false }) {
|
|
26
|
-
const [selected, setSelected] = useState(null);
|
|
27
|
-
const [people, setPeople] = useState(null);
|
|
28
|
-
const transition = useTransition(test);
|
|
29
|
-
const doc = test.doc;
|
|
30
|
-
useEffect(()=>{
|
|
31
|
-
let active = true;
|
|
32
|
-
// The id/status key resets the count; refreshes retain it while loading.
|
|
33
|
-
if (surface.canReadResults && doc.status === 'running') {
|
|
34
|
-
void Promise.resolve().then(()=>active ? createApi(surface.apiRoute).summary([
|
|
35
|
-
doc.id
|
|
36
|
-
]) : undefined).then((result)=>{
|
|
37
|
-
if (!result?.ok) return;
|
|
38
|
-
const count = result.data?.[doc.id]?.exposures;
|
|
39
|
-
if (active) setPeople(typeof count === 'number' && Number.isFinite(count) ? count : null);
|
|
40
|
-
}).catch(()=>{});
|
|
41
|
-
}
|
|
42
|
-
return ()=>{
|
|
43
|
-
active = false;
|
|
44
|
-
};
|
|
45
|
-
}, [
|
|
46
|
-
doc.id,
|
|
47
|
-
doc.status,
|
|
48
|
-
surface.apiRoute,
|
|
49
|
-
surface.canReadResults,
|
|
50
|
-
resultsVersion
|
|
51
|
-
]);
|
|
52
|
-
const decision = doc.decision;
|
|
53
|
-
const winner = actionGroupLabel(decision?.winnerArm ?? 'control', doc.arms.find((item)=>item.key === decision?.winnerArm)?.label);
|
|
54
|
-
const labelledPreflight = test.preflight ? {
|
|
55
|
-
...test.preflight,
|
|
56
|
-
checks: test.preflight.checks.map((check)=>check.code === 'placement-unchecked' ? {
|
|
57
|
-
...check,
|
|
58
|
-
detail: {
|
|
59
|
-
...check.detail,
|
|
60
|
-
title: preflightPlacementLabel(check.detail, test.preflight, surface.adminRoute).title
|
|
61
|
-
}
|
|
62
|
-
} : check)
|
|
63
|
-
} : null;
|
|
64
|
-
const next = nextStep(labelledPreflight, pageReadinessContext(doc, test.preflight, surface));
|
|
65
|
-
const setup = doc.status === 'draft' || doc.status === 'stopped';
|
|
66
|
-
const ready = Boolean(test.preflight && !test.preflightPending && !test.preflightError && test.preflight.checks.every((check)=>check.ok));
|
|
67
|
-
const unsaved = test.hasUnsaved || test.saving === 'saving';
|
|
68
|
-
const startReason = unsaved ? C.saveFirst : next?.sentence ?? (!ready ? test.preflightError ? C.checkError : C.checking : undefined);
|
|
69
|
-
const actions = availableActions({
|
|
70
|
-
status: doc.status,
|
|
71
|
-
kind: doc.kind,
|
|
72
|
-
arms: doc.arms,
|
|
73
|
-
decision,
|
|
74
|
-
canManage: surface.canManage
|
|
75
|
-
}).filter((action)=>setup ? action.id === 'start' : doc.status === 'running' ? RUNNING_ACTIONS.includes(action.id) : true).sort((a, b)=>doc.status === 'running' ? RUNNING_ACTIONS.indexOf(a.id) - RUNNING_ACTIONS.indexOf(b.id) : 0).map((action)=>action.id === 'add-metric' ? {
|
|
76
|
-
...action,
|
|
77
|
-
label: C.addGoal
|
|
78
|
-
} : action.id === 'allocate' ? {
|
|
79
|
-
...action,
|
|
80
|
-
label: C.allocate
|
|
81
|
-
} : action);
|
|
82
|
-
const action = actions.find((item)=>item.id === selected);
|
|
83
|
-
const sentence = setup ? bar && test.preflightError ? null : ready ? C.ready : next ? nextCopy(next.sentence) : test.preflightError ? C.checkError : C.checking : doc.status === 'running' ? runningCopy(displayDate(doc.startedAt), people, daysRemaining(doc, Date.now())) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt), winner) : C.archived;
|
|
84
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
85
|
-
className: `xp-readiness xp-readiness--${setup && ready ? 'ready' : 'neutral'}${bar ? ' xp-readiness--bar xp-tests-container' : ''}`,
|
|
86
|
-
children: [
|
|
87
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
88
|
-
className: "xp-readiness__state",
|
|
89
|
-
children: [
|
|
90
|
-
bar ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
91
|
-
children: [
|
|
92
|
-
/*#__PURE__*/ _jsx(SaveStatus, {
|
|
93
|
-
test: test
|
|
94
|
-
}),
|
|
95
|
-
sentence && (saveStatusMessage(test) || test.preflightError) ? /*#__PURE__*/ _jsx("span", {
|
|
96
|
-
className: "xp-readiness__separator",
|
|
97
|
-
"aria-hidden": "true",
|
|
98
|
-
children: "·"
|
|
99
|
-
}) : null
|
|
100
|
-
]
|
|
101
|
-
}) : null,
|
|
102
|
-
sentence ? /*#__PURE__*/ _jsx("p", {
|
|
103
|
-
role: "status",
|
|
104
|
-
children: setup && next && !ready && next.section !== 'header' ? /*#__PURE__*/ _jsxs("a", {
|
|
105
|
-
href: `#section-${next.section}`,
|
|
106
|
-
onClick: (event)=>{
|
|
107
|
-
event.preventDefault();
|
|
108
|
-
if (next.section !== 'header') jumpToSection(next.section, next.arm);
|
|
109
|
-
},
|
|
110
|
-
children: [
|
|
111
|
-
sentence,
|
|
112
|
-
next.nextStep ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
113
|
-
children: [
|
|
114
|
-
/*#__PURE__*/ _jsx("br", {}),
|
|
115
|
-
/*#__PURE__*/ _jsx("span", {
|
|
116
|
-
children: next.nextStep
|
|
117
|
-
})
|
|
118
|
-
]
|
|
119
|
-
}) : null
|
|
120
|
-
]
|
|
121
|
-
}) : sentence
|
|
122
|
-
}) : null
|
|
123
|
-
]
|
|
124
|
-
}),
|
|
125
|
-
setup && test.preflight?.checks.some((check)=>check.code === 'page-targets-unchecked' && check.warning) ? /*#__PURE__*/ _jsx("p", {
|
|
126
|
-
children: C.uncheckedPages
|
|
127
|
-
}) : null,
|
|
128
|
-
test.preflight?.checks.filter((check)=>check.code === 'make-content-unsupported' && check.warning).map((check)=>/*#__PURE__*/ _jsx("p", {
|
|
129
|
-
children: READINESS[check.code].next(check.detail, doc)
|
|
130
|
-
}, check.code)),
|
|
131
|
-
test.preflight?.checks.filter((check)=>check.warning && [
|
|
132
|
-
'goal-in-some-versions',
|
|
133
|
-
'placement-unchecked'
|
|
134
|
-
].includes(check.code)).map((check, index)=>{
|
|
135
|
-
const placement = check.code === 'placement-unchecked' ? preflightPlacementLabel(check.detail, test.preflight, surface.adminRoute) : undefined;
|
|
136
|
-
return /*#__PURE__*/ _jsx("p", {
|
|
137
|
-
children: placement ? placement.href ? /*#__PURE__*/ _jsx("a", {
|
|
138
|
-
href: placement.href,
|
|
139
|
-
children: placementUncheckedCopy(placement.title)
|
|
140
|
-
}) : placementUncheckedCopy(placement.title) : READINESS[check.code].next(check.detail, doc)
|
|
141
|
-
}, `${check.code}:${index}`);
|
|
142
|
-
}),
|
|
143
|
-
test.preflight?.goalNotes?.map((note)=>/*#__PURE__*/ _jsx("p", {
|
|
144
|
-
children: note.message
|
|
145
|
-
}, note.metricId)),
|
|
146
|
-
doc.status === 'stopped' ? /*#__PURE__*/ _jsx("p", {
|
|
147
|
-
children: stoppedCopy(displayDate(doc.stoppedAt))
|
|
148
|
-
}) : null,
|
|
149
|
-
/*#__PURE__*/ _jsx("div", {
|
|
150
|
-
className: "xp-readiness__actions",
|
|
151
|
-
children: actions.map((item)=>{
|
|
152
|
-
const reason = item.id === 'start' ? startReason : unsaved ? C.saveFirst : item.id === 'allocate' && doc.allocation >= 100 ? C.everyone : undefined;
|
|
153
|
-
const disabled = transition.busy || !!selected || !!reason;
|
|
154
|
-
return /*#__PURE__*/ _jsx("span", {
|
|
155
|
-
title: reason,
|
|
156
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
157
|
-
variant: item.tone === 'primary' || bar && item.id === 'stop' ? 'primary' : 'secondary',
|
|
158
|
-
disabled: disabled,
|
|
159
|
-
onClick: ()=>{
|
|
160
|
-
if (disabled) return;
|
|
161
|
-
if (item.id === 'start' && doc.status === 'draft') void transition.run(()=>createApi(surface.apiRoute).start(doc.id));
|
|
162
|
-
else setSelected(item.id);
|
|
163
|
-
},
|
|
164
|
-
children: item.label
|
|
165
|
-
})
|
|
166
|
-
}, item.id);
|
|
167
|
-
})
|
|
168
|
-
}),
|
|
169
|
-
transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
170
|
-
role: "alert",
|
|
171
|
-
children: transition.error
|
|
172
|
-
}) : null,
|
|
173
|
-
action?.id === 'allocate' ? /*#__PURE__*/ _jsx(AllocateAction, {
|
|
174
|
-
test: test,
|
|
175
|
-
surface: surface,
|
|
176
|
-
onClose: ()=>setSelected(null)
|
|
177
|
-
}) : action?.id === 'add-metric' ? /*#__PURE__*/ _jsx(AddMetricAction, {
|
|
178
|
-
test: test,
|
|
179
|
-
surface: surface,
|
|
180
|
-
onClose: ()=>setSelected(null)
|
|
181
|
-
}) : action ? /*#__PURE__*/ _jsx(ConfirmAction, {
|
|
182
|
-
test: test,
|
|
183
|
-
surface: surface,
|
|
184
|
-
action: action,
|
|
185
|
-
winnerLabel: winner,
|
|
186
|
-
onClose: ()=>setSelected(null)
|
|
187
|
-
}) : null
|
|
188
|
-
]
|
|
189
|
-
});
|
|
190
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useState } from 'react';
|
|
4
|
-
import { Button } from '../../../ui/Button.js';
|
|
5
|
-
import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
6
|
-
export function saveStatusMessage(test) {
|
|
7
|
-
return test.saving === 'saving' ? C.saving : test.saving === 'saved' || test.saving === 'idle' ? C.saved : test.saving === 'error' && !test.stale ? C.saveError : null;
|
|
8
|
-
}
|
|
9
|
-
export function SaveStatus({ test }) {
|
|
10
|
-
const inFlight = useRef(false);
|
|
11
|
-
const [retrying, setRetrying] = useState(false);
|
|
12
|
-
async function retry() {
|
|
13
|
-
if (inFlight.current || test.preflightPending || test.hasUnsaved || test.saving === 'saving') return;
|
|
14
|
-
inFlight.current = true;
|
|
15
|
-
setRetrying(true);
|
|
16
|
-
try {
|
|
17
|
-
await test.refreshPreflight();
|
|
18
|
-
} finally{
|
|
19
|
-
inFlight.current = false;
|
|
20
|
-
setRetrying(false);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const message = saveStatusMessage(test);
|
|
24
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
25
|
-
className: "xp-save-status",
|
|
26
|
-
"aria-live": "polite",
|
|
27
|
-
children: [
|
|
28
|
-
message ? /*#__PURE__*/ _jsx("span", {
|
|
29
|
-
role: test.saving === 'error' ? 'alert' : 'status',
|
|
30
|
-
children: message
|
|
31
|
-
}) : null,
|
|
32
|
-
test.preflightError ? /*#__PURE__*/ _jsxs("div", {
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ _jsx("span", {
|
|
35
|
-
role: "alert",
|
|
36
|
-
children: test.preflightError
|
|
37
|
-
}),
|
|
38
|
-
' ',
|
|
39
|
-
/*#__PURE__*/ _jsx("span", {
|
|
40
|
-
title: test.hasUnsaved || test.saving === 'saving' ? C.saveFirst : undefined,
|
|
41
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
42
|
-
disabled: retrying || test.preflightPending || test.hasUnsaved || test.saving === 'saving',
|
|
43
|
-
onClick: ()=>{
|
|
44
|
-
void retry();
|
|
45
|
-
},
|
|
46
|
-
children: C.retry
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
}) : null
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { SURFACE_COPY } from '../../copy/surface.js';
|
|
2
|
-
import { formatDate } from '../../format/date.js';
|
|
3
|
-
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
4
|
-
import { asymmetricGoalsCopy, placementUncheckedCopy, interactingTestsCopy, sameAddressCopy, identicalVersionCopy, unsupportedContentCopy, versionPageUnavailableCopy, versionPageUncheckedCopy, placementFailureCopy, pageInUseCopy, unpublishedPageCopy, READINESS_COPY as C, attributeNext, contentNext, goalPeopleNext, parameterNext, placementNext, ruleNext, versionsNext } from '../../copy/readiness.js';
|
|
5
|
-
import { normalisePath } from '../../../runtime/normalisePath.js';
|
|
6
|
-
import { testPageCollection } from '../pagePicker/pagePicker.model.js';
|
|
7
|
-
import { SECTION_ORDER } from '../contracts.js';
|
|
8
|
-
const object = (value)=>value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
9
|
-
const first = (value)=>object(Array.isArray(value) ? value[0] : value);
|
|
10
|
-
const text = (value, fallback)=>typeof value === 'string' && value.trim() ? value.trim() : fallback;
|
|
11
|
-
const detailText = (value, fallback)=>typeof value === 'string' ? text(value, fallback) : text(first(value).message ?? first(value).detail, fallback);
|
|
12
|
-
const group = (key, ctx)=>{
|
|
13
|
-
const found = ctx.arms.find((item)=>item.key === key);
|
|
14
|
-
return found ? actionGroupLabel(found.key, found.label) : C.groupFallback;
|
|
15
|
-
};
|
|
16
|
-
const row = (section, next)=>({
|
|
17
|
-
section,
|
|
18
|
-
next
|
|
19
|
-
});
|
|
20
|
-
const versions = row('versions', (detail)=>versionsNext(detailText(detail, C.versionFallback)));
|
|
21
|
-
/** Exhaustive mapping of the checkStart ReadinessCode union, including all ten invariant checks. */ export const READINESS = {
|
|
22
|
-
'make-content-unsupported': row('header', (detail)=>unsupportedContentCopy(text(detail, 'This page'))),
|
|
23
|
-
'goal-in-some-versions': {
|
|
24
|
-
...row('win', (detail)=>asymmetricGoalsCopy(detail)),
|
|
25
|
-
nextStep: 'Edit the versions'
|
|
26
|
-
},
|
|
27
|
-
'placement-unchecked': {
|
|
28
|
-
...row('versions', (detail)=>placementUncheckedCopy(text(object(detail).title ?? object(detail).path, 'This page'))),
|
|
29
|
-
nextStep: (detail)=>`Open ${text(object(detail).title ?? object(detail).path, 'the page')}`
|
|
30
|
-
},
|
|
31
|
-
'invalid-status': row('header', ()=>null),
|
|
32
|
-
'no-placements': row('what', (detail)=>detail === undefined ? C.noPlacements : placementFailureCopy(detail)),
|
|
33
|
-
'placement-unpublished': {
|
|
34
|
-
...row('versions', (detail)=>(Array.isArray(detail) && detail.length ? detail : [
|
|
35
|
-
detail
|
|
36
|
-
]).map((placement)=>`The block you're testing is only on a draft of ${text(object(placement).title, 'this page')}. Publish the page before you start.`).join('\n')),
|
|
37
|
-
nextStep: 'Publish the page'
|
|
38
|
-
},
|
|
39
|
-
'duplicate-version-row': {
|
|
40
|
-
...row('versions', (detail)=>`The Experiment block on ${text(first(detail).title, 'this page')} has the same version twice. Remove one of them, then save.`),
|
|
41
|
-
nextStep: (detail)=>`Edit ${text(first(detail).title, 'this page')}`
|
|
42
|
-
},
|
|
43
|
-
'interacting-tests': {
|
|
44
|
-
...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)),
|
|
45
|
-
nextStep: (detail)=>`Open ${text(first(detail).name, 'the test')}${first(detail).version === true ? `\nEdit ${text(first(detail).path, 'this page')}` : ''}`
|
|
46
|
-
},
|
|
47
|
-
'empty-slot': row('versions', (detail, ctx)=>{
|
|
48
|
-
const placements = Array.isArray(detail) ? detail : [];
|
|
49
|
-
const missing = ctx.arms.find((item)=>item.kind !== 'holdout' && placements.some((placement)=>{
|
|
50
|
-
const slots = object(object(placement).slots);
|
|
51
|
-
return !item.slot || !(typeof slots[item.slot] === 'number' && Number(slots[item.slot]) > 0);
|
|
52
|
-
}));
|
|
53
|
-
return contentNext(group(missing?.key ?? first(detail).arm, ctx));
|
|
54
|
-
}),
|
|
55
|
-
'flag-no-point': row('what', ()=>C.noPoint),
|
|
56
|
-
'flag-params-invalid': row('versions', (detail, ctx)=>{
|
|
57
|
-
const issue = first(detail);
|
|
58
|
-
const point = ctx.flagPoints?.find((item)=>item.id === ctx.flagPoint);
|
|
59
|
-
const parameter = typeof issue.field === 'string' ? point?.params[issue.field]?.label ?? issue.field : C.parameterFallback;
|
|
60
|
-
return parameterNext(parameter, group(issue.arm, ctx));
|
|
61
|
-
}),
|
|
62
|
-
'flag-point-busy': row('what', ()=>C.busy),
|
|
63
|
-
'flag-placement-missing': row('versions', (detail, ctx)=>{
|
|
64
|
-
if (typeof detail === 'string') return placementFailureCopy(detail);
|
|
65
|
-
const value = object(detail);
|
|
66
|
-
const placement = first(value.placements);
|
|
67
|
-
const missing = Array.isArray(value.missing) ? value.missing[0] : undefined;
|
|
68
|
-
return placementNext(group(placement.arm ?? missing, ctx), detailText(typeof detail === 'string' ? detail : placement, ''));
|
|
69
|
-
}),
|
|
70
|
-
'no-primary-metric': row('win', ()=>C.noGoal),
|
|
71
|
-
'unknown-metric-source': row('win', ()=>C.unknownGoal),
|
|
72
|
-
'unit-source-mismatch': row('win', (_, ctx)=>goalPeopleNext(ctx.unitType === 'user' ? 'signed-in users' : 'visitors')),
|
|
73
|
-
'no-planned-duration': row('length', ()=>C.noDuration),
|
|
74
|
-
'no-reach-per-day': row('length', ()=>C.noReach),
|
|
75
|
-
'layer-full': row('versions', ()=>C.full),
|
|
76
|
-
'layer-unit-mismatch': row('header', ()=>C.differentPeople),
|
|
77
|
-
'page-in-use': {
|
|
78
|
-
...row('versions', (detail, ctx)=>{
|
|
79
|
-
const paths = object(detail).paths;
|
|
80
|
-
const path = text(Array.isArray(paths) ? paths[0] : undefined, 'this page');
|
|
81
|
-
return pageInUseCopy(path, pageArm(path, ctx)?.kind === 'variant');
|
|
82
|
-
}),
|
|
83
|
-
nextStep: C.choosePages
|
|
84
|
-
},
|
|
85
|
-
'page-no-targets': {
|
|
86
|
-
...row('versions', ()=>C.noTargets),
|
|
87
|
-
nextStep: 'Choose pages'
|
|
88
|
-
},
|
|
89
|
-
'unknown-collection': row('versions', ()=>"That page type isn't set up for tests."),
|
|
90
|
-
'version-identical': {
|
|
91
|
-
...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)))),
|
|
92
|
-
nextStep: (detail, ctx)=>`Edit ${text(object(detail).path, group(object(detail).arm, ctx))}`
|
|
93
|
-
},
|
|
94
|
-
'version-same-address': {
|
|
95
|
-
...row('versions', (detail, ctx)=>sameAddressCopy(group(object(detail).arm, ctx), group(object(detail).otherArm, ctx), text(object(detail).path, 'this address'), ctx.collectionLabel)),
|
|
96
|
-
nextStep: 'Choose pages'
|
|
97
|
-
},
|
|
98
|
-
'page-target-unpublished': {
|
|
99
|
-
...row('versions', (detail, ctx)=>{
|
|
100
|
-
const path = text(typeof detail === 'string' ? detail : object(detail).path, 'This page');
|
|
101
|
-
const arm = ctx.arms.find((item)=>item.key === object(detail).arm) ?? pageArm(path, ctx);
|
|
102
|
-
const placement = (arm ? ctx.pagePlacements?.find((entry)=>entry.arm === arm.key) : undefined) ?? ctx.pagePlacements?.find((entry)=>normalisePath(entry.path) === normalisePath(path));
|
|
103
|
-
return unpublishedPageCopy(path, ctx.pagePlacements && ctx.collectionLabel ? {
|
|
104
|
-
original: arm?.kind === 'control',
|
|
105
|
-
found: placement?.id != null && placement.published === false,
|
|
106
|
-
collection: ctx.collectionLabel
|
|
107
|
-
} : undefined);
|
|
108
|
-
}),
|
|
109
|
-
nextStep: C.choosePages
|
|
110
|
-
},
|
|
111
|
-
'page-targets-unchecked': row('versions', ()=>C.uncheckedPages),
|
|
112
|
-
'version-page-unavailable': row('versions', (detail)=>versionPageUnavailableCopy(text(detail, 'This page'))),
|
|
113
|
-
'version-page-unchecked': row('versions', (detail)=>versionPageUncheckedCopy(text(detail, 'This page'))),
|
|
114
|
-
'page-user-unit': row('header', ()=>C.pageVisitors),
|
|
115
|
-
'block-path-rule': {
|
|
116
|
-
...row('who', ()=>C.blockPathRule),
|
|
117
|
-
nextStep: C.removeRule
|
|
118
|
-
},
|
|
119
|
-
'invalid-targeting-rule': row('who', (detail)=>{
|
|
120
|
-
const attributes = object(detail).attributes;
|
|
121
|
-
return ruleNext(detailText(detail, Array.isArray(attributes) && attributes.length ? attributes.map(String).join(', ') : C.ruleFallback));
|
|
122
|
-
}),
|
|
123
|
-
'undeclared-targeting-key': row('who', (detail)=>{
|
|
124
|
-
const attributes = object(detail).attributes;
|
|
125
|
-
return attributeNext(text(Array.isArray(attributes) ? attributes[0] : object(detail).attribute, C.attributeFallback));
|
|
126
|
-
}),
|
|
127
|
-
'weights-total': versions,
|
|
128
|
-
'control-count': versions,
|
|
129
|
-
'control-first': versions,
|
|
130
|
-
'holdout-count': versions,
|
|
131
|
-
'holdout-last': versions,
|
|
132
|
-
'variant-count': versions,
|
|
133
|
-
'invalid-key': versions,
|
|
134
|
-
'duplicate-key': versions,
|
|
135
|
-
'slot-required': versions,
|
|
136
|
-
'duplicate-slot': versions
|
|
137
|
-
};
|
|
138
|
-
export function nextStep(preflight, ctx) {
|
|
139
|
-
for (const section of [
|
|
140
|
-
'header',
|
|
141
|
-
...SECTION_ORDER
|
|
142
|
-
]){
|
|
143
|
-
for (const check of preflight?.checks ?? []){
|
|
144
|
-
if (!Object.hasOwn(READINESS, check.code)) {
|
|
145
|
-
if (!check.ok && section === SECTION_ORDER[0]) return {
|
|
146
|
-
section,
|
|
147
|
-
sentence: SURFACE_COPY.next,
|
|
148
|
-
code: check.code
|
|
149
|
-
};
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
const mapping = READINESS[check.code];
|
|
153
|
-
if (check.ok || mapping.section !== section) continue;
|
|
154
|
-
const sentence = mapping.next(check.detail, ctx);
|
|
155
|
-
const nextStep = typeof mapping.nextStep === 'function' ? mapping.nextStep(check.detail, ctx) : mapping.nextStep;
|
|
156
|
-
const arm = readinessArm(check.code, check.detail, ctx);
|
|
157
|
-
if (sentence) return {
|
|
158
|
-
section,
|
|
159
|
-
sentence,
|
|
160
|
-
code: check.code,
|
|
161
|
-
...arm ? {
|
|
162
|
-
arm
|
|
163
|
-
} : {},
|
|
164
|
-
...nextStep ? {
|
|
165
|
-
nextStep
|
|
166
|
-
} : {}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
export function sectionDone(test) {
|
|
173
|
-
return Object.fromEntries(SECTION_ORDER.map((section)=>[
|
|
174
|
-
section,
|
|
175
|
-
test.preflight ? !test.preflight.checks.some((check)=>!check.ok && (Object.hasOwn(READINESS, check.code) ? READINESS[check.code].section : SECTION_ORDER[0]) === section) : section === 'who' || section === 'advanced'
|
|
176
|
-
]));
|
|
177
|
-
}
|
|
178
|
-
export function displayDate(value) {
|
|
179
|
-
if (typeof value !== 'string' || !Number.isFinite(Date.parse(value))) return null;
|
|
180
|
-
return formatDate(value);
|
|
181
|
-
}
|
|
182
|
-
export function daysRemaining(doc, now) {
|
|
183
|
-
const days = doc.analysis?.plannedDurationDays;
|
|
184
|
-
const start = typeof doc.startedAt === 'string' ? Date.parse(doc.startedAt) : NaN;
|
|
185
|
-
return typeof days === 'number' && days > 0 && Number.isFinite(start) ? Math.max(0, Math.ceil(days - (now - start) / 86_400_000)) : null;
|
|
186
|
-
}
|
|
187
|
-
function pageArm(path, ctx) {
|
|
188
|
-
return ctx.arms.find((arm)=>arm.pageTarget && normalisePath(arm.pageTarget) === normalisePath(path));
|
|
189
|
-
}
|
|
190
|
-
export function pageReadinessContext(doc, preflight, surface) {
|
|
191
|
-
return {
|
|
192
|
-
...doc,
|
|
193
|
-
flagPoints: surface.flagPoints,
|
|
194
|
-
pagePlacements: preflight?.pagePlacements,
|
|
195
|
-
collectionLabel: testPageCollection(surface.pageCollections, doc, preflight?.pagePlacements)?.label
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
/** First affected row in arm order; shared by the wizard and the test-page jump. */ export function readinessArm(code, detail, ctx) {
|
|
199
|
-
if (code === 'version-same-address') return ctx.arms.find((arm)=>arm.key === object(detail).arm)?.key;
|
|
200
|
-
if (code === 'page-no-targets') return ctx.arms.find((arm)=>arm.kind !== 'holdout' && !arm.pageTarget)?.key;
|
|
201
|
-
const paths = code === 'page-in-use' ? object(detail).paths : code === 'page-target-unpublished' ? [
|
|
202
|
-
detail
|
|
203
|
-
] : [];
|
|
204
|
-
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;
|
|
205
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ApiResult } from '../../api.js';
|
|
2
|
-
import type { TestDocApi } from '../contracts.js';
|
|
3
|
-
/** The ref closes the gap before React renders the disabled button. */
|
|
4
|
-
export declare function useTransition(test: TestDocApi, onSuccess?: () => void): {
|
|
5
|
-
busy: boolean;
|
|
6
|
-
error: string | null;
|
|
7
|
-
run: (request: () => Promise<ApiResult<unknown>>, { reloadOnSuccess }?: {
|
|
8
|
-
reloadOnSuccess?: boolean | undefined;
|
|
9
|
-
}) => Promise<void>;
|
|
10
|
-
clearError: () => void;
|
|
11
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
3
|
-
import { API_MESSAGES } from '../../copy/common.js';
|
|
4
|
-
/** The ref closes the gap before React renders the disabled button. */ export function useTransition(test, onSuccess) {
|
|
5
|
-
const inFlight = useRef(false);
|
|
6
|
-
const [busy, setBusy] = useState(false);
|
|
7
|
-
const [error, setError] = useState(null);
|
|
8
|
-
async function run(request, { reloadOnSuccess = true } = {}) {
|
|
9
|
-
if (inFlight.current || test.hasUnsaved || test.saving === 'saving') return;
|
|
10
|
-
inFlight.current = true;
|
|
11
|
-
setBusy(true);
|
|
12
|
-
setError(null);
|
|
13
|
-
try {
|
|
14
|
-
const result = await request();
|
|
15
|
-
if (result.ok) {
|
|
16
|
-
if (reloadOnSuccess) {
|
|
17
|
-
await test.reload();
|
|
18
|
-
onSuccess?.();
|
|
19
|
-
// Keep the successful action locked until the reloaded document replaces this view.
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
} else setError(result.message);
|
|
23
|
-
} catch {
|
|
24
|
-
setError(API_MESSAGES.network);
|
|
25
|
-
}
|
|
26
|
-
inFlight.current = false;
|
|
27
|
-
setBusy(false);
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
busy,
|
|
31
|
-
error,
|
|
32
|
-
run,
|
|
33
|
-
clearError: ()=>setError(null)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
.xp-setting-values { display: grid; gap: var(--xp-space-3); }
|
|
2
|
-
.xp-setting-value { white-space: pre-wrap; }
|
|
3
|
-
.xp-setting-lock { color: var(--xp-text-muted); }
|
|
4
|
-
.xp-setting-parameter fieldset { border: 0; padding: 0; margin: 0; }
|
|
5
|
-
.xp-setting-segments { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
|
|
6
|
-
.xp-setting-segments label { position: relative; }
|
|
7
|
-
.xp-setting-segments input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
|
|
8
|
-
.xp-setting-segments span {
|
|
9
|
-
display: block;
|
|
10
|
-
padding: 0.5rem 0.8rem;
|
|
11
|
-
border: 1px solid var(--xp-border);
|
|
12
|
-
border-radius: var(--xp-radius);
|
|
13
|
-
background: var(--xp-input-bg);
|
|
14
|
-
color: var(--xp-text);
|
|
15
|
-
}
|
|
16
|
-
.xp-setting-segments input:checked + span { background: var(--xp-accent-subtle); border-color: var(--xp-accent); }
|
|
17
|
-
.xp-setting-segments input:focus-visible + span { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef } from 'react';
|
|
4
|
-
import { readinessParts } from '../readiness/parts.js';
|
|
5
|
-
import { SectionCard } from '../../../ui/SectionCard.js';
|
|
6
|
-
import { SECTION_ORDER } from '../contracts.js';
|
|
7
|
-
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
8
|
-
export function Section({ test, sectionId, children }) {
|
|
9
|
-
const disclosure = useRef(null);
|
|
10
|
-
const hasAdvancedError = Object.keys(test.errors).some((path)=>path.startsWith('analysis.') && ![
|
|
11
|
-
'analysis.reachPerDay',
|
|
12
|
-
'analysis.plannedDurationDays'
|
|
13
|
-
].includes(path) || path === 'exposurePolicy');
|
|
14
|
-
useEffect(()=>{
|
|
15
|
-
if (hasAdvancedError && disclosure.current) disclosure.current.open = true;
|
|
16
|
-
}, [
|
|
17
|
-
hasAdvancedError
|
|
18
|
-
]);
|
|
19
|
-
const done = readinessParts.sectionDone(test)[sectionId];
|
|
20
|
-
if (sectionId === 'advanced') return /*#__PURE__*/ _jsxs("details", {
|
|
21
|
-
ref: disclosure,
|
|
22
|
-
className: "xp-test-advanced",
|
|
23
|
-
id: "section-advanced",
|
|
24
|
-
children: [
|
|
25
|
-
/*#__PURE__*/ _jsx("summary", {
|
|
26
|
-
children: /*#__PURE__*/ _jsx("h2", {
|
|
27
|
-
id: "title-advanced",
|
|
28
|
-
tabIndex: -1,
|
|
29
|
-
children: C.sections.advanced
|
|
30
|
-
})
|
|
31
|
-
}),
|
|
32
|
-
/*#__PURE__*/ _jsx("div", {
|
|
33
|
-
className: "xp-ui-section-body",
|
|
34
|
-
children: children
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
return /*#__PURE__*/ _jsx(SectionCard, {
|
|
39
|
-
number: SECTION_ORDER.indexOf(sectionId) + 1,
|
|
40
|
-
title: C.sections[sectionId],
|
|
41
|
-
complete: done,
|
|
42
|
-
id: `section-${sectionId}`,
|
|
43
|
-
headingId: `title-${sectionId}`,
|
|
44
|
-
className: "xp-test-section",
|
|
45
|
-
children: children
|
|
46
|
-
});
|
|
47
|
-
}
|