@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,53 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { PAGE_COPY as C, openCollectionCopy, openOriginalCopy } from '../../copy/pages.js';
|
|
4
|
-
export function CopyRoute({ collection, children }) {
|
|
5
|
-
const link = /*#__PURE__*/ _jsx("a", {
|
|
6
|
-
href: collection.copyUrl,
|
|
7
|
-
target: "_blank",
|
|
8
|
-
rel: "noopener",
|
|
9
|
-
children: collection.copyLabel ?? openCollectionCopy(collection.label)
|
|
10
|
-
});
|
|
11
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
12
|
-
className: "xp-copy-route",
|
|
13
|
-
children: [
|
|
14
|
-
/*#__PURE__*/ _jsx("div", {
|
|
15
|
-
className: "xp-copy-route-action"
|
|
16
|
-
}),
|
|
17
|
-
collection.copyHint ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
18
|
-
children: [
|
|
19
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
20
|
-
children: [
|
|
21
|
-
collection.copyHint,
|
|
22
|
-
' ',
|
|
23
|
-
link
|
|
24
|
-
]
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ _jsx("p", {
|
|
27
|
-
children: C.ownAddress
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
}) : /*#__PURE__*/ _jsxs("ol", {
|
|
31
|
-
children: [
|
|
32
|
-
/*#__PURE__*/ _jsxs("li", {
|
|
33
|
-
children: [
|
|
34
|
-
openOriginalCopy(collection.label),
|
|
35
|
-
' ',
|
|
36
|
-
link
|
|
37
|
-
]
|
|
38
|
-
}),
|
|
39
|
-
/*#__PURE__*/ _jsx("li", {
|
|
40
|
-
children: C.duplicateStep
|
|
41
|
-
}),
|
|
42
|
-
/*#__PURE__*/ _jsx("li", {
|
|
43
|
-
children: C.ownAddress
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ _jsx("p", {
|
|
48
|
-
children: C.thenChoose
|
|
49
|
-
}),
|
|
50
|
-
children
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TestDocApi } from '../contracts.js';
|
|
2
|
-
import type { PageCollection } from './pagePicker.model.js';
|
|
3
|
-
/** Mount on open; every reopen and return from another tab refreshes the current query. */
|
|
4
|
-
export declare function PagePicker({ collection, test, armKey, apiRoute, onChoose }: {
|
|
5
|
-
collection: PageCollection;
|
|
6
|
-
test: TestDocApi;
|
|
7
|
-
armKey: string;
|
|
8
|
-
apiRoute: string;
|
|
9
|
-
onChoose?: () => void;
|
|
10
|
-
}): import("react").JSX.Element;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { createApi } from '../../api.js';
|
|
5
|
-
import { PAGE_COPY as C } from '../../copy/pages.js';
|
|
6
|
-
import { reasonFor } from '../test/fields.js';
|
|
7
|
-
import { disabledPageReason, isLatestPageRequest } from './pagePicker.model.js';
|
|
8
|
-
/** Mount on open; every reopen and return from another tab refreshes the current query. */ export function PagePicker({ collection, test, armKey, apiRoute, onChoose }) {
|
|
9
|
-
const api = useMemo(()=>createApi(apiRoute), [
|
|
10
|
-
apiRoute
|
|
11
|
-
]);
|
|
12
|
-
const id = useId();
|
|
13
|
-
const [search, setSearch] = useState('');
|
|
14
|
-
const [q, setQuery] = useState('');
|
|
15
|
-
const [page, setPage] = useState(1);
|
|
16
|
-
const [refresh, setRefresh] = useState(0);
|
|
17
|
-
const [rows, setRows] = useState([]);
|
|
18
|
-
const [more, setMore] = useState(false);
|
|
19
|
-
const [loading, setLoading] = useState(true);
|
|
20
|
-
const [error, setError] = useState('');
|
|
21
|
-
const revision = useRef(0);
|
|
22
|
-
const reload = ()=>{
|
|
23
|
-
setPage(1);
|
|
24
|
-
setRefresh((value)=>value + 1);
|
|
25
|
-
};
|
|
26
|
-
useEffect(()=>{
|
|
27
|
-
if (search === q) return;
|
|
28
|
-
const timer = setTimeout(()=>{
|
|
29
|
-
setQuery(search);
|
|
30
|
-
setPage(1);
|
|
31
|
-
setRows([]);
|
|
32
|
-
setMore(false);
|
|
33
|
-
setLoading(true);
|
|
34
|
-
setError('');
|
|
35
|
-
}, 250);
|
|
36
|
-
return ()=>clearTimeout(timer);
|
|
37
|
-
}, [
|
|
38
|
-
search,
|
|
39
|
-
q
|
|
40
|
-
]);
|
|
41
|
-
useEffect(()=>{
|
|
42
|
-
let lastReturn = -Infinity;
|
|
43
|
-
const focus = ()=>{
|
|
44
|
-
if (document.visibilityState !== 'visible' || Date.now() - lastReturn < 100) return;
|
|
45
|
-
lastReturn = Date.now();
|
|
46
|
-
setPage(1);
|
|
47
|
-
setRefresh((value)=>value + 1);
|
|
48
|
-
};
|
|
49
|
-
const visible = ()=>{
|
|
50
|
-
if (document.visibilityState === 'visible') focus();
|
|
51
|
-
};
|
|
52
|
-
window.addEventListener('focus', focus);
|
|
53
|
-
document.addEventListener('visibilitychange', visible);
|
|
54
|
-
return ()=>{
|
|
55
|
-
window.removeEventListener('focus', focus);
|
|
56
|
-
document.removeEventListener('visibilitychange', visible);
|
|
57
|
-
};
|
|
58
|
-
}, []);
|
|
59
|
-
useEffect(()=>{
|
|
60
|
-
const controller = new AbortController();
|
|
61
|
-
const request = ++revision.current;
|
|
62
|
-
setLoading(true);
|
|
63
|
-
setError('');
|
|
64
|
-
void api.pages({
|
|
65
|
-
collection: collection.slug,
|
|
66
|
-
q,
|
|
67
|
-
page
|
|
68
|
-
}, controller.signal).then((result)=>{
|
|
69
|
-
if (controller.signal.aborted || !isLatestPageRequest(request, revision.current)) return;
|
|
70
|
-
if (result.ok && result.data) {
|
|
71
|
-
const docs = result.data.docs;
|
|
72
|
-
setRows((current)=>{
|
|
73
|
-
const combined = page === 1 ? docs : [
|
|
74
|
-
...current,
|
|
75
|
-
...docs
|
|
76
|
-
];
|
|
77
|
-
return combined.filter((row, index)=>combined.findIndex((item)=>item.id === row.id) === index);
|
|
78
|
-
});
|
|
79
|
-
setMore(result.data.hasNextPage);
|
|
80
|
-
} else {
|
|
81
|
-
setMore(false);
|
|
82
|
-
setError(C.error);
|
|
83
|
-
}
|
|
84
|
-
setLoading(false);
|
|
85
|
-
});
|
|
86
|
-
return ()=>controller.abort();
|
|
87
|
-
}, [
|
|
88
|
-
api,
|
|
89
|
-
collection.slug,
|
|
90
|
-
q,
|
|
91
|
-
page,
|
|
92
|
-
refresh
|
|
93
|
-
]);
|
|
94
|
-
const reason = reasonFor(test, 'arms');
|
|
95
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
96
|
-
className: "xp-page-picker",
|
|
97
|
-
children: [
|
|
98
|
-
/*#__PURE__*/ _jsx("label", {
|
|
99
|
-
htmlFor: id,
|
|
100
|
-
children: C.search
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ _jsx("input", {
|
|
103
|
-
id: id,
|
|
104
|
-
type: "search",
|
|
105
|
-
value: search,
|
|
106
|
-
onChange: (event)=>setSearch(event.currentTarget.value)
|
|
107
|
-
}),
|
|
108
|
-
loading && !rows.length ? /*#__PURE__*/ _jsx("p", {
|
|
109
|
-
role: "status",
|
|
110
|
-
children: C.loading
|
|
111
|
-
}) : null,
|
|
112
|
-
error ? /*#__PURE__*/ _jsxs("p", {
|
|
113
|
-
role: "alert",
|
|
114
|
-
children: [
|
|
115
|
-
error,
|
|
116
|
-
" ",
|
|
117
|
-
/*#__PURE__*/ _jsx("button", {
|
|
118
|
-
type: "button",
|
|
119
|
-
onClick: reload,
|
|
120
|
-
children: C.retry
|
|
121
|
-
})
|
|
122
|
-
]
|
|
123
|
-
}) : null,
|
|
124
|
-
!rows.length ? !loading && !error ? /*#__PURE__*/ _jsx("p", {
|
|
125
|
-
children: C.empty
|
|
126
|
-
}) : null : /*#__PURE__*/ _jsx("ul", {
|
|
127
|
-
children: rows.map((row)=>{
|
|
128
|
-
const disabled = reason ?? disabledPageReason(row, armKey, test.doc?.arms ?? [], test.preflight?.pagePlacements, test.chosenPages, collection.label, collection.slug);
|
|
129
|
-
return /*#__PURE__*/ _jsxs("li", {
|
|
130
|
-
children: [
|
|
131
|
-
/*#__PURE__*/ _jsxs("button", {
|
|
132
|
-
type: "button",
|
|
133
|
-
disabled: !!disabled || test.saving === 'saving',
|
|
134
|
-
onClick: ()=>{
|
|
135
|
-
const arm = test.doc?.arms.find((item)=>item.key === armKey);
|
|
136
|
-
if (!arm || row.path === null || disabled) return;
|
|
137
|
-
void test.choosePage(arm.key, {
|
|
138
|
-
id: row.id,
|
|
139
|
-
path: row.path
|
|
140
|
-
});
|
|
141
|
-
onChoose?.();
|
|
142
|
-
},
|
|
143
|
-
children: [
|
|
144
|
-
/*#__PURE__*/ _jsx("strong", {
|
|
145
|
-
children: row.title
|
|
146
|
-
}),
|
|
147
|
-
' ',
|
|
148
|
-
row.path,
|
|
149
|
-
!row.published ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
150
|
-
children: [
|
|
151
|
-
" · ",
|
|
152
|
-
C.draft
|
|
153
|
-
]
|
|
154
|
-
}) : null
|
|
155
|
-
]
|
|
156
|
-
}),
|
|
157
|
-
disabled ? /*#__PURE__*/ _jsx("p", {
|
|
158
|
-
children: disabled
|
|
159
|
-
}) : null
|
|
160
|
-
]
|
|
161
|
-
}, row.id);
|
|
162
|
-
})
|
|
163
|
-
}),
|
|
164
|
-
more ? /*#__PURE__*/ _jsx("button", {
|
|
165
|
-
type: "button",
|
|
166
|
-
disabled: loading,
|
|
167
|
-
onClick: ()=>setPage((value)=>value + 1),
|
|
168
|
-
children: C.more
|
|
169
|
-
}) : null
|
|
170
|
-
]
|
|
171
|
-
});
|
|
172
|
-
}
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { DocsResponseError, fetchAllDocs } from '../../../lib/fetchAllDocs.js';
|
|
4
|
-
import { usePlacementLabels, placementDetailKey } from '../../placements/usePlacementLabels.js';
|
|
5
|
-
import { placementUncheckedCopy } from '../../copy/readiness.js';
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
7
|
-
import { Button } from '../../../ui/Button.js';
|
|
8
|
-
import { TextInput } from '../../../ui/Inputs.js';
|
|
9
|
-
import { Dialog } from '../../../ui/Dialog.js';
|
|
10
|
-
import { MakeContentResult } from '../../actions/MakeContentResult.js';
|
|
11
|
-
import { expectedConfirm, matchesConfirm } from '../../../transitions/confirmPhrases.js';
|
|
12
|
-
import { ACTIONS_COPY as A, addMetricWarningCopy } from '../../copy/actions.js';
|
|
13
|
-
import { REVIEW_COPY as R } from '../../copy/review.js';
|
|
14
|
-
import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
15
|
-
import { API_MESSAGES, refusalMessage } from '../../copy/common.js';
|
|
16
|
-
import { createApi } from '../../api.js';
|
|
17
|
-
import { useTransition } from './useTransition.js';
|
|
18
|
-
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */ export function ConfirmAction({ test, surface, action, winnerLabel, onClose }) {
|
|
19
|
-
const api = createApi(surface.apiRoute);
|
|
20
|
-
const [typed, setTyped] = useState('');
|
|
21
|
-
const [content, setContent] = useState(null);
|
|
22
|
-
const [reportBusy, setReportBusy] = useState(false);
|
|
23
|
-
const transition = useTransition(test, onClose);
|
|
24
|
-
const phrase = action.confirm.phrase ? expectedConfirm(action.confirm.phrase.action, winnerLabel) : null;
|
|
25
|
-
const ready = action.id !== 'start' || Boolean(test.preflight && !test.preflightPending && !test.preflightError && test.preflight.checks.every((check)=>check.ok));
|
|
26
|
-
const enabled = ready && !transition.busy && !test.hasUnsaved && test.saving !== 'saving' && (!phrase || matchesConfirm(phrase, typed));
|
|
27
|
-
async function submit(finish = false) {
|
|
28
|
-
if (!enabled || !test.doc) return;
|
|
29
|
-
const id = test.doc.id;
|
|
30
|
-
await transition.run(async ()=>{
|
|
31
|
-
if (finish) return api.archive(id, {
|
|
32
|
-
mode: 'after-content'
|
|
33
|
-
});
|
|
34
|
-
if (action.archive) return api.archive(id, {
|
|
35
|
-
...action.archive,
|
|
36
|
-
...phrase ? {
|
|
37
|
-
confirmation: typed.trim()
|
|
38
|
-
} : {}
|
|
39
|
-
});
|
|
40
|
-
if (action.id === 'start') return api.start(id);
|
|
41
|
-
if (action.id === 'stop') return api.stop(id);
|
|
42
|
-
if (action.id === 'release-holdout') return api.releaseHoldout(id);
|
|
43
|
-
const result = await api.makeContent(id);
|
|
44
|
-
if (result.ok && result.data) {
|
|
45
|
-
setContent(result.data);
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
return result.ok ? {
|
|
49
|
-
ok: false,
|
|
50
|
-
status: 0,
|
|
51
|
-
retryable: true,
|
|
52
|
-
message: API_MESSAGES.unreadable
|
|
53
|
-
} : result;
|
|
54
|
-
}, {
|
|
55
|
-
reloadOnSuccess: finish || action.id !== 'make-content'
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function close() {
|
|
59
|
-
if (transition.busy || reportBusy) return;
|
|
60
|
-
if (content) void test.reload();
|
|
61
|
-
onClose();
|
|
62
|
-
}
|
|
63
|
-
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
64
|
-
open: true,
|
|
65
|
-
initialFocus: action.id === 'start' ? undefined : 'cancel',
|
|
66
|
-
dismissible: !transition.busy && !reportBusy,
|
|
67
|
-
title: action.confirm.title,
|
|
68
|
-
onClose: close,
|
|
69
|
-
children: [
|
|
70
|
-
content ? /*#__PURE__*/ _jsx(MakeContentResult, {
|
|
71
|
-
result: content,
|
|
72
|
-
id: test.doc?.id,
|
|
73
|
-
api: api,
|
|
74
|
-
canManage: surface.canManage,
|
|
75
|
-
isDecided: (content.doc?.status ?? test.doc?.status) === 'decided',
|
|
76
|
-
onRetry: ()=>submit(),
|
|
77
|
-
onFinish: ()=>submit(true),
|
|
78
|
-
busy: transition.busy,
|
|
79
|
-
onBusyChange: setReportBusy,
|
|
80
|
-
onActionStart: transition.clearError
|
|
81
|
-
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
82
|
-
children: [
|
|
83
|
-
/*#__PURE__*/ _jsx("p", {
|
|
84
|
-
children: action.confirm.body
|
|
85
|
-
}),
|
|
86
|
-
phrase ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
87
|
-
children: [
|
|
88
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
89
|
-
children: [
|
|
90
|
-
A.typePhrase,
|
|
91
|
-
" ",
|
|
92
|
-
/*#__PURE__*/ _jsx("strong", {
|
|
93
|
-
children: phrase
|
|
94
|
-
})
|
|
95
|
-
]
|
|
96
|
-
}),
|
|
97
|
-
/*#__PURE__*/ _jsx(TextInput, {
|
|
98
|
-
id: "xp-confirmation",
|
|
99
|
-
label: A.confirmation,
|
|
100
|
-
value: typed,
|
|
101
|
-
readOnly: transition.busy,
|
|
102
|
-
onChange: (event)=>setTyped(event.target.value)
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
}) : null
|
|
106
|
-
]
|
|
107
|
-
}),
|
|
108
|
-
transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
109
|
-
role: "alert",
|
|
110
|
-
children: transition.error
|
|
111
|
-
}) : null,
|
|
112
|
-
!content ? /*#__PURE__*/ _jsx(Button, {
|
|
113
|
-
disabled: !enabled,
|
|
114
|
-
onClick: ()=>{
|
|
115
|
-
void submit();
|
|
116
|
-
},
|
|
117
|
-
children: action.label
|
|
118
|
-
}) : null,
|
|
119
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
120
|
-
"data-dialog-cancel": true,
|
|
121
|
-
disabled: transition.busy || reportBusy,
|
|
122
|
-
onClick: close,
|
|
123
|
-
children: content ? A.done : A.cancel
|
|
124
|
-
})
|
|
125
|
-
]
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/** AllocateDialog's validation and copy, with data supplied by the test document. */ export function AllocateAction({ test, surface, onClose }) {
|
|
129
|
-
const current = test.doc?.allocation ?? 100;
|
|
130
|
-
const [value, setValue] = useState(String(Math.min(100, current + 1)));
|
|
131
|
-
const transition = useTransition(test, onClose);
|
|
132
|
-
const allocation = Number(value);
|
|
133
|
-
const valid = value.trim() !== '' && Number.isInteger(allocation) && allocation > current && allocation <= 100;
|
|
134
|
-
const disabled = transition.busy || test.hasUnsaved || test.saving === 'saving';
|
|
135
|
-
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
136
|
-
open: true,
|
|
137
|
-
dismissible: !transition.busy,
|
|
138
|
-
title: C.allocate,
|
|
139
|
-
onClose: ()=>{
|
|
140
|
-
if (!transition.busy) onClose();
|
|
141
|
-
},
|
|
142
|
-
children: [
|
|
143
|
-
/*#__PURE__*/ _jsx("p", {
|
|
144
|
-
children: R.allocationBody
|
|
145
|
-
}),
|
|
146
|
-
/*#__PURE__*/ _jsxs("label", {
|
|
147
|
-
children: [
|
|
148
|
-
C.participation,
|
|
149
|
-
/*#__PURE__*/ _jsx("input", {
|
|
150
|
-
type: "number",
|
|
151
|
-
min: current + 1,
|
|
152
|
-
max: 100,
|
|
153
|
-
step: 1,
|
|
154
|
-
value: value,
|
|
155
|
-
disabled: disabled,
|
|
156
|
-
onChange: (event)=>setValue(event.target.value)
|
|
157
|
-
})
|
|
158
|
-
]
|
|
159
|
-
}),
|
|
160
|
-
!valid ? /*#__PURE__*/ _jsx("p", {
|
|
161
|
-
children: R.allocationInvalid
|
|
162
|
-
}) : null,
|
|
163
|
-
transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
164
|
-
role: "alert",
|
|
165
|
-
children: transition.error
|
|
166
|
-
}) : null,
|
|
167
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
168
|
-
disabled: disabled || !valid,
|
|
169
|
-
onClick: ()=>{
|
|
170
|
-
// Not-found can also mean the experiment is missing; use round copy for the missing phase record.
|
|
171
|
-
if (valid && test.doc) void transition.run(()=>createApi(surface.apiRoute).allocate(test.doc.id, {
|
|
172
|
-
allocation
|
|
173
|
-
}, {
|
|
174
|
-
notFound: API_MESSAGES.roundChanged
|
|
175
|
-
}));
|
|
176
|
-
},
|
|
177
|
-
children: C.allocate
|
|
178
|
-
}),
|
|
179
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
180
|
-
disabled: transition.busy,
|
|
181
|
-
onClick: onClose,
|
|
182
|
-
children: A.cancel
|
|
183
|
-
})
|
|
184
|
-
]
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
/** AddMetricDialog adapter; the primary goal is deliberately absent from the role picker. */ export function AddMetricAction({ test, surface, onClose }) {
|
|
188
|
-
const [metrics, setMetrics] = useState([]);
|
|
189
|
-
const [loading, setLoading] = useState(true);
|
|
190
|
-
const [loadError, setLoadError] = useState(null);
|
|
191
|
-
const [metric, setMetric] = useState('');
|
|
192
|
-
const [warnings, setWarnings] = useState(null);
|
|
193
|
-
const placementLabels = usePlacementLabels({
|
|
194
|
-
details: (warnings ?? []).filter((warning)=>warning.code === 'placement-unchecked').map((warning)=>warning.detail),
|
|
195
|
-
preflight: test.preflight,
|
|
196
|
-
...surface
|
|
197
|
-
});
|
|
198
|
-
const [role, setRole] = useState('secondary');
|
|
199
|
-
const transition = useTransition(test, onClose);
|
|
200
|
-
useEffect(()=>{
|
|
201
|
-
const controller = new AbortController();
|
|
202
|
-
void (async ()=>{
|
|
203
|
-
try {
|
|
204
|
-
const response = await fetchAllDocs(`${surface.apiRoute.replace(/\/$/, '')}/xp-metrics?depth=0`, {
|
|
205
|
-
credentials: 'include',
|
|
206
|
-
signal: controller.signal
|
|
207
|
-
});
|
|
208
|
-
if (!response.ok) throw new Error(refusalMessage(undefined, response.status));
|
|
209
|
-
if (!controller.signal.aborted) setMetrics(response.docs);
|
|
210
|
-
} catch (cause) {
|
|
211
|
-
if (!controller.signal.aborted) setLoadError(cause instanceof DocsResponseError ? API_MESSAGES.unreadable : cause instanceof Error ? cause.message : API_MESSAGES.network);
|
|
212
|
-
} finally{
|
|
213
|
-
if (!controller.signal.aborted) setLoading(false);
|
|
214
|
-
}
|
|
215
|
-
})();
|
|
216
|
-
return ()=>controller.abort();
|
|
217
|
-
}, [
|
|
218
|
-
surface.apiRoute
|
|
219
|
-
]);
|
|
220
|
-
const attached = new Set([
|
|
221
|
-
test.doc?.metrics?.primary,
|
|
222
|
-
...test.doc?.metrics?.secondary ?? [],
|
|
223
|
-
...test.doc?.metrics?.guardrails ?? []
|
|
224
|
-
].filter((id)=>id != null).map(String));
|
|
225
|
-
const available = metrics.filter((item)=>!attached.has(String(item.id)));
|
|
226
|
-
const selected = available.find((item)=>String(item.id) === metric);
|
|
227
|
-
const disabled = transition.busy || test.hasUnsaved || test.saving === 'saving';
|
|
228
|
-
function close() {
|
|
229
|
-
if (transition.busy) return;
|
|
230
|
-
if (warnings) void test.reload();
|
|
231
|
-
onClose();
|
|
232
|
-
}
|
|
233
|
-
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
234
|
-
open: true,
|
|
235
|
-
dismissible: !transition.busy,
|
|
236
|
-
title: C.addGoal,
|
|
237
|
-
onClose: close,
|
|
238
|
-
children: [
|
|
239
|
-
warnings ? warnings.map((warning, index)=>{
|
|
240
|
-
const placement = warning.code === 'placement-unchecked' ? placementLabels.get(placementDetailKey(warning.detail)) : undefined;
|
|
241
|
-
return /*#__PURE__*/ _jsx("p", {
|
|
242
|
-
children: placement ? placement.href ? /*#__PURE__*/ _jsx("a", {
|
|
243
|
-
href: placement.href,
|
|
244
|
-
children: placementUncheckedCopy(placement.title)
|
|
245
|
-
}) : placementUncheckedCopy(placement.title) : addMetricWarningCopy(warning)
|
|
246
|
-
}, index);
|
|
247
|
-
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
248
|
-
children: [
|
|
249
|
-
/*#__PURE__*/ _jsx("p", {
|
|
250
|
-
children: C.addMetric
|
|
251
|
-
}),
|
|
252
|
-
loading ? /*#__PURE__*/ _jsx("p", {
|
|
253
|
-
role: "status",
|
|
254
|
-
children: R.loadingMetrics
|
|
255
|
-
}) : null,
|
|
256
|
-
/*#__PURE__*/ _jsxs("label", {
|
|
257
|
-
children: [
|
|
258
|
-
R.role,
|
|
259
|
-
/*#__PURE__*/ _jsxs("select", {
|
|
260
|
-
value: role,
|
|
261
|
-
disabled: disabled,
|
|
262
|
-
onChange: (event)=>setRole(event.target.value),
|
|
263
|
-
children: [
|
|
264
|
-
/*#__PURE__*/ _jsx("option", {
|
|
265
|
-
value: "secondary",
|
|
266
|
-
children: R.supporting
|
|
267
|
-
}),
|
|
268
|
-
/*#__PURE__*/ _jsx("option", {
|
|
269
|
-
value: "guardrail",
|
|
270
|
-
children: R.guardrail
|
|
271
|
-
})
|
|
272
|
-
]
|
|
273
|
-
})
|
|
274
|
-
]
|
|
275
|
-
}),
|
|
276
|
-
/*#__PURE__*/ _jsxs("label", {
|
|
277
|
-
children: [
|
|
278
|
-
R.metric,
|
|
279
|
-
/*#__PURE__*/ _jsxs("select", {
|
|
280
|
-
value: metric,
|
|
281
|
-
disabled: disabled || loading,
|
|
282
|
-
onChange: (event)=>setMetric(event.target.value),
|
|
283
|
-
children: [
|
|
284
|
-
/*#__PURE__*/ _jsx("option", {
|
|
285
|
-
value: "",
|
|
286
|
-
children: R.chooseMetric
|
|
287
|
-
}),
|
|
288
|
-
available.map((item)=>/*#__PURE__*/ _jsx("option", {
|
|
289
|
-
value: String(item.id),
|
|
290
|
-
children: item.name
|
|
291
|
-
}, item.id))
|
|
292
|
-
]
|
|
293
|
-
})
|
|
294
|
-
]
|
|
295
|
-
}),
|
|
296
|
-
!loading && !loadError && !available.length ? /*#__PURE__*/ _jsx("p", {
|
|
297
|
-
children: R.noMetrics
|
|
298
|
-
}) : null,
|
|
299
|
-
loadError || transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
300
|
-
role: "alert",
|
|
301
|
-
children: loadError ?? transition.error
|
|
302
|
-
}) : null,
|
|
303
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
304
|
-
disabled: disabled || loading || !!loadError || !selected,
|
|
305
|
-
onClick: ()=>{
|
|
306
|
-
// Goal and phase lookups share not-found; prefer the more likely missing goal without reading server text.
|
|
307
|
-
if (selected && test.doc) void transition.run(async ()=>{
|
|
308
|
-
const result = await createApi(surface.apiRoute).addMetric(test.doc.id, {
|
|
309
|
-
metric: selected.id,
|
|
310
|
-
role
|
|
311
|
-
}, {
|
|
312
|
-
notFound: API_MESSAGES.goalNotFound
|
|
313
|
-
});
|
|
314
|
-
if (result.ok) {
|
|
315
|
-
if (result.data?.warnings?.length) setWarnings(result.data.warnings);
|
|
316
|
-
else {
|
|
317
|
-
await test.reload();
|
|
318
|
-
onClose();
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return result;
|
|
322
|
-
}, {
|
|
323
|
-
reloadOnSuccess: false
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
children: C.addGoal
|
|
327
|
-
})
|
|
328
|
-
]
|
|
329
|
-
}),
|
|
330
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
331
|
-
disabled: transition.busy,
|
|
332
|
-
onClick: close,
|
|
333
|
-
children: warnings ? A.done : A.cancel
|
|
334
|
-
})
|
|
335
|
-
]
|
|
336
|
-
});
|
|
337
|
-
}
|