@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +2 -2
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +129 -37
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.d.ts +3 -0
- package/dist/admin/blocks/formApi.js +10 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +10 -6
- package/dist/admin/blocks/statusCache.d.ts +2 -0
- package/dist/admin/blocks/statusCache.js +12 -3
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +21 -1
- package/dist/admin/copy/blocks.js +40 -6
- package/dist/admin/copy/goals.d.ts +6 -1
- package/dist/admin/copy/goals.js +10 -3
- package/dist/admin/copy/newTest.d.ts +6 -7
- package/dist/admin/copy/newTest.js +9 -7
- package/dist/admin/goals/XpGoalField.d.ts +2 -0
- package/dist/admin/goals/XpGoalField.js +156 -114
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/paths.d.ts +3 -0
- package/dist/admin/paths.js +3 -0
- package/dist/admin/placementStatus.model.js +1 -1
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.js +5 -2
- package/dist/admin/surface/TestRowMenu.d.ts +6 -0
- package/dist/admin/surface/TestRowMenu.js +156 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +266 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +95 -54
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +5 -4
- package/dist/admin/surface/goals/data.js +2 -2
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +11 -1
- package/dist/admin/surface/goals/goals.model.js +43 -0
- package/dist/admin/surface/home.model.d.ts +9 -8
- package/dist/admin/surface/home.model.js +22 -21
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +98 -94
- package/dist/admin/surface/newTest/PageWizard.d.ts +2 -1
- package/dist/admin/surface/newTest/PageWizard.js +111 -76
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +58 -54
- package/dist/admin/surface/surface.css +10 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +42 -162
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +18 -165
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +11 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/formState.js +1 -1
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/collections/experiments/config.js +17 -8
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +16 -4
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +5 -4
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +57 -9
- package/dist/endpoints/pages.js +247 -64
- package/dist/endpoints/placementStatus.js +13 -5
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/fields/xpGoal.js +3 -15
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +44 -35
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +27 -2
- package/dist/hooks/pageGuard.js +213 -45
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +36 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +19 -20
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +5 -1
- package/dist/puck/copy.js +5 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.js +951 -179
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +57 -0
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +10 -6
- package/dist/puck/editor/VersionBuilder.d.ts +66 -12
- package/dist/puck/editor/VersionBuilder.js +554 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +64 -19
- package/dist/puck/editor/copy.js +72 -20
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +191 -19
- package/dist/puck/editor/editor.css +328 -24
- package/dist/puck/editor/editor.model.d.ts +17 -1
- package/dist/puck/editor/editor.model.js +61 -4
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +105 -86
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.js +2 -1
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +22 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +48 -22
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +52 -14
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.js +6 -2
- package/dist/testSurface/actions/DecideDialog.d.ts +16 -0
- package/dist/{admin → testSurface}/actions/DecideDialog.js +78 -55
- package/dist/testSurface/actions/LifecycleAction.d.ts +16 -0
- package/dist/testSurface/actions/LifecycleAction.js +105 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +122 -0
- package/dist/{admin → testSurface}/api.d.ts +20 -7
- package/dist/{admin → testSurface}/api.js +72 -22
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +28 -8
- package/dist/{admin → testSurface}/copy/actions.js +31 -11
- package/dist/{admin → testSurface}/copy/common.d.ts +13 -4
- package/dist/{admin → testSurface}/copy/common.js +18 -8
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +1 -0
- package/dist/{admin → testSurface}/copy/metrics.js +1 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +38 -4
- package/dist/{admin → testSurface}/copy/readiness.js +52 -7
- package/dist/{admin → testSurface}/copy/results.d.ts +6 -3
- package/dist/{admin → testSurface}/copy/results.js +6 -3
- package/dist/{admin → testSurface}/copy/review.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/review.js +1 -1
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +13 -10
- package/dist/{admin → testSurface}/copy/testPage.d.ts +53 -8
- package/dist/testSurface/copy/testPage.js +165 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/{admin → testSurface}/placements/placementLabels.d.ts +2 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +3 -2
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.js +6 -2
- package/dist/{admin → testSurface}/surface/contracts.d.ts +17 -3
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/{admin → testSurface}/surface/pageBlock/parts.js +39 -11
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +503 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +8 -4
- package/dist/testSurface/surface/readiness/ActionDialogs.js +351 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +2 -3
- package/dist/testSurface/surface/readiness/Banner.js +187 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +10 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +66 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +28 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +6 -3
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +40 -40
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +108 -44
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +26 -8
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +58 -18
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +2 -0
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +116 -86
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +5 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +4 -1
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +2 -3
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +80 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +82 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/{admin → testSurface}/surface/test/VersionsSection.js +69 -35
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +30 -7
- package/dist/testSurface/surface/test/fields.js +306 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +27 -43
- package/dist/testSurface/surface/test/testPage.css +103 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +3 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +7 -0
- package/dist/testSurface/surfaceUrls.js +19 -0
- package/dist/{admin → testSurface}/useApi.d.ts +21 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +6 -1
- package/dist/transitions/checkStart.js +133 -17
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +6 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +41 -17
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +16 -12
- package/dist/transitions/placements.d.ts +54 -8
- package/dist/transitions/placements.js +304 -81
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +137 -40
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +72 -35
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +15 -3
- package/dist/types/endpoints.d.ts +121 -17
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +9 -9
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +116 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +7 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +49 -5
- package/package.json +3 -2
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -10
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/testPage.js +0 -104
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/pagePicker/CopyRoute.d.ts +0 -6
- package/dist/admin/surface/pagePicker/CopyRoute.js +0 -53
- package/dist/admin/surface/pagePicker/PagePicker.d.ts +0 -10
- package/dist/admin/surface/pagePicker/PagePicker.js +0 -172
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -337
- package/dist/admin/surface/readiness/Banner.js +0 -190
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.js +0 -205
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/fields.js +0 -216
- package/dist/admin/surface/test/testPage.css +0 -97
- package/dist/admin/surface/useTestDocument.d.ts +0 -32
- package/dist/admin/surface/useTestDocument.js +0 -415
- /package/dist/{admin → testSurface}/PreviewLinks.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/allocation.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
- /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/arms.js +0 -0
- /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/audience.js +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
- /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/setting.js +0 -0
- /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
- /package/dist/{admin → testSurface}/format/date.js +0 -0
- /package/dist/{admin → testSurface}/labels.d.ts +0 -0
- /package/dist/{admin → testSurface}/labels.js +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/results.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { invalidatePlacements } from './placementsCache.js';
|
|
4
|
+
const PUCK_SAVE_EVENT = 'payload-puck:save';
|
|
5
|
+
/** Listen for payload-puck 0.12.5+ save results through the DOM event. */ export function usePageSaveReadiness(api, id, page, contentLocale) {
|
|
6
|
+
const collection = page?.collection;
|
|
7
|
+
const pageId = page && String(page.id);
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
if (id === undefined || !collection || !pageId) return;
|
|
10
|
+
const onSave = (event)=>{
|
|
11
|
+
if (!(event instanceof CustomEvent)) return;
|
|
12
|
+
const detail = event.detail;
|
|
13
|
+
if (!detail || typeof detail !== 'object') return;
|
|
14
|
+
const save = detail;
|
|
15
|
+
if (save.ok !== true || save.id !== pageId || save.collection !== undefined && save.collection !== collection) return;
|
|
16
|
+
if (save.operation !== 'save' && save.operation !== 'publish' && save.operation !== 'unpublish') return;
|
|
17
|
+
if (typeof save.apiEndpoint !== 'string' || save.locale !== undefined && typeof save.locale !== 'string') return;
|
|
18
|
+
if (save.status !== undefined && save.status !== 'draft' && save.status !== 'published') return;
|
|
19
|
+
if (save.error !== undefined) return;
|
|
20
|
+
invalidatePlacements(api, id, contentLocale);
|
|
21
|
+
};
|
|
22
|
+
window.addEventListener(PUCK_SAVE_EVENT, onSave);
|
|
23
|
+
return ()=>window.removeEventListener(PUCK_SAVE_EVENT, onSave);
|
|
24
|
+
}, [
|
|
25
|
+
api,
|
|
26
|
+
id,
|
|
27
|
+
collection,
|
|
28
|
+
pageId,
|
|
29
|
+
contentLocale
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DocId } from '../../types/contracts.js';
|
|
2
|
+
/** Subscribe only while save/publish guidance or a retryable placement failure is visible. */
|
|
3
|
+
export declare function usePlacementNotice(api: string, id: DocId | undefined, message: string | undefined, contentLocale?: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { watchPlacementNotice } from './placementsCache.js';
|
|
4
|
+
/** Subscribe only while save/publish guidance or a retryable placement failure is visible. */ export function usePlacementNotice(api, id, message, contentLocale) {
|
|
5
|
+
const showing = message !== undefined && id !== undefined;
|
|
6
|
+
useEffect(()=>{
|
|
7
|
+
if (id === undefined || !showing) return;
|
|
8
|
+
return watchPlacementNotice(api, id, document, contentLocale);
|
|
9
|
+
}, [
|
|
10
|
+
api,
|
|
11
|
+
id,
|
|
12
|
+
showing,
|
|
13
|
+
contentLocale
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useId } from 'react';
|
|
4
4
|
import { useClickGoalPicker } from '../../goals/picker/useClickGoalPicker.js';
|
|
5
|
+
import { clickGoalOptions } from '../../goals/picker/clickGoalPicker.model.js';
|
|
5
6
|
import { CLICK_GOAL_COPY as C } from '../../goals/picker/copy.js';
|
|
6
7
|
import { TextInput, Select } from '../../ui/Inputs.js';
|
|
7
8
|
import { Button } from '../../ui/Button.js';
|
|
@@ -9,8 +10,11 @@ import { resolvePuckRoutes } from '../routes.js';
|
|
|
9
10
|
import './editor.css';
|
|
10
11
|
function XpGoalPuckEditor({ value, onChange, api, readOnly }) {
|
|
11
12
|
const picker = useClickGoalPicker(api, {
|
|
13
|
+
enabled: !readOnly,
|
|
12
14
|
onSelect: onChange
|
|
13
15
|
});
|
|
16
|
+
const { options, missing } = clickGoalOptions(picker.status, picker.goals, value ?? '');
|
|
17
|
+
const readonly = readOnly || picker.status === 'not-manager';
|
|
14
18
|
const id = useId();
|
|
15
19
|
const stopEnter = (event)=>{
|
|
16
20
|
if (event.key === 'Enter') {
|
|
@@ -21,100 +25,115 @@ function XpGoalPuckEditor({ value, onChange, api, readOnly }) {
|
|
|
21
25
|
return /*#__PURE__*/ _jsxs("div", {
|
|
22
26
|
className: "xp-slot-root xp-puck-field",
|
|
23
27
|
children: [
|
|
24
|
-
/*#__PURE__*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
readonly ? /*#__PURE__*/ _jsxs("div", {
|
|
29
|
+
className: "xp-ui-field",
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsx("span", {
|
|
32
|
+
children: C.label
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ _jsx("p", {
|
|
35
|
+
children: value || C.none
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
}) : /*#__PURE__*/ _jsxs("div", {
|
|
39
|
+
className: "xp-ui-inline-row",
|
|
32
40
|
children: [
|
|
33
|
-
/*#__PURE__*/
|
|
41
|
+
/*#__PURE__*/ _jsx(Select, {
|
|
34
42
|
id: `${id}-picker`,
|
|
35
|
-
label: C.
|
|
36
|
-
value:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
children: C.choose
|
|
44
|
-
}),
|
|
45
|
-
picker.goals.map((goal)=>/*#__PURE__*/ _jsx("option", {
|
|
46
|
-
value: goal.slug,
|
|
47
|
-
children: goal.name
|
|
48
|
-
}, goal.id))
|
|
49
|
-
]
|
|
43
|
+
label: C.label,
|
|
44
|
+
value: value ?? '',
|
|
45
|
+
disabled: picker.status !== 'ready',
|
|
46
|
+
onChange: (event)=>onChange(event.currentTarget.value),
|
|
47
|
+
children: options.map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
48
|
+
value: option.value,
|
|
49
|
+
children: option.label
|
|
50
|
+
}, option.value))
|
|
50
51
|
}),
|
|
51
|
-
picker.
|
|
52
|
-
className: "xp-ui-help",
|
|
53
|
-
role: "status",
|
|
54
|
-
children: C.undefinedKey
|
|
55
|
-
}) : null,
|
|
56
|
-
!picker.panel.open ? /*#__PURE__*/ _jsx(Button, {
|
|
52
|
+
picker.canManage && !picker.panel.open ? /*#__PURE__*/ _jsx(Button, {
|
|
57
53
|
type: "button",
|
|
58
54
|
onClick: picker.open,
|
|
59
55
|
children: C.newGoal
|
|
60
|
-
}) :
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
onChange: (event)=>picker.setName(event.currentTarget.value)
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ _jsxs("details", {
|
|
76
|
-
open: picker.panel.advanced,
|
|
77
|
-
onToggle: (event)=>picker.setAdvanced(event.currentTarget.open),
|
|
78
|
-
children: [
|
|
79
|
-
/*#__PURE__*/ _jsx("summary", {
|
|
80
|
-
children: C.advanced
|
|
81
|
-
}),
|
|
82
|
-
/*#__PURE__*/ _jsx(TextInput, {
|
|
83
|
-
id: `${id}-slug`,
|
|
84
|
-
label: C.slug,
|
|
85
|
-
value: picker.panel.slug,
|
|
86
|
-
disabled: picker.panel.pending,
|
|
87
|
-
onKeyDown: stopEnter,
|
|
88
|
-
error: picker.panel.errors.slug,
|
|
89
|
-
onChange: (event)=>picker.setSlug(event.currentTarget.value)
|
|
90
|
-
})
|
|
91
|
-
]
|
|
92
|
-
}),
|
|
93
|
-
picker.panel.errors.general ? /*#__PURE__*/ _jsx("p", {
|
|
94
|
-
className: "xp-ui-error",
|
|
95
|
-
role: "alert",
|
|
96
|
-
children: picker.panel.errors.general
|
|
97
|
-
}) : null,
|
|
98
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
99
|
-
className: "xp-ui-button-group",
|
|
100
|
-
children: [
|
|
101
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
102
|
-
type: "button",
|
|
103
|
-
disabled: picker.panel.pending || !picker.panel.name.trim(),
|
|
104
|
-
onClick: ()=>void picker.create(),
|
|
105
|
-
children: C.createGoal
|
|
106
|
-
}),
|
|
107
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
108
|
-
type: "button",
|
|
109
|
-
disabled: picker.panel.pending,
|
|
110
|
-
onClick: picker.cancel,
|
|
111
|
-
children: C.cancel
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
})
|
|
115
|
-
]
|
|
56
|
+
}) : null
|
|
57
|
+
]
|
|
58
|
+
}),
|
|
59
|
+
!readonly && picker.status === 'error' ? /*#__PURE__*/ _jsxs("div", {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ _jsx("p", {
|
|
62
|
+
className: "xp-ui-help",
|
|
63
|
+
children: C.loadError
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: picker.retry,
|
|
68
|
+
children: C.retry
|
|
116
69
|
})
|
|
117
70
|
]
|
|
71
|
+
}) : null,
|
|
72
|
+
missing && !readonly ? /*#__PURE__*/ _jsx("p", {
|
|
73
|
+
className: "xp-ui-help",
|
|
74
|
+
role: "status",
|
|
75
|
+
children: C.undefinedKey
|
|
76
|
+
}) : null,
|
|
77
|
+
picker.canManage && !readOnly ? /*#__PURE__*/ _jsx(_Fragment, {
|
|
78
|
+
children: picker.panel.open ? /*#__PURE__*/ _jsxs("section", {
|
|
79
|
+
className: "xp-ui-subpanel",
|
|
80
|
+
"aria-labelledby": `${id}-title`,
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
83
|
+
id: `${id}-title`,
|
|
84
|
+
children: C.title
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
87
|
+
id: `${id}-name`,
|
|
88
|
+
label: C.name,
|
|
89
|
+
value: picker.panel.name,
|
|
90
|
+
disabled: picker.panel.pending,
|
|
91
|
+
onKeyDown: stopEnter,
|
|
92
|
+
onChange: (event)=>picker.setName(event.currentTarget.value)
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsxs("details", {
|
|
95
|
+
open: picker.panel.advanced,
|
|
96
|
+
onToggle: (event)=>picker.setAdvanced(event.currentTarget.open),
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
99
|
+
children: C.advanced
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
102
|
+
id: `${id}-slug`,
|
|
103
|
+
label: C.slug,
|
|
104
|
+
value: picker.panel.slug,
|
|
105
|
+
disabled: picker.panel.pending,
|
|
106
|
+
onKeyDown: stopEnter,
|
|
107
|
+
error: picker.panel.errors.slug,
|
|
108
|
+
onChange: (event)=>picker.setSlug(event.currentTarget.value)
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
picker.panel.errors.general ? /*#__PURE__*/ _jsx("p", {
|
|
113
|
+
className: "xp-ui-error",
|
|
114
|
+
role: "alert",
|
|
115
|
+
children: picker.panel.errors.general
|
|
116
|
+
}) : null,
|
|
117
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
118
|
+
className: "xp-ui-button-group",
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
121
|
+
type: "button",
|
|
122
|
+
variant: "primary",
|
|
123
|
+
disabled: picker.panel.pending || !picker.panel.name.trim(),
|
|
124
|
+
onClick: ()=>void picker.create(),
|
|
125
|
+
children: C.createGoal
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
128
|
+
type: "button",
|
|
129
|
+
disabled: picker.panel.pending,
|
|
130
|
+
onClick: picker.cancel,
|
|
131
|
+
children: C.cancel
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}) : null
|
|
118
137
|
}) : null
|
|
119
138
|
]
|
|
120
139
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { CustomField } from '@puckeditor/core';
|
|
2
3
|
import type { ExperimentRef } from '../types/puck.js';
|
|
3
4
|
import { type PuckRoutes } from './routes.js';
|
|
4
5
|
export declare function createExperimentSlotField(opts?: {
|
|
5
6
|
label?: string;
|
|
6
7
|
routes?: PuckRoutes;
|
|
8
|
+
renderActions?: (experiment: ExperimentRef) => ReactNode;
|
|
9
|
+
onBind?: (previous: ExperimentRef | null, next: ExperimentRef | null) => void;
|
|
7
10
|
}): CustomField<ExperimentRef | null>;
|
|
@@ -12,10 +12,21 @@ export function createExperimentSlotField(opts) {
|
|
|
12
12
|
routes,
|
|
13
13
|
children: createElement('div', {
|
|
14
14
|
className: 'xp-puck-field'
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
}, ...opts?.renderActions ? [
|
|
16
|
+
createElement(ExperimentPicker, {
|
|
17
|
+
value,
|
|
18
|
+
onChange: (next)=>{
|
|
19
|
+
opts?.onBind?.(value, next);
|
|
20
|
+
onChange(next);
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
value ? opts.renderActions(value) : null
|
|
24
|
+
] : [
|
|
25
|
+
createElement(ExperimentPicker, {
|
|
26
|
+
value,
|
|
27
|
+
onChange
|
|
28
|
+
})
|
|
29
|
+
])
|
|
19
30
|
})
|
|
20
31
|
};
|
|
21
32
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const nestedTestCopy: {
|
|
2
|
+
start: (outer?: string, inner?: string) => string;
|
|
3
|
+
readinessFallback: string;
|
|
4
|
+
editor: (outer?: string, inner?: string) => string;
|
|
5
|
+
publish: (outer?: string, inner?: string) => string;
|
|
6
|
+
hidden: (outer?: string) => string;
|
|
7
|
+
readiness: (detail: unknown) => string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const innerLabel = (inner)=>inner ? `“${inner}”` : 'An Experiment block with no test chosen';
|
|
2
|
+
const outerLabel = (outer)=>outer ? `“${outer}”` : 'another test';
|
|
3
|
+
const moveLabel = (inner)=>inner ? `“${inner}”` : 'that block';
|
|
4
|
+
const location = (outer, inner)=>`${innerLabel(inner)} is inside a version of ${outerLabel(outer)}.`;
|
|
5
|
+
const start = (outer, inner)=>`${location(outer, inner)} A test can't go inside another test's version. Move ${moveLabel(inner)} out of that version before you start either test.`;
|
|
6
|
+
const readinessFallback = "A test is inside another test's version on this page. A test can't go inside another test's version. Move the inner test out of that version before you start either test.";
|
|
7
|
+
export const nestedTestCopy = {
|
|
8
|
+
start,
|
|
9
|
+
readinessFallback,
|
|
10
|
+
editor: (outer, inner)=>inner ? start(outer, inner) : `This test is inside a version of ${outerLabel(outer)}. A test can't go inside another test's version. Move this test out of that version before you start either test.`,
|
|
11
|
+
publish: (outer, inner)=>`${location(outer, inner)} A test can't go inside another test's version, so this page can't be published. Move ${moveLabel(inner)} out of that version to publish the page.`,
|
|
12
|
+
hidden: (outer)=>`This test is inside a version of ${outerLabel(outer)}. It is hidden, so nothing is blocked now. If you show it again, the page can't be published until you move it out of that version.`,
|
|
13
|
+
readiness: (detail)=>(Array.isArray(detail) && detail.length ? detail : [
|
|
14
|
+
{}
|
|
15
|
+
]).map((value)=>{
|
|
16
|
+
const pair = value && typeof value === 'object' ? value : {};
|
|
17
|
+
const text = (value)=>typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
18
|
+
const message = typeof pair.outer === 'string' && typeof pair.inner === 'string' ? start(text(pair.outer), text(pair.inner)) : readinessFallback;
|
|
19
|
+
const title = text(pair.title);
|
|
20
|
+
return title ? `On ${title}: ${message}` : message;
|
|
21
|
+
}).join('\n')
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PuckBlock } from './visibility.js';
|
|
2
|
+
export interface NestedTest {
|
|
3
|
+
outer: PuckBlock;
|
|
4
|
+
inner: PuckBlock;
|
|
5
|
+
}
|
|
6
|
+
/** The placement traversal owns block shape, legacy zones and inherited visibility.
|
|
7
|
+
* Paste supplies its destination ancestors and includes hidden/unbound blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function nestedTests(data: unknown, { includeHidden, ancestors }?: {
|
|
10
|
+
includeHidden?: boolean;
|
|
11
|
+
ancestors?: readonly PuckBlock[];
|
|
12
|
+
}): NestedTest[];
|
|
13
|
+
export declare const nestedTestSlug: (block: PuckBlock) => string | undefined;
|
|
14
|
+
export declare const nestedTestLabel: (block: PuckBlock) => string;
|
|
15
|
+
export declare const nestedTestKey: ({ outer, inner }: NestedTest) => string;
|
|
16
|
+
/** Traversal records all ancestors, from furthest to nearest for each inner block. */
|
|
17
|
+
export declare const nearestOuterTest: (pairs: readonly NestedTest[], innerId: unknown) => PuckBlock | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EXPERIMENT_SLOT_TYPE } from '../types/puck.js';
|
|
2
|
+
import { puckExperimentSlug } from './experimentSlug.js';
|
|
3
|
+
import { walkVisiblePuck } from './visibility.js';
|
|
4
|
+
/** The placement traversal owns block shape, legacy zones and inherited visibility.
|
|
5
|
+
* Paste supplies its destination ancestors and includes hidden/unbound blocks.
|
|
6
|
+
*/ export function nestedTests(data, { includeHidden = false, ancestors = [] } = {}) {
|
|
7
|
+
const result = [];
|
|
8
|
+
walkVisiblePuck(data, (inner, visibility, parents)=>{
|
|
9
|
+
if (!includeHidden && visibility.hidden || inner.type !== EXPERIMENT_SLOT_TYPE) return;
|
|
10
|
+
for (const outer of [
|
|
11
|
+
...ancestors,
|
|
12
|
+
...parents
|
|
13
|
+
]){
|
|
14
|
+
if (outer.type === EXPERIMENT_SLOT_TYPE) result.push({
|
|
15
|
+
outer,
|
|
16
|
+
inner
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
export const nestedTestSlug = (block)=>puckExperimentSlug(block.props.experiment);
|
|
23
|
+
export const nestedTestLabel = (block)=>nestedTestSlug(block) ?? '';
|
|
24
|
+
export const nestedTestKey = ({ outer, inner })=>JSON.stringify([
|
|
25
|
+
outer.props.id,
|
|
26
|
+
nestedTestSlug(outer),
|
|
27
|
+
inner.props.id,
|
|
28
|
+
nestedTestSlug(inner)
|
|
29
|
+
]);
|
|
30
|
+
/** Traversal records all ancestors, from furthest to nearest for each inner block. */ export const nearestOuterTest = (pairs, innerId)=>pairs.filter((pair)=>pair.inner.props.id === innerId).at(-1)?.outer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentConfig } from '@puckeditor/core';
|
|
2
|
-
import type
|
|
2
|
+
import { type ExperimentSlotProps } from '../types/puck.js';
|
|
3
3
|
export declare const experimentSlotLabel = "Experiment block";
|
|
4
4
|
export declare const experimentSlotFields: NonNullable<ComponentConfig<ExperimentSlotProps>['fields']>;
|
|
5
5
|
export declare const experimentSlotDefaultProps: NonNullable<ComponentConfig<ExperimentSlotProps>['defaultProps']>;
|
package/dist/puck/slotConfig.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXPERIMENT_SLOT_TYPE } from '../types/puck.js';
|
|
1
2
|
import { createExperimentSlotField } from './experimentSlotField.js';
|
|
2
3
|
import { slotLabels } from './copy.js';
|
|
3
4
|
export const experimentSlotLabel = 'Experiment block';
|
|
@@ -6,19 +7,31 @@ export const experimentSlotFields = {
|
|
|
6
7
|
// Puck 0.24's defaultSlots prepends each slot, reversing declaration order in the outline.
|
|
7
8
|
variantC: {
|
|
8
9
|
type: 'slot',
|
|
9
|
-
label: slotLabels.variantC
|
|
10
|
+
label: slotLabels.variantC,
|
|
11
|
+
disallow: [
|
|
12
|
+
EXPERIMENT_SLOT_TYPE
|
|
13
|
+
]
|
|
10
14
|
},
|
|
11
15
|
variantB: {
|
|
12
16
|
type: 'slot',
|
|
13
|
-
label: slotLabels.variantB
|
|
17
|
+
label: slotLabels.variantB,
|
|
18
|
+
disallow: [
|
|
19
|
+
EXPERIMENT_SLOT_TYPE
|
|
20
|
+
]
|
|
14
21
|
},
|
|
15
22
|
variantA: {
|
|
16
23
|
type: 'slot',
|
|
17
|
-
label: slotLabels.variantA
|
|
24
|
+
label: slotLabels.variantA,
|
|
25
|
+
disallow: [
|
|
26
|
+
EXPERIMENT_SLOT_TYPE
|
|
27
|
+
]
|
|
18
28
|
},
|
|
19
29
|
control: {
|
|
20
30
|
type: 'slot',
|
|
21
|
-
label: slotLabels.control
|
|
31
|
+
label: slotLabels.control,
|
|
32
|
+
disallow: [
|
|
33
|
+
EXPERIMENT_SLOT_TYPE
|
|
34
|
+
]
|
|
22
35
|
}
|
|
23
36
|
};
|
|
24
37
|
export const experimentSlotDefaultProps = {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** payload-puck's stored visibility contract. No runtime dependency on the host plugin. */
|
|
2
|
+
export declare const visibilitySizes: readonly ["phone", "tablet", "desktop"];
|
|
3
|
+
export type VisibilitySize = typeof visibilitySizes[number];
|
|
4
|
+
/** Read known sizes only; missing lists and malformed entries add no hiding. */
|
|
5
|
+
export declare function hiddenOnSizes(value: unknown): VisibilitySize[];
|
|
6
|
+
export declare function fullyHidden(value: unknown): boolean;
|
|
7
|
+
export type BlockVisibility = {
|
|
8
|
+
hidden: boolean;
|
|
9
|
+
hideOn: VisibilitySize[];
|
|
10
|
+
};
|
|
11
|
+
export type PuckBlock = Record<string, unknown> & {
|
|
12
|
+
type: string;
|
|
13
|
+
props: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
/** Visit blocks with their ancestors' visibility, including legacy owner-id:zone edges.
|
|
16
|
+
* Orphan zones retain their historical discovery behavior and count as shown.
|
|
17
|
+
*/
|
|
18
|
+
export declare function walkVisiblePuck(data: unknown, visit: (block: PuckBlock, visibility: BlockVisibility, ancestors: readonly PuckBlock[]) => void): void;
|
|
19
|
+
/** Identity-keyed index shared by discovery and the public resolver. */
|
|
20
|
+
export declare function puckVisibility(data: unknown): Map<object, BlockVisibility>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** payload-puck's stored visibility contract. No runtime dependency on the host plugin. */ export const visibilitySizes = [
|
|
2
|
+
'phone',
|
|
3
|
+
'tablet',
|
|
4
|
+
'desktop'
|
|
5
|
+
];
|
|
6
|
+
const object = (value)=>!!value && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
/** Read known sizes only; missing lists and malformed entries add no hiding. */ export function hiddenOnSizes(value) {
|
|
8
|
+
if (!object(value) || !Array.isArray(value.hideOn)) return [];
|
|
9
|
+
const sizes = value.hideOn;
|
|
10
|
+
return visibilitySizes.filter((size)=>sizes.includes(size));
|
|
11
|
+
}
|
|
12
|
+
export function fullyHidden(value) {
|
|
13
|
+
return object(value) && (value.hidden === true || hiddenOnSizes(value).length === visibilitySizes.length);
|
|
14
|
+
}
|
|
15
|
+
/** Visit blocks with their ancestors' visibility, including legacy owner-id:zone edges.
|
|
16
|
+
* Orphan zones retain their historical discovery behavior and count as shown.
|
|
17
|
+
*/ export function walkVisiblePuck(data, visit) {
|
|
18
|
+
const owners = new Set();
|
|
19
|
+
const zones = new Map();
|
|
20
|
+
const roots = [];
|
|
21
|
+
function index(value) {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
value.forEach(index);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!object(value)) return;
|
|
27
|
+
if (typeof value.type === 'string' && object(value.props) && typeof value.props.id === 'string') owners.add(value.props.id);
|
|
28
|
+
for (const [key, child] of Object.entries(value)){
|
|
29
|
+
if (value === data && key === 'zones' && object(child)) {
|
|
30
|
+
for (const [zone, content] of Object.entries(child)){
|
|
31
|
+
const owner = zone.slice(0, zone.lastIndexOf(':'));
|
|
32
|
+
zones.set(owner, [
|
|
33
|
+
...zones.get(owner) ?? [],
|
|
34
|
+
content
|
|
35
|
+
]);
|
|
36
|
+
roots.push({
|
|
37
|
+
owner,
|
|
38
|
+
content
|
|
39
|
+
});
|
|
40
|
+
index(content);
|
|
41
|
+
}
|
|
42
|
+
} else index(child);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
index(data);
|
|
46
|
+
const seen = new WeakSet();
|
|
47
|
+
function walk(value, inherited, ancestors) {
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
value.forEach((child)=>walk(child, inherited, ancestors));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!object(value) || seen.has(value)) return;
|
|
53
|
+
seen.add(value);
|
|
54
|
+
let visibility = inherited;
|
|
55
|
+
const props = value.props;
|
|
56
|
+
if (typeof value.type === 'string' && object(props)) {
|
|
57
|
+
visibility = {
|
|
58
|
+
hidden: inherited.hidden || fullyHidden(props._visibility),
|
|
59
|
+
hideOn: visibilitySizes.filter((size)=>inherited.hideOn.includes(size) || hiddenOnSizes(props._visibility).includes(size))
|
|
60
|
+
};
|
|
61
|
+
visit(value, visibility, ancestors);
|
|
62
|
+
ancestors = [
|
|
63
|
+
...ancestors,
|
|
64
|
+
value
|
|
65
|
+
];
|
|
66
|
+
if (typeof props.id === 'string') for (const content of zones.get(props.id) ?? [])walk(content, visibility, ancestors);
|
|
67
|
+
}
|
|
68
|
+
for (const [key, child] of Object.entries(value))if (value !== data || key !== 'zones' || !object(child)) walk(child, visibility, ancestors);
|
|
69
|
+
}
|
|
70
|
+
const shown = {
|
|
71
|
+
hidden: false,
|
|
72
|
+
hideOn: []
|
|
73
|
+
};
|
|
74
|
+
walk(data, shown, []);
|
|
75
|
+
for (const root of roots)if (!owners.has(root.owner)) walk(root.content, shown, []);
|
|
76
|
+
}
|
|
77
|
+
/** Identity-keyed index shared by discovery and the public resolver. */ export function puckVisibility(data) {
|
|
78
|
+
const result = new Map();
|
|
79
|
+
walkVisiblePuck(data, (block, visibility)=>result.set(block, visibility));
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
@@ -2,11 +2,13 @@ export type Timestamp = Date | string | number;
|
|
|
2
2
|
export interface ExposedUnit {
|
|
3
3
|
arm: string;
|
|
4
4
|
firstTs: Timestamp;
|
|
5
|
+
unitAgeMs?: number;
|
|
5
6
|
}
|
|
6
7
|
export interface MetricEvent {
|
|
7
8
|
unitId: string;
|
|
8
9
|
value: number;
|
|
9
10
|
ts: Timestamp;
|
|
11
|
+
unitAgeMs?: number;
|
|
10
12
|
}
|
|
11
13
|
/** Accept Date, timestamp text, or epoch milliseconds; reject invalid dates. */
|
|
12
14
|
export declare function timestampMs(ts: Timestamp): number;
|
|
@@ -17,18 +19,19 @@ export declare function firstExposures(rows: readonly {
|
|
|
17
19
|
unitId: string;
|
|
18
20
|
arm: string;
|
|
19
21
|
ts: Timestamp;
|
|
22
|
+
unitAgeMs?: number;
|
|
20
23
|
}[], { endedAt }?: {
|
|
21
24
|
endedAt?: Timestamp;
|
|
22
25
|
}): {
|
|
23
|
-
units: Map<string, {
|
|
24
|
-
arm: string;
|
|
26
|
+
units: Map<string, ExposedUnit & {
|
|
25
27
|
firstTs: Date;
|
|
26
28
|
}>;
|
|
27
29
|
excludedMultiArm: number;
|
|
28
30
|
};
|
|
29
31
|
/** Spec §7.6/§8.2: zero-filled outcomes over each exposed unit's half-open window. */
|
|
30
|
-
export declare function perUnitValues(units: ReadonlyMap<string, ExposedUnit>, events: readonly MetricEvent[], { kind, windowHours, endedAt }: {
|
|
32
|
+
export declare function perUnitValues(units: ReadonlyMap<string, ExposedUnit>, events: readonly MetricEvent[], { kind, windowHours, endedAt, onAttributed }: {
|
|
31
33
|
kind: 'binomial' | 'count' | 'revenue';
|
|
32
34
|
windowHours: number;
|
|
33
35
|
endedAt?: Timestamp;
|
|
36
|
+
onAttributed?: (event: MetricEvent, ts: number) => void;
|
|
34
37
|
}): Map<string, number>;
|
|
@@ -21,24 +21,23 @@ import { XpAnalysisError } from '../errors.js';
|
|
|
21
21
|
const ts = timestampMs(row.ts);
|
|
22
22
|
if (ts >= end || excluded.has(row.unitId)) continue;
|
|
23
23
|
const unit = first.get(row.unitId);
|
|
24
|
-
if (
|
|
25
|
-
arm: row.arm,
|
|
26
|
-
firstTs: ts
|
|
27
|
-
});
|
|
28
|
-
else if (unit.arm !== row.arm) {
|
|
24
|
+
if (unit && unit.arm !== row.arm) {
|
|
29
25
|
first.delete(row.unitId);
|
|
30
26
|
excluded.add(row.unitId);
|
|
31
|
-
} else if (ts < unit.firstTs) {
|
|
27
|
+
} else if (!unit || ts < unit.firstTs) {
|
|
32
28
|
first.set(row.unitId, {
|
|
33
29
|
arm: row.arm,
|
|
34
|
-
firstTs: ts
|
|
30
|
+
firstTs: ts,
|
|
31
|
+
...row.unitAgeMs === undefined ? {} : {
|
|
32
|
+
unitAgeMs: row.unitAgeMs
|
|
33
|
+
}
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
const units = new Map();
|
|
39
38
|
for (const [unitId, unit] of first){
|
|
40
39
|
units.set(unitId, {
|
|
41
|
-
|
|
40
|
+
...unit,
|
|
42
41
|
firstTs: new Date(unit.firstTs)
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -47,7 +46,7 @@ import { XpAnalysisError } from '../errors.js';
|
|
|
47
46
|
excludedMultiArm: excluded.size
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
/** Spec §7.6/§8.2: zero-filled outcomes over each exposed unit's half-open window. */ export function perUnitValues(units, events, { kind, windowHours, endedAt }) {
|
|
49
|
+
/** Spec §7.6/§8.2: zero-filled outcomes over each exposed unit's half-open window. */ export function perUnitValues(units, events, { kind, windowHours, endedAt, onAttributed }) {
|
|
51
50
|
const values = new Map();
|
|
52
51
|
const starts = new Map();
|
|
53
52
|
const duration = windowMs(windowHours);
|
|
@@ -61,6 +60,7 @@ import { XpAnalysisError } from '../errors.js';
|
|
|
61
60
|
const start = starts.get(event.unitId);
|
|
62
61
|
if (start === undefined) continue;
|
|
63
62
|
if (ts < start || ts >= Math.min(start + duration, phaseEnd)) continue;
|
|
63
|
+
onAttributed?.(event, ts);
|
|
64
64
|
values.set(event.unitId, kind === 'binomial' ? 1 : values.get(event.unitId) + (kind === 'count' ? 1 : event.value));
|
|
65
65
|
}
|
|
66
66
|
return values;
|