@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +12 -5
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +129 -37
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.d.ts +3 -0
- package/dist/admin/blocks/formApi.js +10 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +10 -6
- package/dist/admin/blocks/statusCache.d.ts +2 -0
- package/dist/admin/blocks/statusCache.js +12 -3
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +21 -1
- package/dist/admin/copy/blocks.js +40 -6
- package/dist/admin/copy/goals.d.ts +21 -9
- package/dist/admin/copy/goals.js +28 -11
- package/dist/admin/copy/newTest.d.ts +7 -7
- package/dist/admin/copy/newTest.js +10 -7
- package/dist/admin/goals/XpGoalField.d.ts +2 -0
- package/dist/admin/goals/XpGoalField.js +156 -114
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/paths.d.ts +3 -0
- package/dist/admin/paths.js +3 -0
- package/dist/admin/placementStatus.model.js +1 -1
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +29 -4
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +273 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +2 -1
- package/dist/admin/surface/goals/GoalForm.js +342 -212
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +107 -37
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +11 -2
- package/dist/admin/surface/goals/goals.css +9 -1
- package/dist/admin/surface/goals/goals.model.d.ts +12 -2
- package/dist/admin/surface/goals/goals.model.js +39 -1
- package/dist/admin/surface/home.model.d.ts +10 -8
- package/dist/admin/surface/home.model.js +27 -22
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +149 -118
- package/dist/admin/surface/newTest/PageWizard.d.ts +5 -2
- package/dist/admin/surface/newTest/PageWizard.js +115 -80
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +3 -3
- package/dist/admin/surface/results/ResultsHeader.js +115 -83
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +44 -152
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +18 -165
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +35 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/collections/experiments/config.js +17 -8
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +28 -9
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +57 -9
- package/dist/endpoints/pages.js +247 -64
- package/dist/endpoints/placementStatus.js +13 -5
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/fields/xpGoal.js +3 -15
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +44 -35
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +27 -2
- package/dist/hooks/pageGuard.js +213 -45
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +36 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +70 -21
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +5 -1
- package/dist/puck/copy.js +5 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +1007 -182
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +72 -0
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +35 -19
- package/dist/puck/editor/VersionBuilder.d.ts +67 -12
- package/dist/puck/editor/VersionBuilder.js +560 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +65 -20
- package/dist/puck/editor/copy.js +73 -21
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +200 -20
- package/dist/puck/editor/editor.css +338 -25
- package/dist/puck/editor/editor.model.d.ts +17 -1
- package/dist/puck/editor/editor.model.js +61 -4
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +105 -86
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +2 -2
- package/dist/puck/slotConfig.js +18 -5
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.d.ts +1 -1
- package/dist/results/verdict.js +9 -7
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +22 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +48 -22
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +9 -5
- package/dist/testSurface/actions/DecideDialog.d.ts +17 -0
- package/dist/testSurface/actions/DecideDialog.js +222 -0
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +123 -0
- package/dist/{admin → testSurface}/actions/decide.model.d.ts +1 -0
- package/dist/{admin → testSurface}/actions/decide.model.js +1 -0
- package/dist/{admin → testSurface}/allocation.model.js +6 -3
- package/dist/{admin → testSurface}/api.d.ts +20 -7
- package/dist/{admin → testSurface}/api.js +72 -22
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +37 -14
- package/dist/{admin → testSurface}/copy/actions.js +40 -17
- package/dist/{admin → testSurface}/copy/advanced.d.ts +10 -0
- package/dist/{admin → testSurface}/copy/advanced.js +10 -0
- package/dist/{admin → testSurface}/copy/arms.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/arms.js +1 -1
- package/dist/{admin → testSurface}/copy/audience.d.ts +4 -3
- package/dist/{admin → testSurface}/copy/audience.js +5 -4
- package/dist/{admin → testSurface}/copy/common.d.ts +15 -6
- package/dist/{admin → testSurface}/copy/common.js +20 -10
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +18 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +40 -6
- package/dist/{admin → testSurface}/copy/readiness.js +54 -9
- package/dist/{admin → testSurface}/copy/recommendation.d.ts +4 -4
- package/dist/{admin → testSurface}/copy/recommendation.js +4 -4
- package/dist/{admin → testSurface}/copy/results.d.ts +19 -12
- package/dist/{admin → testSurface}/copy/results.js +21 -12
- package/dist/testSurface/copy/review.d.ts +20 -0
- package/dist/testSurface/copy/review.js +21 -0
- package/dist/{admin → testSurface}/copy/setting.d.ts +1 -2
- package/dist/{admin → testSurface}/copy/setting.js +1 -2
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +14 -11
- package/dist/{admin → testSurface}/copy/testPage.d.ts +61 -12
- package/dist/testSurface/copy/testPage.js +168 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/format/date.d.ts +1 -0
- package/dist/testSurface/format/date.js +21 -0
- package/dist/{admin → testSurface}/labels.d.ts +1 -2
- package/dist/{admin → testSurface}/labels.js +2 -3
- package/dist/{admin → testSurface}/lockedNotice.model.d.ts +2 -0
- package/dist/{admin → testSurface}/lockedNotice.model.js +31 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/{admin → testSurface}/placements/placementLabels.d.ts +2 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +3 -2
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.d.ts +3 -2
- package/dist/{admin → testSurface}/results/results.model.js +16 -11
- package/dist/{admin → testSurface}/surface/contracts.d.ts +17 -3
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/testSurface/surface/pageBlock/parts.js +107 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +498 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +372 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +4 -3
- package/dist/testSurface/surface/readiness/Banner.js +198 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +13 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +67 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +28 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +6 -3
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +40 -40
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +11 -4
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +207 -104
- package/dist/{admin → testSurface}/surface/results/recommendation.model.js +3 -3
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +26 -8
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +18 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +12 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +119 -89
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +25 -14
- package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +11 -8
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +4 -11
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +88 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +87 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/testSurface/surface/test/VersionsSection.js +301 -0
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +33 -9
- package/dist/testSurface/surface/test/fields.js +300 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +30 -44
- package/dist/testSurface/surface/test/testPage.css +111 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +3 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +8 -0
- package/dist/testSurface/surfaceUrls.js +23 -0
- package/dist/{admin → testSurface}/useApi.d.ts +21 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +6 -1
- package/dist/transitions/checkStart.js +133 -17
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +6 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +41 -17
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +16 -12
- package/dist/transitions/placements.d.ts +54 -8
- package/dist/transitions/placements.js +304 -81
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +137 -40
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +72 -35
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +15 -3
- package/dist/types/endpoints.d.ts +121 -17
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +9 -9
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +141 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +6 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +50 -5
- package/package.json +3 -2
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -10
- package/dist/admin/actions/DecideDialog.js +0 -190
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/copy/metrics.js +0 -9
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/review.d.ts +0 -17
- package/dist/admin/copy/review.js +0 -17
- package/dist/admin/copy/testPage.js +0 -104
- package/dist/admin/format/date.js +0 -10
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/pageBlock/parts.js +0 -69
- package/dist/admin/surface/pagePicker/CopyRoute.d.ts +0 -6
- package/dist/admin/surface/pagePicker/CopyRoute.js +0 -53
- package/dist/admin/surface/pagePicker/PagePicker.d.ts +0 -10
- package/dist/admin/surface/pagePicker/PagePicker.js +0 -172
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -337
- package/dist/admin/surface/readiness/Banner.js +0 -190
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.js +0 -205
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/VersionsSection.js +0 -247
- package/dist/admin/surface/test/fields.js +0 -216
- package/dist/admin/surface/test/testPage.css +0 -97
- package/dist/admin/surface/useTestDocument.d.ts +0 -32
- package/dist/admin/surface/useTestDocument.js +0 -415
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
import { withSlotsFor } from '../arms/model.js';
|
|
2
|
+
import { nestedPlacementNames, nameNestedPlacements } from './nestedPlacementNames.js';
|
|
3
|
+
import { nestedTestCopy } from '../puck/nestedTestCopy.js';
|
|
1
4
|
import { goalContent } from '../goals/fairness.js';
|
|
5
|
+
import { browserWritableMetric } from '../events/writable.js';
|
|
2
6
|
import { detached } from './placementInteractions.js';
|
|
3
7
|
import { lockAndRescanPlacements, placementInteractions } from './placementInteractions.js';
|
|
4
8
|
import { lockPagePaths } from '../db/locks.js';
|
|
5
9
|
import { lockMetricsForFreeze } from '../db/metricUsage.js';
|
|
6
10
|
import { DEFAULT_SEQUENTIAL_TUNING_PARAMETER } from '../constants.js';
|
|
7
11
|
import { claimSlices } from '../db/slices.js';
|
|
8
|
-
import { asymmetricGoalsCopy, sameAddressCopy, interactingTestsCopy, pageInUseCopy, unpublishedPageCopy } from '../
|
|
9
|
-
import { GROUP_LABELS } from '../
|
|
12
|
+
import { READINESS_COPY, asymmetricGoalsCopy, firstStartOnlyCopy, sameAddressCopy, interactingTestsCopy, pageInUseCopy, unpublishedPageCopy } from '../testSurface/copy/readiness.js';
|
|
13
|
+
import { GROUP_LABELS } from '../testSurface/copy/arms.js';
|
|
10
14
|
import { XpRefusal } from '../errors.js';
|
|
11
15
|
import { isOpValid } from '../targeting/ops.js';
|
|
12
16
|
import { newSeed } from '../runtime/seed.js';
|
|
13
17
|
import { checkStart, pageTargetPaths, relationshipId } from './checkStart.js';
|
|
14
18
|
import { withTransition } from './kernel.js';
|
|
15
|
-
import { writePhaseRecord } from './phaseRecord.js';
|
|
16
|
-
import { loadPageTestsInUse,
|
|
19
|
+
import { requireCurrentRound, writePhaseRecord } from './phaseRecord.js';
|
|
20
|
+
import { loadPageTestsInUse, loadStartInputsBatch, readStartInputExperiment, unpublishedPageTargets } from './preflightData.js';
|
|
17
21
|
import { resolveCaps } from './resolveCaps.js';
|
|
22
|
+
import { findStartDocuments, readStartState } from './startReads.js';
|
|
18
23
|
export async function readExperiment(req, id) {
|
|
19
24
|
// §7.8: internal lookup serves the authorised transition write. Preserve
|
|
20
25
|
// admin-only analysis.method/kind for freezing; return access-filtered docs.
|
|
@@ -35,6 +40,7 @@ export async function readExperiment(req, id) {
|
|
|
35
40
|
}
|
|
36
41
|
export function refuse(code, detail) {
|
|
37
42
|
const messages = {
|
|
43
|
+
'nested-tests': nestedTestCopy.readiness(detail),
|
|
38
44
|
'goal-in-some-versions': asymmetricGoalsCopy(detail),
|
|
39
45
|
'placements-changed': "This test's pages changed while it was starting. Try again.",
|
|
40
46
|
'page-busy': "One of this test's pages is being saved right now. Try again in a moment.",
|
|
@@ -43,6 +49,7 @@ export function refuse(code, detail) {
|
|
|
43
49
|
return d ? interactingTestsCopy(d.path, d.status, d.name, d.version) : 'Finish one of the tests first.';
|
|
44
50
|
})(),
|
|
45
51
|
'unknown-collection': "That page type isn't set up for tests.",
|
|
52
|
+
'placement-removed': READINESS_COPY.placementRemoved,
|
|
46
53
|
'page-in-use': pageInUseCopy(detail?.paths?.[0] ?? 'this page'),
|
|
47
54
|
'version-same-address': (()=>{
|
|
48
55
|
const d = detail;
|
|
@@ -78,15 +85,16 @@ export function refuse(code, detail) {
|
|
|
78
85
|
].includes(code);
|
|
79
86
|
throw new XpRefusal(code, messages[code] ?? 'The experiment is not ready to start.', detail, code === 'entry-not-found' ? 404 : conflict ? 409 : 422);
|
|
80
87
|
}
|
|
81
|
-
export async function updateExperiment(req, id, data) {
|
|
82
|
-
// §7.8:
|
|
83
|
-
await req.payload.update({
|
|
88
|
+
export async function updateExperiment(req, id, data, system = false) {
|
|
89
|
+
// §7.8: an authorized manager transition or trusted system Start writes locked plugin fields.
|
|
90
|
+
const updated = await req.payload.update({
|
|
84
91
|
collection: 'xp-experiments',
|
|
85
92
|
req,
|
|
86
93
|
id,
|
|
87
94
|
data,
|
|
88
95
|
overrideAccess: true
|
|
89
96
|
});
|
|
97
|
+
if (system) return updated;
|
|
90
98
|
const { docs } = await req.payload.find({
|
|
91
99
|
collection: 'xp-experiments',
|
|
92
100
|
req,
|
|
@@ -102,14 +110,16 @@ export async function updateExperiment(req, id, data) {
|
|
|
102
110
|
if (!docs[0]) throw new XpRefusal('not-found', 'Experiment not found', undefined, 404);
|
|
103
111
|
return docs[0];
|
|
104
112
|
}
|
|
105
|
-
|
|
106
|
-
const input = await
|
|
113
|
+
async function prepareStart(req, options, before, system) {
|
|
114
|
+
const input = (await loadStartInputsBatch(req, options, [
|
|
115
|
+
before
|
|
116
|
+
], false, system)).get(String(before.id));
|
|
107
117
|
if (!input) throw new XpRefusal('not-found', 'Experiment not found', undefined, 404);
|
|
108
|
-
const full = await readExperiment(req,
|
|
109
|
-
if (full.updatedAt !==
|
|
118
|
+
const full = await readExperiment(req, before.id);
|
|
119
|
+
if (full.updatedAt !== before.updatedAt) refuse('stale-draft');
|
|
110
120
|
// Review reads respect field access; internal writes must preserve hidden config.
|
|
111
121
|
input.experiment = {
|
|
112
|
-
...
|
|
122
|
+
...before,
|
|
113
123
|
kind: full.kind,
|
|
114
124
|
analysis: full.analysis
|
|
115
125
|
};
|
|
@@ -117,26 +127,54 @@ export async function start(req, { experimentId, options }) {
|
|
|
117
127
|
// ReadinessCode to RefusalCode, which intentionally excludes warnings.
|
|
118
128
|
const failed = checkStart(input).find((check)=>!check.ok);
|
|
119
129
|
if (failed && failed.code !== 'page-targets-unchecked' && failed.code !== 'make-content-unsupported') refuse(failed.code, failed.detail);
|
|
120
|
-
const before = input.experiment;
|
|
121
|
-
const updatedAt = before.updatedAt;
|
|
122
130
|
const at = new Date();
|
|
123
131
|
const caps = await resolveCaps(input.metrics, options.metricSources ?? [], at);
|
|
124
|
-
|
|
132
|
+
return {
|
|
133
|
+
input,
|
|
134
|
+
at,
|
|
135
|
+
caps
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export async function start(req, { experimentId, options, phase: expectedPhase, system = false, onlyIfNeverStarted = false }) {
|
|
139
|
+
const before = await readStartInputExperiment(req, experimentId, system);
|
|
140
|
+
if (!before) throw new XpRefusal('not-found', 'Experiment not found', undefined, 404);
|
|
141
|
+
const { updatedAt } = before;
|
|
142
|
+
const prepared = await prepareStart(req, options, before, system).catch((error)=>{
|
|
143
|
+
if (!onlyIfNeverStarted && expectedPhase === undefined) throw error;
|
|
144
|
+
// Conditional Start checks the locked document before reporting a preflight failure.
|
|
145
|
+
return {
|
|
146
|
+
error
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
const kind = 'error' in prepared ? before.kind : prepared.input.experiment.kind;
|
|
150
|
+
const { result: { doc, detail }, revision } = await withTransition(req, {
|
|
125
151
|
experimentId,
|
|
126
152
|
layerId: relationshipId(before.layer),
|
|
127
|
-
flagPointId:
|
|
153
|
+
flagPointId: kind === 'flag' ? before.flagPoint : undefined,
|
|
154
|
+
requireOwnedTransaction: system
|
|
128
155
|
}, async ({ req, exec })=>{
|
|
129
156
|
const current = await readExperiment(req, experimentId);
|
|
157
|
+
// A concurrent Start or Stop must yield the locked status before considering a stale snapshot.
|
|
158
|
+
if (onlyIfNeverStarted && (current.status !== 'draft' || (current.phase ?? 0) !== 0)) {
|
|
159
|
+
const detail = {
|
|
160
|
+
status: current.status,
|
|
161
|
+
phase: current.phase ?? 0
|
|
162
|
+
};
|
|
163
|
+
throw new XpRefusal('first-start-only', firstStartOnlyCopy(current.status), detail, 409);
|
|
164
|
+
}
|
|
165
|
+
requireCurrentRound(expectedPhase, current.phase);
|
|
130
166
|
if (current.updatedAt !== updatedAt) refuse('stale-draft');
|
|
131
167
|
if (current.status !== 'draft' && current.status !== 'stopped') refuse('invalid-status');
|
|
168
|
+
if ('error' in prepared) throw prepared.error;
|
|
169
|
+
const { input, at, caps } = prepared;
|
|
132
170
|
let placementDocs;
|
|
133
171
|
if (current.kind === 'block') {
|
|
134
|
-
const rescan = await lockAndRescanPlacements(req, exec, options, current, input.placements ?? []);
|
|
172
|
+
const rescan = await lockAndRescanPlacements(req, exec, options, current, input.placements ?? [], system);
|
|
135
173
|
placementDocs = rescan.docs;
|
|
136
174
|
const failure = checkStart({
|
|
137
175
|
...input,
|
|
138
176
|
experiment: current,
|
|
139
|
-
placements: rescan.placements
|
|
177
|
+
placements: nameNestedPlacements(rescan.placements, await nestedPlacementNames(req, rescan.placements, system))
|
|
140
178
|
}).find((check)=>!check.ok);
|
|
141
179
|
if (failure && failure.code !== 'page-targets-unchecked' && failure.code !== 'make-content-unsupported') refuse(failure.code, failure.detail);
|
|
142
180
|
}
|
|
@@ -151,7 +189,7 @@ export async function start(req, { experimentId, options }) {
|
|
|
151
189
|
pageTestsInUse: await loadPageTestsInUse(req)
|
|
152
190
|
}).find((check)=>check.code === 'page-in-use' && !check.ok);
|
|
153
191
|
if (recheck) refuse('page-in-use', recheck.detail);
|
|
154
|
-
const conflicts = await placementInteractions(req, exec, options, current, pageTargetPaths(current.arms));
|
|
192
|
+
const conflicts = await placementInteractions(req, exec, options, current, pageTargetPaths(current.arms), system);
|
|
155
193
|
if (conflicts.length) refuse('interacting-tests', conflicts);
|
|
156
194
|
if (options.pages) {
|
|
157
195
|
// The page guard takes the same path locks, so a delete, unpublish or rename that committed
|
|
@@ -170,10 +208,8 @@ export async function start(req, { experimentId, options }) {
|
|
|
170
208
|
}
|
|
171
209
|
}
|
|
172
210
|
if (current.kind === 'flag' && current.flagPoint) {
|
|
173
|
-
const busy = await req
|
|
211
|
+
const busy = await findStartDocuments(req, {
|
|
174
212
|
collection: 'xp-experiments',
|
|
175
|
-
req,
|
|
176
|
-
overrideAccess: false,
|
|
177
213
|
depth: 0,
|
|
178
214
|
limit: 2,
|
|
179
215
|
where: {
|
|
@@ -193,15 +229,10 @@ export async function start(req, { experimentId, options }) {
|
|
|
193
229
|
}
|
|
194
230
|
]
|
|
195
231
|
}
|
|
196
|
-
});
|
|
232
|
+
}, system);
|
|
197
233
|
if (busy.docs.some((doc)=>String(doc.id) !== String(experimentId))) refuse('flag-point-busy');
|
|
198
234
|
const point = options.flagPoints.find((point)=>point.id === current.flagPoint);
|
|
199
|
-
const state = await req
|
|
200
|
-
slug: 'xp-state',
|
|
201
|
-
req,
|
|
202
|
-
overrideAccess: false,
|
|
203
|
-
depth: 0
|
|
204
|
-
});
|
|
235
|
+
const state = await readStartState(req, system);
|
|
205
236
|
const defaults = state.flagDefaults;
|
|
206
237
|
current.arms = current.arms.map((arm)=>arm.kind === 'control' ? {
|
|
207
238
|
...arm,
|
|
@@ -261,15 +292,17 @@ export async function start(req, { experimentId, options }) {
|
|
|
261
292
|
...metric,
|
|
262
293
|
metricId: metric.id,
|
|
263
294
|
addedAt: startedAt,
|
|
295
|
+
browserWritable: browserWritableMetric(metric.source, options),
|
|
264
296
|
role: String(relationshipId(current.metrics?.primary)) === String(metric.id) ? 'primary' : current.metrics?.guardrails?.some((id)=>String(relationshipId(id)) === String(metric.id)) ? 'guardrail' : 'secondary'
|
|
265
297
|
}));
|
|
298
|
+
const arms = current.kind === 'block' ? withSlotsFor(current.arms, 'block') : current.arms;
|
|
266
299
|
await writePhaseRecord(req, {
|
|
267
300
|
experiment: experimentId,
|
|
268
301
|
phase,
|
|
269
302
|
phaseKind: 'test',
|
|
270
303
|
seed,
|
|
271
304
|
startedAt,
|
|
272
|
-
arms
|
|
305
|
+
arms,
|
|
273
306
|
allocation: current.allocation,
|
|
274
307
|
allocationChanges: [],
|
|
275
308
|
targeting,
|
|
@@ -299,21 +332,25 @@ export async function start(req, { experimentId, options }) {
|
|
|
299
332
|
},
|
|
300
333
|
contentChanges: []
|
|
301
334
|
});
|
|
302
|
-
|
|
335
|
+
const doc = await updateExperiment(req, experimentId, {
|
|
303
336
|
status: 'running',
|
|
304
337
|
phase,
|
|
305
338
|
seed,
|
|
306
339
|
startedAt,
|
|
307
340
|
stoppedAt: null,
|
|
308
341
|
layerSlices,
|
|
309
|
-
arms
|
|
310
|
-
});
|
|
342
|
+
arms
|
|
343
|
+
}, system);
|
|
344
|
+
return {
|
|
345
|
+
doc,
|
|
346
|
+
detail: caps.detail
|
|
347
|
+
};
|
|
311
348
|
});
|
|
312
349
|
return {
|
|
313
350
|
doc,
|
|
314
351
|
revision: revision,
|
|
315
|
-
...
|
|
316
|
-
detail
|
|
352
|
+
...detail.length ? {
|
|
353
|
+
detail
|
|
317
354
|
} : {}
|
|
318
355
|
};
|
|
319
356
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
type StartReadQuery = Parameters<PayloadRequest['payload']['find']>[0] & {
|
|
3
|
+
collection: 'xp-experiments' | 'xp-metrics' | 'xp-layers';
|
|
4
|
+
};
|
|
5
|
+
export declare function findStartDocuments(req: PayloadRequest, query: StartReadQuery, system?: boolean): Promise<import("payload").PaginatedDocs<import("payload").JsonObject & import("payload").TypeWithID>>;
|
|
6
|
+
export declare function readStartState(req: PayloadRequest, system?: boolean): Promise<import("payload").JsonObject>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function findStartDocuments(req, query, system = false) {
|
|
2
|
+
// §7.8: Start from trusted host code reads plugin readiness data without a manager actor.
|
|
3
|
+
if (system) return req.payload.find({
|
|
4
|
+
...query,
|
|
5
|
+
req,
|
|
6
|
+
overrideAccess: true
|
|
7
|
+
});
|
|
8
|
+
return req.payload.find({
|
|
9
|
+
...query,
|
|
10
|
+
req,
|
|
11
|
+
overrideAccess: false
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function readStartState(req, system = false) {
|
|
15
|
+
// §7.8: system Start needs the effective flag defaults even without a manager actor.
|
|
16
|
+
if (system) return req.payload.findGlobal({
|
|
17
|
+
slug: 'xp-state',
|
|
18
|
+
req,
|
|
19
|
+
overrideAccess: true,
|
|
20
|
+
depth: 0
|
|
21
|
+
});
|
|
22
|
+
return req.payload.findGlobal({
|
|
23
|
+
slug: 'xp-state',
|
|
24
|
+
req,
|
|
25
|
+
overrideAccess: false,
|
|
26
|
+
depth: 0
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PayloadRequest } from 'payload';
|
|
2
2
|
import type { DocId } from '../types/contracts.js';
|
|
3
|
-
|
|
3
|
+
import type { RoundBody } from '../types/endpoints.js';
|
|
4
|
+
export declare function stop(req: PayloadRequest, { experimentId, phase: expectedPhase }: RoundBody & {
|
|
4
5
|
experimentId: DocId;
|
|
5
6
|
}): Promise<{
|
|
6
7
|
doc: import("payload").JsonObject & import("payload").TypeWithID;
|
package/dist/transitions/stop.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { relationshipId } from './checkStart.js';
|
|
2
2
|
import { withTransition } from './kernel.js';
|
|
3
|
-
import { setPhaseEndedAt } from './phaseRecord.js';
|
|
3
|
+
import { requireCurrentRound, setPhaseEndedAt } from './phaseRecord.js';
|
|
4
4
|
import { readExperiment, refuse, updateExperiment } from './start.js';
|
|
5
|
-
export async function stop(req, { experimentId }) {
|
|
5
|
+
export async function stop(req, { experimentId, phase: expectedPhase }) {
|
|
6
6
|
const before = await readExperiment(req, experimentId);
|
|
7
7
|
const { result: doc, revision } = await withTransition(req, {
|
|
8
8
|
experimentId,
|
|
9
9
|
layerId: relationshipId(before.layer)
|
|
10
10
|
}, async ({ req })=>{
|
|
11
11
|
const current = await readExperiment(req, experimentId);
|
|
12
|
+
requireCurrentRound(expectedPhase, current.phase);
|
|
12
13
|
if (current.status !== 'running') refuse('invalid-status');
|
|
13
14
|
const at = new Date().toISOString();
|
|
14
15
|
await setPhaseEndedAt(req, experimentId, current.phase, at);
|
|
@@ -93,10 +93,11 @@ export interface FlagPoint {
|
|
|
93
93
|
req: PayloadRequest;
|
|
94
94
|
}): Promise<void>;
|
|
95
95
|
}
|
|
96
|
-
/**
|
|
96
|
+
/** Combine a trusted client-address cap with a limit for the verified unit. */
|
|
97
97
|
export type RateLimiter = (args: {
|
|
98
98
|
req: PayloadRequest;
|
|
99
99
|
unitId: string;
|
|
100
|
+
unitType: UnitType;
|
|
100
101
|
}) => boolean | Promise<boolean>;
|
|
101
102
|
export type ExperimentsAccess = (args: {
|
|
102
103
|
req: PayloadRequest;
|
|
@@ -107,6 +108,15 @@ export interface ExperimentsPageCollection {
|
|
|
107
108
|
copyHint?: string;
|
|
108
109
|
copyUrl?: string;
|
|
109
110
|
copyLabel?: string;
|
|
111
|
+
/** Enable draft copying for this collection. Omit or set false to use manual setup. */
|
|
112
|
+
copy?: boolean | {
|
|
113
|
+
/** Override fields for the proposed address, or return null for manual setup. Can run more than once and must not write. */
|
|
114
|
+
overrides: (doc: Record<string, unknown>, context: {
|
|
115
|
+
req: PayloadRequest;
|
|
116
|
+
path: string;
|
|
117
|
+
suffix: string;
|
|
118
|
+
}) => Record<string, unknown> | null | Promise<Record<string, unknown> | null>;
|
|
119
|
+
};
|
|
110
120
|
pathOf: (doc: Record<string, unknown>) => string | null;
|
|
111
121
|
/** Lookup with the supplied req and overrideAccess: false. Under an anonymous req (results checks) only published pages are visible, so a hit is { published: true } or null. Under a req that can read drafts (Start), a draft-only page may be reported as { published: false }. */
|
|
112
122
|
findByPath: (path: string, req: PayloadRequest) => Promise<{
|
|
@@ -173,11 +183,13 @@ export interface ExperimentsPluginOptions<TUser extends {
|
|
|
173
183
|
field?: string;
|
|
174
184
|
}>;
|
|
175
185
|
};
|
|
176
|
-
events
|
|
186
|
+
events: {
|
|
177
187
|
retentionDays?: number;
|
|
178
188
|
maxBodyBytes?: number;
|
|
179
|
-
rateLimit
|
|
189
|
+
rateLimit: RateLimiter | false;
|
|
180
190
|
dimensions?: string[];
|
|
191
|
+
/** Public HTTP(S) origin for clients without Fetch Metadata. Defaults to Payload's serverURL. */
|
|
192
|
+
origin?: string;
|
|
181
193
|
};
|
|
182
194
|
}
|
|
183
195
|
/** Options required by the route table; CORE-02c resolves optional defaults. */
|
|
@@ -7,7 +7,7 @@ import type { Snapshot, VerdictCode } from './snapshot.js';
|
|
|
7
7
|
export type ArmIssueCode = 'weights-total' | 'control-count' | 'control-first' | 'holdout-last' | 'holdout-count' | 'variant-count' | 'duplicate-key' | 'duplicate-slot' | 'slot-required' | 'invalid-key';
|
|
8
8
|
/** Content-report dismiss/restore refusals (CORE-44). */
|
|
9
9
|
export type ContentEntryRefusal = 'not-decided' | 'entry-not-found' | 'entry-ok' | 'entry-dismissed' | 'entry-not-dismissed';
|
|
10
|
-
export type RefusalCode = ArmIssueCode | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'empty-slot' | 'page-in-use' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | 'invalid-status' | 'stale-draft' | 'stale-edit' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
|
|
10
|
+
export type RefusalCode = ArmIssueCode | 'copy-unavailable' | 'copy-not-enabled' | 'copy-no-access' | 'copy-unique-field' | 'copy-orphaned' | 'transaction-lost' | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | 'invalid-status' | 'first-start-only' | 'stale-draft' | 'stale-edit' | 'round-changed' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
|
|
11
11
|
export type ErrorEnvelope = {
|
|
12
12
|
errors: Array<{
|
|
13
13
|
code: RefusalCode;
|
|
@@ -19,8 +19,31 @@ export type TransitionSuccess = {
|
|
|
19
19
|
doc: Record<string, unknown>;
|
|
20
20
|
revision: number;
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
23
|
-
|
|
22
|
+
export type StartExperimentWarning = {
|
|
23
|
+
metricId: DocId;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
export type StartExperimentFirstStartDetail = {
|
|
27
|
+
status: Status;
|
|
28
|
+
phase: number;
|
|
29
|
+
};
|
|
30
|
+
export type StartExperimentResult = {
|
|
31
|
+
status: 'started';
|
|
32
|
+
phase: number;
|
|
33
|
+
revision: number;
|
|
34
|
+
warnings: StartExperimentWarning[];
|
|
35
|
+
} | {
|
|
36
|
+
status: 'refused';
|
|
37
|
+
code: 'first-start-only';
|
|
38
|
+
message: string;
|
|
39
|
+
detail: StartExperimentFirstStartDetail;
|
|
40
|
+
} | {
|
|
41
|
+
status: 'refused';
|
|
42
|
+
code: Exclude<RefusalCode, 'not-found' | 'commit-unverified' | 'first-start-only'> | 'transaction-open';
|
|
43
|
+
message: string;
|
|
44
|
+
detail?: unknown;
|
|
45
|
+
} | {
|
|
46
|
+
status: 'not-found';
|
|
24
47
|
};
|
|
25
48
|
export type AddMetricWarning = {
|
|
26
49
|
code: 'goal-in-some-versions' | 'goal-added-mid-test' | 'placement-unchecked';
|
|
@@ -29,16 +52,23 @@ export type AddMetricWarning = {
|
|
|
29
52
|
export type AddMetricResult = TransitionSuccess & {
|
|
30
53
|
warnings: AddMetricWarning[];
|
|
31
54
|
};
|
|
32
|
-
export type AddMetricBody = {
|
|
55
|
+
export type AddMetricBody = RoundBody & {
|
|
33
56
|
metric: DocId;
|
|
34
57
|
role: 'secondary' | 'guardrail';
|
|
35
58
|
};
|
|
36
|
-
|
|
59
|
+
/** When omitted, the action applies to the current round. */
|
|
60
|
+
export type RoundBody = {
|
|
61
|
+
phase?: number;
|
|
62
|
+
};
|
|
63
|
+
export type AllocateBody = RoundBody & {
|
|
64
|
+
allocation: number;
|
|
65
|
+
};
|
|
66
|
+
export type DecideBody = RoundBody & {
|
|
37
67
|
winnerArm: string;
|
|
38
68
|
note?: string;
|
|
39
69
|
confirmation?: string;
|
|
40
70
|
};
|
|
41
|
-
export type ArchiveBody = {
|
|
71
|
+
export type ArchiveBody = RoundBody & {
|
|
42
72
|
mode: 'stopped' | 'after-content' | 'discard' | 'hard-coded';
|
|
43
73
|
confirmation?: string;
|
|
44
74
|
};
|
|
@@ -64,10 +94,23 @@ export type MakeContentResult = TransitionSuccess & {
|
|
|
64
94
|
}>;
|
|
65
95
|
};
|
|
66
96
|
export type PreflightResult = {
|
|
97
|
+
/** Saved document version used for these checks. */
|
|
98
|
+
document?: {
|
|
99
|
+
status: Status;
|
|
100
|
+
phase?: number;
|
|
101
|
+
updatedAt?: string;
|
|
102
|
+
};
|
|
103
|
+
/** Content language selection and labels when block placements are localized. */
|
|
104
|
+
contentLocales?: {
|
|
105
|
+
selected: string;
|
|
106
|
+
labels: Record<string, string>;
|
|
107
|
+
};
|
|
67
108
|
goalNotes?: Array<{
|
|
68
109
|
metricId: DocId;
|
|
69
110
|
message: string;
|
|
70
111
|
}>;
|
|
112
|
+
/** Advisory only. This does not affect Start readiness. */
|
|
113
|
+
browserWritablePrimaryId?: DocId;
|
|
71
114
|
checks: Array<{
|
|
72
115
|
code: ReadinessCode;
|
|
73
116
|
ok: boolean;
|
|
@@ -89,9 +132,14 @@ export type PreflightResult = {
|
|
|
89
132
|
collection: string;
|
|
90
133
|
id: DocId;
|
|
91
134
|
title: string;
|
|
135
|
+
locales?: string[];
|
|
136
|
+
allLocales?: true;
|
|
137
|
+
localeCodes?: string[];
|
|
138
|
+
slotCount?: number;
|
|
92
139
|
url?: string;
|
|
93
140
|
editorUrl?: string;
|
|
94
141
|
slots?: Record<ArmSlot, number>;
|
|
142
|
+
partlyFilledSlots?: ArmSlot[];
|
|
95
143
|
ok: boolean;
|
|
96
144
|
detail?: string;
|
|
97
145
|
}>;
|
|
@@ -127,6 +175,7 @@ export interface PhaseSummary {
|
|
|
127
175
|
kind: MetricSource['kind'];
|
|
128
176
|
role: 'primary' | 'secondary' | 'guardrail';
|
|
129
177
|
clickGoal?: true;
|
|
178
|
+
browserWritable?: true;
|
|
130
179
|
resolvedCap?: number | null;
|
|
131
180
|
historyUnits?: number;
|
|
132
181
|
capNotice?: 'no-history';
|
|
@@ -183,16 +232,13 @@ export type EventBody = {
|
|
|
183
232
|
attributes?: Record<string, string | number | boolean>;
|
|
184
233
|
}>;
|
|
185
234
|
};
|
|
186
|
-
export type AccessKind = 'manage' | 'readResults' | 'manifestKey' | '
|
|
235
|
+
export type AccessKind = 'manage' | 'readResults' | 'surface' | 'manifestKey' | 'browserEvents';
|
|
187
236
|
export type EndpointContext<TUser extends {
|
|
188
237
|
id: string | number;
|
|
189
238
|
} = {
|
|
190
239
|
id: string | number;
|
|
191
240
|
}> = {
|
|
192
241
|
options: ResolvedOptions<TUser>;
|
|
193
|
-
unit?: {
|
|
194
|
-
visitorId: string;
|
|
195
|
-
};
|
|
196
242
|
};
|
|
197
243
|
export type ClickKeysResult = {
|
|
198
244
|
keys: Array<{
|
|
@@ -201,15 +247,25 @@ export type ClickKeysResult = {
|
|
|
201
247
|
label: string;
|
|
202
248
|
}>;
|
|
203
249
|
};
|
|
250
|
+
export type PageRow = {
|
|
251
|
+
id: DocId;
|
|
252
|
+
title: string;
|
|
253
|
+
path: string | null;
|
|
254
|
+
pathKey: string | null;
|
|
255
|
+
published: boolean;
|
|
256
|
+
address?: string;
|
|
257
|
+
draftAddress?: string;
|
|
258
|
+
status?: 'published' | 'draft' | 'changed';
|
|
259
|
+
updatedAt?: string;
|
|
260
|
+
editor?: 'puck' | 'blocks';
|
|
261
|
+
editorUrl?: string;
|
|
262
|
+
};
|
|
204
263
|
export type PagesResult = {
|
|
205
|
-
docs:
|
|
206
|
-
id: DocId;
|
|
207
|
-
title: string;
|
|
208
|
-
path: string | null;
|
|
209
|
-
pathKey: string | null;
|
|
210
|
-
published: boolean;
|
|
211
|
-
}>;
|
|
264
|
+
docs: PageRow[];
|
|
212
265
|
hasNextPage: boolean;
|
|
266
|
+
pageLimitReached?: boolean;
|
|
267
|
+
totalDocs?: number;
|
|
268
|
+
pagingCounter?: number;
|
|
213
269
|
};
|
|
214
270
|
export type PlacementStatusBody = {
|
|
215
271
|
docs?: Array<{
|
|
@@ -251,6 +307,7 @@ export type PlacementStatusResult = {
|
|
|
251
307
|
slot?: string;
|
|
252
308
|
}>;
|
|
253
309
|
winnerArm?: string;
|
|
310
|
+
discarded?: boolean;
|
|
254
311
|
rollout: boolean;
|
|
255
312
|
}>;
|
|
256
313
|
};
|
|
@@ -261,3 +318,50 @@ export type WrapBlockBody = {
|
|
|
261
318
|
blockId: string;
|
|
262
319
|
experiment: string;
|
|
263
320
|
};
|
|
321
|
+
/** Current visitor effect of deleting a draft or archived test; independent of its stored content report. */
|
|
322
|
+
export type DeleteImpactResult = {
|
|
323
|
+
effect: 'none';
|
|
324
|
+
} | {
|
|
325
|
+
effect: 'block';
|
|
326
|
+
controlLabel: string;
|
|
327
|
+
unreadablePages: number;
|
|
328
|
+
pageCount: number;
|
|
329
|
+
placements: Array<{
|
|
330
|
+
collection: string;
|
|
331
|
+
id: DocId;
|
|
332
|
+
title: string;
|
|
333
|
+
path: string | null;
|
|
334
|
+
locales?: string[];
|
|
335
|
+
allLocales?: true;
|
|
336
|
+
before: {
|
|
337
|
+
key: string;
|
|
338
|
+
label: string;
|
|
339
|
+
};
|
|
340
|
+
after: {
|
|
341
|
+
key: string;
|
|
342
|
+
label: string;
|
|
343
|
+
};
|
|
344
|
+
}>;
|
|
345
|
+
} | {
|
|
346
|
+
effect: 'page';
|
|
347
|
+
winnerPath: string;
|
|
348
|
+
addresses: string[];
|
|
349
|
+
afterPaths?: Record<string, string>;
|
|
350
|
+
};
|
|
351
|
+
export type CopyPagePlan = {
|
|
352
|
+
title: string;
|
|
353
|
+
path: string;
|
|
354
|
+
phase: number;
|
|
355
|
+
updatedAt: string;
|
|
356
|
+
originalId: DocId;
|
|
357
|
+
originalUpdatedAt: string;
|
|
358
|
+
};
|
|
359
|
+
export type CopyPageResult = {
|
|
360
|
+
doc: Record<string, unknown>;
|
|
361
|
+
copy: {
|
|
362
|
+
id: DocId;
|
|
363
|
+
title: string;
|
|
364
|
+
path: string;
|
|
365
|
+
editorUrl: string;
|
|
366
|
+
};
|
|
367
|
+
};
|
package/dist/types/puck.d.ts
CHANGED
package/dist/types/runtime.d.ts
CHANGED
|
@@ -2,15 +2,21 @@ import type { Payload } from 'payload';
|
|
|
2
2
|
import type { NextRequest } from 'next/server';
|
|
3
3
|
import type { Attributes } from './contracts.js';
|
|
4
4
|
import type { Manifest } from './manifest.js';
|
|
5
|
+
type CookieOptions = {
|
|
6
|
+
name?: string;
|
|
7
|
+
maxAgeDays?: number;
|
|
8
|
+
/** Reject pre-rc.9 visitor IDs, including upgraded cookies, starting on this UTC date. Can only shorten the release cutoff. */
|
|
9
|
+
legacyCutoff?: string;
|
|
10
|
+
domain?: string;
|
|
11
|
+
/** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
12
|
+
consent?(req: NextRequest): boolean;
|
|
13
|
+
};
|
|
5
14
|
export interface ExperimentsProxyRuntimeOptions {
|
|
6
15
|
secret: string | string[];
|
|
7
16
|
apiRoute: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
domain?: string; /** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
12
|
-
consent?(req: NextRequest): boolean;
|
|
13
|
-
};
|
|
17
|
+
/** Limit new visitor IDs by trusted client address, or pass false when protected upstream. */
|
|
18
|
+
rateLimitUnit: false | ((req: NextRequest) => boolean | Promise<boolean>);
|
|
19
|
+
cookie?: CookieOptions;
|
|
14
20
|
loadManifest?: (opts?: {
|
|
15
21
|
ifRevision?: number;
|
|
16
22
|
}) => Promise<Manifest | 'not-modified' | null>;
|
|
@@ -27,11 +33,10 @@ export interface ExperimentsProxyRuntimeOptions {
|
|
|
27
33
|
export interface ExperimentsProxyRuntime {
|
|
28
34
|
readonly secrets: readonly string[];
|
|
29
35
|
readonly apiRoute: string;
|
|
30
|
-
readonly
|
|
36
|
+
readonly rateLimitUnit: ExperimentsProxyRuntimeOptions['rateLimitUnit'];
|
|
37
|
+
readonly cookie: CookieOptions & {
|
|
31
38
|
name: string;
|
|
32
39
|
maxAgeDays: number;
|
|
33
|
-
domain?: string; /** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
34
|
-
consent?(req: NextRequest): boolean;
|
|
35
40
|
};
|
|
36
41
|
readonly loadManifest?: ExperimentsProxyRuntimeOptions['loadManifest'];
|
|
37
42
|
readonly getUnit?: ExperimentsProxyRuntimeOptions['getUnit'];
|
|
@@ -57,3 +62,4 @@ export interface ExperimentsServerRuntime<TUser extends {
|
|
|
57
62
|
userIdOf: NonNullable<ExperimentsServerRuntimeOptions<TUser>['userIdOf']>;
|
|
58
63
|
attributesOf: NonNullable<ExperimentsServerRuntimeOptions<TUser>['attributesOf']>;
|
|
59
64
|
}
|
|
65
|
+
export {};
|
package/dist/types/snapshot.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type SnapshotHealth = {
|
|
|
12
12
|
id?: string | number;
|
|
13
13
|
path?: string;
|
|
14
14
|
};
|
|
15
|
+
} | {
|
|
16
|
+
code: 'rapid-browser-events';
|
|
15
17
|
};
|
|
16
18
|
import type { GaussianPrior } from '@delmaredigital/experiments-stats';
|
|
17
19
|
import type { DocId, MetricSource } from './contracts.js';
|