@delmaredigital/payload-experiments 0.3.0-rc.4 → 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 +293 -688
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +4 -4
- package/dist/admin/PlacementStatus.d.ts +3 -0
- package/dist/admin/PlacementStatus.js +54 -0
- 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 +5 -0
- package/dist/admin/blocks/BlockPanel.js +245 -0
- package/dist/admin/blocks/TestBlockField.d.ts +5 -0
- package/dist/admin/blocks/TestBlockField.js +163 -0
- package/dist/admin/blocks/formApi.d.ts +46 -0
- package/dist/admin/blocks/formApi.js +159 -0
- package/dist/admin/blocks/inject.d.ts +7 -0
- package/dist/admin/blocks/inject.js +42 -0
- package/dist/admin/blocks/model.d.ts +18 -0
- package/dist/admin/blocks/model.js +49 -0
- package/dist/admin/blocks/statusCache.d.ts +9 -0
- package/dist/admin/blocks/statusCache.js +92 -0
- package/dist/admin/blocks/useBlockForm.d.ts +17 -0
- package/dist/admin/blocks/useBlockForm.js +46 -0
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +47 -0
- package/dist/admin/copy/blocks.js +72 -0
- package/dist/admin/copy/goals.d.ts +8 -1
- package/dist/admin/copy/goals.js +14 -4
- package/dist/admin/copy/newTest.d.ts +13 -4
- package/dist/admin/copy/newTest.js +16 -4
- package/dist/admin/goals/XpGoalField.d.ts +4 -0
- package/dist/admin/goals/XpGoalField.js +194 -0
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +11 -0
- package/dist/admin/pageCollections.js +23 -0
- package/dist/admin/paths.d.ts +9 -0
- package/dist/admin/paths.js +9 -0
- package/dist/admin/placementStatus.model.d.ts +2 -0
- package/dist/admin/placementStatus.model.js +19 -0
- 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 +298 -59
- package/dist/admin/surface/TestsSurface.js +13 -8
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +159 -85
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +7 -6
- package/dist/admin/surface/goals/data.js +6 -3
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +12 -3
- package/dist/admin/surface/goals/goals.model.js +43 -2
- package/dist/admin/surface/home.model.d.ts +9 -8
- package/dist/admin/surface/home.model.js +28 -23
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +146 -101
- package/dist/admin/surface/newTest/PageWizard.d.ts +8 -0
- package/dist/admin/surface/newTest/PageWizard.js +244 -0
- 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 -57
- 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 -161
- 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 +28 -133
- 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.d.ts +3 -0
- package/dist/blocks/bindings.js +28 -0
- package/dist/blocks/createExperimentBlock.d.ts +6 -0
- package/dist/blocks/createExperimentBlock.js +77 -0
- package/dist/blocks/formState.d.ts +31 -0
- package/dist/blocks/formState.js +146 -0
- package/dist/blocks/model.d.ts +41 -0
- package/dist/blocks/model.js +34 -0
- 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/client/ExperimentGroup.d.ts +6 -0
- package/dist/client/ExperimentGroup.js +9 -0
- package/dist/client/ExperimentsProvider.js +20 -4
- package/dist/client/clickGoals.d.ts +4 -0
- package/dist/client/clickGoals.js +43 -0
- package/dist/collections/experiments/config.js +29 -10
- package/dist/collections/experiments/deleteGuard.d.ts +2 -1
- package/dist/collections/experiments/deleteGuard.js +14 -3
- package/dist/collections/experiments/editability.js +4 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.d.ts +2 -0
- package/dist/collections/experiments/pickSlug.js +10 -0
- package/dist/collections/labels.d.ts +3 -0
- package/dist/collections/labels.js +20 -0
- package/dist/collections/metrics.js +28 -6
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/phases.js +1 -0
- package/dist/collections/serialize.js +12 -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/clickGoals.d.ts +9 -0
- package/dist/db/clickGoals.js +22 -0
- package/dist/db/delete.d.ts +2 -1
- package/dist/db/delete.js +3 -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/locks.d.ts +8 -0
- package/dist/db/locks.js +27 -4
- package/dist/db/names.d.ts +4 -0
- package/dist/db/names.js +4 -0
- package/dist/db/pageBindings.d.ts +4 -0
- package/dist/db/pageBindings.js +17 -0
- package/dist/db/pageBusy.d.ts +2 -0
- package/dist/db/pageBusy.js +10 -0
- package/dist/db/pageContent.d.ts +10 -0
- package/dist/db/pageContent.js +79 -0
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +35 -0
- package/dist/db/placements.js +62 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/slugs.d.ts +8 -0
- package/dist/db/slugs.js +40 -0
- package/dist/db/snapshots.d.ts +7 -0
- package/dist/db/snapshots.js +8 -5
- package/dist/endpoints/clickKeys.d.ts +5 -0
- package/dist/endpoints/clickKeys.js +17 -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 +106 -39
- package/dist/endpoints/index.js +85 -9
- package/dist/endpoints/pages.d.ts +5 -0
- package/dist/endpoints/pages.js +303 -0
- package/dist/endpoints/placementStatus.d.ts +6 -0
- package/dist/endpoints/placementStatus.js +246 -0
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/readBody.d.ts +2 -0
- package/dist/endpoints/readBody.js +24 -0
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +10 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -5
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/endpoints/wrapBlock.d.ts +6 -0
- package/dist/endpoints/wrapBlock.js +76 -0
- package/dist/errors.d.ts +7 -2
- package/dist/errors.js +11 -3
- 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 +25 -7
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +6 -1
- package/dist/exports/adminClient.js +6 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/blocks.d.ts +2 -0
- package/dist/exports/blocks.js +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +1 -0
- package/dist/exports/index.d.ts +6 -1
- package/dist/exports/index.js +3 -0
- package/dist/exports/puck.d.ts +3 -1
- package/dist/exports/puck.js +2 -0
- package/dist/exports/puckEditor.d.ts +3 -0
- package/dist/exports/puckEditor.js +2 -0
- package/dist/exports/rsc.d.ts +4 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/fields/xpGoal.d.ts +3 -0
- package/dist/fields/xpGoal.js +16 -0
- package/dist/globals/state.js +10 -0
- package/dist/goals/cache.d.ts +3 -0
- package/dist/goals/cache.js +35 -0
- package/dist/goals/fairness.d.ts +40 -0
- package/dist/goals/fairness.js +209 -0
- package/dist/goals/key.d.ts +4 -0
- package/dist/goals/key.js +3 -0
- package/dist/goals/picker/clickGoalPicker.model.d.ts +36 -0
- package/dist/goals/picker/clickGoalPicker.model.js +63 -0
- package/dist/goals/picker/copy.d.ts +20 -0
- package/dist/goals/picker/copy.js +24 -0
- package/dist/goals/picker/useClickGoalPicker.d.ts +30 -0
- package/dist/goals/picker/useClickGoalPicker.js +222 -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 +30 -1
- package/dist/hooks/pageGuard.js +337 -107
- 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 +65 -0
- package/dist/options.d.ts +4 -0
- package/dist/options.js +62 -1
- package/dist/plugin.js +56 -44
- 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 +6 -1
- package/dist/puck/copy.js +6 -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 +192 -19
- package/dist/puck/editor/editor.css +329 -24
- package/dist/puck/editor/editor.model.d.ts +21 -3
- package/dist/puck/editor/editor.model.js +67 -7
- 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/integration.d.ts +10 -0
- package/dist/puck/editor/integration.js +30 -0
- 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.d.ts +7 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +153 -0
- 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/integration.d.ts +6 -0
- package/dist/puck/integration.js +21 -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/puck/xpGoalField.d.ts +3 -0
- package/dist/puck/xpGoalField.js +6 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +12 -0
- package/dist/results/health.js +55 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/snapshot.js +15 -2
- 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 +63 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/pageKindSeoContract.d.ts +27 -0
- package/dist/server/pageKindSeoContract.js +80 -0
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +88 -12
- package/dist/server/resolveExperimentBlocks.d.ts +5 -0
- package/dist/server/resolveExperimentBlocks.js +52 -0
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +104 -25
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/toClientAssignments.js +2 -1
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +8 -4
- package/dist/testSurface/actions/DecideDialog.d.ts +16 -0
- package/dist/{admin → testSurface}/actions/DecideDialog.js +79 -56
- 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/testSurface/api.d.ts +60 -0
- package/dist/testSurface/api.js +167 -0
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +30 -8
- package/dist/{admin → testSurface}/copy/actions.js +40 -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 +59 -6
- package/dist/testSurface/copy/readiness.js +136 -0
- package/dist/{admin → testSurface}/copy/results.d.ts +7 -3
- package/dist/{admin → testSurface}/copy/results.js +7 -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 +56 -7
- 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/{admin → testSurface}/metricSource.model.d.ts +2 -0
- package/dist/{admin → testSurface}/metricSource.model.js +4 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/testSurface/placements/placementLabels.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.js +22 -0
- package/dist/testSurface/placements/placementLabels.model.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.model.js +12 -0
- package/dist/testSurface/placements/usePlacementLabels.d.ts +12 -0
- package/dist/testSurface/placements/usePlacementLabels.js +102 -0
- 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/DataQualityPanel.js +4 -1
- 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 -0
- package/dist/{admin → testSurface}/results/results.model.js +14 -6
- package/dist/{admin → testSurface}/surface/contracts.d.ts +23 -8
- 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/testSurface/surface/pagePicker/pagePicker.model.d.ts +29 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +40 -0
- 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/testSurface/surface/readiness/readiness.model.d.ts +57 -0
- 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/testSurface/surface/results/ReleasePages.d.ts +19 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +43 -47
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +129 -46
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +36 -9
- 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/testSurface/surface/test/AdvancedSection.js +169 -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/testSurface/surface/test/GoalSection.js +341 -0
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +6 -2
- package/dist/testSurface/surface/test/PageHoldout.d.ts +3 -0
- package/dist/testSurface/surface/test/PageHoldout.js +70 -0
- 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 +81 -40
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +40 -8
- package/dist/testSurface/surface/test/fields.js +306 -0
- package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/jumpToSection.js +4 -3
- package/dist/testSurface/surface/test/pageParts.d.ts +5 -0
- package/dist/testSurface/surface/test/pageParts.js +106 -0
- 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 +4 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +6 -2
- 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/testSurface/useApi.d.ts +60 -0
- package/dist/testSurface/useApi.js +8 -0
- 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 +4 -6
- package/dist/transitions/addMetric.js +33 -2
- 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 +18 -1
- package/dist/transitions/checkStart.js +207 -9
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +30 -3
- package/dist/transitions/deleteExperiment.d.ts +5 -3
- package/dist/transitions/deleteExperiment.js +43 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +13 -4
- package/dist/transitions/makeContent.d.ts +7 -1
- package/dist/transitions/makeContent.js +74 -22
- 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/pageCollection.d.ts +10 -0
- package/dist/transitions/pageCollection.js +20 -0
- package/dist/transitions/pageVersions.d.ts +10 -0
- package/dist/transitions/pageVersions.js +46 -0
- package/dist/transitions/phaseRecord.d.ts +3 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +40 -0
- package/dist/transitions/placementInteractions.js +98 -0
- package/dist/transitions/placements.d.ts +58 -4
- package/dist/transitions/placements.js +391 -21
- package/dist/transitions/preflightData.d.ts +7 -5
- package/dist/transitions/preflightData.js +269 -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 +3 -4
- package/dist/transitions/resolveCaps.js +6 -2
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +112 -31
- 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/admin.d.ts +1 -1
- package/dist/types/assignments.d.ts +1 -0
- package/dist/types/contracts.d.ts +30 -3
- package/dist/types/endpoints.d.ts +204 -13
- package/dist/types/index.d.ts +3 -0
- package/dist/types/puck.d.ts +8 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +19 -4
- package/dist/types/surface.d.ts +20 -7
- 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 +9 -1
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -18
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -9
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/api.d.ts +0 -38
- package/dist/admin/api.js +0 -99
- package/dist/admin/copy/readiness.js +0 -71
- package/dist/admin/copy/testPage.js +0 -100
- 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/readiness/ActionDialogs.js +0 -302
- package/dist/admin/surface/readiness/Banner.js +0 -166
- 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.d.ts +0 -24
- package/dist/admin/surface/readiness/readiness.model.js +0 -123
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/results/ReleasePages.d.ts +0 -14
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/AdvancedSection.js +0 -160
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/GoalSection.js +0 -228
- 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 -184
- package/dist/admin/surface/test/pageParts.d.ts +0 -2
- package/dist/admin/surface/test/pageParts.js +0 -45
- package/dist/admin/surface/test/testPage.css +0 -90
- package/dist/admin/surface/useTestDocument.d.ts +0 -23
- package/dist/admin/surface/useTestDocument.js +0 -377
- package/dist/admin/useApi.d.ts +0 -35
- package/dist/admin/useApi.js +0 -10
- /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}/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/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/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/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
import type { TestsSurfaceProps } from '../../types/surface.js';
|
|
3
|
+
export declare function renderTestsSurface(req: PayloadRequest, clientProps: TestsSurfaceProps | null): Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").JSX.Element | null | undefined>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
3
|
+
import { accentStyles } from '../../ui/accent.js';
|
|
4
|
+
import { xpOptionsFromReq } from '../../options/fromReq.js';
|
|
5
|
+
import { XP_TESTS_SURFACE } from '../paths.js';
|
|
6
|
+
import { SURFACE_COPY } from '../../testSurface/copy/surface.js';
|
|
7
|
+
export async function renderTestsSurface(req, clientProps) {
|
|
8
|
+
// Keep the server export importable in plain Node; Next loads the CSS-bearing client boundary on render.
|
|
9
|
+
const { RootViewMessage } = await import('../components/RootViewMessage.js');
|
|
10
|
+
if (!clientProps) return /*#__PURE__*/ _jsx(RootViewMessage, {
|
|
11
|
+
children: SURFACE_COPY.noAccess
|
|
12
|
+
});
|
|
13
|
+
function TestsSurfaceFallback() {
|
|
14
|
+
return /*#__PURE__*/ _jsx(RootViewMessage, {
|
|
15
|
+
alert: true,
|
|
16
|
+
children: SURFACE_COPY.notInstalled
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const css = accentStyles(xpOptionsFromReq(req).theme?.accent);
|
|
20
|
+
const surface = RenderServerComponent({
|
|
21
|
+
Component: XP_TESTS_SURFACE,
|
|
22
|
+
Fallback: TestsSurfaceFallback,
|
|
23
|
+
importMap: req.payload.importMap,
|
|
24
|
+
clientProps
|
|
25
|
+
});
|
|
26
|
+
return css ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ _jsx("style", {
|
|
29
|
+
children: css
|
|
30
|
+
}),
|
|
31
|
+
surface
|
|
32
|
+
]
|
|
33
|
+
}) : surface;
|
|
34
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResolvedOptions } from '../types/contracts.js';
|
|
2
|
+
/** Same document-kind rule as the scan; Payload blocks are top level, Puck is recursive. */
|
|
3
|
+
export declare function placementSlugs(options: Pick<ResolvedOptions, 'blocks' | 'puck'>, collection: string, doc: Record<string, unknown> | undefined): string[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { puckExperimentSlug } from '../puck/experimentSlug.js';
|
|
2
|
+
import { walkVisiblePuck } from '../puck/visibility.js';
|
|
3
|
+
import { documentEditor, puckCollections } from '../options.js';
|
|
4
|
+
import { EXPERIMENT_BLOCK_SLUG, hostBlocks } from './model.js';
|
|
5
|
+
/** Same document-kind rule as the scan; Payload blocks are top level, Puck is recursive. */ export function placementSlugs(options, collection, doc) {
|
|
6
|
+
if (!doc) return [];
|
|
7
|
+
const editor = documentEditor(options, collection, doc);
|
|
8
|
+
if (editor === 'blocks') {
|
|
9
|
+
const registration = options.blocks?.collections.find((r)=>r.slug === collection);
|
|
10
|
+
if (!registration) return [];
|
|
11
|
+
return [
|
|
12
|
+
...new Set(hostBlocks(doc[registration.field]).flatMap((block)=>block.blockType === (registration.blockSlug ?? EXPERIMENT_BLOCK_SLUG) && typeof block.experiment === 'string' ? [
|
|
13
|
+
block.experiment
|
|
14
|
+
] : []))
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
if (editor !== 'puck') return [];
|
|
18
|
+
const registration = puckCollections(options).find((r)=>r.slug === collection);
|
|
19
|
+
const found = new Set();
|
|
20
|
+
if (registration) walkVisiblePuck(doc[registration.field], (node, visibility)=>{
|
|
21
|
+
if (visibility.hidden || node.type !== 'ExperimentSlot') return;
|
|
22
|
+
const slug = puckExperimentSlug(node.props.experiment);
|
|
23
|
+
if (typeof slug === 'string') found.add(slug);
|
|
24
|
+
});
|
|
25
|
+
return [
|
|
26
|
+
...found
|
|
27
|
+
];
|
|
28
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { XP_BLOCK_STATUS, XP_BLOCK_ROW_LABEL, XP_COPY_ORIGINAL } from '../admin/paths.js';
|
|
2
|
+
import { BLOCK_SLOTS, EXPERIMENT_BLOCK_SLUG } from './model.js';
|
|
3
|
+
export function validateExperimentSlots(value) {
|
|
4
|
+
if (!Array.isArray(value)) return true;
|
|
5
|
+
const slots = value.map((row)=>row?.slot);
|
|
6
|
+
return new Set(slots).size === slots.length ? true : 'Each version appears once';
|
|
7
|
+
}
|
|
8
|
+
export function createExperimentBlock({ blocks, slug = EXPERIMENT_BLOCK_SLUG }) {
|
|
9
|
+
if (blocks.some((block)=>block.slug === slug)) throw new Error('Experiment blocks cannot be nested.');
|
|
10
|
+
return {
|
|
11
|
+
slug,
|
|
12
|
+
labels: {
|
|
13
|
+
singular: 'Experiment',
|
|
14
|
+
plural: 'Experiments'
|
|
15
|
+
},
|
|
16
|
+
fields: [
|
|
17
|
+
{
|
|
18
|
+
name: 'xpBlockStatus',
|
|
19
|
+
type: 'ui',
|
|
20
|
+
admin: {
|
|
21
|
+
components: {
|
|
22
|
+
Field: XP_BLOCK_STATUS
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'experiment',
|
|
28
|
+
label: 'Test',
|
|
29
|
+
type: 'text',
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'slots',
|
|
34
|
+
label: 'Versions',
|
|
35
|
+
type: 'array',
|
|
36
|
+
validate: validateExperimentSlots,
|
|
37
|
+
admin: {
|
|
38
|
+
components: {
|
|
39
|
+
RowLabel: XP_BLOCK_ROW_LABEL
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
fields: [
|
|
43
|
+
{
|
|
44
|
+
name: 'xpCopyOriginal',
|
|
45
|
+
type: 'ui',
|
|
46
|
+
admin: {
|
|
47
|
+
components: {
|
|
48
|
+
Field: XP_COPY_ORIGINAL
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'slot',
|
|
54
|
+
label: 'Version',
|
|
55
|
+
type: 'select',
|
|
56
|
+
required: true,
|
|
57
|
+
options: BLOCK_SLOTS.map((value, index)=>({
|
|
58
|
+
value,
|
|
59
|
+
label: [
|
|
60
|
+
'Original',
|
|
61
|
+
'Variant A',
|
|
62
|
+
'Variant B',
|
|
63
|
+
'Variant C'
|
|
64
|
+
][index]
|
|
65
|
+
}))
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'blocks',
|
|
69
|
+
label: 'Content',
|
|
70
|
+
type: 'blocks',
|
|
71
|
+
blocks
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Block, Field, SanitizedConfig } from 'payload';
|
|
2
|
+
import { type ExperimentBlock, type HostBlock } from './model.js';
|
|
3
|
+
type RowConfig = {
|
|
4
|
+
blocks?: Block[];
|
|
5
|
+
localization?: SanitizedConfig['localization'];
|
|
6
|
+
};
|
|
7
|
+
type RowsField = Extract<Field, {
|
|
8
|
+
type: 'array' | 'blocks';
|
|
9
|
+
}>;
|
|
10
|
+
/** Mirror Payload 3.90.2's collections/operations/utilities/copyDataWithFreshRowIDs.js:
|
|
11
|
+
* walk configured row/subfield containers only. Mint ids for array/blocks rows, leaving
|
|
12
|
+
* opaque values (including json, richText, relationships and uploads) unchanged.
|
|
13
|
+
* Global block definitions resolve blockReferences; inline slot blocks retain host configs.
|
|
14
|
+
*/
|
|
15
|
+
export declare function freshBlockIds<T>(value: T, field: RowsField, config?: RowConfig, mint?: () => string): T;
|
|
16
|
+
export declare function wrapExperimentBlock(block: HostBlock, experiment: string, field: RowsField, config?: RowConfig, blockSlug?: string): ExperimentBlock;
|
|
17
|
+
export declare function syncExperimentSlots(block: ExperimentBlock, arms: readonly {
|
|
18
|
+
key: string;
|
|
19
|
+
kind?: string;
|
|
20
|
+
slot?: string | null;
|
|
21
|
+
}[], field: RowsField, config?: RowConfig): ExperimentBlock;
|
|
22
|
+
export declare function copyOriginalIntoVersion(block: ExperimentBlock, slot: string, field: RowsField, config?: RowConfig): ExperimentBlock;
|
|
23
|
+
export declare function unwrapExperimentBlock(block: HostBlock, field: RowsField, slot?: string, config?: RowConfig): HostBlock[];
|
|
24
|
+
/** Config coordinates include unnamed layout containers. No field component is injected here. */
|
|
25
|
+
export declare function findRegisteredBlocksField(fields: readonly Field[], name: string): {
|
|
26
|
+
field: Extract<Field, {
|
|
27
|
+
type: 'blocks';
|
|
28
|
+
}>;
|
|
29
|
+
path: Array<string | number>;
|
|
30
|
+
} | undefined;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { BLOCK_SLOTS, EXPERIMENT_BLOCK_SLUG, isObject, slotBlocks } from './model.js';
|
|
2
|
+
/** Mirror Payload 3.90.2's collections/operations/utilities/copyDataWithFreshRowIDs.js:
|
|
3
|
+
* walk configured row/subfield containers only. Mint ids for array/blocks rows, leaving
|
|
4
|
+
* opaque values (including json, richText, relationships and uploads) unchanged.
|
|
5
|
+
* Global block definitions resolve blockReferences; inline slot blocks retain host configs.
|
|
6
|
+
*/ export function freshBlockIds(value, field, config = {}, mint = ()=>globalThis.crypto.randomUUID()) {
|
|
7
|
+
function copyObject(data, fields, parentIsLocalized = false) {
|
|
8
|
+
const result = {
|
|
9
|
+
...data
|
|
10
|
+
};
|
|
11
|
+
for (const child of fields){
|
|
12
|
+
if (child.type === 'row' || child.type === 'collapsible' || child.type === 'group' && !('name' in child && child.name)) {
|
|
13
|
+
Object.assign(result, copyObject(result, child.fields, parentIsLocalized));
|
|
14
|
+
} else if (child.type === 'tabs') {
|
|
15
|
+
for (const tab of child.tabs){
|
|
16
|
+
if ('name' in tab && tab.name) {
|
|
17
|
+
if (Object.hasOwn(result, tab.name)) result[tab.name] = subfields(result[tab.name], tab.fields, tab.localized, parentIsLocalized);
|
|
18
|
+
} else Object.assign(result, copyObject(result, tab.fields, parentIsLocalized));
|
|
19
|
+
}
|
|
20
|
+
} else if (child.type === 'group' && 'name' in child && child.name) {
|
|
21
|
+
if (Object.hasOwn(result, child.name)) result[child.name] = subfields(result[child.name], child.fields, child.localized, parentIsLocalized);
|
|
22
|
+
} else if (child.type === 'array' || child.type === 'blocks') {
|
|
23
|
+
if (Object.hasOwn(result, child.name)) result[child.name] = copyRows(result[child.name], child, parentIsLocalized || Boolean(child.localized));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
function subfields(data, fields, localized, parentIsLocalized) {
|
|
29
|
+
if (!isObject(data)) return data;
|
|
30
|
+
const locales = config.localization ? config.localization.localeCodes : [];
|
|
31
|
+
if (localized && !parentIsLocalized && Object.keys(data).length > 0 && Object.keys(data).every((key)=>locales.includes(key))) return Object.fromEntries(Object.entries(data).map(([locale, value])=>[
|
|
32
|
+
locale,
|
|
33
|
+
isObject(value) ? copyObject(value, fields, true) : value
|
|
34
|
+
]));
|
|
35
|
+
return copyObject(data, fields, parentIsLocalized || Boolean(localized));
|
|
36
|
+
}
|
|
37
|
+
function copyRows(data, rowsField, parentIsLocalized = false) {
|
|
38
|
+
if (Array.isArray(data)) return data.map((row)=>{
|
|
39
|
+
if (!isObject(row)) return row;
|
|
40
|
+
const fields = rowsField.type === 'array' ? rowsField.fields : (config.blocks?.find((block)=>block.slug === row.blockType) ?? [
|
|
41
|
+
...rowsField.blocks,
|
|
42
|
+
...(rowsField.blockReferences ?? []).filter((block)=>typeof block !== 'string')
|
|
43
|
+
].find((block)=>block.slug === row.blockType))?.fields ?? [];
|
|
44
|
+
return {
|
|
45
|
+
...copyObject(row, fields, parentIsLocalized),
|
|
46
|
+
id: mint()
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
if (isObject(data)) return Object.fromEntries(Object.entries(data).map(([locale, rows])=>[
|
|
50
|
+
locale,
|
|
51
|
+
Array.isArray(rows) ? copyRows(rows, rowsField, true) : rows
|
|
52
|
+
]));
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
return copyRows(value, field);
|
|
56
|
+
}
|
|
57
|
+
export function wrapExperimentBlock(block, experiment, field, config = {}, blockSlug = EXPERIMENT_BLOCK_SLUG) {
|
|
58
|
+
if (block.blockType === blockSlug) throw new Error('Experiment blocks cannot be nested.');
|
|
59
|
+
return {
|
|
60
|
+
id: globalThis.crypto.randomUUID(),
|
|
61
|
+
blockType: blockSlug,
|
|
62
|
+
experiment,
|
|
63
|
+
slots: [
|
|
64
|
+
{
|
|
65
|
+
id: globalThis.crypto.randomUUID(),
|
|
66
|
+
slot: 'control',
|
|
67
|
+
blocks: [
|
|
68
|
+
block
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: globalThis.crypto.randomUUID(),
|
|
73
|
+
slot: 'variantA',
|
|
74
|
+
blocks: freshBlockIds([
|
|
75
|
+
block
|
|
76
|
+
], field, config)
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function copySlotBlocks(block, slot, field, config) {
|
|
82
|
+
// Traverse the wrapper too: slot content may use blocks defined only inside
|
|
83
|
+
// createExperimentBlock, rather than in the host's outer blocks field.
|
|
84
|
+
return slotBlocks(freshBlockIds([
|
|
85
|
+
block
|
|
86
|
+
], field, config)[0], slot);
|
|
87
|
+
}
|
|
88
|
+
export function syncExperimentSlots(block, arms, field, config = {}) {
|
|
89
|
+
const wanted = arms.filter((a)=>a.kind !== 'holdout' && a.key !== 'holdout').map((a)=>a.key).filter((slot)=>BLOCK_SLOTS.includes(slot));
|
|
90
|
+
const slots = [
|
|
91
|
+
...new Set(wanted)
|
|
92
|
+
].map((slot)=>block.slots.find((row)=>row.slot === slot) ?? {
|
|
93
|
+
id: globalThis.crypto.randomUUID(),
|
|
94
|
+
slot,
|
|
95
|
+
blocks: copySlotBlocks(block, 'control', field, config)
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
...block,
|
|
99
|
+
slots
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function copyOriginalIntoVersion(block, slot, field, config = {}) {
|
|
103
|
+
return {
|
|
104
|
+
...block,
|
|
105
|
+
slots: block.slots.map((row)=>row.slot === slot && slot !== 'control' ? {
|
|
106
|
+
...row,
|
|
107
|
+
blocks: copySlotBlocks(block, 'control', field, config)
|
|
108
|
+
} : row)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export function unwrapExperimentBlock(block, field, slot = 'control', config = {}) {
|
|
112
|
+
return copySlotBlocks(block, slot, field, config);
|
|
113
|
+
}
|
|
114
|
+
/** Config coordinates include unnamed layout containers. No field component is injected here. */ export function findRegisteredBlocksField(fields, name) {
|
|
115
|
+
function visit(fields, path) {
|
|
116
|
+
for(let i = 0; i < fields.length; i++){
|
|
117
|
+
const field = fields[i], here = [
|
|
118
|
+
...path,
|
|
119
|
+
i
|
|
120
|
+
];
|
|
121
|
+
if ('name' in field && field.name === name && field.type === 'blocks') return {
|
|
122
|
+
field,
|
|
123
|
+
path: here
|
|
124
|
+
};
|
|
125
|
+
if (field.type === 'tabs') for(let t = 0; t < field.tabs.length; t++){
|
|
126
|
+
const tab = field.tabs[t];
|
|
127
|
+
if ('name' in tab && tab.name) continue;
|
|
128
|
+
const found = visit(field.tabs[t].fields, [
|
|
129
|
+
...here,
|
|
130
|
+
'tabs',
|
|
131
|
+
t,
|
|
132
|
+
'fields'
|
|
133
|
+
]);
|
|
134
|
+
if (found) return found;
|
|
135
|
+
}
|
|
136
|
+
if (field.type === 'row' || field.type === 'collapsible') {
|
|
137
|
+
const found = visit(field.fields, [
|
|
138
|
+
...here,
|
|
139
|
+
'fields'
|
|
140
|
+
]);
|
|
141
|
+
if (found) return found;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return visit(fields, []);
|
|
146
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RenderedExposure } from '../types/assignments.js';
|
|
2
|
+
export declare const EXPERIMENT_BLOCK_SLUG = "xpExperiment";
|
|
3
|
+
export declare const BLOCK_SLOTS: readonly ["control", "variantA", "variantB", "variantC"];
|
|
4
|
+
export interface HostBlock {
|
|
5
|
+
id?: string;
|
|
6
|
+
blockType: string;
|
|
7
|
+
blockName?: string;
|
|
8
|
+
[field: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface ExperimentBlock extends HostBlock {
|
|
11
|
+
experiment: string;
|
|
12
|
+
slots: Array<{
|
|
13
|
+
id?: string;
|
|
14
|
+
slot: string;
|
|
15
|
+
blocks: HostBlock[];
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface ExperimentBlockGroup {
|
|
19
|
+
slug: string;
|
|
20
|
+
expose?: RenderedExposure;
|
|
21
|
+
}
|
|
22
|
+
export type ResolvedHostBlock = HostBlock & {
|
|
23
|
+
xpGroup?: ExperimentBlockGroup;
|
|
24
|
+
};
|
|
25
|
+
export interface ResolvedExperimentBlocks {
|
|
26
|
+
blocks: ResolvedHostBlock[];
|
|
27
|
+
rendered: RenderedExposure[];
|
|
28
|
+
groups: Array<ExperimentBlockGroup & {
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export declare const isObject: (v: unknown) => v is Record<string, unknown>;
|
|
34
|
+
export declare const hostBlocks: (v: unknown) => HostBlock[];
|
|
35
|
+
export declare function slotBlocks(block: HostBlock, slot: string): HostBlock[];
|
|
36
|
+
/** Experiments-off rendering preserves stored row ids; only top-level wrappers are read. */
|
|
37
|
+
export declare function controlOnlyBlocks(blocks: unknown, blockSlug?: string): HostBlock[];
|
|
38
|
+
export declare function segmentExperimentBlocks(blocks: readonly ResolvedHostBlock[]): Array<{
|
|
39
|
+
group?: ExperimentBlockGroup;
|
|
40
|
+
blocks: HostBlock[];
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const EXPERIMENT_BLOCK_SLUG = 'xpExperiment';
|
|
2
|
+
export const BLOCK_SLOTS = [
|
|
3
|
+
'control',
|
|
4
|
+
'variantA',
|
|
5
|
+
'variantB',
|
|
6
|
+
'variantC'
|
|
7
|
+
];
|
|
8
|
+
export const isObject = (v)=>!!v && typeof v === 'object' && !Array.isArray(v);
|
|
9
|
+
export const hostBlocks = (v)=>Array.isArray(v) ? v.filter((b)=>isObject(b) && typeof b.blockType === 'string') : [];
|
|
10
|
+
export function slotBlocks(block, slot) {
|
|
11
|
+
const row = Array.isArray(block.slots) ? block.slots.find((row)=>isObject(row) && row.slot === slot) : undefined;
|
|
12
|
+
return isObject(row) ? hostBlocks(row.blocks) : [];
|
|
13
|
+
}
|
|
14
|
+
/** Experiments-off rendering preserves stored row ids; only top-level wrappers are read. */ export function controlOnlyBlocks(blocks, blockSlug = EXPERIMENT_BLOCK_SLUG) {
|
|
15
|
+
return hostBlocks(blocks).flatMap((block)=>block.blockType === blockSlug ? slotBlocks(block, 'control') : [
|
|
16
|
+
block
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
export function segmentExperimentBlocks(blocks) {
|
|
20
|
+
const runs = [];
|
|
21
|
+
for (const block of blocks){
|
|
22
|
+
const group = block.xpGroup, last = runs.at(-1);
|
|
23
|
+
if (last && last.group === group) last.blocks.push(block);
|
|
24
|
+
else runs.push({
|
|
25
|
+
...group ? {
|
|
26
|
+
group
|
|
27
|
+
} : {},
|
|
28
|
+
blocks: [
|
|
29
|
+
block
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return runs;
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
/** One language naming rule for placement lists and visitor-impact details. */
|
|
3
|
+
export declare function placementLanguages(req: PayloadRequest, codes: readonly string[]): {
|
|
4
|
+
locales?: string[];
|
|
5
|
+
allLocales?: true;
|
|
6
|
+
};
|
|
7
|
+
export declare function placementLanguageNames(req: PayloadRequest, codes: readonly string[]): string[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getTranslation } from '@payloadcms/translations';
|
|
2
|
+
/** One language naming rule for placement lists and visitor-impact details. */ export function placementLanguages(req, codes) {
|
|
3
|
+
const localization = req.payload.config.localization;
|
|
4
|
+
const unique = [
|
|
5
|
+
...new Set(codes.filter(Boolean))
|
|
6
|
+
];
|
|
7
|
+
if (localization && unique.length === localization.localeCodes.length) return {
|
|
8
|
+
allLocales: true
|
|
9
|
+
};
|
|
10
|
+
const locales = placementLanguageNames(req, unique);
|
|
11
|
+
return locales.length ? {
|
|
12
|
+
locales
|
|
13
|
+
} : {};
|
|
14
|
+
}
|
|
15
|
+
export function placementLanguageNames(req, codes) {
|
|
16
|
+
const localization = req.payload.config.localization;
|
|
17
|
+
const unique = [
|
|
18
|
+
...new Set(codes.filter(Boolean))
|
|
19
|
+
];
|
|
20
|
+
return unique.map((code)=>{
|
|
21
|
+
const label = localization && localization.locales.find((entry)=>entry.code === code)?.label;
|
|
22
|
+
return label ? getTranslation(label, req.i18n ?? {
|
|
23
|
+
language: 'en',
|
|
24
|
+
fallbackLanguage: 'en'
|
|
25
|
+
}) || code : code;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type PayloadRequest } from 'payload';
|
|
2
|
+
import type { DocId, ResolvedOptions } from '../types/contracts.js';
|
|
3
|
+
export type PlacementInput = 'all-locales' | 'localized';
|
|
4
|
+
export declare function placementLocaleContent(req: PayloadRequest, collection: string, doc: Record<string, unknown> | undefined, input: PlacementInput): Record<string, unknown> | undefined;
|
|
5
|
+
/** The single document → locale view → editor/placements boundary. Compiled schemas are shared per sanitized config.
|
|
6
|
+
* Local API and form documents explicitly bypass all-locale projection.
|
|
7
|
+
*/
|
|
8
|
+
export declare function placementReader(req: PayloadRequest, collection: string, options?: Pick<ResolvedOptions, "puck" | "blocks">): {
|
|
9
|
+
views: PlacementLocaleView[];
|
|
10
|
+
documentViews: PlacementLocaleView[];
|
|
11
|
+
read(doc: Record<string, unknown> | null | undefined, input: PlacementInput, view?: PlacementLocaleView): {
|
|
12
|
+
view: PlacementLocaleView;
|
|
13
|
+
readonly doc: Record<string, unknown> | undefined;
|
|
14
|
+
readonly editor: "page" | "puck" | "blocks";
|
|
15
|
+
readonly slugs: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function allPlacementSlugs(req: PayloadRequest, collection: string, doc: Record<string, unknown> | undefined, input: PlacementInput): string[];
|
|
19
|
+
export interface PlacementLocaleView {
|
|
20
|
+
locale: string;
|
|
21
|
+
fallbackLocale: import('payload').TypedFallbackLocale;
|
|
22
|
+
}
|
|
23
|
+
export declare const placementDocumentKey: (collection: string, id: DocId, view: PlacementLocaleView) => string;
|
|
24
|
+
export type RemovedPlacementViews = Map<string, PlacementLocaleView[]>;
|
|
25
|
+
export declare function localeRequest(req: PayloadRequest, view: PlacementLocaleView): PayloadRequest;
|
|
26
|
+
/** Canonical views of registered content, without multiplying nonlocalized rows. */
|
|
27
|
+
export declare function placementLocaleViews(req: PayloadRequest, collection: string, options?: Pick<ResolvedOptions, "puck" | "blocks">): PlacementLocaleView[];
|
|
28
|
+
/** Compare every locale view: a localized edit can also change fallback
|
|
29
|
+
* content in another locale. Whole-row removals replace every view with absence.
|
|
30
|
+
* The incoming hook document is already flattened to the writing locale.
|
|
31
|
+
*/
|
|
32
|
+
export declare function removedPlacementViews(req: PayloadRequest, collection: string, before: Record<string, unknown> | undefined, after: Record<string, unknown>, removingPage: boolean, input?: PlacementInput): RemovedPlacementViews;
|
|
33
|
+
/** Rebuild unchanged locale maps around a flattened hook write before reading each view. */
|
|
34
|
+
export declare function mergedPlacementLocales(req: PayloadRequest, collection: string, before: Record<string, unknown> | undefined, after: Record<string, unknown>): Record<string, unknown>;
|
|
35
|
+
/** Project host document adapters before they run. Callers own path normalization
|
|
36
|
+
* and use sortLockKeys for the existing experiment → page-path lock ordering. */
|
|
37
|
+
export declare function placementDocumentPaths(req: PayloadRequest, collection: string, docs: Array<Record<string, unknown> | undefined>, input: PlacementInput, pathOf: (doc: Record<string, unknown>) => string | null): string[];
|