@delmaredigital/payload-experiments 0.4.1 → 0.5.1
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 -5
- 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/blocks/placementLocale.d.ts +14 -0
- package/dist/blocks/placementLocale.js +80 -13
- package/dist/blocks/placementPublication.d.ts +14 -0
- package/dist/blocks/placementPublication.js +24 -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 +2 -1
- package/dist/db/adapter.js +17 -4
- package/dist/db/appends.d.ts +2 -1
- package/dist/db/appends.js +3 -2
- package/dist/db/bulkPlacementRemoval.d.ts +5 -0
- package/dist/db/bulkPlacementRemoval.js +7 -2
- 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/pageBindings.d.ts +2 -2
- package/dist/db/pageBindings.js +3 -3
- 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.d.ts +6 -1
- package/dist/db/placements.js +27 -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/duplicateOriginal.d.ts +1 -0
- 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.d.ts +1 -1
- package/dist/hooks/blockRemovalRule.js +12 -8
- package/dist/hooks/pageGuard.d.ts +7 -1
- package/dist/hooks/pageGuard.js +177 -4
- package/dist/hooks/puckNestedTests.d.ts +1 -1
- package/dist/hooks/puckNestedTests.js +3 -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 -6
- 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/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +42 -20
- 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 +44 -8
- 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 +40 -13
- 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.d.ts +7 -2
- package/dist/transitions/placementInteractions.js +9 -7
- package/dist/transitions/placements.d.ts +4 -3
- package/dist/transitions/placements.js +28 -14
- 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 +139 -56
- 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
|
@@ -14,7 +14,7 @@ export declare function classifyReadinessRead(status: number, body?: unknown, fa
|
|
|
14
14
|
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
15
15
|
kind: string;
|
|
16
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." | "
|
|
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." | "You don't have access to this test." | "Couldn't load this test." | "Couldn't load this test. Try selecting it again." | "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
18
|
failed: boolean;
|
|
19
19
|
retry: boolean;
|
|
20
20
|
pollDelay: number | null;
|
|
@@ -29,7 +29,7 @@ export declare function readinessRead(test: {
|
|
|
29
29
|
loadState: "forbidden" | "error" | "missing" | "ready";
|
|
30
30
|
kind: string;
|
|
31
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." | "
|
|
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." | "You don't have access to this test." | "Couldn't load this test." | "Couldn't load this test. Try selecting it again." | "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
33
|
failed: boolean;
|
|
34
34
|
retry: boolean;
|
|
35
35
|
pollDelay: number | null;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { RESULTS_COPY as C } from '../copy/results.js';
|
|
4
4
|
import './results.css';
|
|
5
|
-
const quality = (item)=>item.id === 'srm' || item.id.startsWith('version-page-unavailable') ? 'problem' : 'watch';
|
|
5
|
+
const quality = (item)=>item.id === 'schedule-population' ? 'ok' : item.id === 'srm' || item.id.startsWith('version-page-unavailable') ? 'problem' : 'watch';
|
|
6
6
|
export function DataQualityPanel({ items, problem = false }) {
|
|
7
|
-
const overall = problem || items.some((item)=>quality(item) === 'problem') ? 'problem' : items.
|
|
7
|
+
const overall = problem || items.some((item)=>quality(item) === 'problem') ? 'problem' : items.some((item)=>quality(item) === 'watch') ? 'watch' : 'ok';
|
|
8
8
|
return /*#__PURE__*/ _jsxs("details", {
|
|
9
9
|
className: "xp-results-panel xp-data-quality",
|
|
10
|
-
open:
|
|
10
|
+
open: problem || items.length > 0,
|
|
11
11
|
children: [
|
|
12
12
|
/*#__PURE__*/ _jsxs("summary", {
|
|
13
13
|
children: [
|
|
@@ -23,10 +23,10 @@ export function DataQualityPanel({ items, problem = false }) {
|
|
|
23
23
|
children: items.length ? items.map((item)=>/*#__PURE__*/ _jsxs("div", {
|
|
24
24
|
className: "xp-quality-row",
|
|
25
25
|
children: [
|
|
26
|
-
/*#__PURE__*/ _jsx("span", {
|
|
26
|
+
quality(item) !== 'ok' ? /*#__PURE__*/ _jsx("span", {
|
|
27
27
|
className: `xp-quality-chip xp-quality-chip--${quality(item)}`,
|
|
28
28
|
children: C.qualityStates[quality(item)]
|
|
29
|
-
}),
|
|
29
|
+
}) : null,
|
|
30
30
|
/*#__PURE__*/ _jsx("p", {
|
|
31
31
|
children: item.message
|
|
32
32
|
}),
|
|
@@ -39,13 +39,13 @@ export function DataQualityPanel({ items, problem = false }) {
|
|
|
39
39
|
children: share
|
|
40
40
|
}, index))
|
|
41
41
|
}) : null,
|
|
42
|
-
/*#__PURE__*/ _jsx("p", {
|
|
42
|
+
item.nextStep ? /*#__PURE__*/ _jsx("p", {
|
|
43
43
|
className: "xp-quality-next",
|
|
44
44
|
children: item.href ? /*#__PURE__*/ _jsx("a", {
|
|
45
45
|
href: item.href,
|
|
46
46
|
children: item.nextStep
|
|
47
47
|
}) : item.nextStep
|
|
48
|
-
})
|
|
48
|
+
}) : null
|
|
49
49
|
]
|
|
50
50
|
}, item.id)) : /*#__PURE__*/ _jsx("p", {
|
|
51
51
|
className: "xp-quality-row",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocId, Status } from '../../types/contracts.js';
|
|
2
2
|
import type { PhaseSummary, ResultsResponse } from '../../types/endpoints.js';
|
|
3
3
|
import type { Snapshot } from '../../types/snapshot.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type DateFormatter } from '../format/date.js';
|
|
5
5
|
import type { roundProgress } from '../format/roundProgress.js';
|
|
6
6
|
import { type DisplaySnapshot } from './snapshot.js';
|
|
7
7
|
import type { PlacementLabel } from '../placements/placementLabels.model.js';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { COHORT_COPY, cohortExitsLabel } from '../copy/cohorts.js';
|
|
1
2
|
import { isLongDuration } from '../../results/verdict.js';
|
|
3
|
+
import { createDateFormatter } from '../format/date.js';
|
|
4
|
+
import { pausedShareCopy, schedulePopulationCopy } from '../copy/schedule.js';
|
|
2
5
|
import { READINESS_COPY, placementUncheckedCopy, versionPageUnavailableCopy, versionPageUncheckedCopy } from '../copy/readiness.js';
|
|
3
6
|
import { armLabel, phaseKindLabel, verdictCodeLabel } from '../labels.js';
|
|
4
|
-
import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, keepRunningTo, metricUnavailable, moreDays, pastPlannedEnd, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal, verdictControlCopy } from '../copy/results.js';
|
|
7
|
+
import { RESULTS_COPY, cappedCount, collectingCopy, conflictCopy, decidedTitle, exclusionCopy, ignoredCopy, keepRunningTo, metricUnavailable, moreDays, moreWeekends, pastPlannedEnd, roundLabel, shareCopy, shippingTitle, srmP, uncappedTotal, verdictControlCopy } from '../copy/results.js';
|
|
5
8
|
import { formatCI, formatCount, formatMetric, formatPercent, formatProbability } from './format.js';
|
|
6
9
|
import { legacyMinimum, legacyRolloutLine, legacyTooFew } from './legacy.js';
|
|
7
10
|
import { isLegacySnapshot } from './snapshot.js';
|
|
@@ -119,10 +122,12 @@ export function guardrailChips(snapshot) {
|
|
|
119
122
|
}));
|
|
120
123
|
}
|
|
121
124
|
export function runningPlanLine(snapshot, progress, formatDate) {
|
|
122
|
-
const date = progress.end === null ? null : formatDate(progress.end);
|
|
125
|
+
const date = progress.end === null ? null : (progress.timeZone ? createDateFormatter(progress.timeZone) : formatDate)(progress.end);
|
|
123
126
|
const planned = date === null ? RESULTS_COPY.plannedEnd : progress.daysToGo === 0 ? pastPlannedEnd(date) : keepRunningTo(date);
|
|
124
127
|
const days = snapshot.power.daysRemaining;
|
|
125
|
-
|
|
128
|
+
if (days === null || progress.daysToGo === null || days <= progress.daysToGo) return planned;
|
|
129
|
+
const extra = progress.daysPerWeekend && days > 1 ? moreWeekends(formatCount(Math.ceil(days / progress.daysPerWeekend))) : moreDays(formatCount(Math.ceil(days)));
|
|
130
|
+
return `${planned} ${extra}`;
|
|
126
131
|
}
|
|
127
132
|
export function powerLine({ snapshot, phaseKind, status }, planned) {
|
|
128
133
|
if (phaseKind !== 'test' || status !== 'running' || snapshot.verdict.code !== 'collecting') return null;
|
|
@@ -142,18 +147,36 @@ function smallest(values) {
|
|
|
142
147
|
return collectingCopy(formatCount(smallest(keys.map((key)=>snapshot.exposures.perArm[key]))), formatCount(isLegacySnapshot(snapshot) ? legacyMinimum(snapshot, ctx) : snapshot.minExposuresPerArm), formatCount(smallest(keys.map((key)=>primary?.perArm.find((arm)=>arm.arm === key)?.converters))), formatCount(primary ? snapshot.params.minSampleSizes[primary.metricId] : undefined));
|
|
143
148
|
}
|
|
144
149
|
export function dataQuality(snapshot, ctx = {}) {
|
|
145
|
-
const items = (snapshot.health ?? []).map((item)=>
|
|
150
|
+
const items = (snapshot.health ?? []).map((item)=>{
|
|
151
|
+
if (item.code === 'cohort-no-exposures') return {
|
|
152
|
+
id: item.code,
|
|
153
|
+
message: COHORT_COPY.noExposures,
|
|
154
|
+
nextStep: ''
|
|
155
|
+
};
|
|
156
|
+
if (item.code === 'paused-share') return {
|
|
157
|
+
id: item.code,
|
|
158
|
+
message: pausedShareCopy(item.pausedDays),
|
|
159
|
+
nextStep: ''
|
|
160
|
+
};
|
|
161
|
+
if (item.code === 'schedule-population') return {
|
|
162
|
+
id: item.code,
|
|
163
|
+
message: schedulePopulationCopy(item.summary),
|
|
164
|
+
nextStep: ''
|
|
165
|
+
};
|
|
166
|
+
if (item.code === 'rapid-browser-events') return {
|
|
146
167
|
id: item.code,
|
|
147
168
|
message: RESULTS_COPY.rapidBrowserEvents,
|
|
148
169
|
nextStep: RESULTS_COPY.rapidBrowserEventsNext
|
|
149
|
-
}
|
|
170
|
+
};
|
|
171
|
+
return {
|
|
150
172
|
id: item.code === 'placement-unchecked' ? `${item.code}:${JSON.stringify(item.detail)}` : `${item.code}:${'path' in item ? item.path : item.metricId}`,
|
|
151
173
|
message: item.code === 'placement-unchecked' ? placementUncheckedCopy(ctx.placementLabels?.get(placementDetailKey(item.detail))?.title ?? item.detail.path ?? 'This page') : item.code === 'goal-in-some-versions' ? `${item.name} now appears in some versions but not all, so this result is no longer a fair comparison. Add it to every version, or remove it.` : READINESS_COPY.needsAttention,
|
|
152
174
|
...item.code === 'placement-unchecked' ? {
|
|
153
175
|
href: ctx.placementLabels?.get(placementDetailKey(item.detail))?.href
|
|
154
176
|
} : {},
|
|
155
177
|
nextStep: item.code === 'placement-unchecked' ? `Open ${ctx.placementLabels?.get(placementDetailKey(item.detail))?.title ?? item.detail.path ?? 'the page'}` : item.code === 'goal-in-some-versions' ? 'Edit the versions' : item.code === 'version-page-unavailable' ? versionPageUnavailableCopy(item.path, ctx.status) : versionPageUncheckedCopy(item.path, ctx.status)
|
|
156
|
-
}
|
|
178
|
+
};
|
|
179
|
+
});
|
|
157
180
|
const srmTotal = Object.keys(snapshot.srm.expected).reduce((total, key)=>total + (snapshot.exposures.perArm[key] ?? 0), 0);
|
|
158
181
|
if (snapshot.srm.flagged) items.push({
|
|
159
182
|
id: 'srm',
|
|
@@ -162,6 +185,11 @@ export function dataQuality(snapshot, ctx = {}) {
|
|
|
162
185
|
shares: Object.entries(snapshot.srm.expected).map(([key, expected])=>shareCopy(ctx.phase?.arms.find((arm)=>arm.key === key)?.label ?? armLabel(key), formatPercent(expected), formatPercent(srmTotal > 0 ? (snapshot.exposures.perArm[key] ?? 0) / srmTotal : undefined)))
|
|
163
186
|
});
|
|
164
187
|
const exposures = snapshot.exposures;
|
|
188
|
+
if ((exposures.cohortExits ?? 0) > 0) items.push({
|
|
189
|
+
id: 'cohort-exits',
|
|
190
|
+
message: cohortExitsLabel(exposures.cohortExits),
|
|
191
|
+
nextStep: ''
|
|
192
|
+
});
|
|
165
193
|
if (exposures.excludedMultiArm > 0 || exposures.multiArmShare > 0) items.push({
|
|
166
194
|
id: 'multi-group',
|
|
167
195
|
message: RESULTS_COPY.multiGroup,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CohortRule } from '../../cohorts/rule.js';
|
|
2
|
+
import type { CohortSourceOption } from '../../types/endpoints.js';
|
|
3
|
+
export declare function selectedCohortRound(source: CohortSourceOption | undefined, phase: CohortRule['phase']): import("../../types/endpoints.js").CohortSourceRound | undefined;
|
|
4
|
+
export declare function cohortSize(rule: CohortRule, source: CohortSourceOption | undefined): number | undefined;
|
|
5
|
+
export declare function audienceReview(entries: Array<{
|
|
6
|
+
include: boolean;
|
|
7
|
+
size?: number;
|
|
8
|
+
}>, minExposuresPerArm: number, comparedVersions: number): {
|
|
9
|
+
warning?: "This audience may be too small to reach a reliable answer." | undefined;
|
|
10
|
+
lines: string[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { COHORT_EDITOR, cohortReviewLabel } from '../copy/cohorts.js';
|
|
2
|
+
export function selectedCohortRound(source, phase) {
|
|
3
|
+
return phase === 'latest' ? source?.rounds[0] : source?.rounds.find((round)=>round.phase === phase);
|
|
4
|
+
}
|
|
5
|
+
export function cohortSize(rule, source) {
|
|
6
|
+
const estimate = selectedCohortRound(source, rule.phase)?.estimate;
|
|
7
|
+
if (!estimate || !rule.arms.length) return;
|
|
8
|
+
let total = 0;
|
|
9
|
+
for (const key of rule.arms){
|
|
10
|
+
const arm = estimate.perArm[key];
|
|
11
|
+
if (!arm) return;
|
|
12
|
+
if (!rule.goal) {
|
|
13
|
+
total += arm.exposed;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const converters = arm.converters[rule.goal.metricId];
|
|
17
|
+
if (converters === undefined) return;
|
|
18
|
+
total += rule.goal.completed ? converters : Math.max(0, arm.exposed - converters);
|
|
19
|
+
}
|
|
20
|
+
return total;
|
|
21
|
+
}
|
|
22
|
+
export function audienceReview(entries, minExposuresPerArm, comparedVersions) {
|
|
23
|
+
const sizes = entries.flatMap(({ include, size })=>include && size !== undefined ? [
|
|
24
|
+
size
|
|
25
|
+
] : []);
|
|
26
|
+
return {
|
|
27
|
+
lines: sizes.map(cohortReviewLabel),
|
|
28
|
+
...sizes.some((size)=>size < minExposuresPerArm * comparedVersions) ? {
|
|
29
|
+
warning: COHORT_EDITOR.tooSmall
|
|
30
|
+
} : {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -4,7 +4,7 @@ import type { SerializedAttributeKeys, SerializedFlagPoint, SerializedMetricSour
|
|
|
4
4
|
import type { ArmSlot } from '../../types/puck.js';
|
|
5
5
|
import type { useTestDocument } from './useTestDocument.js';
|
|
6
6
|
/** Sections of the test page, in readiness order (surface spec §6.2, §8). */
|
|
7
|
-
export type SectionId = 'what' | 'versions' | 'win' | 'who' | 'length' | 'advanced';
|
|
7
|
+
export type SectionId = 'what' | 'versions' | 'win' | 'who' | 'length' | 'schedule' | 'advanced';
|
|
8
8
|
export declare const SECTION_ORDER: readonly SectionId[];
|
|
9
9
|
/** The data layer's return value; every section takes it as `test`. */
|
|
10
10
|
type DocumentApi = ReturnType<typeof useTestDocument>;
|
|
@@ -28,6 +28,7 @@ export interface SurfaceProps {
|
|
|
28
28
|
editorPlacementMessage?: string;
|
|
29
29
|
adminRoute: string;
|
|
30
30
|
apiRoute: string;
|
|
31
|
+
timeZone?: string;
|
|
31
32
|
contentLanguageLabels?: string[];
|
|
32
33
|
contentLocale?: string;
|
|
33
34
|
collectionTitles?: Record<string, string>;
|
|
@@ -10,6 +10,7 @@ export declare function editorPlacementMessage(placements: PreflightResult['plac
|
|
|
10
10
|
export declare function editorPreflight(answer: PreflightResult | null, surface: SurfaceProps, includeLocalBlocker?: boolean): PreflightResult | null;
|
|
11
11
|
/** Shared sidebar policy; the bounded list renders these steps verbatim. */
|
|
12
12
|
export declare function sidebarReadinessBlockers(test: ActionTestApi, surface: SurfaceProps): ({
|
|
13
|
+
rule?: number | undefined;
|
|
13
14
|
arm?: import("../../types/armKey.js").ArmKey | undefined;
|
|
14
15
|
section: "header" | import("./contracts.js").SectionId;
|
|
15
16
|
sentence: string;
|
|
@@ -6,11 +6,12 @@ type Props = {
|
|
|
6
6
|
onClose(): void;
|
|
7
7
|
};
|
|
8
8
|
export declare function dialogTitle(label: string, test: ActionTestApi): string;
|
|
9
|
-
|
|
10
|
-
export declare function ConfirmAction({ test, surface, action, winnerLabel, onClose, onSuccess }: Props & {
|
|
9
|
+
export declare function ConfirmAction({ test, surface, action, winnerLabel, onClose, onSuccess, unavailable, now }: Props & {
|
|
11
10
|
action: ExperimentAction;
|
|
12
11
|
winnerLabel: string;
|
|
13
12
|
onSuccess?: () => void;
|
|
13
|
+
unavailable?: boolean;
|
|
14
|
+
now?: number;
|
|
14
15
|
}): import("react").JSX.Element;
|
|
15
16
|
/** AllocateDialog's validation and copy, with data supplied by the test document. */
|
|
16
17
|
export declare function AllocateAction({ test, surface, onClose }: Props): import("react").JSX.Element;
|
|
@@ -3,9 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { canStartTest, readyToStart } from '../../readinessRead.js';
|
|
4
4
|
import { DocsResponseError, fetchAllDocs } from '../../../lib/fetchAllDocs.js';
|
|
5
5
|
import { usePlacementLabels, placementDetailKey } from '../../placements/usePlacementLabels.js';
|
|
6
|
-
import { placementUncheckedCopy } from '../../copy/readiness.js';
|
|
6
|
+
import { placementUncheckedCopy, scheduleOccupancyCopy } from '../../copy/readiness.js';
|
|
7
7
|
import { useEffect, useId, useState } from 'react';
|
|
8
|
-
import { TextInput, Select } from '../../../ui/Inputs.js';
|
|
8
|
+
import { TextInput, Select, Textarea } from '../../../ui/Inputs.js';
|
|
9
9
|
import { ConfirmDialog } from '../../../ui/Dialog.js';
|
|
10
10
|
import { isDestructiveAction } from '../../actions/actions.model.js';
|
|
11
11
|
import { MakeContentResult } from '../../actions/MakeContentResult.js';
|
|
@@ -20,33 +20,60 @@ import { actionWaitMessage } from './SaveStatus.js';
|
|
|
20
20
|
import { surfaceUrls } from '../../surfaceUrls.js';
|
|
21
21
|
import { Button } from '../../../ui/Button.js';
|
|
22
22
|
import { useTransition } from './useTransition.js';
|
|
23
|
+
import { formatLocalDateTime, isValidTimeZone, parseLocalDateTime } from '../../../schedule/activeTime.js';
|
|
24
|
+
import { COHORT_EDITOR } from '../../copy/cohorts.js';
|
|
25
|
+
import { readCohortRule } from '../../../cohorts/rule.js';
|
|
26
|
+
import { audienceReview, cohortSize } from '../../review/cohortEstimate.js';
|
|
27
|
+
import { SCHEDULE_COPY } from '../../copy/schedule.js';
|
|
28
|
+
import { ScheduleDateInput } from '../test/ScheduleDateInput.js';
|
|
23
29
|
export function dialogTitle(label, test) {
|
|
24
30
|
return test.doc?.name ? actionTitle(label, test.doc.name) : label;
|
|
25
31
|
}
|
|
26
|
-
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */
|
|
32
|
+
/** Prop-driven ConfirmDialog adapter: same model/copy, section reload instead of a page reload. */ const PAUSE_REASON_LIMIT = 500;
|
|
33
|
+
export function ConfirmAction({ test, surface, action, winnerLabel, onClose, onSuccess, unavailable, now = Date.now() }) {
|
|
27
34
|
const api = createApi(surface.apiRoute);
|
|
28
35
|
const [openedPhase] = useState(test.doc?.phase);
|
|
29
36
|
const [openedStatus] = useState(test.doc?.status);
|
|
30
37
|
const confirmationId = useId();
|
|
31
38
|
const [typed, setTyped] = useState('');
|
|
39
|
+
const [pauseReason, setPauseReason] = useState('');
|
|
40
|
+
const configuredZone = test.doc?.schedule?.timeZone || surface.timeZone || test.preflight?.scheduleTimeZone;
|
|
41
|
+
const zone = configuredZone && isValidTimeZone(configuredZone) ? configuredZone : 'UTC';
|
|
42
|
+
const [originalEnd] = useState(test.doc?.schedule?.endAt ?? null);
|
|
43
|
+
const [endAt, setEndAt] = useState(()=>formatLocalDateTime(originalEnd, zone));
|
|
44
|
+
const endInstant = endAt === formatLocalDateTime(originalEnd, zone) ? originalEnd : endAt ? parseLocalDateTime(endAt, zone) : null;
|
|
45
|
+
const endError = action.id !== 'reschedule' || !endAt ? undefined : !endInstant ? SCHEDULE_COPY.invalidTime : Date.parse(endInstant) <= Math.max(now, Date.parse(test.doc?.startedAt ?? '') || 0) ? scheduleOccupancyCopy.reschedulePast : undefined;
|
|
32
46
|
const [content, setContent] = useState(null);
|
|
33
47
|
const [reportBusy, setReportBusy] = useState(false);
|
|
34
48
|
const transition = useTransition(test, ()=>{
|
|
35
49
|
onClose();
|
|
36
50
|
onSuccess?.();
|
|
37
51
|
}, surface, true);
|
|
38
|
-
const changed = test.doc?.phase !== openedPhase || test.doc?.status !== openedStatus;
|
|
39
|
-
const
|
|
52
|
+
const changed = unavailable || test.doc?.phase !== openedPhase || test.doc?.status !== openedStatus || action.id === 'reschedule' && (test.doc?.schedule?.endAt ?? null) !== originalEnd;
|
|
53
|
+
const buildAction = action.id === 'build-cohorts';
|
|
54
|
+
const wait = action.id === 'start' || buildAction ? actionWaitMessage(test) : undefined;
|
|
55
|
+
const [building, setBuilding] = useState(false);
|
|
56
|
+
const [recoverAudience, setRecoverAudience] = useState(false);
|
|
57
|
+
const review = action.id === 'start' && test.doc ? audienceReview((test.doc.targeting ?? []).flatMap((row)=>{
|
|
58
|
+
const rule = readCohortRule(row);
|
|
59
|
+
return rule ? [
|
|
60
|
+
{
|
|
61
|
+
include: rule.include,
|
|
62
|
+
size: cohortSize(rule, test.preflight?.cohortSources?.find((source)=>String(source.id) === rule.experiment))
|
|
63
|
+
}
|
|
64
|
+
] : [];
|
|
65
|
+
}), test.doc.analysis?.minExposuresPerArm ?? 200, test.doc.arms.filter((arm)=>arm.kind !== 'holdout').length) : undefined;
|
|
40
66
|
const phrase = action.confirm.phrase ? expectedConfirm(action.confirm.phrase.action, winnerLabel) : null;
|
|
41
67
|
const ready = action.id !== 'start' || !transition.checking && canStartTest(test, surface.editorPlacementMessage);
|
|
42
68
|
const blocker = action.id === 'start' && !readyToStart(test, surface.editorPlacementMessage) ? test.preflightError ?? (test.doc ? blockingSteps(test.preflight, pageReadinessContext(test.doc, test.preflight, surface))[0]?.sentence : undefined) ?? C.checking : undefined;
|
|
43
69
|
const startMessage = wait ?? blocker;
|
|
44
|
-
const enabled = surface.canManage && !changed && ready && !test.statusReadPending && !transition.busy && !transition.reloadRequired && !wait && (!phrase || matchesConfirm(phrase, typed));
|
|
70
|
+
const enabled = surface.canManage && !changed && ready && !test.statusReadPending && !transition.busy && !transition.reloadRequired && !recoverAudience && !wait && !endError && (!phrase || matchesConfirm(phrase, typed));
|
|
45
71
|
async function submit(finish = false) {
|
|
46
72
|
if (!enabled || !test.doc) return;
|
|
47
73
|
const { id } = test.doc;
|
|
48
74
|
const phase = openedPhase;
|
|
49
75
|
await transition.run(finish ? 'archive' : action.id === 'start' && test.doc.status === 'stopped' ? 'restart' : action.id, async ()=>{
|
|
76
|
+
if (action.id === 'build-cohorts') return api.buildCohorts(id);
|
|
50
77
|
if (finish) return api.archive(id, {
|
|
51
78
|
mode: 'after-content',
|
|
52
79
|
phase
|
|
@@ -58,8 +85,22 @@ export function dialogTitle(label, test) {
|
|
|
58
85
|
confirmation: typed.trim()
|
|
59
86
|
} : {}
|
|
60
87
|
});
|
|
61
|
-
if (action.id === 'start')
|
|
88
|
+
if (action.id === 'start') {
|
|
89
|
+
const result = await api.start(id, openedPhase);
|
|
90
|
+
if (!result.ok && result.code === 'cohort-build-timeout') setRecoverAudience(true);
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
62
93
|
if (action.id === 'stop') return api.stop(id, openedPhase);
|
|
94
|
+
if (action.id === 'pause') return api.pause(id, {
|
|
95
|
+
phase,
|
|
96
|
+
reason: pauseReason.trim() || undefined
|
|
97
|
+
});
|
|
98
|
+
if (action.id === 'resume') return api.resume(id, phase);
|
|
99
|
+
if (action.id === 'cancel-schedule') return api.cancelSchedule(id, phase);
|
|
100
|
+
if (action.id === 'reschedule') return api.reschedule(id, {
|
|
101
|
+
phase,
|
|
102
|
+
endAt: endInstant
|
|
103
|
+
});
|
|
63
104
|
if (action.id === 'release-holdout') return api.releaseHoldout(id, phase);
|
|
64
105
|
const result = await api.makeContent(id, phase);
|
|
65
106
|
if (result.ok && result.data) {
|
|
@@ -81,17 +122,34 @@ export function dialogTitle(label, test) {
|
|
|
81
122
|
closeOnSuccess: finish || action.id !== 'make-content'
|
|
82
123
|
});
|
|
83
124
|
}
|
|
125
|
+
async function buildAudience() {
|
|
126
|
+
if (!test.doc || changed || wait || !surface.canManage || transition.busy) return;
|
|
127
|
+
setBuilding(true);
|
|
128
|
+
const id = test.doc.id;
|
|
129
|
+
try {
|
|
130
|
+
await transition.run('build-cohorts', async ()=>{
|
|
131
|
+
const result = await api.buildCohorts(id);
|
|
132
|
+
if (result.ok) setRecoverAudience(false);
|
|
133
|
+
return result;
|
|
134
|
+
}, {
|
|
135
|
+
closeOnSuccess: false
|
|
136
|
+
});
|
|
137
|
+
} finally{
|
|
138
|
+
setBuilding(false);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
84
141
|
function close() {
|
|
85
142
|
if (transition.busy || reportBusy) return;
|
|
86
143
|
onClose();
|
|
87
144
|
transition.refreshAfterDismissal();
|
|
88
145
|
}
|
|
89
146
|
const label = action.confirm.label ?? action.label;
|
|
147
|
+
const body = action.id === 'resume' && Date.parse(test.doc?.schedule?.endAt ?? '') <= now ? A.resumeEndedBody : action.confirm.body;
|
|
90
148
|
const caveats = action.id === 'start' ? readinessCaveats(test, surface.adminRoute) : [];
|
|
91
149
|
const description = caveats.length ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
92
150
|
children: [
|
|
93
151
|
/*#__PURE__*/ _jsx("p", {
|
|
94
|
-
children:
|
|
152
|
+
children: body
|
|
95
153
|
}),
|
|
96
154
|
/*#__PURE__*/ _jsx("ul", {
|
|
97
155
|
children: caveats.map(({ key, sentence, href })=>/*#__PURE__*/ _jsx("li", {
|
|
@@ -102,14 +160,19 @@ export function dialogTitle(label, test) {
|
|
|
102
160
|
}, key))
|
|
103
161
|
})
|
|
104
162
|
]
|
|
105
|
-
}) :
|
|
163
|
+
}) : body;
|
|
106
164
|
return /*#__PURE__*/ _jsxs(ConfirmDialog, {
|
|
107
165
|
title: action.confirm.title === label ? dialogTitle(label, test) : action.confirm.title,
|
|
108
166
|
onClose: close,
|
|
109
167
|
description: content ? undefined : description,
|
|
110
168
|
busy: transition.busy || reportBusy,
|
|
111
|
-
busyLabel: C.changing,
|
|
169
|
+
busyLabel: buildAction || building ? COHORT_EDITOR.progress : C.changing,
|
|
112
170
|
cancelLabel: content ? A.done : A.cancel,
|
|
171
|
+
secondaryAction: recoverAudience ? /*#__PURE__*/ _jsx(Button, {
|
|
172
|
+
disabled: !!wait || changed || transition.busy,
|
|
173
|
+
onClick: ()=>void buildAudience(),
|
|
174
|
+
children: COHORT_EDITOR.build
|
|
175
|
+
}) : undefined,
|
|
113
176
|
error: transition.error ?? (changed && !transition.busy && !content ? A.actionChanged : null),
|
|
114
177
|
confirm: content ? undefined : {
|
|
115
178
|
label,
|
|
@@ -133,28 +196,54 @@ export function dialogTitle(label, test) {
|
|
|
133
196
|
if (result.ok) test.acceptTransition?.(result.data);
|
|
134
197
|
await test.reload();
|
|
135
198
|
}
|
|
136
|
-
}) : /*#__PURE__*/
|
|
137
|
-
children:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
199
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
200
|
+
children: [
|
|
201
|
+
phrase ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
202
|
+
children: [
|
|
203
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
204
|
+
children: [
|
|
205
|
+
A.typePhrase,
|
|
206
|
+
" ",
|
|
207
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
208
|
+
children: phrase
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
213
|
+
id: confirmationId,
|
|
214
|
+
label: A.confirmation,
|
|
215
|
+
value: typed,
|
|
216
|
+
readOnly: transition.busy,
|
|
217
|
+
onChange: (event)=>setTyped(event.target.value)
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
}) : null,
|
|
221
|
+
action.id === 'pause' ? /*#__PURE__*/ _jsx(Textarea, {
|
|
222
|
+
id: confirmationId,
|
|
223
|
+
label: A.pauseReason,
|
|
224
|
+
value: pauseReason,
|
|
225
|
+
maxLength: PAUSE_REASON_LIMIT,
|
|
226
|
+
help: A.pauseCount(pauseReason.length, PAUSE_REASON_LIMIT),
|
|
227
|
+
readOnly: transition.busy,
|
|
228
|
+
onChange: (event)=>setPauseReason(event.target.value.slice(0, PAUSE_REASON_LIMIT))
|
|
229
|
+
}) : null,
|
|
230
|
+
action.id === 'reschedule' ? /*#__PURE__*/ _jsx(ScheduleDateInput, {
|
|
231
|
+
label: SCHEDULE_COPY.end,
|
|
232
|
+
timeZone: zone,
|
|
233
|
+
value: endAt,
|
|
234
|
+
error: endError,
|
|
235
|
+
readOnly: transition.busy,
|
|
236
|
+
onChange: (event)=>setEndAt(event.target.value)
|
|
237
|
+
}) : null
|
|
238
|
+
]
|
|
157
239
|
}),
|
|
240
|
+
review?.lines.map((line, index)=>/*#__PURE__*/ _jsx("p", {
|
|
241
|
+
children: line
|
|
242
|
+
}, index)),
|
|
243
|
+
review?.warning ? /*#__PURE__*/ _jsx("p", {
|
|
244
|
+
className: "xp-ui-help",
|
|
245
|
+
children: review.warning
|
|
246
|
+
}) : null,
|
|
158
247
|
!content && startMessage && startMessage !== transition.error ? /*#__PURE__*/ _jsx("p", {
|
|
159
248
|
children: startMessage
|
|
160
249
|
}) : null
|
|
@@ -256,7 +345,7 @@ export function dialogTitle(label, test) {
|
|
|
256
345
|
const available = metrics.filter((item)=>!attached.has(String(item.id)));
|
|
257
346
|
const empty = !loading && !loadError && !available.length;
|
|
258
347
|
const selected = available.find((item)=>String(item.id) === metric);
|
|
259
|
-
const changed = test.doc?.status !== 'running' || test.doc?.phase !== openedPhase;
|
|
348
|
+
const changed = test.doc?.status !== 'running' && test.doc?.status !== 'paused' || test.doc?.phase !== openedPhase;
|
|
260
349
|
const disabled = transition.busy || test.statusReadPending || changed || transition.reloadRequired && transition.error !== API_MESSAGES.goalNotFound;
|
|
261
350
|
function close() {
|
|
262
351
|
if (transition.busy) return;
|
|
@@ -5,12 +5,14 @@ import { useEffect, useState } from 'react';
|
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
6
|
import { actionWaitMessage, SaveStatus, saveStatusMessage } from './SaveStatus.js';
|
|
7
7
|
import { jumpToSection } from '../test/jumpToSection.js';
|
|
8
|
-
import { actionGroupLabel, availableActions } from '../../actions/actions.model.js';
|
|
8
|
+
import { actionGroupLabel, availableActions, buildAudienceAction } from '../../actions/actions.model.js';
|
|
9
9
|
import { createApi } from '../../api.js';
|
|
10
10
|
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
11
11
|
import { READINESS_COPY as C, decidedCopy, fixFieldsNext, runningCopy, stoppedCopy } from '../../copy/readiness.js';
|
|
12
|
+
import { useScheduleClock } from '../../format/useScheduleClock.js';
|
|
13
|
+
import { scheduleStatus } from '../../format/scheduleStatus.js';
|
|
12
14
|
import { useDateFormatter } from '../../format/useDateFormatter.js';
|
|
13
|
-
import {
|
|
15
|
+
import { testProgress, displayDate, blockingSteps, pageReadinessContext, errorSection, readinessCaveats } from './readiness.model.js';
|
|
14
16
|
import { LifecycleButton, LifecycleDialog } from '../../actions/LifecycleAction.js';
|
|
15
17
|
import { preflightPlacementLabel } from '../../placements/placementLabels.js';
|
|
16
18
|
import { BlockerList } from './BlockerList.js';
|
|
@@ -19,19 +21,24 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
|
|
|
19
21
|
const [selected, setSelected] = useState(null);
|
|
20
22
|
const [audience, setAudience] = useState();
|
|
21
23
|
const doc = test.doc;
|
|
22
|
-
const
|
|
24
|
+
const summary = audience?.phase === doc.phase ? audience?.summary : undefined;
|
|
25
|
+
const now = useScheduleClock([
|
|
26
|
+
doc
|
|
27
|
+
], surface.timeZone);
|
|
28
|
+
const schedule = scheduleStatus(doc, now, test.preflight?.timing ?? summary?.timing, surface.timeZone, test.preflight?.pauseAttribution);
|
|
29
|
+
const progress = schedule.status === 'running' ? testProgress(doc, now, summary?.timing) : null;
|
|
23
30
|
useEffect(()=>{
|
|
24
31
|
let active = true;
|
|
25
32
|
// Refreshes retain the last count for this round while loading.
|
|
26
|
-
if (surface.canReadResults &&
|
|
33
|
+
if (surface.canReadResults && (schedule.status === 'running' || schedule.status === 'paused')) {
|
|
27
34
|
void Promise.resolve().then(()=>active ? createApi(surface.apiRoute).summary([
|
|
28
35
|
doc.id
|
|
29
36
|
]) : undefined).then((result)=>{
|
|
30
37
|
if (!result?.ok) return;
|
|
31
|
-
const
|
|
32
|
-
if (active &&
|
|
38
|
+
const next = result.data?.[doc.id];
|
|
39
|
+
if (active && next && Number.isFinite(next.exposures)) setAudience({
|
|
33
40
|
phase: doc.phase,
|
|
34
|
-
|
|
41
|
+
summary: next
|
|
35
42
|
});
|
|
36
43
|
}).catch(()=>{});
|
|
37
44
|
}
|
|
@@ -40,7 +47,7 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
|
|
|
40
47
|
};
|
|
41
48
|
}, [
|
|
42
49
|
doc.id,
|
|
43
|
-
|
|
50
|
+
schedule.status,
|
|
44
51
|
doc.phase,
|
|
45
52
|
surface.apiRoute,
|
|
46
53
|
surface.canReadResults,
|
|
@@ -93,13 +100,15 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
|
|
|
93
100
|
const actions = availableActions({
|
|
94
101
|
...doc,
|
|
95
102
|
decision,
|
|
103
|
+
now,
|
|
104
|
+
timeZone: surface.timeZone,
|
|
96
105
|
canManage: surface.canManage,
|
|
97
106
|
canReadResults: surface.canReadResults
|
|
98
107
|
}).filter((action)=>action.id !== 'delete' && (!embedded || ![
|
|
99
108
|
'decide',
|
|
100
109
|
'release-pages'
|
|
101
110
|
].includes(action.id)));
|
|
102
|
-
const sentence = test.statusReadPending ? C.checking : setup ? ready && !blockers.length ? C.ready : null :
|
|
111
|
+
const sentence = test.statusReadPending ? C.checking : setup ? ready && !blockers.length ? C.ready : null : progress ? runningCopy(displayDate(doc.startedAt, formatDate), summary?.exposures ?? null, progress.daysToGo, progress.weekendsToGo) : doc.status === 'decided' ? decidedCopy(displayDate(doc.decidedAt, formatDate), winner) : doc.status === 'archived' ? C.archived : null;
|
|
103
112
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
104
113
|
children: [
|
|
105
114
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -143,15 +152,19 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
|
|
|
143
152
|
role: "status",
|
|
144
153
|
children: sentence
|
|
145
154
|
}) : null,
|
|
155
|
+
!test.statusReadPending && embedded && schedule.line ? /*#__PURE__*/ _jsx("p", {
|
|
156
|
+
role: "status",
|
|
157
|
+
children: schedule.line
|
|
158
|
+
}) : null,
|
|
146
159
|
setup ? /*#__PURE__*/ _jsx(BlockerList, {
|
|
147
160
|
steps: blockers,
|
|
148
161
|
renderSentence: (_, index)=>{
|
|
149
162
|
const step = blockers[index];
|
|
150
163
|
return step.section === 'header' ? step.sentence : /*#__PURE__*/ _jsx("a", {
|
|
151
|
-
href: `#section-${step.section}`,
|
|
164
|
+
href: step.rule === undefined ? `#section-${step.section}` : `#xp-targeting-${step.rule}`,
|
|
152
165
|
onClick: (event)=>{
|
|
153
166
|
event.preventDefault();
|
|
154
|
-
if (step.section !== 'header') jumpToSection(step.section, step.arm);
|
|
167
|
+
if (step.section !== 'header') jumpToSection(step.section, step.arm, step.rule, event.currentTarget.ownerDocument);
|
|
155
168
|
},
|
|
156
169
|
children: step.sentence
|
|
157
170
|
});
|
|
@@ -170,6 +183,11 @@ export function ReadinessContent({ test, surface, resultsVersion, embedded = fal
|
|
|
170
183
|
},
|
|
171
184
|
children: C.refresh
|
|
172
185
|
}) : null,
|
|
186
|
+
setup && surface.canManage && readinessBlockers.some((step)=>step.code === 'cohort-build-timeout') ? /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
187
|
+
action: buildAudienceAction,
|
|
188
|
+
disabled: !!wait || test.statusReadPending || test.preflightPending,
|
|
189
|
+
onClick: ()=>setSelected(buildAudienceAction)
|
|
190
|
+
}) : null,
|
|
173
191
|
actions.map((item)=>{
|
|
174
192
|
if (test.statusReadPending) return null;
|
|
175
193
|
const reason = item.id === 'start' ? startReason : item.unavailable;
|