@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
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from 'react';
|
|
4
4
|
import { Button } from '../../../ui/Button.js';
|
|
5
5
|
import { Range } from '../../../ui/Inputs.js';
|
|
6
|
-
import { useEffect, useRef, useState } from 'react';
|
|
7
6
|
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
7
|
+
import { actionGroupLabel } from '../../actions/actions.model.js';
|
|
8
8
|
import { ARMS_COPY, GROUP_LABELS, issueMessage } from '../../copy/arms.js';
|
|
9
9
|
import { addHoldoutArm, addVariant, issuesByRow, removeArm, splitEvenly, totalWeight, withSlotsFor } from '../../arms/arms.model.js';
|
|
10
|
+
import { LOCKED_MESSAGES } from '../../copy/common.js';
|
|
10
11
|
import { allocationSentence } from '../../allocation.model.js';
|
|
11
|
-
import { balanceWeight, orderedVersions, trafficShares } from './testPage.model.js';
|
|
12
|
-
import { FieldErrors, ReadOnly, reasonFor, save, TextEdit } from './fields.js';
|
|
12
|
+
import { balanceWeight, orderedVersions, trafficShares, trafficSplit } from './testPage.model.js';
|
|
13
|
+
import { FieldErrors, ReadOnly, reasonFor, save, SavedValueChanged, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
|
|
13
14
|
import { PAGE_COPY } from '../../copy/pages.js';
|
|
14
15
|
import { testPageCollection } from '../pagePicker/pagePicker.model.js';
|
|
15
16
|
import { Section } from './Section.js';
|
|
@@ -24,28 +25,33 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
24
25
|
const id = useId();
|
|
25
26
|
const doc = test.doc;
|
|
26
27
|
const [weightEdit, setWeightEdit] = useState(null);
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]);
|
|
28
|
+
const split = trafficSplit(doc.arms);
|
|
29
|
+
const allocationEdit = useFieldDraft(test, 'allocation', C.allocation, String(doc.allocation));
|
|
30
|
+
const [announcement, announce] = useDraftAnnouncement();
|
|
31
|
+
const allocation = Number(allocationEdit.value);
|
|
32
|
+
const allocationReason = reasonFor(test, 'allocation');
|
|
33
|
+
const allocationConflict = allocationEdit.dirty && !allocationEdit.saving && (allocationEdit.conflict || allocationEdit.retry || allocationReason) ? `${id}-new-value` : undefined;
|
|
34
|
+
if (weightEdit && (weightEdit.split !== split || test.mountDraft && !test.fieldDrafts?.[`share:${weightEdit.key}`])) setWeightEdit(null);
|
|
35
35
|
const reason = reasonFor(test, 'arms');
|
|
36
|
-
const
|
|
36
|
+
const setting = doc.kind === 'flag' || doc.kind === 'code';
|
|
37
|
+
const live = weightEdit && !reason ? balanceWeight(doc.arms, weightEdit.key, weightEdit.weight) : doc.arms;
|
|
37
38
|
const ordered = orderedVersions(live);
|
|
38
39
|
const shares = trafficShares(ordered.map((row)=>row.arm));
|
|
39
|
-
const issues = issuesByRow(live, doc.kind);
|
|
40
|
+
const issues = issuesByRow(doc.kind === 'block' ? withSlotsFor(live, 'block') : live, doc.kind);
|
|
41
|
+
const controlLabel = live.find((arm)=>arm.kind === 'control')?.label;
|
|
40
42
|
const update = (transform)=>save(test, 'arms', ()=>({
|
|
41
43
|
arms: withSlotsFor(transform(test.doc.arms), test.doc.kind)
|
|
42
44
|
}));
|
|
43
|
-
const commitAllocation = ()=>{
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const commitAllocation = (confirmed = false)=>{
|
|
46
|
+
if (!allocationEdit.dirty || allocationEdit.saving) return;
|
|
47
|
+
if (allocationReason || test.stale || allocationConflict && !confirmed) {
|
|
48
|
+
announce();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (allocation === doc.allocation) allocationEdit.discard();
|
|
52
|
+
else allocationEdit.submit(()=>save(test, 'allocation', ()=>({
|
|
53
|
+
allocation
|
|
54
|
+
})));
|
|
49
55
|
};
|
|
50
56
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
51
57
|
surface: surface,
|
|
@@ -58,12 +64,8 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
58
64
|
contentOnCanvas ? /*#__PURE__*/ _jsx("p", {
|
|
59
65
|
children: C.editVersionsOnCanvas
|
|
60
66
|
}) : null,
|
|
61
|
-
reason ? /*#__PURE__*/ _jsx("p", {
|
|
62
|
-
className: "xp-ui-help",
|
|
63
|
-
children: reason
|
|
64
|
-
}) : null,
|
|
65
67
|
/*#__PURE__*/ _jsxs("div", {
|
|
66
|
-
className:
|
|
68
|
+
className: `xp-version-rows${setting ? ' xp-version-rows--setting' : ''}`,
|
|
67
69
|
children: [
|
|
68
70
|
/*#__PURE__*/ _jsxs("div", {
|
|
69
71
|
className: "xp-version-grid-head",
|
|
@@ -72,47 +74,80 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
72
74
|
/*#__PURE__*/ _jsx("span", {
|
|
73
75
|
children: C.label
|
|
74
76
|
}),
|
|
75
|
-
/*#__PURE__*/ _jsx("span", {
|
|
76
|
-
children: C.
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
setting ? /*#__PURE__*/ _jsx("span", {
|
|
78
|
+
children: C.valueColumn
|
|
79
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsx("span", {
|
|
82
|
+
children: C.weight
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ _jsx("span", {}),
|
|
85
|
+
/*#__PURE__*/ _jsx("span", {})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
80
88
|
]
|
|
81
89
|
}),
|
|
82
|
-
ordered.filter(({ arm })=>doc.kind !== 'page' || arm.kind !== 'holdout').map(({ arm, index })
|
|
90
|
+
ordered.filter(({ arm })=>doc.kind !== 'page' || arm.kind !== 'holdout').map(({ arm, index })=>{
|
|
91
|
+
const fieldLabel = arm.kind === 'control' ? actionGroupLabel(arm.key, arm.label) : GROUP_LABELS[arm.key];
|
|
92
|
+
const name = contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
|
|
93
|
+
children: arm.label
|
|
94
|
+
}) : /*#__PURE__*/ _jsx(TextEdit, {
|
|
95
|
+
test: test,
|
|
96
|
+
label: `${fieldLabel}: ${C.label}`,
|
|
97
|
+
draftKey: `${GROUP_LABELS[arm.key]}: ${C.label}`,
|
|
98
|
+
value: arm.label,
|
|
99
|
+
reason: reason,
|
|
100
|
+
hideLabel: true,
|
|
101
|
+
onCommit: (label)=>update((arms)=>arms.map((current)=>current.key === arm.key ? {
|
|
102
|
+
...current,
|
|
103
|
+
label
|
|
104
|
+
} : current))
|
|
105
|
+
});
|
|
106
|
+
const weight = /*#__PURE__*/ _jsx(TextEdit, {
|
|
107
|
+
test: test,
|
|
108
|
+
draftKey: `share:${arm.key}`,
|
|
109
|
+
label: `${fieldLabel}: ${C.weight}`,
|
|
110
|
+
type: "number",
|
|
111
|
+
min: 0,
|
|
112
|
+
max: 100,
|
|
113
|
+
value: doc.arms[index].weight,
|
|
114
|
+
preview: weightEdit?.key !== arm.key ? arm.weight : undefined,
|
|
115
|
+
scope: split,
|
|
116
|
+
reason: reason,
|
|
117
|
+
hideLabel: !setting,
|
|
118
|
+
isValid: (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) >= 0 && Number(raw) <= 100,
|
|
119
|
+
invalidMessage: C.invalidShare,
|
|
120
|
+
onDraft: (value)=>setWeightEdit(value === null ? null : {
|
|
121
|
+
split,
|
|
122
|
+
key: arm.key,
|
|
123
|
+
weight: Number(value)
|
|
124
|
+
}),
|
|
125
|
+
onCommit: (value)=>update((arms)=>balanceWeight(arms, arm.key, Number(value)))
|
|
126
|
+
});
|
|
127
|
+
const remove = !reason && !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
|
|
128
|
+
variant: "quiet",
|
|
129
|
+
size: "sm",
|
|
130
|
+
onClick: ()=>update((arms)=>splitEvenly(removeArm(arms, arm.key))),
|
|
131
|
+
children: C.remove
|
|
132
|
+
}) : null;
|
|
133
|
+
return /*#__PURE__*/ _jsxs("article", {
|
|
83
134
|
className: "xp-version-row",
|
|
84
135
|
id: `xp-version-${arm.key}`,
|
|
136
|
+
"aria-label": arm.label,
|
|
85
137
|
tabIndex: -1,
|
|
86
138
|
children: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ _jsx(TextEdit, {
|
|
101
|
-
label: `${GROUP_LABELS[arm.key]}: ${C.weight}`,
|
|
102
|
-
type: "number",
|
|
103
|
-
min: 0,
|
|
104
|
-
max: 100,
|
|
105
|
-
value: doc.arms[index].weight,
|
|
106
|
-
reason: reason,
|
|
107
|
-
hideLabel: true,
|
|
108
|
-
disabled: Boolean(reason),
|
|
109
|
-
isValid: (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) >= 0 && Number(raw) <= 100,
|
|
110
|
-
invalidMessage: C.invalidShare,
|
|
111
|
-
onDraft: (value)=>setWeightEdit({
|
|
112
|
-
key: arm.key,
|
|
113
|
-
weight: Number(value)
|
|
114
|
-
}),
|
|
115
|
-
onCommit: (value)=>update((arms)=>balanceWeight(arms, arm.key, Number(value)))
|
|
139
|
+
setting ? /*#__PURE__*/ _jsxs("div", {
|
|
140
|
+
className: "xp-setting-version-name",
|
|
141
|
+
children: [
|
|
142
|
+
name,
|
|
143
|
+
!reason || test.fieldDrafts?.[`share:${arm.key}`] ? weight : null,
|
|
144
|
+
remove
|
|
145
|
+
]
|
|
146
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
147
|
+
children: [
|
|
148
|
+
name,
|
|
149
|
+
weight
|
|
150
|
+
]
|
|
116
151
|
}),
|
|
117
152
|
/*#__PURE__*/ _jsx(parts.VersionContent, {
|
|
118
153
|
test: test,
|
|
@@ -120,27 +155,21 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
120
155
|
armIndex: index,
|
|
121
156
|
summary: contentOnCanvas
|
|
122
157
|
}),
|
|
123
|
-
/*#__PURE__*/ _jsx("div", {
|
|
158
|
+
!setting && !reason ? /*#__PURE__*/ _jsx("div", {
|
|
124
159
|
className: "xp-ui-button-group xp-version-remove",
|
|
125
|
-
children:
|
|
126
|
-
|
|
127
|
-
size: "sm",
|
|
128
|
-
disabled: Boolean(reason),
|
|
129
|
-
title: reason ?? undefined,
|
|
130
|
-
onClick: ()=>update((arms)=>splitEvenly(removeArm(arms, arm.key))),
|
|
131
|
-
children: C.remove
|
|
132
|
-
}) : null
|
|
133
|
-
}),
|
|
160
|
+
children: remove
|
|
161
|
+
}) : null,
|
|
134
162
|
issues.rows[index]?.map((issue, i)=>/*#__PURE__*/ _jsx("p", {
|
|
135
163
|
role: "alert",
|
|
136
|
-
children: issueMessage(issue, totalWeight(live))
|
|
164
|
+
children: issueMessage(issue, totalWeight(live), controlLabel)
|
|
137
165
|
}, i)),
|
|
138
166
|
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
139
167
|
test: test,
|
|
140
168
|
path: `arms.${index}`
|
|
141
169
|
})
|
|
142
170
|
]
|
|
143
|
-
}, arm.key)
|
|
171
|
+
}, arm.key);
|
|
172
|
+
})
|
|
144
173
|
]
|
|
145
174
|
}),
|
|
146
175
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -170,34 +199,32 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
170
199
|
]
|
|
171
200
|
}, arm.key))
|
|
172
201
|
}),
|
|
173
|
-
/*#__PURE__*/ _jsx("p", {
|
|
202
|
+
!reason ? /*#__PURE__*/ _jsx("p", {
|
|
174
203
|
className: "xp-ui-help",
|
|
175
204
|
children: C.balanceHelp
|
|
176
|
-
}),
|
|
205
|
+
}) : null,
|
|
177
206
|
issues.form.map((issue, i)=>/*#__PURE__*/ _jsx("p", {
|
|
178
207
|
role: "alert",
|
|
179
|
-
children: issueMessage(issue, totalWeight(live))
|
|
208
|
+
children: issueMessage(issue, totalWeight(live), controlLabel)
|
|
180
209
|
}, i)),
|
|
181
210
|
test.errors.arms ? /*#__PURE__*/ _jsx("p", {
|
|
182
211
|
role: "alert",
|
|
183
212
|
children: test.errors.arms
|
|
184
213
|
}) : null,
|
|
185
|
-
!contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
|
|
214
|
+
!reason && !contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
|
|
186
215
|
className: "xp-section-actions xp-ui-button-group",
|
|
187
|
-
title: reason ?? undefined,
|
|
188
216
|
children: [
|
|
189
217
|
/*#__PURE__*/ _jsx(Button, {
|
|
190
|
-
disabled:
|
|
218
|
+
disabled: doc.arms.filter((arm)=>arm.kind === 'variant').length >= 3,
|
|
191
219
|
onClick: ()=>update((arms)=>addVariant(arms, doc.kind)),
|
|
192
220
|
children: C.addVersion
|
|
193
221
|
}),
|
|
194
222
|
doc.kind !== 'page' ? /*#__PURE__*/ _jsx(Button, {
|
|
195
|
-
disabled:
|
|
223
|
+
disabled: doc.arms.some((arm)=>arm.kind === 'holdout'),
|
|
196
224
|
onClick: ()=>update(addHoldoutArm),
|
|
197
225
|
children: C.addHoldout
|
|
198
226
|
}) : null,
|
|
199
227
|
/*#__PURE__*/ _jsx(Button, {
|
|
200
|
-
disabled: Boolean(reason),
|
|
201
228
|
onClick: ()=>update(splitEvenly),
|
|
202
229
|
children: C.split
|
|
203
230
|
})
|
|
@@ -205,12 +232,11 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
205
232
|
}) : null,
|
|
206
233
|
doc.kind !== 'page' && doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
|
|
207
234
|
className: "xp-ui-help",
|
|
208
|
-
children: ARMS_COPY.holdout
|
|
235
|
+
children: ARMS_COPY.holdout(actionGroupLabel('control', doc.arms.find((arm)=>arm.key === 'control')?.label))
|
|
209
236
|
}) : null,
|
|
210
|
-
|
|
237
|
+
allocationReason && !allocationEdit.dirty ? /*#__PURE__*/ _jsx(ReadOnly, {
|
|
211
238
|
label: C.allocation,
|
|
212
|
-
value: `${doc.allocation}
|
|
213
|
-
reason: reasonFor(test, 'allocation')
|
|
239
|
+
value: `${doc.allocation}%`
|
|
214
240
|
}) : /*#__PURE__*/ _jsx(Range, {
|
|
215
241
|
id: id,
|
|
216
242
|
label: C.allocation,
|
|
@@ -218,11 +244,21 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
218
244
|
min: 1,
|
|
219
245
|
max: 100,
|
|
220
246
|
value: allocation,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
247
|
+
"aria-describedby": allocationConflict,
|
|
248
|
+
disabled: Boolean(allocationReason || test.stale || allocationEdit.saving),
|
|
249
|
+
onChange: (e)=>allocationEdit.change(e.target.value),
|
|
250
|
+
onPointerUp: ()=>commitAllocation(),
|
|
251
|
+
onKeyDown: (e)=>{
|
|
252
|
+
if (e.key === 'Enter' && allocationConflict) {
|
|
253
|
+
e.preventDefault();
|
|
254
|
+
announce();
|
|
255
|
+
}
|
|
256
|
+
if (e.key === 'Escape' && allocationEdit.dirty && !allocationEdit.saving) {
|
|
257
|
+
e.preventDefault();
|
|
258
|
+
e.stopPropagation();
|
|
259
|
+
allocationEdit.discard();
|
|
260
|
+
}
|
|
224
261
|
},
|
|
225
|
-
onPointerUp: commitAllocation,
|
|
226
262
|
onKeyUp: (e)=>{
|
|
227
263
|
if ([
|
|
228
264
|
'ArrowLeft',
|
|
@@ -235,11 +271,25 @@ export function VersionsSection({ test, surface, parts, contentOnCanvas = false
|
|
|
235
271
|
'PageDown'
|
|
236
272
|
].includes(e.key)) commitAllocation();
|
|
237
273
|
},
|
|
238
|
-
onBlur: commitAllocation
|
|
274
|
+
onBlur: ()=>commitAllocation()
|
|
239
275
|
}),
|
|
276
|
+
allocationConflict ? /*#__PURE__*/ _jsx(SavedValueChanged, {
|
|
277
|
+
id: allocationConflict,
|
|
278
|
+
value: `${doc.allocation}%`,
|
|
279
|
+
reason: allocationReason,
|
|
280
|
+
showReason: false,
|
|
281
|
+
conflict: allocationEdit.conflict,
|
|
282
|
+
announce: announcement,
|
|
283
|
+
onKeep: !allocationReason && !test.stale ? ()=>commitAllocation(true) : undefined,
|
|
284
|
+
onDiscard: allocationEdit.discard
|
|
285
|
+
}) : null,
|
|
286
|
+
doc.status === 'running' ? /*#__PURE__*/ _jsx("p", {
|
|
287
|
+
className: "xp-ui-help",
|
|
288
|
+
children: doc.allocation >= 100 ? C.everyoneMatches : LOCKED_MESSAGES.runningAllocation
|
|
289
|
+
}) : null,
|
|
240
290
|
/*#__PURE__*/ _jsx("p", {
|
|
241
291
|
children: allocationSentence({
|
|
242
|
-
allocation:
|
|
292
|
+
allocation: allocationReason ? doc.allocation : allocation,
|
|
243
293
|
unitType: doc.unitType,
|
|
244
294
|
arms: live,
|
|
245
295
|
status: doc.status
|
|
@@ -3,24 +3,50 @@ import type { SectionProps, TestDocApi } from '../contracts.js';
|
|
|
3
3
|
import type { EditableField } from '../../../types/admin.js';
|
|
4
4
|
import type { TestDocumentPatch } from '../testDocument.model.js';
|
|
5
5
|
export declare function reasonFor(test: TestDocApi, field: string): string | null;
|
|
6
|
-
export declare function save(test: TestDocApi, field: EditableField, patch: () => TestDocumentPatch):
|
|
6
|
+
export declare function save(test: TestDocApi, field: EditableField, patch: () => TestDocumentPatch): boolean;
|
|
7
7
|
export declare function FieldErrors({ test, path }: {
|
|
8
8
|
test: TestDocApi;
|
|
9
9
|
path: string;
|
|
10
10
|
}): import("react").JSX.Element;
|
|
11
|
-
export declare function ReadOnly({ label, value,
|
|
11
|
+
export declare function ReadOnly({ label, value, labelAction, hideLabel }: {
|
|
12
12
|
label: string;
|
|
13
13
|
value: ReactNode;
|
|
14
|
-
reason: string | null;
|
|
15
14
|
labelAction?: ReactNode;
|
|
15
|
+
hideLabel?: boolean;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function useFieldDraft(test: TestDocApi, key: string, label: string, saved: string, scope?: string): {
|
|
18
|
+
value: string;
|
|
19
|
+
dirty: boolean;
|
|
20
|
+
saving: boolean;
|
|
21
|
+
retry: boolean;
|
|
22
|
+
conflict: boolean;
|
|
23
|
+
change(value: string): void;
|
|
24
|
+
submit(save: () => boolean | void): void;
|
|
25
|
+
discard(): void;
|
|
26
|
+
};
|
|
27
|
+
export declare function SavedValueChanged({ id, value, reason, showReason, conflict, announce, onKeep, onDiscard }: {
|
|
28
|
+
id: string;
|
|
29
|
+
value: string;
|
|
30
|
+
reason?: string | null;
|
|
31
|
+
showReason?: boolean;
|
|
32
|
+
conflict: boolean;
|
|
33
|
+
announce: number;
|
|
34
|
+
onKeep?: () => void;
|
|
35
|
+
onDiscard: () => void;
|
|
16
36
|
}): import("react").JSX.Element;
|
|
37
|
+
/** Announce the existing choices again when blur or Enter cannot commit. */
|
|
38
|
+
export declare function useDraftAnnouncement(): readonly [number, () => void];
|
|
17
39
|
/** Local typing is intentionally separate from staging: build the current group on commit. */
|
|
18
|
-
export declare function TextEdit({ label, value, onCommit, reason, multiline, placeholder, type, min, max, required, onDraft, isValid, invalidMessage, hideLabel, disabled, help }: {
|
|
40
|
+
export declare function TextEdit({ test, label, draftKey, value, preview, onCommit, reason, multiline, placeholder, type, min, max, required, onDraft, scope, isValid, invalidMessage, hideLabel, disabled, help }: {
|
|
41
|
+
test: TestDocApi;
|
|
19
42
|
label: string;
|
|
43
|
+
draftKey?: string;
|
|
20
44
|
value: string | number;
|
|
21
|
-
onCommit: (value: string) => void;
|
|
45
|
+
onCommit: (value: string) => boolean | void;
|
|
22
46
|
reason?: string | null;
|
|
23
|
-
onDraft?: (value: string) => void;
|
|
47
|
+
onDraft?: (value: string | null) => void;
|
|
48
|
+
scope?: string;
|
|
49
|
+
preview?: number;
|
|
24
50
|
multiline?: boolean;
|
|
25
51
|
placeholder?: string;
|
|
26
52
|
type?: 'text' | 'number';
|