@delmaredigital/payload-experiments 0.4.0 → 0.5.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 +10 -4
- package/dist/admin/blocks/model.js +2 -0
- package/dist/admin/copy/blocks.d.ts +1 -0
- package/dist/admin/copy/blocks.js +1 -0
- package/dist/admin/copy/status.d.ts +3 -0
- package/dist/admin/copy/status.js +3 -0
- package/dist/admin/placementStatus.model.js +3 -0
- package/dist/admin/status.model.d.ts +3 -2
- package/dist/admin/status.model.js +9 -3
- package/dist/admin/surface/ResultsRoute.js +2 -1
- package/dist/admin/surface/TestsHome.d.ts +2 -1
- package/dist/admin/surface/TestsHome.js +31 -11
- package/dist/admin/surface/TestsSurface.js +4 -0
- package/dist/admin/surface/home.model.d.ts +11 -6
- package/dist/admin/surface/home.model.js +19 -8
- package/dist/admin/surface/newTest/PageWizard.js +13 -3
- package/dist/admin/surface/results/ResultsHeader.js +43 -9
- package/dist/admin/surface/test/TestPage.js +11 -1
- package/dist/admin/useLayerUsage.d.ts +1 -1
- package/dist/admin/views/buildSurfaceProps.js +3 -0
- package/dist/cohorts/build.d.ts +35 -0
- package/dist/cohorts/build.js +134 -0
- package/dist/cohorts/key.d.ts +12 -0
- package/dist/cohorts/key.js +15 -0
- package/dist/cohorts/maintenance.d.ts +10 -0
- package/dist/cohorts/maintenance.js +70 -0
- package/dist/cohorts/readiness.d.ts +30 -0
- package/dist/cohorts/readiness.js +54 -0
- package/dist/cohorts/readinessData.d.ts +29 -0
- package/dist/cohorts/readinessData.js +123 -0
- package/dist/cohorts/rule.d.ts +33 -0
- package/dist/cohorts/rule.js +50 -0
- package/dist/collections/cohortMembers.d.ts +4 -0
- package/dist/collections/cohortMembers.js +95 -0
- package/dist/collections/experiments/config.js +157 -7
- package/dist/collections/experiments/editability.js +10 -6
- package/dist/collections/experiments/lockHook.js +39 -20
- package/dist/collections/index.js +4 -1
- package/dist/collections/phases.js +4 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/db/adapter.d.ts +1 -1
- package/dist/db/adapter.js +14 -4
- package/dist/db/appends.js +1 -1
- package/dist/db/cohortMembership.d.ts +11 -0
- package/dist/db/cohortMembership.js +31 -0
- package/dist/db/cohortPool.d.ts +9 -0
- package/dist/db/cohortPool.js +53 -0
- package/dist/db/cohortTransactions.d.ts +3 -0
- package/dist/db/cohortTransactions.js +52 -0
- package/dist/db/cohorts.d.ts +72 -0
- package/dist/db/cohorts.js +280 -0
- package/dist/db/erase.d.ts +2 -0
- package/dist/db/erase.js +21 -2
- package/dist/db/events.d.ts +2 -0
- package/dist/db/events.js +8 -0
- package/dist/db/executor.d.ts +2 -0
- package/dist/db/executor.js +8 -0
- package/dist/db/locks.d.ts +7 -0
- package/dist/db/locks.js +13 -1
- package/dist/db/names.d.ts +95 -1
- package/dist/db/names.js +95 -1
- package/dist/db/occupancy.d.ts +21 -0
- package/dist/db/occupancy.js +46 -0
- package/dist/db/pageOccupancy.d.ts +4 -4
- package/dist/db/pageOccupancy.js +13 -10
- package/dist/db/pgExecutor.d.ts +4 -0
- package/dist/db/pgExecutor.js +1 -1
- package/dist/db/placements.js +1 -1
- package/dist/db/results.d.ts +5 -2
- package/dist/db/results.js +32 -5
- package/dist/db/slices.d.ts +9 -2
- package/dist/db/slices.js +15 -8
- package/dist/db/snapshots.d.ts +16 -1
- package/dist/db/snapshots.js +27 -2
- package/dist/db/sql.d.ts +2 -2
- package/dist/db/sql.js +1 -2
- package/dist/endpoints/cohortSources.d.ts +16 -0
- package/dist/endpoints/cohortSources.js +335 -0
- package/dist/endpoints/contentLocale.d.ts +1 -1
- package/dist/endpoints/events.js +82 -18
- package/dist/endpoints/index.js +45 -1
- package/dist/endpoints/pausedBy.d.ts +14 -0
- package/dist/endpoints/pausedBy.js +94 -0
- package/dist/endpoints/preflight.js +4 -1
- package/dist/endpoints/previewToken.js +2 -0
- package/dist/endpoints/results.d.ts +2 -2
- package/dist/endpoints/results.js +111 -3
- package/dist/endpoints/routeId.d.ts +2 -1
- package/dist/endpoints/routeId.js +6 -2
- package/dist/endpoints/summary.js +24 -1
- package/dist/endpoints/transitions.d.ts +7 -0
- package/dist/endpoints/transitions.js +50 -1
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +5 -3
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.js +1 -0
- package/dist/exports/runtimeProxy.d.ts +1 -0
- package/dist/exports/runtimeProxy.js +1 -0
- package/dist/hooks/blockRemovalRule.js +7 -4
- package/dist/hooks/pageGuard.js +1 -1
- package/dist/labels/status.d.ts +15 -0
- package/dist/labels/status.js +12 -0
- package/dist/manifest/compile.d.ts +15 -4
- package/dist/manifest/compile.js +91 -3
- package/dist/onInit.js +4 -1
- package/dist/options.d.ts +1 -0
- package/dist/options.js +10 -0
- package/dist/proxy/consentFallback.d.ts +1 -1
- package/dist/proxy/consentFallback.js +4 -4
- package/dist/proxy/control.d.ts +1 -1
- package/dist/proxy/control.js +2 -2
- package/dist/proxy/pageRewrite.d.ts +1 -1
- package/dist/proxy/pageRewrite.js +3 -2
- package/dist/proxy/resolve.js +76 -17
- package/dist/puck/ExperimentPicker.js +2 -1
- package/dist/puck/copy.d.ts +6 -5
- package/dist/puck/copy.js +3 -7
- package/dist/puck/editor/ExperimentSlotEditor.js +16 -5
- package/dist/puck/editor/QuickTestActions.js +7 -1
- package/dist/puck/editor/armWrites.js +6 -1
- package/dist/puck/editor/copy.d.ts +3 -0
- package/dist/puck/editor/copy.js +3 -0
- package/dist/puck/editor/editor.css +2 -1
- package/dist/puck/editor/editor.model.d.ts +2 -1
- package/dist/puck/editor/editor.model.js +2 -0
- package/dist/puck/editor/placementsCache.d.ts +1 -1
- package/dist/puck/editor/placementsCache.js +6 -3
- package/dist/results/analyse.d.ts +3 -1
- package/dist/results/analyse.js +20 -3
- package/dist/results/health.d.ts +11 -0
- package/dist/results/health.js +38 -0
- package/dist/results/power.d.ts +1 -1
- package/dist/results/power.js +1 -1
- package/dist/results/snapshot.d.ts +8 -2
- package/dist/results/snapshot.js +23 -1
- package/dist/results/unitValues.d.ts +48 -0
- package/dist/results/unitValues.js +166 -0
- package/dist/runtime/assign.d.ts +7 -3
- package/dist/runtime/assign.js +12 -4
- package/dist/runtime/cohortCookie.d.ts +15 -0
- package/dist/runtime/cohortCookie.js +72 -0
- package/dist/runtime/cohortLookup.d.ts +9 -0
- package/dist/runtime/cohortLookup.js +25 -0
- package/dist/runtime/eligibility.d.ts +11 -5
- package/dist/runtime/eligibility.js +33 -7
- package/dist/runtime/header.d.ts +1 -0
- package/dist/runtime/header.js +1 -1
- package/dist/runtime/proxyRuntime.js +5 -1
- package/dist/runtime/targeting.d.ts +3 -2
- package/dist/runtime/targeting.js +2 -1
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +41 -4
- package/dist/schedule/activeTime.d.ts +28 -0
- package/dist/schedule/activeTime.js +322 -0
- package/dist/schedule/ranges.d.ts +13 -0
- package/dist/schedule/ranges.js +11 -0
- package/dist/schedule/roundTime.d.ts +10 -0
- package/dist/schedule/roundTime.js +45 -0
- package/dist/schedule/types.d.ts +29 -0
- package/dist/schedule/types.js +1 -0
- package/dist/server/cohortLookup.d.ts +3 -0
- package/dist/server/cohortLookup.js +7 -0
- package/dist/server/eraseUser.d.ts +1 -0
- package/dist/server/getAssignments.js +63 -40
- package/dist/server/previewDraft.d.ts +1 -1
- package/dist/server/previewDraft.js +3 -2
- package/dist/server/recordExposures.js +4 -2
- package/dist/server/runResults.js +97 -150
- package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
- package/dist/testSurface/actions/LifecycleAction.js +15 -5
- package/dist/testSurface/actions/actions.model.d.ts +13 -2
- package/dist/testSurface/actions/actions.model.js +38 -5
- package/dist/testSurface/api.d.ts +13 -1
- package/dist/testSurface/api.js +19 -0
- package/dist/testSurface/copy/actions.d.ts +13 -0
- package/dist/testSurface/copy/actions.js +13 -0
- package/dist/testSurface/copy/cohorts.d.ts +68 -0
- package/dist/testSurface/copy/cohorts.js +81 -0
- package/dist/testSurface/copy/common.d.ts +2 -3
- package/dist/testSurface/copy/common.js +4 -4
- package/dist/testSurface/copy/inputs.d.ts +3 -0
- package/dist/testSurface/copy/inputs.js +3 -0
- package/dist/testSurface/copy/readiness.d.ts +20 -6
- package/dist/testSurface/copy/readiness.js +42 -9
- package/dist/testSurface/copy/results.d.ts +1 -0
- package/dist/testSurface/copy/results.js +1 -0
- package/dist/testSurface/copy/schedule.d.ts +58 -0
- package/dist/testSurface/copy/schedule.js +150 -0
- package/dist/testSurface/copy/surface.d.ts +2 -0
- package/dist/testSurface/copy/surface.js +2 -0
- package/dist/testSurface/copy/testPage.d.ts +12 -2
- package/dist/testSurface/copy/testPage.js +17 -2
- package/dist/testSurface/format/roundProgress.d.ts +13 -1
- package/dist/testSurface/format/roundProgress.js +34 -5
- package/dist/testSurface/format/scheduleStatus.d.ts +34 -0
- package/dist/testSurface/format/scheduleStatus.js +93 -0
- package/dist/testSurface/format/useScheduleClock.d.ts +3 -0
- package/dist/testSurface/format/useScheduleClock.js +20 -0
- package/dist/testSurface/labels.d.ts +4 -9
- package/dist/testSurface/labels.js +2 -7
- package/dist/testSurface/lockedNotice.model.d.ts +2 -2
- package/dist/testSurface/lockedNotice.model.js +16 -3
- package/dist/testSurface/readPreflight.d.ts +3 -0
- package/dist/testSurface/readPreflight.js +14 -0
- package/dist/testSurface/readinessRead.d.ts +2 -2
- package/dist/testSurface/results/DataQualityPanel.js +7 -7
- package/dist/testSurface/results/results.model.d.ts +1 -1
- package/dist/testSurface/results/results.model.js +34 -6
- package/dist/testSurface/review/cohortEstimate.d.ts +11 -0
- package/dist/testSurface/review/cohortEstimate.js +32 -0
- package/dist/testSurface/surface/contracts.d.ts +2 -1
- package/dist/testSurface/surface/contracts.js +1 -0
- package/dist/testSurface/surface/editorPlacement.d.ts +1 -0
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +3 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.js +121 -32
- package/dist/testSurface/surface/readiness/Banner.js +29 -11
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -2
- package/dist/testSurface/surface/readiness/readiness.model.js +35 -5
- package/dist/testSurface/surface/readiness/useTransition.js +17 -5
- package/dist/testSurface/surface/results/ResultsBody.js +46 -10
- package/dist/testSurface/surface/results/useResults.d.ts +16 -1
- package/dist/testSurface/surface/results/useResults.js +17 -6
- package/dist/testSurface/surface/test/CohortRuleEditor.d.ts +16 -0
- package/dist/testSurface/surface/test/CohortRuleEditor.js +492 -0
- package/dist/testSurface/surface/test/LengthSection.js +26 -6
- package/dist/testSurface/surface/test/ScheduleDateInput.d.ts +4 -0
- package/dist/testSurface/surface/test/ScheduleDateInput.js +15 -0
- package/dist/testSurface/surface/test/ScheduleSection.d.ts +2 -0
- package/dist/testSurface/surface/test/ScheduleSection.js +322 -0
- package/dist/testSurface/surface/test/Section.js +1 -1
- package/dist/testSurface/surface/test/TargetingSection.js +306 -182
- package/dist/testSurface/surface/test/TestSurface.js +9 -0
- package/dist/testSurface/surface/test/fields.d.ts +2 -1
- package/dist/testSurface/surface/test/fields.js +3 -3
- package/dist/testSurface/surface/test/jumpToSection.d.ts +1 -1
- package/dist/testSurface/surface/test/jumpToSection.js +4 -4
- package/dist/testSurface/surface/test/testPage.css +26 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +12 -1
- package/dist/testSurface/surface/testDocument.model.js +2 -1
- package/dist/testSurface/surface/useTestDocument.js +11 -4
- package/dist/testSurface/targeting/targeting.model.d.ts +2 -1
- package/dist/testSurface/targeting/targeting.model.js +1 -1
- package/dist/testSurface/useApi.d.ts +12 -0
- package/dist/transitions/addMetric.js +5 -2
- package/dist/transitions/allocate.js +6 -1
- package/dist/transitions/assertNoOverlap.d.ts +9 -0
- package/dist/transitions/assertNoOverlap.js +24 -0
- package/dist/transitions/buildCohorts.d.ts +10 -0
- package/dist/transitions/buildCohorts.js +68 -0
- package/dist/transitions/cancelSchedule.d.ts +4 -0
- package/dist/transitions/cancelSchedule.js +42 -0
- package/dist/transitions/checkStart.d.ts +17 -3
- package/dist/transitions/checkStart.js +20 -7
- package/dist/transitions/decide.js +35 -11
- package/dist/transitions/kernel.d.ts +3 -1
- package/dist/transitions/kernel.js +5 -2
- package/dist/transitions/pause.d.ts +4 -0
- package/dist/transitions/pause.js +35 -0
- package/dist/transitions/phaseRecord.d.ts +19 -2
- package/dist/transitions/phaseRecord.js +50 -11
- package/dist/transitions/placementInteractions.js +1 -1
- package/dist/transitions/preflightData.d.ts +11 -3
- package/dist/transitions/preflightData.js +134 -81
- package/dist/transitions/reschedule.d.ts +4 -0
- package/dist/transitions/reschedule.js +58 -0
- package/dist/transitions/resume.d.ts +4 -0
- package/dist/transitions/resume.js +32 -0
- package/dist/transitions/scheduledRound.d.ts +18 -0
- package/dist/transitions/scheduledRound.js +42 -0
- package/dist/transitions/start.d.ts +4 -0
- package/dist/transitions/start.js +136 -55
- package/dist/transitions/startReads.d.ts +14 -0
- package/dist/transitions/startReads.js +27 -0
- package/dist/transitions/stop.d.ts +10 -0
- package/dist/transitions/stop.js +35 -22
- package/dist/types/admin.d.ts +1 -1
- package/dist/types/contracts.d.ts +7 -1
- package/dist/types/endpoints.d.ts +72 -3
- package/dist/types/manifest.d.ts +9 -0
- package/dist/types/runtime.d.ts +5 -0
- package/dist/types/snapshot.d.ts +10 -0
- package/dist/types/status.d.ts +1 -0
- package/dist/types/status.js +1 -0
- package/dist/types/surface.d.ts +1 -0
- package/dist/ui/Feedback.d.ts +9 -6
- package/dist/ui/Feedback.js +10 -9
- package/dist/ui/SelectControl.js +1 -1
- package/dist/ui/ui.css +2 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { COHORT_EDITOR } from '../../copy/cohorts.js';
|
|
3
4
|
import { theme } from '../../theme.js';
|
|
4
5
|
import { useEffect, useId, useRef, useState } from 'react';
|
|
5
6
|
import { Button } from '../../../ui/Button.js';
|
|
@@ -27,6 +28,8 @@ import { recommendation } from './recommendation.model.js';
|
|
|
27
28
|
import { useResults } from './useResults.js';
|
|
28
29
|
import { DecideDialog } from '../../actions/DecideDialog.js';
|
|
29
30
|
import { Banner } from '../../../ui/Banner.js';
|
|
31
|
+
import { displayStatus } from '../../labels.js';
|
|
32
|
+
import { useScheduleClock } from '../../format/useScheduleClock.js';
|
|
30
33
|
import { availableActions } from '../../actions/actions.model.js';
|
|
31
34
|
import { PagesReleased, ReleasePagesDialog } from './ReleasePages.js';
|
|
32
35
|
import { usePlacementLabels } from '../../placements/usePlacementLabels.js';
|
|
@@ -46,7 +49,10 @@ export function ResultsBody({ id, surface, onRecomputed, renderPage, onChanged,
|
|
|
46
49
|
}
|
|
47
50
|
function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, documentVersion, liveDocument, statusReadPending }) {
|
|
48
51
|
const formatDate = useDateFormatter();
|
|
49
|
-
const results = useResults(id, surface,
|
|
52
|
+
const results = useResults(id, surface, {
|
|
53
|
+
documentVersion,
|
|
54
|
+
documentPhase: liveDocument?.phase
|
|
55
|
+
});
|
|
50
56
|
const { api, doc, round, phases, state, data } = results;
|
|
51
57
|
const managerDoc = liveDocument ?? doc;
|
|
52
58
|
const manage = surface.canManage && surface.canReadResults;
|
|
@@ -114,16 +120,28 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
114
120
|
});
|
|
115
121
|
const latestPhase = phases.find((phase)=>phase.phase === newestRound);
|
|
116
122
|
const decision = data?.decision ?? doc?.decision;
|
|
117
|
-
const status = managerDoc?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
|
|
123
|
+
const status = managerDoc?.status ?? data?.experiment?.status ?? (data?.decision ? 'decided' : latestPhase?.phaseKind === 'test' && latestPhase.endedAt === null ? 'running' : 'stopped');
|
|
124
|
+
const startedAt = liveDocument?.startedAt ?? latestPhase?.startedAt;
|
|
125
|
+
const now = useScheduleClock([
|
|
126
|
+
{
|
|
127
|
+
status,
|
|
128
|
+
startedAt,
|
|
129
|
+
schedule: liveDocument?.schedule ?? latestPhase?.schedule
|
|
130
|
+
}
|
|
131
|
+
], surface.timeZone);
|
|
132
|
+
const currentStatus = displayStatus({
|
|
133
|
+
status,
|
|
134
|
+
startedAt
|
|
135
|
+
}, now);
|
|
118
136
|
// ADM-06b: an older round never inherits the live test's running status.
|
|
119
|
-
const lineStatus = !statusReadPending &&
|
|
137
|
+
const lineStatus = !statusReadPending && currentStatus === 'running' && round === newestRound ? 'running' : 'stopped';
|
|
120
138
|
const isDecidedTestRound = status === 'decided' && phase?.phaseKind === 'test' && decision?.phase === round;
|
|
121
139
|
const showingDecision = isDecidedTestRound && Boolean(data?.decisionSnapshot);
|
|
122
140
|
const shown = showingDecision ? data.decisionSnapshot : snapshot;
|
|
123
141
|
const winner = phase?.arms.find((arm)=>arm.key === decision?.winnerArm)?.label ?? armLabel(decision?.winnerArm ?? 'control');
|
|
124
142
|
const control = phase?.arms.find((arm)=>arm.kind === 'control') ?? phases.find((item)=>item.phase === decision?.phase)?.arms.find((arm)=>arm.kind === 'control');
|
|
125
143
|
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' ?
|
|
144
|
+
const progress = roundProgress(phase?.startedAt ?? shown?.window.from, planned, lineStatus === 'running' || status === 'paused' && round === newestRound ? now : Date.parse(shown?.window.to ?? ''), undefined, phase);
|
|
127
145
|
const planLine = shown && lineStatus === 'running' ? runningPlanLine(shown, progress, formatDate) : null;
|
|
128
146
|
const card = shown ? verdictCard({
|
|
129
147
|
snapshot: shown,
|
|
@@ -149,12 +167,12 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
149
167
|
placementLabels
|
|
150
168
|
};
|
|
151
169
|
// A late browser-activity warning can reach the same round after a decision.
|
|
152
|
-
const
|
|
153
|
-
const qualitySnapshot = shown &&
|
|
170
|
+
const lateHealth = showingDecision && snapshot && shown && snapshot.phase === shown.phase ? snapshot.health?.filter((item)=>(item.code === 'rapid-browser-events' || item.code === 'paused-share' || item.code === 'schedule-population') && !shown.health?.some((existing)=>item.code === existing.code)) ?? [] : [];
|
|
171
|
+
const qualitySnapshot = shown && lateHealth.length ? {
|
|
154
172
|
...shown,
|
|
155
173
|
health: [
|
|
156
174
|
...shown.health ?? [],
|
|
157
|
-
|
|
175
|
+
...lateHealth
|
|
158
176
|
]
|
|
159
177
|
} : shown;
|
|
160
178
|
const qualityItems = phase && qualitySnapshot ? dataQuality(qualitySnapshot, context) : [];
|
|
@@ -163,6 +181,8 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
163
181
|
const lifecycle = managerDoc || data ? availableActions({
|
|
164
182
|
...managerDoc,
|
|
165
183
|
status,
|
|
184
|
+
startedAt,
|
|
185
|
+
now,
|
|
166
186
|
kind: managerDoc?.kind ?? 'block',
|
|
167
187
|
decision: managerDoc?.decision,
|
|
168
188
|
canManage: surface.canManage,
|
|
@@ -190,7 +210,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
190
210
|
results: data && round === decisionRound.phase && 'arms' in decisionRound && (state === 'ready' || state === 'empty') ? data : undefined
|
|
191
211
|
});
|
|
192
212
|
}
|
|
193
|
-
});
|
|
213
|
+
}, action.id);
|
|
194
214
|
if (action.id === 'release-pages') roundActions['release-pages'] = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
195
215
|
action: action,
|
|
196
216
|
disabled: busy || !!deciding,
|
|
@@ -200,7 +220,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
200
220
|
phase: managerDoc?.phase
|
|
201
221
|
});
|
|
202
222
|
}
|
|
203
|
-
});
|
|
223
|
+
}, action.id);
|
|
204
224
|
}
|
|
205
225
|
const pages = manage && placements ? actionablePreviewPages(placements, doc?.flagPoint) : [];
|
|
206
226
|
const editorUrls = [
|
|
@@ -214,7 +234,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
214
234
|
children: TEST_PAGE.editOnPage
|
|
215
235
|
}) : null;
|
|
216
236
|
// A decided round displays the frozen snapshot used for the decision.
|
|
217
|
-
const refresh = manage && !showingDecision ? /*#__PURE__*/ _jsxs("div", {
|
|
237
|
+
const refresh = manage && !showingDecision && currentStatus !== 'scheduled' ? /*#__PURE__*/ _jsxs("div", {
|
|
218
238
|
className: "xp-results-refresh",
|
|
219
239
|
children: [
|
|
220
240
|
/*#__PURE__*/ _jsx(Button, {
|
|
@@ -271,6 +291,20 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
271
291
|
]
|
|
272
292
|
})
|
|
273
293
|
});
|
|
294
|
+
const participation = phase?.cohortSummaries?.length ? /*#__PURE__*/ _jsxs("section", {
|
|
295
|
+
"aria-label": COHORT_EDITOR.whoTookPart,
|
|
296
|
+
className: "xp-results-block",
|
|
297
|
+
children: [
|
|
298
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
299
|
+
children: COHORT_EDITOR.whoTookPart
|
|
300
|
+
}),
|
|
301
|
+
/*#__PURE__*/ _jsx("ul", {
|
|
302
|
+
children: phase.cohortSummaries.map((line, index)=>/*#__PURE__*/ _jsx("li", {
|
|
303
|
+
children: line
|
|
304
|
+
}, index))
|
|
305
|
+
})
|
|
306
|
+
]
|
|
307
|
+
}) : null;
|
|
274
308
|
const leader = shown?.verdict.recommendedArm;
|
|
275
309
|
const leadingComparison = shown?.metrics.find((metric)=>metric.role === 'primary')?.comparisons.find((item)=>item.arm === leader);
|
|
276
310
|
const chance = shown?.method === 'bayesian' && ![
|
|
@@ -346,6 +380,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
346
380
|
browserWritablePrimary: primary?.browserWritable || primary?.clickGoal,
|
|
347
381
|
sinceShipping: rolloutLine(shown, phase, phases, decision ?? undefined)
|
|
348
382
|
}),
|
|
383
|
+
participation,
|
|
349
384
|
primary?.clickGoal ? /*#__PURE__*/ _jsx("p", {
|
|
350
385
|
children: C.clickPrimary
|
|
351
386
|
}) : null,
|
|
@@ -414,6 +449,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
414
449
|
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
415
450
|
children: [
|
|
416
451
|
meta,
|
|
452
|
+
participation,
|
|
417
453
|
state === 'empty' || state === 'ready' ? /*#__PURE__*/ _jsx("p", {
|
|
418
454
|
children: C.empty
|
|
419
455
|
}) : null
|
|
@@ -29,7 +29,10 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
|
|
|
29
29
|
apiRoute: string;
|
|
30
30
|
canReadResults: boolean;
|
|
31
31
|
canManage?: boolean;
|
|
32
|
-
}, documentVersion?:
|
|
32
|
+
}, { documentVersion, documentPhase }?: {
|
|
33
|
+
documentVersion?: string;
|
|
34
|
+
documentPhase?: number;
|
|
35
|
+
}): {
|
|
33
36
|
api: {
|
|
34
37
|
findTestIdBySlug: (slug: string) => Promise<Extract<ApiResult<DocId>, {
|
|
35
38
|
ok: false;
|
|
@@ -48,6 +51,13 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
|
|
|
48
51
|
page?: number;
|
|
49
52
|
mode?: "block";
|
|
50
53
|
}, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").PagesResult>>;
|
|
54
|
+
cohortSources: (q: string, exclude: DocId, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").CohortSourcesResult>>;
|
|
55
|
+
buildCohorts: (id: DocId) => Promise<ApiResult<{
|
|
56
|
+
cohorts: Array<{
|
|
57
|
+
key: string;
|
|
58
|
+
members: number;
|
|
59
|
+
}>;
|
|
60
|
+
}>>;
|
|
51
61
|
previewPageCopy: (id: DocId, arm: string, signal?: AbortSignal) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPagePlan>>;
|
|
52
62
|
makePageCopy: (id: DocId, arm: string, plan: import("../../../types/endpoints.js").CopyPagePlan) => Promise<ApiResult<import("../../../types/endpoints.js").CopyPageResult>>;
|
|
53
63
|
placementStatus: (body: import("../../../types/endpoints.js").PlacementStatusBody) => Promise<ApiResult<import("../../../types/endpoints.js").PlacementStatusResult>>;
|
|
@@ -65,6 +75,10 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
|
|
|
65
75
|
fallback?: string;
|
|
66
76
|
}) => Promise<ApiResult<import("../../../types/endpoints.js").AddMetricResult>>;
|
|
67
77
|
stop: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
78
|
+
pause: (id: DocId, body: import("../../../types/endpoints.js").PauseBody) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
79
|
+
resume: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
80
|
+
reschedule: (id: DocId, body: import("../../../types/endpoints.js").RescheduleBody) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
81
|
+
cancelSchedule: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
68
82
|
decide: (id: DocId, body: import("../../../types/endpoints.js").DecideBody) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
69
83
|
releaseHoldout: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
70
84
|
releasePages: (id: DocId, phase?: number) => Promise<ApiResult<import("../../../types/endpoints.js").TransitionSuccess>>;
|
|
@@ -88,6 +102,7 @@ export declare function useResults(id: DocId, { apiRoute, canReadResults, canMan
|
|
|
88
102
|
recompute: (id: DocId) => Promise<ApiResult<{
|
|
89
103
|
snapshotId: string;
|
|
90
104
|
}>>;
|
|
105
|
+
pausedBy: (signal: AbortSignal) => Promise<ApiResult<Record<string, import("../../../types/endpoints.js").PauseAttribution>>>;
|
|
91
106
|
summary: (ids: readonly DocId[]) => Promise<ApiResult<import("../../../types/endpoints.js").SummaryResponse>>;
|
|
92
107
|
};
|
|
93
108
|
state: ResultsLoadState;
|
|
@@ -32,7 +32,7 @@ async function read(url, signal) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
export function useResults(id, { apiRoute, canReadResults, canManage = true }, documentVersion) {
|
|
35
|
+
export function useResults(id, { apiRoute, canReadResults, canManage = true }, { documentVersion, documentPhase } = {}) {
|
|
36
36
|
const base = apiRoute.replace(/\/$/, '');
|
|
37
37
|
const key = JSON.stringify([
|
|
38
38
|
base,
|
|
@@ -47,7 +47,14 @@ export function useResults(id, { apiRoute, canReadResults, canManage = true }, d
|
|
|
47
47
|
key,
|
|
48
48
|
round: null
|
|
49
49
|
});
|
|
50
|
-
const
|
|
50
|
+
const selected = selection.key === key ? selection.round : null;
|
|
51
|
+
// Cancel schedule moves the current phase backwards and deletes the unopened round.
|
|
52
|
+
const removed = selected !== null && documentPhase !== undefined && selection.documentPhase !== undefined && selected <= selection.documentPhase && selected > documentPhase;
|
|
53
|
+
if (removed) setSelection({
|
|
54
|
+
key,
|
|
55
|
+
round: null
|
|
56
|
+
});
|
|
57
|
+
const round = removed ? null : selected;
|
|
51
58
|
const [refresh, setRefresh] = useState(0);
|
|
52
59
|
const [view, setView] = useState({
|
|
53
60
|
key,
|
|
@@ -129,7 +136,8 @@ export function useResults(id, { apiRoute, canReadResults, canManage = true }, d
|
|
|
129
136
|
});
|
|
130
137
|
setSelection({
|
|
131
138
|
key,
|
|
132
|
-
round: initial
|
|
139
|
+
round: initial,
|
|
140
|
+
documentPhase
|
|
133
141
|
});
|
|
134
142
|
return;
|
|
135
143
|
}
|
|
@@ -153,7 +161,8 @@ export function useResults(id, { apiRoute, canReadResults, canManage = true }, d
|
|
|
153
161
|
canManage,
|
|
154
162
|
round,
|
|
155
163
|
refresh,
|
|
156
|
-
documentVersion
|
|
164
|
+
documentVersion,
|
|
165
|
+
documentPhase
|
|
157
166
|
]);
|
|
158
167
|
const current = view.key === key;
|
|
159
168
|
const matching = current && (round === null || view.round === round);
|
|
@@ -172,12 +181,14 @@ export function useResults(id, { apiRoute, canReadResults, canManage = true }, d
|
|
|
172
181
|
error: matching ? view.error : undefined,
|
|
173
182
|
setRound: (next)=>setSelection({
|
|
174
183
|
key,
|
|
175
|
-
round: next
|
|
184
|
+
round: next,
|
|
185
|
+
documentPhase
|
|
176
186
|
}),
|
|
177
187
|
reload: ()=>{
|
|
178
188
|
setSelection({
|
|
179
189
|
key,
|
|
180
|
-
round: selectedRound
|
|
190
|
+
round: selectedRound,
|
|
191
|
+
documentPhase
|
|
181
192
|
});
|
|
182
193
|
setRefresh((value)=>value + 1);
|
|
183
194
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CohortRule } from '../../../cohorts/rule.js';
|
|
2
|
+
import type { CohortSourceOption } from '../../../types/endpoints.js';
|
|
3
|
+
import type { SectionProps } from '../contracts.js';
|
|
4
|
+
import '../pagePicker/pagePicker.css';
|
|
5
|
+
export declare const EMPTY_COHORT_RULE: CohortRule;
|
|
6
|
+
export declare function CohortRuleEditor({ test, surface, index, pending, draftId, saved, sourceFor, onSource, onSave, onRemove, onDiscard }: SectionProps & {
|
|
7
|
+
index: number;
|
|
8
|
+
pending?: boolean;
|
|
9
|
+
draftId: string;
|
|
10
|
+
saved: CohortRule;
|
|
11
|
+
sourceFor: (id: string) => CohortSourceOption | undefined;
|
|
12
|
+
onSource: (source: CohortSourceOption) => void;
|
|
13
|
+
onSave: (rule: CohortRule) => boolean;
|
|
14
|
+
onRemove: () => void;
|
|
15
|
+
onDiscard?: () => void;
|
|
16
|
+
}): import("react").JSX.Element;
|