@delmaredigital/payload-experiments 0.4.0-rc.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -8
- package/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +75 -29
- package/dist/admin/blocks/model.js +5 -4
- package/dist/admin/copy/blocks.d.ts +14 -11
- package/dist/admin/copy/blocks.js +33 -22
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +10 -7
- package/dist/admin/copy/newTest.js +14 -7
- package/dist/admin/copy/status.d.ts +1 -1
- package/dist/admin/copy/status.js +2 -1
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/placementStatus.model.js +5 -3
- package/dist/admin/status.model.d.ts +1 -0
- package/dist/admin/status.model.js +2 -1
- package/dist/admin/surface/ResultsRoute.js +4 -8
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +28 -3
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +4 -3
- package/dist/admin/surface/TestsHome.js +186 -47
- package/dist/admin/surface/TestsSurface.js +2 -1
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -198
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +15 -8
- package/dist/admin/surface/home.model.js +22 -18
- package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
- package/dist/admin/surface/newTest/NewTest.js +156 -96
- package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
- package/dist/admin/surface/newTest/PageWizard.js +93 -68
- package/dist/admin/surface/newTest/newTest.css +28 -11
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +90 -63
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.js +46 -38
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/admin/views/buildSurfaceProps.js +18 -66
- package/dist/arms/copy.d.ts +13 -3
- package/dist/arms/copy.js +5 -4
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +1 -1
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/serialize.js +3 -2
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/snapshots.d.ts +1 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +414 -0
- package/dist/endpoints/editorSurface.js +1 -1
- package/dist/endpoints/index.js +20 -0
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +1 -0
- package/dist/endpoints/results.js +3 -0
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +4 -5
- package/dist/exports/index.d.ts +1 -1
- package/dist/goals/picker/copy.js +1 -1
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/labels/arms.d.ts +3 -0
- package/dist/labels/arms.js +8 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +18 -2
- package/dist/plugin.js +56 -2
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +36 -26
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +219 -106
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +2 -2
- package/dist/puck/editor/QuickTestActions.js +44 -34
- package/dist/puck/editor/ResultsReadout.d.ts +3 -1
- package/dist/puck/editor/ResultsReadout.js +28 -16
- package/dist/puck/editor/VersionBuilder.d.ts +4 -2
- package/dist/puck/editor/VersionBuilder.js +42 -63
- package/dist/puck/editor/armWrites.js +1 -1
- package/dist/puck/editor/copy.d.ts +10 -6
- package/dist/puck/editor/copy.js +22 -12
- package/dist/puck/editor/editor.chrome.css +9 -8
- package/dist/puck/editor/editor.css +14 -9
- package/dist/puck/editor/placementsCache.d.ts +1 -1
- package/dist/puck/editor/placementsCache.js +9 -17
- package/dist/puck/editor/usePageSaveReadiness.d.ts +1 -4
- package/dist/puck/editor/usePageSaveReadiness.js +18 -21
- package/dist/puck/editor/usePlacementNotice.d.ts +2 -2
- package/dist/puck/editor/usePlacementNotice.js +4 -5
- package/dist/puck/nestedTestCopy.js +2 -2
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/verdict.d.ts +4 -4
- package/dist/results/verdict.js +13 -10
- 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 +7 -4
- package/dist/testSurface/actions/DecideDialog.js +71 -59
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.js +1 -1
- package/dist/testSurface/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +75 -22
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/api.d.ts +4 -1
- package/dist/testSurface/api.js +22 -14
- package/dist/testSurface/copy/actions.d.ts +36 -14
- package/dist/testSurface/copy/actions.js +39 -17
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +6 -6
- package/dist/testSurface/copy/common.js +6 -6
- package/dist/testSurface/copy/metrics.d.ts +6 -0
- package/dist/testSurface/copy/metrics.js +8 -0
- package/dist/testSurface/copy/pages.d.ts +67 -7
- package/dist/testSurface/copy/pages.js +74 -7
- package/dist/testSurface/copy/readiness.d.ts +8 -6
- package/dist/testSurface/copy/readiness.js +19 -10
- package/dist/testSurface/copy/recommendation.d.ts +1 -22
- package/dist/testSurface/copy/recommendation.js +2 -22
- package/dist/testSurface/copy/results.d.ts +16 -10
- package/dist/testSurface/copy/results.js +19 -11
- package/dist/testSurface/copy/review.d.ts +13 -10
- package/dist/testSurface/copy/review.js +14 -10
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.d.ts +11 -2
- package/dist/testSurface/copy/surface.js +14 -11
- package/dist/testSurface/copy/testPage.d.ts +16 -10
- package/dist/testSurface/copy/testPage.js +24 -18
- package/dist/testSurface/format/date.d.ts +5 -2
- package/dist/testSurface/format/date.js +24 -8
- package/dist/testSurface/format/roundProgress.d.ts +6 -0
- package/dist/testSurface/format/roundProgress.js +15 -0
- package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
- package/dist/testSurface/format/useDateFormatter.js +8 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/readPreflight.d.ts +0 -1
- package/dist/testSurface/readPreflight.js +0 -1
- package/dist/testSurface/results/CiChart.js +2 -1
- package/dist/testSurface/results/DataTable.d.ts +1 -1
- package/dist/testSurface/results/DataTable.js +4 -3
- package/dist/testSurface/results/VerdictHero.d.ts +1 -1
- package/dist/testSurface/results/legacy.d.ts +0 -5
- package/dist/testSurface/results/legacy.js +0 -14
- package/dist/testSurface/results/results.css +2 -2
- package/dist/testSurface/results/results.model.d.ts +8 -3
- package/dist/testSurface/results/results.model.js +25 -21
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +6 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +1 -1
- package/dist/testSurface/surface/editorPlacement.js +1 -1
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +1 -1
- package/dist/testSurface/surface/pageBlock/parts.js +25 -12
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +298 -209
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +5 -3
- package/dist/testSurface/surface/readiness/ActionDialogs.js +213 -207
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +109 -148
- 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.d.ts +14 -5
- package/dist/testSurface/surface/readiness/readiness.model.js +62 -12
- package/dist/testSurface/surface/readiness/useTransition.d.ts +3 -1
- package/dist/testSurface/surface/readiness/useTransition.js +49 -8
- package/dist/testSurface/surface/results/ReleasePages.d.ts +4 -3
- package/dist/testSurface/surface/results/ReleasePages.js +41 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +7 -2
- package/dist/testSurface/surface/results/ResultsBody.js +170 -110
- package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
- package/dist/testSurface/surface/results/recommendation.model.js +15 -59
- package/dist/testSurface/surface/results/useResults.d.ts +6 -2
- 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/DeleteTest.d.ts +5 -1
- package/dist/testSurface/surface/test/DeleteTest.js +63 -55
- package/dist/testSurface/surface/test/GoalSection.js +11 -11
- package/dist/testSurface/surface/test/LengthSection.js +21 -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 +2 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +7 -2
- package/dist/testSurface/surface/test/TestSurface.js +17 -43
- package/dist/testSurface/surface/test/VersionsSection.js +93 -70
- 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 +13 -7
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/useTestDocument.d.ts +1 -3
- package/dist/testSurface/surface/useTestDocument.js +110 -52
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/testSurface/useApi.d.ts +3 -0
- package/dist/transitions/addMetric.d.ts +1 -1
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/kernel.d.ts +2 -0
- package/dist/transitions/kernel.js +1 -1
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.d.ts +1 -1
- package/dist/transitions/preflightData.js +10 -2
- package/dist/transitions/start.d.ts +1 -1
- package/dist/transitions/start.js +8 -5
- package/dist/types/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +11 -1
- package/dist/types/endpoints.d.ts +38 -9
- package/dist/types/endpoints.js +1 -1
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/Dialog.d.ts +21 -2
- package/dist/ui/Dialog.js +101 -4
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +5 -1
- package/package.json +2 -2
|
@@ -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
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { DocId, ExperimentKind } from '../../../types/contracts.js';
|
|
2
|
+
import type { SectionProps } from '../contracts.js';
|
|
2
3
|
export type DeleteOutcome = 'done' | 'already';
|
|
3
4
|
export declare const DELETE_IMPACT_TIMEOUT_MS = 15000;
|
|
5
|
+
export declare function DeleteTestAction({ test, surface }: SectionProps): import("react").JSX.Element | null;
|
|
4
6
|
/** Matches deleteExperiment's status guard; the server rechecks under its lock. */
|
|
5
|
-
export declare function DeleteTest({ test, canManage, apiRoute, contentLocale, onDeleted, onStatusChanged, onDialogChange }: {
|
|
7
|
+
export declare function DeleteTest({ test, canManage, apiRoute, contentLocale, onDeleted, onStatusChanged, onDialogChange, fromMenu, statusReadPending }: {
|
|
6
8
|
test: {
|
|
7
9
|
id: DocId;
|
|
8
10
|
name: string;
|
|
@@ -16,4 +18,6 @@ export declare function DeleteTest({ test, canManage, apiRoute, contentLocale, o
|
|
|
16
18
|
onDeleted: (outcome: DeleteOutcome) => void;
|
|
17
19
|
onStatusChanged: () => void;
|
|
18
20
|
onDialogChange?: (open: boolean) => void;
|
|
21
|
+
fromMenu?: boolean;
|
|
22
|
+
statusReadPending?: boolean;
|
|
19
23
|
}): import("react").JSX.Element | null;
|
|
@@ -7,11 +7,31 @@ import { API_MESSAGES } from '../../copy/common.js';
|
|
|
7
7
|
import { DELETE_TEST as C, deleteStatusCopy } from '../../copy/testPage.js';
|
|
8
8
|
import { useOnTestReturn } from '../../useOnTestReturn.js';
|
|
9
9
|
import { Button } from '../../../ui/Button.js';
|
|
10
|
-
import {
|
|
10
|
+
import { ConfirmDialog } from '../../../ui/Dialog.js';
|
|
11
|
+
import { canDeleteTest } from '../../actions/actions.model.js';
|
|
12
|
+
import { READINESS_COPY } from '../../copy/readiness.js';
|
|
13
|
+
import { surfaceUrls } from '../../surfaceUrls.js';
|
|
14
|
+
import { notifyTestDocument } from '../watchTestDocument.js';
|
|
11
15
|
const VISIBLE_PAGES = 5;
|
|
12
16
|
export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
export function DeleteTestAction({ test, surface }) {
|
|
18
|
+
if (!test.doc) return null;
|
|
19
|
+
return /*#__PURE__*/ _jsx(DeleteTest, {
|
|
20
|
+
test: test.doc,
|
|
21
|
+
canManage: surface.canManage,
|
|
22
|
+
statusReadPending: test.statusReadPending,
|
|
23
|
+
apiRoute: surface.apiRoute,
|
|
24
|
+
contentLocale: surface.contentLocale,
|
|
25
|
+
onStatusChanged: ()=>{
|
|
26
|
+
void test.reload();
|
|
27
|
+
},
|
|
28
|
+
onDeleted: (outcome)=>window.location.assign(surfaceUrls.home(surface.adminRoute, {
|
|
29
|
+
deleted: outcome
|
|
30
|
+
}))
|
|
31
|
+
}, test.doc.id);
|
|
32
|
+
}
|
|
33
|
+
/** Matches deleteExperiment's status guard; the server rechecks under its lock. */ export function DeleteTest({ test, canManage, apiRoute, contentLocale, onDeleted, onStatusChanged, onDialogChange, fromMenu = false, statusReadPending }) {
|
|
34
|
+
const [open, setOpen] = useState(fromMenu);
|
|
15
35
|
const [busy, setBusy] = useState(false);
|
|
16
36
|
const pending = useRef(false);
|
|
17
37
|
const actions = useRef(null);
|
|
@@ -30,7 +50,7 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
30
50
|
const impact = refusal ?? (checked?.key === checkKey ? checked.impact : {
|
|
31
51
|
state: 'loading'
|
|
32
52
|
});
|
|
33
|
-
const deletable = test.status
|
|
53
|
+
const deletable = canDeleteTest(test.status);
|
|
34
54
|
const statusMessage = deletable ? undefined : deleteStatusCopy(test.status, test.kind);
|
|
35
55
|
const blocked = !canManage ? API_MESSAGES.forbidden : impact.state === 'blocked' ? impact.reason === 'invalid-status' ? statusMessage ?? impact.message : impact.message : statusMessage;
|
|
36
56
|
useOnTestReturn(useCallback(()=>{
|
|
@@ -87,14 +107,13 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
87
107
|
});
|
|
88
108
|
} else setRefusal({
|
|
89
109
|
state: 'blocked',
|
|
90
|
-
message: result.message
|
|
110
|
+
message: result.message,
|
|
111
|
+
reason: [
|
|
112
|
+
401,
|
|
113
|
+
403
|
|
114
|
+
].includes(result.status) ? 'access' : undefined
|
|
91
115
|
});
|
|
92
|
-
if (!result.ok && !onDialogChange &&
|
|
93
|
-
401,
|
|
94
|
-
403,
|
|
95
|
-
404,
|
|
96
|
-
409
|
|
97
|
-
].includes(result.status)) onStatusChanged();
|
|
116
|
+
if (!result.ok && !onDialogChange && result.status === 409) onStatusChanged();
|
|
98
117
|
});
|
|
99
118
|
return ()=>{
|
|
100
119
|
current = false;
|
|
@@ -125,15 +144,17 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
125
144
|
onDialogChange?.(false);
|
|
126
145
|
// Keep the refusal visible until dismissed. Reloading can move the row to another group.
|
|
127
146
|
if (impact.state === 'blocked' && impact.reason === 'already-deleted') onDeleted('already');
|
|
147
|
+
if (impact.state === 'blocked' && impact.reason === 'access') onStatusChanged();
|
|
128
148
|
if (onDialogChange && impact.state === 'blocked' && impact.reason === 'invalid-status') onStatusChanged();
|
|
129
149
|
}
|
|
130
150
|
async function remove() {
|
|
131
|
-
if (blocked || checking || pending.current) return;
|
|
151
|
+
if (blocked || checking || statusReadPending || pending.current) return;
|
|
132
152
|
pending.current = true;
|
|
133
153
|
setBusy(true);
|
|
134
154
|
setError(undefined);
|
|
135
155
|
const result = await createApi(apiRoute).deleteTest(test.id);
|
|
136
156
|
if (result.ok || result.status === 404) {
|
|
157
|
+
if (result.ok) notifyTestDocument(apiRoute, test.id);
|
|
137
158
|
setOpen(false);
|
|
138
159
|
onDialogChange?.(false);
|
|
139
160
|
onDeleted(result.ok ? 'done' : 'already');
|
|
@@ -148,9 +169,9 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
148
169
|
} else if (result.status === 401 || result.status === 403) {
|
|
149
170
|
setRefusal({
|
|
150
171
|
state: 'blocked',
|
|
151
|
-
message: result.message
|
|
172
|
+
message: result.message,
|
|
173
|
+
reason: 'access'
|
|
152
174
|
});
|
|
153
|
-
onStatusChanged();
|
|
154
175
|
} else {
|
|
155
176
|
setError(result.message);
|
|
156
177
|
if (result.status === 409) onStatusChanged();
|
|
@@ -160,27 +181,38 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
160
181
|
}
|
|
161
182
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
162
183
|
children: [
|
|
163
|
-
canManage && deletable && (refusal?.reason !== 'invalid-status' || refusal.refusedStatus !== test.status) ? /*#__PURE__*/ _jsx(Button, {
|
|
184
|
+
!fromMenu && canManage && deletable && !statusReadPending && (refusal?.reason !== 'invalid-status' || refusal.refusedStatus !== test.status) ? /*#__PURE__*/ _jsx(Button, {
|
|
164
185
|
variant: "quiet",
|
|
165
186
|
size: "sm",
|
|
166
|
-
onClick:
|
|
187
|
+
onClick: (event)=>{
|
|
188
|
+
event.currentTarget.focus();
|
|
189
|
+
showDialog();
|
|
190
|
+
},
|
|
167
191
|
children: C.action
|
|
168
192
|
}) : null,
|
|
169
|
-
/*#__PURE__*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
193
|
+
/*#__PURE__*/ _jsx("div", {
|
|
194
|
+
ref: actions,
|
|
195
|
+
children: /*#__PURE__*/ _jsx(ConfirmDialog, {
|
|
196
|
+
open: open,
|
|
197
|
+
title: C.title(test.name),
|
|
198
|
+
description: blocked ? undefined : C.consequences,
|
|
199
|
+
busy: busy,
|
|
200
|
+
busyLabel: READINESS_COPY.changing,
|
|
201
|
+
onClose: close,
|
|
202
|
+
cancelLabel: blocked ? C.close : C.cancel,
|
|
203
|
+
error: blocked ?? error,
|
|
204
|
+
confirm: blocked ? undefined : {
|
|
205
|
+
label: C.action,
|
|
206
|
+
destructive: true,
|
|
207
|
+
disabled: checking || statusReadPending,
|
|
208
|
+
onClick: remove
|
|
209
|
+
},
|
|
210
|
+
children: blocked ? (impact.state === 'blocked' && impact.reason === 'invalid-status' ? impact.refusedStatus : test.status) === 'running' && canManage ? /*#__PURE__*/ _jsx("ol", {
|
|
211
|
+
children: C.runningSteps.map((step)=>/*#__PURE__*/ _jsx("li", {
|
|
212
|
+
children: step
|
|
213
|
+
}, step))
|
|
214
|
+
}) : null : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
180
215
|
children: [
|
|
181
|
-
/*#__PURE__*/ _jsx("p", {
|
|
182
|
-
children: C.consequences
|
|
183
|
-
}),
|
|
184
216
|
/*#__PURE__*/ _jsx("p", {
|
|
185
217
|
children: C.content
|
|
186
218
|
}),
|
|
@@ -191,34 +223,10 @@ export const DELETE_IMPACT_TIMEOUT_MS = 15_000;
|
|
|
191
223
|
}),
|
|
192
224
|
impact.state === 'ready' ? /*#__PURE__*/ _jsx(ImpactDetails, {
|
|
193
225
|
impact: impact.data
|
|
194
|
-
}) : null,
|
|
195
|
-
error ? /*#__PURE__*/ _jsx("p", {
|
|
196
|
-
role: "alert",
|
|
197
|
-
children: error
|
|
198
|
-
}) : null
|
|
199
|
-
]
|
|
200
|
-
}),
|
|
201
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
202
|
-
ref: actions,
|
|
203
|
-
className: "xp-ui-button-group",
|
|
204
|
-
children: [
|
|
205
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
206
|
-
"data-dialog-cancel": true,
|
|
207
|
-
disabled: busy,
|
|
208
|
-
onClick: close,
|
|
209
|
-
children: blocked ? C.close : C.cancel
|
|
210
|
-
}),
|
|
211
|
-
!blocked ? /*#__PURE__*/ _jsx(Button, {
|
|
212
|
-
variant: "danger",
|
|
213
|
-
disabled: checking,
|
|
214
|
-
"aria-disabled": busy || checking || undefined,
|
|
215
|
-
"aria-busy": busy || undefined,
|
|
216
|
-
onClick: ()=>void remove(),
|
|
217
|
-
children: C.action
|
|
218
226
|
}) : null
|
|
219
227
|
]
|
|
220
228
|
})
|
|
221
|
-
|
|
229
|
+
})
|
|
222
230
|
})
|
|
223
231
|
]
|
|
224
232
|
});
|
|
@@ -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"
|
|
@@ -3,12 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Button } from '../../../ui/Button.js';
|
|
4
4
|
import { TEST_PAGE as C, suggestedWeeks, weeksHint } from '../../copy/testPage.js';
|
|
5
5
|
import { durationSuggestion } from './testPage.model.js';
|
|
6
|
-
import { FieldErrors, positiveInteger, reasonFor, save, TextEdit } from './fields.js';
|
|
6
|
+
import { FieldErrors, positiveInteger, ReadOnly, reasonFor, save, TextEdit } from './fields.js';
|
|
7
|
+
import { useDateFormatter } from '../../format/useDateFormatter.js';
|
|
7
8
|
import { Section } from './Section.js';
|
|
8
9
|
export function LengthSection({ test, surface }) {
|
|
10
|
+
const formatDate = useDateFormatter();
|
|
9
11
|
const doc = test.doc;
|
|
10
12
|
const reason = reasonFor(test, 'analysis');
|
|
11
|
-
const
|
|
13
|
+
const days = doc.analysis?.plannedDurationDays ?? 28;
|
|
14
|
+
const suggestion = !reason ? durationSuggestion(test.preflight, days) : null;
|
|
15
|
+
const end = typeof doc.startedAt === 'string' ? Date.parse(doc.startedAt) + days * 86_400_000 : NaN;
|
|
12
16
|
const required = [
|
|
13
17
|
'manual',
|
|
14
18
|
'viewport'
|
|
@@ -27,7 +31,7 @@ export function LengthSection({ test, surface }) {
|
|
|
27
31
|
/*#__PURE__*/ _jsxs("div", {
|
|
28
32
|
className: "xp-field-grid",
|
|
29
33
|
children: [
|
|
30
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
34
|
+
!reason || test.fieldDrafts?.['analysis.reachPerDay'] ? /*#__PURE__*/ _jsxs("div", {
|
|
31
35
|
children: [
|
|
32
36
|
/*#__PURE__*/ _jsx(TextEdit, {
|
|
33
37
|
test: test,
|
|
@@ -37,38 +41,42 @@ export function LengthSection({ test, surface }) {
|
|
|
37
41
|
type: "number",
|
|
38
42
|
min: 1,
|
|
39
43
|
reason: reason,
|
|
40
|
-
required: required,
|
|
44
|
+
required: required && !reason,
|
|
41
45
|
onCommit: (value)=>change('reachPerDay', value)
|
|
42
46
|
}),
|
|
43
|
-
/*#__PURE__*/ _jsx("p", {
|
|
47
|
+
!reason ? /*#__PURE__*/ _jsx("p", {
|
|
44
48
|
className: "xp-ui-help",
|
|
45
49
|
children: C.reachHelp
|
|
46
|
-
}),
|
|
50
|
+
}) : null,
|
|
47
51
|
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
48
52
|
test: test,
|
|
49
53
|
path: "analysis.reachPerDay"
|
|
50
54
|
})
|
|
51
55
|
]
|
|
52
|
-
}),
|
|
56
|
+
}, "reach") : null,
|
|
53
57
|
/*#__PURE__*/ _jsxs("div", {
|
|
54
58
|
children: [
|
|
55
59
|
/*#__PURE__*/ _jsx(TextEdit, {
|
|
56
60
|
test: test,
|
|
57
61
|
label: C.duration,
|
|
58
|
-
value:
|
|
62
|
+
value: days,
|
|
59
63
|
type: "number",
|
|
60
64
|
min: 1,
|
|
61
65
|
reason: reason,
|
|
62
66
|
isValid: positiveInteger,
|
|
63
67
|
onCommit: (value)=>change('plannedDurationDays', value),
|
|
64
|
-
help: weeksHint(
|
|
68
|
+
help: !reason ? weeksHint(days) : undefined
|
|
65
69
|
}),
|
|
66
70
|
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
67
71
|
test: test,
|
|
68
72
|
path: "analysis.plannedDurationDays"
|
|
69
73
|
})
|
|
70
74
|
]
|
|
71
|
-
})
|
|
75
|
+
}, "duration"),
|
|
76
|
+
reason ? /*#__PURE__*/ _jsx(ReadOnly, {
|
|
77
|
+
label: C.endDate,
|
|
78
|
+
value: formatDate(end)
|
|
79
|
+
}) : null
|
|
72
80
|
]
|
|
73
81
|
}),
|
|
74
82
|
suggestion ? /*#__PURE__*/ _jsxs("div", {
|
|
@@ -77,7 +85,7 @@ export function LengthSection({ test, surface }) {
|
|
|
77
85
|
/*#__PURE__*/ _jsx("p", {
|
|
78
86
|
children: suggestedWeeks(suggestion.weeks)
|
|
79
87
|
}),
|
|
80
|
-
|
|
88
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
81
89
|
onClick: ()=>save(test, 'analysis', ()=>({
|
|
82
90
|
analysis: {
|
|
83
91
|
...test.doc.analysis,
|
|
@@ -86,12 +94,12 @@ export function LengthSection({ test, surface }) {
|
|
|
86
94
|
}
|
|
87
95
|
})),
|
|
88
96
|
children: C.apply
|
|
89
|
-
})
|
|
97
|
+
}),
|
|
90
98
|
!suggestion.feasible ? /*#__PURE__*/ _jsx("p", {
|
|
91
99
|
children: C.infeasible
|
|
92
100
|
}) : null
|
|
93
101
|
]
|
|
94
|
-
}) : !test.preflight?.estimate ? /*#__PURE__*/ _jsx("p", {
|
|
102
|
+
}) : !reason && !test.preflight?.estimate ? /*#__PURE__*/ _jsx("p", {
|
|
95
103
|
children: doc.analysis?.reachPerDay == null ? C.noSuggestion : C.chooseGoalSuggestion
|
|
96
104
|
}) : null,
|
|
97
105
|
test.errors.analysis ? /*#__PURE__*/ _jsx("p", {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SectionProps } from '../contracts.js';
|
|
2
2
|
/** Whole-page holdouts have no page of their own; their controls live under Advanced. */
|
|
3
|
-
export declare function PageHoldout({ test }: SectionProps): import("react").JSX.Element;
|
|
3
|
+
export declare function PageHoldout({ test }: SectionProps): import("react").JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
4
|
+
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
4
5
|
import { ARMS_COPY } from '../../copy/arms.js';
|
|
5
6
|
import { addHoldoutArm, removeArm, splitEvenly } from '../../arms/arms.model.js';
|
|
6
7
|
import { balanceWeight, trafficSplit } from './testPage.model.js';
|
|
@@ -11,6 +12,7 @@ import { Button } from '../../../ui/Button.js';
|
|
|
11
12
|
const arm = doc.arms.find((item)=>item.kind === 'holdout');
|
|
12
13
|
const index = doc.arms.findIndex((item)=>item.kind === 'holdout');
|
|
13
14
|
const reason = reasonFor(test, 'arms');
|
|
15
|
+
if (reason && !arm) return null;
|
|
14
16
|
return /*#__PURE__*/ _jsxs("div", {
|
|
15
17
|
children: [
|
|
16
18
|
arm ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -46,24 +48,22 @@ import { Button } from '../../../ui/Button.js';
|
|
|
46
48
|
test: test,
|
|
47
49
|
path: `arms.${index}`
|
|
48
50
|
}),
|
|
49
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
50
|
-
disabled: !!reason,
|
|
51
|
+
!reason ? /*#__PURE__*/ _jsx(Button, {
|
|
51
52
|
onClick: ()=>save(test, 'arms', ()=>({
|
|
52
53
|
arms: splitEvenly(removeArm(doc.arms, arm.key))
|
|
53
54
|
})),
|
|
54
55
|
children: C.remove
|
|
55
|
-
})
|
|
56
|
+
}) : null
|
|
56
57
|
]
|
|
57
|
-
}) : /*#__PURE__*/ _jsx(Button, {
|
|
58
|
-
disabled: !!reason,
|
|
58
|
+
}) : !reason ? /*#__PURE__*/ _jsx(Button, {
|
|
59
59
|
onClick: ()=>save(test, 'arms', ()=>({
|
|
60
60
|
arms: addHoldoutArm(doc.arms)
|
|
61
61
|
})),
|
|
62
62
|
children: C.addHoldout
|
|
63
|
-
}),
|
|
63
|
+
}) : null,
|
|
64
64
|
/*#__PURE__*/ _jsx("p", {
|
|
65
65
|
className: "xp-ui-help",
|
|
66
|
-
children: ARMS_COPY.holdout
|
|
66
|
+
children: ARMS_COPY.holdout(actionGroupLabel('control', doc.arms.find((arm)=>arm.key === 'control')?.label))
|
|
67
67
|
})
|
|
68
68
|
]
|
|
69
69
|
});
|
|
@@ -2,4 +2,5 @@ import type { SectionProps } from '../contracts.js';
|
|
|
2
2
|
/** Measure wrapping actions/copy so the final section always clears the fixed bar. */
|
|
3
3
|
export declare function ReadinessBar({ onHeightChange, ...props }: SectionProps & {
|
|
4
4
|
onHeightChange: (height: number) => void;
|
|
5
|
-
|
|
5
|
+
embedded?: boolean;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useRef } from 'react';
|
|
4
|
-
import { READINESS_COPY as C } from '../../copy/readiness.js';
|
|
5
4
|
import { ReadinessContent } from '../readiness/Banner.js';
|
|
6
5
|
/** Measure wrapping actions/copy so the final section always clears the fixed bar. */ export function ReadinessBar({ onHeightChange, ...props }) {
|
|
7
6
|
const ref = useRef(null);
|
|
@@ -20,13 +19,8 @@ import { ReadinessContent } from '../readiness/Banner.js';
|
|
|
20
19
|
}, [
|
|
21
20
|
onHeightChange
|
|
22
21
|
]);
|
|
23
|
-
return /*#__PURE__*/ _jsx(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"aria-label": C.label,
|
|
28
|
-
children: props.test.doc ? /*#__PURE__*/ _jsx(ReadinessContent, {
|
|
29
|
-
...props
|
|
30
|
-
}, `${props.test.doc.id}/${props.test.doc.status}/${props.test.doc.phase}`) : null
|
|
31
|
-
});
|
|
22
|
+
return props.test.doc ? /*#__PURE__*/ _jsx(ReadinessContent, {
|
|
23
|
+
...props,
|
|
24
|
+
barRef: ref
|
|
25
|
+
}, props.test.doc.id) : null;
|
|
32
26
|
}
|