@delmaredigital/payload-experiments 0.4.0-rc.3 → 0.4.0-rc.5
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/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +2 -2
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.js +2 -2
- package/dist/admin/TestsNavLink.js +2 -2
- package/dist/admin/blocks/BlockPanel.js +3 -3
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.js +1 -1
- package/dist/admin/blocks/model.js +1 -1
- package/dist/admin/blocks/statusCache.js +1 -1
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +2 -2
- package/dist/admin/copy/blocks.js +3 -2
- package/dist/admin/copy/goals.d.ts +5 -1
- package/dist/admin/copy/goals.js +9 -3
- package/dist/admin/goals/XpGoalField.js +155 -129
- package/dist/admin/goals/xpGoalField.css +2 -3
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +6 -13
- package/dist/admin/surface/SurfaceShell.js +2 -2
- package/dist/admin/surface/TestsHome.d.ts +1 -1
- package/dist/admin/surface/TestsHome.js +3 -3
- package/dist/admin/surface/TestsSurface.js +2 -2
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +55 -7
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +4 -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 +1 -1
- package/dist/admin/surface/home.model.js +5 -5
- package/dist/admin/surface/newTest/NewTest.d.ts +1 -1
- package/dist/admin/surface/newTest/NewTest.js +1 -1
- package/dist/admin/surface/newTest/PageWizard.d.ts +1 -1
- package/dist/admin/surface/newTest/PageWizard.js +23 -25
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +22 -15
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +45 -156
- package/dist/admin/views/ExperimentsRootView.js +1 -1
- package/dist/admin/views/TestsNavLinkServer.js +1 -1
- package/dist/admin/views/renderCollectionList.js +1 -1
- package/dist/admin/views/renderTestsSurface.js +1 -1
- package/dist/blocks/placementLocale.d.ts +21 -0
- package/dist/blocks/placementLocale.js +115 -0
- package/dist/collections/experiments/config.js +1 -1
- package/dist/collections/metrics.js +1 -1
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +107 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/index.js +28 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fields/xpGoal.js +1 -1
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +1 -1
- 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 +4 -2
- package/dist/goals/picker/copy.js +4 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/hooks/blockRemovalRule.d.ts +29 -0
- package/dist/hooks/blockRemovalRule.js +141 -0
- package/dist/hooks/pageGuard.d.ts +24 -2
- package/dist/hooks/pageGuard.js +178 -24
- package/dist/lib/placementPages.d.ts +9 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +1 -4
- package/dist/onInit.js +22 -0
- package/dist/plugin.js +2 -1
- package/dist/puck/ExperimentPicker.js +25 -10
- package/dist/puck/copy.d.ts +4 -1
- package/dist/puck/copy.js +4 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +21 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +147 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +11 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +73 -9
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.js +690 -79
- package/dist/puck/editor/LeftoverVersions.d.ts +13 -0
- package/dist/puck/editor/LeftoverVersions.js +115 -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 +3 -0
- package/dist/puck/editor/QuickTestActions.js +50 -0
- package/dist/puck/editor/ResultsReadout.js +8 -5
- package/dist/puck/editor/VersionBuilder.d.ts +20 -6
- package/dist/puck/editor/VersionBuilder.js +80 -50
- package/dist/puck/editor/armWrites.d.ts +3 -1
- package/dist/puck/editor/armWrites.js +2 -1
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -3
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +42 -5
- package/dist/puck/editor/copy.js +43 -6
- package/dist/puck/editor/editor.chrome.css +44 -0
- package/dist/puck/editor/editor.css +68 -0
- package/dist/puck/editor/editor.model.d.ts +14 -0
- package/dist/puck/editor/editor.model.js +58 -1
- 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 +2 -0
- package/dist/puck/editor/localPlacements.js +29 -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 +50 -0
- package/dist/puck/editor/placementsCache.js +258 -0
- package/dist/puck/editor/sidebar.d.ts +12 -0
- package/dist/puck/editor/sidebar.js +77 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +14 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +109 -98
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/{admin → testSurface}/actions/DecideDialog.d.ts +2 -1
- package/dist/{admin → testSurface}/actions/DecideDialog.js +6 -4
- package/dist/{admin → testSurface}/api.js +5 -6
- package/dist/{admin → testSurface}/copy/common.d.ts +3 -1
- package/dist/{admin → testSurface}/copy/common.js +5 -1
- package/dist/{admin → testSurface}/copy/readiness.d.ts +20 -1
- package/dist/{admin → testSurface}/copy/readiness.js +25 -1
- package/dist/{admin → testSurface}/copy/testPage.d.ts +4 -0
- package/dist/{admin → testSurface}/copy/testPage.js +8 -2
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +1 -1
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +9 -0
- package/dist/testSurface/readPreflight.js +38 -0
- package/dist/testSurface/readinessRead.d.ts +50 -0
- package/dist/testSurface/readinessRead.js +46 -0
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/surface/contracts.d.ts +7 -2
- package/dist/testSurface/surface/editorPlacement.d.ts +21 -0
- package/dist/testSurface/surface/editorPlacement.js +60 -0
- package/dist/{admin → testSurface}/surface/pageBlock/parts.js +19 -9
- package/dist/testSurface/surface/pagePicker/pagePicker.css +10 -0
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.js +37 -7
- package/dist/testSurface/surface/readiness/Banner.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.js +106 -68
- 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 +9 -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 +13 -0
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.js +51 -36
- package/dist/{admin → testSurface}/surface/readiness/useTransition.d.ts +5 -2
- package/dist/testSurface/surface/readiness/useTransition.js +98 -0
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +2 -2
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +18 -11
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +1 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +4 -2
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +2 -1
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +1 -2
- 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 +5 -0
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +213 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/{admin → testSurface}/surface/test/VersionsSection.js +13 -6
- package/dist/testSurface/surface/test/testPage.css +104 -0
- package/dist/{admin → testSurface}/surface/useTestDocument.d.ts +9 -2
- package/dist/{admin → testSurface}/surface/useTestDocument.js +92 -46
- package/dist/{admin → testSurface}/surfaceUrls.js +1 -1
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +24 -0
- package/dist/transitions/placementInteractions.js +1 -1
- package/dist/transitions/placements.d.ts +27 -8
- package/dist/transitions/placements.js +77 -6
- package/dist/transitions/preflightData.js +1 -1
- package/dist/transitions/start.js +2 -2
- package/dist/types/endpoints.d.ts +1 -1
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/Dialog.d.ts +4 -1
- package/dist/ui/Dialog.js +41 -3
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Tabs.d.ts +4 -3
- package/dist/ui/Tabs.js +47 -32
- package/dist/ui/ui.css +24 -0
- package/package.json +1 -1
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- 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/pagePicker/pagePicker.css +0 -10
- package/dist/admin/surface/readiness/Banner.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- 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 -48
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/testPage.css +0 -92
- /package/dist/{admin → testSurface}/PreviewLinks.d.ts +0 -0
- /package/dist/{admin → testSurface}/PreviewLinks.js +0 -0
- /package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/MakeContentResult.js +0 -0
- /package/dist/{admin → testSurface}/actions/actions.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/actions.model.js +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}/api.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}/copy/actions.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/actions.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/metrics.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/metrics.js +0 -0
- /package/dist/{admin → testSurface}/copy/pages.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/pages.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/results.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/results.js +0 -0
- /package/dist/{admin → testSurface}/copy/review.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/review.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}/copy/surface.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/surface.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.d.ts +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/VerdictHero.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/VerdictHero.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/results.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/pageBlock.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.js +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.js +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/ReleasePages.js +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/results/useResults.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/useResults.js +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.js +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/PageHoldout.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/fields.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/fields.js +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}/surface/test/pageParts.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/testPage.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/testDocument.model.js +0 -0
- /package/dist/{admin → testSurface}/surfaceUrls.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.d.ts +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../styles.js';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
3
2
|
import type { DocId } from '../../../types/contracts.js';
|
|
4
3
|
import type { ResultsResponse } from '../../../types/endpoints.js';
|
|
@@ -13,8 +12,9 @@ type ResultsBodyProps = {
|
|
|
13
12
|
renderPage?: (parts: ResultsPageParts) => ReactNode;
|
|
14
13
|
id: DocId;
|
|
15
14
|
surface: SurfaceProps;
|
|
15
|
+
onChanged?: (doc?: Record<string, unknown>) => void;
|
|
16
16
|
onRecomputed?: () => void;
|
|
17
17
|
onPagesReleased?: () => void;
|
|
18
18
|
};
|
|
19
|
-
export declare function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage }: ResultsBodyProps): import("react").JSX.Element;
|
|
19
|
+
export declare function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }: ResultsBodyProps): import("react").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { theme } from '../../theme.js';
|
|
4
|
-
import '../../styles.js';
|
|
5
4
|
import { useEffect, useRef, useState } from 'react';
|
|
6
5
|
import { Button } from '../../../ui/Button.js';
|
|
7
6
|
import { Select } from '../../../ui/Inputs.js';
|
|
@@ -28,17 +27,18 @@ import { Banner } from '../../../ui/Banner.js';
|
|
|
28
27
|
import { canReleasePages } from '../../results/releasePages.model.js';
|
|
29
28
|
import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
|
|
30
29
|
import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
|
|
31
|
-
export function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage }) {
|
|
30
|
+
export function ResultsBody({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }) {
|
|
32
31
|
// A different test owns an independent selection and action lifecycle.
|
|
33
32
|
return /*#__PURE__*/ _jsx(ResultsContent, {
|
|
34
33
|
id: id,
|
|
35
34
|
surface: surface,
|
|
36
35
|
onRecomputed: onRecomputed,
|
|
37
36
|
onPagesReleased: onPagesReleased,
|
|
38
|
-
renderPage: renderPage
|
|
37
|
+
renderPage: renderPage,
|
|
38
|
+
onChanged: onChanged
|
|
39
39
|
}, `${surface.apiRoute}/${id}`);
|
|
40
40
|
}
|
|
41
|
-
function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage }) {
|
|
41
|
+
function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage, onChanged }) {
|
|
42
42
|
const results = useResults(id, surface);
|
|
43
43
|
const { api, doc, round, phases, state, data } = results;
|
|
44
44
|
const manage = surface.canManage && surface.canReadResults;
|
|
@@ -382,7 +382,11 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
382
382
|
id: id,
|
|
383
383
|
arms: phase.arms,
|
|
384
384
|
checks: checks,
|
|
385
|
-
onClose: ()=>setDeciding(false)
|
|
385
|
+
onClose: ()=>setDeciding(false),
|
|
386
|
+
onSuccess: onChanged ? (doc)=>{
|
|
387
|
+
setDeciding(false);
|
|
388
|
+
onChanged(doc);
|
|
389
|
+
} : undefined
|
|
386
390
|
}) : null,
|
|
387
391
|
releasing && manage ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
|
|
388
392
|
id: id,
|
|
@@ -396,12 +400,15 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
396
400
|
}) : null
|
|
397
401
|
]
|
|
398
402
|
});
|
|
399
|
-
return
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
404
|
+
className: "xp-test-surface",
|
|
405
|
+
children: renderPage ? renderPage({
|
|
406
|
+
children: content,
|
|
407
|
+
actions,
|
|
408
|
+
released,
|
|
409
|
+
data
|
|
410
|
+
}) : content
|
|
411
|
+
});
|
|
405
412
|
}
|
|
406
413
|
function MetricTable({ metric, snapshot, phase, leader }) {
|
|
407
414
|
const rows = armRows({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:where(.xp-test-surface) .xp-setting-values { display: grid; gap: var(--xp-space-3); }
|
|
2
|
+
:where(.xp-test-surface) .xp-setting-value { white-space: pre-wrap; }
|
|
3
|
+
:where(.xp-test-surface) .xp-setting-lock { color: var(--xp-text-muted); }
|
|
4
|
+
:where(.xp-test-surface) .xp-setting-parameter fieldset { border: 0; padding: 0; margin: 0; }
|
|
5
|
+
:where(.xp-test-surface) .xp-setting-segments { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
|
|
6
|
+
:where(.xp-test-surface) .xp-setting-segments label { position: relative; }
|
|
7
|
+
:where(.xp-test-surface) .xp-setting-segments input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
|
|
8
|
+
:where(.xp-test-surface) .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
|
+
:where(.xp-test-surface) .xp-setting-segments input:checked + span { background: var(--xp-accent-subtle); border-color: var(--xp-accent); }
|
|
17
|
+
:where(.xp-test-surface) .xp-setting-segments input:focus-visible + span { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
@@ -12,7 +12,7 @@ import { sourceFor } from '../../metricSource.model.js';
|
|
|
12
12
|
import { reviewView } from '../../review/review.model.js';
|
|
13
13
|
import { CheckboxList, FieldErrors, reasonFor, save, SelectEdit } from './fields.js';
|
|
14
14
|
import { Section } from './Section.js';
|
|
15
|
-
export function GoalSection({ test, surface }) {
|
|
15
|
+
export function GoalSection({ test, surface, embedded = false }) {
|
|
16
16
|
const api = useMemo(()=>createApi(surface.apiRoute), [
|
|
17
17
|
surface.apiRoute
|
|
18
18
|
]);
|
|
@@ -83,7 +83,7 @@ export function GoalSection({ test, surface }) {
|
|
|
83
83
|
]);
|
|
84
84
|
const reason = reasonFor(test, 'metrics');
|
|
85
85
|
useEffect(()=>{
|
|
86
|
-
if (!loaded) return;
|
|
86
|
+
if (embedded || !loaded) return;
|
|
87
87
|
const url = new URL(window.location.href);
|
|
88
88
|
const goalId = url.searchParams.get('goal');
|
|
89
89
|
if (goalId == null) return;
|
|
@@ -101,6 +101,7 @@ export function GoalSection({ test, surface }) {
|
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
}, [
|
|
104
|
+
embedded,
|
|
104
105
|
loaded,
|
|
105
106
|
metrics,
|
|
106
107
|
reason,
|
|
@@ -194,6 +195,7 @@ export function GoalSection({ test, surface }) {
|
|
|
194
195
|
primaryMetricKind: kind
|
|
195
196
|
}).baseline : null;
|
|
196
197
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
198
|
+
surface: surface,
|
|
197
199
|
test: test,
|
|
198
200
|
sectionId: "win",
|
|
199
201
|
children: [
|
|
@@ -5,7 +5,7 @@ import { TEST_PAGE as C, suggestedWeeks, weeksHint } from '../../copy/testPage.j
|
|
|
5
5
|
import { durationSuggestion } from './testPage.model.js';
|
|
6
6
|
import { FieldErrors, positiveInteger, reasonFor, save, TextEdit } from './fields.js';
|
|
7
7
|
import { Section } from './Section.js';
|
|
8
|
-
export function LengthSection({ test }) {
|
|
8
|
+
export function LengthSection({ test, surface }) {
|
|
9
9
|
const doc = test.doc;
|
|
10
10
|
const reason = reasonFor(test, 'analysis');
|
|
11
11
|
const suggestion = durationSuggestion(test.preflight, doc.analysis?.plannedDurationDays);
|
|
@@ -20,6 +20,7 @@ export function LengthSection({ test }) {
|
|
|
20
20
|
}
|
|
21
21
|
}));
|
|
22
22
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
23
|
+
surface: surface,
|
|
23
24
|
test: test,
|
|
24
25
|
sectionId: "length",
|
|
25
26
|
children: [
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { SECTION_ORDER } from '../contracts.js';
|
|
5
|
+
import { sectionBlocked } from '../readiness/readiness.model.js';
|
|
5
6
|
import { readinessParts } from '../readiness/parts.js';
|
|
6
7
|
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
8
|
+
import { READINESS_COPY } from '../../copy/readiness.js';
|
|
7
9
|
import { jumpToSection } from './jumpToSection.js';
|
|
8
10
|
export function Rail({ test }) {
|
|
9
11
|
const [active, setActive] = useState('what');
|
|
10
12
|
const ref = useRef(null);
|
|
11
13
|
const done = readinessParts.sectionDone(test);
|
|
14
|
+
const blocked = (id)=>(test.doc?.status === 'draft' || test.doc?.status === 'stopped') && sectionBlocked(test, id);
|
|
12
15
|
useEffect(()=>{
|
|
13
16
|
if (typeof IntersectionObserver === 'undefined') return;
|
|
14
17
|
const visible = new Map();
|
|
@@ -53,7 +56,7 @@ export function Rail({ test }) {
|
|
|
53
56
|
children: SECTION_ORDER.map((id)=>/*#__PURE__*/ _jsx("li", {
|
|
54
57
|
children: /*#__PURE__*/ _jsxs("a", {
|
|
55
58
|
href: `#section-${id}`,
|
|
56
|
-
className: `xp-test-rail-item${id === 'advanced' ? ' xp-test-rail-item--advanced' : ''}${active === id ? ' is-active' : ''}`,
|
|
59
|
+
className: `xp-test-rail-item${blocked(id) ? ' is-blocked' : ''}${id === 'advanced' ? ' xp-test-rail-item--advanced' : ''}${active === id ? ' is-active' : ''}`,
|
|
57
60
|
"aria-current": active === id ? 'location' : undefined,
|
|
58
61
|
onClick: (event)=>{
|
|
59
62
|
event.preventDefault();
|
|
@@ -65,12 +68,12 @@ export function Rail({ test }) {
|
|
|
65
68
|
children: [
|
|
66
69
|
/*#__PURE__*/ _jsx("span", {
|
|
67
70
|
"aria-hidden": "true",
|
|
68
|
-
className: done[id] ? 'xp-test-rail-mark xp-test-rail-mark--done' : 'xp-test-rail-mark',
|
|
69
|
-
children: done[id] ? C.completeMark : C.incompleteMark
|
|
71
|
+
className: blocked(id) ? 'xp-test-rail-mark xp-test-rail-mark--blocked' : done[id] ? 'xp-test-rail-mark xp-test-rail-mark--done' : 'xp-test-rail-mark',
|
|
72
|
+
children: blocked(id) ? '!' : done[id] ? C.completeMark : C.incompleteMark
|
|
70
73
|
}),
|
|
71
74
|
/*#__PURE__*/ _jsx("span", {
|
|
72
75
|
className: "xp-test-sr-only",
|
|
73
|
-
children: done[id] ? C.completePrefix : C.incompletePrefix
|
|
76
|
+
children: blocked(id) ? READINESS_COPY.needsAttentionPrefix : done[id] ? C.completePrefix : C.incompletePrefix
|
|
74
77
|
})
|
|
75
78
|
]
|
|
76
79
|
}) : null,
|
|
@@ -26,8 +26,7 @@ import { ReadinessContent } from '../readiness/Banner.js';
|
|
|
26
26
|
role: "region",
|
|
27
27
|
"aria-label": C.label,
|
|
28
28
|
children: props.test.doc ? /*#__PURE__*/ _jsx(ReadinessContent, {
|
|
29
|
-
...props
|
|
30
|
-
bar: true
|
|
29
|
+
...props
|
|
31
30
|
}, `${props.test.doc.id}/${props.test.doc.status}`) : null
|
|
32
31
|
});
|
|
33
32
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { SectionId, TestDocApi } from '../contracts.js';
|
|
3
|
-
|
|
3
|
+
import type { SurfaceProps } from '../contracts.js';
|
|
4
|
+
export declare function Section({ test, sectionId, children, surface }: {
|
|
4
5
|
test: TestDocApi;
|
|
5
6
|
sectionId: SectionId;
|
|
6
7
|
children: ReactNode;
|
|
8
|
+
surface?: SurfaceProps;
|
|
7
9
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { blockingSteps, pageReadinessContext, sectionBlocked } from '../readiness/readiness.model.js';
|
|
5
|
+
import { readinessParts } from '../readiness/parts.js';
|
|
6
|
+
import { SectionCard } from '../../../ui/SectionCard.js';
|
|
7
|
+
import { SECTION_ORDER } from '../contracts.js';
|
|
8
|
+
import { fixFieldsNext } from '../../copy/readiness.js';
|
|
9
|
+
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
10
|
+
export function Section({ test, sectionId, children, surface }) {
|
|
11
|
+
const hasAdvancedError = Object.keys(test.errors).some((path)=>path.startsWith('analysis.') && ![
|
|
12
|
+
'analysis.reachPerDay',
|
|
13
|
+
'analysis.plannedDurationDays'
|
|
14
|
+
].includes(path) || path === 'exposurePolicy');
|
|
15
|
+
const [open, setOpen] = useState(hasAdvancedError);
|
|
16
|
+
const [prevHasAdvancedError, setPrevHasAdvancedError] = useState(hasAdvancedError);
|
|
17
|
+
if (hasAdvancedError !== prevHasAdvancedError) {
|
|
18
|
+
setPrevHasAdvancedError(hasAdvancedError);
|
|
19
|
+
if (hasAdvancedError) setOpen(true);
|
|
20
|
+
}
|
|
21
|
+
const setup = test.doc?.status === 'draft' || test.doc?.status === 'stopped';
|
|
22
|
+
const blocked = setup && sectionBlocked(test, sectionId);
|
|
23
|
+
const blockers = setup && test.doc ? blockingSteps(test.preflight, surface ? pageReadinessContext(test.doc, test.preflight, surface) : test.doc).filter((step)=>step.section === sectionId) : [];
|
|
24
|
+
const done = readinessParts.sectionDone(test)[sectionId];
|
|
25
|
+
const blockerLines = blockers.map((step, index)=>/*#__PURE__*/ _jsxs("p", {
|
|
26
|
+
className: "xp-ui-error xp-test-blocker",
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ _jsx("span", {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: "⊗ "
|
|
31
|
+
}),
|
|
32
|
+
step.sentence
|
|
33
|
+
]
|
|
34
|
+
}, `${step.code}-${index}`));
|
|
35
|
+
if (setup && sectionId === 'advanced' && hasAdvancedError) blockerLines.push(/*#__PURE__*/ _jsxs("p", {
|
|
36
|
+
className: "xp-ui-error xp-test-blocker",
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ _jsx("span", {
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
children: "⊗ "
|
|
41
|
+
}),
|
|
42
|
+
fixFieldsNext(C.sections.advanced)
|
|
43
|
+
]
|
|
44
|
+
}, "advanced-validation"));
|
|
45
|
+
if (sectionId === 'advanced') return /*#__PURE__*/ _jsxs("details", {
|
|
46
|
+
open: open,
|
|
47
|
+
onToggle: (event)=>setOpen(event.currentTarget.open),
|
|
48
|
+
className: `xp-test-advanced${blocked ? ' xp-ui-section--blocked' : ''}`,
|
|
49
|
+
id: "section-advanced",
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
52
|
+
children: /*#__PURE__*/ _jsx("h2", {
|
|
53
|
+
id: "title-advanced",
|
|
54
|
+
tabIndex: -1,
|
|
55
|
+
children: C.sections.advanced
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
59
|
+
className: "xp-ui-section-body",
|
|
60
|
+
children: [
|
|
61
|
+
children,
|
|
62
|
+
blockerLines
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/ _jsxs(SectionCard, {
|
|
68
|
+
number: SECTION_ORDER.indexOf(sectionId) + 1,
|
|
69
|
+
title: C.sections[sectionId],
|
|
70
|
+
complete: done,
|
|
71
|
+
blocked: blocked,
|
|
72
|
+
id: `section-${sectionId}`,
|
|
73
|
+
headingId: `title-${sectionId}`,
|
|
74
|
+
className: "xp-test-section",
|
|
75
|
+
children: [
|
|
76
|
+
children,
|
|
77
|
+
blockerLines
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
@@ -22,6 +22,7 @@ export function TargetingSection({ test, surface }) {
|
|
|
22
22
|
const blockPath = (key)=>test.doc.kind === 'block' && key === 'path';
|
|
23
23
|
const keys = Object.keys(surface.attributeKeys).filter((key)=>!blockPath(key));
|
|
24
24
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
25
|
+
surface: surface,
|
|
25
26
|
test: test,
|
|
26
27
|
sectionId: "who",
|
|
27
28
|
children: [
|
|
@@ -179,6 +180,10 @@ export function TargetingSection({ test, surface }) {
|
|
|
179
180
|
]
|
|
180
181
|
}, `${rowsRevision}-${index}`);
|
|
181
182
|
}),
|
|
183
|
+
!reason && !keys.length ? /*#__PURE__*/ _jsx("p", {
|
|
184
|
+
className: "xp-ui-help",
|
|
185
|
+
children: C.noAudienceRules
|
|
186
|
+
}) : null,
|
|
182
187
|
!reason ? /*#__PURE__*/ _jsx("div", {
|
|
183
188
|
className: "xp-ui-button-group",
|
|
184
189
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { DocId } from '../../../types/contracts.js';
|
|
3
|
+
import type { SurfaceProps, TestDocApi } from '../contracts.js';
|
|
4
|
+
import type { TestDocument } from '../testDocument.model.js';
|
|
5
|
+
import type { PreflightResult } from '../../../types/endpoints.js';
|
|
6
|
+
import './testPage.css';
|
|
7
|
+
export declare function TestSurface({ id, surface, onTitleChange, renderFrame, embedded, onDocument, onPreflight, requestPreflight }: {
|
|
8
|
+
id: DocId;
|
|
9
|
+
surface: SurfaceProps;
|
|
10
|
+
onTitleChange?: (title: string) => void;
|
|
11
|
+
embedded?: boolean;
|
|
12
|
+
renderFrame?: (content: {
|
|
13
|
+
test: TestDocApi;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}) => ReactNode;
|
|
16
|
+
onDocument?: (doc: TestDocument) => void;
|
|
17
|
+
onPreflight?: (preflight: PreflightResult) => void;
|
|
18
|
+
requestPreflight?: (signal: AbortSignal, supersede?: boolean) => Promise<Response>;
|
|
19
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { useTestDocument } from '../useTestDocument.js';
|
|
5
|
+
import { API_MESSAGES } from '../../copy/common.js';
|
|
6
|
+
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
7
|
+
import { pageBlockParts } from '../pageBlock/parts.js';
|
|
8
|
+
import { settingParts } from '../setting/parts.js';
|
|
9
|
+
import { pageParts } from './pageParts.js';
|
|
10
|
+
import { Section } from './Section.js';
|
|
11
|
+
import { Hypothesis, TestName } from './fields.js';
|
|
12
|
+
import { VersionsSection } from './VersionsSection.js';
|
|
13
|
+
import { GoalSection } from './GoalSection.js';
|
|
14
|
+
import { TargetingSection } from './TargetingSection.js';
|
|
15
|
+
import { LengthSection } from './LengthSection.js';
|
|
16
|
+
import { AdvancedSection } from './AdvancedSection.js';
|
|
17
|
+
import { Button } from '../../../ui/Button.js';
|
|
18
|
+
import { Banner } from '../../../ui/Feedback.js';
|
|
19
|
+
import { Rail } from './Rail.js';
|
|
20
|
+
import { ReadinessBar } from './ReadinessBar.js';
|
|
21
|
+
import { ResultsBody } from '../results/ResultsBody.js';
|
|
22
|
+
import { usePlacementNotice } from '../../../puck/editor/usePlacementNotice.js';
|
|
23
|
+
import { subscribePlacements, cachedPreflight, cachedReadinessRead, placementsPending, placementsBlocking, placementReadError } from '../../../puck/editor/placementsCache.js';
|
|
24
|
+
import { currentPuckDocument } from '../../../puck/editor/editor.model.js';
|
|
25
|
+
import { editorPlacementMessage, editorPreflight } from '../editorPlacement.js';
|
|
26
|
+
import './testPage.css';
|
|
27
|
+
export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded = false, onDocument, onPreflight, requestPreflight }) {
|
|
28
|
+
const [barHeight, setBarHeight] = useState();
|
|
29
|
+
const documentState = useTestDocument(id, {
|
|
30
|
+
apiRoute: surface.apiRoute,
|
|
31
|
+
refetchPreflightOnFocus: true,
|
|
32
|
+
...!surface.canManage ? {
|
|
33
|
+
enabled: false
|
|
34
|
+
} : {},
|
|
35
|
+
...onDocument ? {
|
|
36
|
+
onDocument
|
|
37
|
+
} : {},
|
|
38
|
+
...onPreflight ? {
|
|
39
|
+
onPreflight
|
|
40
|
+
} : {},
|
|
41
|
+
...requestPreflight ? {
|
|
42
|
+
requestPreflight
|
|
43
|
+
} : {}
|
|
44
|
+
});
|
|
45
|
+
const [placementRead, setPlacementRead] = useState();
|
|
46
|
+
const placementKey = JSON.stringify([
|
|
47
|
+
surface.apiRoute,
|
|
48
|
+
String(id)
|
|
49
|
+
]);
|
|
50
|
+
const watching = embedded && surface.canManage && documentState.loadState === 'ready';
|
|
51
|
+
useEffect(()=>{
|
|
52
|
+
if (!embedded || !surface.canManage) return;
|
|
53
|
+
return subscribePlacements(surface.apiRoute, id, ()=>setPlacementRead({
|
|
54
|
+
key: placementKey,
|
|
55
|
+
preflight: cachedPreflight(surface.apiRoute, id),
|
|
56
|
+
read: cachedReadinessRead(surface.apiRoute, id),
|
|
57
|
+
pending: placementsPending(surface.apiRoute, id),
|
|
58
|
+
blocking: placementsBlocking(surface.apiRoute, id),
|
|
59
|
+
error: placementReadError(surface.apiRoute, id)
|
|
60
|
+
}));
|
|
61
|
+
}, [
|
|
62
|
+
surface.apiRoute,
|
|
63
|
+
id,
|
|
64
|
+
embedded,
|
|
65
|
+
surface.canManage,
|
|
66
|
+
placementKey
|
|
67
|
+
]);
|
|
68
|
+
const currentRead = documentState.loadState === 'ready' && placementRead?.key === placementKey ? placementRead : undefined;
|
|
69
|
+
const preflight = currentRead ? currentRead.preflight ?? (currentRead.pending && !currentRead.error ? documentState.preflight : null) : documentState.preflight;
|
|
70
|
+
const sharedDocument = currentRead ? {
|
|
71
|
+
...documentState,
|
|
72
|
+
preflight,
|
|
73
|
+
preflightRead: currentRead.read,
|
|
74
|
+
preflightPending: currentRead.pending || documentState.preflightPending,
|
|
75
|
+
preflightError: !preflight ? currentRead.read?.message ?? null : null
|
|
76
|
+
} : documentState;
|
|
77
|
+
const placementFailed = preflight?.checks.some((check)=>!check.ok && check.code === 'no-placements' && check.detail !== undefined);
|
|
78
|
+
const lastPlacements = useRef(undefined);
|
|
79
|
+
if (preflight?.placements && !placementFailed) lastPlacements.current = {
|
|
80
|
+
key: placementKey,
|
|
81
|
+
value: preflight.placements
|
|
82
|
+
};
|
|
83
|
+
const placements = !placementFailed && !sharedDocument.preflightError && lastPlacements.current?.key === placementKey ? lastPlacements.current.value : undefined;
|
|
84
|
+
const editorPage = embedded ? currentPuckDocument(window.location.pathname, surface.adminRoute, placements) ?? surface.editorPage : surface.editorPage;
|
|
85
|
+
const message = editorPlacementMessage(placements, editorPage, documentState.doc?.status);
|
|
86
|
+
surface = {
|
|
87
|
+
...surface,
|
|
88
|
+
editorPage,
|
|
89
|
+
editorPlacementMessage: message
|
|
90
|
+
};
|
|
91
|
+
usePlacementNotice(surface.apiRoute, id, watching ? sharedDocument.preflightError ?? (placementFailed ? placementReadError(surface.apiRoute, id) : message) : undefined);
|
|
92
|
+
const setup = documentState.doc?.status === 'draft' || documentState.doc?.status === 'stopped';
|
|
93
|
+
const test = setup ? {
|
|
94
|
+
...sharedDocument,
|
|
95
|
+
preflight: editorPreflight(preflight, surface)
|
|
96
|
+
} : sharedDocument;
|
|
97
|
+
useEffect(()=>{
|
|
98
|
+
if (test.doc?.name) onTitleChange?.(test.doc.name);
|
|
99
|
+
}, [
|
|
100
|
+
test.doc?.name,
|
|
101
|
+
onTitleChange
|
|
102
|
+
]);
|
|
103
|
+
const frame = (body)=>{
|
|
104
|
+
const children = /*#__PURE__*/ _jsx("div", {
|
|
105
|
+
className: "xp-test-surface",
|
|
106
|
+
children: body
|
|
107
|
+
});
|
|
108
|
+
return renderFrame ? renderFrame({
|
|
109
|
+
test,
|
|
110
|
+
children
|
|
111
|
+
}) : children;
|
|
112
|
+
};
|
|
113
|
+
// Results readers have no permission to load the manager-only test/preflight.
|
|
114
|
+
if (!surface.canManage) return frame(/*#__PURE__*/ _jsx(ResultsBody, {
|
|
115
|
+
id: id,
|
|
116
|
+
surface: surface
|
|
117
|
+
}));
|
|
118
|
+
if (test.loadState !== 'ready' || !test.doc) return frame(/*#__PURE__*/ _jsxs("div", {
|
|
119
|
+
className: "xp-test-page",
|
|
120
|
+
role: test.loadState === 'error' ? 'alert' : 'status',
|
|
121
|
+
children: [
|
|
122
|
+
/*#__PURE__*/ _jsx("p", {
|
|
123
|
+
children: test.preflightRead?.kind === 'signed-out' ? API_MESSAGES.unauthenticated : test.loadState === 'forbidden' ? C.forbidden : test.loadState === 'missing' ? C.missing : test.loadState === 'error' ? C.error : C.loading
|
|
124
|
+
}),
|
|
125
|
+
test.preflightRead?.retry ?? test.loadState === 'error' ? /*#__PURE__*/ _jsx(Button, {
|
|
126
|
+
onClick: ()=>void test.reload(),
|
|
127
|
+
children: C.retry
|
|
128
|
+
}) : null
|
|
129
|
+
]
|
|
130
|
+
}));
|
|
131
|
+
const parts = test.doc.kind === 'block' ? pageBlockParts : test.doc.kind === 'page' ? pageParts : settingParts;
|
|
132
|
+
const props = {
|
|
133
|
+
test,
|
|
134
|
+
surface
|
|
135
|
+
};
|
|
136
|
+
return frame(/*#__PURE__*/ _jsxs("div", {
|
|
137
|
+
className: "xp-test-page xp-test-page--setup",
|
|
138
|
+
style: {
|
|
139
|
+
paddingBottom: embedded || barHeight === undefined ? undefined : `${barHeight}px`
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
143
|
+
className: "xp-test-layout",
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ _jsx(Rail, {
|
|
146
|
+
test: test
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
149
|
+
className: "xp-test-content",
|
|
150
|
+
children: [
|
|
151
|
+
test.errors._section ? /*#__PURE__*/ _jsx(Banner, {
|
|
152
|
+
tone: "error",
|
|
153
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
154
|
+
onClick: ()=>void test.reload(),
|
|
155
|
+
children: C.reload
|
|
156
|
+
}),
|
|
157
|
+
children: test.errors._section
|
|
158
|
+
}) : null,
|
|
159
|
+
/*#__PURE__*/ _jsxs(Section, {
|
|
160
|
+
surface: surface,
|
|
161
|
+
test: test,
|
|
162
|
+
sectionId: "what",
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ _jsx(TestName, {
|
|
165
|
+
...props
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx(parts.Binding, {
|
|
168
|
+
...props
|
|
169
|
+
}),
|
|
170
|
+
/*#__PURE__*/ _jsx(Hypothesis, {
|
|
171
|
+
...props
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ _jsx(VersionsSection, {
|
|
176
|
+
...props,
|
|
177
|
+
parts: parts,
|
|
178
|
+
contentOnCanvas: embedded
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx(GoalSection, {
|
|
181
|
+
...props,
|
|
182
|
+
embedded: embedded
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ _jsx(TargetingSection, {
|
|
185
|
+
...props
|
|
186
|
+
}),
|
|
187
|
+
/*#__PURE__*/ _jsx(LengthSection, {
|
|
188
|
+
...props
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ _jsx(AdvancedSection, {
|
|
191
|
+
...props
|
|
192
|
+
}),
|
|
193
|
+
embedded && surface.canReadResults && test.doc.status !== 'draft' ? /*#__PURE__*/ _jsx(ResultsBody, {
|
|
194
|
+
id: id,
|
|
195
|
+
surface: surface,
|
|
196
|
+
onChanged: (doc)=>{
|
|
197
|
+
test.acceptTransition?.({
|
|
198
|
+
doc
|
|
199
|
+
});
|
|
200
|
+
void test.reload();
|
|
201
|
+
}
|
|
202
|
+
}, `${test.doc.id}/${test.doc.phase}/${test.doc.status}`) : null
|
|
203
|
+
]
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
}),
|
|
207
|
+
/*#__PURE__*/ _jsx(ReadinessBar, {
|
|
208
|
+
...props,
|
|
209
|
+
onHeightChange: setBarHeight
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
@@ -20,7 +20,7 @@ const COLOURS = {
|
|
|
20
20
|
variantC: 'var(--xp-series-c)',
|
|
21
21
|
holdout: 'var(--xp-series-muted)'
|
|
22
22
|
};
|
|
23
|
-
export function VersionsSection({ test, surface, parts }) {
|
|
23
|
+
export function VersionsSection({ test, surface, parts, contentOnCanvas = false }) {
|
|
24
24
|
const id = useId();
|
|
25
25
|
const doc = test.doc;
|
|
26
26
|
const [weightEdit, setWeightEdit] = useState(null);
|
|
@@ -48,12 +48,16 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
48
48
|
}));
|
|
49
49
|
};
|
|
50
50
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
51
|
+
surface: surface,
|
|
51
52
|
test: test,
|
|
52
53
|
sectionId: "versions",
|
|
53
54
|
children: [
|
|
54
55
|
doc.kind === 'page' && testPageCollection(surface.pageCollections, doc, test.preflight?.pagePlacements)?.contentChecks === false ? /*#__PURE__*/ _jsx("p", {
|
|
55
56
|
children: PAGE_COPY.contentChecksOff
|
|
56
57
|
}) : null,
|
|
58
|
+
contentOnCanvas ? /*#__PURE__*/ _jsx("p", {
|
|
59
|
+
children: C.editVersionsOnCanvas
|
|
60
|
+
}) : null,
|
|
57
61
|
reason ? /*#__PURE__*/ _jsx("p", {
|
|
58
62
|
className: "xp-ui-help",
|
|
59
63
|
children: reason
|
|
@@ -80,7 +84,9 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
80
84
|
id: `xp-version-${arm.key}`,
|
|
81
85
|
tabIndex: -1,
|
|
82
86
|
children: [
|
|
83
|
-
/*#__PURE__*/ _jsx(
|
|
87
|
+
contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
|
|
88
|
+
children: arm.label
|
|
89
|
+
}) : /*#__PURE__*/ _jsx(TextEdit, {
|
|
84
90
|
label: `${GROUP_LABELS[arm.key]}: ${C.label}`,
|
|
85
91
|
value: arm.label,
|
|
86
92
|
reason: reason,
|
|
@@ -111,11 +117,12 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
111
117
|
/*#__PURE__*/ _jsx(parts.VersionContent, {
|
|
112
118
|
test: test,
|
|
113
119
|
surface: surface,
|
|
114
|
-
armIndex: index
|
|
120
|
+
armIndex: index,
|
|
121
|
+
summary: contentOnCanvas
|
|
115
122
|
}),
|
|
116
123
|
/*#__PURE__*/ _jsx("div", {
|
|
117
124
|
className: "xp-ui-button-group xp-version-remove",
|
|
118
|
-
children: arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
|
|
125
|
+
children: !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
|
|
119
126
|
variant: "quiet",
|
|
120
127
|
size: "sm",
|
|
121
128
|
disabled: Boolean(reason),
|
|
@@ -175,7 +182,7 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
175
182
|
role: "alert",
|
|
176
183
|
children: test.errors.arms
|
|
177
184
|
}) : null,
|
|
178
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
185
|
+
!contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
|
|
179
186
|
className: "xp-section-actions xp-ui-button-group",
|
|
180
187
|
title: reason ?? undefined,
|
|
181
188
|
children: [
|
|
@@ -195,7 +202,7 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
195
202
|
children: C.split
|
|
196
203
|
})
|
|
197
204
|
]
|
|
198
|
-
}),
|
|
205
|
+
}) : null,
|
|
199
206
|
doc.kind !== 'page' && doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
|
|
200
207
|
className: "xp-ui-help",
|
|
201
208
|
children: ARMS_COPY.holdout
|