@delmaredigital/payload-experiments 0.4.0-rc.10 → 0.4.0-rc.11
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/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/copy/blocks.js +3 -3
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +3 -2
- package/dist/admin/copy/newTest.js +3 -2
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +25 -3
- package/dist/admin/surface/TestRowMenu.d.ts +7 -0
- package/dist/admin/surface/TestRowMenu.js +9 -2
- package/dist/admin/surface/TestsHome.js +8 -1
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -191
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +1 -0
- package/dist/admin/surface/home.model.js +5 -1
- package/dist/admin/surface/newTest/NewTest.js +56 -29
- package/dist/admin/surface/newTest/PageWizard.d.ts +3 -1
- package/dist/admin/surface/newTest/PageWizard.js +14 -14
- package/dist/admin/surface/newTest/newTest.css +3 -3
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +69 -41
- package/dist/admin/surface/surface.css +20 -1
- package/dist/admin/surface/test/TestPage.js +46 -34
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +1 -1
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/serialize.js +3 -2
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/plugin.js +51 -1
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +96 -43
- package/dist/puck/editor/QuickTestActions.d.ts +2 -2
- package/dist/puck/editor/QuickTestActions.js +42 -27
- package/dist/puck/editor/ResultsReadout.d.ts +3 -1
- package/dist/puck/editor/ResultsReadout.js +28 -16
- package/dist/puck/editor/VersionBuilder.d.ts +2 -1
- package/dist/puck/editor/VersionBuilder.js +14 -8
- package/dist/puck/editor/copy.d.ts +3 -3
- package/dist/puck/editor/copy.js +4 -4
- package/dist/puck/editor/editor.chrome.css +9 -1
- package/dist/puck/editor/editor.css +10 -1
- package/dist/puck/nestedTestCopy.js +1 -1
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/verdict.d.ts +1 -1
- package/dist/results/verdict.js +7 -6
- package/dist/server/runResults.js +2 -1
- package/dist/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +3 -2
- package/dist/testSurface/actions/DecideDialog.js +21 -12
- package/dist/testSurface/actions/LifecycleAction.d.ts +2 -1
- package/dist/testSurface/actions/LifecycleAction.js +3 -1
- package/dist/testSurface/actions/actions.model.js +6 -5
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/copy/actions.d.ts +12 -9
- package/dist/testSurface/copy/actions.js +12 -9
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +2 -2
- package/dist/testSurface/copy/common.js +2 -2
- package/dist/testSurface/copy/metrics.d.ts +6 -0
- package/dist/testSurface/copy/metrics.js +8 -0
- package/dist/testSurface/copy/readiness.d.ts +3 -3
- package/dist/testSurface/copy/readiness.js +5 -5
- package/dist/testSurface/copy/recommendation.d.ts +4 -4
- package/dist/testSurface/copy/recommendation.js +4 -4
- package/dist/testSurface/copy/results.d.ts +13 -9
- package/dist/testSurface/copy/results.js +15 -9
- package/dist/testSurface/copy/review.d.ts +12 -9
- package/dist/testSurface/copy/review.js +13 -9
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.js +1 -1
- package/dist/testSurface/copy/testPage.d.ts +13 -9
- package/dist/testSurface/copy/testPage.js +16 -13
- package/dist/testSurface/format/date.d.ts +1 -0
- package/dist/testSurface/format/date.js +11 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/results/results.model.d.ts +3 -2
- package/dist/testSurface/results/results.model.js +10 -9
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
- package/dist/testSurface/surface/pageBlock/parts.js +17 -7
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +0 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +1 -1
- package/dist/testSurface/surface/readiness/ActionDialogs.js +54 -33
- package/dist/testSurface/surface/readiness/Banner.d.ts +3 -1
- package/dist/testSurface/surface/readiness/Banner.js +86 -75
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +5 -2
- package/dist/testSurface/surface/readiness/SaveStatus.js +8 -7
- package/dist/testSurface/surface/readiness/readiness.model.js +1 -1
- package/dist/testSurface/surface/results/ResultsBody.d.ts +4 -1
- package/dist/testSurface/surface/results/ResultsBody.js +119 -80
- package/dist/testSurface/surface/results/recommendation.model.js +3 -3
- package/dist/testSurface/surface/setting/parts.js +31 -28
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +10 -4
- package/dist/testSurface/surface/test/GoalSection.js +11 -11
- package/dist/testSurface/surface/test/LengthSection.js +20 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +7 -7
- package/dist/testSurface/surface/test/ReadinessBar.d.ts +1 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +7 -2
- package/dist/testSurface/surface/test/VersionsSection.js +88 -68
- package/dist/testSurface/surface/test/fields.d.ts +4 -3
- package/dist/testSurface/surface/test/fields.js +10 -16
- package/dist/testSurface/surface/test/pageParts.js +3 -1
- package/dist/testSurface/surface/test/testPage.css +9 -1
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/ui/Dialog.js +25 -0
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +1 -0
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { theme } from '../../theme.js';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useEffect, useId, useRef, useState } from 'react';
|
|
5
5
|
import { Button } from '../../../ui/Button.js';
|
|
6
6
|
import { Select } from '../../../ui/Inputs.js';
|
|
7
|
-
import { RESULTS_COPY as C } from '../../copy/results.js';
|
|
8
|
-
import { formatDate } from '../../format/date.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { RESULTS_COPY as C, daysOfPlan, percentileCapHelp, revenueCapHelp } from '../../copy/results.js';
|
|
8
|
+
import { formatDate, relativeTime } from '../../format/date.js';
|
|
9
|
+
import { TEST_PAGE } from '../../copy/testPage.js';
|
|
10
|
+
import { LifecycleButton } from '../../actions/LifecycleAction.js';
|
|
11
|
+
import { percentileTail } from '../../copy/metrics.js';
|
|
11
12
|
import { API_MESSAGES } from '../../copy/common.js';
|
|
12
13
|
import { armLabel } from '../../labels.js';
|
|
13
14
|
import { PreviewLinks } from '../../PreviewLinks.js';
|
|
@@ -15,8 +16,7 @@ import { actionablePreviewPages } from '../../previewLinks.model.js';
|
|
|
15
16
|
import { VerdictHero } from '../../results/VerdictHero.js';
|
|
16
17
|
import { StatTile } from '../../results/StatTile.js';
|
|
17
18
|
import { DataTable, Swatch } from '../../results/DataTable.js';
|
|
18
|
-
import {
|
|
19
|
-
import { formatCount, formatPercent } from '../../results/format.js';
|
|
19
|
+
import { formatCount, formatCurrency, formatPercent } from '../../results/format.js';
|
|
20
20
|
import { DataQualityPanel } from '../../results/DataQualityPanel.js';
|
|
21
21
|
import { CiChart } from '../../results/CiChart.js';
|
|
22
22
|
import { armRows, collectingLine, dataQuality, defaultRound, guardrailChips, powerLine, rolloutLine, roundOptions, verdictCard } from '../../results/results.model.js';
|
|
@@ -54,6 +54,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
54
54
|
const mounted = useRef(true);
|
|
55
55
|
const [actionError, setActionError] = useState(null);
|
|
56
56
|
const [deciding, setDeciding] = useState(null);
|
|
57
|
+
const previewId = useId();
|
|
57
58
|
const [releasing, setReleasing] = useState(null);
|
|
58
59
|
useEffect(()=>{
|
|
59
60
|
mounted.current = true;
|
|
@@ -115,11 +116,13 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
115
116
|
const showingDecision = isDecidedTestRound && Boolean(data?.decisionSnapshot);
|
|
116
117
|
const shown = showingDecision ? data.decisionSnapshot : snapshot;
|
|
117
118
|
const winner = phase?.arms.find((arm)=>arm.key === decision?.winnerArm)?.label ?? armLabel(decision?.winnerArm ?? 'control');
|
|
119
|
+
const control = phase?.arms.find((arm)=>arm.kind === 'control') ?? phases.find((item)=>item.phase === decision?.phase)?.arms.find((arm)=>arm.kind === 'control');
|
|
118
120
|
const card = shown ? verdictCard({
|
|
119
121
|
snapshot: shown,
|
|
120
122
|
decisionSnapshot: data?.decisionSnapshot,
|
|
121
123
|
isDecidedTestRound,
|
|
122
|
-
winnerLabel: winner
|
|
124
|
+
winnerLabel: winner,
|
|
125
|
+
controlLabel: control?.label
|
|
123
126
|
}) : null;
|
|
124
127
|
const placementLabels = usePlacementLabels({
|
|
125
128
|
details: shown?.health?.filter((item)=>item.code === 'placement-unchecked').map((item)=>item.detail) ?? [],
|
|
@@ -148,47 +151,78 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
148
151
|
const primary = phase?.metrics.find((metric)=>metric.role === 'primary');
|
|
149
152
|
// The endpoint decides the current round; historical rounds are read-only.
|
|
150
153
|
const managerDoc = liveDocument ?? doc;
|
|
151
|
-
const lifecycle = availableActions({
|
|
154
|
+
const lifecycle = managerDoc || data ? availableActions({
|
|
155
|
+
...managerDoc,
|
|
152
156
|
status,
|
|
153
157
|
kind: managerDoc?.kind ?? 'block',
|
|
154
158
|
decision: managerDoc?.decision,
|
|
155
159
|
canManage: surface.canManage,
|
|
156
160
|
canReadResults: surface.canReadResults
|
|
157
|
-
});
|
|
161
|
+
}) : [];
|
|
158
162
|
const decisionRound = phase?.phaseKind === 'test' && round === newestRound && (liveDocument?.phase == null || liveDocument.phase === round) ? phase : !phases.length && liveDocument?.phase != null ? {
|
|
159
163
|
phase: liveDocument.phase
|
|
160
164
|
} : null;
|
|
161
|
-
const canDecide = lifecycle.some((action)=>action.id === 'decide') && !!decisionRound;
|
|
162
165
|
const canRelease = lifecycle.some((action)=>action.id === 'release-pages');
|
|
163
166
|
function refreshDocument(transition) {
|
|
164
167
|
if (transition && !onChanged) notifyTestDocument(surface.apiRoute, id);
|
|
165
168
|
results.reload();
|
|
166
169
|
onChanged?.(transition);
|
|
167
170
|
}
|
|
168
|
-
const
|
|
171
|
+
const roundActions = {};
|
|
172
|
+
for (const action of lifecycle){
|
|
173
|
+
if (statusReadPending) break;
|
|
174
|
+
if (action.id === 'decide' && (decisionRound || state !== 'loading')) roundActions.decide = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
175
|
+
action: action,
|
|
176
|
+
reason: decisionRound ? undefined : C.previousRound,
|
|
177
|
+
disabled: busy || !!releasing,
|
|
178
|
+
onClick: ()=>{
|
|
179
|
+
if (decisionRound) setDeciding({
|
|
180
|
+
...decisionRound,
|
|
181
|
+
results: data && round === decisionRound.phase && 'arms' in decisionRound && (state === 'ready' || state === 'empty') ? data : undefined
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
if (action.id === 'release-pages') roundActions['release-pages'] = /*#__PURE__*/ _jsx(LifecycleButton, {
|
|
186
|
+
action: action,
|
|
187
|
+
disabled: busy || !!deciding,
|
|
188
|
+
onClick: ()=>{
|
|
189
|
+
setActionError(null);
|
|
190
|
+
setReleasing({
|
|
191
|
+
phase: managerDoc?.phase
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const pages = manage && placements ? actionablePreviewPages(placements, doc?.flagPoint) : [];
|
|
197
|
+
const editorUrls = [
|
|
198
|
+
...new Set(pages.flatMap((page)=>page.editorUrl ? [
|
|
199
|
+
page.editorUrl
|
|
200
|
+
] : []))
|
|
201
|
+
];
|
|
202
|
+
const editOnPage = editorUrls.length ? /*#__PURE__*/ _jsx(Button, {
|
|
203
|
+
size: "sm",
|
|
204
|
+
href: editorUrls.length === 1 ? editorUrls[0] : `#${previewId}`,
|
|
205
|
+
children: TEST_PAGE.editOnPage
|
|
206
|
+
}) : null;
|
|
207
|
+
// A decided round displays the frozen snapshot used for the decision.
|
|
208
|
+
const refresh = manage && !showingDecision ? /*#__PURE__*/ _jsxs("div", {
|
|
209
|
+
className: "xp-results-refresh",
|
|
169
210
|
children: [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
children: ACTIONS_COPY.decide
|
|
177
|
-
}) : null,
|
|
178
|
-
canRelease && !statusReadPending ? /*#__PURE__*/ _jsx(Button, {
|
|
179
|
-
variant: "secondary",
|
|
180
|
-
disabled: busy || !!deciding,
|
|
181
|
-
onClick: (event)=>{
|
|
182
|
-
event.currentTarget.focus();
|
|
183
|
-
setActionError(null);
|
|
184
|
-
setReleasing({
|
|
185
|
-
phase: managerDoc?.phase
|
|
186
|
-
});
|
|
211
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
212
|
+
size: "sm",
|
|
213
|
+
busy: busy,
|
|
214
|
+
disabled: !!deciding || !!releasing,
|
|
215
|
+
onClick: ()=>{
|
|
216
|
+
void recompute();
|
|
187
217
|
},
|
|
188
|
-
children: C.
|
|
218
|
+
children: busy ? C.recomputing : C.recompute
|
|
219
|
+
}),
|
|
220
|
+
snapshot?.computedAt ? /*#__PURE__*/ _jsx("span", {
|
|
221
|
+
className: "xp-ui-help",
|
|
222
|
+
children: C.updated(relativeTime(snapshot.computedAt))
|
|
189
223
|
}) : null
|
|
190
224
|
]
|
|
191
|
-
});
|
|
225
|
+
}) : null;
|
|
192
226
|
// Release details come only from the manager's own document, never the results response.
|
|
193
227
|
const releaseDecision = managerDoc?.decision;
|
|
194
228
|
const released = manage && releaseDecision?.pagesReleasedAt ? /*#__PURE__*/ _jsx(PagesReleased, {
|
|
@@ -197,47 +231,36 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
197
231
|
userId: surface.userId,
|
|
198
232
|
userCollection: surface.userCollection
|
|
199
233
|
}) : null;
|
|
200
|
-
const meta = /*#__PURE__*/
|
|
201
|
-
children:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}),
|
|
231
|
-
manage && !showingDecision ? /*#__PURE__*/ _jsx(Button, {
|
|
232
|
-
variant: "quiet",
|
|
233
|
-
size: "sm",
|
|
234
|
-
disabled: busy || !!deciding || !!releasing,
|
|
235
|
-
onClick: ()=>{
|
|
236
|
-
void recompute();
|
|
237
|
-
},
|
|
238
|
-
children: busy ? C.recomputing : C.recompute
|
|
239
|
-
}) : null
|
|
240
|
-
]
|
|
234
|
+
const meta = /*#__PURE__*/ _jsx(_Fragment, {
|
|
235
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
236
|
+
className: "xp-round-meta",
|
|
237
|
+
children: [
|
|
238
|
+
phases.length > 0 ? /*#__PURE__*/ _jsx(Select, {
|
|
239
|
+
id: "xp-results-round",
|
|
240
|
+
label: C.round,
|
|
241
|
+
disabled: !!deciding || !!releasing,
|
|
242
|
+
value: round ?? '',
|
|
243
|
+
onChange: (event)=>results.setRound(Number(event.target.value)),
|
|
244
|
+
children: roundOptions(phases).map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
245
|
+
value: option.value,
|
|
246
|
+
children: option.label
|
|
247
|
+
}, option.value))
|
|
248
|
+
}) : null,
|
|
249
|
+
manage && shown ? /*#__PURE__*/ _jsxs("span", {
|
|
250
|
+
children: [
|
|
251
|
+
"· ",
|
|
252
|
+
C.methods[shown.method]
|
|
253
|
+
]
|
|
254
|
+
}) : null,
|
|
255
|
+
showingDecision ? /*#__PURE__*/ _jsxs("span", {
|
|
256
|
+
className: "xp-results-as-of",
|
|
257
|
+
children: [
|
|
258
|
+
manage ? '· ' : '',
|
|
259
|
+
C.asOfDecision(formatDate(data.decisionSnapshot.computedAt))
|
|
260
|
+
]
|
|
261
|
+
}) : null
|
|
262
|
+
]
|
|
263
|
+
})
|
|
241
264
|
});
|
|
242
265
|
const leader = shown?.verdict.recommendedArm;
|
|
243
266
|
const leadingComparison = shown?.metrics.find((metric)=>metric.role === 'primary')?.comparisons.find((item)=>item.arm === leader);
|
|
@@ -259,9 +282,13 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
259
282
|
}) : null,
|
|
260
283
|
!renderPage ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
261
284
|
children: [
|
|
262
|
-
/*#__PURE__*/
|
|
285
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
263
286
|
className: "xp-ui-button-group",
|
|
264
|
-
children:
|
|
287
|
+
children: [
|
|
288
|
+
editOnPage,
|
|
289
|
+
refresh,
|
|
290
|
+
Object.values(roundActions)
|
|
291
|
+
]
|
|
265
292
|
}),
|
|
266
293
|
released
|
|
267
294
|
]
|
|
@@ -385,7 +412,8 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
385
412
|
}) : null
|
|
386
413
|
]
|
|
387
414
|
}),
|
|
388
|
-
|
|
415
|
+
placements && pages.length > 0 && (editorUrls.length !== 1 || pages.some((page)=>page.url)) ? /*#__PURE__*/ _jsxs("section", {
|
|
416
|
+
id: previewId,
|
|
389
417
|
className: "xp-results-block",
|
|
390
418
|
children: [
|
|
391
419
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -395,6 +423,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
395
423
|
})
|
|
396
424
|
}),
|
|
397
425
|
/*#__PURE__*/ _jsx(PreviewLinks, {
|
|
426
|
+
showEditLinks: editorUrls.length !== 1 || !renderPage,
|
|
398
427
|
apiRoute: surface.apiRoute,
|
|
399
428
|
experimentId: id,
|
|
400
429
|
flagPoint: doc?.flagPoint,
|
|
@@ -442,7 +471,9 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
442
471
|
children: [
|
|
443
472
|
renderPage ? renderPage({
|
|
444
473
|
children: content,
|
|
445
|
-
|
|
474
|
+
roundActions,
|
|
475
|
+
editOnPage,
|
|
476
|
+
refresh,
|
|
446
477
|
released,
|
|
447
478
|
data
|
|
448
479
|
}) : content,
|
|
@@ -452,6 +483,7 @@ function ResultsContent({ id, surface, onRecomputed, renderPage, onChanged, docu
|
|
|
452
483
|
name: managerDoc?.name ?? data?.experiment?.name,
|
|
453
484
|
phase: deciding.phase,
|
|
454
485
|
arms: deciding.arms,
|
|
486
|
+
results: deciding.results,
|
|
455
487
|
checks: checks,
|
|
456
488
|
pending: statusReadPending,
|
|
457
489
|
unavailable: !lifecycle.some((action)=>action.id === 'decide') || liveDocument?.phase != null && liveDocument.phase !== deciding.phase,
|
|
@@ -477,6 +509,15 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
477
509
|
const notices = [
|
|
478
510
|
...new Set(rows.map((row)=>row.capped.notice).filter(Boolean))
|
|
479
511
|
];
|
|
512
|
+
if (metric.kind === 'revenue' && !notices.length) {
|
|
513
|
+
const cap = snapshot.params.caps[metric.metricId];
|
|
514
|
+
if (cap?.resolvedCap === null || !cap && metric.capNotice === 'no-history') notices.push(C.noCap);
|
|
515
|
+
else if (cap?.type === 'percentile') notices.push(percentileCapHelp(percentileTail(cap.value)));
|
|
516
|
+
else {
|
|
517
|
+
const threshold = cap?.value ?? metric.resolvedCap;
|
|
518
|
+
if (threshold != null) notices.push(revenueCapHelp(formatCurrency(threshold)));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
480
521
|
return /*#__PURE__*/ _jsxs("section", {
|
|
481
522
|
className: "xp-results-block",
|
|
482
523
|
children: [
|
|
@@ -510,12 +551,10 @@ function MetricTable({ metric, snapshot, phase, leader }) {
|
|
|
510
551
|
primary: metric.role === 'primary',
|
|
511
552
|
leader: leader
|
|
512
553
|
}),
|
|
513
|
-
|
|
514
|
-
METRICS_COPY.revenueHint
|
|
515
|
-
]).map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
554
|
+
notices.map((notice)=>/*#__PURE__*/ _jsx("p", {
|
|
516
555
|
className: "xp-results-cap-help",
|
|
517
556
|
children: notice
|
|
518
|
-
}, notice))
|
|
557
|
+
}, notice))
|
|
519
558
|
]
|
|
520
559
|
});
|
|
521
560
|
}
|
|
@@ -38,8 +38,8 @@ const rolloutWinner = (ctx)=>isLegacySnapshot(ctx.snapshot) ? legacyRecommendati
|
|
|
38
38
|
const groups = ctx.phase?.arms.filter((arm)=>arm.kind !== 'holdout').length ?? ctx.snapshot.k + 1;
|
|
39
39
|
return needed === null ? C.collecting : collectingRecommendation(formatCount(Math.round(needed * groups)));
|
|
40
40
|
},
|
|
41
|
-
'original-better': ()=>C.originalBetter,
|
|
42
|
-
'worse-none-better': (ctx)=>worseRecommendation(label(ctx, worse(ctx))),
|
|
41
|
+
'original-better': (ctx)=>C.originalBetter(label(ctx, 'control')),
|
|
42
|
+
'worse-none-better': (ctx)=>worseRecommendation(label(ctx, worse(ctx)), label(ctx, 'control')),
|
|
43
43
|
winner: (ctx)=>winnerRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm)),
|
|
44
44
|
mixed: (ctx)=>mixedRecommendation(label(ctx, ctx.snapshot.verdict.recommendedArm), label(ctx, worse(ctx))),
|
|
45
45
|
'keep-running': (ctx)=>{
|
|
@@ -51,7 +51,7 @@ const rolloutWinner = (ctx)=>isLegacySnapshot(ctx.snapshot) ? legacyRecommendati
|
|
|
51
51
|
const end = days != null && Number.isFinite(days) && days > 0 ? start + days * 86_400_000 : NaN;
|
|
52
52
|
return Number.isFinite(end) ? runningRecommendation(formatDate(end)) : C.keepRunning;
|
|
53
53
|
},
|
|
54
|
-
'no-difference': ()=>C.noDifference,
|
|
54
|
+
'no-difference': (ctx)=>C.noDifference(label(ctx, 'control')),
|
|
55
55
|
'rollout-collecting': (ctx)=>rolloutCollectingRecommendation(rolloutWinner(ctx).label),
|
|
56
56
|
'rollout-readout': (ctx)=>rolloutReadoutRecommendation(rolloutWinner(ctx).label, formatPercent(primary(ctx)?.comparisons.find((comparison)=>comparison.arm === rolloutWinner(ctx).key)?.lift, true))
|
|
57
57
|
};
|
|
@@ -5,7 +5,10 @@ import { Checkbox, Textarea, TextInput, NumberInput, Select } from '../../../ui/
|
|
|
5
5
|
import { EDITABLE_BY_STATUS, isEditable } from '../../../collections/experiments/editability.js';
|
|
6
6
|
import { coerceParam, paramIssue, paramsForArm, setParam } from '../../arms/params.model.js';
|
|
7
7
|
import { SETTING_COPY } from '../../copy/setting.js';
|
|
8
|
+
import { LOCKED_MESSAGES } from '../../copy/common.js';
|
|
8
9
|
import { lockedReason } from '../../lockedNotice.model.js';
|
|
10
|
+
import { holdoutContent } from '../../copy/audience.js';
|
|
11
|
+
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
9
12
|
import { SavedValueChanged, useDraftAnnouncement, useFieldDraft } from '../test/fields.js';
|
|
10
13
|
import { bindSetting, displayParam, paramCheckMessage, paramControl } from './setting.model.js';
|
|
11
14
|
import './setting.css';
|
|
@@ -15,7 +18,7 @@ function Binding({ test, surface }) {
|
|
|
15
18
|
if (!doc) return null;
|
|
16
19
|
const point = surface.flagPoints.find((point)=>point.id === doc.flagPoint);
|
|
17
20
|
const editable = surface.canManage && isEditable(doc.status, 'flagPoint');
|
|
18
|
-
const
|
|
21
|
+
const description = point?.description?.trim() !== point?.label.trim() ? point?.description?.trim() : undefined;
|
|
19
22
|
return /*#__PURE__*/ _jsxs("div", {
|
|
20
23
|
className: "xp-setting-binding",
|
|
21
24
|
children: [
|
|
@@ -23,7 +26,7 @@ function Binding({ test, surface }) {
|
|
|
23
26
|
id: id,
|
|
24
27
|
label: SETTING_COPY.setting,
|
|
25
28
|
value: point?.id ?? '',
|
|
26
|
-
"aria-describedby":
|
|
29
|
+
"aria-describedby": description ? `${id}-description` : undefined,
|
|
27
30
|
onChange: (event)=>{
|
|
28
31
|
const current = test.doc;
|
|
29
32
|
if (!current || !surface.canManage || !isEditable(current.status, 'flagPoint') || event.target.value === current.flagPoint) return;
|
|
@@ -45,21 +48,18 @@ function Binding({ test, surface }) {
|
|
|
45
48
|
children: point.label
|
|
46
49
|
}, point.id))
|
|
47
50
|
]
|
|
48
|
-
}) : /*#__PURE__*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
point ? /*#__PURE__*/ _jsx("p", {
|
|
57
|
-
id: `${id}-description`,
|
|
58
|
-
children: point.description ?? point.label
|
|
51
|
+
}) : doc.name.trim() !== point?.label.trim() ? /*#__PURE__*/ _jsx("p", {
|
|
52
|
+
children: /*#__PURE__*/ _jsx("strong", {
|
|
53
|
+
children: point?.label ?? SETTING_COPY.choose
|
|
54
|
+
})
|
|
55
|
+
}) : null,
|
|
56
|
+
!editable && doc.flagPoint ? /*#__PURE__*/ _jsx("p", {
|
|
57
|
+
className: "xp-ui-help",
|
|
58
|
+
children: LOCKED_MESSAGES.creation
|
|
59
59
|
}) : null,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
children:
|
|
60
|
+
description ? /*#__PURE__*/ _jsx("p", {
|
|
61
|
+
id: `${id}-description`,
|
|
62
|
+
children: description
|
|
63
63
|
}) : null,
|
|
64
64
|
test.errors.flagPoint ? /*#__PURE__*/ _jsx("p", {
|
|
65
65
|
role: "alert",
|
|
@@ -155,25 +155,21 @@ function Parameter({ test, surface, armIndex, paramKey, field }) {
|
|
|
155
155
|
},
|
|
156
156
|
children: [
|
|
157
157
|
arm.kind === 'control' || !editable && !draft.dirty ? /*#__PURE__*/ _jsxs("div", {
|
|
158
|
-
title: reason ?? undefined,
|
|
159
158
|
children: [
|
|
160
159
|
/*#__PURE__*/ _jsx("span", {
|
|
161
160
|
children: field.label
|
|
162
161
|
}),
|
|
163
162
|
/*#__PURE__*/ _jsx("p", {
|
|
164
163
|
className: "xp-setting-value",
|
|
165
|
-
children:
|
|
166
|
-
})
|
|
167
|
-
reason ? /*#__PURE__*/ _jsx("p", {
|
|
168
|
-
className: "xp-setting-lock",
|
|
169
|
-
children: reason
|
|
170
|
-
}) : null
|
|
164
|
+
children: displayParam(field, value)
|
|
165
|
+
})
|
|
171
166
|
]
|
|
172
167
|
}) : control === 'checkbox' ? /*#__PURE__*/ _jsx(Checkbox, {
|
|
173
168
|
...shared,
|
|
174
169
|
error: issue ?? undefined,
|
|
175
170
|
name: id,
|
|
176
171
|
checked: value === true,
|
|
172
|
+
help: displayParam(field, value),
|
|
177
173
|
onChange: (event)=>save(event.target.checked)
|
|
178
174
|
}) : control === 'segmented' ? /*#__PURE__*/ _jsxs("fieldset", {
|
|
179
175
|
"aria-describedby": issue ? `${id}-error` : undefined,
|
|
@@ -245,6 +241,7 @@ function Parameter({ test, surface, armIndex, paramKey, field }) {
|
|
|
245
241
|
id: conflictId,
|
|
246
242
|
value: saved,
|
|
247
243
|
reason: reason,
|
|
244
|
+
showReason: false,
|
|
248
245
|
conflict: draft.conflict,
|
|
249
246
|
announce: announcement,
|
|
250
247
|
onKeep: editable && !test.stale ? ()=>commit(true) : undefined,
|
|
@@ -260,21 +257,27 @@ function VersionContent({ test, surface, armIndex }) {
|
|
|
260
257
|
if (!doc || !arm) return null;
|
|
261
258
|
if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
|
|
262
259
|
className: "xp-content-chip",
|
|
263
|
-
children:
|
|
260
|
+
children: holdoutContent(actionGroupLabel('control', test.doc?.arms.find((arm)=>arm.key === 'control')?.label))
|
|
264
261
|
});
|
|
265
262
|
const point = surface.flagPoints.find((point)=>point.id === doc.flagPoint);
|
|
266
263
|
if (!point) return /*#__PURE__*/ _jsx("p", {
|
|
267
264
|
children: SETTING_COPY.choose
|
|
268
265
|
});
|
|
269
|
-
const
|
|
266
|
+
const values = paramsForArm(arm, point);
|
|
267
|
+
const entries = Object.entries(point.params);
|
|
268
|
+
const ready = entries.every(([key, field])=>!paramIssue(field, values[key]));
|
|
269
|
+
const current = entries.length > 0 && entries.every(([key])=>values[key] === point.effectiveDefaults[key]);
|
|
270
270
|
return /*#__PURE__*/ _jsxs("div", {
|
|
271
271
|
className: "xp-setting-values",
|
|
272
272
|
children: [
|
|
273
|
-
/*#__PURE__*/ _jsx("span", {
|
|
273
|
+
current ? /*#__PURE__*/ _jsx("span", {
|
|
274
|
+
className: "xp-content-chip",
|
|
275
|
+
children: SETTING_COPY.current
|
|
276
|
+
}) : isEditable(doc.status, 'arms') ? /*#__PURE__*/ _jsx("span", {
|
|
274
277
|
className: `xp-content-chip ${ready ? 'xp-content-ready' : 'xp-content-empty'}`,
|
|
275
278
|
children: ready ? SETTING_COPY.valuesReady : SETTING_COPY.setValues
|
|
276
|
-
}),
|
|
277
|
-
|
|
279
|
+
}) : null,
|
|
280
|
+
entries.map(([key, field])=>/*#__PURE__*/ _jsx(Parameter, {
|
|
278
281
|
test: test,
|
|
279
282
|
surface: surface,
|
|
280
283
|
armIndex: armIndex,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
:where(.xp-test-surface) .xp-setting-values { display: grid; gap: var(--xp-space-3); }
|
|
2
2
|
:where(.xp-test-surface) .xp-setting-value { white-space: pre-wrap; }
|
|
3
|
-
:where(.xp-test-surface) .xp-setting-
|
|
3
|
+
:where(.xp-test-surface) .xp-setting-version-name { display: grid; gap: var(--xp-space-2); min-width: 0; }
|
|
4
|
+
:where(.xp-test-surface) .xp-setting-version-name > .xp-ui-button { justify-self: start; }
|
|
4
5
|
:where(.xp-test-surface) .xp-setting-parameter fieldset { border: 0; padding: 0; margin: 0; }
|
|
5
6
|
:where(.xp-test-surface) .xp-setting-segments { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
|
|
6
7
|
:where(.xp-test-surface) .xp-setting-segments label { position: relative; }
|
|
@@ -37,6 +37,15 @@ export function AdvancedSection({ test, surface }) {
|
|
|
37
37
|
0
|
|
38
38
|
]
|
|
39
39
|
];
|
|
40
|
+
const layer = typeof doc.layer === 'string' || typeof doc.layer === 'number' ? doc.layer : C.none;
|
|
41
|
+
const values = {
|
|
42
|
+
layer,
|
|
43
|
+
slug: /*#__PURE__*/ _jsx("code", {
|
|
44
|
+
children: doc.slug
|
|
45
|
+
}),
|
|
46
|
+
kind: C.kinds[doc.kind],
|
|
47
|
+
unitType: C.units[doc.unitType]
|
|
48
|
+
};
|
|
40
49
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
41
50
|
surface: surface,
|
|
42
51
|
test: test,
|
|
@@ -152,10 +161,7 @@ export function AdvancedSection({ test, surface }) {
|
|
|
152
161
|
children: [
|
|
153
162
|
/*#__PURE__*/ _jsx(ReadOnly, {
|
|
154
163
|
label: C[field].label,
|
|
155
|
-
value: field
|
|
156
|
-
children: String(doc.slug)
|
|
157
|
-
}) : typeof doc[field] === 'string' || typeof doc[field] === 'number' ? String(doc[field]) : C.none,
|
|
158
|
-
reason: reasonFor(test, field)
|
|
164
|
+
value: values[field]
|
|
159
165
|
}),
|
|
160
166
|
/*#__PURE__*/ _jsx("p", {
|
|
161
167
|
children: C[field].help
|
|
@@ -12,7 +12,7 @@ import { isClickSource, validClickSource } from '../../../goals/key.js';
|
|
|
12
12
|
import { createApi } from '../../api.js';
|
|
13
13
|
import { sourceFor } from '../../metricSource.model.js';
|
|
14
14
|
import { reviewView } from '../../review/review.model.js';
|
|
15
|
-
import { FieldErrors, reasonFor, save, SelectEdit } from './fields.js';
|
|
15
|
+
import { FieldErrors, ReadOnly, reasonFor, save, SelectEdit } from './fields.js';
|
|
16
16
|
import { Section } from './Section.js';
|
|
17
17
|
export function GoalSection({ test, surface, embedded = false }) {
|
|
18
18
|
const api = useMemo(()=>createApi(surface.apiRoute), [
|
|
@@ -139,7 +139,7 @@ export function GoalSection({ test, surface, embedded = false }) {
|
|
|
139
139
|
value: id,
|
|
140
140
|
label: unknownGoal
|
|
141
141
|
});
|
|
142
|
-
const otherGoals = visible.filter((option)=>option.value !== String(doc.metrics?.primary ?? ''));
|
|
142
|
+
const otherGoals = visible.filter((option)=>option.value !== String(doc.metrics?.primary ?? '') && (!reason || chosen.includes(option.value)));
|
|
143
143
|
const otherCount = new Set([
|
|
144
144
|
...doc.metrics?.guardrails ?? [],
|
|
145
145
|
...doc.metrics?.secondary ?? []
|
|
@@ -233,6 +233,9 @@ export function GoalSection({ test, surface, embedded = false }) {
|
|
|
233
233
|
})
|
|
234
234
|
]
|
|
235
235
|
}) : null,
|
|
236
|
+
/*#__PURE__*/ _jsx("p", {
|
|
237
|
+
children: C.goalHelp
|
|
238
|
+
}),
|
|
236
239
|
/*#__PURE__*/ _jsx(SelectEdit, {
|
|
237
240
|
labelAction: /*#__PURE__*/ _jsx("span", {
|
|
238
241
|
className: "xp-ui-button-group",
|
|
@@ -261,9 +264,6 @@ export function GoalSection({ test, surface, embedded = false }) {
|
|
|
261
264
|
]),
|
|
262
265
|
onCommit: changePrimary
|
|
263
266
|
}),
|
|
264
|
-
/*#__PURE__*/ _jsx("p", {
|
|
265
|
-
children: C.goalHelp
|
|
266
|
-
}),
|
|
267
267
|
primary && isClickSource(primary.source) ? /*#__PURE__*/ _jsx("p", {
|
|
268
268
|
children: C.clickGoalHelp
|
|
269
269
|
}) : null,
|
|
@@ -292,11 +292,15 @@ export function GoalSection({ test, surface, embedded = false }) {
|
|
|
292
292
|
className: "xp-other-goal-list",
|
|
293
293
|
children: otherGoals.map((option, index)=>{
|
|
294
294
|
const role = doc.metrics?.guardrails?.some((id)=>String(id) === option.value) ? 'guardrails' : doc.metrics?.secondary?.some((id)=>String(id) === option.value) ? 'secondary' : '';
|
|
295
|
+
const label = onPage.get(option.value) ?? option.label;
|
|
296
|
+
if (reason) return /*#__PURE__*/ _jsx(ReadOnly, {
|
|
297
|
+
label: label,
|
|
298
|
+
value: role === 'guardrails' ? C.mustNotWorsen : C.watch
|
|
299
|
+
}, option.value);
|
|
295
300
|
return /*#__PURE__*/ _jsxs(Select, {
|
|
296
301
|
id: `${roleId}-${index}`,
|
|
297
|
-
label:
|
|
302
|
+
label: label,
|
|
298
303
|
value: role,
|
|
299
|
-
disabled: Boolean(reason),
|
|
300
304
|
onChange: (event)=>setRole(option.value, event.target.value),
|
|
301
305
|
children: [
|
|
302
306
|
/*#__PURE__*/ _jsx("option", {
|
|
@@ -318,10 +322,6 @@ export function GoalSection({ test, surface, embedded = false }) {
|
|
|
318
322
|
/*#__PURE__*/ _jsx("p", {
|
|
319
323
|
children: C.otherGoalsHelp
|
|
320
324
|
}),
|
|
321
|
-
reason ? /*#__PURE__*/ _jsx("p", {
|
|
322
|
-
className: "xp-ui-help",
|
|
323
|
-
children: reason
|
|
324
|
-
}) : null,
|
|
325
325
|
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
326
326
|
test: test,
|
|
327
327
|
path: "metrics.guardrails"
|