@delmaredigital/payload-experiments 0.4.0-rc.7 → 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 +9 -15
- 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 +7 -6
- 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 +12 -10
- 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 +224 -52
- 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 +99 -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 +98 -66
- 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 +2 -2
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/experiments/config.js +8 -3
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/deleteImpact.js +2 -1
- 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/events.js +103 -39
- package/dist/endpoints/index.js +22 -8
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +8 -4
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +9 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +6 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/goals/fairness.js +2 -2
- 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/hostHook.js +6 -2
- package/dist/hooks/pageGuard.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/lib/fetchAllDocs.d.ts +1 -1
- package/dist/manifest/compile.js +8 -5
- package/dist/onInit.js +14 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +56 -2
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +40 -29
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +376 -139
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +6 -3
- package/dist/puck/editor/QuickTestActions.js +55 -33
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +28 -15
- package/dist/puck/editor/VersionBuilder.d.ts +17 -4
- package/dist/puck/editor/VersionBuilder.js +175 -112
- package/dist/puck/editor/armWrites.js +2 -2
- package/dist/puck/editor/armsCache.js +1 -3
- package/dist/puck/editor/copy.d.ts +14 -7
- package/dist/puck/editor/copy.js +26 -13
- package/dist/puck/editor/editor.chrome.css +10 -8
- package/dist/puck/editor/editor.css +15 -9
- package/dist/puck/editor/editor.model.d.ts +1 -0
- package/dist/puck/editor/placementsCache.d.ts +4 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- 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/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.d.ts +4 -4
- package/dist/results/verdict.js +15 -11
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +20 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +11 -2
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +2 -5
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +10 -4
- package/dist/testSurface/actions/DecideDialog.js +93 -63
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
- package/dist/testSurface/actions/MakeContentResult.js +10 -2
- 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 +9 -6
- package/dist/testSurface/api.js +43 -23
- package/dist/testSurface/copy/actions.d.ts +37 -14
- package/dist/testSurface/copy/actions.js +40 -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 +8 -6
- package/dist/testSurface/copy/common.js +8 -6
- package/dist/testSurface/copy/languages.d.ts +1 -0
- package/dist/testSurface/copy/languages.js +1 -0
- package/dist/testSurface/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +9 -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 +20 -7
- package/dist/testSurface/copy/readiness.js +36 -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 +21 -12
- package/dist/testSurface/copy/results.js +24 -13
- 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 +36 -12
- package/dist/testSurface/copy/testPage.js +53 -16
- 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 +4 -0
- package/dist/testSurface/readPreflight.js +6 -0
- package/dist/testSurface/readinessRead.d.ts +3 -0
- package/dist/testSurface/readinessRead.js +4 -0
- 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 +3 -2
- package/dist/testSurface/results/VerdictHero.js +5 -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 +9 -4
- package/dist/testSurface/results/results.model.js +31 -23
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +13 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +3 -3
- package/dist/testSurface/surface/editorPlacement.js +2 -2
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +3 -3
- 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 +300 -197
- 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 +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +241 -230
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +113 -141
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +8 -4
- package/dist/testSurface/surface/readiness/SaveStatus.js +23 -22
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -6
- package/dist/testSurface/surface/readiness/readiness.model.js +168 -21
- package/dist/testSurface/surface/readiness/useTransition.d.ts +6 -4
- package/dist/testSurface/surface/readiness/useTransition.js +57 -14
- package/dist/testSurface/surface/results/ReleasePages.d.ts +6 -3
- package/dist/testSurface/surface/results/ReleasePages.js +42 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +11 -4
- package/dist/testSurface/surface/results/ResultsBody.js +221 -118
- 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 +13 -8
- package/dist/testSurface/surface/results/useResults.js +3 -2
- package/dist/testSurface/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +11 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +10 -2
- package/dist/testSurface/surface/test/DeleteTest.js +173 -74
- package/dist/testSurface/surface/test/GoalSection.js +18 -14
- package/dist/testSurface/surface/test/LengthSection.js +24 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +11 -8
- 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 +82 -12
- package/dist/testSurface/surface/test/TestSurface.js +73 -37
- package/dist/testSurface/surface/test/VersionsSection.js +141 -91
- package/dist/testSurface/surface/test/fields.d.ts +32 -6
- package/dist/testSurface/surface/test/fields.js +166 -52
- package/dist/testSurface/surface/test/pageParts.js +27 -12
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
- package/dist/testSurface/surface/test/testPage.model.js +6 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
- package/dist/testSurface/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +21 -5
- package/dist/testSurface/surface/useTestDocument.js +472 -167
- 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 +8 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.js +3 -1
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +1 -0
- package/dist/transitions/checkStart.js +17 -6
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +5 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +12 -8
- package/dist/transitions/nestedPlacementNames.d.ts +2 -2
- package/dist/transitions/nestedPlacementNames.js +4 -5
- 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/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +8 -7
- package/dist/transitions/placements.d.ts +2 -0
- package/dist/transitions/placements.js +5 -5
- package/dist/transitions/preflightData.d.ts +3 -2
- package/dist/transitions/preflightData.js +77 -43
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +7 -9
- package/dist/transitions/start.js +75 -39
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +17 -4
- package/dist/types/endpoints.d.ts +89 -17
- package/dist/types/endpoints.js +1 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- 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
package/dist/admin/copy/goals.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CLICK_GOAL_COPY } from '../../goals/picker/copy.js';
|
|
2
|
+
import { percentileTail } from '../../testSurface/copy/metrics.js';
|
|
2
3
|
export const GOALS_COPY = {
|
|
3
4
|
slugRule: CLICK_GOAL_COPY.slugRule,
|
|
4
5
|
duplicateSlug: CLICK_GOAL_COPY.duplicateSlug,
|
|
@@ -9,6 +10,7 @@ export const GOALS_COPY = {
|
|
|
9
10
|
name: 'Name',
|
|
10
11
|
source: 'Measured by',
|
|
11
12
|
directionColumn: 'Better when',
|
|
13
|
+
nameRequired: 'Enter a name for this goal.',
|
|
12
14
|
direction: 'Better when it goes',
|
|
13
15
|
increase: 'More is better',
|
|
14
16
|
decrease: 'Less is better',
|
|
@@ -26,18 +28,19 @@ export const GOALS_COPY = {
|
|
|
26
28
|
slugLocked: 'The short name stays the same once a test uses this goal.',
|
|
27
29
|
sourceLocked: 'What this goal measures stays the same once a test uses it.',
|
|
28
30
|
chooseSource: 'Choose an outcome',
|
|
29
|
-
window: 'Count results for (
|
|
31
|
+
window: 'Count results for (days)',
|
|
32
|
+
windowError: 'Enter a whole number of days, at least 1.',
|
|
30
33
|
minimum: 'Minimum completions before deciding',
|
|
34
|
+
minimumError: 'Enter a number of at least 1.',
|
|
31
35
|
advanced: 'Advanced',
|
|
32
36
|
capping: 'Limit very large values',
|
|
33
37
|
capType: 'Limit by',
|
|
34
|
-
capValue: '
|
|
35
|
-
noCap: '
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
capHelp: 'For past amounts, enter a number such as 0.99 to limit only the largest 1%; or enter a fixed amount.',
|
|
38
|
+
capValue: 'Fixed amount',
|
|
39
|
+
noCap: "Don't limit",
|
|
40
|
+
absolute: 'Limit to a fixed amount',
|
|
41
|
+
fixedAmountError: 'Enter an amount of zero or more.',
|
|
39
42
|
threshold: 'Warn when it gets worse by (%)',
|
|
40
|
-
|
|
43
|
+
createGoal: 'Create goal',
|
|
41
44
|
saving: 'Saving…',
|
|
42
45
|
cancel: 'Cancel',
|
|
43
46
|
remove: 'Delete goal',
|
|
@@ -50,9 +53,13 @@ export const GOALS_COPY = {
|
|
|
50
53
|
notFound: 'This goal no longer exists.',
|
|
51
54
|
backToTest: 'Back to the test',
|
|
52
55
|
useGoal: 'Use this goal',
|
|
53
|
-
open: 'Open',
|
|
54
56
|
search: 'Search goals',
|
|
55
57
|
clearSearch: 'Clear search',
|
|
58
|
+
roles: {
|
|
59
|
+
primary: 'Main goal',
|
|
60
|
+
secondary: 'Also tracked',
|
|
61
|
+
guardrails: 'Must not get worse'
|
|
62
|
+
},
|
|
56
63
|
fields: 'Goal details',
|
|
57
64
|
deleteTitle: 'Delete this goal?',
|
|
58
65
|
deleteBody: 'This cannot be undone.',
|
|
@@ -75,3 +82,6 @@ export function goalsNoMatches(search) {
|
|
|
75
82
|
export function goalShowAll(count) {
|
|
76
83
|
return `Show all ${count}`;
|
|
77
84
|
}
|
|
85
|
+
export function largestValues(quantile) {
|
|
86
|
+
return `Limit the largest ${percentileTail(Number(quantile))}%`;
|
|
87
|
+
}
|
|
@@ -4,21 +4,23 @@ export declare const NEW_TEST_COPY: {
|
|
|
4
4
|
readonly setting: "A setting";
|
|
5
5
|
readonly page: "A whole page";
|
|
6
6
|
readonly pageMeaning: "Show different versions of a whole page at the same address, and see which one works better.";
|
|
7
|
-
readonly collection: "
|
|
7
|
+
readonly collection: "Which type of page?";
|
|
8
8
|
readonly original: "Original";
|
|
9
9
|
readonly originalHelp: "Choose the page visitors see today.";
|
|
10
10
|
readonly review: "Review";
|
|
11
11
|
readonly backToTest: "Back to the test";
|
|
12
12
|
readonly finishSetup: "Finish setup";
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
13
|
+
readonly blocksHandoff: `Choose '${string}' to pick the block to test.`;
|
|
14
|
+
readonly blocksOnlyHandoff: `Open the page you want to test, then choose '${string}' to pick the block to test.`;
|
|
15
|
+
readonly pageType: "Page type";
|
|
16
|
+
readonly choosePageType: "Choose a page type";
|
|
15
17
|
readonly blockMeaning: "Compare different versions of content on a page.";
|
|
16
18
|
readonly settingMeaning: "Compare different choices for a setting on your site.";
|
|
17
19
|
readonly unavailable: "A developer needs to set up pages or settings before you can create a test.";
|
|
18
|
-
readonly handoff: "Open the page
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
20
|
+
readonly handoff: "Open the page you want to test, then follow these steps in the editor.";
|
|
21
|
+
readonly mixedEditorHandoff: "Open the page you want to test, then follow the steps for its editor.";
|
|
22
|
+
readonly pagesMarked: (editor: string) => string;
|
|
23
|
+
readonly handoffSteps: readonly ["Add a Test block to the page.", "Choose Set up test in the sidebar."];
|
|
22
24
|
readonly chooseSetting: "Which setting do you want to test?";
|
|
23
25
|
readonly people: "Count people as:";
|
|
24
26
|
readonly visitors: "Visitors";
|
|
@@ -35,6 +37,7 @@ export declare const NEW_TEST_COPY: {
|
|
|
35
37
|
readonly name: "Name";
|
|
36
38
|
readonly hypothesis: "Why are you testing this? (optional)";
|
|
37
39
|
readonly back: "Back";
|
|
40
|
+
readonly change: "Change";
|
|
38
41
|
readonly next: "Next";
|
|
39
42
|
readonly createTest: "Create";
|
|
40
43
|
readonly creating: "Creating…";
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
+
import { BLOCK_COPY } from './blocks.js';
|
|
1
2
|
export const NEW_TEST_COPY = {
|
|
2
3
|
question: 'What do you want to test?',
|
|
3
4
|
block: 'A block on a page',
|
|
4
5
|
setting: 'A setting',
|
|
5
6
|
page: 'A whole page',
|
|
6
7
|
pageMeaning: 'Show different versions of a whole page at the same address, and see which one works better.',
|
|
7
|
-
collection: '
|
|
8
|
+
collection: 'Which type of page?',
|
|
8
9
|
original: 'Original',
|
|
9
10
|
originalHelp: 'Choose the page visitors see today.',
|
|
10
11
|
review: 'Review',
|
|
11
12
|
backToTest: 'Back to the test',
|
|
12
13
|
finishSetup: 'Finish setup',
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
blocksHandoff: `Choose '${BLOCK_COPY.testBlock}' to pick the block to test.`,
|
|
15
|
+
blocksOnlyHandoff: `Open the page you want to test, then choose '${BLOCK_COPY.testBlock}' to pick the block to test.`,
|
|
16
|
+
pageType: 'Page type',
|
|
17
|
+
choosePageType: 'Choose a page type',
|
|
15
18
|
blockMeaning: 'Compare different versions of content on a page.',
|
|
16
19
|
settingMeaning: 'Compare different choices for a setting on your site.',
|
|
17
20
|
unavailable: 'A developer needs to set up pages or settings before you can create a test.',
|
|
18
|
-
handoff: 'Open the page
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
handoff: 'Open the page you want to test, then follow these steps in the editor.',
|
|
22
|
+
mixedEditorHandoff: 'Open the page you want to test, then follow the steps for its editor.',
|
|
23
|
+
pagesMarked: (editor)=>`Pages marked ${editor}:`,
|
|
24
|
+
handoffSteps: [
|
|
25
|
+
'Add a Test block to the page.',
|
|
26
|
+
'Choose Set up test in the sidebar.'
|
|
27
|
+
],
|
|
22
28
|
chooseSetting: 'Which setting do you want to test?',
|
|
23
29
|
people: 'Count people as:',
|
|
24
30
|
visitors: 'Visitors',
|
|
@@ -35,6 +41,7 @@ export const NEW_TEST_COPY = {
|
|
|
35
41
|
name: 'Name',
|
|
36
42
|
hypothesis: 'Why are you testing this? (optional)',
|
|
37
43
|
back: 'Back',
|
|
44
|
+
change: 'Change',
|
|
38
45
|
next: 'Next',
|
|
39
46
|
createTest: 'Create',
|
|
40
47
|
creating: 'Creating…',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const STATUS_TOOLTIPS: {
|
|
2
2
|
readonly draft: "Draft";
|
|
3
3
|
readonly running: "Running";
|
|
4
|
-
readonly stopped:
|
|
4
|
+
readonly stopped: (label?: string) => string;
|
|
5
5
|
readonly decided: "Decided — everyone sees the winner";
|
|
6
6
|
readonly decidedWithHoldout: "Decided — everyone sees the winner, except the holdout";
|
|
7
7
|
readonly archived: "Archived";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { controlVersionName } from '../../labels/arms.js';
|
|
1
2
|
export const STATUS_TOOLTIPS = {
|
|
2
3
|
draft: 'Draft',
|
|
3
4
|
running: 'Running',
|
|
4
|
-
stopped:
|
|
5
|
+
stopped: (label)=>`Stopped — everyone sees ${controlVersionName(label)}`,
|
|
5
6
|
decided: 'Decided — everyone sees the winner',
|
|
6
7
|
decidedWithHoldout: 'Decided — everyone sees the winner, except the holdout',
|
|
7
8
|
archived: 'Archived'
|
|
@@ -3,6 +3,7 @@ import type { ExperimentsPageCollection } from '../types/contracts.js';
|
|
|
3
3
|
export declare function serializePageCollections(collections: ExperimentsPageCollection[], req: PayloadRequest): {
|
|
4
4
|
copyUrl: string;
|
|
5
5
|
copyLabel: string;
|
|
6
|
+
copyEnabled?: true | undefined;
|
|
6
7
|
copyHint?: string | undefined;
|
|
7
8
|
slug: string;
|
|
8
9
|
label: string;
|
|
@@ -10,6 +10,9 @@ export function serializePageCollections(collections, req) {
|
|
|
10
10
|
...entry.copyHint ? {
|
|
11
11
|
copyHint: entry.copyHint
|
|
12
12
|
} : {},
|
|
13
|
+
...entry.copy ? {
|
|
14
|
+
copyEnabled: true
|
|
15
|
+
} : {},
|
|
13
16
|
copyUrl: entry.copyUrl ?? formatAdminURL({
|
|
14
17
|
adminRoute: req.payload.config.routes.admin,
|
|
15
18
|
path: `/collections/${entry.slug}`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { controlVersionName } from '../labels/arms.js';
|
|
1
2
|
export function pageStatusCopy(test) {
|
|
2
3
|
if (test.pagesReleased) return null;
|
|
3
4
|
const winner = `${test.winnerLabel ?? 'the winner'}${test.winnerTitle ? ` (${test.winnerTitle})` : ''}`;
|
|
@@ -6,14 +7,15 @@ export function pageStatusCopy(test) {
|
|
|
6
7
|
return `This page is ${test.armLabel} in the draft test ${test.name}.`;
|
|
7
8
|
case 'stopped':
|
|
8
9
|
{
|
|
9
|
-
const
|
|
10
|
+
const control = controlVersionName(test.controlLabel);
|
|
11
|
+
const visitors = test.role === 'original' ? 'Visitors see this page.' : !test.originalPath ? `Visitors see ${control}.` : `Visitors to ${test.originalPath === '/' ? 'the homepage (/)' : test.originalPath} see ${control}.`;
|
|
10
12
|
return `This page is ${test.armLabel} in the stopped test ${test.name}. ${visitors}`;
|
|
11
13
|
}
|
|
12
14
|
case 'running':
|
|
13
15
|
return `This page is the ${test.armLabel} of a running test: ${test.name}.`;
|
|
14
16
|
case 'decided':
|
|
15
|
-
return `This page is ${test.armLabel} of a decided test; ${test.rollout ? `most visitors see ${winner}; a holdout still sees
|
|
17
|
+
return `This page is ${test.armLabel} of a decided test; ${test.rollout ? `most visitors see ${winner}; a holdout still sees ${controlVersionName(test.controlLabel ?? (test.role === 'original' ? test.armLabel : undefined))}` : `visitors see ${winner}`}.`;
|
|
16
18
|
case 'archived':
|
|
17
|
-
return test.winner ? `This page is also shown at the other versions' addresses because test ${test.name} made it the winner.
|
|
19
|
+
return test.winner ? `This page is also shown at the other versions' addresses because test ${test.name} made it the winner. Use "Release pages" on the test to free it.` : test.role === 'original' ? `This page's address now shows the winner of test ${test.name}. Use "Release pages" on the test to free it.` : `This page's address now shows ${winner}. Use "Release pages" on the test to show this page again.`;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -9,9 +9,10 @@ const TONES = {
|
|
|
9
9
|
};
|
|
10
10
|
export function statusPill({ status, arms = [], decision }) {
|
|
11
11
|
const holdout = status === 'decided' && arms?.some((group)=>group.key === 'holdout') && Boolean(decision?.winnerArm) && decision?.winnerArm !== 'control' && !decision?.holdoutReleasedAt;
|
|
12
|
+
const tooltip = status === 'stopped' ? STATUS_TOOLTIPS.stopped(arms?.find((group)=>group.key === 'control')?.label) : holdout ? STATUS_TOOLTIPS.decidedWithHoldout : STATUS_TOOLTIPS[status];
|
|
12
13
|
return {
|
|
13
14
|
label: statusLabel(status),
|
|
14
15
|
tone: TONES[status],
|
|
15
|
-
tooltip
|
|
16
|
+
tooltip
|
|
16
17
|
};
|
|
17
18
|
}
|
|
@@ -39,12 +39,15 @@ function ManagedResults({ id, surface, onTitleChange }) {
|
|
|
39
39
|
test.doc.allocation,
|
|
40
40
|
test.doc.metrics
|
|
41
41
|
]) : 'loading';
|
|
42
|
-
// ResultsBody's Decide is the shared DecideDialog, which reloads the page; Recompute keeps status.
|
|
43
42
|
if (test.loadState === 'ready' && test.doc) return /*#__PURE__*/ _jsx(ResultsBody, {
|
|
43
|
+
documentVersion: bodyKey,
|
|
44
|
+
liveDocument: test.doc,
|
|
45
|
+
statusReadPending: test.statusReadPending,
|
|
44
46
|
id: id,
|
|
45
47
|
surface: surface,
|
|
46
48
|
onRecomputed: ()=>setResultsVersion((value)=>value + 1),
|
|
47
|
-
|
|
49
|
+
onChanged: (transition)=>{
|
|
50
|
+
if (transition) test.acceptTransition?.(transition);
|
|
48
51
|
void test.reload();
|
|
49
52
|
},
|
|
50
53
|
renderPage: (parts)=>/*#__PURE__*/ _jsx(ResultsHeader, {
|
|
@@ -52,8 +55,8 @@ function ManagedResults({ id, surface, onTitleChange }) {
|
|
|
52
55
|
surface: surface,
|
|
53
56
|
resultsVersion: resultsVersion,
|
|
54
57
|
...parts
|
|
55
|
-
},
|
|
56
|
-
}
|
|
58
|
+
}, test.doc.id)
|
|
59
|
+
});
|
|
57
60
|
return /*#__PURE__*/ _jsx(ReaderResultsShell, {
|
|
58
61
|
surface: surface,
|
|
59
62
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
@@ -67,14 +70,13 @@ function ManagedResults({ id, surface, onTitleChange }) {
|
|
|
67
70
|
onClick: ()=>void test.reload(),
|
|
68
71
|
children: C.retry
|
|
69
72
|
}) : null,
|
|
70
|
-
test.loadState
|
|
73
|
+
test.loadState === 'error' ? /*#__PURE__*/ _jsx(ResultsBody, {
|
|
71
74
|
id: id,
|
|
72
|
-
surface:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
void test.reload();
|
|
75
|
+
surface: {
|
|
76
|
+
...surface,
|
|
77
|
+
canManage: false
|
|
76
78
|
}
|
|
77
|
-
}
|
|
79
|
+
}) : null
|
|
78
80
|
]
|
|
79
81
|
})
|
|
80
82
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../theme.css';
|
|
2
|
-
import type
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import './surface.css';
|
|
4
4
|
export interface SurfaceShellProps {
|
|
5
5
|
adminRoute: string;
|
|
@@ -12,5 +12,7 @@ export interface SurfaceShellProps {
|
|
|
12
12
|
status?: ReactNode;
|
|
13
13
|
actions?: ReactNode;
|
|
14
14
|
subtitle?: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
dynamicTitle?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function SurfaceShell({ adminRoute, children, crumbs, title, status, actions, subtitle }: SurfaceShellProps): import("react").JSX.Element;
|
|
18
|
+
export declare function SurfaceShell({ adminRoute, children, crumbs, title, status, actions, subtitle, className, dynamicTitle }: SurfaceShellProps): import("react").JSX.Element;
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import '../theme.css';
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
4
5
|
import { formatAdminURL } from 'payload/shared';
|
|
5
6
|
import { Breadcrumb } from '../../ui/Breadcrumb.js';
|
|
6
7
|
import { Button } from '../../ui/Button.js';
|
|
7
8
|
import { SURFACE_COPY } from '../../testSurface/copy/surface.js';
|
|
9
|
+
import { XpStepNavContext } from './useXpStepNav.js';
|
|
8
10
|
import './surface.css';
|
|
9
11
|
export function SurfaceShell({ adminRoute, children, crumbs = [
|
|
10
12
|
{
|
|
11
13
|
label: SURFACE_COPY.title
|
|
12
14
|
}
|
|
13
|
-
], title = SURFACE_COPY.title, status, actions, subtitle }) {
|
|
15
|
+
], title = SURFACE_COPY.title, status, actions, subtitle, className, dynamicTitle = false }) {
|
|
16
|
+
const stepNav = useContext(XpStepNavContext);
|
|
17
|
+
const route = stepNav?.route;
|
|
18
|
+
const items = stepNav?.items.length && route !== 'home' && route !== 'goals' ? stepNav.items.map(({ label, url })=>({
|
|
19
|
+
label,
|
|
20
|
+
href: url
|
|
21
|
+
})) : crumbs;
|
|
22
|
+
// Custom view metadata is static in Payload 3. Use the name already loaded by the screen.
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
if (!dynamicTitle && route !== 'goal') return;
|
|
25
|
+
const previous = document.title;
|
|
26
|
+
const next = `${title} · ${SURFACE_COPY.title}`;
|
|
27
|
+
document.title = next;
|
|
28
|
+
return ()=>{
|
|
29
|
+
if (document.title === next) document.title = previous;
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
title,
|
|
33
|
+
dynamicTitle,
|
|
34
|
+
route
|
|
35
|
+
]);
|
|
14
36
|
return /*#__PURE__*/ _jsxs("div", {
|
|
15
|
-
className:
|
|
37
|
+
className: `xp-tests-surface xp-test-surface${className ? ` ${className}` : ''}`,
|
|
38
|
+
"data-dialog-focus-scope": true,
|
|
16
39
|
children: [
|
|
17
40
|
/*#__PURE__*/ _jsxs("header", {
|
|
18
41
|
className: "xp-tests-shell-header",
|
|
@@ -21,7 +44,7 @@ export function SurfaceShell({ adminRoute, children, crumbs = [
|
|
|
21
44
|
className: "xp-tests-container xp-tests-shell-top",
|
|
22
45
|
children: [
|
|
23
46
|
/*#__PURE__*/ _jsx(Breadcrumb, {
|
|
24
|
-
items:
|
|
47
|
+
items: items
|
|
25
48
|
}),
|
|
26
49
|
/*#__PURE__*/ _jsx(Button, {
|
|
27
50
|
variant: "quiet",
|
|
@@ -43,6 +66,8 @@ export function SurfaceShell({ adminRoute, children, crumbs = [
|
|
|
43
66
|
className: "xp-tests-shell-title",
|
|
44
67
|
children: [
|
|
45
68
|
/*#__PURE__*/ _jsx("h1", {
|
|
69
|
+
tabIndex: -1,
|
|
70
|
+
"data-dialog-focus-fallback": true,
|
|
46
71
|
children: title
|
|
47
72
|
}),
|
|
48
73
|
status
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExperimentAction } from '../../testSurface/actions/actions.model.js';
|
|
2
|
+
export declare function TestRowMenu({ name, actions, onSelect }: {
|
|
3
|
+
name: string;
|
|
4
|
+
actions: ExperimentAction[];
|
|
5
|
+
onSelect: (action: ExperimentAction) => void;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function RowMenu<T extends Pick<ExperimentAction, 'label' | 'tone' | 'unavailable' | 'hint'> & {
|
|
8
|
+
id: string;
|
|
9
|
+
}>({ label, actions, onSelect, }: {
|
|
10
|
+
label: string;
|
|
11
|
+
actions: T[];
|
|
12
|
+
onSelect: (action: T) => void;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Button } from '../../ui/Button.js';
|
|
5
|
+
import { actionsForTest } from '../../testSurface/copy/actions.js';
|
|
6
|
+
export function TestRowMenu({ name, actions, onSelect }) {
|
|
7
|
+
return /*#__PURE__*/ _jsx(RowMenu, {
|
|
8
|
+
label: actionsForTest(name),
|
|
9
|
+
actions: actions,
|
|
10
|
+
onSelect: onSelect
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function RowMenu({ label, actions, onSelect }) {
|
|
14
|
+
const root = useRef(null);
|
|
15
|
+
const menu = useRef(null);
|
|
16
|
+
const triggerId = useId();
|
|
17
|
+
const menuId = useId();
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const startAtEnd = useRef(false);
|
|
20
|
+
const menuItems = ()=>[
|
|
21
|
+
...menu.current?.querySelectorAll('[role="menuitem"]') ?? []
|
|
22
|
+
];
|
|
23
|
+
function close(restoreFocus) {
|
|
24
|
+
if (restoreFocus) root.current?.querySelector('button')?.focus();
|
|
25
|
+
setOpen(false);
|
|
26
|
+
}
|
|
27
|
+
useLayoutEffect(()=>{
|
|
28
|
+
if (!open) return;
|
|
29
|
+
const items = menuItems();
|
|
30
|
+
(startAtEnd.current ? items.at(-1) : items[0])?.focus();
|
|
31
|
+
}, [
|
|
32
|
+
open
|
|
33
|
+
]);
|
|
34
|
+
useEffect(()=>{
|
|
35
|
+
if (!open) return;
|
|
36
|
+
const element = root.current;
|
|
37
|
+
if (!element) return;
|
|
38
|
+
const doc = element.ownerDocument;
|
|
39
|
+
const dismiss = (event)=>{
|
|
40
|
+
if (!element.contains(event.target)) setOpen(false);
|
|
41
|
+
};
|
|
42
|
+
doc.addEventListener('pointerdown', dismiss, true);
|
|
43
|
+
return ()=>doc.removeEventListener('pointerdown', dismiss, true);
|
|
44
|
+
}, [
|
|
45
|
+
open
|
|
46
|
+
]);
|
|
47
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
48
|
+
className: "xp-tests-row-menu",
|
|
49
|
+
ref: root,
|
|
50
|
+
onBlur: (event)=>{
|
|
51
|
+
if (open && !event.currentTarget.contains(event.relatedTarget)) close(false);
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
55
|
+
id: triggerId,
|
|
56
|
+
className: "xp-tests-row-menu-trigger",
|
|
57
|
+
variant: "quiet",
|
|
58
|
+
size: "sm",
|
|
59
|
+
"aria-label": label,
|
|
60
|
+
"aria-haspopup": "menu",
|
|
61
|
+
"aria-expanded": open,
|
|
62
|
+
"aria-controls": open ? menuId : undefined,
|
|
63
|
+
onClick: ()=>{
|
|
64
|
+
if (open) close(true);
|
|
65
|
+
else {
|
|
66
|
+
startAtEnd.current = false;
|
|
67
|
+
setOpen(true);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
onKeyDown: (event)=>{
|
|
71
|
+
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
startAtEnd.current = event.key === 'ArrowUp';
|
|
74
|
+
if (open) {
|
|
75
|
+
const items = menuItems();
|
|
76
|
+
(startAtEnd.current ? items.at(-1) : items[0])?.focus();
|
|
77
|
+
} else setOpen(true);
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
80
|
+
width: "18",
|
|
81
|
+
height: "18",
|
|
82
|
+
viewBox: "0 0 18 18",
|
|
83
|
+
fill: "currentColor",
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
87
|
+
cx: "4",
|
|
88
|
+
cy: "9",
|
|
89
|
+
r: "1.3"
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
92
|
+
cx: "9",
|
|
93
|
+
cy: "9",
|
|
94
|
+
r: "1.3"
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
97
|
+
cx: "14",
|
|
98
|
+
cy: "9",
|
|
99
|
+
r: "1.3"
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
open ? /*#__PURE__*/ _jsx("div", {
|
|
105
|
+
id: menuId,
|
|
106
|
+
ref: menu,
|
|
107
|
+
role: "menu",
|
|
108
|
+
"aria-labelledby": triggerId,
|
|
109
|
+
className: "xp-tests-row-menu-items",
|
|
110
|
+
onKeyDown: (event)=>{
|
|
111
|
+
const items = menuItems();
|
|
112
|
+
const index = items.findIndex((item)=>item === event.target);
|
|
113
|
+
const key = event.key;
|
|
114
|
+
if (key === 'Tab') {
|
|
115
|
+
close(true);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (key === 'Escape') {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
close(true);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const next = key === 'Home' ? items[0] : key === 'End' ? items.at(-1) : key === 'ArrowDown' ? items[(index + 1) % items.length] : key === 'ArrowUp' ? items[(index - 1 + items.length) % items.length] : key.length === 1 && key !== ' ' && !event.altKey && !event.ctrlKey && !event.metaKey ? [
|
|
124
|
+
...items.slice(index + 1),
|
|
125
|
+
...items.slice(0, index + 1)
|
|
126
|
+
].find((item)=>item.textContent?.trim().toLowerCase().startsWith(key.toLowerCase())) : undefined;
|
|
127
|
+
if (next) {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
next.focus();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
children: actions.map((action, index)=>{
|
|
133
|
+
const detail = action.unavailable ?? action.hint;
|
|
134
|
+
const detailId = `${menuId}-${index}`;
|
|
135
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
role: "menuitem",
|
|
138
|
+
tabIndex: -1,
|
|
139
|
+
"aria-label": action.label,
|
|
140
|
+
"aria-disabled": action.unavailable ? true : undefined,
|
|
141
|
+
className: `xp-tests-menu-item${action.tone === 'secondary' ? '' : ` xp-tests-menu-item--${action.tone}`}`,
|
|
142
|
+
"aria-describedby": detail ? detailId : undefined,
|
|
143
|
+
onClick: ()=>{
|
|
144
|
+
if (action.unavailable) return;
|
|
145
|
+
close(true);
|
|
146
|
+
onSelect(action);
|
|
147
|
+
},
|
|
148
|
+
children: [
|
|
149
|
+
/*#__PURE__*/ _jsx("span", {
|
|
150
|
+
children: action.label
|
|
151
|
+
}),
|
|
152
|
+
detail ? /*#__PURE__*/ _jsx("span", {
|
|
153
|
+
id: detailId,
|
|
154
|
+
className: "xp-ui-help",
|
|
155
|
+
children: detail
|
|
156
|
+
}) : null
|
|
157
|
+
]
|
|
158
|
+
}, action.id);
|
|
159
|
+
})
|
|
160
|
+
}) : null
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SurfaceShellProps } from './SurfaceShell.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function TestsHome({ adminRoute, apiRoute, contentLocale, canManage, crumbs, flagPoints }: {
|
|
2
|
+
import type { SurfaceProps } from '../../testSurface/surface/contracts.js';
|
|
3
|
+
export declare function TestsHome({ adminRoute, apiRoute, contentLocale, canManage, canReadResults, crumbs, flagPoints }: {
|
|
4
4
|
adminRoute: string;
|
|
5
5
|
apiRoute: string;
|
|
6
6
|
contentLocale?: string;
|
|
7
7
|
canManage?: boolean;
|
|
8
|
+
canReadResults?: boolean;
|
|
8
9
|
crumbs?: SurfaceShellProps['crumbs'];
|
|
9
|
-
flagPoints?:
|
|
10
|
+
flagPoints?: SurfaceProps['flagPoints'];
|
|
10
11
|
}): import("react").JSX.Element;
|