@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
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import type { ArmKind, DocId, ExperimentKind, ExposurePolicy, MetricSource, ResolvedOptions, Status } from './contracts.js';
|
|
1
|
+
import type { ArmKey, ArmKind, UnitType, DocId, ExperimentKind, ExposurePolicy, MetricSource, ResolvedOptions, Status } from './contracts.js';
|
|
2
2
|
import type { ContentReportReason } from './reasons.js';
|
|
3
3
|
import type { ArmSlot } from './puck.js';
|
|
4
4
|
import type { ReadinessCode } from '../transitions/checkStart.js';
|
|
5
5
|
export type { ReadinessCode } from '../transitions/checkStart.js';
|
|
6
6
|
import type { Snapshot, VerdictCode } from './snapshot.js';
|
|
7
|
+
import type { CohortReadinessCode } from '../cohorts/readiness.js';
|
|
8
|
+
import type { RoundTiming } from '../schedule/types.js';
|
|
7
9
|
export type ArmIssueCode = 'weights-total' | 'control-count' | 'control-first' | 'holdout-last' | 'holdout-count' | 'variant-count' | 'duplicate-key' | 'duplicate-slot' | 'slot-required' | 'invalid-key';
|
|
8
10
|
/** Content-report dismiss/restore refusals (CORE-44). */
|
|
9
11
|
export type ContentEntryRefusal = 'not-decided' | 'entry-not-found' | 'entry-ok' | 'entry-dismissed' | 'entry-not-dismissed';
|
|
10
|
-
export type
|
|
12
|
+
export type OccupiedInRangeDetail = {
|
|
13
|
+
otherTestId: DocId;
|
|
14
|
+
otherTestName: string;
|
|
15
|
+
from: string;
|
|
16
|
+
to: string | null;
|
|
17
|
+
place?: 'page' | 'setting' | 'traffic group';
|
|
18
|
+
timeZone?: string;
|
|
19
|
+
};
|
|
20
|
+
type ScheduleRefusal = 'not-live' | 'not-pausable' | 'paused' | 'schedule-invalid' | 'reschedule-past' | 'schedule-started';
|
|
21
|
+
export type RefusalCode = ArmIssueCode | CohortReadinessCode | 'cohort-build-timeout' | 'copy-unavailable' | 'copy-not-enabled' | 'copy-no-access' | 'copy-unique-field' | 'copy-orphaned' | 'transaction-lost' | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'occupied-in-range' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | ScheduleRefusal | 'invalid-status' | 'first-start-only' | 'stale-draft' | 'stale-edit' | 'round-changed' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
|
|
11
22
|
export type ErrorEnvelope = {
|
|
12
23
|
errors: Array<{
|
|
13
24
|
code: RefusalCode;
|
|
@@ -60,6 +71,12 @@ export type AddMetricBody = RoundBody & {
|
|
|
60
71
|
export type RoundBody = {
|
|
61
72
|
phase?: number;
|
|
62
73
|
};
|
|
74
|
+
export type PauseBody = RoundBody & {
|
|
75
|
+
reason?: string;
|
|
76
|
+
};
|
|
77
|
+
export type RescheduleBody = RoundBody & {
|
|
78
|
+
endAt: string | null;
|
|
79
|
+
};
|
|
63
80
|
export type AllocateBody = RoundBody & {
|
|
64
81
|
allocation: number;
|
|
65
82
|
};
|
|
@@ -93,18 +110,30 @@ export type MakeContentResult = TransitionSuccess & {
|
|
|
93
110
|
dismissedBy?: string | null;
|
|
94
111
|
}>;
|
|
95
112
|
};
|
|
113
|
+
export type PauseAttribution = {
|
|
114
|
+
name: string;
|
|
115
|
+
pausedAt: string | null;
|
|
116
|
+
};
|
|
96
117
|
export type PreflightResult = {
|
|
97
118
|
/** Saved document version used for these checks. */
|
|
98
119
|
document?: {
|
|
99
120
|
status: Status;
|
|
100
121
|
phase?: number;
|
|
101
122
|
updatedAt?: string;
|
|
123
|
+
pausedAt?: string | null;
|
|
102
124
|
};
|
|
125
|
+
pauseAttribution?: PauseAttribution;
|
|
126
|
+
pauseLookupSkipped?: true;
|
|
103
127
|
/** Content language selection and labels when block placements are localized. */
|
|
104
128
|
contentLocales?: {
|
|
105
129
|
selected: string;
|
|
106
130
|
labels: Record<string, string>;
|
|
107
131
|
};
|
|
132
|
+
cohortSources?: CohortSourceOption[];
|
|
133
|
+
cohortSummaries?: Array<{
|
|
134
|
+
rule: import('../cohorts/rule.js').CohortRule;
|
|
135
|
+
summary: string;
|
|
136
|
+
}>;
|
|
108
137
|
goalNotes?: Array<{
|
|
109
138
|
metricId: DocId;
|
|
110
139
|
message: string;
|
|
@@ -149,6 +178,8 @@ export type PreflightResult = {
|
|
|
149
178
|
days: 28;
|
|
150
179
|
} | null;
|
|
151
180
|
trafficPerDay: number | null;
|
|
181
|
+
scheduleTimeZone?: string;
|
|
182
|
+
timing?: RoundTiming;
|
|
152
183
|
estimate: {
|
|
153
184
|
weeks: number;
|
|
154
185
|
plannedDurationDays: number;
|
|
@@ -156,15 +187,50 @@ export type PreflightResult = {
|
|
|
156
187
|
feasible: boolean;
|
|
157
188
|
} | null;
|
|
158
189
|
};
|
|
190
|
+
export interface CohortEstimate {
|
|
191
|
+
computedAt: string;
|
|
192
|
+
perArm: Partial<Record<ArmKey, {
|
|
193
|
+
exposed: number;
|
|
194
|
+
converters: Record<string, number>;
|
|
195
|
+
}>>;
|
|
196
|
+
}
|
|
197
|
+
export interface CohortSourceRound {
|
|
198
|
+
/** null: the manager cannot read this test's rounds (xp-phases access), so only "Latest round" is offered. */
|
|
199
|
+
phase: number | null;
|
|
200
|
+
startedAt: string | null;
|
|
201
|
+
endedAt: string | null;
|
|
202
|
+
closedAt: string | null;
|
|
203
|
+
arms: Array<{
|
|
204
|
+
key: ArmKey;
|
|
205
|
+
label: string;
|
|
206
|
+
kind: ArmKind;
|
|
207
|
+
}>;
|
|
208
|
+
goals: Array<{
|
|
209
|
+
metricId: DocId;
|
|
210
|
+
name: string;
|
|
211
|
+
}>;
|
|
212
|
+
estimate?: CohortEstimate;
|
|
213
|
+
}
|
|
214
|
+
export interface CohortSourceOption {
|
|
215
|
+
id: DocId;
|
|
216
|
+
name: string;
|
|
217
|
+
status: Status | 'scheduled';
|
|
218
|
+
unitType: UnitType;
|
|
219
|
+
rounds: CohortSourceRound[];
|
|
220
|
+
}
|
|
221
|
+
export type CohortSourcesResult = {
|
|
222
|
+
docs: CohortSourceOption[];
|
|
223
|
+
};
|
|
159
224
|
export type PreviewTokenResult = {
|
|
160
225
|
token: string;
|
|
161
226
|
};
|
|
162
|
-
export interface PhaseSummary {
|
|
227
|
+
export interface PhaseSummary extends RoundTiming {
|
|
163
228
|
phase: number;
|
|
164
229
|
phaseKind: 'test' | 'rollout';
|
|
165
230
|
startedAt: string;
|
|
166
231
|
endedAt: string | null;
|
|
167
232
|
plannedDurationDays?: number;
|
|
233
|
+
cohortSummaries?: string[];
|
|
168
234
|
arms: Array<{
|
|
169
235
|
key: string;
|
|
170
236
|
label: string;
|
|
@@ -211,6 +277,9 @@ export type SummaryResponse = Record<DocId, {
|
|
|
211
277
|
detail?: unknown;
|
|
212
278
|
};
|
|
213
279
|
health?: import('./snapshot.js').SnapshotHealth[];
|
|
280
|
+
timing?: RoundTiming & {
|
|
281
|
+
phase: number;
|
|
282
|
+
};
|
|
214
283
|
exposures: number;
|
|
215
284
|
days: number;
|
|
216
285
|
verdict: {
|
package/dist/types/manifest.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Arm, DocId, ExposurePolicy, ExperimentKind, TargetingRule, UnitType } from './contracts.js';
|
|
2
|
+
import type { ActiveSpec } from '../schedule/types.js';
|
|
2
3
|
export interface FlagDefault {
|
|
3
4
|
winnerArm: string;
|
|
4
5
|
params: Record<string, unknown>;
|
|
@@ -31,10 +32,18 @@ export interface ManifestExperiment {
|
|
|
31
32
|
targeting: Array<TargetingRule & {
|
|
32
33
|
type: 'string' | 'number' | 'boolean';
|
|
33
34
|
}>;
|
|
35
|
+
cohorts?: Array<{
|
|
36
|
+
key: string;
|
|
37
|
+
include: boolean;
|
|
38
|
+
sourceClosedAt: string | null;
|
|
39
|
+
}>;
|
|
34
40
|
layer?: {
|
|
35
41
|
slug: string;
|
|
36
42
|
slices: number[];
|
|
37
43
|
};
|
|
44
|
+
active?: ActiveSpec;
|
|
45
|
+
/** Lower bound for requests validated after the most recent resume. */
|
|
46
|
+
resumedAt?: string;
|
|
38
47
|
exposurePolicy: ExposurePolicy;
|
|
39
48
|
winnerArm?: string;
|
|
40
49
|
holdoutKey?: string;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Payload } from 'payload';
|
|
|
2
2
|
import type { NextRequest } from 'next/server';
|
|
3
3
|
import type { Attributes } from './contracts.js';
|
|
4
4
|
import type { Manifest } from './manifest.js';
|
|
5
|
+
import type { CohortLookup } from '../runtime/cohortLookup.js';
|
|
5
6
|
type CookieOptions = {
|
|
6
7
|
name?: string;
|
|
7
8
|
maxAgeDays?: number;
|
|
@@ -20,6 +21,7 @@ export interface ExperimentsProxyRuntimeOptions {
|
|
|
20
21
|
loadManifest?: (opts?: {
|
|
21
22
|
ifRevision?: number;
|
|
22
23
|
}) => Promise<Manifest | 'not-modified' | null>;
|
|
24
|
+
lookupCohorts?: CohortLookup;
|
|
23
25
|
getUnit?: (req: NextRequest) => {
|
|
24
26
|
userId?: string;
|
|
25
27
|
attributes: Attributes;
|
|
@@ -31,6 +33,8 @@ export interface ExperimentsProxyRuntimeOptions {
|
|
|
31
33
|
}>;
|
|
32
34
|
}
|
|
33
35
|
export interface ExperimentsProxyRuntime {
|
|
36
|
+
/** @internal Clock shared by assignment and exposure validation. */
|
|
37
|
+
readonly now?: () => Date;
|
|
34
38
|
readonly secrets: readonly string[];
|
|
35
39
|
readonly apiRoute: string;
|
|
36
40
|
readonly rateLimitUnit: ExperimentsProxyRuntimeOptions['rateLimitUnit'];
|
|
@@ -39,6 +43,7 @@ export interface ExperimentsProxyRuntime {
|
|
|
39
43
|
maxAgeDays: number;
|
|
40
44
|
};
|
|
41
45
|
readonly loadManifest?: ExperimentsProxyRuntimeOptions['loadManifest'];
|
|
46
|
+
readonly lookupCohorts?: CohortLookup;
|
|
42
47
|
readonly getUnit?: ExperimentsProxyRuntimeOptions['getUnit'];
|
|
43
48
|
}
|
|
44
49
|
export interface ExperimentsServerRuntimeOptions<TUser extends {
|
package/dist/types/snapshot.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ export type SnapshotHealth = {
|
|
|
14
14
|
};
|
|
15
15
|
} | {
|
|
16
16
|
code: 'rapid-browser-events';
|
|
17
|
+
} | {
|
|
18
|
+
code: 'cohort-no-exposures';
|
|
19
|
+
} | {
|
|
20
|
+
code: 'paused-share';
|
|
21
|
+
pausedDays: number;
|
|
22
|
+
} | {
|
|
23
|
+
code: 'schedule-population';
|
|
24
|
+
summary: string;
|
|
17
25
|
};
|
|
18
26
|
import type { GaussianPrior } from '@delmaredigital/experiments-stats';
|
|
19
27
|
import type { DocId, MetricSource } from './contracts.js';
|
|
@@ -34,6 +42,7 @@ export interface Snapshot {
|
|
|
34
42
|
alpha: number;
|
|
35
43
|
alphaAdjusted: number;
|
|
36
44
|
k: number;
|
|
45
|
+
activeDays?: number;
|
|
37
46
|
params: {
|
|
38
47
|
sequentialTuningParameter: number;
|
|
39
48
|
prior: GaussianPrior;
|
|
@@ -56,6 +65,7 @@ export interface Snapshot {
|
|
|
56
65
|
total: number;
|
|
57
66
|
perArm: Record<string, number>;
|
|
58
67
|
excludedMultiArm: number;
|
|
68
|
+
cohortExits: number;
|
|
59
69
|
multiArmShare: number;
|
|
60
70
|
armMismatch: number;
|
|
61
71
|
identityConflictShare: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Status = 'draft' | 'running' | 'paused' | 'stopped' | 'decided' | 'archived';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/types/surface.d.ts
CHANGED
package/dist/ui/Feedback.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import './ui.css';
|
|
3
3
|
export declare const statusLabels: {
|
|
4
|
-
readonly draft: "Draft";
|
|
5
4
|
readonly ready: "Ready";
|
|
6
|
-
readonly running: "Running";
|
|
7
5
|
readonly 'needs-attention': "Needs attention";
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly stopped:
|
|
6
|
+
readonly draft: string;
|
|
7
|
+
readonly running: string;
|
|
8
|
+
readonly stopped: string;
|
|
9
|
+
readonly decided: string;
|
|
10
|
+
readonly archived: string;
|
|
11
|
+
readonly scheduled: string;
|
|
12
|
+
readonly paused: string;
|
|
11
13
|
};
|
|
12
14
|
export type UIStatus = keyof typeof statusLabels;
|
|
13
|
-
export declare function StatusChip({ status }: {
|
|
15
|
+
export declare function StatusChip({ status, startedAt }: {
|
|
14
16
|
status: UIStatus;
|
|
17
|
+
startedAt?: string | null;
|
|
15
18
|
}): import("react").JSX.Element;
|
|
16
19
|
export declare function Banner({ tone, children, action }: {
|
|
17
20
|
tone?: 'info' | 'warning' | 'error';
|
package/dist/ui/Feedback.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { STATUS_LABELS, displayStatus } from '../labels/status.js';
|
|
2
3
|
import './ui.css';
|
|
3
4
|
export const statusLabels = {
|
|
4
|
-
|
|
5
|
+
...STATUS_LABELS,
|
|
5
6
|
ready: 'Ready',
|
|
6
|
-
|
|
7
|
-
'needs-attention': 'Needs attention',
|
|
8
|
-
decided: 'Decided',
|
|
9
|
-
archived: 'Archived',
|
|
10
|
-
stopped: 'Stopped'
|
|
7
|
+
'needs-attention': 'Needs attention'
|
|
11
8
|
};
|
|
12
|
-
export function StatusChip({ status }) {
|
|
9
|
+
export function StatusChip({ status, startedAt }) {
|
|
10
|
+
const shown = status === 'running' ? displayStatus({
|
|
11
|
+
status,
|
|
12
|
+
startedAt
|
|
13
|
+
}) : status;
|
|
13
14
|
return /*#__PURE__*/ _jsx("span", {
|
|
14
|
-
className: `xp-ui-status xp-ui-status--${
|
|
15
|
-
children: statusLabels[
|
|
15
|
+
className: `xp-ui-status xp-ui-status--${shown}`,
|
|
16
|
+
children: statusLabels[shown]
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
export function Banner({ tone = 'info', children, action }) {
|
package/dist/ui/SelectControl.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Children, isValidElement, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
|
-
import { INPUT_COPY } from '../testSurface/copy/
|
|
5
|
+
import { INPUT_COPY } from '../testSurface/copy/inputs.js';
|
|
6
6
|
function optionText(children) {
|
|
7
7
|
return Children.toArray(children).map((child)=>/*#__PURE__*/ isValidElement(child) ? optionText(child.props.children) : String(child)).join('');
|
|
8
8
|
}
|
package/dist/ui/ui.css
CHANGED
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
.xp-ui-tabpanel { padding-block: 16px; }
|
|
56
56
|
.xp-ui-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--xp-radius-chip); border: 1px solid var(--xp-border-strong); background: var(--xp-surface-2); color: var(--xp-text-2); font: 500 12px/18px var(--xp-font); white-space: nowrap; }
|
|
57
57
|
.xp-ui-status--running, .xp-ui-status--ready { background: var(--xp-success-bg); color: var(--xp-success); border-color: var(--xp-success-border); }
|
|
58
|
-
.xp-ui-status--needs-attention { background: var(--xp-warning-bg); color: var(--xp-warning); border-color: var(--xp-warning-border); }
|
|
58
|
+
.xp-ui-status--needs-attention, .xp-ui-status--paused { background: var(--xp-warning-bg); color: var(--xp-warning); border-color: var(--xp-warning-border); }
|
|
59
|
+
.xp-ui-status--scheduled { color: var(--xp-accent-text); }
|
|
59
60
|
.xp-ui-status--decided { background: var(--xp-text); color: var(--xp-surface); border-color: var(--xp-text); }
|
|
60
61
|
.xp-ui-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-control); background: var(--xp-surface-2); color: var(--xp-text); font: var(--xp-text-body); }
|
|
61
62
|
.xp-ui-banner p, .xp-ui-empty p { margin: 0; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delmaredigital/payload-experiments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "No-code A/B testing for Payload CMS and Next.js: block, page and flag experiments with holdouts, layers, exposure logging and honest statistics inside the admin — no vendor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"bugs": {
|
|
126
126
|
"url": "https://github.com/delmaredigital/payload-experiments/issues"
|
|
127
127
|
},
|
|
128
|
-
"homepage": "https://delmaredigital.com/
|
|
128
|
+
"homepage": "https://plugins.delmaredigital.com/experiments",
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@delmaredigital/payload-puck": "0.12.5",
|
|
131
131
|
"payload": "^3.90.2",
|