@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
|
@@ -58,19 +58,22 @@ export declare const RESULTS_COPY: {
|
|
|
58
58
|
readonly infeasible: "A clear answer would take more than 90 days at this traffic.";
|
|
59
59
|
readonly noCap: "Not capped: fewer than 20 people had this outcome in the 90 days before Start, so every value counts in full.";
|
|
60
60
|
readonly quality: "Data quality";
|
|
61
|
-
readonly missingWinner: "The stored winner is missing from this round
|
|
61
|
+
readonly missingWinner: "The stored winner is missing from this round's results.";
|
|
62
62
|
readonly missingWinnerNext: "Recompute; if it persists, contact a developer before trusting these results.";
|
|
63
|
-
readonly srm: "Traffic isn't splitting as set.
|
|
63
|
+
readonly srm: "Traffic isn't splitting as set. Caching, a page placed twice, or automated traffic could affect the split.";
|
|
64
|
+
readonly srmAction: "Don't trust these results. Ask a developer to check for caching, a page placed twice, or automated traffic.";
|
|
64
65
|
readonly multiGroup: "People who saw more than one group were excluded.";
|
|
65
66
|
readonly multiGroupNext: "Check for caching or a page placed twice before trusting the results.";
|
|
66
67
|
readonly mismatch: "Beacons that didn't match the assigned group were ignored.";
|
|
67
68
|
readonly mismatchNext: "Check that the page reports the group it actually showed.";
|
|
69
|
+
readonly rapidBrowserEvents: "A larger share of visitors acted within seconds of arriving on one version than on another. One version may make it easier to act quickly, or some activity may be automated.";
|
|
70
|
+
readonly rapidBrowserEventsNext: "Check where the action appears in each version and ask your site team to review the traffic before choosing a winner.";
|
|
68
71
|
readonly identity: "Some linked identities were seen in different groups.";
|
|
69
72
|
readonly identityNext: "Check identity linking at sign-in and registration.";
|
|
70
73
|
readonly tooFew: "Too few people have seen the compared groups.";
|
|
71
74
|
readonly tooFewNext: "Keep collecting results until each compared group reaches the planned minimum.";
|
|
72
75
|
readonly layerFull: "The layer has fewer slices reserved than the requested allocation.";
|
|
73
|
-
readonly layerNext: "Free
|
|
76
|
+
readonly layerNext: "Free up room in the layer to include more people.";
|
|
74
77
|
readonly unavailable: {
|
|
75
78
|
'source-failed': string;
|
|
76
79
|
'source-unavailable': string;
|
|
@@ -58,19 +58,22 @@ export const RESULTS_COPY = {
|
|
|
58
58
|
infeasible: 'A clear answer would take more than 90 days at this traffic.',
|
|
59
59
|
noCap: 'Not capped: fewer than 20 people had this outcome in the 90 days before Start, so every value counts in full.',
|
|
60
60
|
quality: 'Data quality',
|
|
61
|
-
missingWinner:
|
|
61
|
+
missingWinner: "The stored winner is missing from this round's results.",
|
|
62
62
|
missingWinnerNext: 'Recompute; if it persists, contact a developer before trusting these results.',
|
|
63
|
-
srm: "Traffic isn't splitting as set.
|
|
63
|
+
srm: "Traffic isn't splitting as set. Caching, a page placed twice, or automated traffic could affect the split.",
|
|
64
|
+
srmAction: "Don't trust these results. Ask a developer to check for caching, a page placed twice, or automated traffic.",
|
|
64
65
|
multiGroup: 'People who saw more than one group were excluded.',
|
|
65
66
|
multiGroupNext: 'Check for caching or a page placed twice before trusting the results.',
|
|
66
67
|
mismatch: "Beacons that didn't match the assigned group were ignored.",
|
|
67
68
|
mismatchNext: 'Check that the page reports the group it actually showed.',
|
|
69
|
+
rapidBrowserEvents: 'A larger share of visitors acted within seconds of arriving on one version than on another. One version may make it easier to act quickly, or some activity may be automated.',
|
|
70
|
+
rapidBrowserEventsNext: 'Check where the action appears in each version and ask your site team to review the traffic before choosing a winner.',
|
|
68
71
|
identity: 'Some linked identities were seen in different groups.',
|
|
69
72
|
identityNext: 'Check identity linking at sign-in and registration.',
|
|
70
73
|
tooFew: 'Too few people have seen the compared groups.',
|
|
71
74
|
tooFewNext: 'Keep collecting results until each compared group reaches the planned minimum.',
|
|
72
75
|
layerFull: 'The layer has fewer slices reserved than the requested allocation.',
|
|
73
|
-
layerNext: 'Free
|
|
76
|
+
layerNext: 'Free up room in the layer to include more people.',
|
|
74
77
|
unavailable: {
|
|
75
78
|
'source-failed': "couldn't be read this time; the next results run will try again.",
|
|
76
79
|
'source-unavailable': "can't be read because its data source is no longer available. Ask a developer to check this goal.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const REVIEW_COPY: {
|
|
2
2
|
readonly noBaseline: "No data yet for this metric.";
|
|
3
3
|
readonly preview: "Preview";
|
|
4
|
-
readonly previewBlocked: "Your browser blocked the preview window. Allow pop-ups for this site
|
|
4
|
+
readonly previewBlocked: "Your browser blocked the preview window. Allow pop-ups for this site.";
|
|
5
5
|
readonly placedTimes: (n: number) => string;
|
|
6
6
|
readonly raise: "Raise allocation";
|
|
7
7
|
readonly addMetric: "Add a metric";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const REVIEW_COPY = {
|
|
2
2
|
noBaseline: 'No data yet for this metric.',
|
|
3
3
|
preview: 'Preview',
|
|
4
|
-
previewBlocked: 'Your browser blocked the preview window. Allow pop-ups for this site
|
|
4
|
+
previewBlocked: 'Your browser blocked the preview window. Allow pop-ups for this site.',
|
|
5
5
|
placedTimes: (n)=>`(placed ${n} times on this page)`,
|
|
6
6
|
raise: 'Raise allocation',
|
|
7
7
|
addMetric: 'Add a metric',
|
|
@@ -18,7 +18,15 @@ export declare const SURFACE_COPY: {
|
|
|
18
18
|
readonly retry: "Try again";
|
|
19
19
|
readonly empty: "Create a test to learn what works.";
|
|
20
20
|
readonly clear: "Clear";
|
|
21
|
-
readonly groups:
|
|
21
|
+
readonly groups: {
|
|
22
|
+
readonly attention: "Needs attention";
|
|
23
|
+
readonly running: "Running";
|
|
24
|
+
readonly ready: "Ready to start";
|
|
25
|
+
readonly draft: "Draft";
|
|
26
|
+
readonly stopped: "Stopped";
|
|
27
|
+
readonly decided: "Decided";
|
|
28
|
+
readonly archived: "Archived";
|
|
29
|
+
};
|
|
22
30
|
readonly kinds: {
|
|
23
31
|
readonly block: "Page block";
|
|
24
32
|
readonly flag: "Setting";
|
|
@@ -26,13 +34,14 @@ export declare const SURFACE_COPY: {
|
|
|
26
34
|
readonly page: "Whole page";
|
|
27
35
|
};
|
|
28
36
|
readonly ready: "Ready to start";
|
|
37
|
+
readonly readyAgain: "Ready to start a new round";
|
|
29
38
|
readonly next: "Review setup";
|
|
30
39
|
readonly continue: "Continue setup";
|
|
31
40
|
readonly results: "View results";
|
|
32
41
|
readonly open: "Open";
|
|
33
42
|
readonly health: {
|
|
34
43
|
readonly red: "Needs attention";
|
|
35
|
-
readonly amber: "
|
|
44
|
+
readonly amber: "Needs attention";
|
|
36
45
|
readonly green: "On track";
|
|
37
46
|
};
|
|
38
47
|
readonly backToSetup: "Back to setup";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { READINESS_COPY } from './readiness.js';
|
|
1
2
|
export const SURFACE_COPY = {
|
|
2
3
|
title: 'Tests',
|
|
3
4
|
test: 'Test',
|
|
@@ -18,14 +19,15 @@ export const SURFACE_COPY = {
|
|
|
18
19
|
retry: 'Try again',
|
|
19
20
|
empty: 'Create a test to learn what works.',
|
|
20
21
|
clear: 'Clear',
|
|
21
|
-
groups:
|
|
22
|
-
|
|
23
|
-
'Running',
|
|
24
|
-
'Ready to start',
|
|
25
|
-
'Draft',
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
|
|
22
|
+
groups: {
|
|
23
|
+
attention: READINESS_COPY.needsAttention,
|
|
24
|
+
running: 'Running',
|
|
25
|
+
ready: 'Ready to start',
|
|
26
|
+
draft: 'Draft',
|
|
27
|
+
stopped: 'Stopped',
|
|
28
|
+
decided: 'Decided',
|
|
29
|
+
archived: 'Archived'
|
|
30
|
+
},
|
|
29
31
|
kinds: {
|
|
30
32
|
block: 'Page block',
|
|
31
33
|
flag: 'Setting',
|
|
@@ -33,13 +35,14 @@ export const SURFACE_COPY = {
|
|
|
33
35
|
page: 'Whole page'
|
|
34
36
|
},
|
|
35
37
|
ready: 'Ready to start',
|
|
38
|
+
readyAgain: 'Ready to start a new round',
|
|
36
39
|
next: 'Review setup',
|
|
37
40
|
continue: 'Continue setup',
|
|
38
41
|
results: 'View results',
|
|
39
42
|
open: 'Open',
|
|
40
43
|
health: {
|
|
41
|
-
red:
|
|
42
|
-
amber:
|
|
44
|
+
red: READINESS_COPY.needsAttention,
|
|
45
|
+
amber: READINESS_COPY.needsAttention,
|
|
43
46
|
green: 'On track'
|
|
44
47
|
},
|
|
45
48
|
backToSetup: 'Back to setup'
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import type { ExperimentKind } from '../../types/contracts.js';
|
|
1
2
|
export declare const TEST_PAGE: {
|
|
3
|
+
readonly noAudienceRules: "No audience choices are available here. Everyone eligible takes part; leave this section as it is.";
|
|
4
|
+
readonly editVersionsOnCanvas: "Edit version content on the canvas.";
|
|
2
5
|
readonly clickPageGroup: "On this test's page";
|
|
3
|
-
readonly clickGoalsNote: "Goals inside linked documents aren't shown. Goals added in code (data-xp-goal) work but aren't listed here.";
|
|
4
6
|
readonly clickGoalHelp: "A click shows interest, not the result you want.";
|
|
5
|
-
readonly staleEdit: "
|
|
7
|
+
readonly staleEdit: "This test changed. Reload to see the latest settings and discard your unfinished edits.";
|
|
6
8
|
readonly reload: "Reload";
|
|
9
|
+
readonly reloadAfterError: "Reload to discard your unfinished edits and try again.";
|
|
10
|
+
readonly draftNotSaved: "Your edit is still unsaved.";
|
|
11
|
+
readonly conflictChoice: "Your edit is unsaved. Choose which value to keep. Saving your edit replaces the saved value shown below.";
|
|
12
|
+
readonly keepEdit: "Save my edit";
|
|
13
|
+
readonly retryEdit: "Try saving again";
|
|
14
|
+
readonly editInvalid: "Enter a valid value before saving.";
|
|
15
|
+
readonly detachedEdit: (field: string) => string;
|
|
16
|
+
readonly discardEdit: "Discard edit";
|
|
17
|
+
readonly savedValueChanged: "This field changed while you were editing.";
|
|
18
|
+
readonly savedValue: "Saved value";
|
|
19
|
+
readonly emptyValue: "(empty)";
|
|
20
|
+
readonly useSavedValue: "Use saved value";
|
|
7
21
|
readonly loading: "Loading test…";
|
|
8
22
|
readonly forbidden: "You don't have access to this test.";
|
|
9
23
|
readonly missing: "This test no longer exists.";
|
|
@@ -36,7 +50,7 @@ export declare const TEST_PAGE: {
|
|
|
36
50
|
};
|
|
37
51
|
readonly hypothesis: "Why are you testing this? (optional)";
|
|
38
52
|
readonly hypothesisPlaceholder: "We believe … will … because …";
|
|
39
|
-
readonly notPlaced: "
|
|
53
|
+
readonly notPlaced: "This test needs a block on a page. Add it to an Experiment block.";
|
|
40
54
|
readonly onPage: "On:";
|
|
41
55
|
readonly openPage: "Open the page";
|
|
42
56
|
readonly editedOnPage: "Versions are edited on the page.";
|
|
@@ -60,13 +74,17 @@ export declare const TEST_PAGE: {
|
|
|
60
74
|
readonly holdoutPrefix: "Holdout: ";
|
|
61
75
|
readonly allocation: "How many people take part";
|
|
62
76
|
readonly traffic: "How people are split";
|
|
77
|
+
readonly otherGoals: "Other goals (optional)";
|
|
78
|
+
readonly otherGoalsTitle: "Other goals";
|
|
79
|
+
readonly dontTrack: "Don't track";
|
|
80
|
+
readonly watch: "Watch";
|
|
81
|
+
readonly mustNotWorsen: "Must not get worse";
|
|
82
|
+
readonly otherGoalsHelp: "Watch: shown in results. Must not get worse: you're warned if a version makes it worse.";
|
|
63
83
|
readonly goal: "Goal";
|
|
64
|
-
readonly goalHelp: "The
|
|
65
|
-
readonly
|
|
66
|
-
readonly
|
|
67
|
-
readonly secondary: "Also keep an eye on (optional)";
|
|
84
|
+
readonly goalHelp: "The one thing you want more of. It decides the winner.";
|
|
85
|
+
readonly guardrailsShort: "Must not get worse";
|
|
86
|
+
readonly secondaryShort: "Also keep an eye on";
|
|
68
87
|
readonly manageGoals: "Manage goals";
|
|
69
|
-
readonly searchGoals: "Search goals";
|
|
70
88
|
readonly chooseGoal: "Choose a goal";
|
|
71
89
|
readonly goalsError: "Couldn't load goals. Try again.";
|
|
72
90
|
readonly noGoal: "None selected";
|
|
@@ -77,6 +95,7 @@ export declare const TEST_PAGE: {
|
|
|
77
95
|
readonly addRule: "Add a rule";
|
|
78
96
|
readonly removeRule: "Remove rule";
|
|
79
97
|
readonly blockPathRule: "This rule no longer applies to page block tests; remove it.";
|
|
98
|
+
readonly targetingValue: (attribute: string) => string;
|
|
80
99
|
readonly attribute: "Attribute";
|
|
81
100
|
readonly comparison: "Comparison";
|
|
82
101
|
readonly value: "Value";
|
|
@@ -102,3 +121,29 @@ export declare const NUMBER_COMPARISONS: {
|
|
|
102
121
|
readonly lte: "is at most";
|
|
103
122
|
};
|
|
104
123
|
export declare const placementCount: (count: number) => string;
|
|
124
|
+
export declare const DELETE_TEST: {
|
|
125
|
+
readonly blockWinner: (label: string) => string;
|
|
126
|
+
readonly currentSite: "This list reflects the site right now.";
|
|
127
|
+
readonly changedPages: (count: number) => string;
|
|
128
|
+
readonly unreadablePages: (count: number, total: number) => string;
|
|
129
|
+
readonly pageWinner: "These addresses will change where they send visitors:";
|
|
130
|
+
readonly content: "Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.";
|
|
131
|
+
readonly runningSteps: readonly ["Stop the test.", "Archive the test."];
|
|
132
|
+
readonly archiveFirst: "You can delete this test after it is archived.";
|
|
133
|
+
readonly close: "Close";
|
|
134
|
+
readonly labelWithCode: (label: string, code: string) => string;
|
|
135
|
+
readonly allLocales: "All languages";
|
|
136
|
+
readonly locales: (names: string) => string;
|
|
137
|
+
readonly action: "Delete test";
|
|
138
|
+
readonly cancel: "Cancel";
|
|
139
|
+
readonly deleted: "Test deleted.";
|
|
140
|
+
readonly title: (name: string) => string;
|
|
141
|
+
readonly consequences: "This permanently deletes the test and all its rounds and results. You can't undo this.";
|
|
142
|
+
readonly alreadyDeleted: "This test was already deleted.";
|
|
143
|
+
readonly checking: "Checking what visitors will see…";
|
|
144
|
+
readonly checkFailed: "Couldn't check what visitors will see after deletion. You can still choose to delete this test.";
|
|
145
|
+
readonly noEffect: "Deleting this test will not change what visitors see.";
|
|
146
|
+
readonly versionChange: (before: string, after: string) => string;
|
|
147
|
+
readonly morePages: (count: number) => string;
|
|
148
|
+
};
|
|
149
|
+
export declare function deleteStatusCopy(status: string, kind?: ExperimentKind): string;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { API_MESSAGES } from './common.js';
|
|
2
|
+
import { PLACEMENT_LANGUAGES } from './languages.js';
|
|
3
|
+
const guardrailsShort = 'Must not get worse';
|
|
4
|
+
const secondaryShort = 'Also keep an eye on';
|
|
5
|
+
export const TEST_PAGE = {
|
|
6
|
+
noAudienceRules: 'No audience choices are available here. Everyone eligible takes part; leave this section as it is.',
|
|
7
|
+
editVersionsOnCanvas: 'Edit version content on the canvas.',
|
|
8
|
+
clickPageGroup: "On this test's page",
|
|
9
|
+
clickGoalHelp: 'A click shows interest, not the result you want.',
|
|
10
|
+
staleEdit: 'This test changed. Reload to see the latest settings and discard your unfinished edits.',
|
|
11
|
+
reload: 'Reload',
|
|
12
|
+
reloadAfterError: 'Reload to discard your unfinished edits and try again.',
|
|
13
|
+
draftNotSaved: 'Your edit is still unsaved.',
|
|
14
|
+
conflictChoice: 'Your edit is unsaved. Choose which value to keep. Saving your edit replaces the saved value shown below.',
|
|
15
|
+
keepEdit: 'Save my edit',
|
|
16
|
+
retryEdit: 'Try saving again',
|
|
17
|
+
editInvalid: 'Enter a valid value before saving.',
|
|
18
|
+
detachedEdit: (field)=>`Your edit to “${field}” is still unsaved. Return to the field to finish it, or copy your edit and discard it here.`,
|
|
19
|
+
discardEdit: 'Discard edit',
|
|
20
|
+
savedValueChanged: 'This field changed while you were editing.',
|
|
21
|
+
savedValue: 'Saved value',
|
|
22
|
+
emptyValue: '(empty)',
|
|
23
|
+
useSavedValue: 'Use saved value',
|
|
24
|
+
loading: 'Loading test…',
|
|
25
|
+
forbidden: "You don't have access to this test.",
|
|
26
|
+
missing: 'This test no longer exists.',
|
|
27
|
+
error: "Couldn't load this test.",
|
|
28
|
+
retry: 'Try again',
|
|
29
|
+
name: 'Test name',
|
|
30
|
+
results: 'Results',
|
|
31
|
+
tests: 'Tests',
|
|
32
|
+
test: 'Test',
|
|
33
|
+
navigation: 'Sections',
|
|
34
|
+
completePrefix: 'Complete: ',
|
|
35
|
+
incompletePrefix: 'Incomplete: ',
|
|
36
|
+
complete: 'Complete',
|
|
37
|
+
incomplete: 'Incomplete',
|
|
38
|
+
completeMark: '✓',
|
|
39
|
+
incompleteMark: '○',
|
|
40
|
+
kinds: {
|
|
41
|
+
block: 'Page block',
|
|
42
|
+
page: 'Whole page',
|
|
43
|
+
flag: 'Setting',
|
|
44
|
+
code: 'Setting'
|
|
45
|
+
},
|
|
46
|
+
sections: {
|
|
47
|
+
what: "What you're testing",
|
|
48
|
+
versions: 'Versions',
|
|
49
|
+
win: 'What counts as a win',
|
|
50
|
+
who: 'Who takes part (optional)',
|
|
51
|
+
length: 'How long',
|
|
52
|
+
advanced: 'Advanced settings · for developers'
|
|
53
|
+
},
|
|
54
|
+
hypothesis: 'Why are you testing this? (optional)',
|
|
55
|
+
hypothesisPlaceholder: 'We believe … will … because …',
|
|
56
|
+
notPlaced: 'This test needs a block on a page. Add it to an Experiment block.',
|
|
57
|
+
onPage: 'On:',
|
|
58
|
+
openPage: 'Open the page',
|
|
59
|
+
editedOnPage: 'Versions are edited on the page.',
|
|
60
|
+
editOnPage: 'Edit on page',
|
|
61
|
+
empty: 'Empty',
|
|
62
|
+
pageReady: 'Page ready',
|
|
63
|
+
addPageAddress: 'Add a page address',
|
|
64
|
+
ready: 'Content ready',
|
|
65
|
+
emptySlot: 'Nothing in this slot yet',
|
|
66
|
+
pageBinding: 'Each version is a whole page at its own address.',
|
|
67
|
+
pageAddress: 'Page address',
|
|
68
|
+
holdoutContent: 'Sees the Original',
|
|
69
|
+
label: 'Version label',
|
|
70
|
+
weight: 'Share (%)',
|
|
71
|
+
balanceHelp: 'Changing a share balances the other versions so the total stays at 100%.',
|
|
72
|
+
addVersion: 'Add a version',
|
|
73
|
+
addHoldout: 'Add a holdout',
|
|
74
|
+
split: 'Split evenly',
|
|
75
|
+
remove: 'Remove version',
|
|
76
|
+
invalidShare: 'Use a whole number from 0 to 100.',
|
|
77
|
+
holdoutPrefix: 'Holdout: ',
|
|
78
|
+
allocation: 'How many people take part',
|
|
79
|
+
traffic: 'How people are split',
|
|
80
|
+
otherGoals: 'Other goals (optional)',
|
|
81
|
+
otherGoalsTitle: 'Other goals',
|
|
82
|
+
dontTrack: "Don't track",
|
|
83
|
+
watch: 'Watch',
|
|
84
|
+
mustNotWorsen: 'Must not get worse',
|
|
85
|
+
otherGoalsHelp: "Watch: shown in results. Must not get worse: you're warned if a version makes it worse.",
|
|
86
|
+
goal: 'Goal',
|
|
87
|
+
goalHelp: 'The one thing you want more of. It decides the winner.',
|
|
88
|
+
guardrailsShort,
|
|
89
|
+
secondaryShort,
|
|
90
|
+
manageGoals: 'Manage goals',
|
|
91
|
+
chooseGoal: 'Choose a goal',
|
|
92
|
+
goalsError: "Couldn't load goals. Try again.",
|
|
93
|
+
noGoal: 'None selected',
|
|
94
|
+
missingGoal: 'A goal that no longer exists',
|
|
95
|
+
goalUnavailable: 'Goal details unavailable',
|
|
96
|
+
everyone: 'Everyone on the pages where this appears.',
|
|
97
|
+
rulesSummary: 'Only people matching these rules.',
|
|
98
|
+
addRule: 'Add a rule',
|
|
99
|
+
removeRule: 'Remove rule',
|
|
100
|
+
blockPathRule: 'This rule no longer applies to page block tests; remove it.',
|
|
101
|
+
targetingValue: (attribute)=>`Value for ${attribute}`,
|
|
102
|
+
attribute: 'Attribute',
|
|
103
|
+
comparison: 'Comparison',
|
|
104
|
+
value: 'Value',
|
|
105
|
+
yes: 'Yes',
|
|
106
|
+
no: 'No',
|
|
107
|
+
reach: 'About how many people will see this per day?',
|
|
108
|
+
reachHelp: 'A rough number is fine. It only sets the suggested length.',
|
|
109
|
+
duration: 'Planned length (days)',
|
|
110
|
+
noSuggestion: 'Enter a daily number above to get a suggestion. 4 weeks is a safe default.',
|
|
111
|
+
chooseGoalSuggestion: 'Choose a goal to get a suggestion.',
|
|
112
|
+
required: '(required)',
|
|
113
|
+
apply: 'Apply',
|
|
114
|
+
infeasible: 'This may need more people than are available.'
|
|
115
|
+
};
|
|
116
|
+
export const suggestedWeeks = (weeks)=>`Suggested: about ${Math.round(weeks * 10) / 10} weeks`;
|
|
117
|
+
export const weeksHint = (days)=>`About ${Math.round(days / 7 * 10) / 10} weeks`;
|
|
118
|
+
export const NUMBER_COMPARISONS = {
|
|
119
|
+
eq: 'is',
|
|
120
|
+
neq: 'is not',
|
|
121
|
+
gt: 'is more than',
|
|
122
|
+
gte: 'is at least',
|
|
123
|
+
lt: 'is less than',
|
|
124
|
+
lte: 'is at most'
|
|
125
|
+
};
|
|
126
|
+
export const placementCount = (count)=>` (placed ${count} times)`;
|
|
127
|
+
export const DELETE_TEST = {
|
|
128
|
+
action: 'Delete test',
|
|
129
|
+
cancel: 'Cancel',
|
|
130
|
+
deleted: 'Test deleted.',
|
|
131
|
+
title: (name)=>`Delete “${name}”?`,
|
|
132
|
+
consequences: "This permanently deletes the test and all its rounds and results. You can't undo this.",
|
|
133
|
+
alreadyDeleted: 'This test was already deleted.',
|
|
134
|
+
checking: 'Checking what visitors will see…',
|
|
135
|
+
checkFailed: "Couldn't check what visitors will see after deletion. You can still choose to delete this test.",
|
|
136
|
+
noEffect: 'Deleting this test will not change what visitors see.',
|
|
137
|
+
versionChange: (before, after)=>`${before} → ${after}`,
|
|
138
|
+
morePages: (count)=>`${count} more ${count === 1 ? 'page' : 'pages'}.`,
|
|
139
|
+
...PLACEMENT_LANGUAGES,
|
|
140
|
+
blockWinner: (label)=>`On these pages, visitors will see ${label} again, or nothing where it is empty:`,
|
|
141
|
+
currentSite: 'This list reflects the site right now.',
|
|
142
|
+
changedPages: (count)=>`${count} ${count === 1 ? 'page' : 'pages'} will change`,
|
|
143
|
+
unreadablePages: (count, total)=>total === 1 ? "You can't open this page." : count === total ? "You can't open any of these pages." : `You can't open ${count} of these pages.`,
|
|
144
|
+
pageWinner: 'These addresses will change where they send visitors:',
|
|
145
|
+
content: 'Deleting the test does not delete your page content. An Experiment block that used this test stays on its page and says the test was deleted.',
|
|
146
|
+
runningSteps: [
|
|
147
|
+
'Stop the test.',
|
|
148
|
+
'Archive the test.'
|
|
149
|
+
],
|
|
150
|
+
archiveFirst: 'You can delete this test after it is archived.',
|
|
151
|
+
close: 'Close'
|
|
152
|
+
};
|
|
153
|
+
export function deleteStatusCopy(status, kind) {
|
|
154
|
+
switch(status){
|
|
155
|
+
case 'running':
|
|
156
|
+
return DELETE_TEST.archiveFirst;
|
|
157
|
+
case 'stopped':
|
|
158
|
+
return DELETE_TEST.archiveFirst;
|
|
159
|
+
case 'decided':
|
|
160
|
+
if (!kind) return `${DELETE_TEST.archiveFirst} Open the test to see the available archive options.`;
|
|
161
|
+
return `${DELETE_TEST.archiveFirst} Use the archive controls on the test.`;
|
|
162
|
+
default:
|
|
163
|
+
return API_MESSAGES.deleteInvalidStatus;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Path-only admin URLs, preserving Payload's root-route and trailing-slash behavior.
|
|
2
|
+
* Source: Payload 3.90.2 utilities/formatAdminURL.ts (MIT).
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatAdminURL({ adminRoute, path }: {
|
|
5
|
+
adminRoute: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
}): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Path-only admin URLs, preserving Payload's root-route and trailing-slash behavior.
|
|
2
|
+
* Source: Payload 3.90.2 utilities/formatAdminURL.ts (MIT).
|
|
3
|
+
*/ export function formatAdminURL({ adminRoute, path = '' }) {
|
|
4
|
+
const url = `${adminRoute === '/' ? '' : adminRoute.replace(/\/$/, '')}${path}` || '/';
|
|
5
|
+
if (process.env.NEXT_TRAILING_SLASH !== 'true') return url;
|
|
6
|
+
const index = url.search(/[?#]/);
|
|
7
|
+
const pathname = index === -1 ? url : url.slice(0, index);
|
|
8
|
+
return pathname.endsWith('/') ? url : `${pathname}/${index === -1 ? '' : url.slice(index)}`;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
type Placement = PreflightResult['placements'][number];
|
|
3
|
+
/** Shared row identity. Legacy previews and edit links omit publication state;
|
|
4
|
+
* Binding already showed it on single-language sites. */
|
|
5
|
+
export declare function placementLabel(placement: Placement, showState?: boolean, states?: string[]): string;
|
|
6
|
+
/** A shared editor link describes the union of its rows, retaining their first page title. */
|
|
7
|
+
export declare function placementGroupLabel(placements: readonly Placement[], configuredLanguages?: readonly string[]): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { placementLanguageSuffix } from './copy/languages.js';
|
|
2
|
+
/** Shared row identity. Legacy previews and edit links omit publication state;
|
|
3
|
+
* Binding already showed it on single-language sites. */ export function placementLabel(placement, showState = Boolean(placement.allLocales || placement.locales?.length), states = [
|
|
4
|
+
placement.detail === 'Published' ? 'Published' : 'Draft'
|
|
5
|
+
]) {
|
|
6
|
+
return `${placement.title}${showState ? ` (${states.join(', ')})` : ''}${placementLanguageSuffix(placement)}`;
|
|
7
|
+
}
|
|
8
|
+
/** A shared editor link describes the union of its rows, retaining their first page title. */ export function placementGroupLabel(placements, configuredLanguages) {
|
|
9
|
+
const first = placements[0];
|
|
10
|
+
const locales = [
|
|
11
|
+
...new Set(placements.flatMap((row)=>row.locales ?? []))
|
|
12
|
+
];
|
|
13
|
+
const allLocales = placements.some((row)=>row.allLocales) || Boolean(configuredLanguages?.length && configuredLanguages.every((name)=>locales.includes(name)));
|
|
14
|
+
const states = [
|
|
15
|
+
...new Set(placements.map((row)=>row.detail === 'Published' ? 'Published' : 'Draft'))
|
|
16
|
+
];
|
|
17
|
+
return placementLabel({
|
|
18
|
+
...first,
|
|
19
|
+
locales,
|
|
20
|
+
...allLocales ? {
|
|
21
|
+
allLocales: true
|
|
22
|
+
} : {}
|
|
23
|
+
}, true, states);
|
|
24
|
+
}
|
|
@@ -7,5 +7,7 @@ export declare function resolvedPlacementLabel(value: unknown, match: {
|
|
|
7
7
|
id?: DocId | null;
|
|
8
8
|
title?: string;
|
|
9
9
|
editorUrl?: string;
|
|
10
|
+
locales?: string[];
|
|
11
|
+
allLocales?: true;
|
|
10
12
|
} | undefined, adminRoute: string): PlacementLabel;
|
|
11
13
|
export declare function preflightPlacementLabel(value: unknown, preflight: PreflightResult, adminRoute: string): PlacementLabel;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { placementLanguageSuffix } from '../copy/languages.js';
|
|
2
|
+
import { formatAdminURL } from '../format/adminURL.js';
|
|
2
3
|
import { placementDetail } from './placementLabels.model.js';
|
|
3
4
|
export { placementDetailKey, placementDetail, fallbackPlacementLabel } from './placementLabels.model.js';
|
|
4
5
|
export function resolvedPlacementLabel(value, match, adminRoute) {
|
|
5
6
|
const detail = placementDetail(value);
|
|
6
7
|
const id = match?.id ?? detail.id;
|
|
7
8
|
return {
|
|
8
|
-
title: match?.title?.trim() || detail.path || 'This page'
|
|
9
|
+
title: `${match?.title?.trim() || detail.path || 'This page'}${placementLanguageSuffix(match ?? {})}`,
|
|
9
10
|
...id != null && detail.collection ? {
|
|
10
11
|
href: match?.editorUrl || formatAdminURL({
|
|
11
12
|
adminRoute,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
import { type PreviewPage } from '../lib/placementPages.js';
|
|
2
3
|
type Placement = PreflightResult['placements'][number];
|
|
3
|
-
type PreviewPage = Placement & {
|
|
4
|
-
key: string;
|
|
5
|
-
slotCount: number;
|
|
6
|
-
};
|
|
7
|
-
/** Preview URLs identify pages; counts use the most placements in any one version. */
|
|
8
|
-
export declare function previewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
9
4
|
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */
|
|
10
5
|
export declare function actionablePreviewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
11
6
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { placementPages } from '../lib/placementPages.js';
|
|
2
|
+
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */ export function actionablePreviewPages(placements, flagPoint) {
|
|
3
|
+
return placementPages(placements, flagPoint).filter((page)=>page.url || page.editorUrl);
|
|
4
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
export declare const PREFLIGHT_TIMEOUT_MS = 15000;
|
|
3
|
+
type DocumentVersion = NonNullable<PreflightResult['document']>;
|
|
4
|
+
export declare function statusOrRoundChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
|
|
5
|
+
export declare function documentChanged(answer: DocumentVersion | undefined, current: DocumentVersion): boolean;
|
|
6
|
+
/** The answer must support both readiness and placement consumers. */
|
|
7
|
+
export declare function isPreflightResult(value: unknown): value is PreflightResult;
|
|
8
|
+
/** Bound the response and body read, even when a producer ignores cancellation. */
|
|
9
|
+
export declare function readPreflight(request: (signal: AbortSignal) => Promise<Response>, signal: AbortSignal): Promise<{
|
|
10
|
+
response: Response;
|
|
11
|
+
body: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const PREFLIGHT_TIMEOUT_MS = 15_000;
|
|
2
|
+
export function statusOrRoundChanged(answer, current) {
|
|
3
|
+
return !!answer && (answer.status !== current.status || answer.phase !== undefined && answer.phase !== current.phase);
|
|
4
|
+
}
|
|
5
|
+
export function documentChanged(answer, current) {
|
|
6
|
+
return statusOrRoundChanged(answer, current) || answer?.updatedAt !== undefined && answer.updatedAt !== current.updatedAt;
|
|
7
|
+
}
|
|
8
|
+
/** The answer must support both readiness and placement consumers. */ export function isPreflightResult(value) {
|
|
9
|
+
const data = value;
|
|
10
|
+
return !!data && Array.isArray(data.placements) && Array.isArray(data.checks) && data.checks.every((check)=>check && typeof check.code === 'string' && typeof check.ok === 'boolean');
|
|
11
|
+
}
|
|
12
|
+
/** Bound the response and body read, even when a producer ignores cancellation. */ export async function readPreflight(request, signal) {
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
let timer;
|
|
15
|
+
let cancel;
|
|
16
|
+
const cancelled = new Promise((_, reject)=>{
|
|
17
|
+
cancel = ()=>{
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
controller.abort();
|
|
20
|
+
reject(new Error('Readiness read cancelled'));
|
|
21
|
+
};
|
|
22
|
+
timer = setTimeout(cancel, PREFLIGHT_TIMEOUT_MS);
|
|
23
|
+
});
|
|
24
|
+
signal.addEventListener('abort', cancel, {
|
|
25
|
+
once: true
|
|
26
|
+
});
|
|
27
|
+
if (signal.aborted) cancel();
|
|
28
|
+
try {
|
|
29
|
+
return await Promise.race([
|
|
30
|
+
cancelled,
|
|
31
|
+
(async ()=>{
|
|
32
|
+
const response = await request(controller.signal);
|
|
33
|
+
const body = await response.json().catch(()=>undefined);
|
|
34
|
+
return {
|
|
35
|
+
response,
|
|
36
|
+
body
|
|
37
|
+
};
|
|
38
|
+
})()
|
|
39
|
+
]);
|
|
40
|
+
} finally{
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
signal.removeEventListener('abort', cancel);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
import type { DocId } from '../types/contracts.js';
|
|
3
|
+
export type ReadinessRead = ReturnType<typeof classifyReadinessRead>;
|
|
4
|
+
/** One read policy for every surface. Pending retains this settled value verbatim. */
|
|
5
|
+
export declare function classifyReadinessRead(status: number, body?: unknown, failures?: number, context?: {
|
|
6
|
+
kind: 'document';
|
|
7
|
+
surface?: 'editor';
|
|
8
|
+
resultsOnly?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'readiness' | 'where-used';
|
|
11
|
+
placementNotice?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
status: number;
|
|
14
|
+
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
15
|
+
kind: string;
|
|
16
|
+
answer: PreflightResult | undefined;
|
|
17
|
+
message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
|
|
18
|
+
failed: boolean;
|
|
19
|
+
retry: boolean;
|
|
20
|
+
pollDelay: number | null;
|
|
21
|
+
};
|
|
22
|
+
/** Legacy callers can supply an answer; producers always supply the classified read. */
|
|
23
|
+
export declare function readinessRead(test: {
|
|
24
|
+
preflight: PreflightResult | null;
|
|
25
|
+
preflightError: string | null;
|
|
26
|
+
preflightRead?: ReadinessRead;
|
|
27
|
+
}): {
|
|
28
|
+
status: number;
|
|
29
|
+
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
30
|
+
kind: string;
|
|
31
|
+
answer: PreflightResult | undefined;
|
|
32
|
+
message: "Couldn't check where this test is used. Try again." | "You don't have permission to check where this test is used." | "A page used by this test no longer exists. Choose another page." | "This test's setup couldn't be checked." | "Couldn't check readiness. Try again." | "This test no longer exists." | "This isn't available yet." | "Your session has expired. Sign in again." | "Couldn't load this test. Try selecting it again." | "You don't have access to this test." | "Couldn't load this test." | "You don't have access to this test. You can still edit its content." | "This test isn't available to you. You can still edit its content." | "You can view this test's results." | undefined;
|
|
33
|
+
failed: boolean;
|
|
34
|
+
retry: boolean;
|
|
35
|
+
pollDelay: number | null;
|
|
36
|
+
};
|
|
37
|
+
/** Settled display is independent of a refresh in progress. */
|
|
38
|
+
export declare function readyToStart(test: {
|
|
39
|
+
preflight: PreflightResult | null;
|
|
40
|
+
preflightError: string | null;
|
|
41
|
+
preflightRead?: ReadinessRead;
|
|
42
|
+
}, placementMessage?: string): boolean;
|
|
43
|
+
/** A pending edit can change the selected goal before the next readiness response. */
|
|
44
|
+
export declare function hasBrowserWritablePrimary(preflight: PreflightResult | null, primary: DocId | null | undefined): boolean;
|
|
45
|
+
/** Pending changes only the ability to fire Start, never the settled display. */
|
|
46
|
+
export declare function canStartTest(test: {
|
|
47
|
+
preflight: PreflightResult | null;
|
|
48
|
+
preflightError: string | null;
|
|
49
|
+
preflightRead?: ReadinessRead;
|
|
50
|
+
preflightPending: boolean;
|
|
51
|
+
hasUnsaved: boolean;
|
|
52
|
+
saving: string;
|
|
53
|
+
}, placementMessage?: string): boolean;
|