@delmaredigital/payload-experiments 0.4.0-rc.7 → 0.4.0
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 +9 -15
- package/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +75 -29
- package/dist/admin/blocks/model.js +7 -6
- package/dist/admin/copy/blocks.d.ts +14 -11
- package/dist/admin/copy/blocks.js +33 -22
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +10 -7
- package/dist/admin/copy/newTest.js +14 -7
- package/dist/admin/copy/status.d.ts +1 -1
- package/dist/admin/copy/status.js +2 -1
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/placementStatus.model.js +5 -3
- package/dist/admin/status.model.d.ts +1 -0
- package/dist/admin/status.model.js +2 -1
- package/dist/admin/surface/ResultsRoute.js +12 -10
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +28 -3
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +4 -3
- package/dist/admin/surface/TestsHome.js +224 -52
- package/dist/admin/surface/TestsSurface.js +2 -1
- 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 +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -198
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +15 -8
- package/dist/admin/surface/home.model.js +22 -18
- package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
- package/dist/admin/surface/newTest/NewTest.js +156 -96
- package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
- package/dist/admin/surface/newTest/PageWizard.js +99 -68
- package/dist/admin/surface/newTest/newTest.css +28 -11
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +98 -66
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.js +46 -38
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/admin/views/buildSurfaceProps.js +18 -66
- package/dist/arms/copy.d.ts +13 -3
- package/dist/arms/copy.js +5 -4
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/experiments/config.js +8 -3
- 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 +12 -5
- 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/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/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/deleteImpact.js +2 -1
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +414 -0
- package/dist/endpoints/editorSurface.js +1 -1
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +22 -8
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +8 -4
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +9 -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 +4 -0
- package/dist/errors.js +6 -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/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/goals/fairness.js +2 -2
- package/dist/goals/picker/copy.js +1 -1
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.js +4 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/labels/arms.d.ts +3 -0
- package/dist/labels/arms.js +8 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/manifest/compile.js +8 -5
- package/dist/onInit.js +14 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +56 -2
- 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/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +40 -29
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +376 -139
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +6 -3
- package/dist/puck/editor/QuickTestActions.js +55 -33
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +28 -15
- package/dist/puck/editor/VersionBuilder.d.ts +17 -4
- package/dist/puck/editor/VersionBuilder.js +175 -112
- package/dist/puck/editor/armWrites.js +2 -2
- package/dist/puck/editor/armsCache.js +1 -3
- package/dist/puck/editor/copy.d.ts +14 -7
- package/dist/puck/editor/copy.js +26 -13
- package/dist/puck/editor/editor.chrome.css +10 -8
- package/dist/puck/editor/editor.css +15 -9
- package/dist/puck/editor/editor.model.d.ts +1 -0
- package/dist/puck/editor/placementsCache.d.ts +4 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/nestedTestCopy.js +2 -2
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- 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 +4 -4
- package/dist/results/verdict.js +15 -11
- 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 +20 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +11 -2
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +2 -5
- 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/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +10 -4
- package/dist/testSurface/actions/DecideDialog.js +93 -63
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
- package/dist/testSurface/actions/MakeContentResult.js +10 -2
- package/dist/testSurface/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +75 -22
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/api.d.ts +9 -6
- package/dist/testSurface/api.js +43 -23
- package/dist/testSurface/copy/actions.d.ts +37 -14
- package/dist/testSurface/copy/actions.js +40 -17
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +8 -6
- package/dist/testSurface/copy/common.js +8 -6
- package/dist/testSurface/copy/languages.d.ts +1 -0
- package/dist/testSurface/copy/languages.js +1 -0
- package/dist/testSurface/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +9 -0
- package/dist/testSurface/copy/pages.d.ts +67 -7
- package/dist/testSurface/copy/pages.js +74 -7
- package/dist/testSurface/copy/readiness.d.ts +20 -7
- package/dist/testSurface/copy/readiness.js +36 -10
- package/dist/testSurface/copy/recommendation.d.ts +1 -22
- package/dist/testSurface/copy/recommendation.js +2 -22
- package/dist/testSurface/copy/results.d.ts +21 -12
- package/dist/testSurface/copy/results.js +24 -13
- package/dist/testSurface/copy/review.d.ts +13 -10
- package/dist/testSurface/copy/review.js +14 -10
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.d.ts +11 -2
- package/dist/testSurface/copy/surface.js +14 -11
- package/dist/testSurface/copy/testPage.d.ts +36 -12
- package/dist/testSurface/copy/testPage.js +53 -16
- package/dist/testSurface/format/date.d.ts +5 -2
- package/dist/testSurface/format/date.js +24 -8
- package/dist/testSurface/format/roundProgress.d.ts +6 -0
- package/dist/testSurface/format/roundProgress.js +15 -0
- package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
- package/dist/testSurface/format/useDateFormatter.js +8 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/readPreflight.d.ts +4 -0
- package/dist/testSurface/readPreflight.js +6 -0
- package/dist/testSurface/readinessRead.d.ts +3 -0
- package/dist/testSurface/readinessRead.js +4 -0
- package/dist/testSurface/results/CiChart.js +2 -1
- package/dist/testSurface/results/DataTable.d.ts +1 -1
- package/dist/testSurface/results/DataTable.js +4 -3
- package/dist/testSurface/results/VerdictHero.d.ts +3 -2
- package/dist/testSurface/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/legacy.d.ts +0 -5
- package/dist/testSurface/results/legacy.js +0 -14
- package/dist/testSurface/results/results.css +2 -2
- package/dist/testSurface/results/results.model.d.ts +9 -4
- package/dist/testSurface/results/results.model.js +31 -23
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +13 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +3 -3
- package/dist/testSurface/surface/editorPlacement.js +2 -2
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +3 -3
- package/dist/testSurface/surface/pageBlock/parts.js +25 -12
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +300 -197
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +241 -230
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +113 -141
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +8 -4
- package/dist/testSurface/surface/readiness/SaveStatus.js +23 -22
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -6
- package/dist/testSurface/surface/readiness/readiness.model.js +168 -21
- package/dist/testSurface/surface/readiness/useTransition.d.ts +6 -4
- package/dist/testSurface/surface/readiness/useTransition.js +57 -14
- package/dist/testSurface/surface/results/ReleasePages.d.ts +6 -3
- package/dist/testSurface/surface/results/ReleasePages.js +42 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +11 -4
- package/dist/testSurface/surface/results/ResultsBody.js +221 -118
- package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
- package/dist/testSurface/surface/results/recommendation.model.js +15 -59
- package/dist/testSurface/surface/results/useResults.d.ts +13 -8
- package/dist/testSurface/surface/results/useResults.js +3 -2
- package/dist/testSurface/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +11 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +10 -2
- package/dist/testSurface/surface/test/DeleteTest.js +173 -74
- package/dist/testSurface/surface/test/GoalSection.js +18 -14
- package/dist/testSurface/surface/test/LengthSection.js +24 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +11 -8
- package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +82 -12
- package/dist/testSurface/surface/test/TestSurface.js +73 -37
- package/dist/testSurface/surface/test/VersionsSection.js +141 -91
- package/dist/testSurface/surface/test/fields.d.ts +32 -6
- package/dist/testSurface/surface/test/fields.js +166 -52
- package/dist/testSurface/surface/test/pageParts.js +27 -12
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
- package/dist/testSurface/surface/test/testPage.model.js +6 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
- package/dist/testSurface/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +21 -5
- package/dist/testSurface/surface/useTestDocument.js +472 -167
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/testSurface/useApi.d.ts +8 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.js +3 -1
- 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 +1 -0
- package/dist/transitions/checkStart.js +17 -6
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +5 -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 +12 -8
- package/dist/transitions/nestedPlacementNames.d.ts +2 -2
- package/dist/transitions/nestedPlacementNames.js +4 -5
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.d.ts +1 -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 +8 -7
- package/dist/transitions/placements.d.ts +2 -0
- package/dist/transitions/placements.js +5 -5
- package/dist/transitions/preflightData.d.ts +3 -2
- package/dist/transitions/preflightData.js +77 -43
- 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 +7 -9
- package/dist/transitions/start.js +75 -39
- 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/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +17 -4
- package/dist/types/endpoints.d.ts +89 -17
- package/dist/types/endpoints.js +1 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +21 -2
- package/dist/ui/Dialog.js +101 -4
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +5 -1
- package/package.json +2 -2
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { theme } from '../../theme.js';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
6
|
import { Select } from '../../../ui/Inputs.js';
|
|
7
|
-
import { RESULTS_COPY as C } from '../../copy/results.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { RESULTS_COPY as C, daysOfPlan, percentileCapHelp, revenueCapHelp } from '../../copy/results.js';
|
|
8
|
+
import { relativeTime } from '../../format/date.js';
|
|
9
|
+
import { roundProgress } from '../../format/roundProgress.js';
|
|
10
|
+
import { useDateFormatter } from '../../format/useDateFormatter.js';
|
|
11
|
+
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
12
|
+
import { LifecycleButton } from '../../actions/LifecycleAction.js';
|
|
13
|
+
import { percentileTail } from '../../copy/metrics.js';
|
|
11
14
|
import { API_MESSAGES } from '../../copy/common.js';
|
|
12
15
|
import { armLabel } from '../../labels.js';
|
|
13
16
|
import { PreviewLinks } from '../../PreviewLinks.js';
|
|
@@ -15,32 +18,37 @@ import { actionablePreviewPages } from '../../previewLinks.model.js';
|
|
|
15
18
|
import { VerdictHero } from '../../results/VerdictHero.js';
|
|
16
19
|
import { StatTile } from '../../results/StatTile.js';
|
|
17
20
|
import { DataTable, Swatch } from '../../results/DataTable.js';
|
|
18
|
-
import {
|
|
19
|
-
import { formatCount, formatPercent } from '../../results/format.js';
|
|
21
|
+
import { formatCount, formatCurrency, formatPercent } from '../../results/format.js';
|
|
20
22
|
import { DataQualityPanel } from '../../results/DataQualityPanel.js';
|
|
21
23
|
import { CiChart } from '../../results/CiChart.js';
|
|
22
|
-
import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, verdictCard } from '../../results/results.model.js';
|
|
24
|
+
import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, runningPlanLine, verdictCard } from '../../results/results.model.js';
|
|
25
|
+
import { hasMissingRolloutWinner } from '../../results/snapshot.js';
|
|
23
26
|
import { recommendation } from './recommendation.model.js';
|
|
24
27
|
import { useResults } from './useResults.js';
|
|
25
28
|
import { DecideDialog } from '../../actions/DecideDialog.js';
|
|
26
29
|
import { Banner } from '../../../ui/Banner.js';
|
|
27
|
-
import {
|
|
30
|
+
import { availableActions } from '../../actions/actions.model.js';
|
|
28
31
|
import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
|
|
29
32
|
import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
|
|
30
|
-
|
|
33
|
+
import { notifyTestDocument } from '../watchTestDocument.js';
|
|
34
|
+
export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
|
|
31
35
|
// A different test owns an independent selection and action lifecycle.
|
|
32
36
|
return /*#__PURE__*/ _jsx(ResultsContent, {
|
|
33
37
|
id: id,
|
|
34
38
|
surface: surface,
|
|
35
39
|
onRecomputed: onRecomputed,
|
|
36
|
-
onPagesReleased: onPagesReleased,
|
|
37
40
|
renderPage: renderPage,
|
|
38
|
-
onChanged: onChanged
|
|
41
|
+
onChanged: onChanged,
|
|
42
|
+
documentVersion: documentVersion,
|
|
43
|
+
liveDocument: liveDocument,
|
|
44
|
+
statusReadPending: statusReadPending
|
|
39
45
|
}, `${surface.apiRoute}/${id}`);
|
|
40
46
|
}
|
|
41
|
-
function ResultsContent({ id, surface, onRecomputed,
|
|
42
|
-
const
|
|
47
|
+
function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
|
|
48
|
+
const formatDate = useDateFormatter();
|
|
49
|
+
const results = useResults(id, surface, documentVersion);
|
|
43
50
|
const { api, doc, round, phases, state, data } = results;
|
|
51
|
+
const managerDoc = liveDocument ?? doc;
|
|
44
52
|
const manage = surface.canManage && surface.canReadResults;
|
|
45
53
|
const [placements, setPlacements] = useState(null);
|
|
46
54
|
const [checks, setChecks] = useState([]);
|
|
@@ -50,8 +58,9 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
50
58
|
const inFlight = useRef(false);
|
|
51
59
|
const mounted = useRef(true);
|
|
52
60
|
const [actionError, setActionError] = useState(null);
|
|
53
|
-
const [deciding, setDeciding] = useState(
|
|
54
|
-
const
|
|
61
|
+
const [deciding, setDeciding] = useState(null);
|
|
62
|
+
const previewId = useId();
|
|
63
|
+
const [releasing, setReleasing] = useState(null);
|
|
55
64
|
useEffect(()=>{
|
|
56
65
|
mounted.current = true;
|
|
57
66
|
return ()=>{
|
|
@@ -91,12 +100,13 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
91
100
|
results.reload();
|
|
92
101
|
onRecomputed?.();
|
|
93
102
|
} else setActionError(result.message);
|
|
103
|
+
onChanged?.();
|
|
94
104
|
} finally{
|
|
95
105
|
inFlight.current = false;
|
|
96
106
|
if (mounted.current) setBusy(false);
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
|
-
const phase =
|
|
109
|
+
const phase = phases.find((phase)=>phase.phase === round);
|
|
100
110
|
const snapshot = data?.snapshot;
|
|
101
111
|
const newestRound = defaultRound({
|
|
102
112
|
phases,
|
|
@@ -104,18 +114,24 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
104
114
|
});
|
|
105
115
|
const latestPhase = phases.find((phase)=>phase.phase === newestRound);
|
|
106
116
|
const decision = data?.decision ?? doc?.decision;
|
|
107
|
-
const status =
|
|
117
|
+
const status = managerDoc?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
|
|
108
118
|
// ADM-06b: an older round never inherits the live test's running status.
|
|
109
|
-
const lineStatus = status === 'running' && round === newestRound ? 'running' : 'stopped';
|
|
119
|
+
const lineStatus = !statusReadPending && status === 'running' && round === newestRound ? 'running' : 'stopped';
|
|
110
120
|
const isDecidedTestRound = status === 'decided' && phase?.phaseKind === 'test' && decision?.phase === round;
|
|
111
121
|
const showingDecision = isDecidedTestRound && Boolean(data?.decisionSnapshot);
|
|
112
122
|
const shown = showingDecision ? data.decisionSnapshot : snapshot;
|
|
113
123
|
const winner = phase?.arms.find((arm)=>arm.key === decision?.winnerArm)?.label ?? armLabel(decision?.winnerArm ?? 'control');
|
|
124
|
+
const control = phase?.arms.find((arm)=>arm.kind === 'control') ?? phases.find((item)=>item.phase === decision?.phase)?.arms.find((arm)=>arm.kind === 'control');
|
|
125
|
+
const planned = phase?.plannedDurationDays ?? (phase?.phaseKind === 'test' && lineStatus === 'running' ? managerDoc?.analysis?.plannedDurationDays : undefined);
|
|
126
|
+
const progress = roundProgress(phase?.startedAt ?? shown?.window.from, planned, lineStatus === 'running' ? Date.now() : Date.parse(shown?.window.to ?? ''));
|
|
127
|
+
const planLine = shown && lineStatus === 'running' ? runningPlanLine(shown, progress, formatDate) : null;
|
|
114
128
|
const card = shown ? verdictCard({
|
|
115
129
|
snapshot: shown,
|
|
116
130
|
decisionSnapshot: data?.decisionSnapshot,
|
|
117
131
|
isDecidedTestRound,
|
|
118
|
-
winnerLabel: winner
|
|
132
|
+
winnerLabel: winner,
|
|
133
|
+
controlLabel: control?.label,
|
|
134
|
+
keepRunningAction: planLine
|
|
119
135
|
}) : null;
|
|
120
136
|
const placementLabels = usePlacementLabels({
|
|
121
137
|
details: shown?.health?.filter((item)=>item.code === 'placement-unchecked').map((item)=>item.detail) ?? [],
|
|
@@ -132,75 +148,128 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
132
148
|
allocation: doc?.allocation,
|
|
133
149
|
placementLabels
|
|
134
150
|
};
|
|
151
|
+
// A late browser-activity warning can reach the same round after a decision.
|
|
152
|
+
const latestActivity = showingDecision && snapshot && shown && snapshot.phase === shown.phase ? snapshot.health?.find((item)=>item.code === 'rapid-browser-events') : undefined;
|
|
153
|
+
const qualitySnapshot = shown && latestActivity && !shown.health?.some((item)=>item.code === latestActivity.code) ? {
|
|
154
|
+
...shown,
|
|
155
|
+
health: [
|
|
156
|
+
...shown.health ?? [],
|
|
157
|
+
latestActivity
|
|
158
|
+
]
|
|
159
|
+
} : shown;
|
|
160
|
+
const qualityItems = phase && qualitySnapshot ? dataQuality(qualitySnapshot, context) : [];
|
|
135
161
|
const primary = phase?.metrics.find((metric)=>metric.role === 'primary');
|
|
136
162
|
// The endpoint decides the current round; historical rounds are read-only.
|
|
137
|
-
const
|
|
138
|
-
|
|
163
|
+
const lifecycle = managerDoc || data ? availableActions({
|
|
164
|
+
...managerDoc,
|
|
165
|
+
status,
|
|
166
|
+
kind: managerDoc?.kind ?? 'block',
|
|
167
|
+
decision: managerDoc?.decision,
|
|
168
|
+
canManage: surface.canManage,
|
|
169
|
+
canReadResults: surface.canReadResults
|
|
170
|
+
}) : [];
|
|
171
|
+
const decisionRound = phase?.phaseKind === 'test' && round === newestRound && (liveDocument?.phase == null || liveDocument.phase === round) ? phase : !phases.length && liveDocument?.phase != null ? {
|
|
172
|
+
phase: liveDocument.phase
|
|
173
|
+
} : null;
|
|
174
|
+
const canRelease = lifecycle.some((action)=>action.id === 'release-pages');
|
|
175
|
+
function refreshDocument(transition) {
|
|
176
|
+
if (transition && !onChanged) notifyTestDocument(surface.apiRoute, id);
|
|
177
|
+
results.reload();
|
|
178
|
+
onChanged?.(transition);
|
|
179
|
+
}
|
|
180
|
+
const roundActions = {};
|
|
181
|
+
for (const action of lifecycle){
|
|
182
|
+
if (statusReadPending) break;
|
|
183
|
+
if (action.id === 'decide' && (decisionRound || state !== 'loading')) roundActions.decide = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
184
|
+
action: action,
|
|
185
|
+
reason: decisionRound ? undefined : C.previousRound,
|
|
186
|
+
disabled: busy || !!releasing,
|
|
187
|
+
onClick: ()=>{
|
|
188
|
+
if (decisionRound) setDeciding({
|
|
189
|
+
...decisionRound,
|
|
190
|
+
results: data && round === decisionRound.phase && 'arms' in decisionRound && (state === 'ready' || state === 'empty') ? data : undefined
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
if (action.id === 'release-pages') roundActions['release-pages'] = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
195
|
+
action: action,
|
|
196
|
+
disabled: busy || !!deciding,
|
|
197
|
+
onClick: ()=>{
|
|
198
|
+
setActionError(null);
|
|
199
|
+
setReleasing({
|
|
200
|
+
phase: managerDoc?.phase
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const pages = manage && placements ? actionablePreviewPages(placements, doc?.flagPoint) : [];
|
|
206
|
+
const editorUrls = [
|
|
207
|
+
...new Set(pages.flatMap((page)=>page.editorUrl ? [
|
|
208
|
+
page.editorUrl
|
|
209
|
+
] : []))
|
|
210
|
+
];
|
|
211
|
+
const editOnPage = editorUrls.length ? /*#__PURE__*/ _jsx(Button, {
|
|
212
|
+
size: "sm",
|
|
213
|
+
href: editorUrls.length === 1 ? editorUrls[0] : `#${previewId}`,
|
|
214
|
+
children: TEST_PAGE.editOnPage
|
|
215
|
+
}) : null;
|
|
216
|
+
// A decided round displays the frozen snapshot used for the decision.
|
|
217
|
+
const refresh = manage && !showingDecision ? /*#__PURE__*/ _jsxs("div", {
|
|
218
|
+
className: "xp-results-refresh",
|
|
139
219
|
children: [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}) : null,
|
|
145
|
-
manage && doc && canReleasePages(doc) ? /*#__PURE__*/ _jsx(Button, {
|
|
146
|
-
variant: "secondary",
|
|
147
|
-
disabled: busy || deciding || releasing,
|
|
220
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
221
|
+
size: "sm",
|
|
222
|
+
busy: busy,
|
|
223
|
+
disabled: !!deciding || !!releasing,
|
|
148
224
|
onClick: ()=>{
|
|
149
|
-
|
|
150
|
-
setReleasing(true);
|
|
225
|
+
void recompute();
|
|
151
226
|
},
|
|
152
|
-
children: C.
|
|
227
|
+
children: busy ? C.recomputing : C.recompute
|
|
228
|
+
}),
|
|
229
|
+
snapshot?.computedAt ? /*#__PURE__*/ _jsx("span", {
|
|
230
|
+
className: "xp-ui-help",
|
|
231
|
+
children: C.updated(relativeTime(snapshot.computedAt, undefined, formatDate))
|
|
153
232
|
}) : null
|
|
154
233
|
]
|
|
155
|
-
});
|
|
234
|
+
}) : null;
|
|
156
235
|
// Release details come only from the manager's own document, never the results response.
|
|
157
|
-
const
|
|
158
|
-
|
|
236
|
+
const releaseDecision = managerDoc?.decision;
|
|
237
|
+
const released = manage && releaseDecision?.pagesReleasedAt ? /*#__PURE__*/ _jsx(PagesReleased, {
|
|
238
|
+
decision: releaseDecision,
|
|
159
239
|
apiRoute: surface.apiRoute,
|
|
160
240
|
userId: surface.userId,
|
|
161
241
|
userCollection: surface.userCollection
|
|
162
242
|
}) : null;
|
|
163
|
-
const meta = /*#__PURE__*/
|
|
164
|
-
children:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}),
|
|
194
|
-
manage && !showingDecision ? /*#__PURE__*/ _jsx(Button, {
|
|
195
|
-
variant: "quiet",
|
|
196
|
-
size: "sm",
|
|
197
|
-
disabled: busy || deciding || releasing,
|
|
198
|
-
onClick: ()=>{
|
|
199
|
-
void recompute();
|
|
200
|
-
},
|
|
201
|
-
children: busy ? C.recomputing : C.recompute
|
|
202
|
-
}) : null
|
|
203
|
-
]
|
|
243
|
+
const meta = /*#__PURE__*/ _jsx(_Fragment, {
|
|
244
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
245
|
+
className: "xp-round-meta",
|
|
246
|
+
children: [
|
|
247
|
+
phases.length > 0 ? /*#__PURE__*/ _jsx(Select, {
|
|
248
|
+
id: "xp-results-round",
|
|
249
|
+
label: C.round,
|
|
250
|
+
disabled: !!deciding || !!releasing,
|
|
251
|
+
value: round ?? '',
|
|
252
|
+
onChange: (event)=>results.setRound(Number(event.target.value)),
|
|
253
|
+
children: roundOptions(phases).map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
254
|
+
value: option.value,
|
|
255
|
+
children: option.label
|
|
256
|
+
}, option.value))
|
|
257
|
+
}) : null,
|
|
258
|
+
manage && shown ? /*#__PURE__*/ _jsxs("span", {
|
|
259
|
+
children: [
|
|
260
|
+
"· ",
|
|
261
|
+
C.methods[shown.method]
|
|
262
|
+
]
|
|
263
|
+
}) : null,
|
|
264
|
+
showingDecision ? /*#__PURE__*/ _jsxs("span", {
|
|
265
|
+
className: "xp-results-as-of",
|
|
266
|
+
children: [
|
|
267
|
+
manage ? '· ' : '',
|
|
268
|
+
C.asOfDecision(formatDate(data.decisionSnapshot.computedAt))
|
|
269
|
+
]
|
|
270
|
+
}) : null
|
|
271
|
+
]
|
|
272
|
+
})
|
|
204
273
|
});
|
|
205
274
|
const leader = shown?.verdict.recommendedArm;
|
|
206
275
|
const leadingComparison = shown?.metrics.find((metric)=>metric.role === 'primary')?.comparisons.find((item)=>item.arm === leader);
|
|
@@ -208,8 +277,6 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
208
277
|
'collecting',
|
|
209
278
|
'rollout-collecting'
|
|
210
279
|
].includes(shown.verdict.code) ? leadingComparison?.chanceToWin : undefined;
|
|
211
|
-
const days = shown ? Math.max(0, Math.floor((Date.parse(shown.window.to) - Date.parse(phase?.startedAt ?? shown.window.from)) / 86400000)) : undefined;
|
|
212
|
-
const planned = doc?.analysis?.plannedDurationDays;
|
|
213
280
|
const content = /*#__PURE__*/ _jsxs("div", {
|
|
214
281
|
className: "xp-results",
|
|
215
282
|
style: {
|
|
@@ -222,9 +289,13 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
222
289
|
}) : null,
|
|
223
290
|
!renderPage ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
224
291
|
children: [
|
|
225
|
-
/*#__PURE__*/
|
|
292
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
226
293
|
className: "xp-ui-button-group",
|
|
227
|
-
children:
|
|
294
|
+
children: [
|
|
295
|
+
editOnPage,
|
|
296
|
+
refresh,
|
|
297
|
+
Object.values(roundActions)
|
|
298
|
+
]
|
|
228
299
|
}),
|
|
229
300
|
released
|
|
230
301
|
]
|
|
@@ -259,19 +330,20 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
259
330
|
snapshot: shown,
|
|
260
331
|
phase,
|
|
261
332
|
status: lineStatus,
|
|
262
|
-
|
|
333
|
+
isDecidedTestRound
|
|
263
334
|
}),
|
|
264
335
|
guardrails: guardrailChips(shown),
|
|
265
336
|
power: powerLine({
|
|
266
337
|
snapshot: shown,
|
|
267
338
|
phaseKind: phase.phaseKind,
|
|
268
339
|
status: lineStatus
|
|
269
|
-
}),
|
|
340
|
+
}, planLine),
|
|
270
341
|
collecting: collectingLine({
|
|
271
342
|
snapshot: shown,
|
|
272
343
|
phaseKind: phase.phaseKind,
|
|
273
344
|
status: lineStatus
|
|
274
345
|
}, context),
|
|
346
|
+
browserWritablePrimary: primary?.browserWritable || primary?.clickGoal,
|
|
275
347
|
sinceShipping: rolloutLine(shown, phase, phases, decision ?? undefined)
|
|
276
348
|
}),
|
|
277
349
|
primary?.clickGoal ? /*#__PURE__*/ _jsx("p", {
|
|
@@ -286,9 +358,9 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
286
358
|
}),
|
|
287
359
|
/*#__PURE__*/ _jsx(StatTile, {
|
|
288
360
|
label: C.days,
|
|
289
|
-
value:
|
|
361
|
+
value: progress.plannedDays === null ? formatCount(progress.day) : daysOfPlan(formatCount(progress.day), formatCount(progress.plannedDays))
|
|
290
362
|
}),
|
|
291
|
-
/*#__PURE__*/ _jsx(StatTile, {
|
|
363
|
+
shown.method === 'bayesian' ? /*#__PURE__*/ _jsx(StatTile, {
|
|
292
364
|
label: C.chanceToWin,
|
|
293
365
|
value: formatPercent(chance),
|
|
294
366
|
detail: chance != null && leader ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -299,7 +371,7 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
299
371
|
phase.arms.find((arm)=>arm.key === leader)?.label ?? armLabel(leader)
|
|
300
372
|
]
|
|
301
373
|
}) : undefined
|
|
302
|
-
})
|
|
374
|
+
}) : null
|
|
303
375
|
]
|
|
304
376
|
}),
|
|
305
377
|
phase.metrics.filter((metric)=>metric.role === 'primary').map((metric)=>/*#__PURE__*/ _jsx(MetricTable, {
|
|
@@ -326,10 +398,10 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
326
398
|
shown.goalFairnessNotice ? /*#__PURE__*/ _jsx("p", {
|
|
327
399
|
children: shown.goalFairnessNotice
|
|
328
400
|
}) : null,
|
|
329
|
-
/*#__PURE__*/ _jsx(DataQualityPanel, {
|
|
401
|
+
qualityItems.length > 0 || !hasMissingRolloutWinner(shown) ? /*#__PURE__*/ _jsx(DataQualityPanel, {
|
|
330
402
|
problem: shown.verdict.code === 'data-problem',
|
|
331
|
-
items:
|
|
332
|
-
}),
|
|
403
|
+
items: qualityItems
|
|
404
|
+
}) : null,
|
|
333
405
|
[
|
|
334
406
|
'guardrail',
|
|
335
407
|
'secondary'
|
|
@@ -347,7 +419,8 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
347
419
|
}) : null
|
|
348
420
|
]
|
|
349
421
|
}),
|
|
350
|
-
|
|
422
|
+
placements && pages.length > 0 && (editorUrls.length !== 1 || pages.some((page)=>page.url)) ? /*#__PURE__*/ _jsxs("section", {
|
|
423
|
+
id: previewId,
|
|
351
424
|
className: "xp-results-block",
|
|
352
425
|
children: [
|
|
353
426
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -357,6 +430,7 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
357
430
|
})
|
|
358
431
|
}),
|
|
359
432
|
/*#__PURE__*/ _jsx(PreviewLinks, {
|
|
433
|
+
showEditLinks: editorUrls.length !== 1 || !renderPage,
|
|
360
434
|
apiRoute: surface.apiRoute,
|
|
361
435
|
experimentId: id,
|
|
362
436
|
flagPoint: doc?.flagPoint,
|
|
@@ -377,38 +451,60 @@ function ResultsContent({ id, surface, onRecomputed, onPagesReleased, renderPage
|
|
|
377
451
|
})
|
|
378
452
|
]
|
|
379
453
|
}) : null,
|
|
380
|
-
|
|
454
|
+
releasing ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
|
|
455
|
+
id: id,
|
|
456
|
+
name: managerDoc?.name,
|
|
457
|
+
disabled: statusReadPending || !canRelease || managerDoc?.phase !== releasing.phase,
|
|
458
|
+
phase: releasing.phase,
|
|
459
|
+
apiRoute: surface.apiRoute,
|
|
460
|
+
onClose: ()=>setReleasing(null),
|
|
461
|
+
onRefusal: (status)=>{
|
|
462
|
+
if ([
|
|
463
|
+
401,
|
|
464
|
+
403,
|
|
465
|
+
404,
|
|
466
|
+
409,
|
|
467
|
+
422
|
|
468
|
+
].includes(status)) refreshDocument();
|
|
469
|
+
},
|
|
470
|
+
onSuccess: (doc)=>refreshDocument({
|
|
471
|
+
doc
|
|
472
|
+
})
|
|
473
|
+
}) : null
|
|
474
|
+
]
|
|
475
|
+
});
|
|
476
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
477
|
+
className: "xp-test-surface",
|
|
478
|
+
children: [
|
|
479
|
+
renderPage ? renderPage({
|
|
480
|
+
children: content,
|
|
481
|
+
roundActions,
|
|
482
|
+
editOnPage,
|
|
483
|
+
refresh,
|
|
484
|
+
released,
|
|
485
|
+
data
|
|
486
|
+
}) : content,
|
|
487
|
+
deciding && manage ? /*#__PURE__*/ _jsx(DecideDialog, {
|
|
381
488
|
apiRoute: surface.apiRoute,
|
|
382
489
|
id: id,
|
|
383
|
-
|
|
490
|
+
name: managerDoc?.name ?? data?.experiment?.name,
|
|
491
|
+
phase: deciding.phase,
|
|
492
|
+
arms: deciding.arms,
|
|
493
|
+
results: deciding.results,
|
|
384
494
|
checks: checks,
|
|
385
|
-
|
|
495
|
+
pending: statusReadPending,
|
|
496
|
+
unavailable: !lifecycle.some((action)=>action.id === 'decide') || liveDocument?.phase != null && liveDocument.phase !== deciding.phase,
|
|
497
|
+
onClose: ()=>setDeciding(null),
|
|
498
|
+
onRefusal: ()=>refreshDocument(),
|
|
386
499
|
onSuccess: onChanged ? (doc)=>{
|
|
387
|
-
setDeciding(
|
|
388
|
-
|
|
500
|
+
setDeciding(null);
|
|
501
|
+
refreshDocument({
|
|
502
|
+
doc
|
|
503
|
+
});
|
|
389
504
|
} : undefined
|
|
390
|
-
}) : null,
|
|
391
|
-
releasing && manage ? /*#__PURE__*/ _jsx(ReleasePagesDialog, {
|
|
392
|
-
id: id,
|
|
393
|
-
apiRoute: surface.apiRoute,
|
|
394
|
-
onClose: ()=>setReleasing(false),
|
|
395
|
-
onRefusal: setActionError,
|
|
396
|
-
onSuccess: ()=>{
|
|
397
|
-
results.reload();
|
|
398
|
-
onPagesReleased?.();
|
|
399
|
-
}
|
|
400
505
|
}) : null
|
|
401
506
|
]
|
|
402
507
|
});
|
|
403
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
404
|
-
className: "xp-test-surface",
|
|
405
|
-
children: renderPage ? renderPage({
|
|
406
|
-
children: content,
|
|
407
|
-
actions,
|
|
408
|
-
released,
|
|
409
|
-
data
|
|
410
|
-
}) : content
|
|
411
|
-
});
|
|
412
508
|
}
|
|
413
509
|
function MetricTable({ metric, snapshot, phase, leader }) {
|
|
414
510
|
const rows = armRows({
|
|
@@ -420,6 +516,15 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
420
516
|
const notices = [
|
|
421
517
|
...new Set(rows.map((row)=>row.capped.notice).filter(Boolean))
|
|
422
518
|
];
|
|
519
|
+
if (metric.kind === 'revenue' && !notices.length) {
|
|
520
|
+
const cap = snapshot.params.caps[metric.metricId];
|
|
521
|
+
if (cap?.resolvedCap === null || !cap && metric.capNotice === 'no-history') notices.push(C.noCap);
|
|
522
|
+
else if (cap?.type === 'percentile') notices.push(percentileCapHelp(percentileTail(cap.value)));
|
|
523
|
+
else {
|
|
524
|
+
const threshold = cap?.value ?? metric.resolvedCap;
|
|
525
|
+
if (threshold != null) notices.push(revenueCapHelp(formatCurrency(threshold)));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
423
528
|
return /*#__PURE__*/ _jsxs("section", {
|
|
424
529
|
className: "xp-results-block",
|
|
425
530
|
children: [
|
|
@@ -453,12 +558,10 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
453
558
|
primary: metric.role === 'primary',
|
|
454
559
|
leader: leader
|
|
455
560
|
}),
|
|
456
|
-
|
|
457
|
-
METRICS_COPY.revenueHint
|
|
458
|
-
]).map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
561
|
+
notices.map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
459
562
|
className: "xp-results-cap-help",
|
|
460
563
|
children: notice
|
|
461
|
-
}, notice))
|
|
564
|
+
}, notice))
|
|
462
565
|
]
|
|
463
566
|
});
|
|
464
567
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { PhaseSummary } from '../../../types/endpoints.js';
|
|
2
2
|
import type { Status } from '../../../types/contracts.js';
|
|
3
|
-
import type { VerdictCode } from '../../../types/snapshot.js';
|
|
4
3
|
import { type DisplaySnapshot } from '../../results/snapshot.js';
|
|
5
|
-
|
|
4
|
+
/** Add guidance only when it gives the editor information the verdict does not. */
|
|
5
|
+
export declare function recommendation({ snapshot, phase, status, isDecidedTestRound }: {
|
|
6
6
|
snapshot: DisplaySnapshot;
|
|
7
|
-
phase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
/** Select stored findings and format them; never run inference in the admin. */
|
|
12
|
-
export declare const RECOMMENDATION: Record<VerdictCode, (ctx: RecommendationContext) => string>;
|
|
13
|
-
export declare const recommendation: (ctx: RecommendationContext) => string;
|
|
7
|
+
phase: PhaseSummary;
|
|
8
|
+
status: Status;
|
|
9
|
+
isDecidedTestRound: boolean;
|
|
10
|
+
}): string | null;
|
|
@@ -1,62 +1,18 @@
|
|
|
1
|
-
import { formatDate } from '../../format/date.js';
|
|
2
1
|
import { armLabel } from '../../labels.js';
|
|
3
|
-
import { formatCount
|
|
2
|
+
import { formatCount } from '../../results/format.js';
|
|
3
|
+
import { collectingRecommendation, noDifferenceRecommendation } from '../../copy/recommendation.js';
|
|
4
4
|
import { RESULTS_COPY } from '../../copy/results.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
|
|
5
|
+
import { hasMissingRolloutWinner } from '../../results/snapshot.js';
|
|
6
|
+
/** Add guidance only when it gives the editor information the verdict does not. */ export function recommendation({ snapshot, phase, status, isDecidedTestRound }) {
|
|
7
|
+
if (hasMissingRolloutWinner(snapshot)) return `${RESULTS_COPY.missingWinner} ${RESULTS_COPY.missingWinnerNext}`;
|
|
8
|
+
if (isDecidedTestRound) return null;
|
|
9
|
+
if (snapshot.verdict.code === 'collecting' && status === 'running' && snapshot.power.exposuresNeededPerArm != null) {
|
|
10
|
+
const groups = phase.arms.filter((arm)=>arm.kind !== 'holdout').length;
|
|
11
|
+
return collectingRecommendation(formatCount(Math.round(snapshot.power.exposuresNeededPerArm * groups)));
|
|
12
|
+
}
|
|
13
|
+
if (snapshot.verdict.code === 'no-difference') {
|
|
14
|
+
const control = phase.arms.find((arm)=>arm.kind === 'control');
|
|
15
|
+
return noDifferenceRecommendation(control?.label.trim() || armLabel('control'));
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
17
18
|
}
|
|
18
|
-
const primary = ({ snapshot })=>snapshot.metrics.find((metric)=>metric.role === 'primary');
|
|
19
|
-
const worse = (ctx)=>primary(ctx)?.comparisons.find((comparison)=>comparison.significant === 'worse' && ctx.phase?.arms.some((arm)=>arm.key === comparison.arm && arm.kind === 'variant'))?.arm;
|
|
20
|
-
const rolloutWinner = (ctx)=>isLegacySnapshot(ctx.snapshot) ? legacyRecommendationWinner(ctx.snapshot, ctx.phase) : {
|
|
21
|
-
key: ctx.snapshot.winnerArm,
|
|
22
|
-
label: label(ctx, ctx.snapshot.winnerArm)
|
|
23
|
-
};
|
|
24
|
-
/** Select stored findings and format them; never run inference in the admin. */ export const RECOMMENDATION = {
|
|
25
|
-
unavailable: ()=>C.unavailable,
|
|
26
|
-
'data-problem': ()=>C.dataProblem,
|
|
27
|
-
'guardrail-failing': (ctx)=>{
|
|
28
|
-
const guardrail = ctx.snapshot.guardrails.find((guardrail)=>guardrail.status === 'failing');
|
|
29
|
-
const metric = ctx.snapshot.metrics.find((metric)=>metric.metricId === guardrail?.metricId);
|
|
30
|
-
// Guardrail safety uses one-sided tests, distinct from comparison significance.
|
|
31
|
-
// Select the group the server named; do not re-infer harm from the table.
|
|
32
|
-
const group = ctx.phase?.arms.find((arm)=>ctx.snapshot.verdict.finding === storedGuardrailFinding(arm.label.trim() || armLabel(arm.key), metric?.name ?? C.guardrail));
|
|
33
|
-
return guardrailRecommendation(label(ctx, ctx.snapshot.verdict.worstArm ?? group?.key), metric?.name ?? C.guardrail);
|
|
34
|
-
},
|
|
35
|
-
collecting: (ctx)=>{
|
|
36
|
-
if (ctx.status === 'stopped') return C.stoppedCollecting;
|
|
37
|
-
const needed = ctx.snapshot.power.exposuresNeededPerArm;
|
|
38
|
-
const groups = ctx.phase?.arms.filter((arm)=>arm.kind !== 'holdout').length ?? ctx.snapshot.k + 1;
|
|
39
|
-
return needed === null ? C.collecting : collectingRecommendation(formatCount(Math.round(needed * groups)));
|
|
40
|
-
},
|
|
41
|
-
'original-better': ()=>C.originalBetter,
|
|
42
|
-
'worse-none-better': (ctx)=>worseRecommendation(label(ctx, worse(ctx))),
|
|
43
|
-
winner: (ctx)=>winnerRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm)),
|
|
44
|
-
mixed: (ctx)=>mixedRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm), label(ctx, worse(ctx))),
|
|
45
|
-
'keep-running': (ctx)=>{
|
|
46
|
-
// Same condition as the server's long-duration branch (src/results/verdict.ts).
|
|
47
|
-
const power = ctx.snapshot.power;
|
|
48
|
-
if (!power.feasible || power.daysRemaining !== null && power.daysRemaining > 90) return C.longDuration;
|
|
49
|
-
const days = ctx.plannedDurationDays;
|
|
50
|
-
const start = Date.parse(ctx.phase?.startedAt ?? '');
|
|
51
|
-
const end = days != null && Number.isFinite(days) && days > 0 ? start + days * 86_400_000 : NaN;
|
|
52
|
-
return Number.isFinite(end) ? runningRecommendation(formatDate(end)) : C.keepRunning;
|
|
53
|
-
},
|
|
54
|
-
'no-difference': ()=>C.noDifference,
|
|
55
|
-
'rollout-collecting': (ctx)=>rolloutCollectingRecommendation(rolloutWinner(ctx).label),
|
|
56
|
-
'rollout-readout': (ctx)=>rolloutReadoutRecommendation(rolloutWinner(ctx).label, formatPercent(primary(ctx)?.comparisons.find((comparison)=>comparison.arm === rolloutWinner(ctx).key)?.lift, true))
|
|
57
|
-
};
|
|
58
|
-
export const recommendation = (ctx)=>{
|
|
59
|
-
if (!isLegacySnapshot(ctx.snapshot) && ctx.snapshot.phaseKind === 'rollout' && ctx.snapshot.winnerArm === null) return RESULTS_COPY.missingWinner;
|
|
60
|
-
const sentence = RECOMMENDATION[ctx.snapshot.verdict.code];
|
|
61
|
-
return sentence(ctx);
|
|
62
|
-
};
|