@delmaredigital/payload-experiments 0.4.0-rc.1 → 0.4.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -772
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +12 -5
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +129 -37
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.d.ts +3 -0
- package/dist/admin/blocks/formApi.js +10 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +10 -6
- package/dist/admin/blocks/statusCache.d.ts +2 -0
- package/dist/admin/blocks/statusCache.js +12 -3
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +21 -1
- package/dist/admin/copy/blocks.js +40 -6
- package/dist/admin/copy/goals.d.ts +21 -9
- package/dist/admin/copy/goals.js +28 -11
- package/dist/admin/copy/newTest.d.ts +7 -7
- package/dist/admin/copy/newTest.js +10 -7
- package/dist/admin/goals/XpGoalField.d.ts +2 -0
- package/dist/admin/goals/XpGoalField.js +156 -114
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/paths.d.ts +3 -0
- package/dist/admin/paths.js +3 -0
- package/dist/admin/placementStatus.model.js +1 -1
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +29 -4
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +273 -58
- package/dist/admin/surface/TestsSurface.js +8 -7
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +2 -1
- package/dist/admin/surface/goals/GoalForm.js +342 -212
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +107 -37
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +11 -2
- package/dist/admin/surface/goals/goals.css +9 -1
- package/dist/admin/surface/goals/goals.model.d.ts +12 -2
- package/dist/admin/surface/goals/goals.model.js +39 -1
- package/dist/admin/surface/home.model.d.ts +10 -8
- package/dist/admin/surface/home.model.js +27 -22
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +149 -118
- package/dist/admin/surface/newTest/PageWizard.d.ts +5 -2
- package/dist/admin/surface/newTest/PageWizard.js +115 -80
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +3 -3
- package/dist/admin/surface/results/ResultsHeader.js +115 -83
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +44 -152
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +18 -165
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +35 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/collections/experiments/config.js +17 -8
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +28 -9
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +57 -9
- package/dist/endpoints/pages.js +247 -64
- package/dist/endpoints/placementStatus.js +13 -5
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +6 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/fields/xpGoal.js +3 -15
- package/dist/goals/fairness.d.ts +1 -1
- package/dist/goals/fairness.js +44 -35
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +27 -2
- package/dist/hooks/pageGuard.js +213 -45
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +36 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +70 -21
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +5 -1
- package/dist/puck/copy.js +5 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +1007 -182
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +72 -0
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +35 -19
- package/dist/puck/editor/VersionBuilder.d.ts +67 -12
- package/dist/puck/editor/VersionBuilder.js +560 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +65 -20
- package/dist/puck/editor/copy.js +73 -21
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +200 -20
- package/dist/puck/editor/editor.css +338 -25
- package/dist/puck/editor/editor.model.d.ts +17 -1
- package/dist/puck/editor/editor.model.js +61 -4
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +105 -86
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +2 -2
- package/dist/puck/slotConfig.js +18 -5
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.d.ts +1 -1
- package/dist/results/verdict.js +9 -7
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +22 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +48 -22
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +9 -5
- package/dist/testSurface/actions/DecideDialog.d.ts +17 -0
- package/dist/testSurface/actions/DecideDialog.js +222 -0
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +123 -0
- package/dist/{admin → testSurface}/actions/decide.model.d.ts +1 -0
- package/dist/{admin → testSurface}/actions/decide.model.js +1 -0
- package/dist/{admin → testSurface}/allocation.model.js +6 -3
- package/dist/{admin → testSurface}/api.d.ts +20 -7
- package/dist/{admin → testSurface}/api.js +72 -22
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +37 -14
- package/dist/{admin → testSurface}/copy/actions.js +40 -17
- package/dist/{admin → testSurface}/copy/advanced.d.ts +10 -0
- package/dist/{admin → testSurface}/copy/advanced.js +10 -0
- package/dist/{admin → testSurface}/copy/arms.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/arms.js +1 -1
- package/dist/{admin → testSurface}/copy/audience.d.ts +4 -3
- package/dist/{admin → testSurface}/copy/audience.js +5 -4
- package/dist/{admin → testSurface}/copy/common.d.ts +15 -6
- package/dist/{admin → testSurface}/copy/common.js +20 -10
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +18 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +40 -6
- package/dist/{admin → testSurface}/copy/readiness.js +54 -9
- package/dist/{admin → testSurface}/copy/recommendation.d.ts +4 -4
- package/dist/{admin → testSurface}/copy/recommendation.js +4 -4
- package/dist/{admin → testSurface}/copy/results.d.ts +19 -12
- package/dist/{admin → testSurface}/copy/results.js +21 -12
- package/dist/testSurface/copy/review.d.ts +20 -0
- package/dist/testSurface/copy/review.js +21 -0
- package/dist/{admin → testSurface}/copy/setting.d.ts +1 -2
- package/dist/{admin → testSurface}/copy/setting.js +1 -2
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +14 -11
- package/dist/{admin → testSurface}/copy/testPage.d.ts +61 -12
- package/dist/testSurface/copy/testPage.js +168 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/format/date.d.ts +1 -0
- package/dist/testSurface/format/date.js +21 -0
- package/dist/{admin → testSurface}/labels.d.ts +1 -2
- package/dist/{admin → testSurface}/labels.js +2 -3
- package/dist/{admin → testSurface}/lockedNotice.model.d.ts +2 -0
- package/dist/{admin → testSurface}/lockedNotice.model.js +31 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/{admin → testSurface}/placements/placementLabels.d.ts +2 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +3 -2
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.d.ts +3 -2
- package/dist/{admin → testSurface}/results/results.model.js +16 -11
- package/dist/{admin → testSurface}/surface/contracts.d.ts +17 -3
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/testSurface/surface/pageBlock/parts.js +107 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +498 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +372 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +4 -3
- package/dist/testSurface/surface/readiness/Banner.js +198 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +13 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +67 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +28 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +6 -3
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +40 -40
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +11 -4
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +207 -104
- package/dist/{admin → testSurface}/surface/results/recommendation.model.js +3 -3
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +26 -8
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +18 -0
- package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +12 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +119 -89
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +25 -14
- package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/PageHoldout.js +11 -8
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +4 -11
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +88 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +87 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/testSurface/surface/test/VersionsSection.js +301 -0
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +33 -9
- package/dist/testSurface/surface/test/fields.js +300 -0
- package/dist/{admin → testSurface}/surface/test/pageParts.js +30 -44
- package/dist/testSurface/surface/test/testPage.css +111 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +3 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +8 -0
- package/dist/testSurface/surfaceUrls.js +23 -0
- package/dist/{admin → testSurface}/useApi.d.ts +21 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +6 -1
- package/dist/transitions/checkStart.js +133 -17
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +6 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +41 -17
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +16 -12
- package/dist/transitions/placements.d.ts +54 -8
- package/dist/transitions/placements.js +304 -81
- package/dist/transitions/preflightData.d.ts +5 -3
- package/dist/transitions/preflightData.js +137 -40
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +72 -35
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/contracts.d.ts +15 -3
- package/dist/types/endpoints.d.ts +121 -17
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +9 -9
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +141 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +6 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +50 -5
- package/package.json +3 -2
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -10
- package/dist/admin/actions/DecideDialog.js +0 -190
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/copy/metrics.js +0 -9
- package/dist/admin/copy/pages.d.ts +0 -26
- package/dist/admin/copy/pages.js +0 -26
- package/dist/admin/copy/review.d.ts +0 -17
- package/dist/admin/copy/review.js +0 -17
- package/dist/admin/copy/testPage.js +0 -104
- package/dist/admin/format/date.js +0 -10
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/pageBlock/parts.js +0 -69
- package/dist/admin/surface/pagePicker/CopyRoute.d.ts +0 -6
- package/dist/admin/surface/pagePicker/CopyRoute.js +0 -53
- package/dist/admin/surface/pagePicker/PagePicker.d.ts +0 -10
- package/dist/admin/surface/pagePicker/PagePicker.js +0 -172
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -337
- package/dist/admin/surface/readiness/Banner.js +0 -190
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.js +0 -205
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/VersionsSection.js +0 -247
- package/dist/admin/surface/test/fields.js +0 -216
- package/dist/admin/surface/test/testPage.css +0 -97
- package/dist/admin/surface/useTestDocument.d.ts +0 -32
- package/dist/admin/surface/useTestDocument.js +0 -415
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { blockingSteps, pageReadinessContext, sectionBlocked } from '../readiness/readiness.model.js';
|
|
5
|
+
import { readinessParts } from '../readiness/parts.js';
|
|
6
|
+
import { SectionCard } from '../../../ui/SectionCard.js';
|
|
7
|
+
import { SECTION_ORDER } from '../contracts.js';
|
|
8
|
+
import { fixFieldsNext } from '../../copy/readiness.js';
|
|
9
|
+
import { sectionLockNotice } from '../../lockedNotice.model.js';
|
|
10
|
+
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
11
|
+
export function Section({ test, sectionId, children, surface }) {
|
|
12
|
+
const hasAdvancedError = Object.keys(test.errors).some((path)=>path.startsWith('analysis.') && ![
|
|
13
|
+
'analysis.reachPerDay',
|
|
14
|
+
'analysis.plannedDurationDays'
|
|
15
|
+
].includes(path) || path === 'exposurePolicy');
|
|
16
|
+
const [open, setOpen] = useState(hasAdvancedError);
|
|
17
|
+
const [prevHasAdvancedError, setPrevHasAdvancedError] = useState(hasAdvancedError);
|
|
18
|
+
if (hasAdvancedError !== prevHasAdvancedError) {
|
|
19
|
+
setPrevHasAdvancedError(hasAdvancedError);
|
|
20
|
+
if (hasAdvancedError) setOpen(true);
|
|
21
|
+
}
|
|
22
|
+
const reason = test.doc && sectionLockNotice(test.doc.status, sectionId);
|
|
23
|
+
const notice = reason ? /*#__PURE__*/ _jsx("p", {
|
|
24
|
+
className: "xp-ui-help xp-section-lock",
|
|
25
|
+
children: reason
|
|
26
|
+
}) : null;
|
|
27
|
+
const setup = test.doc?.status === 'draft' || test.doc?.status === 'stopped';
|
|
28
|
+
const blocked = setup && sectionBlocked(test, sectionId);
|
|
29
|
+
const blockers = setup && test.doc ? blockingSteps(test.preflight, surface ? pageReadinessContext(test.doc, test.preflight, surface) : test.doc).filter((step)=>step.section === sectionId) : [];
|
|
30
|
+
const done = readinessParts.sectionDone(test)[sectionId];
|
|
31
|
+
const blockerLines = blockers.map((step, index)=>/*#__PURE__*/ _jsxs("p", {
|
|
32
|
+
className: "xp-ui-error xp-test-blocker",
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsx("span", {
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
children: "⊗ "
|
|
37
|
+
}),
|
|
38
|
+
step.sentence
|
|
39
|
+
]
|
|
40
|
+
}, `${step.code}-${index}`));
|
|
41
|
+
if (setup && sectionId === 'advanced' && hasAdvancedError) blockerLines.push(/*#__PURE__*/ _jsxs("p", {
|
|
42
|
+
className: "xp-ui-error xp-test-blocker",
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ _jsx("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: "⊗ "
|
|
47
|
+
}),
|
|
48
|
+
fixFieldsNext(C.sections.advanced)
|
|
49
|
+
]
|
|
50
|
+
}, "advanced-validation"));
|
|
51
|
+
if (sectionId === 'advanced') return /*#__PURE__*/ _jsxs("details", {
|
|
52
|
+
open: open,
|
|
53
|
+
onToggle: (event)=>setOpen(event.currentTarget.open),
|
|
54
|
+
className: `xp-test-advanced${blocked ? ' xp-ui-section--blocked' : ''}`,
|
|
55
|
+
id: "section-advanced",
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
58
|
+
children: /*#__PURE__*/ _jsx("h2", {
|
|
59
|
+
id: "title-advanced",
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
children: C.sections.advanced
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
65
|
+
className: "xp-ui-section-body",
|
|
66
|
+
children: [
|
|
67
|
+
notice,
|
|
68
|
+
children,
|
|
69
|
+
blockerLines
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
return /*#__PURE__*/ _jsxs(SectionCard, {
|
|
75
|
+
number: SECTION_ORDER.indexOf(sectionId) + 1,
|
|
76
|
+
title: C.sections[sectionId],
|
|
77
|
+
complete: done,
|
|
78
|
+
blocked: blocked,
|
|
79
|
+
id: `section-${sectionId}`,
|
|
80
|
+
headingId: `title-${sectionId}`,
|
|
81
|
+
className: "xp-test-section",
|
|
82
|
+
children: [
|
|
83
|
+
notice,
|
|
84
|
+
children,
|
|
85
|
+
blockerLines
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Button } from '../../../ui/Button.js';
|
|
4
4
|
import { useId, useState } from 'react';
|
|
5
5
|
import { ChipsInput } from '../../../ui/ChipsInput.js';
|
|
6
6
|
import { AUDIENCE_COPY } from '../../copy/audience.js';
|
|
7
7
|
import { coerceValue, emptyListHint, humaniseAttribute, opLabel, opsFor, readListValue, readTargetingRules, valueInput } from '../../targeting/targeting.model.js';
|
|
8
8
|
import { TEST_PAGE as C, NUMBER_COMPARISONS } from '../../copy/testPage.js';
|
|
9
|
-
import { CheckboxList, FieldErrors, reasonFor, save, SelectEdit, TextEdit } from './fields.js';
|
|
9
|
+
import { CheckboxList, FieldErrors, ReadOnly, reasonFor, save, SavedValueChanged, SelectEdit, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
|
|
10
10
|
import { Section } from './Section.js';
|
|
11
11
|
export function TargetingSection({ test, surface }) {
|
|
12
12
|
const id = useId();
|
|
@@ -22,6 +22,7 @@ export function TargetingSection({ test, surface }) {
|
|
|
22
22
|
const blockPath = (key)=>test.doc.kind === 'block' && key === 'path';
|
|
23
23
|
const keys = Object.keys(surface.attributeKeys).filter((key)=>!blockPath(key));
|
|
24
24
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
25
|
+
surface: surface,
|
|
25
26
|
test: test,
|
|
26
27
|
sectionId: "who",
|
|
27
28
|
children: [
|
|
@@ -58,12 +59,20 @@ export function TargetingSection({ test, surface }) {
|
|
|
58
59
|
...partial
|
|
59
60
|
} : row));
|
|
60
61
|
const hint = emptyListHint(rule.op, rule.value);
|
|
62
|
+
const draftKey = JSON.stringify([
|
|
63
|
+
'targeting',
|
|
64
|
+
rowsRevision,
|
|
65
|
+
index,
|
|
66
|
+
rule.attribute,
|
|
67
|
+
rule.op,
|
|
68
|
+
rules.length
|
|
69
|
+
]);
|
|
61
70
|
const changeValue = (raw)=>{
|
|
62
71
|
const current = test.doc.targeting?.[index];
|
|
63
72
|
const schema = current && surface.attributeKeys[current.attribute];
|
|
64
|
-
if (!current || !schema) return;
|
|
73
|
+
if (!current || !schema) return false;
|
|
65
74
|
const value = coerceValue(schema.type, current.op, raw);
|
|
66
|
-
|
|
75
|
+
return value !== null && setRule({
|
|
67
76
|
value
|
|
68
77
|
});
|
|
69
78
|
};
|
|
@@ -124,15 +133,15 @@ export function TargetingSection({ test, surface }) {
|
|
|
124
133
|
])
|
|
125
134
|
] : values.filter((saved)=>saved !== value));
|
|
126
135
|
}
|
|
127
|
-
}) : input.kind === 'chips' ? /*#__PURE__*/ _jsx(
|
|
136
|
+
}) : input.kind === 'chips' ? /*#__PURE__*/ _jsx(TargetingChips, {
|
|
137
|
+
draftKey: draftKey,
|
|
138
|
+
test: test,
|
|
128
139
|
id: `${id}-${index}-value`,
|
|
129
|
-
label: C.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
onChange: changeValue
|
|
135
|
-
}, `${rule.attribute}-${rule.op}`) : input.kind === 'select' ? /*#__PURE__*/ _jsx(SelectEdit, {
|
|
140
|
+
label: C.targetingValue(humaniseAttribute(rule.attribute)),
|
|
141
|
+
values: readListValue(rule.value),
|
|
142
|
+
reason: reason,
|
|
143
|
+
onCommit: changeValue
|
|
144
|
+
}, draftKey) : input.kind === 'select' ? /*#__PURE__*/ _jsx(SelectEdit, {
|
|
136
145
|
label: C.value,
|
|
137
146
|
reason: reason,
|
|
138
147
|
value: String(rule.value),
|
|
@@ -154,6 +163,8 @@ export function TargetingSection({ test, surface }) {
|
|
|
154
163
|
],
|
|
155
164
|
onCommit: changeValue
|
|
156
165
|
}) : /*#__PURE__*/ _jsx(TextEdit, {
|
|
166
|
+
test: test,
|
|
167
|
+
draftKey: draftKey,
|
|
157
168
|
label: C.value,
|
|
158
169
|
reason: reason,
|
|
159
170
|
value: Array.isArray(rule.value) ? rule.value.join(', ') : String(rule.value),
|
|
@@ -179,6 +190,10 @@ export function TargetingSection({ test, surface }) {
|
|
|
179
190
|
]
|
|
180
191
|
}, `${rowsRevision}-${index}`);
|
|
181
192
|
}),
|
|
193
|
+
!reason && !keys.length ? /*#__PURE__*/ _jsx("p", {
|
|
194
|
+
className: "xp-ui-help",
|
|
195
|
+
children: C.noAudienceRules
|
|
196
|
+
}) : null,
|
|
182
197
|
!reason ? /*#__PURE__*/ _jsx("div", {
|
|
183
198
|
className: "xp-ui-button-group",
|
|
184
199
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
@@ -205,3 +220,63 @@ export function TargetingSection({ test, surface }) {
|
|
|
205
220
|
]
|
|
206
221
|
});
|
|
207
222
|
}
|
|
223
|
+
function TargetingChips({ test, draftKey, id, label, values, reason, onCommit }) {
|
|
224
|
+
const saved = values.join(', ');
|
|
225
|
+
const draft = useFieldDraft(test, draftKey, label, '', saved);
|
|
226
|
+
const [announcement, announce] = useDraftAnnouncement();
|
|
227
|
+
const choice = draft.dirty && !draft.saving && (draft.conflict || draft.retry || reason);
|
|
228
|
+
const locked = Boolean(reason || test.stale || draft.saving);
|
|
229
|
+
const commit = (text, confirmed = false)=>{
|
|
230
|
+
if (locked || choice && !confirmed) {
|
|
231
|
+
announce();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const next = [
|
|
235
|
+
...new Set([
|
|
236
|
+
...values,
|
|
237
|
+
...text.split(',').map((value)=>value.trim()).filter(Boolean)
|
|
238
|
+
])
|
|
239
|
+
];
|
|
240
|
+
if (next.length === values.length) {
|
|
241
|
+
draft.discard();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (text !== draft.value || !draft.dirty) draft.change(text);
|
|
245
|
+
draft.submit(()=>onCommit(next));
|
|
246
|
+
};
|
|
247
|
+
if (reason && !draft.dirty) return /*#__PURE__*/ _jsx(ReadOnly, {
|
|
248
|
+
label: C.value,
|
|
249
|
+
value: values.join(', ')
|
|
250
|
+
});
|
|
251
|
+
const choiceId = choice ? `${id}-new-value` : undefined;
|
|
252
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
253
|
+
children: [
|
|
254
|
+
/*#__PURE__*/ _jsx(ChipsInput, {
|
|
255
|
+
id: id,
|
|
256
|
+
label: C.value,
|
|
257
|
+
value: values,
|
|
258
|
+
disabled: locked,
|
|
259
|
+
description: reason ? undefined : AUDIENCE_COPY.listDescription,
|
|
260
|
+
placeholder: AUDIENCE_COPY.listPlaceholder,
|
|
261
|
+
onChange: onCommit,
|
|
262
|
+
draft: {
|
|
263
|
+
value: draft.dirty ? draft.value : '',
|
|
264
|
+
change: draft.change,
|
|
265
|
+
submit: commit,
|
|
266
|
+
discard: draft.discard,
|
|
267
|
+
describedBy: choiceId
|
|
268
|
+
}
|
|
269
|
+
}),
|
|
270
|
+
choiceId ? /*#__PURE__*/ _jsx(SavedValueChanged, {
|
|
271
|
+
id: choiceId,
|
|
272
|
+
value: saved,
|
|
273
|
+
reason: reason,
|
|
274
|
+
showReason: false,
|
|
275
|
+
conflict: draft.conflict,
|
|
276
|
+
announce: announcement,
|
|
277
|
+
onKeep: !locked ? ()=>commit(draft.value, true) : undefined,
|
|
278
|
+
onDiscard: draft.discard
|
|
279
|
+
}) : null
|
|
280
|
+
]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { DocId } from '../../../types/contracts.js';
|
|
3
|
+
import type { SurfaceProps, TestDocApi } from '../contracts.js';
|
|
4
|
+
import type { TestDocument } from '../testDocument.model.js';
|
|
5
|
+
import type { PreflightResult } from '../../../types/endpoints.js';
|
|
6
|
+
import './testPage.css';
|
|
7
|
+
export declare function TestSurface({ id, surface, onTitleChange, renderFrame, embedded, onDocument, onPreflight, requestPreflight }: {
|
|
8
|
+
id: DocId;
|
|
9
|
+
surface: SurfaceProps;
|
|
10
|
+
onTitleChange?: (title: string) => void;
|
|
11
|
+
embedded?: boolean;
|
|
12
|
+
renderFrame?: (content: {
|
|
13
|
+
test: TestDocApi;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}) => ReactNode;
|
|
16
|
+
onDocument?: (doc: TestDocument) => void;
|
|
17
|
+
onPreflight?: (preflight: PreflightResult) => void;
|
|
18
|
+
requestPreflight?: (signal: AbortSignal, supersede?: boolean) => Promise<Response>;
|
|
19
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { DeleteTestAction } from './DeleteTest.js';
|
|
4
|
+
import { useEffect, useState, useRef } from 'react';
|
|
5
|
+
import { useTestDocument } from '../useTestDocument.js';
|
|
6
|
+
import { API_MESSAGES } from '../../copy/common.js';
|
|
7
|
+
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
8
|
+
import { pageBlockParts } from '../pageBlock/parts.js';
|
|
9
|
+
import { settingParts } from '../setting/parts.js';
|
|
10
|
+
import { pageParts } from './pageParts.js';
|
|
11
|
+
import { Section } from './Section.js';
|
|
12
|
+
import { Hypothesis, TestName } from './fields.js';
|
|
13
|
+
import { VersionsSection } from './VersionsSection.js';
|
|
14
|
+
import { GoalSection } from './GoalSection.js';
|
|
15
|
+
import { TargetingSection } from './TargetingSection.js';
|
|
16
|
+
import { LengthSection } from './LengthSection.js';
|
|
17
|
+
import { AdvancedSection } from './AdvancedSection.js';
|
|
18
|
+
import { Button } from '../../../ui/Button.js';
|
|
19
|
+
import { Banner } from '../../../ui/Feedback.js';
|
|
20
|
+
import { Rail } from './Rail.js';
|
|
21
|
+
import { ReadinessBar } from './ReadinessBar.js';
|
|
22
|
+
import { ResultsBody } from '../results/ResultsBody.js';
|
|
23
|
+
import { usePlacementNotice } from '../../../puck/editor/usePlacementNotice.js';
|
|
24
|
+
import { subscribePlacements, cachedPreflight, cachedReadinessRead, placementsPending, placementsBlocking, placementReadError } from '../../../puck/editor/placementsCache.js';
|
|
25
|
+
import { currentPuckDocument } from '../../../puck/editor/editor.model.js';
|
|
26
|
+
import { editorPlacementMessage, editorPreflight } from '../editorPlacement.js';
|
|
27
|
+
import './testPage.css';
|
|
28
|
+
export function TestSurface({ id, surface, onTitleChange, renderFrame, embedded = false, onDocument, onPreflight, requestPreflight }) {
|
|
29
|
+
const [barHeight, setBarHeight] = useState();
|
|
30
|
+
const documentState = useTestDocument(id, {
|
|
31
|
+
apiRoute: surface.apiRoute,
|
|
32
|
+
contentLocale: surface.contentLocale,
|
|
33
|
+
enabled: surface.canManage,
|
|
34
|
+
onDocument,
|
|
35
|
+
onPreflight,
|
|
36
|
+
requestPreflight
|
|
37
|
+
});
|
|
38
|
+
const [placementRead, setPlacementRead] = useState();
|
|
39
|
+
const placementKey = JSON.stringify([
|
|
40
|
+
surface.apiRoute,
|
|
41
|
+
String(id),
|
|
42
|
+
...surface.contentLocale ? [
|
|
43
|
+
surface.contentLocale
|
|
44
|
+
] : []
|
|
45
|
+
]);
|
|
46
|
+
const watching = embedded && surface.canManage && documentState.loadState === 'ready';
|
|
47
|
+
useEffect(()=>{
|
|
48
|
+
if (!embedded || !surface.canManage) return;
|
|
49
|
+
return subscribePlacements(surface.apiRoute, id, ()=>setPlacementRead({
|
|
50
|
+
key: placementKey,
|
|
51
|
+
preflight: cachedPreflight(surface.apiRoute, id, surface.contentLocale),
|
|
52
|
+
read: cachedReadinessRead(surface.apiRoute, id, surface.contentLocale),
|
|
53
|
+
pending: placementsPending(surface.apiRoute, id, surface.contentLocale),
|
|
54
|
+
blocking: placementsBlocking(surface.apiRoute, id, surface.contentLocale),
|
|
55
|
+
error: placementReadError(surface.apiRoute, id, surface.contentLocale)
|
|
56
|
+
}), surface.contentLocale);
|
|
57
|
+
}, [
|
|
58
|
+
surface.apiRoute,
|
|
59
|
+
id,
|
|
60
|
+
embedded,
|
|
61
|
+
surface.canManage,
|
|
62
|
+
placementKey,
|
|
63
|
+
surface.contentLocale
|
|
64
|
+
]);
|
|
65
|
+
const currentRead = documentState.loadState === 'ready' && placementRead?.key === placementKey ? placementRead : undefined;
|
|
66
|
+
const answer = currentRead?.pending ? undefined : currentRead?.read;
|
|
67
|
+
const { syncDocument } = documentState;
|
|
68
|
+
useEffect(()=>{
|
|
69
|
+
syncDocument?.(answer);
|
|
70
|
+
}, [
|
|
71
|
+
answer,
|
|
72
|
+
syncDocument
|
|
73
|
+
]);
|
|
74
|
+
const preflight = currentRead ? currentRead.preflight ?? (currentRead.pending && !currentRead.error ? documentState.preflight : null) : documentState.preflight;
|
|
75
|
+
const sharedDocument = currentRead ? {
|
|
76
|
+
...documentState,
|
|
77
|
+
preflight,
|
|
78
|
+
preflightRead: currentRead.read,
|
|
79
|
+
preflightPending: currentRead.pending || documentState.preflightPending,
|
|
80
|
+
preflightError: !preflight ? currentRead.read?.message ?? null : null
|
|
81
|
+
} : documentState;
|
|
82
|
+
const placementFailed = preflight?.checks.some((check)=>!check.ok && check.code === 'no-placements' && check.detail !== undefined);
|
|
83
|
+
const lastPlacements = useRef(undefined);
|
|
84
|
+
if (preflight?.placements && !placementFailed) lastPlacements.current = {
|
|
85
|
+
key: placementKey,
|
|
86
|
+
value: preflight.placements
|
|
87
|
+
};
|
|
88
|
+
const placements = !placementFailed && !sharedDocument.preflightError && lastPlacements.current?.key === placementKey ? lastPlacements.current.value : undefined;
|
|
89
|
+
const editorPage = embedded ? currentPuckDocument(window.location.pathname, surface.adminRoute, placements) ?? surface.editorPage : surface.editorPage;
|
|
90
|
+
const message = editorPlacementMessage(placements, editorPage, documentState.doc?.status);
|
|
91
|
+
surface = {
|
|
92
|
+
...surface,
|
|
93
|
+
editorPage,
|
|
94
|
+
editorPlacementMessage: message
|
|
95
|
+
};
|
|
96
|
+
usePlacementNotice(surface.apiRoute, id, watching ? sharedDocument.preflightError ?? (placementFailed ? placementReadError(surface.apiRoute, id, surface.contentLocale) : message) : undefined, surface.contentLocale);
|
|
97
|
+
const setup = documentState.doc?.status === 'draft' || documentState.doc?.status === 'stopped';
|
|
98
|
+
const test = setup ? {
|
|
99
|
+
...sharedDocument,
|
|
100
|
+
preflight: editorPreflight(preflight, surface)
|
|
101
|
+
} : sharedDocument;
|
|
102
|
+
useEffect(()=>{
|
|
103
|
+
if (test.doc?.name) onTitleChange?.(test.doc.name);
|
|
104
|
+
}, [
|
|
105
|
+
test.doc?.name,
|
|
106
|
+
onTitleChange
|
|
107
|
+
]);
|
|
108
|
+
const frame = (body)=>{
|
|
109
|
+
const children = /*#__PURE__*/ _jsx("div", {
|
|
110
|
+
className: "xp-test-surface",
|
|
111
|
+
children: body
|
|
112
|
+
});
|
|
113
|
+
return renderFrame ? renderFrame({
|
|
114
|
+
test,
|
|
115
|
+
children
|
|
116
|
+
}) : children;
|
|
117
|
+
};
|
|
118
|
+
const detachedEdits = (test.detachedDrafts ?? []).map((key)=>{
|
|
119
|
+
const draft = test.fieldDrafts?.[key];
|
|
120
|
+
return draft && !draft.saving ? /*#__PURE__*/ _jsxs(Banner, {
|
|
121
|
+
tone: "warning",
|
|
122
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
123
|
+
onClick: ()=>test.trackDraft(key, null),
|
|
124
|
+
children: C.discardEdit
|
|
125
|
+
}),
|
|
126
|
+
children: [
|
|
127
|
+
C.detachedEdit(draft.label),
|
|
128
|
+
" ",
|
|
129
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
130
|
+
children: draft.value || C.emptyValue
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}, key) : null;
|
|
134
|
+
});
|
|
135
|
+
// Results readers have no permission to load the manager-only test/preflight.
|
|
136
|
+
if (!surface.canManage) return frame(/*#__PURE__*/ _jsx(ResultsBody, {
|
|
137
|
+
id: id,
|
|
138
|
+
surface: surface
|
|
139
|
+
}));
|
|
140
|
+
if (test.loadState !== 'ready' || !test.doc) return frame(/*#__PURE__*/ _jsxs("div", {
|
|
141
|
+
className: "xp-test-page",
|
|
142
|
+
role: test.loadState === 'error' ? 'alert' : 'status',
|
|
143
|
+
children: [
|
|
144
|
+
Object.entries(test.fieldDrafts ?? {}).map(([key, draft])=>/*#__PURE__*/ _jsxs(Banner, {
|
|
145
|
+
tone: "warning",
|
|
146
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
147
|
+
onClick: ()=>test.trackDraft(key, null),
|
|
148
|
+
children: C.discardEdit
|
|
149
|
+
}),
|
|
150
|
+
children: [
|
|
151
|
+
C.detachedEdit(draft.label),
|
|
152
|
+
" ",
|
|
153
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
154
|
+
children: draft.value || C.emptyValue
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}, key)),
|
|
158
|
+
/*#__PURE__*/ _jsx("p", {
|
|
159
|
+
children: test.preflightRead?.kind === 'signed-out' ? API_MESSAGES.unauthenticated : test.loadState === 'forbidden' ? C.forbidden : test.loadState === 'missing' ? C.missing : test.loadState === 'error' ? C.error : C.loading
|
|
160
|
+
}),
|
|
161
|
+
test.preflightRead?.retry ?? test.loadState === 'error' ? /*#__PURE__*/ _jsx(Button, {
|
|
162
|
+
onClick: ()=>void test.reload(),
|
|
163
|
+
children: C.retry
|
|
164
|
+
}) : null
|
|
165
|
+
]
|
|
166
|
+
}));
|
|
167
|
+
const parts = test.doc.kind === 'block' ? pageBlockParts : test.doc.kind === 'page' ? pageParts : settingParts;
|
|
168
|
+
const props = {
|
|
169
|
+
test,
|
|
170
|
+
surface
|
|
171
|
+
};
|
|
172
|
+
return frame(/*#__PURE__*/ _jsxs("div", {
|
|
173
|
+
className: "xp-test-page xp-test-page--setup",
|
|
174
|
+
style: {
|
|
175
|
+
paddingBottom: embedded || barHeight === undefined ? undefined : `${barHeight}px`
|
|
176
|
+
},
|
|
177
|
+
children: [
|
|
178
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
179
|
+
className: "xp-test-layout",
|
|
180
|
+
children: [
|
|
181
|
+
/*#__PURE__*/ _jsx(Rail, {
|
|
182
|
+
test: test
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
185
|
+
className: "xp-test-content",
|
|
186
|
+
children: [
|
|
187
|
+
test.errors._section ? /*#__PURE__*/ _jsxs(Banner, {
|
|
188
|
+
tone: "error",
|
|
189
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
190
|
+
onClick: ()=>void test.reload({
|
|
191
|
+
discardDrafts: true
|
|
192
|
+
}),
|
|
193
|
+
children: C.reload
|
|
194
|
+
}),
|
|
195
|
+
children: [
|
|
196
|
+
test.errors._section,
|
|
197
|
+
test.stale ? null : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
198
|
+
children: [
|
|
199
|
+
" ",
|
|
200
|
+
C.reloadAfterError
|
|
201
|
+
]
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}) : null,
|
|
205
|
+
detachedEdits,
|
|
206
|
+
/*#__PURE__*/ _jsxs(Section, {
|
|
207
|
+
surface: surface,
|
|
208
|
+
test: test,
|
|
209
|
+
sectionId: "what",
|
|
210
|
+
children: [
|
|
211
|
+
/*#__PURE__*/ _jsx(TestName, {
|
|
212
|
+
...props
|
|
213
|
+
}),
|
|
214
|
+
/*#__PURE__*/ _jsx(parts.Binding, {
|
|
215
|
+
...props
|
|
216
|
+
}),
|
|
217
|
+
/*#__PURE__*/ _jsx(Hypothesis, {
|
|
218
|
+
...props
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}),
|
|
222
|
+
/*#__PURE__*/ _jsx(VersionsSection, {
|
|
223
|
+
...props,
|
|
224
|
+
parts: parts,
|
|
225
|
+
contentOnCanvas: embedded
|
|
226
|
+
}),
|
|
227
|
+
/*#__PURE__*/ _jsx(GoalSection, {
|
|
228
|
+
...props,
|
|
229
|
+
embedded: embedded
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ _jsx(TargetingSection, {
|
|
232
|
+
...props
|
|
233
|
+
}),
|
|
234
|
+
/*#__PURE__*/ _jsx(LengthSection, {
|
|
235
|
+
...props
|
|
236
|
+
}),
|
|
237
|
+
/*#__PURE__*/ _jsx(AdvancedSection, {
|
|
238
|
+
...props
|
|
239
|
+
}),
|
|
240
|
+
!embedded ? /*#__PURE__*/ _jsx(DeleteTestAction, {
|
|
241
|
+
...props
|
|
242
|
+
}) : null,
|
|
243
|
+
embedded && surface.canReadResults && test.doc.status !== 'draft' ? /*#__PURE__*/ _jsx(ResultsBody, {
|
|
244
|
+
documentVersion: `${test.doc.phase}/${test.doc.status}`,
|
|
245
|
+
liveDocument: test.doc,
|
|
246
|
+
statusReadPending: test.statusReadPending,
|
|
247
|
+
id: id,
|
|
248
|
+
surface: surface,
|
|
249
|
+
onChanged: (transition)=>{
|
|
250
|
+
if (transition) test.acceptTransition?.(transition);
|
|
251
|
+
void test.reload();
|
|
252
|
+
}
|
|
253
|
+
}) : null
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
}),
|
|
258
|
+
/*#__PURE__*/ _jsx(ReadinessBar, {
|
|
259
|
+
...props,
|
|
260
|
+
embedded: embedded,
|
|
261
|
+
onHeightChange: setBarHeight
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
}));
|
|
265
|
+
}
|