@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,4 +1,6 @@
|
|
|
1
|
+
import { placementLanguageSuffix } from '../testSurface/copy/languages.js';
|
|
1
2
|
import { asymmetricGoal } from '../goals/fairness.js';
|
|
3
|
+
import { withSlotsFor } from '../arms/model.js';
|
|
2
4
|
import { checkArms } from '../collections/experiments/armInvariants.js';
|
|
3
5
|
import { normalisePath } from '../runtime/normalisePath.js';
|
|
4
6
|
import { isOpValid } from '../targeting/ops.js';
|
|
@@ -19,11 +21,87 @@ export const relationshipId = (value)=>value == null ? undefined : typeof value
|
|
|
19
21
|
* pageTarget, holdout included, normalised the same way ('' is '/'). Occupancy and lock keys use this. */ export const pageTargetPaths = (arms)=>[
|
|
20
22
|
...new Set(arms.filter((arm)=>typeof arm.pageTarget === 'string').map((arm)=>normalisePath(arm.pageTarget)))
|
|
21
23
|
].sort();
|
|
22
|
-
const placementDetail = ({ collection, id, title })=>({
|
|
24
|
+
const placementDetail = ({ collection, id, title, locales, allLocales, locale, localeLabel })=>({
|
|
23
25
|
collection,
|
|
24
26
|
id,
|
|
25
|
-
title
|
|
27
|
+
title: `${title}${placementLanguageSuffix({
|
|
28
|
+
allLocales,
|
|
29
|
+
locales: locales?.length ? locales : locale ? [
|
|
30
|
+
localeLabel ?? locale
|
|
31
|
+
] : undefined
|
|
32
|
+
})}`
|
|
26
33
|
});
|
|
34
|
+
/** Group only the languages with this finding, independently for each page and
|
|
35
|
+
* finding payload. Single-language occurrence details keep their original shape. */ function placementDetails(findings, all, input, { findingKey = (detail)=>JSON.stringify(detail), includeLocaleCodes = false } = {}) {
|
|
36
|
+
const groups = new Map();
|
|
37
|
+
const ordered = [];
|
|
38
|
+
for (const { placement, detail } of findings){
|
|
39
|
+
if (!placement.locale) {
|
|
40
|
+
ordered.push({
|
|
41
|
+
placement,
|
|
42
|
+
detail,
|
|
43
|
+
languages: new Map(),
|
|
44
|
+
members: []
|
|
45
|
+
});
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const key = JSON.stringify([
|
|
49
|
+
placement.collection,
|
|
50
|
+
String(placement.id),
|
|
51
|
+
findingKey(detail)
|
|
52
|
+
]);
|
|
53
|
+
let group = groups.get(key);
|
|
54
|
+
if (!group) {
|
|
55
|
+
group = {
|
|
56
|
+
placement,
|
|
57
|
+
detail,
|
|
58
|
+
languages: new Map(),
|
|
59
|
+
members: []
|
|
60
|
+
};
|
|
61
|
+
groups.set(key, group);
|
|
62
|
+
ordered.push(group);
|
|
63
|
+
}
|
|
64
|
+
group.languages.set(placement.locale, placement.localeLabel ?? placement.locale);
|
|
65
|
+
group.members.push(placement);
|
|
66
|
+
}
|
|
67
|
+
return ordered.map(({ placement, detail, languages, members })=>{
|
|
68
|
+
if (!placement.locale) return {
|
|
69
|
+
...placementDetail(placement),
|
|
70
|
+
...detail
|
|
71
|
+
};
|
|
72
|
+
const page = all.filter((other)=>other.collection === placement.collection && String(other.id) === String(placement.id));
|
|
73
|
+
const configured = input.placementLocaleCodes ?? (page.some((other)=>other.allLocales) ? [
|
|
74
|
+
...new Set(page.flatMap((other)=>other.locale ? [
|
|
75
|
+
other.locale
|
|
76
|
+
] : []))
|
|
77
|
+
] : undefined);
|
|
78
|
+
const allLocales = configured?.length && configured.every((code)=>languages.has(code)) ? true : undefined;
|
|
79
|
+
const names = [
|
|
80
|
+
...languages.values()
|
|
81
|
+
];
|
|
82
|
+
const title = (members.find((row)=>row.locale === input.placementLocale) ?? members.find((row)=>row.locale === input.placementDefaultLocale) ?? placement).title;
|
|
83
|
+
return {
|
|
84
|
+
...placementDetail({
|
|
85
|
+
...placement,
|
|
86
|
+
title,
|
|
87
|
+
locale: undefined,
|
|
88
|
+
allLocales,
|
|
89
|
+
locales: names
|
|
90
|
+
}),
|
|
91
|
+
...allLocales ? {
|
|
92
|
+
allLocales: true
|
|
93
|
+
} : {
|
|
94
|
+
locales: names
|
|
95
|
+
},
|
|
96
|
+
...includeLocaleCodes ? {
|
|
97
|
+
localeCodes: [
|
|
98
|
+
...languages.keys()
|
|
99
|
+
]
|
|
100
|
+
} : {},
|
|
101
|
+
...detail
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
27
105
|
const positive = (value)=>typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
28
106
|
function invalidParams(arms, point) {
|
|
29
107
|
return arms.flatMap((arm)=>{
|
|
@@ -54,7 +132,7 @@ function invalidParams(arms, point) {
|
|
|
54
132
|
} : {}
|
|
55
133
|
});
|
|
56
134
|
add('invalid-status', e.status === 'draft' || e.status === 'stopped');
|
|
57
|
-
const issues = checkArms(e.arms, e.kind);
|
|
135
|
+
const issues = checkArms(e.kind === 'block' && Array.isArray(e.arms) ? withSlotsFor(e.arms, 'block') : e.arms, e.kind);
|
|
58
136
|
for (const code of ARM_CHECK_ORDER){
|
|
59
137
|
const matches = issues.filter((issue)=>issue.code === code);
|
|
60
138
|
add(code, matches.length === 0, matches);
|
|
@@ -114,29 +192,67 @@ function invalidParams(arms, point) {
|
|
|
114
192
|
}))
|
|
115
193
|
});
|
|
116
194
|
const placements = input.placements ?? [];
|
|
117
|
-
|
|
195
|
+
const placementRemoved = e.kind === 'block' && e.status === 'stopped' && (e.phase ?? 0) >= 1 && placements.length === 0 && input.placementError === undefined;
|
|
196
|
+
add('no-placements', placementRemoved || e.kind !== 'block' || !input.placementError && placements.length > 0, input.placementError);
|
|
197
|
+
add('placement-removed', !placementRemoved);
|
|
118
198
|
const unpublished = placements.filter((p)=>!p.published && !placements.some((other)=>other.published && other.collection === p.collection && String(other.id) === String(p.id)));
|
|
119
|
-
add('placement-unpublished', unpublished.length === 0, unpublished.map(
|
|
199
|
+
add('placement-unpublished', unpublished.length === 0, placementDetails(unpublished.map((placement)=>({
|
|
200
|
+
placement,
|
|
201
|
+
detail: {}
|
|
202
|
+
})), placements, input));
|
|
203
|
+
const nested = placements.filter((p)=>p.published).flatMap((placement)=>(placement.nestedTests ?? []).map((detail)=>({
|
|
204
|
+
placement,
|
|
205
|
+
detail
|
|
206
|
+
})));
|
|
207
|
+
const seenPairs = new Set();
|
|
208
|
+
const uniqueNested = nested.filter(({ placement, detail })=>{
|
|
209
|
+
const key = JSON.stringify([
|
|
210
|
+
placement.collection,
|
|
211
|
+
String(placement.id),
|
|
212
|
+
placement.locale,
|
|
213
|
+
detail.outerSlug ?? detail.outer,
|
|
214
|
+
detail.innerSlug ?? detail.inner
|
|
215
|
+
]);
|
|
216
|
+
if (seenPairs.has(key)) return false;
|
|
217
|
+
seenPairs.add(key);
|
|
218
|
+
return true;
|
|
219
|
+
});
|
|
220
|
+
add('nested-tests', nested.length === 0, placementDetails(uniqueNested, placements, input));
|
|
120
221
|
const duplicates = placements.filter((p)=>p.published && p.duplicateRows);
|
|
121
|
-
add('duplicate-version-row', duplicates.length === 0, duplicates.map(
|
|
122
|
-
|
|
123
|
-
|
|
222
|
+
add('duplicate-version-row', duplicates.length === 0, placementDetails(duplicates.map((placement)=>({
|
|
223
|
+
placement,
|
|
224
|
+
detail: {}
|
|
225
|
+
})), placements, input));
|
|
226
|
+
const identical = placements.filter((p)=>p.published).flatMap((placement)=>(placement.identicalSlots ?? []).filter((slot)=>e.arms.some((arm)=>arm.key === slot && arm.kind !== 'holdout')).map((arm)=>({
|
|
227
|
+
placement,
|
|
228
|
+
detail: {
|
|
229
|
+
arm
|
|
230
|
+
}
|
|
231
|
+
})));
|
|
232
|
+
for (const detail of placementDetails(identical, placements, input)){
|
|
233
|
+
const { arm, ...page } = detail;
|
|
234
|
+
checks.push({
|
|
124
235
|
code: 'version-identical',
|
|
125
236
|
ok: true,
|
|
126
237
|
warning: true,
|
|
127
238
|
detail: {
|
|
128
|
-
arm
|
|
129
|
-
|
|
130
|
-
id: p.id,
|
|
131
|
-
title: p.title
|
|
239
|
+
arm,
|
|
240
|
+
...page
|
|
132
241
|
}
|
|
133
242
|
});
|
|
134
243
|
}
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
244
|
+
const missingVersions = (slots)=>e.arms.filter((arm)=>arm.kind !== 'holdout' && arm.key !== 'holdout' && !(slots[arm.key] > 0)).map((arm)=>arm.key);
|
|
245
|
+
const empty = placements.filter((placement)=>placement.published && missingVersions(placement.slots).length > 0);
|
|
246
|
+
add('empty-slot', e.kind !== 'block' || empty.length === 0, placementDetails(empty.map((placement)=>({
|
|
247
|
+
placement,
|
|
248
|
+
detail: {
|
|
249
|
+
slots: placement.slots,
|
|
250
|
+
missing: missingVersions(placement.slots)
|
|
251
|
+
}
|
|
252
|
+
})), placements, input, {
|
|
253
|
+
findingKey: (detail)=>JSON.stringify(detail.missing),
|
|
254
|
+
includeLocaleCodes: true
|
|
255
|
+
}));
|
|
140
256
|
add('make-content-unsupported', true);
|
|
141
257
|
const localized = placements.find((placement)=>placement.localized);
|
|
142
258
|
if (localized) Object.assign(checks[checks.length - 1], {
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
const blocks = config.blocks ?? [];
|
|
12
12
|
return fields.some((field)=>{
|
|
13
13
|
if (seen.has(field)) return false;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
seen.add(field);
|
|
15
|
+
try {
|
|
16
|
+
if ('localized' in field && field.localized) return true;
|
|
17
|
+
if ('tabs' in field && field.tabs.some((tab)=>tab.localized || hasLocalizedFields(tab.fields, config, seen))) return true;
|
|
18
|
+
if ('fields' in field && hasLocalizedFields(field.fields, config, seen)) return true;
|
|
19
|
+
return field.type === 'blocks' && contentBlocks(field, blocks).some((block)=>hasLocalizedFields(block.fields, config, seen));
|
|
20
|
+
} finally{
|
|
21
|
+
seen.delete(field);
|
|
22
|
+
}
|
|
19
23
|
});
|
|
20
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PayloadRequest } from 'payload';
|
|
2
2
|
import type { DocId } from '../types/contracts.js';
|
|
3
3
|
import type { DecideBody } from '../types/endpoints.js';
|
|
4
|
-
export declare function decide(req: PayloadRequest, { experimentId, winnerArm, note, confirmation }: DecideBody & {
|
|
4
|
+
export declare function decide(req: PayloadRequest, { experimentId, winnerArm, note, confirmation, phase: expectedPhase }: DecideBody & {
|
|
5
5
|
experimentId: DocId;
|
|
6
6
|
}): Promise<{
|
|
7
7
|
doc: import("payload").JsonObject & import("payload").TypeWithID;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withSlotsFor } from '../arms/model.js';
|
|
1
2
|
import { detached, scanPlacements, lockAndRescanPlacements, placementInteractions } from './placementInteractions.js';
|
|
2
3
|
import { DEFAULT_SEQUENTIAL_TUNING_PARAMETER } from '../constants.js';
|
|
3
4
|
import { refreshPlacementDocs } from '../db/placements.js';
|
|
@@ -9,9 +10,9 @@ import { routedPageTests } from '../db/pageOccupancy.js';
|
|
|
9
10
|
import { pageTargetPaths, relationshipId } from './checkStart.js';
|
|
10
11
|
import { expectedConfirm, matchesConfirm, storedWinnerLabel } from './confirmPhrases.js';
|
|
11
12
|
import { withTransition } from './kernel.js';
|
|
12
|
-
import { readPhaseRecord, setPhaseEndedAt, writePhaseRecord } from './phaseRecord.js';
|
|
13
|
+
import { requireCurrentRound, readPhaseRecord, setPhaseEndedAt, writePhaseRecord } from './phaseRecord.js';
|
|
13
14
|
import { readExperiment, refuse, updateExperiment } from './start.js';
|
|
14
|
-
export async function decide(req, { experimentId, winnerArm, note, confirmation }) {
|
|
15
|
+
export async function decide(req, { experimentId, winnerArm, note, confirmation, phase: expectedPhase }) {
|
|
15
16
|
const before = await readExperiment(req, experimentId);
|
|
16
17
|
const options = req.payload.config.custom?.xp;
|
|
17
18
|
const placements = before.status === 'stopped' && before.kind === 'block' ? await detached(req, ()=>scanPlacements(req, options, before.slug)) : [];
|
|
@@ -21,6 +22,7 @@ export async function decide(req, { experimentId, winnerArm, note, confirmation
|
|
|
21
22
|
flagPointId: before.kind === 'flag' ? before.flagPoint : undefined
|
|
22
23
|
}, async ({ req, exec })=>{
|
|
23
24
|
const current = await readExperiment(req, experimentId);
|
|
25
|
+
requireCurrentRound(expectedPhase, current.phase);
|
|
24
26
|
if (current.status !== 'running' && current.status !== 'stopped') refuse('invalid-status');
|
|
25
27
|
if (current.kind === 'flag' && current.flagPoint) {
|
|
26
28
|
// §7.8: recheck point occupancy under its lock before restoring live routing.
|
|
@@ -57,6 +59,7 @@ export async function decide(req, { experimentId, winnerArm, note, confirmation
|
|
|
57
59
|
...current,
|
|
58
60
|
arms: test.arms
|
|
59
61
|
}, placements);
|
|
62
|
+
if (rescan.placements.length === 0) refuse('placement-removed');
|
|
60
63
|
await refreshPlacementDocs(exec, experimentId, test.phase, rescan.docs);
|
|
61
64
|
}
|
|
62
65
|
if (current.kind === 'page' && current.status === 'stopped') {
|
|
@@ -147,7 +150,7 @@ export async function decide(req, { experimentId, winnerArm, note, confirmation
|
|
|
147
150
|
phaseKind: 'rollout',
|
|
148
151
|
startedAt: at,
|
|
149
152
|
seed: test.seed,
|
|
150
|
-
arms,
|
|
153
|
+
arms: current.kind === 'block' ? withSlotsFor(arms, 'block') : arms,
|
|
151
154
|
allocation: test.allocation,
|
|
152
155
|
allocationChanges: [],
|
|
153
156
|
targeting: test.targeting,
|
|
@@ -3,5 +3,5 @@ import type { DocId } from '../types/contracts.js';
|
|
|
3
3
|
/** Lock the entire bulk scope before any per-document hook can take state. */
|
|
4
4
|
export declare function prepareBulkDelete(req: PayloadRequest, where: Where): Promise<void>;
|
|
5
5
|
/** Payload deleteByID owns the request transaction; never commit inside hooks. */
|
|
6
|
-
export declare function deleteExperiment(req: PayloadRequest,
|
|
7
|
-
export declare function deleteExperimentAfter(req: PayloadRequest
|
|
6
|
+
export declare function deleteExperiment(req: PayloadRequest, requestedId: DocId): Promise<void>;
|
|
7
|
+
export declare function deleteExperimentAfter(req: PayloadRequest): Promise<void>;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { safeError } from '../log.js';
|
|
2
2
|
import { retireSlug } from '../db/slugs.js';
|
|
3
3
|
import { txExecutor } from '../db/executor.js';
|
|
4
|
+
import { assertReadCommitted } from '../db/adapter.js';
|
|
4
5
|
import { deleteExperimentSnapshots, serializeDelete } from '../db/delete.js';
|
|
5
6
|
import { deleteExperimentEvents } from '../db/events.js';
|
|
6
7
|
import { lockTransitionScope, sortLockKeys } from '../db/locks.js';
|
|
8
|
+
import { experimentId as canonicalExperimentId } from '../endpoints/routeId.js';
|
|
9
|
+
import { XpRefusal } from '../errors.js';
|
|
7
10
|
import { buildAndStoreManifest } from '../manifest/compile.js';
|
|
8
|
-
import {
|
|
11
|
+
import { API_MESSAGES } from '../testSurface/copy/common.js';
|
|
12
|
+
import { readExperiment } from './start.js';
|
|
9
13
|
/** Lock the entire bulk scope before any per-document hook can take state. */ export async function prepareBulkDelete(req, where) {
|
|
10
14
|
await serializeDelete(req, async ()=>{
|
|
15
|
+
const exec = txExecutor(req);
|
|
16
|
+
await assertReadCommitted(req);
|
|
11
17
|
// §7.8 transition exception: hook read only discovers the lock set; delete still checks access.
|
|
12
18
|
const { docs } = await req.payload.find({
|
|
13
19
|
collection: 'xp-experiments',
|
|
@@ -22,20 +28,25 @@ import { readExperiment, refuse } from './start.js';
|
|
|
22
28
|
where
|
|
23
29
|
});
|
|
24
30
|
for (const experimentId of sortLockKeys(docs.map((doc)=>String(doc.id)))){
|
|
25
|
-
await lockTransitionScope(
|
|
31
|
+
await lockTransitionScope(exec, {
|
|
26
32
|
experimentId
|
|
27
33
|
});
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
|
-
/** Payload deleteByID owns the request transaction; never commit inside hooks. */ export async function deleteExperiment(req,
|
|
37
|
+
/** Payload deleteByID owns the request transaction; never commit inside hooks. */ export async function deleteExperiment(req, requestedId) {
|
|
32
38
|
await serializeDelete(req, async (state)=>{
|
|
33
39
|
const exec = txExecutor(req);
|
|
40
|
+
await assertReadCommitted(req);
|
|
41
|
+
const experimentId = canonicalExperimentId(req, requestedId, 'payload');
|
|
42
|
+
if (experimentId === undefined) throw new XpRefusal('not-found', 'Experiment not found', undefined, 404);
|
|
34
43
|
await lockTransitionScope(exec, {
|
|
35
44
|
experimentId
|
|
36
45
|
});
|
|
37
46
|
const current = await readExperiment(req, experimentId);
|
|
38
|
-
if (current.status !== 'draft' && current.status !== 'archived')
|
|
47
|
+
if (current.status !== 'draft' && current.status !== 'archived') {
|
|
48
|
+
throw new XpRefusal('invalid-status', API_MESSAGES.deleteInvalidStatus, undefined, 409);
|
|
49
|
+
}
|
|
39
50
|
try {
|
|
40
51
|
const collection = 'xp-phases';
|
|
41
52
|
// §7.8 transition exception: cascade while FK references still exist.
|
|
@@ -76,14 +87,13 @@ import { readExperiment, refuse } from './start.js';
|
|
|
76
87
|
}
|
|
77
88
|
});
|
|
78
89
|
}
|
|
79
|
-
export async function deleteExperimentAfter(req
|
|
90
|
+
export async function deleteExperimentAfter(req) {
|
|
80
91
|
await serializeDelete(req, async (state)=>{
|
|
81
92
|
for (const slug of state.retiredSlugs)await retireSlug(txExecutor(req), slug);
|
|
82
93
|
state.retiredSlugs.clear();
|
|
83
94
|
await buildAndStoreManifest(req, {
|
|
84
95
|
excludeIds: [
|
|
85
|
-
...state.excludedIds.values()
|
|
86
|
-
experimentId
|
|
96
|
+
...state.excludedIds.values()
|
|
87
97
|
],
|
|
88
98
|
pruneFlagDefaultIds: [
|
|
89
99
|
...state.pruneFlagDefaultIds.values()
|
|
@@ -9,6 +9,10 @@ export interface TransitionScope {
|
|
|
9
9
|
bump?: boolean;
|
|
10
10
|
/** Best-effort content audit only; a borrowed transaction must never be killed here. */
|
|
11
11
|
audit?: boolean;
|
|
12
|
+
/** Trusted server-side Start must commit its own transaction. Preflight passes the request to host callbacks. */
|
|
13
|
+
requireOwnedTransaction?: boolean;
|
|
14
|
+
/** Guard an ordinary access-checked edit without bypassing the collection's lock hook. */
|
|
15
|
+
edit?: boolean;
|
|
12
16
|
excludeIds?: DocId[];
|
|
13
17
|
}
|
|
14
18
|
/** Runs transition writes on the request's transaction under ordered locks.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { commitTransaction,
|
|
1
|
+
import { commitTransaction, killTransaction } from 'payload';
|
|
2
|
+
import { assertReadCommitted, initTransitionTransaction } from '../db/adapter.js';
|
|
2
3
|
import { pooledExecutor, txExecutor } from '../db/executor.js';
|
|
3
4
|
import { lockTransitionScope } from '../db/locks.js';
|
|
4
5
|
import { currentTxid, txidStatus } from '../db/txid.js';
|
|
5
6
|
import { contentChangeSavepoint } from '../db/appends.js';
|
|
6
7
|
import { isPageBusy } from '../db/pageBusy.js';
|
|
7
|
-
import { XpRefusal } from '../errors.js';
|
|
8
|
+
import { XpRefusal, XpStartTransactionOpen } from '../errors.js';
|
|
8
9
|
import { buildAndStoreManifest } from '../manifest/compile.js';
|
|
9
10
|
/** Runs transition writes on the request's transaction under ordered locks.
|
|
10
11
|
* Returns the callback result and, unless bump is false, the stored manifest's
|
|
@@ -17,15 +18,19 @@ import { buildAndStoreManifest } from '../manifest/compile.js';
|
|
|
17
18
|
* itself fails: the host must observe its own failed commit. Other failures kill
|
|
18
19
|
* even a borrowed transaction. Owned audits follow the ordinary owned path.
|
|
19
20
|
*/ export async function withTransition(req, scope, fn) {
|
|
21
|
+
if (scope.requireOwnedTransaction && req.transactionID != null) {
|
|
22
|
+
throw new XpStartTransactionOpen();
|
|
23
|
+
}
|
|
20
24
|
const hadTransition = Object.prototype.hasOwnProperty.call(req.context, 'xpTransition');
|
|
21
25
|
const previousTransition = req.context.xpTransition;
|
|
22
26
|
let borrowedAudit = scope.audit === true && req.transactionID != null;
|
|
23
27
|
try {
|
|
24
|
-
const owns = await
|
|
28
|
+
const owns = await initTransitionTransaction(req);
|
|
25
29
|
borrowedAudit = scope.audit === true && !owns;
|
|
26
30
|
const exec = txExecutor(req);
|
|
27
|
-
req.context.xpTransition = true;
|
|
28
31
|
const work = async ()=>{
|
|
32
|
+
if (!owns) await assertReadCommitted(req);
|
|
33
|
+
if (!scope.edit) req.context.xpTransition = true;
|
|
29
34
|
await lockTransitionScope(exec, scope);
|
|
30
35
|
return fn({
|
|
31
36
|
exec,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RoundBody } from '../types/endpoints.js';
|
|
1
2
|
import { type PayloadRequest } from 'payload';
|
|
2
3
|
import type { ContentReportReason } from '../types/reasons.js';
|
|
3
4
|
import type { DocId, ResolvedOptions } from '../types/contracts.js';
|
|
@@ -17,7 +18,7 @@ type ContentDoc = {
|
|
|
17
18
|
export declare function hostTransaction(req: PayloadRequest, experimentId: DocId, fn: () => Promise<void>): Promise<void>;
|
|
18
19
|
export declare function makeContent<TUser extends {
|
|
19
20
|
id: DocId;
|
|
20
|
-
}>(req: PayloadRequest, { experimentId, options }: {
|
|
21
|
+
}>(req: PayloadRequest, { experimentId, options, phase: expectedPhase }: RoundBody & {
|
|
21
22
|
experimentId: DocId;
|
|
22
23
|
options: ResolvedOptions<TUser>;
|
|
23
24
|
}): Promise<{
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireCurrentRound } from './phaseRecord.js';
|
|
2
|
+
import { placementReader } from '../blocks/placementLocale.js';
|
|
3
|
+
import { puckExperimentSlug } from '../puck/experimentSlug.js';
|
|
4
|
+
import { puckVisibility, hiddenOnSizes, visibilitySizes } from '../puck/visibility.js';
|
|
5
|
+
import { Forbidden, NotFound, ValidationError, Locked, commitTransaction, killTransaction } from 'payload';
|
|
6
|
+
import { initTransitionTransaction } from '../db/adapter.js';
|
|
2
7
|
import { latestDraftContent, publishedContent as readPublishedContent } from '../db/publishedContent.js';
|
|
3
8
|
import { EXPERIMENT_BLOCK_SLUG, hostBlocks, slotBlocks } from '../blocks/model.js';
|
|
4
9
|
import { findRegisteredBlocksField, freshBlockIds } from '../blocks/formState.js';
|
|
@@ -9,7 +14,7 @@ import { lockContentDefaults } from '../db/appends.js';
|
|
|
9
14
|
import { pooledExecutor, txExecutor } from '../db/executor.js';
|
|
10
15
|
import { currentTxid, txidStatus } from '../db/txid.js';
|
|
11
16
|
import { buildAndStoreManifest } from '../manifest/compile.js';
|
|
12
|
-
import {
|
|
17
|
+
import { puckCollections } from '../options.js';
|
|
13
18
|
import { contentDone } from '../contentDone.js';
|
|
14
19
|
import { archive } from './archive.js';
|
|
15
20
|
import { relationshipId } from './checkStart.js';
|
|
@@ -30,23 +35,40 @@ class LocalizedContent extends Error {
|
|
|
30
35
|
}
|
|
31
36
|
const isNotFound = (error)=>contentFailureReason(error) === 'not-found' || Boolean(error && typeof error === 'object' && 'status' in error && error.status === 404);
|
|
32
37
|
const object = (value)=>value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
33
|
-
/** Flatten selected slots in every content array, including nested selected slots. */ function unwrap(value, slug, slot) {
|
|
38
|
+
/** Flatten selected slots in every content array, including nested selected slots. */ function unwrap(value, slug, slot, visibility = puckVisibility(value)) {
|
|
34
39
|
if (Array.isArray(value)) return value.flatMap((node)=>{
|
|
40
|
+
if (object(node) && visibility.get(node)?.hidden) return [
|
|
41
|
+
node
|
|
42
|
+
];
|
|
35
43
|
if (object(node) && node.type === 'ExperimentSlot' && object(node.props)) {
|
|
36
|
-
|
|
37
|
-
if ((typeof ref === 'string' ? ref : object(ref) ? ref.slug : undefined) === slug) {
|
|
44
|
+
if (puckExperimentSlug(node.props.experiment) === slug) {
|
|
38
45
|
const content = node.props[slot];
|
|
39
46
|
if (!Array.isArray(content)) throw new Error('The winning content slot is missing.');
|
|
40
|
-
|
|
47
|
+
const selected = unwrap(content, slug, slot, visibility);
|
|
48
|
+
const hideOn = hiddenOnSizes(node.props._visibility);
|
|
49
|
+
return hideOn.length ? selected.map((child)=>{
|
|
50
|
+
if (!object(child) || !object(child.props)) return child;
|
|
51
|
+
const current = object(child.props._visibility) ? child.props._visibility : {};
|
|
52
|
+
return {
|
|
53
|
+
...child,
|
|
54
|
+
props: {
|
|
55
|
+
...child.props,
|
|
56
|
+
_visibility: {
|
|
57
|
+
...current,
|
|
58
|
+
hideOn: visibilitySizes.filter((size)=>hideOn.includes(size) || hiddenOnSizes(current).includes(size))
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}) : selected;
|
|
41
63
|
}
|
|
42
64
|
}
|
|
43
65
|
return [
|
|
44
|
-
unwrap(node, slug, slot)
|
|
66
|
+
unwrap(node, slug, slot, visibility)
|
|
45
67
|
];
|
|
46
68
|
});
|
|
47
|
-
if (object(value)) return Object.fromEntries(Object.entries(value).map(([key, child])=>[
|
|
69
|
+
if (object(value)) return visibility.get(value)?.hidden ? value : Object.fromEntries(Object.entries(value).map(([key, child])=>[
|
|
48
70
|
key,
|
|
49
|
-
unwrap(child, slug, slot)
|
|
71
|
+
unwrap(child, slug, slot, visibility)
|
|
50
72
|
]));
|
|
51
73
|
return value;
|
|
52
74
|
}
|
|
@@ -175,7 +197,7 @@ async function fieldRefusal(fields, req, doc, operation = 'update', data = doc,
|
|
|
175
197
|
delete req.transactionID;
|
|
176
198
|
delete req.context.xpTransition;
|
|
177
199
|
try {
|
|
178
|
-
if (!await
|
|
200
|
+
if (!await initTransitionTransaction(req)) throw new Error('A content transaction could not be started.');
|
|
179
201
|
await fn();
|
|
180
202
|
const xid = await currentTxid(txExecutor(req));
|
|
181
203
|
await commitTransaction(req);
|
|
@@ -191,7 +213,7 @@ async function fieldRefusal(fields, req, doc, operation = 'update', data = doc,
|
|
|
191
213
|
else req.context.xpTransition = transition;
|
|
192
214
|
}
|
|
193
215
|
}
|
|
194
|
-
export async function makeContent(req, { experimentId, options }) {
|
|
216
|
+
export async function makeContent(req, { experimentId, options, phase: expectedPhase }) {
|
|
195
217
|
const before = await readExperiment(req, experimentId);
|
|
196
218
|
const { result } = await withTransition(req, {
|
|
197
219
|
experimentId,
|
|
@@ -200,6 +222,7 @@ export async function makeContent(req, { experimentId, options }) {
|
|
|
200
222
|
bump: false
|
|
201
223
|
}, async ({ exec })=>{
|
|
202
224
|
const current = await readExperiment(req, experimentId);
|
|
225
|
+
requireCurrentRound(expectedPhase, current.phase);
|
|
203
226
|
if (current.status !== 'decided' || ![
|
|
204
227
|
'block',
|
|
205
228
|
'flag',
|
|
@@ -235,7 +258,7 @@ export async function makeContent(req, { experimentId, options }) {
|
|
|
235
258
|
// Roll back any remaining writes, then check the row while still
|
|
236
259
|
// detached from the outer transition and its privileged context.
|
|
237
260
|
await killTransaction(req);
|
|
238
|
-
if (!await
|
|
261
|
+
if (!await initTransitionTransaction(req)) throw new Error('A content transaction could not be started.');
|
|
239
262
|
missing = !await readPublishedContent(req, collection, id);
|
|
240
263
|
}
|
|
241
264
|
throw error;
|
|
@@ -272,7 +295,8 @@ export async function makeContent(req, { experimentId, options }) {
|
|
|
272
295
|
}
|
|
273
296
|
};
|
|
274
297
|
if (current.kind === 'block') {
|
|
275
|
-
if (
|
|
298
|
+
if (winner.key === 'holdout') refuse('invalid-winner');
|
|
299
|
+
const winnerSlot = winner.key;
|
|
276
300
|
const registrations = [
|
|
277
301
|
...puckCollections(options),
|
|
278
302
|
...options.blocks?.collections ?? []
|
|
@@ -393,7 +417,7 @@ export async function makeContent(req, { experimentId, options }) {
|
|
|
393
417
|
const drafts = Boolean(config?.versions && config.versions.drafts);
|
|
394
418
|
const published = await readPublishedContent(req, collection, id);
|
|
395
419
|
if (!published) throw new NotFound();
|
|
396
|
-
const editor =
|
|
420
|
+
const editor = placementReader(req, collection, options).read(published, 'all-locales').editor;
|
|
397
421
|
const blockRegistration = options.blocks?.collections.find((r)=>r.slug === collection);
|
|
398
422
|
const contentField = editor === 'blocks' ? blockRegistration?.field : field;
|
|
399
423
|
if (!contentField) throw new Error('This content field is no longer configured.');
|
|
@@ -403,13 +427,13 @@ export async function makeContent(req, { experimentId, options }) {
|
|
|
403
427
|
block
|
|
404
428
|
];
|
|
405
429
|
const rows = Array.isArray(block.slots) ? block.slots : [];
|
|
406
|
-
if (!rows.some((row)=>row?.slot ===
|
|
430
|
+
if (!rows.some((row)=>row?.slot === winnerSlot)) throw new Error('The winning content slot is missing.');
|
|
407
431
|
const registered = findRegisteredBlocksField(config?.fields ?? [], field);
|
|
408
432
|
if (!registered) throw new Error('This content field is no longer configured.');
|
|
409
433
|
return slotBlocks(freshBlockIds([
|
|
410
434
|
block
|
|
411
|
-
], registered.field, req.payload.config)[0],
|
|
412
|
-
}) : unwrap(value, current.slug,
|
|
435
|
+
], registered.field, req.payload.config)[0], winnerSlot);
|
|
436
|
+
}) : unwrap(value, current.slug, winnerSlot);
|
|
413
437
|
const draft = drafts ? await latestDraftContent(req, collection, id) ?? published : published;
|
|
414
438
|
const draftValue = draft[field] ?? null;
|
|
415
439
|
const draftContent = transform(draftValue);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
import type { BlockPlacement } from './placements.js';
|
|
3
|
+
/** Read names for preflight and Start's locked rescan. */
|
|
4
|
+
export declare function nestedPlacementNames(req: PayloadRequest, placements: readonly BlockPlacement[], system?: boolean): Promise<Map<string, string>>;
|
|
5
|
+
export declare const nameNestedPlacements: (placements: readonly BlockPlacement[], names: ReadonlyMap<string, string>) => BlockPlacement[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { findStartDocuments } from './startReads.js';
|
|
2
|
+
/** Read names for preflight and Start's locked rescan. */ export async function nestedPlacementNames(req, placements, system = false) {
|
|
3
|
+
const slugs = [
|
|
4
|
+
...new Set(placements.flatMap((p)=>(p.nestedTests ?? []).flatMap((pair)=>[
|
|
5
|
+
pair.outer,
|
|
6
|
+
pair.inner
|
|
7
|
+
])))
|
|
8
|
+
];
|
|
9
|
+
if (!slugs.length) return new Map();
|
|
10
|
+
const found = await findStartDocuments(req, {
|
|
11
|
+
collection: 'xp-experiments',
|
|
12
|
+
depth: 0,
|
|
13
|
+
pagination: false,
|
|
14
|
+
where: {
|
|
15
|
+
slug: {
|
|
16
|
+
in: slugs
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, system);
|
|
20
|
+
return new Map(found.docs.map((doc)=>[
|
|
21
|
+
String(doc.slug),
|
|
22
|
+
String(doc.name)
|
|
23
|
+
]));
|
|
24
|
+
}
|
|
25
|
+
export const nameNestedPlacements = (placements, names)=>placements.map((p)=>({
|
|
26
|
+
...p,
|
|
27
|
+
nestedTests: p.nestedTests?.map((pair)=>({
|
|
28
|
+
...pair,
|
|
29
|
+
outer: names.get(pair.outer) ?? pair.outer,
|
|
30
|
+
inner: names.get(pair.inner) ?? pair.inner
|
|
31
|
+
}))
|
|
32
|
+
}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
import type { ExperimentsPageCollection } from '../types/contracts.js';
|
|
3
|
+
export declare const PAGE_ADDRESS_FIELDS: string[];
|
|
4
|
+
/** Hosts can resolve drafts in findByPath. For simple addresses, the admin also
|
|
5
|
+
* recognizes never-published drafts when a host lookup only sees live pages. */
|
|
6
|
+
export declare function findDraftPageByPath(req: PayloadRequest, entry: ExperimentsPageCollection, path: string): Promise<(import("payload").JsonObject & import("payload").TypeWithID) | undefined>;
|