@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,76 @@
|
|
|
1
|
+
import { Locked } from 'payload';
|
|
2
|
+
import { readBody } from './readBody.js';
|
|
3
|
+
import { findRegisteredBlocksField, wrapExperimentBlock } from '../blocks/formState.js';
|
|
4
|
+
import { EXPERIMENT_BLOCK_SLUG, hostBlocks, isObject } from '../blocks/model.js';
|
|
5
|
+
import { XpRefusal } from '../errors.js';
|
|
6
|
+
export async function handleWrapBlock(req, { options }) {
|
|
7
|
+
let value;
|
|
8
|
+
try {
|
|
9
|
+
value = await readBody(req);
|
|
10
|
+
} catch (cause) {
|
|
11
|
+
throw new XpRefusal(cause instanceof RangeError ? 'body-too-large' : 'invalid-body', 'Enter a valid request body.', undefined, cause instanceof RangeError ? 413 : 422);
|
|
12
|
+
}
|
|
13
|
+
if (!isObject(value) || Object.keys(value).some((k)=>![
|
|
14
|
+
'collection',
|
|
15
|
+
'id',
|
|
16
|
+
'field',
|
|
17
|
+
'blockId',
|
|
18
|
+
'experiment'
|
|
19
|
+
].includes(k)) || ![
|
|
20
|
+
'collection',
|
|
21
|
+
'field',
|
|
22
|
+
'blockId',
|
|
23
|
+
'experiment'
|
|
24
|
+
].every((k)=>typeof value[k] === 'string' && value[k].trim()) || !(typeof value.id === 'string' && value.id.trim() || typeof value.id === 'number' && Number.isSafeInteger(value.id))) throw new XpRefusal('invalid-body', 'Enter a valid request body.', undefined, 422);
|
|
25
|
+
const { collection, field, blockId, experiment } = value;
|
|
26
|
+
const id = value.id;
|
|
27
|
+
const registration = options.blocks?.collections.find((r)=>r.slug === collection && r.field === field);
|
|
28
|
+
if (!registration) throw new XpRefusal('unknown-collection', "That page type isn't set up for tests.", undefined, 422);
|
|
29
|
+
const tests = await req.payload.find({
|
|
30
|
+
collection: 'xp-experiments',
|
|
31
|
+
req,
|
|
32
|
+
overrideAccess: false,
|
|
33
|
+
depth: 0,
|
|
34
|
+
limit: 1,
|
|
35
|
+
where: {
|
|
36
|
+
slug: {
|
|
37
|
+
equals: experiment
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const test = tests.docs[0];
|
|
42
|
+
if (test?.kind !== 'block') throw new XpRefusal('invalid-body', 'Choose a block test.', undefined, 422);
|
|
43
|
+
if (test.status !== 'draft') throw new XpRefusal('invalid-status', 'This action is not available in the current status.', undefined, 409);
|
|
44
|
+
const doc = await req.payload.findByID({
|
|
45
|
+
collection,
|
|
46
|
+
id,
|
|
47
|
+
req,
|
|
48
|
+
overrideAccess: false,
|
|
49
|
+
depth: 0,
|
|
50
|
+
draft: true,
|
|
51
|
+
includeLockStatus: true
|
|
52
|
+
});
|
|
53
|
+
const blocks = hostBlocks(doc[field]), blockSlug = registration.blockSlug ?? EXPERIMENT_BLOCK_SLUG;
|
|
54
|
+
const index = blocks.findIndex((block)=>block.id === blockId && block.blockType !== blockSlug);
|
|
55
|
+
if (index < 0) throw new XpRefusal('wrap-target-missing', 'Reload the page and try again.', undefined, 409);
|
|
56
|
+
const config = findRegisteredBlocksField(req.payload.config.collections.find((c)=>c.slug === collection)?.fields ?? [], field);
|
|
57
|
+
if (!config) throw new Error(`Experiments blocks field ${collection}.${field} is not configured.`);
|
|
58
|
+
blocks[index] = wrapExperimentBlock(blocks[index], experiment, config.field, req.payload.config, blockSlug);
|
|
59
|
+
try {
|
|
60
|
+
const result = await req.payload.update({
|
|
61
|
+
collection,
|
|
62
|
+
id,
|
|
63
|
+
req,
|
|
64
|
+
overrideAccess: false,
|
|
65
|
+
overrideLock: false,
|
|
66
|
+
draft: true,
|
|
67
|
+
data: {
|
|
68
|
+
[field]: blocks
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return Response.json(result);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error instanceof Locked || error instanceof Error && error.name === 'Locked') throw new XpRefusal('locked-placement', 'Another editor has this page open. Try again when it is unlocked.', undefined, 409);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -14,16 +14,21 @@ export declare class XpLockedFieldError extends Error {
|
|
|
14
14
|
constructor(field: string, experimentStatus: Status);
|
|
15
15
|
}
|
|
16
16
|
export declare class XpNoTransactionError extends Error {
|
|
17
|
+
name: string;
|
|
18
|
+
constructor(message?: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class XpStartTransactionOpen extends Error {
|
|
17
21
|
name: string;
|
|
18
22
|
constructor();
|
|
19
23
|
}
|
|
20
24
|
export declare class XpRefusal extends Error {
|
|
21
25
|
readonly code: RefusalCode;
|
|
22
26
|
readonly detail: unknown | undefined;
|
|
23
|
-
readonly status: 409 | 422 | 500 | 404;
|
|
27
|
+
readonly status: 409 | 413 | 422 | 500 | 404;
|
|
24
28
|
name: string;
|
|
29
|
+
readonly isOperational = true;
|
|
25
30
|
readonly isPublic = true;
|
|
26
|
-
constructor(code: RefusalCode, message: string, detail: unknown | undefined, status: 409 | 422 | 500 | 404);
|
|
31
|
+
constructor(code: RefusalCode, message: string, detail: unknown | undefined, status: 409 | 413 | 422 | 500 | 404, options?: ErrorOptions);
|
|
27
32
|
}
|
|
28
33
|
/** Fixed analysis diagnostics: callers can choose a code, never supply log text. */
|
|
29
34
|
export type AnalysisErrorCode = 'no-baseline' | 'primary-metric-count' | 'duplicate-metric' | 'invalid-timestamp' | 'window-hours' | 'window-before-start' | 'unknown-arm' | 'metric-not-supplied' | 'non-finite-values' | 'non-finite-covariates' | 'source-unavailable' | 'unit-type-unavailable' | 'srm-weights' | 'cuped-non-finite' | 'cuped-binomial' | 'seed-format' | 'snapshot-shape' | 'snapshot-invariants';
|
package/dist/errors.js
CHANGED
|
@@ -17,8 +17,14 @@ export class XpLockedFieldError extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
export class XpNoTransactionError extends Error {
|
|
19
19
|
name = 'XpNoTransactionError';
|
|
20
|
+
constructor(message = 'An active transaction is required'){
|
|
21
|
+
super(message);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class XpStartTransactionOpen extends Error {
|
|
25
|
+
name = 'XpStartTransactionOpen';
|
|
20
26
|
constructor(){
|
|
21
|
-
super('
|
|
27
|
+
super('Call startExperiment after your transaction commits.');
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
export class XpRefusal extends Error {
|
|
@@ -26,9 +32,11 @@ export class XpRefusal extends Error {
|
|
|
26
32
|
detail;
|
|
27
33
|
status;
|
|
28
34
|
name = 'XpRefusal';
|
|
35
|
+
// Payload-compatible marker used by Puck's public-error response mapper.
|
|
36
|
+
isOperational = true;
|
|
29
37
|
isPublic = true;
|
|
30
|
-
constructor(code, message, detail, status){
|
|
31
|
-
super(message), this.code = code, this.detail = detail, this.status = status;
|
|
38
|
+
constructor(code, message, detail, status, options){
|
|
39
|
+
super(message, options), this.code = code, this.detail = detail, this.status = status;
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
export const ANALYSIS_ERROR_MESSAGES = Object.freeze({
|
package/dist/events/request.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export declare function publicEventOrigin(value: string | undefined): string | undefined;
|
|
3
|
+
/** Fetch Metadata wins. For older clients, use only the deployment's configured origin. */
|
|
4
|
+
export declare function eventRequestContext(request: NextRequest, publicOrigin: string | undefined): {
|
|
5
|
+
allowed: boolean;
|
|
6
|
+
source: NextRequest | null;
|
|
7
|
+
};
|
package/dist/events/request.js
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (!referrer) return null;
|
|
2
|
+
function webUrl(value) {
|
|
3
|
+
if (!value) return null;
|
|
5
4
|
try {
|
|
6
|
-
const url = new URL(
|
|
7
|
-
|
|
8
|
-
return new NextRequest(url, {
|
|
9
|
-
headers: request.headers
|
|
10
|
-
});
|
|
5
|
+
const url = new URL(value);
|
|
6
|
+
return (url.protocol === 'http:' || url.protocol === 'https:') && !url.username && !url.password ? url : null;
|
|
11
7
|
} catch {
|
|
12
8
|
return null;
|
|
13
9
|
}
|
|
14
10
|
}
|
|
11
|
+
export function publicEventOrigin(value) {
|
|
12
|
+
if (typeof value === 'string' && /^https?:\/\/[^/?#\\\s]+\/?$/i.test(value)) return webUrl(value)?.origin;
|
|
13
|
+
}
|
|
14
|
+
function browserRequestOrigin(request) {
|
|
15
|
+
// Next can construct the URL from its listener address behind a reverse proxy.
|
|
16
|
+
// Use the forwarded authority only to recover page context after Fetch Metadata passed.
|
|
17
|
+
const host = request.headers.get('x-forwarded-host') ?? request.headers.get('host');
|
|
18
|
+
const protocol = request.headers.get('x-forwarded-proto') ?? request.nextUrl.protocol.slice(0, -1);
|
|
19
|
+
if (host && /^[^\s,/?#@\\]+$/.test(host) && (protocol === 'http' || protocol === 'https')) {
|
|
20
|
+
const origin = publicEventOrigin(`${protocol}://${host}`);
|
|
21
|
+
if (origin) return origin;
|
|
22
|
+
}
|
|
23
|
+
return request.nextUrl.origin;
|
|
24
|
+
}
|
|
25
|
+
/** Fetch Metadata wins. For older clients, use only the deployment's configured origin. */ export function eventRequestContext(request, publicOrigin) {
|
|
26
|
+
const site = request.headers.get('sec-fetch-site');
|
|
27
|
+
const origin = request.headers.get('origin');
|
|
28
|
+
const referrer = request.headers.get('referer');
|
|
29
|
+
const page = webUrl(referrer);
|
|
30
|
+
// Same-site can include siblings. None describes direct navigation, not a page beacon.
|
|
31
|
+
const allowed = site !== null ? site === 'same-origin' : origin !== null ? origin === publicOrigin : referrer === null || page !== null && page.origin === publicOrigin;
|
|
32
|
+
const pageOrigin = site === 'same-origin' ? browserRequestOrigin(request) : publicOrigin;
|
|
33
|
+
const senderOrigin = publicEventOrigin(origin ?? undefined);
|
|
34
|
+
const source = allowed && page && page.origin === pageOrigin && (!senderOrigin || senderOrigin === pageOrigin) ? new NextRequest(page, {
|
|
35
|
+
headers: request.headers
|
|
36
|
+
}) : null;
|
|
37
|
+
return {
|
|
38
|
+
allowed,
|
|
39
|
+
source
|
|
40
|
+
};
|
|
41
|
+
}
|
package/dist/events/rows.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import type { ResolvedOptions } from '../types/contracts.js';
|
|
|
4
4
|
import type { Manifest } from '../types/manifest.js';
|
|
5
5
|
export declare function eventRows<TUser extends {
|
|
6
6
|
id: string | number;
|
|
7
|
-
}>(events: unknown[], manifest: Manifest, assignments: AssignmentResult, options: ResolvedOptions<TUser>, visitorId: string, userId: string | undefined, ts: string, requestAttributes?: Readonly<Record<string, unknown
|
|
7
|
+
}>(events: unknown[], manifest: Manifest, assignments: AssignmentResult, options: ResolvedOptions<TUser>, visitorId: string | undefined, userId: string | undefined, ts: string, unitAgeMs: number | 'legacy' | null, requestAttributes?: Readonly<Record<string, unknown>>, clickKeys?: ReadonlySet<string>): EventRow[];
|
package/dist/events/rows.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { isClickSource } from '../goals/key.js';
|
|
1
2
|
import { exposureDimensions } from './dimensions.js';
|
|
3
|
+
import { browserWritableEvent } from './writable.js';
|
|
4
|
+
import { USER_BROWSER_CONVERSION_PREFIX } from '../constants.js';
|
|
2
5
|
function record(value) {
|
|
3
6
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
4
7
|
}
|
|
@@ -9,8 +12,13 @@ function record(value) {
|
|
|
9
12
|
return definition && typeof item === definition.type && (typeof item !== 'number' || Number.isFinite(item)) && (!definition.values || typeof item === 'string' && definition.values.includes(item));
|
|
10
13
|
}));
|
|
11
14
|
}
|
|
12
|
-
export function eventRows(events, manifest, assignments, options, visitorId, userId, ts, requestAttributes = {}) {
|
|
15
|
+
export function eventRows(events, manifest, assignments, options, visitorId, userId, ts, unitAgeMs, requestAttributes = {}, clickKeys) {
|
|
13
16
|
const rows = new Map();
|
|
17
|
+
const telemetry = {
|
|
18
|
+
_xp: {
|
|
19
|
+
unitAgeMs
|
|
20
|
+
}
|
|
21
|
+
};
|
|
14
22
|
for (const event of events){
|
|
15
23
|
if (!record(event)) continue;
|
|
16
24
|
let row;
|
|
@@ -36,25 +44,35 @@ export function eventRows(events, manifest, assignments, options, visitorId, use
|
|
|
36
44
|
userId,
|
|
37
45
|
ts,
|
|
38
46
|
dimensions: mismatch ? null : exposureDimensions(requestAttributes, options.events?.dimensions),
|
|
47
|
+
attributes: telemetry,
|
|
39
48
|
// §5.5 / §11: diagnostics are separate rows, never exposure denominators or multi-arm counts.
|
|
40
49
|
dedupeKey: mismatch ? `mismatch:${experiment.id}:${experiment.phase}:${unitId}:${ts.slice(0, 10)}` : `exposure:${experiment.id}:${experiment.phase}:${event.arm}:${unitId}:${ts.slice(0, 10)}`
|
|
41
50
|
};
|
|
42
51
|
} else if (event.type === 'conversion') {
|
|
43
52
|
if (typeof event.eventName !== 'string' || typeof event.idempotencyKey !== 'string' || !event.idempotencyKey.trim() || event.value !== undefined && (typeof event.value !== 'number' || !Number.isFinite(event.value))) continue;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
53
|
+
const click = isClickSource(event.eventName);
|
|
54
|
+
if (!browserWritableEvent(event.eventName, options) || click && !clickKeys?.has(event.eventName.slice(6))) continue;
|
|
55
|
+
const unitId = visitorId ?? userId;
|
|
56
|
+
if (!unitId) continue;
|
|
46
57
|
row = {
|
|
47
58
|
type: 'conversion',
|
|
48
59
|
eventName: event.eventName,
|
|
49
60
|
value: 1,
|
|
50
|
-
unitId
|
|
51
|
-
unitType: 'visitor',
|
|
61
|
+
unitId,
|
|
62
|
+
unitType: visitorId ? 'visitor' : 'user',
|
|
52
63
|
userId,
|
|
53
64
|
ts,
|
|
54
65
|
dimensions: null,
|
|
55
|
-
attributes:
|
|
66
|
+
attributes: {
|
|
67
|
+
...click ? undefined : attributes(event.attributes, options.attributeKeys),
|
|
68
|
+
...telemetry
|
|
69
|
+
},
|
|
56
70
|
// §5.5: scoped by unit and event so one client can never pre-claim another's key.
|
|
57
|
-
dedupeKey: `conversion:c:${visitorId}:${event.eventName}:${event.idempotencyKey}`
|
|
71
|
+
dedupeKey: visitorId ? `conversion:c:${visitorId}:${event.eventName}:${event.idempotencyKey}` : USER_BROWSER_CONVERSION_PREFIX + JSON.stringify([
|
|
72
|
+
unitId,
|
|
73
|
+
event.eventName,
|
|
74
|
+
event.idempotencyKey
|
|
75
|
+
])
|
|
58
76
|
};
|
|
59
77
|
} else continue;
|
|
60
78
|
rows.set(row.dedupeKey, row);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MetricSource, ResolvedOptions } from '../types/contracts.js';
|
|
2
|
+
type Sources = Pick<ResolvedOptions, 'eventSources'> & {
|
|
3
|
+
metricSources?: ReadonlyArray<Pick<MetricSource, 'id' | 'kind' | 'clientWritable'>>;
|
|
4
|
+
};
|
|
5
|
+
/** Checks source configuration. Ingestion separately checks that the click key exists. */
|
|
6
|
+
export declare function browserWritableEvent(eventName: string, options: Sources): boolean;
|
|
7
|
+
/** Built-in event metrics use the event name after the `events:` prefix. */
|
|
8
|
+
export declare function browserWritableMetric(source: string | undefined, options: Sources): boolean;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validClickSource } from '../goals/key.js';
|
|
2
|
+
/** Checks source configuration. Ingestion separately checks that the click key exists. */ export function browserWritableEvent(eventName, options) {
|
|
3
|
+
if (eventName.startsWith('click:')) return validClickSource(eventName);
|
|
4
|
+
const metric = options.metricSources?.find((source)=>source.id === eventName);
|
|
5
|
+
if (metric) return metric.clientWritable === true && metric.kind !== 'revenue';
|
|
6
|
+
return options.eventSources?.some((source)=>source.name === eventName && source.clientWritable) ?? false;
|
|
7
|
+
}
|
|
8
|
+
/** Built-in event metrics use the event name after the `events:` prefix. */ export function browserWritableMetric(source, options) {
|
|
9
|
+
if (!source) return false;
|
|
10
|
+
if (!source.startsWith('events:')) return browserWritableEvent(source, options);
|
|
11
|
+
const eventName = source.slice(7);
|
|
12
|
+
return options.eventSources?.some((event)=>event.name === eventName) === true && browserWritableEvent(eventName, options);
|
|
13
|
+
}
|
|
@@ -3,5 +3,10 @@ export { LayerUsage } from '../admin/LayerUsage.js';
|
|
|
3
3
|
export { MetricSourceSelect } from '../admin/MetricSourceSelect.js';
|
|
4
4
|
export { ArmSelectField } from '../admin/armSelect/ArmSelectField.js';
|
|
5
5
|
export { TestsNavLink } from '../admin/TestsNavLink.js';
|
|
6
|
-
export { TestsSurface } from '../admin/
|
|
6
|
+
export { TestsSurface } from '../admin/views/TestsSurfaceClient.js';
|
|
7
7
|
export { TestsDashboardCards } from '../admin/TestsDashboardCards.js';
|
|
8
|
+
export { PlacementStatus } from '../admin/PlacementStatus.js';
|
|
9
|
+
export { wrapExperimentBlock, syncExperimentSlots, copyOriginalIntoVersion, unwrapExperimentBlock, findRegisteredBlocksField } from '../blocks/formState.js';
|
|
10
|
+
export { TestBlockField } from '../admin/blocks/TestBlockField.js';
|
|
11
|
+
export { BlockStatusField, BlockSlotRowLabel, CopyOriginalField } from '../admin/blocks/BlockPanel.js';
|
|
12
|
+
export { XpGoalField } from '../admin/goals/XpGoalField.js';
|
|
@@ -4,5 +4,10 @@ export { LayerUsage } from '../admin/LayerUsage.js';
|
|
|
4
4
|
export { MetricSourceSelect } from '../admin/MetricSourceSelect.js';
|
|
5
5
|
export { ArmSelectField } from '../admin/armSelect/ArmSelectField.js';
|
|
6
6
|
export { TestsNavLink } from '../admin/TestsNavLink.js';
|
|
7
|
-
export { TestsSurface } from '../admin/
|
|
7
|
+
export { TestsSurface } from '../admin/views/TestsSurfaceClient.js';
|
|
8
8
|
export { TestsDashboardCards } from '../admin/TestsDashboardCards.js';
|
|
9
|
+
export { PlacementStatus } from '../admin/PlacementStatus.js';
|
|
10
|
+
export { wrapExperimentBlock, syncExperimentSlots, copyOriginalIntoVersion, unwrapExperimentBlock, findRegisteredBlocksField } from '../blocks/formState.js';
|
|
11
|
+
export { TestBlockField } from '../admin/blocks/TestBlockField.js';
|
|
12
|
+
export { BlockStatusField, BlockSlotRowLabel, CopyOriginalField } from '../admin/blocks/BlockPanel.js';
|
|
13
|
+
export { XpGoalField } from '../admin/goals/XpGoalField.js';
|
|
@@ -2,3 +2,6 @@ export { ExperimentsRootView } from '../admin/views/ExperimentsRootView.js';
|
|
|
2
2
|
export { CollectionListRedirect } from '../admin/views/CollectionListRedirect.js';
|
|
3
3
|
export { CollectionEditRedirect } from '../admin/views/CollectionEditRedirect.js';
|
|
4
4
|
export { TestsNavLinkServer } from '../admin/views/TestsNavLinkServer.js';
|
|
5
|
+
export { TestsCollectionListView } from '../admin/views/TestsCollectionListView.js';
|
|
6
|
+
export { GoalsCollectionListView } from '../admin/views/GoalsCollectionListView.js';
|
|
7
|
+
export { GoalEditRedirect } from '../admin/views/GoalEditRedirect.js';
|
package/dist/exports/adminRsc.js
CHANGED
|
@@ -2,3 +2,6 @@ export { ExperimentsRootView } from '../admin/views/ExperimentsRootView.js';
|
|
|
2
2
|
export { CollectionListRedirect } from '../admin/views/CollectionListRedirect.js';
|
|
3
3
|
export { CollectionEditRedirect } from '../admin/views/CollectionEditRedirect.js';
|
|
4
4
|
export { TestsNavLinkServer } from '../admin/views/TestsNavLinkServer.js';
|
|
5
|
+
export { TestsCollectionListView } from '../admin/views/TestsCollectionListView.js';
|
|
6
|
+
export { GoalsCollectionListView } from '../admin/views/GoalsCollectionListView.js';
|
|
7
|
+
export { GoalEditRedirect } from '../admin/views/GoalEditRedirect.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { controlOnlyBlocks, segmentExperimentBlocks, EXPERIMENT_BLOCK_SLUG } from '../blocks/model.js';
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { ExperimentPageview } from '../client/ExperimentPageview.js';
|
|
|
5
5
|
export { trackConversionBeacon } from '../client/trackConversionBeacon.js';
|
|
6
6
|
export { MAX_EVENTS_PER_BODY, DEFAULT_MAX_BODY_BYTES } from '../constants.js';
|
|
7
7
|
export type { ClientAssignments } from '../types/assignments.js';
|
|
8
|
+
export { ExperimentGroup } from '../client/ExperimentGroup.js';
|
package/dist/exports/client.js
CHANGED
|
@@ -5,3 +5,4 @@ export { useExperiment } from '../client/useExperiment.js';
|
|
|
5
5
|
export { ExperimentPageview } from '../client/ExperimentPageview.js';
|
|
6
6
|
export { trackConversionBeacon } from '../client/trackConversionBeacon.js';
|
|
7
7
|
export { MAX_EVENTS_PER_BODY, DEFAULT_MAX_BODY_BYTES } from '../constants.js';
|
|
8
|
+
export { ExperimentGroup } from '../client/ExperimentGroup.js';
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -2,4 +2,9 @@ export { createExperimentsPlugin } from '../plugin.js';
|
|
|
2
2
|
export { defineFlagPoint, defineMetricSource } from '../define.js';
|
|
3
3
|
export { contentDone } from '../contentDone.js';
|
|
4
4
|
export { createArmSelectField } from '../fields/armSelect.js';
|
|
5
|
-
export type { SerializedFlagPoint, SerializedMetricSource, SerializedAttributeKeys, EditableField, Assignment, Assignments, FlagPointResult, ClientAssignments, RenderedExposure, DocId, PreviewPlacement, Attributes, ExposurePolicy, ExperimentKind, Status, UnitType, ArmKey, ArmKind, TargetingRule, Arm, ParamField, MetricSource, FlagPoint, RateLimiter, ExperimentsAccess, ExperimentsPluginOptions, ExperimentsPageCollection, ArmIssueCode, RefusalCode, ReadinessCode, ErrorEnvelope, TransitionSuccess, AllocateBody, AddMetricBody, DecideBody, ArchiveBody, MakeContentResult, DismissContentEntryBody, DismissContentEntryResult, RestoreContentEntryBody, RestoreContentEntryResult, ContentReport, PreflightResult, PreviewTokenResult, PhaseSummary, ResultsResponse, SummaryResponse, EventBody, FlagDefault, Manifest, ManifestExperiment, ArmSlot, ExperimentRef, ExperimentSlotProps, ExperimentsProxyRuntimeOptions, ExperimentsProxyRuntime, ExperimentsServerRuntimeOptions, ExperimentsServerRuntime, VerdictCode, Snapshot, MetricUnavailableReason, ContentReportReason, } from '../types/index.js';
|
|
5
|
+
export type { SerializedFlagPoint, SerializedMetricSource, SerializedAttributeKeys, EditableField, Assignment, Assignments, FlagPointResult, ClientAssignments, RenderedExposure, DocId, PreviewPlacement, Attributes, ExposurePolicy, ExperimentKind, Status, UnitType, ArmKey, ArmKind, TargetingRule, Arm, ParamField, MetricSource, FlagPoint, RateLimiter, ExperimentsAccess, ExperimentsPluginOptions, ExperimentsPageCollection, ArmIssueCode, RefusalCode, ReadinessCode, ErrorEnvelope, TransitionSuccess, StartExperimentFirstStartDetail, StartExperimentResult, StartExperimentWarning, AllocateBody, AddMetricBody, AddMetricWarning, AddMetricResult, ClickKeysResult, PageRow, PagesResult, CopyPagePlan, CopyPageResult, PlacementStatusResult, PageTestStatus, DeleteImpactResult, RoundBody, DecideBody, ArchiveBody, MakeContentResult, DismissContentEntryBody, DismissContentEntryResult, RestoreContentEntryBody, RestoreContentEntryResult, ContentReport, PreflightResult, PreviewTokenResult, PhaseSummary, ResultsResponse, SummaryResponse, EventBody, FlagDefault, Manifest, ManifestExperiment, ArmSlot, ExperimentRef, ExperimentSlotProps, ExperimentsProxyRuntimeOptions, ExperimentsProxyRuntime, ExperimentsServerRuntimeOptions, ExperimentsServerRuntime, VerdictCode, Snapshot, MetricUnavailableReason, ContentReportReason, } from '../types/index.js';
|
|
6
|
+
export { createExperimentBlock } from '../blocks/createExperimentBlock.js';
|
|
7
|
+
export { EXPERIMENT_BLOCK_SLUG } from '../blocks/model.js';
|
|
8
|
+
export type { HostBlock, ExperimentBlock, ExperimentBlockGroup, ResolvedHostBlock, ResolvedExperimentBlocks } from '../blocks/model.js';
|
|
9
|
+
export type { WrapBlockBody, SnapshotHealth } from '../types/index.js';
|
|
10
|
+
export { xpGoalField } from '../fields/xpGoal.js';
|
package/dist/exports/index.js
CHANGED
|
@@ -2,3 +2,6 @@ export { createExperimentsPlugin } from '../plugin.js';
|
|
|
2
2
|
export { defineFlagPoint, defineMetricSource } from '../define.js';
|
|
3
3
|
export { contentDone } from '../contentDone.js';
|
|
4
4
|
export { createArmSelectField } from '../fields/armSelect.js';
|
|
5
|
+
export { createExperimentBlock } from '../blocks/createExperimentBlock.js';
|
|
6
|
+
export { EXPERIMENT_BLOCK_SLUG } from '../blocks/model.js';
|
|
7
|
+
export { xpGoalField } from '../fields/xpGoal.js';
|
package/dist/exports/puck.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { ExperimentSlot, createExperimentSlot } from '../puck/ExperimentSlot.js';
|
|
2
2
|
export { createExperimentSlotField } from '../puck/experimentSlotField.js';
|
|
3
|
+
export { experimentsPuck } from '../puck/integration.js';
|
|
3
4
|
export { EXPERIMENT_SLOT_TYPE } from '../types/puck.js';
|
|
4
|
-
export type { ArmSlot, ExperimentRef, ExperimentSlotProps } from '../types/puck.js';
|
|
5
|
+
export type { ArmSlot, ExperimentRef, ExperimentSlotProps, ExperimentsPuckIntegration } from '../types/puck.js';
|
|
5
6
|
export type { PuckRoutes } from '../puck/routes.js';
|
|
7
|
+
export { xpGoalPuckField } from '../puck/xpGoalField.js';
|
package/dist/exports/puck.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { ExperimentSlot, createExperimentSlot } from '../puck/ExperimentSlot.js';
|
|
2
2
|
export { createExperimentSlotField } from '../puck/experimentSlotField.js';
|
|
3
|
+
export { experimentsPuck } from '../puck/integration.js';
|
|
3
4
|
export { EXPERIMENT_SLOT_TYPE } from '../types/puck.js';
|
|
5
|
+
export { xpGoalPuckField } from '../puck/xpGoalField.js';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { ExperimentSlotEditor, createExperimentSlotEditor } from '../puck/editor/ExperimentSlotEditor.js';
|
|
2
2
|
export { experimentOutlinePlugin } from '../puck/editor/experimentOutlinePlugin.js';
|
|
3
|
+
export { experimentsPuckEditor } from '../puck/editor/integration.js';
|
|
4
|
+
export type { ExperimentsPuckIntegration } from '../types/puck.js';
|
|
3
5
|
export { deriveAccent } from '../ui/accent.js';
|
|
6
|
+
export { xpGoalPuckEditorField } from '../puck/editor/xpGoalPuckEditorField.js';
|
|
4
7
|
export type { PuckRoutes } from '../puck/routes.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
export { ExperimentSlotEditor, createExperimentSlotEditor } from '../puck/editor/ExperimentSlotEditor.js';
|
|
3
3
|
export { experimentOutlinePlugin } from '../puck/editor/experimentOutlinePlugin.js';
|
|
4
|
+
export { experimentsPuckEditor } from '../puck/editor/integration.js';
|
|
4
5
|
export { deriveAccent } from '../ui/accent.js';
|
|
6
|
+
export { xpGoalPuckEditorField } from '../puck/editor/xpGoalPuckEditorField.js';
|
package/dist/exports/rsc.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { eraseUser } from '../server/eraseUser.js';
|
|
|
8
8
|
export type { MetricUnavailableReason, ContentReportReason } from '../types/reasons.js';
|
|
9
9
|
export type { PreviewPlacement } from '../types/contracts.js';
|
|
10
10
|
export { runResults } from '../server/runResults.js';
|
|
11
|
+
export { startExperiment } from '../server/startExperiment.js';
|
|
11
12
|
export { recordContentChange } from '../server/recordContentChange.js';
|
|
12
13
|
export { experimentSitemapFilter } from '../server/sitemap.js';
|
|
13
14
|
export { experimentMetadata } from '../server/metadata.js';
|
|
@@ -16,3 +17,6 @@ export { compileManifest } from '../manifest/compile.js';
|
|
|
16
17
|
export type { ManifestInputs, ManifestInputExperiment, ManifestPhase, ManifestCompileOptions } from '../manifest/compile.js';
|
|
17
18
|
export type { Manifest, ManifestExperiment } from '../types/manifest.js';
|
|
18
19
|
export { contentChangesBeforeHook as captureContentBaseline } from '../hooks/contentChanges.js';
|
|
20
|
+
export { pageKindSeoContract, type PageKindSeoContractOptions, type PageKindSeoContractRow } from '../server/pageKindSeoContract.js';
|
|
21
|
+
export { resolveExperimentBlocks } from '../server/resolveExperimentBlocks.js';
|
|
22
|
+
export type { HostBlock, ExperimentBlock, ExperimentBlockGroup, ResolvedHostBlock, ResolvedExperimentBlocks } from '../blocks/model.js';
|
package/dist/exports/rsc.js
CHANGED
|
@@ -6,6 +6,7 @@ export { linkIdentity } from '../server/linkIdentity.js';
|
|
|
6
6
|
export { trackConversion } from '../server/trackConversion.js';
|
|
7
7
|
export { eraseUser } from '../server/eraseUser.js';
|
|
8
8
|
export { runResults } from '../server/runResults.js';
|
|
9
|
+
export { startExperiment } from '../server/startExperiment.js';
|
|
9
10
|
export { recordContentChange } from '../server/recordContentChange.js';
|
|
10
11
|
export { experimentSitemapFilter } from '../server/sitemap.js';
|
|
11
12
|
export { experimentMetadata } from '../server/metadata.js';
|
|
@@ -13,3 +14,5 @@ export { toClientAssignments } from '../server/toClientAssignments.js';
|
|
|
13
14
|
// Pure manifest builder for host tests (CORE-43): the same compile transitions run, with no database access.
|
|
14
15
|
export { compileManifest } from '../manifest/compile.js';
|
|
15
16
|
export { contentChangesBeforeHook as captureContentBaseline } from '../hooks/contentChanges.js';
|
|
17
|
+
export { pageKindSeoContract } from '../server/pageKindSeoContract.js';
|
|
18
|
+
export { resolveExperimentBlocks } from '../server/resolveExperimentBlocks.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XP_GOAL_FIELD } from '../admin/paths.js';
|
|
2
|
+
import { validateClickGoal } from '../goals/validate.js';
|
|
3
|
+
/** The host renders this value as data-xp-goal on its interactive element. */ export function xpGoalField() {
|
|
4
|
+
return {
|
|
5
|
+
name: 'xpGoal',
|
|
6
|
+
label: 'Click goal',
|
|
7
|
+
type: 'text',
|
|
8
|
+
admin: {
|
|
9
|
+
description: 'Choose the click goal to count here.',
|
|
10
|
+
components: {
|
|
11
|
+
Field: XP_GOAL_FIELD
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
validate: (value, { req })=>validateClickGoal(value, req)
|
|
15
|
+
};
|
|
16
|
+
}
|
package/dist/globals/state.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { preserveRetiredSlugs } from '../db/slugs.js';
|
|
1
2
|
import { deny, isTrue } from '../collections/access.js';
|
|
2
3
|
export function stateGlobal(options) {
|
|
3
4
|
return {
|
|
@@ -13,12 +14,21 @@ export function stateGlobal(options) {
|
|
|
13
14
|
update: deny,
|
|
14
15
|
readVersions: deny
|
|
15
16
|
},
|
|
17
|
+
hooks: {
|
|
18
|
+
beforeChange: [
|
|
19
|
+
preserveRetiredSlugs
|
|
20
|
+
]
|
|
21
|
+
},
|
|
16
22
|
fields: [
|
|
17
23
|
{
|
|
18
24
|
name: 'revision',
|
|
19
25
|
type: 'number',
|
|
20
26
|
defaultValue: 0
|
|
21
27
|
},
|
|
28
|
+
{
|
|
29
|
+
name: 'retiredSlugs',
|
|
30
|
+
type: 'json'
|
|
31
|
+
},
|
|
22
32
|
{
|
|
23
33
|
name: 'manifest',
|
|
24
34
|
type: 'json'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { definedClickKeys } from '../db/clickGoals.js';
|
|
2
|
+
import { pooledExecutor } from '../db/executor.js';
|
|
3
|
+
import { safeError } from '../log.js';
|
|
4
|
+
import { CLICK_KEY } from './key.js';
|
|
5
|
+
const caches = new WeakMap();
|
|
6
|
+
/** Cache failures too, retaining the last good set and bounding retry traffic. */ export async function clickKeys(payload) {
|
|
7
|
+
let entry = caches.get(payload);
|
|
8
|
+
if (!entry) {
|
|
9
|
+
entry = {
|
|
10
|
+
until: 0
|
|
11
|
+
};
|
|
12
|
+
caches.set(payload, entry);
|
|
13
|
+
}
|
|
14
|
+
if (entry.pending) return entry.pending;
|
|
15
|
+
if (Date.now() < entry.until) return entry.keys;
|
|
16
|
+
const current = entry;
|
|
17
|
+
current.pending = (async ()=>{
|
|
18
|
+
try {
|
|
19
|
+
current.keys = new Set([
|
|
20
|
+
...await definedClickKeys(pooledExecutor(payload))
|
|
21
|
+
].filter((key)=>CLICK_KEY.test(key)));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
try {
|
|
24
|
+
payload.logger.error({
|
|
25
|
+
err: safeError(error)
|
|
26
|
+
}, 'Experiments: click goal lookup failed');
|
|
27
|
+
} catch {}
|
|
28
|
+
} finally{
|
|
29
|
+
current.until = Date.now() + 30_000;
|
|
30
|
+
current.pending = undefined;
|
|
31
|
+
}
|
|
32
|
+
return current.keys;
|
|
33
|
+
})();
|
|
34
|
+
return current.pending;
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
import type { Arm, DocId, ResolvedOptions } from '../types/contracts.js';
|
|
3
|
+
import type { PlacementDoc } from '../db/placements.js';
|
|
4
|
+
export declare const OUTSIDE_GOAL: (name?: string, kind?: string) => string;
|
|
5
|
+
export declare const LEGACY_FAIRNESS = "Goal fairness isn't checked for tests started before this update.";
|
|
6
|
+
export interface GoalPlacement {
|
|
7
|
+
collection?: string;
|
|
8
|
+
id?: DocId;
|
|
9
|
+
path?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GoalContent {
|
|
13
|
+
keys: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
arms: string[];
|
|
16
|
+
label: string;
|
|
17
|
+
}>;
|
|
18
|
+
unchecked: GoalPlacement[];
|
|
19
|
+
readArms: string[];
|
|
20
|
+
skipped?: boolean;
|
|
21
|
+
}
|
|
22
|
+
type Experiment = {
|
|
23
|
+
id: DocId;
|
|
24
|
+
slug: string;
|
|
25
|
+
kind: string;
|
|
26
|
+
arms: Arm[];
|
|
27
|
+
pageCollection?: string | null;
|
|
28
|
+
};
|
|
29
|
+
/** Call outside a transition, or on Start's detached request after its locks.
|
|
30
|
+
* Frozen null placements are deliberately skipped by results (no anonymous scan).
|
|
31
|
+
*/
|
|
32
|
+
export declare function goalContent<TUser extends {
|
|
33
|
+
id: DocId;
|
|
34
|
+
}>(req: PayloadRequest, options: ResolvedOptions<TUser>, experiment: Experiment, placements?: readonly PlacementDoc[] | null): Promise<GoalContent>;
|
|
35
|
+
/** Readiness detail contains placement identifiers only. */
|
|
36
|
+
export declare function goalPlacementDetail({ collection, id, path }: GoalPlacement): Omit<GoalPlacement, 'title'>;
|
|
37
|
+
export declare function asymmetricGoal(content: GoalContent, source: string, arms: readonly {
|
|
38
|
+
key: string;
|
|
39
|
+
}[]): boolean;
|
|
40
|
+
export {};
|