@delmaredigital/payload-experiments 0.4.0-rc.2 → 0.4.0-rc.4
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 +283 -775
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +2 -2
- package/dist/admin/PlacementStatus.js +1 -1
- package/dist/admin/TestsDashboardCards.js +2 -2
- package/dist/admin/TestsNavLink.js +2 -2
- package/dist/admin/blocks/BlockPanel.js +3 -3
- package/dist/admin/blocks/TestBlockField.js +3 -3
- package/dist/admin/blocks/formApi.js +1 -1
- package/dist/admin/blocks/model.js +1 -1
- package/dist/admin/blocks/statusCache.js +1 -1
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +2 -2
- package/dist/admin/copy/blocks.js +3 -2
- package/dist/admin/copy/goals.d.ts +6 -1
- package/dist/admin/copy/goals.js +10 -3
- package/dist/admin/goals/XpGoalField.js +155 -129
- package/dist/admin/goals/xpGoalField.css +2 -3
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +4 -3
- package/dist/admin/surface/SurfaceShell.js +2 -2
- package/dist/admin/surface/TestsHome.d.ts +1 -1
- package/dist/admin/surface/TestsHome.js +3 -3
- package/dist/admin/surface/TestsSurface.js +2 -2
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +69 -15
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +4 -4
- package/dist/admin/surface/goals/data.js +2 -2
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +11 -1
- package/dist/admin/surface/goals/goals.model.js +43 -0
- package/dist/admin/surface/home.model.d.ts +1 -1
- package/dist/admin/surface/home.model.js +5 -5
- package/dist/admin/surface/newTest/NewTest.d.ts +1 -1
- package/dist/admin/surface/newTest/NewTest.js +1 -1
- package/dist/admin/surface/newTest/PageWizard.d.ts +1 -1
- package/dist/admin/surface/newTest/PageWizard.js +13 -13
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +8 -8
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +45 -156
- package/dist/admin/views/ExperimentsRootView.js +1 -1
- package/dist/admin/views/TestsNavLinkServer.js +1 -1
- package/dist/admin/views/renderCollectionList.js +1 -1
- package/dist/admin/views/renderTestsSurface.js +1 -1
- package/dist/blocks/placementLocale.d.ts +21 -0
- package/dist/blocks/placementLocale.js +115 -0
- package/dist/collections/experiments/config.js +1 -1
- package/dist/collections/metrics.js +1 -1
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +107 -0
- package/dist/db/placements.d.ts +2 -0
- package/dist/db/placements.js +8 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/index.js +28 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fields/xpGoal.js +1 -1
- package/dist/goals/picker/clickGoalPicker.model.d.ts +8 -1
- package/dist/goals/picker/clickGoalPicker.model.js +20 -2
- package/dist/goals/picker/copy.d.ts +6 -2
- package/dist/goals/picker/copy.js +11 -2
- package/dist/goals/picker/useClickGoalPicker.d.ts +1 -1
- package/dist/goals/picker/useClickGoalPicker.js +4 -2
- package/dist/goals/validate.js +3 -2
- package/dist/hooks/blockRemovalRule.d.ts +29 -0
- package/dist/hooks/blockRemovalRule.js +141 -0
- package/dist/hooks/pageGuard.d.ts +24 -2
- package/dist/hooks/pageGuard.js +178 -24
- package/dist/hooks/puckGoals.d.ts +2 -0
- package/dist/hooks/puckGoals.js +34 -10
- package/dist/lib/placementPages.d.ts +9 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +1 -4
- package/dist/onInit.js +22 -0
- package/dist/plugin.js +2 -1
- package/dist/puck/ExperimentPicker.js +25 -10
- package/dist/puck/copy.d.ts +4 -1
- package/dist/puck/copy.js +4 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +21 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +147 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +11 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +69 -9
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.js +317 -51
- package/dist/puck/editor/ResultsReadout.js +3 -5
- package/dist/puck/editor/VersionBuilder.js +2 -2
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -3
- package/dist/puck/editor/copy.d.ts +18 -2
- package/dist/puck/editor/copy.js +19 -3
- package/dist/puck/editor/editor.chrome.css +33 -0
- package/dist/puck/editor/editor.css +39 -0
- package/dist/puck/editor/editor.model.d.ts +14 -0
- package/dist/puck/editor/editor.model.js +58 -1
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/localPlacements.d.ts +2 -0
- package/dist/puck/editor/localPlacements.js +29 -0
- package/dist/puck/editor/placementsCache.d.ts +19 -0
- package/dist/puck/editor/placementsCache.js +83 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +109 -98
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/{admin → testSurface}/actions/DecideDialog.d.ts +2 -1
- package/dist/{admin → testSurface}/actions/DecideDialog.js +6 -4
- package/dist/{admin → testSurface}/api.js +4 -5
- package/dist/{admin → testSurface}/copy/common.d.ts +2 -0
- package/dist/{admin → testSurface}/copy/common.js +2 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +3 -0
- package/dist/{admin → testSurface}/copy/readiness.js +3 -0
- package/dist/{admin → testSurface}/copy/testPage.d.ts +3 -0
- package/dist/{admin → testSurface}/copy/testPage.js +7 -2
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/placements/placementLabels.js +1 -1
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/surface/contracts.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/pageBlock/parts.js +6 -6
- package/dist/testSurface/surface/pagePicker/pagePicker.css +10 -0
- package/dist/{admin → testSurface}/surface/readiness/useTransition.js +1 -0
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +2 -2
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +18 -11
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/test/GoalSection.js +3 -2
- package/dist/{admin → testSurface}/surface/test/Section.js +9 -8
- package/dist/testSurface/surface/test/TestSurface.d.ts +18 -0
- package/dist/testSurface/surface/test/TestSurface.js +152 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/{admin → testSurface}/surface/test/VersionsSection.js +12 -6
- package/dist/testSurface/surface/test/testPage.css +92 -0
- package/dist/{admin → testSurface}/surface/useTestDocument.d.ts +5 -1
- package/dist/{admin → testSurface}/surface/useTestDocument.js +34 -3
- package/dist/{admin → testSurface}/surfaceUrls.js +1 -1
- package/dist/transitions/placementInteractions.js +1 -1
- package/dist/transitions/placements.d.ts +27 -8
- package/dist/transitions/placements.js +77 -6
- package/dist/transitions/start.js +2 -2
- package/dist/types/endpoints.d.ts +1 -1
- package/dist/ui/Dialog.d.ts +4 -1
- package/dist/ui/Dialog.js +41 -3
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Tabs.d.ts +3 -3
- package/dist/ui/Tabs.js +35 -33
- package/dist/ui/ui.css +6 -0
- package/package.json +1 -1
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -19
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/results/results.css +0 -64
- package/dist/admin/styles.css +0 -10
- package/dist/admin/styles.d.ts +0 -2
- package/dist/admin/styles.js +0 -3
- package/dist/admin/surface/pagePicker/pagePicker.css +0 -10
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/testPage.css +0 -92
- /package/dist/{admin → testSurface}/PreviewLinks.d.ts +0 -0
- /package/dist/{admin → testSurface}/PreviewLinks.js +0 -0
- /package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/MakeContentResult.js +0 -0
- /package/dist/{admin → testSurface}/actions/actions.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/actions.model.js +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/actions/decide.model.js +0 -0
- /package/dist/{admin → testSurface}/allocation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/allocation.model.js +0 -0
- /package/dist/{admin → testSurface}/api.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/arms.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/pageTarget.model.js +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/arms/params.model.js +0 -0
- /package/dist/{admin → testSurface}/copy/actions.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/actions.js +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/advanced.js +0 -0
- /package/dist/{admin → testSurface}/copy/arms.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/arms.js +0 -0
- /package/dist/{admin → testSurface}/copy/audience.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/audience.js +0 -0
- /package/dist/{admin → testSurface}/copy/metrics.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/metrics.js +0 -0
- /package/dist/{admin → testSurface}/copy/pages.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/pages.js +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.js +0 -0
- /package/dist/{admin → testSurface}/copy/results.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/results.js +0 -0
- /package/dist/{admin → testSurface}/copy/review.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/review.js +0 -0
- /package/dist/{admin → testSurface}/copy/setting.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/setting.js +0 -0
- /package/dist/{admin → testSurface}/copy/surface.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/surface.js +0 -0
- /package/dist/{admin → testSurface}/format/date.d.ts +0 -0
- /package/dist/{admin → testSurface}/format/date.js +0 -0
- /package/dist/{admin → testSurface}/labels.d.ts +0 -0
- /package/dist/{admin → testSurface}/labels.js +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/lockedNotice.model.js +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/metricSource.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/placementLabels.model.js +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.d.ts +0 -0
- /package/dist/{admin → testSurface}/placements/usePlacementLabels.js +0 -0
- /package/dist/{admin → testSurface}/reload.d.ts +0 -0
- /package/dist/{admin → testSurface}/reload.js +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CappedCell.js +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/CiChart.js +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataQualityPanel.js +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/DataTable.js +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/StatTile.js +0 -0
- /package/dist/{admin → testSurface}/results/VerdictHero.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/VerdictHero.js +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/chart.model.js +0 -0
- /package/dist/{admin → testSurface}/results/format.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/format.js +0 -0
- /package/dist/{admin → testSurface}/results/legacy.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/legacy.js +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/releasePages.model.js +0 -0
- /package/dist/{admin → testSurface}/results/results.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/results.model.js +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.d.ts +0 -0
- /package/dist/{admin → testSurface}/results/snapshot.js +0 -0
- /package/dist/{admin → testSurface}/review/review.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/review/review.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/contracts.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/pageBlock.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/pageBlock/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/CopyRoute.js +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/PageCombobox.js +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/pagePicker/pagePicker.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/Banner.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/SaveStatus.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/SaveStatus.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/readiness.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/readiness.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/useTransition.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/ReleasePages.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/ReleasePages.js +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/recommendation.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/results/useResults.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/results/useResults.js +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/parts.js +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/setting/setting.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/AdvancedSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/LengthSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/LengthSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/PageHoldout.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/PageHoldout.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/Rail.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/Section.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/fields.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/fields.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/jumpToSection.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/pageParts.js +0 -0
- /package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/testPage.model.js +0 -0
- /package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/testDocument.model.js +0 -0
- /package/dist/{admin → testSurface}/surfaceUrls.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.d.ts +0 -0
- /package/dist/{admin → testSurface}/targeting/targeting.model.js +0 -0
- /package/dist/{admin → testSurface}/theme.d.ts +0 -0
- /package/dist/{admin → testSurface}/theme.js +0 -0
- /package/dist/{admin → testSurface}/useApi.d.ts +0 -0
- /package/dist/{admin → testSurface}/useApi.js +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useId } from 'react';
|
|
4
4
|
import { useClickGoalPicker } from '../../goals/picker/useClickGoalPicker.js';
|
|
5
|
+
import { clickGoalOptions } from '../../goals/picker/clickGoalPicker.model.js';
|
|
5
6
|
import { CLICK_GOAL_COPY as C } from '../../goals/picker/copy.js';
|
|
6
7
|
import { TextInput, Select } from '../../ui/Inputs.js';
|
|
7
8
|
import { Button } from '../../ui/Button.js';
|
|
@@ -9,8 +10,11 @@ import { resolvePuckRoutes } from '../routes.js';
|
|
|
9
10
|
import './editor.css';
|
|
10
11
|
function XpGoalPuckEditor({ value, onChange, api, readOnly }) {
|
|
11
12
|
const picker = useClickGoalPicker(api, {
|
|
13
|
+
enabled: !readOnly,
|
|
12
14
|
onSelect: onChange
|
|
13
15
|
});
|
|
16
|
+
const { options, missing } = clickGoalOptions(picker.status, picker.goals, value ?? '');
|
|
17
|
+
const readonly = readOnly || picker.status === 'not-manager';
|
|
14
18
|
const id = useId();
|
|
15
19
|
const stopEnter = (event)=>{
|
|
16
20
|
if (event.key === 'Enter') {
|
|
@@ -21,108 +25,115 @@ function XpGoalPuckEditor({ value, onChange, api, readOnly }) {
|
|
|
21
25
|
return /*#__PURE__*/ _jsxs("div", {
|
|
22
26
|
className: "xp-slot-root xp-puck-field",
|
|
23
27
|
children: [
|
|
24
|
-
/*#__PURE__*/
|
|
25
|
-
|
|
26
|
-
label: C.label,
|
|
27
|
-
value: value ?? '',
|
|
28
|
-
readOnly: readOnly,
|
|
29
|
-
onChange: (event)=>onChange(event.currentTarget.value)
|
|
30
|
-
}),
|
|
31
|
-
picker.canManage && !readOnly ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
28
|
+
readonly ? /*#__PURE__*/ _jsxs("div", {
|
|
29
|
+
className: "xp-ui-field",
|
|
32
30
|
children: [
|
|
33
|
-
/*#__PURE__*/
|
|
34
|
-
|
|
35
|
-
children: [
|
|
36
|
-
/*#__PURE__*/ _jsxs(Select, {
|
|
37
|
-
id: `${id}-picker`,
|
|
38
|
-
label: C.choose,
|
|
39
|
-
value: picker.goals.some((goal)=>goal.slug === value) ? value : '',
|
|
40
|
-
onChange: (event)=>{
|
|
41
|
-
if (event.currentTarget.value) onChange(event.currentTarget.value);
|
|
42
|
-
},
|
|
43
|
-
children: [
|
|
44
|
-
/*#__PURE__*/ _jsx("option", {
|
|
45
|
-
value: "",
|
|
46
|
-
children: C.choose
|
|
47
|
-
}),
|
|
48
|
-
picker.goals.map((goal)=>/*#__PURE__*/ _jsx("option", {
|
|
49
|
-
value: goal.slug,
|
|
50
|
-
children: goal.name
|
|
51
|
-
}, goal.id))
|
|
52
|
-
]
|
|
53
|
-
}),
|
|
54
|
-
!picker.panel.open ? /*#__PURE__*/ _jsx(Button, {
|
|
55
|
-
type: "button",
|
|
56
|
-
onClick: picker.open,
|
|
57
|
-
children: C.newGoal
|
|
58
|
-
}) : null
|
|
59
|
-
]
|
|
31
|
+
/*#__PURE__*/ _jsx("span", {
|
|
32
|
+
children: C.label
|
|
60
33
|
}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
open: picker.panel.advanced,
|
|
84
|
-
onToggle: (event)=>picker.setAdvanced(event.currentTarget.open),
|
|
85
|
-
children: [
|
|
86
|
-
/*#__PURE__*/ _jsx("summary", {
|
|
87
|
-
children: C.advanced
|
|
88
|
-
}),
|
|
89
|
-
/*#__PURE__*/ _jsx(TextInput, {
|
|
90
|
-
id: `${id}-slug`,
|
|
91
|
-
label: C.slug,
|
|
92
|
-
value: picker.panel.slug,
|
|
93
|
-
disabled: picker.panel.pending,
|
|
94
|
-
onKeyDown: stopEnter,
|
|
95
|
-
error: picker.panel.errors.slug,
|
|
96
|
-
onChange: (event)=>picker.setSlug(event.currentTarget.value)
|
|
97
|
-
})
|
|
98
|
-
]
|
|
99
|
-
}),
|
|
100
|
-
picker.panel.errors.general ? /*#__PURE__*/ _jsx("p", {
|
|
101
|
-
className: "xp-ui-error",
|
|
102
|
-
role: "alert",
|
|
103
|
-
children: picker.panel.errors.general
|
|
104
|
-
}) : null,
|
|
105
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
106
|
-
className: "xp-ui-button-group",
|
|
107
|
-
children: [
|
|
108
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
109
|
-
type: "button",
|
|
110
|
-
variant: "primary",
|
|
111
|
-
disabled: picker.panel.pending || !picker.panel.name.trim(),
|
|
112
|
-
onClick: ()=>void picker.create(),
|
|
113
|
-
children: C.createGoal
|
|
114
|
-
}),
|
|
115
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
116
|
-
type: "button",
|
|
117
|
-
disabled: picker.panel.pending,
|
|
118
|
-
onClick: picker.cancel,
|
|
119
|
-
children: C.cancel
|
|
120
|
-
})
|
|
121
|
-
]
|
|
122
|
-
})
|
|
123
|
-
]
|
|
34
|
+
/*#__PURE__*/ _jsx("p", {
|
|
35
|
+
children: value || C.none
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
}) : /*#__PURE__*/ _jsxs("div", {
|
|
39
|
+
className: "xp-ui-inline-row",
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsx(Select, {
|
|
42
|
+
id: `${id}-picker`,
|
|
43
|
+
label: C.label,
|
|
44
|
+
value: value ?? '',
|
|
45
|
+
disabled: picker.status !== 'ready',
|
|
46
|
+
onChange: (event)=>onChange(event.currentTarget.value),
|
|
47
|
+
children: options.map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
48
|
+
value: option.value,
|
|
49
|
+
children: option.label
|
|
50
|
+
}, option.value))
|
|
51
|
+
}),
|
|
52
|
+
picker.canManage && !picker.panel.open ? /*#__PURE__*/ _jsx(Button, {
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: picker.open,
|
|
55
|
+
children: C.newGoal
|
|
124
56
|
}) : null
|
|
125
57
|
]
|
|
58
|
+
}),
|
|
59
|
+
!readonly && picker.status === 'error' ? /*#__PURE__*/ _jsxs("div", {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ _jsx("p", {
|
|
62
|
+
className: "xp-ui-help",
|
|
63
|
+
children: C.loadError
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: picker.retry,
|
|
68
|
+
children: C.retry
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}) : null,
|
|
72
|
+
missing && !readonly ? /*#__PURE__*/ _jsx("p", {
|
|
73
|
+
className: "xp-ui-help",
|
|
74
|
+
role: "status",
|
|
75
|
+
children: C.undefinedKey
|
|
76
|
+
}) : null,
|
|
77
|
+
picker.canManage && !readOnly ? /*#__PURE__*/ _jsx(_Fragment, {
|
|
78
|
+
children: picker.panel.open ? /*#__PURE__*/ _jsxs("section", {
|
|
79
|
+
className: "xp-ui-subpanel",
|
|
80
|
+
"aria-labelledby": `${id}-title`,
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
83
|
+
id: `${id}-title`,
|
|
84
|
+
children: C.title
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
87
|
+
id: `${id}-name`,
|
|
88
|
+
label: C.name,
|
|
89
|
+
value: picker.panel.name,
|
|
90
|
+
disabled: picker.panel.pending,
|
|
91
|
+
onKeyDown: stopEnter,
|
|
92
|
+
onChange: (event)=>picker.setName(event.currentTarget.value)
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsxs("details", {
|
|
95
|
+
open: picker.panel.advanced,
|
|
96
|
+
onToggle: (event)=>picker.setAdvanced(event.currentTarget.open),
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsx("summary", {
|
|
99
|
+
children: C.advanced
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ _jsx(TextInput, {
|
|
102
|
+
id: `${id}-slug`,
|
|
103
|
+
label: C.slug,
|
|
104
|
+
value: picker.panel.slug,
|
|
105
|
+
disabled: picker.panel.pending,
|
|
106
|
+
onKeyDown: stopEnter,
|
|
107
|
+
error: picker.panel.errors.slug,
|
|
108
|
+
onChange: (event)=>picker.setSlug(event.currentTarget.value)
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
picker.panel.errors.general ? /*#__PURE__*/ _jsx("p", {
|
|
113
|
+
className: "xp-ui-error",
|
|
114
|
+
role: "alert",
|
|
115
|
+
children: picker.panel.errors.general
|
|
116
|
+
}) : null,
|
|
117
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
118
|
+
className: "xp-ui-button-group",
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
121
|
+
type: "button",
|
|
122
|
+
variant: "primary",
|
|
123
|
+
disabled: picker.panel.pending || !picker.panel.name.trim(),
|
|
124
|
+
onClick: ()=>void picker.create(),
|
|
125
|
+
children: C.createGoal
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
128
|
+
type: "button",
|
|
129
|
+
disabled: picker.panel.pending,
|
|
130
|
+
onClick: picker.cancel,
|
|
131
|
+
children: C.cancel
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}) : null
|
|
126
137
|
}) : null
|
|
127
138
|
]
|
|
128
139
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { CustomField } from '@puckeditor/core';
|
|
2
3
|
import type { ExperimentRef } from '../types/puck.js';
|
|
3
4
|
import { type PuckRoutes } from './routes.js';
|
|
4
5
|
export declare function createExperimentSlotField(opts?: {
|
|
5
6
|
label?: string;
|
|
6
7
|
routes?: PuckRoutes;
|
|
8
|
+
renderActions?: (experiment: ExperimentRef) => ReactNode;
|
|
9
|
+
onBind?: (previous: ExperimentRef | null, next: ExperimentRef | null) => void;
|
|
7
10
|
}): CustomField<ExperimentRef | null>;
|
|
@@ -12,10 +12,21 @@ export function createExperimentSlotField(opts) {
|
|
|
12
12
|
routes,
|
|
13
13
|
children: createElement('div', {
|
|
14
14
|
className: 'xp-puck-field'
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
}, ...opts?.renderActions ? [
|
|
16
|
+
createElement(ExperimentPicker, {
|
|
17
|
+
value,
|
|
18
|
+
onChange: (next)=>{
|
|
19
|
+
opts?.onBind?.(value, next);
|
|
20
|
+
onChange(next);
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
value ? opts.renderActions(value) : null
|
|
24
|
+
] : [
|
|
25
|
+
createElement(ExperimentPicker, {
|
|
26
|
+
value,
|
|
27
|
+
onChange
|
|
28
|
+
})
|
|
29
|
+
])
|
|
19
30
|
})
|
|
20
31
|
};
|
|
21
32
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { DocId } from '../../types/contracts.js';
|
|
2
2
|
import type { PreflightResult } from '../../types/endpoints.js';
|
|
3
3
|
import type { ActionGroup } from './actions.model.js';
|
|
4
|
-
export declare function DecideDialog({ id, arms, checks, onClose, apiRoute }: {
|
|
4
|
+
export declare function DecideDialog({ id, arms, checks, onClose, apiRoute, onSuccess }: {
|
|
5
5
|
apiRoute: string;
|
|
6
|
+
onSuccess?: (doc?: Record<string, unknown>) => void;
|
|
6
7
|
id: DocId;
|
|
7
8
|
arms: readonly ActionGroup[];
|
|
8
9
|
checks?: PreflightResult['checks'];
|
|
@@ -9,8 +9,8 @@ import { reloadPage } from '../reload.js';
|
|
|
9
9
|
import { RESULTS_COPY } from '../copy/results.js';
|
|
10
10
|
import { ACTIONS_COPY as C, decideCopy } from '../copy/actions.js';
|
|
11
11
|
import { decideState } from './decide.model.js';
|
|
12
|
-
import {
|
|
13
|
-
export function DecideDialog({ id, arms, checks = [], onClose, apiRoute }) {
|
|
12
|
+
import { Dialog } from '../../ui/Dialog.js';
|
|
13
|
+
export function DecideDialog({ id, arms, checks = [], onClose, apiRoute, onSuccess }) {
|
|
14
14
|
const api = useApi(apiRoute);
|
|
15
15
|
const [snapshot, setSnapshot] = useState(null);
|
|
16
16
|
const [chosenArm, setChosenArm] = useState(null);
|
|
@@ -73,7 +73,8 @@ export function DecideDialog({ id, arms, checks = [], onClose, apiRoute }) {
|
|
|
73
73
|
setError(null);
|
|
74
74
|
const result = await api.decide(id, state.body);
|
|
75
75
|
if (result.ok) {
|
|
76
|
-
|
|
76
|
+
if (onSuccess) onSuccess(result.data?.doc);
|
|
77
|
+
else reloadPage();
|
|
77
78
|
return;
|
|
78
79
|
} else {
|
|
79
80
|
setError(result);
|
|
@@ -87,7 +88,8 @@ export function DecideDialog({ id, arms, checks = [], onClose, apiRoute }) {
|
|
|
87
88
|
}
|
|
88
89
|
const enabled = !busy && !loading && !loadFailed && state.canSubmit;
|
|
89
90
|
const label = state.options.find((option)=>option.value === chosenArm)?.label;
|
|
90
|
-
return /*#__PURE__*/ _jsxs(
|
|
91
|
+
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
92
|
+
open: true,
|
|
91
93
|
dismissible: !busy,
|
|
92
94
|
initialFocus: "cancel",
|
|
93
95
|
title: C.decide,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { API_MESSAGES, refusalMessage } from './copy/common.js';
|
|
2
|
-
import { BLOCK_COPY } from './copy/blocks.js';
|
|
3
2
|
import { CONTENT_ENTRY_REFUSALS } from './copy/actions.js';
|
|
4
3
|
export function createApi(apiBase) {
|
|
5
4
|
const collectionBase = `${apiBase.replace(/\/$/, '')}/xp-experiments`;
|
|
@@ -75,7 +74,7 @@ export function createApi(apiBase) {
|
|
|
75
74
|
status: 404,
|
|
76
75
|
code: 'not-found',
|
|
77
76
|
message: refusalMessage('not-found', 404, undefined, {
|
|
78
|
-
notFound:
|
|
77
|
+
notFound: API_MESSAGES.testAlreadyDeleted
|
|
79
78
|
}),
|
|
80
79
|
retryable: false
|
|
81
80
|
};
|
|
@@ -85,10 +84,10 @@ export function createApi(apiBase) {
|
|
|
85
84
|
};
|
|
86
85
|
},
|
|
87
86
|
deleteTest: (id)=>request(()=>`${collectionBase}/${encodeURIComponent(id)}`, 'DELETE', undefined, {
|
|
88
|
-
notFound:
|
|
89
|
-
forbidden:
|
|
87
|
+
notFound: API_MESSAGES.testNoLongerDraft,
|
|
88
|
+
forbidden: API_MESSAGES.testNoLongerDraft,
|
|
90
89
|
codes: {
|
|
91
|
-
'invalid-status':
|
|
90
|
+
'invalid-status': API_MESSAGES.testNoLongerDraft
|
|
92
91
|
}
|
|
93
92
|
}),
|
|
94
93
|
wrapBlock: (body)=>request(()=>`${apiBase.replace(/\/$/, '')}/xp/blocks/wrap`, 'POST', body),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const API_MESSAGES: {
|
|
2
|
+
readonly testAlreadyDeleted: "This test was already deleted. Reload the page.";
|
|
3
|
+
readonly testNoLongerDraft: "This test is no longer a draft. Reload the page.";
|
|
2
4
|
readonly notFound: "This test no longer exists.";
|
|
3
5
|
readonly goalNotFound: "That goal no longer exists. Choose another goal.";
|
|
4
6
|
readonly roundChanged: "This round has changed. Reload the page.";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export const API_MESSAGES = {
|
|
2
|
+
testAlreadyDeleted: 'This test was already deleted. Reload the page.',
|
|
3
|
+
testNoLongerDraft: 'This test is no longer a draft. Reload the page.',
|
|
2
4
|
notFound: 'This test no longer exists.',
|
|
3
5
|
goalNotFound: 'That goal no longer exists. Choose another goal.',
|
|
4
6
|
roundChanged: 'This round has changed. Reload the page.',
|
|
@@ -67,6 +67,9 @@ export declare const attributeNext: (attribute: string) => string;
|
|
|
67
67
|
export declare const stoppedCopy: (date: string | null) => string;
|
|
68
68
|
export declare const decidedCopy: (date: string | null, winner: string) => string;
|
|
69
69
|
export declare const runningCopy: (date: string | null, people: number | null, days: number | null) => string;
|
|
70
|
+
export declare const lastBlockPlacementCopy: (name: string, removingPage?: boolean) => string;
|
|
71
|
+
export declare const bulkBlockRemovalCopy: (name: string) => string;
|
|
72
|
+
export declare const pendingBlockRemovalCopy: (name: string) => string;
|
|
70
73
|
/** After archive the guard protects the winner and the Original; only the winner page is "the winner". */
|
|
71
74
|
export declare const pageGuardCopy: (name: string, status: "running" | "decided" | "archived", role?: "winner" | "original") => string;
|
|
72
75
|
export declare const versionPageUnavailableCopy: (path: string, status?: string) => string;
|
|
@@ -68,6 +68,9 @@ export const runningCopy = (date, people, days)=>[
|
|
|
68
68
|
people === null ? null : `${people.toLocaleString('en-US')} people so far`,
|
|
69
69
|
days === null ? null : `about ${days} days to go`
|
|
70
70
|
].filter(Boolean).join(' · ');
|
|
71
|
+
export const lastBlockPlacementCopy = (name, removingPage = false)=>removingPage ? `“${name}” is running and this page is the only published place it appears. Stop the test first.` : `“${name}” is running and this is the only published place it appears. Stop the test, or keep its block on this page.`;
|
|
72
|
+
export const bulkBlockRemovalCopy = (name)=>`“${name}” is running and the pages in this change are the only published places it appears. Stop the test first.`;
|
|
73
|
+
export const pendingBlockRemovalCopy = (name)=>`“${name}” is running and the pages in this change are the only published places it appears. Stop the test first, or change these pages one at a time.`;
|
|
71
74
|
/** After archive the guard protects the winner and the Original; only the winner page is "the winner". */ export const pageGuardCopy = (name, status, role = 'winner')=>status === 'archived' ? role === 'original' ? `This page's address now shows the winner of the finished test "${name}". To free it, open the test and choose "Release pages".` : `This page is shown at other addresses because the finished test "${name}" made it the winner. To free it, open the test and choose "Release pages".` : status === 'decided' ? `This page is part of the decided test "${name}". Choose "Make it the content" or "Discard winner" on the test before you delete, rename or unpublish it.` : `This page is part of the running test "${name}". Stop the test before you delete, rename or unpublish it.`;
|
|
72
75
|
export const versionPageUnavailableCopy = (path, status = 'running')=>`${path} isn't published, so visitors assigned to it see an error. Republish it, or ${status === 'decided' ? 'discard the winner' : 'stop the test'}.`;
|
|
73
76
|
export const versionPageUncheckedCopy = (path, status = 'running')=>`Couldn't check whether ${path} is published. Check that it is still published, or ${status === 'decided' ? 'discard the winner' : 'stop the test'}.`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const TEST_PAGE: {
|
|
2
|
+
readonly editVersionsOnCanvas: "Edit version content on the canvas.";
|
|
2
3
|
readonly clickPageGroup: "On this test's page";
|
|
3
4
|
readonly clickGoalsNote: "Goals inside linked documents aren't shown. Goals added in code (data-xp-goal) work but aren't listed here.";
|
|
4
5
|
readonly clickGoalHelp: "A click shows interest, not the result you want.";
|
|
@@ -62,8 +63,10 @@ export declare const TEST_PAGE: {
|
|
|
62
63
|
readonly traffic: "How people are split";
|
|
63
64
|
readonly goal: "Goal";
|
|
64
65
|
readonly goalHelp: "The goal decides whether a version wins. Pick the one thing you want more of.";
|
|
66
|
+
readonly guardrailsShort: "Must not get worse";
|
|
65
67
|
readonly guardrails: "Must not get worse (optional)";
|
|
66
68
|
readonly guardrailHelp: "If a version makes one of these worse, you'll be warned.";
|
|
69
|
+
readonly secondaryShort: "Also keep an eye on";
|
|
67
70
|
readonly secondary: "Also keep an eye on (optional)";
|
|
68
71
|
readonly manageGoals: "Manage goals";
|
|
69
72
|
readonly searchGoals: "Search goals";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
const guardrailsShort = 'Must not get worse';
|
|
2
|
+
const secondaryShort = 'Also keep an eye on';
|
|
1
3
|
export const TEST_PAGE = {
|
|
4
|
+
editVersionsOnCanvas: 'Edit version content on the canvas.',
|
|
2
5
|
clickPageGroup: "On this test's page",
|
|
3
6
|
clickGoalsNote: "Goals inside linked documents aren't shown. Goals added in code (data-xp-goal) work but aren't listed here.",
|
|
4
7
|
clickGoalHelp: 'A click shows interest, not the result you want.',
|
|
@@ -62,9 +65,11 @@ export const TEST_PAGE = {
|
|
|
62
65
|
traffic: 'How people are split',
|
|
63
66
|
goal: 'Goal',
|
|
64
67
|
goalHelp: 'The goal decides whether a version wins. Pick the one thing you want more of.',
|
|
65
|
-
|
|
68
|
+
guardrailsShort,
|
|
69
|
+
guardrails: `${guardrailsShort} (optional)`,
|
|
66
70
|
guardrailHelp: "If a version makes one of these worse, you'll be warned.",
|
|
67
|
-
|
|
71
|
+
secondaryShort,
|
|
72
|
+
secondary: `${secondaryShort} (optional)`,
|
|
68
73
|
manageGoals: 'Manage goals',
|
|
69
74
|
searchGoals: 'Search goals',
|
|
70
75
|
chooseGoal: 'Choose a goal',
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Path-only admin URLs, preserving Payload's root-route and trailing-slash behavior.
|
|
2
|
+
* Source: Payload 3.90.2 utilities/formatAdminURL.ts (MIT).
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatAdminURL({ adminRoute, path }: {
|
|
5
|
+
adminRoute: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
}): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Path-only admin URLs, preserving Payload's root-route and trailing-slash behavior.
|
|
2
|
+
* Source: Payload 3.90.2 utilities/formatAdminURL.ts (MIT).
|
|
3
|
+
*/ export function formatAdminURL({ adminRoute, path = '' }) {
|
|
4
|
+
const url = `${adminRoute === '/' ? '' : adminRoute.replace(/\/$/, '')}${path}` || '/';
|
|
5
|
+
if (process.env.NEXT_TRAILING_SLASH !== 'true') return url;
|
|
6
|
+
const index = url.search(/[?#]/);
|
|
7
|
+
const pathname = index === -1 ? url : url.slice(0, index);
|
|
8
|
+
return pathname.endsWith('/') ? url : `${pathname}/${index === -1 ? '' : url.slice(index)}`;
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatAdminURL } from '
|
|
1
|
+
import { formatAdminURL } from '../format/adminURL.js';
|
|
2
2
|
import { placementDetail } from './placementLabels.model.js';
|
|
3
3
|
export { placementDetailKey, placementDetail, fallbackPlacementLabel } from './placementLabels.model.js';
|
|
4
4
|
export function resolvedPlacementLabel(value, match, adminRoute) {
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { PreflightResult } from '../types/endpoints.js';
|
|
2
|
+
import { type PreviewPage } from '../lib/placementPages.js';
|
|
2
3
|
type Placement = PreflightResult['placements'][number];
|
|
3
|
-
type PreviewPage = Placement & {
|
|
4
|
-
key: string;
|
|
5
|
-
slotCount: number;
|
|
6
|
-
};
|
|
7
|
-
/** Preview URLs identify pages; counts use the most placements in any one version. */
|
|
8
|
-
export declare function previewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
9
4
|
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */
|
|
10
5
|
export declare function actionablePreviewPages(placements: readonly Placement[], flagPoint?: string): PreviewPage[];
|
|
11
6
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { placementPages } from '../lib/placementPages.js';
|
|
2
|
+
/** Pages that offer something to do: a preview or an editor link. The section is hidden when none do. */ export function actionablePreviewPages(placements, flagPoint) {
|
|
3
|
+
return placementPages(placements, flagPoint).filter((page)=>page.url || page.editorUrl);
|
|
4
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
:where(.xp-test-surface) .xp-results { max-width: 1120px; display: grid; gap: var(--xp-space-8); min-width: 0; }
|
|
2
|
+
:where(.xp-test-surface) .xp-results h2, :where(.xp-test-surface) .xp-results h3, :where(.xp-test-surface) .xp-results p { margin: 0; }
|
|
3
|
+
:where(.xp-test-surface) .xp-verdict-hero { background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); padding: 28px; min-width: 0; }
|
|
4
|
+
:where(.xp-test-surface) .xp-verdict-hero h2 { font: var(--xp-text-display); letter-spacing: -0.01em; max-width: 36ch; }
|
|
5
|
+
:where(.xp-test-surface) .xp-verdict-hero p { margin-top: var(--xp-space-2); color: var(--xp-text-2); }
|
|
6
|
+
:where(.xp-test-surface) .xp-verdict-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--xp-space-3); margin-top: var(--xp-space-5); padding-top: var(--xp-space-4); border-top: 1px solid var(--xp-border); color: var(--xp-text-3); font: var(--xp-text-small); }
|
|
7
|
+
:where(.xp-test-surface) .xp-round-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--xp-space-2); min-width: 0; }
|
|
8
|
+
:where(.xp-test-surface) .xp-round-meta .xp-ui-field { display: flex; align-items: center; gap: var(--xp-space-2); margin: 0; min-width: 0; }
|
|
9
|
+
:where(.xp-test-surface) .xp-round-meta select { width: auto; max-width: 100%; }
|
|
10
|
+
:where(.xp-test-surface) .xp-results-chips { display: flex; flex-wrap: wrap; gap: var(--xp-space-2); list-style: none; padding: 0; margin-bottom: 0; }
|
|
11
|
+
:where(.xp-test-surface) .xp-stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); overflow: hidden; }
|
|
12
|
+
:where(.xp-test-surface) .xp-stat-tile { padding: 20px; min-width: 0; }
|
|
13
|
+
:where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 1px solid var(--xp-border); }
|
|
14
|
+
:where(.xp-test-surface) .xp-stat-tile-label, :where(.xp-test-surface) .xp-stat-tile-detail { font: var(--xp-text-small); color: var(--xp-text-2); }
|
|
15
|
+
:where(.xp-test-surface) .xp-stat-tile-value { margin-top: 6px; font: 600 32px/36px var(--xp-font); font-variant-numeric: tabular-nums; }
|
|
16
|
+
:where(.xp-test-surface) .xp-stat-tile-detail { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
|
|
17
|
+
:where(.xp-test-surface) .xp-results-block { min-width: 0; }
|
|
18
|
+
:where(.xp-test-surface) .xp-results-block-head { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
|
19
|
+
:where(.xp-test-surface) .xp-results-block-head h2 { font: var(--xp-text-title); }
|
|
20
|
+
:where(.xp-test-surface) .xp-results-block-meta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--xp-text-2); }
|
|
21
|
+
:where(.xp-test-surface) .xp-data-table-frame { position: relative; min-width: 0; border-radius: var(--xp-radius-card); }
|
|
22
|
+
:where(.xp-test-surface) .xp-data-table-wrap { overflow-x: auto; overflow-y: auto; max-height: 70vh; border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); }
|
|
23
|
+
:where(.xp-test-surface) .xp-data-table-wrap:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
24
|
+
/* Overlays stay visible above opaque sticky headers and the highlighted row. */
|
|
25
|
+
:where(.xp-test-surface) .xp-data-table-frame::before, :where(.xp-test-surface) .xp-data-table-frame::after { content: ''; position: absolute; top: 1px; bottom: 1px; width: var(--xp-space-6); z-index: 3; pointer-events: none; opacity: 0; }
|
|
26
|
+
:where(.xp-test-surface) .xp-data-table-frame::before { left: 1px; border-radius: var(--xp-radius-card) 0 0 var(--xp-radius-card); background: linear-gradient(to right, var(--xp-border-strong), transparent); }
|
|
27
|
+
:where(.xp-test-surface) .xp-data-table-frame::after { right: 1px; border-radius: 0 var(--xp-radius-card) var(--xp-radius-card) 0; background: linear-gradient(to left, var(--xp-border-strong), transparent); }
|
|
28
|
+
:where(.xp-test-surface) .xp-data-table-frame.has-left::before, :where(.xp-test-surface) .xp-data-table-frame.has-right::after { opacity: 1; }
|
|
29
|
+
:where(.xp-test-surface) .xp-data-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 14px/20px var(--xp-font); }
|
|
30
|
+
:where(.xp-test-surface) .xp-data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
|
|
31
|
+
:where(.xp-test-surface) .xp-data-table th, :where(.xp-test-surface) .xp-data-table td { padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid var(--xp-border); text-align: left; }
|
|
32
|
+
:where(.xp-test-surface) .xp-data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--xp-surface); font: var(--xp-text-small); color: var(--xp-text-2); }
|
|
33
|
+
:where(.xp-test-surface) .xp-data-table tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--xp-surface); }
|
|
34
|
+
:where(.xp-test-surface) .xp-data-table thead tr > :first-child { z-index: 2; }
|
|
35
|
+
:where(.xp-test-surface) .xp-data-table tbody th { font-weight: 400; }
|
|
36
|
+
:where(.xp-test-surface) .xp-data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
37
|
+
:where(.xp-test-surface) .xp-data-table .muted { color: var(--xp-text-3); }
|
|
38
|
+
:where(.xp-test-surface) .xp-data-table tr:last-child > * { border-bottom: 0; }
|
|
39
|
+
:where(.xp-test-surface) .xp-data-table tr.is-lead > * { background: var(--xp-surface-2); font-weight: 600; }
|
|
40
|
+
:where(.xp-test-surface) .xp-results-group { display: inline-flex; align-items: center; gap: 8px; }
|
|
41
|
+
:where(.xp-test-surface) .xp-results-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
|
|
42
|
+
:where(.xp-test-surface) .xp-results-panel { border: 1px solid var(--xp-border); border-radius: var(--xp-radius-card); background: var(--xp-surface); min-width: 0; }
|
|
43
|
+
:where(.xp-test-surface) .xp-results-panel > summary { padding: 16px 20px; cursor: pointer; font: var(--xp-text-title); }
|
|
44
|
+
:where(.xp-test-surface) .xp-results-panel > summary:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
45
|
+
:where(.xp-test-surface) .xp-results-panel > summary .xp-quality-chip { margin-left: 12px; }
|
|
46
|
+
:where(.xp-test-surface) .xp-quality-row { padding: 14px 20px; border-top: 1px solid var(--xp-border); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; }
|
|
47
|
+
:where(.xp-test-surface) .xp-quality-row > :not(:first-child) { grid-column: 2; }
|
|
48
|
+
:where(.xp-test-surface) .xp-quality-row ul { margin: 0; padding-left: 20px; }
|
|
49
|
+
:where(.xp-test-surface) .xp-quality-detail, :where(.xp-test-surface) .xp-quality-next, :where(.xp-test-surface) .xp-results-cap-help { color: var(--xp-text-2); font: var(--xp-text-small); }
|
|
50
|
+
:where(.xp-test-surface) .xp-quality-chip { display: inline-flex; align-self: start; padding: 2px 8px; border-radius: var(--xp-radius-chip); font: var(--xp-text-small); color: var(--xp-success); background: var(--xp-success-bg); }
|
|
51
|
+
:where(.xp-test-surface) .xp-quality-chip--watch { color: var(--xp-warning); background: var(--xp-warning-bg); }
|
|
52
|
+
:where(.xp-test-surface) .xp-quality-chip--problem { color: var(--xp-error); background: var(--xp-error-bg); }
|
|
53
|
+
:where(.xp-test-surface) .xp-ci-chart { padding: 20px; overflow-x: auto; }
|
|
54
|
+
:where(.xp-test-surface) .xp-ci-chart svg { display: block; min-width: 560px; }
|
|
55
|
+
:where(.xp-test-surface) .xp-ci-chart ul { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; margin: 0; padding: 0; font: var(--xp-text-small); }
|
|
56
|
+
:where(.xp-test-surface) .xp-preview-links { display: grid; gap: 12px; }
|
|
57
|
+
:where(.xp-test-surface) .xp-preview-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--xp-border); padding-bottom: 12px; }
|
|
58
|
+
@media (max-width: 720px) {
|
|
59
|
+
:where(.xp-test-surface) .xp-stat-tiles { grid-template-columns: minmax(0, 1fr); }
|
|
60
|
+
:where(.xp-test-surface) .xp-stat-tile + .xp-stat-tile { border-left: 0; border-top: 1px solid var(--xp-border); }
|
|
61
|
+
:where(.xp-test-surface) .xp-verdict-hero { padding: 20px; }
|
|
62
|
+
:where(.xp-test-surface) .xp-verdict-hero h2 { font-size: 24px; line-height: 30px; }
|
|
63
|
+
}
|
|
64
|
+
:where(.xp-test-surface) .xp-results-as-of { color: var(--xp-text-2); }
|
|
@@ -1,7 +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 { Button } from '../../../ui/Button.js';
|
|
4
|
-
import {
|
|
4
|
+
import { placementPages } from '../../../lib/placementPages.js';
|
|
5
5
|
import { TEST_PAGE as C, placementCount } from '../../copy/testPage.js';
|
|
6
6
|
import { placementLine, slotReady } from './pageBlock.model.js';
|
|
7
7
|
function Binding({ test }) {
|
|
@@ -10,7 +10,7 @@ function Binding({ test }) {
|
|
|
10
10
|
className: "xp-page-binding",
|
|
11
11
|
children: placements.length ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
12
12
|
children: [
|
|
13
|
-
|
|
13
|
+
placementPages(placements).map((placement)=>/*#__PURE__*/ _jsxs("p", {
|
|
14
14
|
className: "xp-ui-button-group",
|
|
15
15
|
children: [
|
|
16
16
|
placementLine(placement),
|
|
@@ -33,7 +33,7 @@ function Binding({ test }) {
|
|
|
33
33
|
})
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
function VersionContent({ test, armIndex }) {
|
|
36
|
+
function VersionContent({ test, armIndex, summary }) {
|
|
37
37
|
const arm = test.doc?.arms[armIndex];
|
|
38
38
|
if (!arm) return null;
|
|
39
39
|
if (arm.kind === 'holdout') return /*#__PURE__*/ _jsx("span", {
|
|
@@ -41,7 +41,7 @@ function VersionContent({ test, armIndex }) {
|
|
|
41
41
|
children: C.holdoutContent
|
|
42
42
|
});
|
|
43
43
|
const placements = test.preflight?.placements ?? [];
|
|
44
|
-
const pages =
|
|
44
|
+
const pages = placementPages(placements);
|
|
45
45
|
const ready = placements.length > 0 && placements.every((placement)=>slotReady(placement, arm));
|
|
46
46
|
return /*#__PURE__*/ _jsxs("div", {
|
|
47
47
|
className: "xp-version-content",
|
|
@@ -52,13 +52,13 @@ function VersionContent({ test, armIndex }) {
|
|
|
52
52
|
}),
|
|
53
53
|
/*#__PURE__*/ _jsx("div", {
|
|
54
54
|
className: "xp-ui-button-group",
|
|
55
|
-
children: pages.filter((page)=>page.editorUrl).map((page)=>/*#__PURE__*/ _jsx(Button, {
|
|
55
|
+
children: !summary ? pages.filter((page)=>page.editorUrl).map((page)=>/*#__PURE__*/ _jsx(Button, {
|
|
56
56
|
variant: "link",
|
|
57
57
|
size: "sm",
|
|
58
58
|
href: page.editorUrl,
|
|
59
59
|
"aria-label": pages.length > 1 ? `${C.editOnPage}: ${page.title}` : undefined,
|
|
60
60
|
children: C.editOnPage
|
|
61
|
-
}, page.key))
|
|
61
|
+
}, page.key)) : null
|
|
62
62
|
})
|
|
63
63
|
]
|
|
64
64
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
:where(.xp-test-surface) .xp-page-combobox { position: relative; width: 100%; min-width: 0; }
|
|
2
|
+
:where(.xp-test-surface) .xp-page-combobox input { width: 100%; }
|
|
3
|
+
:where(.xp-test-surface) .xp-page-combobox-popup { position: absolute; inset-inline: 0; z-index: 5; max-height: 24rem; overflow-y: auto; background: var(--xp-surface); color: var(--xp-text); border: 1px solid var(--xp-border-strong); border-radius: var(--xp-radius-control); padding: var(--xp-space-1); }
|
|
4
|
+
:where(.xp-test-surface) .xp-page-option { position: relative; display: block; width: 100%; box-sizing: border-box; text-align: left; padding: var(--xp-space-3); padding-inline-end: var(--xp-space-6); border: 2px solid transparent; border-radius: var(--xp-radius-control); cursor: pointer; color: var(--xp-text); background: var(--xp-surface); overflow-wrap: anywhere; }
|
|
5
|
+
:where(.xp-test-surface) .xp-page-option-detail { display: block; color: var(--xp-text-2); font: var(--xp-text-small); }
|
|
6
|
+
:where(.xp-test-surface) .xp-page-option[aria-selected='true'] { border-color: var(--xp-accent); }
|
|
7
|
+
:where(.xp-test-surface) .xp-page-option-check { position: absolute; inset-inline-end: var(--xp-space-2); top: var(--xp-space-3); color: var(--xp-accent); }
|
|
8
|
+
:where(.xp-test-surface) .xp-page-option[data-active='true'] { background: var(--xp-surface-2); outline: 2px solid var(--xp-focus); outline-offset: -4px; }
|
|
9
|
+
:where(.xp-test-surface) .xp-page-option[aria-disabled='true'] { cursor: not-allowed; border-color: var(--xp-text-2); border-style: dashed; }
|
|
10
|
+
:where(.xp-test-surface) .xp-page-option[aria-disabled='true'] strong { font-weight: 400; }
|