@delmaredigital/payload-experiments 0.3.0-rc.4 → 0.4.0-rc.10
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 +293 -688
- package/dist/admin/LayerUsage.js +1 -1
- package/dist/admin/MetricSourceSelect.js +4 -4
- package/dist/admin/PlacementStatus.d.ts +3 -0
- package/dist/admin/PlacementStatus.js +54 -0
- package/dist/admin/TestsDashboardCards.d.ts +1 -0
- package/dist/admin/TestsDashboardCards.js +5 -9
- package/dist/admin/TestsNavLink.d.ts +1 -0
- package/dist/admin/TestsNavLink.js +5 -11
- package/dist/admin/blocks/BlockPanel.d.ts +5 -0
- package/dist/admin/blocks/BlockPanel.js +245 -0
- package/dist/admin/blocks/TestBlockField.d.ts +5 -0
- package/dist/admin/blocks/TestBlockField.js +163 -0
- package/dist/admin/blocks/formApi.d.ts +46 -0
- package/dist/admin/blocks/formApi.js +159 -0
- package/dist/admin/blocks/inject.d.ts +7 -0
- package/dist/admin/blocks/inject.js +42 -0
- package/dist/admin/blocks/model.d.ts +18 -0
- package/dist/admin/blocks/model.js +49 -0
- package/dist/admin/blocks/statusCache.d.ts +9 -0
- package/dist/admin/blocks/statusCache.js +92 -0
- package/dist/admin/blocks/useBlockForm.d.ts +17 -0
- package/dist/admin/blocks/useBlockForm.js +46 -0
- package/dist/admin/components/RootViewMessage.js +1 -1
- package/dist/admin/copy/blocks.d.ts +47 -0
- package/dist/admin/copy/blocks.js +72 -0
- package/dist/admin/copy/goals.d.ts +8 -1
- package/dist/admin/copy/goals.js +14 -4
- package/dist/admin/copy/newTest.d.ts +13 -4
- package/dist/admin/copy/newTest.js +16 -4
- package/dist/admin/goals/XpGoalField.d.ts +4 -0
- package/dist/admin/goals/XpGoalField.js +194 -0
- package/dist/admin/goals/xpGoalField.css +47 -0
- package/dist/admin/pageCollections.d.ts +11 -0
- package/dist/admin/pageCollections.js +23 -0
- package/dist/admin/paths.d.ts +9 -0
- package/dist/admin/paths.js +9 -0
- package/dist/admin/placementStatus.model.d.ts +2 -0
- package/dist/admin/placementStatus.model.js +19 -0
- package/dist/admin/status.model.js +1 -1
- package/dist/admin/surface/ResultsRoute.d.ts +2 -1
- package/dist/admin/surface/ResultsRoute.js +20 -24
- package/dist/admin/surface/SurfaceShell.js +5 -2
- package/dist/admin/surface/TestRowMenu.d.ts +6 -0
- package/dist/admin/surface/TestRowMenu.js +156 -0
- package/dist/admin/surface/TestsHome.d.ts +5 -3
- package/dist/admin/surface/TestsHome.js +298 -59
- package/dist/admin/surface/TestsSurface.js +13 -8
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -1
- package/dist/admin/surface/goals/GoalForm.js +159 -85
- package/dist/admin/surface/goals/GoalsList.d.ts +1 -1
- package/dist/admin/surface/goals/GoalsList.js +7 -6
- package/dist/admin/surface/goals/data.js +6 -3
- package/dist/admin/surface/goals/goals.css +7 -0
- package/dist/admin/surface/goals/goals.model.d.ts +12 -3
- package/dist/admin/surface/goals/goals.model.js +43 -2
- package/dist/admin/surface/home.model.d.ts +9 -8
- package/dist/admin/surface/home.model.js +28 -23
- package/dist/admin/surface/newTest/NewTest.d.ts +4 -4
- package/dist/admin/surface/newTest/NewTest.js +146 -101
- package/dist/admin/surface/newTest/PageWizard.d.ts +8 -0
- package/dist/admin/surface/newTest/PageWizard.js +244 -0
- package/dist/admin/surface/newTest/newTest.css +28 -9
- package/dist/admin/surface/results/ResultsHeader.d.ts +2 -2
- package/dist/admin/surface/results/ResultsHeader.js +58 -57
- package/dist/admin/surface/surface.css +10 -0
- package/dist/admin/surface/test/TestPage.d.ts +1 -2
- package/dist/admin/surface/test/TestPage.js +42 -161
- package/dist/admin/theme.css +2 -0
- package/dist/admin/views/CollectionListRedirect.d.ts +1 -0
- package/dist/admin/views/CollectionListRedirect.js +1 -1
- package/dist/admin/views/ExperimentsRootView.js +28 -133
- package/dist/admin/views/GoalEditRedirect.d.ts +4 -0
- package/dist/admin/views/GoalEditRedirect.js +14 -0
- package/dist/admin/views/GoalsCollectionListView.d.ts +2 -0
- package/dist/admin/views/GoalsCollectionListView.js +4 -0
- package/dist/admin/views/TestsCollectionListView.d.ts +2 -0
- package/dist/admin/views/TestsCollectionListView.js +4 -0
- package/dist/admin/views/TestsNavLinkServer.d.ts +1 -0
- package/dist/admin/views/TestsNavLinkServer.js +2 -2
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +11 -0
- package/dist/admin/views/buildSurfaceProps.d.ts +8 -0
- package/dist/admin/views/buildSurfaceProps.js +102 -0
- package/dist/admin/views/renderCollectionList.d.ts +2 -0
- package/dist/admin/views/renderCollectionList.js +34 -0
- package/dist/admin/views/renderTestsSurface.d.ts +3 -0
- package/dist/admin/views/renderTestsSurface.js +34 -0
- package/dist/blocks/bindings.d.ts +3 -0
- package/dist/blocks/bindings.js +28 -0
- package/dist/blocks/createExperimentBlock.d.ts +6 -0
- package/dist/blocks/createExperimentBlock.js +77 -0
- package/dist/blocks/formState.d.ts +31 -0
- package/dist/blocks/formState.js +146 -0
- package/dist/blocks/model.d.ts +41 -0
- package/dist/blocks/model.js +34 -0
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +37 -0
- package/dist/blocks/placementLocale.js +270 -0
- package/dist/client/ExperimentGroup.d.ts +6 -0
- package/dist/client/ExperimentGroup.js +9 -0
- package/dist/client/ExperimentsProvider.js +20 -4
- package/dist/client/clickGoals.d.ts +4 -0
- package/dist/client/clickGoals.js +43 -0
- package/dist/collections/experiments/config.js +29 -10
- package/dist/collections/experiments/deleteGuard.d.ts +2 -1
- package/dist/collections/experiments/deleteGuard.js +14 -3
- package/dist/collections/experiments/editability.js +4 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.d.ts +2 -0
- package/dist/collections/experiments/pickSlug.js +10 -0
- package/dist/collections/labels.d.ts +3 -0
- package/dist/collections/labels.js +20 -0
- package/dist/collections/metrics.js +28 -6
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/phases.js +1 -0
- package/dist/collections/serialize.js +12 -4
- 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/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.d.ts +30 -0
- package/dist/db/bulkPlacementRemoval.js +111 -0
- package/dist/db/clickGoals.d.ts +9 -0
- package/dist/db/clickGoals.js +22 -0
- package/dist/db/delete.d.ts +2 -1
- package/dist/db/delete.js +3 -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/locks.d.ts +8 -0
- package/dist/db/locks.js +27 -4
- package/dist/db/names.d.ts +4 -0
- package/dist/db/names.js +4 -0
- package/dist/db/pageBindings.d.ts +4 -0
- package/dist/db/pageBindings.js +17 -0
- package/dist/db/pageBusy.d.ts +2 -0
- package/dist/db/pageBusy.js +10 -0
- package/dist/db/pageContent.d.ts +10 -0
- package/dist/db/pageContent.js +79 -0
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/placements.d.ts +35 -0
- package/dist/db/placements.js +62 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/slugs.d.ts +8 -0
- package/dist/db/slugs.js +40 -0
- package/dist/db/snapshots.d.ts +7 -0
- package/dist/db/snapshots.js +8 -5
- package/dist/endpoints/clickKeys.d.ts +5 -0
- package/dist/endpoints/clickKeys.js +17 -0
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +207 -0
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +407 -0
- package/dist/endpoints/editorSurface.d.ts +3 -0
- package/dist/endpoints/editorSurface.js +31 -0
- package/dist/endpoints/events.js +106 -39
- package/dist/endpoints/index.js +85 -9
- package/dist/endpoints/pages.d.ts +5 -0
- package/dist/endpoints/pages.js +303 -0
- package/dist/endpoints/placementStatus.d.ts +6 -0
- package/dist/endpoints/placementStatus.js +246 -0
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/endpoints/readBody.d.ts +2 -0
- package/dist/endpoints/readBody.js +24 -0
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +10 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -5
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/endpoints/wrapBlock.d.ts +6 -0
- package/dist/endpoints/wrapBlock.js +76 -0
- package/dist/errors.d.ts +7 -2
- package/dist/errors.js +11 -3
- 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 +25 -7
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/adminClient.d.ts +6 -1
- package/dist/exports/adminClient.js +6 -1
- package/dist/exports/adminRsc.d.ts +3 -0
- package/dist/exports/adminRsc.js +3 -0
- package/dist/exports/blocks.d.ts +2 -0
- package/dist/exports/blocks.js +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +1 -0
- package/dist/exports/index.d.ts +6 -1
- package/dist/exports/index.js +3 -0
- package/dist/exports/puck.d.ts +3 -1
- package/dist/exports/puck.js +2 -0
- package/dist/exports/puckEditor.d.ts +3 -0
- package/dist/exports/puckEditor.js +2 -0
- package/dist/exports/rsc.d.ts +4 -0
- package/dist/exports/rsc.js +3 -0
- package/dist/fields/xpGoal.d.ts +3 -0
- package/dist/fields/xpGoal.js +16 -0
- package/dist/globals/state.js +10 -0
- package/dist/goals/cache.d.ts +3 -0
- package/dist/goals/cache.js +35 -0
- package/dist/goals/fairness.d.ts +40 -0
- package/dist/goals/fairness.js +209 -0
- package/dist/goals/key.d.ts +4 -0
- package/dist/goals/key.js +3 -0
- package/dist/goals/picker/clickGoalPicker.model.d.ts +36 -0
- package/dist/goals/picker/clickGoalPicker.model.js +63 -0
- package/dist/goals/picker/copy.d.ts +20 -0
- package/dist/goals/picker/copy.js +24 -0
- package/dist/goals/picker/useClickGoalPicker.d.ts +30 -0
- package/dist/goals/picker/useClickGoalPicker.js +222 -0
- package/dist/goals/validate.d.ts +3 -0
- package/dist/goals/validate.js +15 -0
- package/dist/hooks/blockRemovalRule.d.ts +30 -0
- package/dist/hooks/blockRemovalRule.js +165 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.d.ts +30 -1
- package/dist/hooks/pageGuard.js +337 -107
- package/dist/hooks/puckGoals.d.ts +5 -0
- package/dist/hooks/puckGoals.js +62 -0
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/lib/placementPages.d.ts +10 -0
- package/dist/{admin/previewLinks.model.js → lib/placementPages.js} +10 -5
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +13 -6
- package/dist/onInit.js +65 -0
- package/dist/options.d.ts +4 -0
- package/dist/options.js +62 -1
- package/dist/plugin.js +56 -44
- 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/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +62 -40
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +6 -1
- package/dist/puck/copy.js +6 -1
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +25 -0
- package/dist/puck/editor/ConfigureTestDrawer.js +150 -0
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +12 -2
- package/dist/puck/editor/CreateExperimentDrawer.js +89 -21
- package/dist/puck/editor/EditorControls.d.ts +14 -0
- package/dist/puck/editor/EditorControls.js +99 -0
- package/dist/puck/editor/ExperimentSlotEditor.js +951 -179
- package/dist/puck/editor/LeftoverVersions.d.ts +15 -0
- package/dist/puck/editor/LeftoverVersions.js +79 -0
- package/dist/puck/editor/PlacementNotice.d.ts +8 -0
- package/dist/puck/editor/PlacementNotice.js +22 -0
- package/dist/puck/editor/QuickTestActions.d.ts +6 -0
- package/dist/puck/editor/QuickTestActions.js +57 -0
- package/dist/puck/editor/ResultsReadout.d.ts +2 -1
- package/dist/puck/editor/ResultsReadout.js +10 -6
- package/dist/puck/editor/VersionBuilder.d.ts +66 -12
- package/dist/puck/editor/VersionBuilder.js +554 -231
- package/dist/puck/editor/armWrites.d.ts +11 -2
- package/dist/puck/editor/armWrites.js +43 -4
- package/dist/puck/editor/armsCache.d.ts +3 -1
- package/dist/puck/editor/armsCache.js +20 -4
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/cloneSlot.d.ts +2 -0
- package/dist/puck/editor/cloneSlot.js +7 -0
- package/dist/puck/editor/copy.d.ts +64 -19
- package/dist/puck/editor/copy.js +72 -20
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +192 -19
- package/dist/puck/editor/editor.css +329 -24
- package/dist/puck/editor/editor.model.d.ts +21 -3
- package/dist/puck/editor/editor.model.js +67 -7
- package/dist/puck/editor/editorSurface.d.ts +10 -0
- package/dist/puck/editor/editorSurface.js +65 -0
- package/dist/puck/editor/experimentOutlinePlugin.js +96 -28
- package/dist/puck/editor/integration.d.ts +10 -0
- package/dist/puck/editor/integration.js +30 -0
- package/dist/puck/editor/localPlacements.d.ts +5 -0
- package/dist/puck/editor/localPlacements.js +43 -0
- package/dist/puck/editor/outlineVersion.d.ts +5 -0
- package/dist/puck/editor/outlineVersion.js +36 -0
- package/dist/puck/editor/placementsCache.d.ts +60 -0
- package/dist/puck/editor/placementsCache.js +263 -0
- package/dist/puck/editor/sidebar.d.ts +8 -0
- package/dist/puck/editor/sidebar.js +74 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/editor/usePlacementNotice.d.ts +3 -0
- package/dist/puck/editor/usePlacementNotice.js +15 -0
- package/dist/puck/editor/xpGoalPuckEditorField.d.ts +7 -0
- package/dist/puck/editor/xpGoalPuckEditorField.js +153 -0
- package/dist/puck/experimentSlotField.d.ts +3 -0
- package/dist/puck/experimentSlotField.js +15 -4
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/integration.d.ts +6 -0
- package/dist/puck/integration.js +21 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/puck/xpGoalField.d.ts +3 -0
- package/dist/puck/xpGoalField.js +6 -0
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/health.d.ts +12 -0
- package/dist/results/health.js +55 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/snapshot.js +15 -2
- package/dist/results/verdict.js +2 -1
- 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 +63 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/pageKindSeoContract.d.ts +27 -0
- package/dist/server/pageKindSeoContract.js +80 -0
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +88 -12
- package/dist/server/resolveExperimentBlocks.d.ts +5 -0
- package/dist/server/resolveExperimentBlocks.js +52 -0
- package/dist/server/resolveExperimentData.js +8 -8
- package/dist/server/runResults.js +104 -25
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/toClientAssignments.js +2 -1
- package/dist/server/trackConversion.js +10 -13
- package/dist/{admin → testSurface}/PreviewLinks.d.ts +2 -1
- package/dist/{admin → testSurface}/PreviewLinks.js +8 -4
- package/dist/testSurface/actions/DecideDialog.d.ts +16 -0
- package/dist/{admin → testSurface}/actions/DecideDialog.js +79 -56
- package/dist/testSurface/actions/LifecycleAction.d.ts +16 -0
- package/dist/testSurface/actions/LifecycleAction.js +105 -0
- package/dist/{admin → testSurface}/actions/MakeContentResult.d.ts +4 -3
- package/dist/{admin → testSurface}/actions/MakeContentResult.js +10 -2
- package/dist/{admin → testSurface}/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +122 -0
- package/dist/testSurface/api.d.ts +60 -0
- package/dist/testSurface/api.js +167 -0
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/{admin → testSurface}/copy/actions.d.ts +30 -8
- package/dist/{admin → testSurface}/copy/actions.js +40 -11
- package/dist/{admin → testSurface}/copy/common.d.ts +13 -4
- package/dist/{admin → testSurface}/copy/common.js +18 -8
- package/dist/testSurface/copy/languages.d.ts +12 -0
- package/dist/testSurface/copy/languages.js +8 -0
- package/dist/{admin → testSurface}/copy/metrics.d.ts +1 -0
- package/dist/{admin → testSurface}/copy/metrics.js +1 -0
- package/dist/testSurface/copy/pages.d.ts +84 -0
- package/dist/testSurface/copy/pages.js +90 -0
- package/dist/{admin → testSurface}/copy/readiness.d.ts +59 -6
- package/dist/testSurface/copy/readiness.js +136 -0
- package/dist/{admin → testSurface}/copy/results.d.ts +7 -3
- package/dist/{admin → testSurface}/copy/results.js +7 -3
- package/dist/{admin → testSurface}/copy/review.d.ts +1 -1
- package/dist/{admin → testSurface}/copy/review.js +1 -1
- package/dist/{admin → testSurface}/copy/surface.d.ts +11 -2
- package/dist/{admin → testSurface}/copy/surface.js +13 -10
- package/dist/{admin → testSurface}/copy/testPage.d.ts +56 -7
- package/dist/testSurface/copy/testPage.js +165 -0
- package/dist/testSurface/format/adminURL.d.ts +7 -0
- package/dist/testSurface/format/adminURL.js +9 -0
- package/dist/{admin → testSurface}/metricSource.model.d.ts +2 -0
- package/dist/{admin → testSurface}/metricSource.model.js +4 -0
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/testSurface/placements/placementLabels.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.js +22 -0
- package/dist/testSurface/placements/placementLabels.model.d.ts +13 -0
- package/dist/testSurface/placements/placementLabels.model.js +12 -0
- package/dist/testSurface/placements/usePlacementLabels.d.ts +12 -0
- package/dist/testSurface/placements/usePlacementLabels.js +102 -0
- package/dist/{admin → testSurface}/previewLinks.model.d.ts +1 -6
- package/dist/testSurface/previewLinks.model.js +4 -0
- package/dist/testSurface/readPreflight.d.ts +13 -0
- package/dist/testSurface/readPreflight.js +44 -0
- package/dist/testSurface/readinessRead.d.ts +53 -0
- package/dist/testSurface/readinessRead.js +50 -0
- package/dist/{admin → testSurface}/results/DataQualityPanel.js +4 -1
- package/dist/{admin → testSurface}/results/VerdictHero.d.ts +2 -1
- package/dist/{admin → testSurface}/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/results.css +64 -0
- package/dist/{admin → testSurface}/results/results.model.d.ts +3 -0
- package/dist/{admin → testSurface}/results/results.model.js +14 -6
- package/dist/{admin → testSurface}/surface/contracts.d.ts +23 -8
- package/dist/testSurface/surface/editorPlacement.d.ts +26 -0
- package/dist/testSurface/surface/editorPlacement.js +78 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +9 -0
- package/dist/{admin → testSurface}/surface/pageBlock/parts.js +39 -11
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +13 -0
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +273 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +21 -0
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +503 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +29 -0
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +40 -0
- package/dist/{admin → testSurface}/surface/readiness/ActionDialogs.d.ts +8 -4
- package/dist/testSurface/surface/readiness/ActionDialogs.js +351 -0
- package/dist/{admin → testSurface}/surface/readiness/Banner.d.ts +2 -3
- package/dist/testSurface/surface/readiness/Banner.js +187 -0
- package/dist/testSurface/surface/readiness/BlockerList.d.ts +11 -0
- package/dist/testSurface/surface/readiness/BlockerList.js +31 -0
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +10 -0
- package/dist/testSurface/surface/readiness/SaveStatus.js +66 -0
- package/dist/{admin → testSurface}/surface/readiness/parts.js +0 -2
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +57 -0
- package/dist/testSurface/surface/readiness/readiness.model.js +377 -0
- package/dist/testSurface/surface/readiness/useTransition.d.ts +16 -0
- package/dist/testSurface/surface/readiness/useTransition.js +141 -0
- package/dist/testSurface/surface/results/ReleasePages.d.ts +19 -0
- package/dist/{admin → testSurface}/surface/results/ReleasePages.js +43 -47
- package/dist/{admin → testSurface}/surface/results/ResultsBody.d.ts +7 -3
- package/dist/{admin → testSurface}/surface/results/ResultsBody.js +129 -46
- package/dist/{admin → testSurface}/surface/results/useResults.d.ts +36 -9
- package/dist/{admin → testSurface}/surface/results/useResults.js +3 -2
- package/dist/{admin → testSurface}/surface/setting/parts.js +58 -18
- package/dist/testSurface/surface/setting/setting.css +17 -0
- package/dist/testSurface/surface/test/AdvancedSection.js +169 -0
- package/dist/testSurface/surface/test/DeleteTest.d.ts +23 -0
- package/dist/testSurface/surface/test/DeleteTest.js +270 -0
- package/dist/testSurface/surface/test/GoalSection.d.ts +4 -0
- package/dist/testSurface/surface/test/GoalSection.js +341 -0
- package/dist/testSurface/surface/test/LengthSection.d.ts +2 -0
- package/dist/{admin → testSurface}/surface/test/LengthSection.js +6 -2
- package/dist/testSurface/surface/test/PageHoldout.d.ts +3 -0
- package/dist/testSurface/surface/test/PageHoldout.js +70 -0
- package/dist/{admin → testSurface}/surface/test/Rail.js +7 -4
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/ReadinessBar.js +2 -3
- package/dist/{admin → testSurface}/surface/test/Section.d.ts +3 -1
- package/dist/testSurface/surface/test/Section.js +80 -0
- package/dist/{admin → testSurface}/surface/test/TargetingSection.js +82 -12
- package/dist/testSurface/surface/test/TestSurface.d.ts +19 -0
- package/dist/testSurface/surface/test/TestSurface.js +265 -0
- package/dist/testSurface/surface/test/VersionsSection.d.ts +5 -0
- package/dist/{admin → testSurface}/surface/test/VersionsSection.js +81 -40
- package/dist/{admin → testSurface}/surface/test/fields.d.ts +40 -8
- package/dist/testSurface/surface/test/fields.js +306 -0
- package/dist/{admin → testSurface}/surface/test/jumpToSection.d.ts +1 -1
- package/dist/{admin → testSurface}/surface/test/jumpToSection.js +4 -3
- package/dist/testSurface/surface/test/pageParts.d.ts +5 -0
- package/dist/testSurface/surface/test/pageParts.js +106 -0
- package/dist/testSurface/surface/test/testPage.css +103 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.d.ts +1 -0
- package/dist/{admin → testSurface}/surface/test/testPage.model.js +6 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.d.ts +4 -0
- package/dist/{admin → testSurface}/surface/testDocument.model.js +6 -2
- package/dist/testSurface/surface/useTestDocument.d.ts +60 -0
- package/dist/testSurface/surface/useTestDocument.js +782 -0
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +7 -0
- package/dist/testSurface/surfaceUrls.js +19 -0
- package/dist/testSurface/useApi.d.ts +60 -0
- package/dist/testSurface/useApi.js +8 -0
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.d.ts +3 -0
- package/dist/testSurface/useReadinessPolling.js +26 -0
- package/dist/transitions/addMetric.d.ts +4 -6
- package/dist/transitions/addMetric.js +33 -2
- 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 +18 -1
- package/dist/transitions/checkStart.js +207 -9
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +30 -3
- package/dist/transitions/deleteExperiment.d.ts +5 -3
- package/dist/transitions/deleteExperiment.js +43 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +13 -4
- package/dist/transitions/makeContent.d.ts +7 -1
- package/dist/transitions/makeContent.js +74 -22
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +32 -0
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageCollection.d.ts +10 -0
- package/dist/transitions/pageCollection.js +20 -0
- package/dist/transitions/pageVersions.d.ts +10 -0
- package/dist/transitions/pageVersions.js +46 -0
- package/dist/transitions/phaseRecord.d.ts +3 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +40 -0
- package/dist/transitions/placementInteractions.js +98 -0
- package/dist/transitions/placements.d.ts +58 -4
- package/dist/transitions/placements.js +391 -21
- package/dist/transitions/preflightData.d.ts +7 -5
- package/dist/transitions/preflightData.js +269 -40
- 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 +3 -4
- package/dist/transitions/resolveCaps.js +6 -2
- package/dist/transitions/start.d.ts +6 -8
- package/dist/transitions/start.js +112 -31
- 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/admin.d.ts +1 -1
- package/dist/types/assignments.d.ts +1 -0
- package/dist/types/contracts.d.ts +30 -3
- package/dist/types/endpoints.d.ts +204 -13
- package/dist/types/index.d.ts +3 -0
- package/dist/types/puck.d.ts +8 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +19 -4
- package/dist/types/surface.d.ts +20 -7
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Card.d.ts +2 -1
- package/dist/ui/Card.js +4 -4
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +24 -2
- package/dist/ui/Dialog.js +116 -6
- package/dist/ui/Drawer.d.ts +10 -0
- package/dist/ui/Drawer.js +29 -0
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +7 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +4 -4
- package/dist/ui/Tabs.js +35 -32
- package/dist/ui/ui.css +49 -5
- package/package.json +9 -1
- package/dist/admin/actions/ConfirmDialog.d.ts +0 -18
- package/dist/admin/actions/ConfirmDialog.js +0 -149
- package/dist/admin/actions/DecideDialog.d.ts +0 -9
- package/dist/admin/actions/actions.model.js +0 -70
- package/dist/admin/api.d.ts +0 -38
- package/dist/admin/api.js +0 -99
- package/dist/admin/copy/readiness.js +0 -71
- package/dist/admin/copy/testPage.js +0 -100
- 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/pageBlock/pageBlock.model.js +0 -8
- package/dist/admin/surface/readiness/ActionDialogs.js +0 -302
- package/dist/admin/surface/readiness/Banner.js +0 -166
- package/dist/admin/surface/readiness/SaveStatus.d.ts +0 -5
- package/dist/admin/surface/readiness/SaveStatus.js +0 -53
- package/dist/admin/surface/readiness/readiness.model.d.ts +0 -24
- package/dist/admin/surface/readiness/readiness.model.js +0 -123
- package/dist/admin/surface/readiness/useTransition.d.ts +0 -11
- package/dist/admin/surface/readiness/useTransition.js +0 -35
- package/dist/admin/surface/results/ReleasePages.d.ts +0 -14
- package/dist/admin/surface/setting/setting.css +0 -17
- package/dist/admin/surface/test/AdvancedSection.js +0 -160
- package/dist/admin/surface/test/GoalSection.d.ts +0 -2
- package/dist/admin/surface/test/GoalSection.js +0 -228
- package/dist/admin/surface/test/LengthSection.d.ts +0 -2
- package/dist/admin/surface/test/Section.js +0 -47
- package/dist/admin/surface/test/VersionsSection.d.ts +0 -4
- package/dist/admin/surface/test/fields.js +0 -184
- package/dist/admin/surface/test/pageParts.d.ts +0 -2
- package/dist/admin/surface/test/pageParts.js +0 -45
- package/dist/admin/surface/test/testPage.css +0 -90
- package/dist/admin/surface/useTestDocument.d.ts +0 -23
- package/dist/admin/surface/useTestDocument.js +0 -377
- package/dist/admin/useApi.d.ts +0 -35
- package/dist/admin/useApi.js +0 -10
- /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}/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/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/recommendation.d.ts +0 -0
- /package/dist/{admin → testSurface}/copy/recommendation.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}/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}/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/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/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/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/parts.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/readiness/parts.d.ts +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/setting/parts.d.ts +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/Rail.d.ts +0 -0
- /package/dist/{admin → testSurface}/surface/test/TargetingSection.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
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
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';
|
|
8
7
|
import { ARMS_COPY, GROUP_LABELS, issueMessage } from '../../copy/arms.js';
|
|
9
8
|
import { addHoldoutArm, addVariant, issuesByRow, removeArm, splitEvenly, totalWeight, withSlotsFor } from '../../arms/arms.model.js';
|
|
10
9
|
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';
|
|
10
|
+
import { balanceWeight, orderedVersions, trafficShares, trafficSplit } from './testPage.model.js';
|
|
11
|
+
import { FieldErrors, ReadOnly, reasonFor, save, SavedValueChanged, TextEdit, useDraftAnnouncement, useFieldDraft } from './fields.js';
|
|
12
|
+
import { PAGE_COPY } from '../../copy/pages.js';
|
|
13
|
+
import { testPageCollection } from '../pagePicker/pagePicker.model.js';
|
|
13
14
|
import { Section } from './Section.js';
|
|
14
15
|
const COLOURS = {
|
|
15
16
|
control: 'var(--xp-series-muted)',
|
|
@@ -18,37 +19,47 @@ const COLOURS = {
|
|
|
18
19
|
variantC: 'var(--xp-series-c)',
|
|
19
20
|
holdout: 'var(--xp-series-muted)'
|
|
20
21
|
};
|
|
21
|
-
export function VersionsSection({ test, surface, parts }) {
|
|
22
|
+
export function VersionsSection({ test, surface, parts, contentOnCanvas = false }) {
|
|
22
23
|
const id = useId();
|
|
23
24
|
const doc = test.doc;
|
|
24
25
|
const [weightEdit, setWeightEdit] = useState(null);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]);
|
|
26
|
+
const split = trafficSplit(doc.arms);
|
|
27
|
+
const allocationEdit = useFieldDraft(test, 'allocation', C.allocation, String(doc.allocation));
|
|
28
|
+
const [announcement, announce] = useDraftAnnouncement();
|
|
29
|
+
const allocation = Number(allocationEdit.value);
|
|
30
|
+
const allocationReason = reasonFor(test, 'allocation');
|
|
31
|
+
const allocationConflict = allocationEdit.dirty && !allocationEdit.saving && (allocationEdit.conflict || allocationEdit.retry || allocationReason) ? `${id}-new-value` : undefined;
|
|
32
|
+
if (weightEdit && (weightEdit.split !== split || test.mountDraft && !test.fieldDrafts?.[`share:${weightEdit.key}`])) setWeightEdit(null);
|
|
33
33
|
const reason = reasonFor(test, 'arms');
|
|
34
|
-
const live = weightEdit ? balanceWeight(doc.arms, weightEdit.key, weightEdit.weight) : doc.arms;
|
|
34
|
+
const live = weightEdit && !reason ? balanceWeight(doc.arms, weightEdit.key, weightEdit.weight) : doc.arms;
|
|
35
35
|
const ordered = orderedVersions(live);
|
|
36
36
|
const shares = trafficShares(ordered.map((row)=>row.arm));
|
|
37
|
-
const issues = issuesByRow(live, doc.kind);
|
|
37
|
+
const issues = issuesByRow(doc.kind === 'block' ? withSlotsFor(live, 'block') : live, doc.kind);
|
|
38
38
|
const update = (transform)=>save(test, 'arms', ()=>({
|
|
39
39
|
arms: withSlotsFor(transform(test.doc.arms), test.doc.kind)
|
|
40
40
|
}));
|
|
41
|
-
const commitAllocation = ()=>{
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
const commitAllocation = (confirmed = false)=>{
|
|
42
|
+
if (!allocationEdit.dirty || allocationEdit.saving) return;
|
|
43
|
+
if (allocationReason || test.stale || allocationConflict && !confirmed) {
|
|
44
|
+
announce();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (allocation === doc.allocation) allocationEdit.discard();
|
|
48
|
+
else allocationEdit.submit(()=>save(test, 'allocation', ()=>({
|
|
49
|
+
allocation
|
|
50
|
+
})));
|
|
47
51
|
};
|
|
48
52
|
return /*#__PURE__*/ _jsxs(Section, {
|
|
53
|
+
surface: surface,
|
|
49
54
|
test: test,
|
|
50
55
|
sectionId: "versions",
|
|
51
56
|
children: [
|
|
57
|
+
doc.kind === 'page' && testPageCollection(surface.pageCollections, doc, test.preflight?.pagePlacements)?.contentChecks === false ? /*#__PURE__*/ _jsx("p", {
|
|
58
|
+
children: PAGE_COPY.contentChecksOff
|
|
59
|
+
}) : null,
|
|
60
|
+
contentOnCanvas ? /*#__PURE__*/ _jsx("p", {
|
|
61
|
+
children: C.editVersionsOnCanvas
|
|
62
|
+
}) : null,
|
|
52
63
|
reason ? /*#__PURE__*/ _jsx("p", {
|
|
53
64
|
className: "xp-ui-help",
|
|
54
65
|
children: reason
|
|
@@ -70,10 +81,15 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
70
81
|
/*#__PURE__*/ _jsx("span", {})
|
|
71
82
|
]
|
|
72
83
|
}),
|
|
73
|
-
ordered.map(({ arm, index })=>/*#__PURE__*/ _jsxs("article", {
|
|
84
|
+
ordered.filter(({ arm })=>doc.kind !== 'page' || arm.kind !== 'holdout').map(({ arm, index })=>/*#__PURE__*/ _jsxs("article", {
|
|
74
85
|
className: "xp-version-row",
|
|
86
|
+
id: `xp-version-${arm.key}`,
|
|
87
|
+
tabIndex: -1,
|
|
75
88
|
children: [
|
|
76
|
-
/*#__PURE__*/ _jsx(
|
|
89
|
+
contentOnCanvas ? /*#__PURE__*/ _jsx("span", {
|
|
90
|
+
children: arm.label
|
|
91
|
+
}) : /*#__PURE__*/ _jsx(TextEdit, {
|
|
92
|
+
test: test,
|
|
77
93
|
label: `${GROUP_LABELS[arm.key]}: ${C.label}`,
|
|
78
94
|
value: arm.label,
|
|
79
95
|
reason: reason,
|
|
@@ -85,17 +101,22 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
85
101
|
} : current))
|
|
86
102
|
}),
|
|
87
103
|
/*#__PURE__*/ _jsx(TextEdit, {
|
|
104
|
+
test: test,
|
|
105
|
+
draftKey: `share:${arm.key}`,
|
|
88
106
|
label: `${GROUP_LABELS[arm.key]}: ${C.weight}`,
|
|
89
107
|
type: "number",
|
|
90
108
|
min: 0,
|
|
91
109
|
max: 100,
|
|
92
110
|
value: doc.arms[index].weight,
|
|
111
|
+
preview: weightEdit?.key !== arm.key ? arm.weight : undefined,
|
|
112
|
+
scope: split,
|
|
93
113
|
reason: reason,
|
|
94
114
|
hideLabel: true,
|
|
95
115
|
disabled: Boolean(reason),
|
|
96
|
-
|
|
116
|
+
isValid: (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) >= 0 && Number(raw) <= 100,
|
|
97
117
|
invalidMessage: C.invalidShare,
|
|
98
|
-
onDraft: (value)=>setWeightEdit({
|
|
118
|
+
onDraft: (value)=>setWeightEdit(value === null ? null : {
|
|
119
|
+
split,
|
|
99
120
|
key: arm.key,
|
|
100
121
|
weight: Number(value)
|
|
101
122
|
}),
|
|
@@ -104,11 +125,12 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
104
125
|
/*#__PURE__*/ _jsx(parts.VersionContent, {
|
|
105
126
|
test: test,
|
|
106
127
|
surface: surface,
|
|
107
|
-
armIndex: index
|
|
128
|
+
armIndex: index,
|
|
129
|
+
summary: contentOnCanvas
|
|
108
130
|
}),
|
|
109
131
|
/*#__PURE__*/ _jsx("div", {
|
|
110
132
|
className: "xp-ui-button-group xp-version-remove",
|
|
111
|
-
children: arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
|
|
133
|
+
children: !contentOnCanvas && arm.kind !== 'control' ? /*#__PURE__*/ _jsx(Button, {
|
|
112
134
|
variant: "quiet",
|
|
113
135
|
size: "sm",
|
|
114
136
|
disabled: Boolean(reason),
|
|
@@ -168,7 +190,7 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
168
190
|
role: "alert",
|
|
169
191
|
children: test.errors.arms
|
|
170
192
|
}) : null,
|
|
171
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
193
|
+
!contentOnCanvas ? /*#__PURE__*/ _jsxs("div", {
|
|
172
194
|
className: "xp-section-actions xp-ui-button-group",
|
|
173
195
|
title: reason ?? undefined,
|
|
174
196
|
children: [
|
|
@@ -177,26 +199,26 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
177
199
|
onClick: ()=>update((arms)=>addVariant(arms, doc.kind)),
|
|
178
200
|
children: C.addVersion
|
|
179
201
|
}),
|
|
180
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
202
|
+
doc.kind !== 'page' ? /*#__PURE__*/ _jsx(Button, {
|
|
181
203
|
disabled: Boolean(reason) || doc.arms.some((arm)=>arm.kind === 'holdout'),
|
|
182
204
|
onClick: ()=>update(addHoldoutArm),
|
|
183
205
|
children: C.addHoldout
|
|
184
|
-
}),
|
|
206
|
+
}) : null,
|
|
185
207
|
/*#__PURE__*/ _jsx(Button, {
|
|
186
208
|
disabled: Boolean(reason),
|
|
187
209
|
onClick: ()=>update(splitEvenly),
|
|
188
210
|
children: C.split
|
|
189
211
|
})
|
|
190
212
|
]
|
|
191
|
-
}),
|
|
192
|
-
doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
|
|
213
|
+
}) : null,
|
|
214
|
+
doc.kind !== 'page' && doc.arms.some((arm)=>arm.kind === 'holdout') ? /*#__PURE__*/ _jsx("p", {
|
|
193
215
|
className: "xp-ui-help",
|
|
194
216
|
children: ARMS_COPY.holdout
|
|
195
217
|
}) : null,
|
|
196
|
-
|
|
218
|
+
allocationReason && !allocationEdit.dirty ? /*#__PURE__*/ _jsx(ReadOnly, {
|
|
197
219
|
label: C.allocation,
|
|
198
220
|
value: `${doc.allocation}%`,
|
|
199
|
-
reason:
|
|
221
|
+
reason: allocationReason
|
|
200
222
|
}) : /*#__PURE__*/ _jsx(Range, {
|
|
201
223
|
id: id,
|
|
202
224
|
label: C.allocation,
|
|
@@ -204,11 +226,21 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
204
226
|
min: 1,
|
|
205
227
|
max: 100,
|
|
206
228
|
value: allocation,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
229
|
+
"aria-describedby": allocationConflict,
|
|
230
|
+
disabled: Boolean(allocationReason || test.stale || allocationEdit.saving),
|
|
231
|
+
onChange: (e)=>allocationEdit.change(e.target.value),
|
|
232
|
+
onPointerUp: ()=>commitAllocation(),
|
|
233
|
+
onKeyDown: (e)=>{
|
|
234
|
+
if (e.key === 'Enter' && allocationConflict) {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
announce();
|
|
237
|
+
}
|
|
238
|
+
if (e.key === 'Escape' && allocationEdit.dirty && !allocationEdit.saving) {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
e.stopPropagation();
|
|
241
|
+
allocationEdit.discard();
|
|
242
|
+
}
|
|
210
243
|
},
|
|
211
|
-
onPointerUp: commitAllocation,
|
|
212
244
|
onKeyUp: (e)=>{
|
|
213
245
|
if ([
|
|
214
246
|
'ArrowLeft',
|
|
@@ -221,11 +253,20 @@ export function VersionsSection({ test, surface, parts }) {
|
|
|
221
253
|
'PageDown'
|
|
222
254
|
].includes(e.key)) commitAllocation();
|
|
223
255
|
},
|
|
224
|
-
onBlur: commitAllocation
|
|
256
|
+
onBlur: ()=>commitAllocation()
|
|
225
257
|
}),
|
|
258
|
+
allocationConflict ? /*#__PURE__*/ _jsx(SavedValueChanged, {
|
|
259
|
+
id: allocationConflict,
|
|
260
|
+
value: `${doc.allocation}%`,
|
|
261
|
+
reason: allocationReason,
|
|
262
|
+
conflict: allocationEdit.conflict,
|
|
263
|
+
announce: announcement,
|
|
264
|
+
onKeep: !allocationReason && !test.stale ? ()=>commitAllocation(true) : undefined,
|
|
265
|
+
onDiscard: allocationEdit.discard
|
|
266
|
+
}) : null,
|
|
226
267
|
/*#__PURE__*/ _jsx("p", {
|
|
227
268
|
children: allocationSentence({
|
|
228
|
-
allocation:
|
|
269
|
+
allocation: allocationReason ? doc.allocation : allocation,
|
|
229
270
|
unitType: doc.unitType,
|
|
230
271
|
arms: live,
|
|
231
272
|
status: doc.status
|
|
@@ -3,7 +3,7 @@ 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;
|
|
@@ -14,27 +14,59 @@ export declare function ReadOnly({ label, value, reason, labelAction }: {
|
|
|
14
14
|
reason: string | null;
|
|
15
15
|
labelAction?: ReactNode;
|
|
16
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, conflict, announce, onKeep, onDiscard }: {
|
|
28
|
+
id: string;
|
|
29
|
+
value: string;
|
|
30
|
+
reason?: string | null;
|
|
31
|
+
conflict: boolean;
|
|
32
|
+
announce: number;
|
|
33
|
+
onKeep?: () => void;
|
|
34
|
+
onDiscard: () => void;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
/** Announce the existing choices again when blur or Enter cannot commit. */
|
|
37
|
+
export declare function useDraftAnnouncement(): readonly [number, () => void];
|
|
17
38
|
/** 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,
|
|
39
|
+
export declare function TextEdit({ test, label, draftKey, value, preview, onCommit, reason, multiline, placeholder, type, min, max, required, onDraft, scope, isValid, invalidMessage, hideLabel, disabled, help }: {
|
|
40
|
+
test: TestDocApi;
|
|
19
41
|
label: string;
|
|
42
|
+
draftKey?: string;
|
|
20
43
|
value: string | number;
|
|
21
|
-
onCommit: (value: string) => void;
|
|
44
|
+
onCommit: (value: string) => boolean | void;
|
|
22
45
|
reason?: string | null;
|
|
23
|
-
onDraft?: (value: string) => void;
|
|
46
|
+
onDraft?: (value: string | null) => void;
|
|
47
|
+
scope?: string;
|
|
48
|
+
preview?: number;
|
|
24
49
|
multiline?: boolean;
|
|
25
50
|
placeholder?: string;
|
|
26
51
|
type?: 'text' | 'number';
|
|
27
52
|
min?: number;
|
|
28
53
|
max?: number;
|
|
29
54
|
required?: boolean;
|
|
30
|
-
|
|
55
|
+
isValid?: (value: string) => boolean;
|
|
31
56
|
invalidMessage?: string;
|
|
32
57
|
hideLabel?: boolean;
|
|
33
58
|
disabled?: boolean;
|
|
34
59
|
help?: string;
|
|
35
60
|
}): import("react").JSX.Element;
|
|
36
61
|
export declare const positiveInteger: (raw: string) => boolean;
|
|
37
|
-
export
|
|
62
|
+
export type OptionGroup = {
|
|
63
|
+
label?: string;
|
|
64
|
+
options: readonly {
|
|
65
|
+
label: string;
|
|
66
|
+
value: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
export declare function SelectEdit({ label, value, options, groups, reason, onCommit, readOnlyValue, labelAction }: {
|
|
38
70
|
label: string;
|
|
39
71
|
value: string;
|
|
40
72
|
options: readonly {
|
|
@@ -45,8 +77,9 @@ export declare function SelectEdit({ label, value, options, reason, onCommit, re
|
|
|
45
77
|
onCommit: (value: string) => void;
|
|
46
78
|
readOnlyValue?: string;
|
|
47
79
|
labelAction?: ReactNode;
|
|
80
|
+
groups?: readonly OptionGroup[];
|
|
48
81
|
}): import("react").JSX.Element;
|
|
49
|
-
export declare function CheckboxList({ label, value, options, reason, onToggle, readOnlyValue
|
|
82
|
+
export declare function CheckboxList({ label, value, options, reason, onToggle, readOnlyValue }: {
|
|
50
83
|
label: string;
|
|
51
84
|
value: string[];
|
|
52
85
|
options: readonly {
|
|
@@ -56,7 +89,6 @@ export declare function CheckboxList({ label, value, options, reason, onToggle,
|
|
|
56
89
|
reason?: string | null;
|
|
57
90
|
onToggle: (value: string, checked: boolean) => void;
|
|
58
91
|
readOnlyValue?: string;
|
|
59
|
-
searchable?: boolean;
|
|
60
92
|
}): import("react").JSX.Element;
|
|
61
93
|
export declare function TestName({ test }: SectionProps): import("react").JSX.Element;
|
|
62
94
|
export declare function Hypothesis({ test }: SectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useLayoutEffect, useState } from 'react';
|
|
4
|
+
import { TextInput, NumberInput, Textarea, Select, CheckboxList as UICheckboxList } from '../../../ui/Inputs.js';
|
|
5
|
+
import { Button } from '../../../ui/Button.js';
|
|
6
|
+
import { Banner } from '../../../ui/Feedback.js';
|
|
7
|
+
import { TEST_PAGE as C } from '../../copy/testPage.js';
|
|
8
|
+
import { EDITABLE_BY_STATUS } from '../../../collections/experiments/editability.js';
|
|
9
|
+
import { lockedReason } from '../../lockedNotice.model.js';
|
|
10
|
+
export function reasonFor(test, field) {
|
|
11
|
+
return test.doc ? lockedReason(test.doc.status, field, EDITABLE_BY_STATUS) : null;
|
|
12
|
+
}
|
|
13
|
+
export function save(test, field, patch) {
|
|
14
|
+
if (!test.doc || reasonFor(test, field) || !test.stage(patch())) return false;
|
|
15
|
+
void test.commit();
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
export function FieldErrors({ test, path }) {
|
|
19
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
20
|
+
children: Object.entries(test.errors).filter(([key])=>key === path || key.startsWith(`${path}.`)).map(([key, message])=>/*#__PURE__*/ _jsx("p", {
|
|
21
|
+
className: "xp-field-error",
|
|
22
|
+
role: "alert",
|
|
23
|
+
children: message
|
|
24
|
+
}, key))
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function ReadOnly({ label, value, reason, labelAction }) {
|
|
28
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
29
|
+
className: "xp-read-only",
|
|
30
|
+
title: reason ?? undefined,
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
33
|
+
className: "xp-ui-field-label",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
36
|
+
children: label
|
|
37
|
+
}),
|
|
38
|
+
labelAction
|
|
39
|
+
]
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ _jsx("p", {
|
|
42
|
+
children: value
|
|
43
|
+
}),
|
|
44
|
+
reason ? /*#__PURE__*/ _jsx("small", {
|
|
45
|
+
children: reason
|
|
46
|
+
}) : null
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function useFieldDraft(test, key, label, saved, scope) {
|
|
51
|
+
const { mountDraft, submitDraft, trackDraft } = test;
|
|
52
|
+
const [localEdit, setLocalEdit] = useState(null);
|
|
53
|
+
const edit = mountDraft ? test.fieldDrafts?.[key] : localEdit;
|
|
54
|
+
const conflict = Boolean(edit && !edit.saving && (edit.scope !== scope || edit.base !== saved && edit.value !== saved));
|
|
55
|
+
useLayoutEffect(()=>mountDraft?.(key), [
|
|
56
|
+
key,
|
|
57
|
+
mountDraft
|
|
58
|
+
]);
|
|
59
|
+
const update = (draft)=>mountDraft ? trackDraft(key, draft) : setLocalEdit(draft);
|
|
60
|
+
return {
|
|
61
|
+
value: edit?.value ?? saved,
|
|
62
|
+
dirty: Boolean(edit),
|
|
63
|
+
saving: Boolean(edit?.saving),
|
|
64
|
+
retry: Boolean(edit?.retry),
|
|
65
|
+
conflict,
|
|
66
|
+
change (value) {
|
|
67
|
+
update(value === saved && !conflict ? null : {
|
|
68
|
+
label,
|
|
69
|
+
base: edit?.base ?? saved,
|
|
70
|
+
scope: edit ? edit.scope : scope,
|
|
71
|
+
value
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
submit (save) {
|
|
75
|
+
if (submitDraft) submitDraft(key, save);
|
|
76
|
+
else if (save() !== false) update(null);
|
|
77
|
+
},
|
|
78
|
+
discard () {
|
|
79
|
+
update(null);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export function SavedValueChanged({ id, value, reason, conflict, announce, onKeep, onDiscard }) {
|
|
84
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
85
|
+
id: id,
|
|
86
|
+
className: "xp-field-draft-notice",
|
|
87
|
+
children: /*#__PURE__*/ _jsx(Banner, {
|
|
88
|
+
tone: "error",
|
|
89
|
+
action: /*#__PURE__*/ _jsxs("div", {
|
|
90
|
+
className: "xp-ui-button-group",
|
|
91
|
+
children: [
|
|
92
|
+
onKeep ? /*#__PURE__*/ _jsx(Button, {
|
|
93
|
+
size: "sm",
|
|
94
|
+
onClick: onKeep,
|
|
95
|
+
children: conflict ? C.keepEdit : C.retryEdit
|
|
96
|
+
}) : null,
|
|
97
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
98
|
+
size: "sm",
|
|
99
|
+
variant: "quiet",
|
|
100
|
+
onClick: onDiscard,
|
|
101
|
+
children: C.useSavedValue
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
}),
|
|
105
|
+
children: /*#__PURE__*/ _jsxs("span", {
|
|
106
|
+
children: [
|
|
107
|
+
reason ?? (conflict ? C.savedValueChanged : null),
|
|
108
|
+
' ',
|
|
109
|
+
onKeep && conflict ? C.conflictChoice : C.draftNotSaved,
|
|
110
|
+
' ',
|
|
111
|
+
C.savedValue,
|
|
112
|
+
" ",
|
|
113
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
114
|
+
children: value || C.emptyValue
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
}, announce)
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** Announce the existing choices again when blur or Enter cannot commit. */ export function useDraftAnnouncement() {
|
|
122
|
+
const [announcement, setAnnouncement] = useState(0);
|
|
123
|
+
return [
|
|
124
|
+
announcement,
|
|
125
|
+
()=>setAnnouncement((count)=>count + 1)
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
/** Local typing is intentionally separate from staging: build the current group on commit. */ export function TextEdit({ test, label, draftKey = label, value, preview, onCommit, reason, multiline, placeholder, type = 'text', min, max, required, onDraft, scope, isValid, invalidMessage, hideLabel = false, disabled = false, help }) {
|
|
129
|
+
const id = useId();
|
|
130
|
+
const edit = useFieldDraft(test, draftKey, label, String(value), scope);
|
|
131
|
+
const [announcement, announce] = useDraftAnnouncement();
|
|
132
|
+
const [error, setError] = useState(null);
|
|
133
|
+
if (error && !edit.dirty) setError(null);
|
|
134
|
+
const discard = ()=>{
|
|
135
|
+
edit.discard();
|
|
136
|
+
onDraft?.(null);
|
|
137
|
+
setError(null);
|
|
138
|
+
};
|
|
139
|
+
const locked = Boolean(reason || disabled);
|
|
140
|
+
const choice = edit.dirty && !edit.saving && (edit.conflict || edit.retry || locked || Boolean(error));
|
|
141
|
+
const choiceId = choice ? `${id}-new-value` : undefined;
|
|
142
|
+
const commit = (confirmed = false)=>{
|
|
143
|
+
if (!edit.dirty || edit.saving) return;
|
|
144
|
+
if (locked || test.stale || choice && !confirmed) {
|
|
145
|
+
announce();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const draft = edit.value;
|
|
149
|
+
if (draft === String(value)) {
|
|
150
|
+
discard();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (isValid && !isValid(draft)) {
|
|
154
|
+
onDraft?.(null);
|
|
155
|
+
setError(invalidMessage ?? C.editInvalid);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
edit.submit(()=>onCommit(draft));
|
|
159
|
+
onDraft?.(null);
|
|
160
|
+
};
|
|
161
|
+
if (reason && !disabled && !edit.dirty) return /*#__PURE__*/ _jsx(ReadOnly, {
|
|
162
|
+
label: label,
|
|
163
|
+
value: value === '' && placeholder ? placeholder : value,
|
|
164
|
+
reason: reason
|
|
165
|
+
});
|
|
166
|
+
const Input = multiline ? Textarea : type === 'number' ? NumberInput : TextInput;
|
|
167
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
168
|
+
className: hideLabel ? 'xp-grid-field' : undefined,
|
|
169
|
+
title: reason ?? undefined,
|
|
170
|
+
children: [
|
|
171
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
172
|
+
id: id,
|
|
173
|
+
label: label,
|
|
174
|
+
"aria-label": label,
|
|
175
|
+
value: edit.dirty ? edit.value : preview ?? edit.value,
|
|
176
|
+
disabled: disabled && !edit.dirty,
|
|
177
|
+
readOnly: locked || test.stale || edit.saving,
|
|
178
|
+
"aria-describedby": choiceId,
|
|
179
|
+
placeholder: placeholder,
|
|
180
|
+
min: min,
|
|
181
|
+
max: max,
|
|
182
|
+
required: required,
|
|
183
|
+
help: help,
|
|
184
|
+
error: error ?? undefined,
|
|
185
|
+
onChange: (e)=>{
|
|
186
|
+
if (locked || test.stale || edit.saving) return;
|
|
187
|
+
const draft = e.target.value;
|
|
188
|
+
setError(null);
|
|
189
|
+
edit.change(draft);
|
|
190
|
+
onDraft?.(draft === String(value) || edit.conflict ? null : draft);
|
|
191
|
+
},
|
|
192
|
+
onBlur: ()=>commit(),
|
|
193
|
+
onKeyDown: (e)=>{
|
|
194
|
+
if (e.key === 'Escape' && edit.dirty && !edit.saving) {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
e.stopPropagation();
|
|
197
|
+
discard();
|
|
198
|
+
}
|
|
199
|
+
if (e.key === 'Enter' && !e.nativeEvent.isComposing && (choice || !multiline)) {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
commit();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
choiceId ? /*#__PURE__*/ _jsx(SavedValueChanged, {
|
|
206
|
+
id: choiceId,
|
|
207
|
+
value: String(value),
|
|
208
|
+
reason: reason,
|
|
209
|
+
conflict: edit.conflict,
|
|
210
|
+
announce: announcement,
|
|
211
|
+
onKeep: !locked && !test.stale && !error ? ()=>commit(true) : undefined,
|
|
212
|
+
onDiscard: discard
|
|
213
|
+
}) : null
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
export const positiveInteger = (raw)=>raw.trim() !== '' && Number.isInteger(Number(raw)) && Number(raw) > 0;
|
|
218
|
+
export function SelectEdit({ label, value, options, groups, reason, onCommit, readOnlyValue, labelAction }) {
|
|
219
|
+
const id = useId();
|
|
220
|
+
if (reason) {
|
|
221
|
+
return /*#__PURE__*/ _jsx(ReadOnly, {
|
|
222
|
+
label: label,
|
|
223
|
+
reason: reason,
|
|
224
|
+
labelAction: labelAction,
|
|
225
|
+
value: readOnlyValue ?? options.find((o)=>o.value === value)?.label ?? value
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return /*#__PURE__*/ _jsx(Select, {
|
|
229
|
+
id: id,
|
|
230
|
+
label: label,
|
|
231
|
+
labelAction: labelAction,
|
|
232
|
+
value: value,
|
|
233
|
+
onChange: (e)=>onCommit(e.target.value),
|
|
234
|
+
children: groups ? groups.map((group, index)=>group.label ? /*#__PURE__*/ _jsx("optgroup", {
|
|
235
|
+
label: group.label,
|
|
236
|
+
children: group.options.map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
237
|
+
value: option.value,
|
|
238
|
+
children: option.label
|
|
239
|
+
}, option.value))
|
|
240
|
+
}, index) : group.options.map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
241
|
+
value: option.value,
|
|
242
|
+
children: option.label
|
|
243
|
+
}, option.value))) : options.map((option)=>/*#__PURE__*/ _jsx("option", {
|
|
244
|
+
value: option.value,
|
|
245
|
+
children: option.label
|
|
246
|
+
}, option.value))
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export function CheckboxList({ label, value, options, reason, onToggle, readOnlyValue }) {
|
|
250
|
+
const id = useId();
|
|
251
|
+
if (reason) return /*#__PURE__*/ _jsx(ReadOnly, {
|
|
252
|
+
label: label,
|
|
253
|
+
reason: reason,
|
|
254
|
+
value: readOnlyValue ?? value.map((v)=>options.find((o)=>o.value === v)?.label ?? v).join(', ')
|
|
255
|
+
});
|
|
256
|
+
return /*#__PURE__*/ _jsx(UICheckboxList, {
|
|
257
|
+
id: id,
|
|
258
|
+
label: label,
|
|
259
|
+
value: value,
|
|
260
|
+
options: options,
|
|
261
|
+
onChange: (next)=>{
|
|
262
|
+
const changed = options.find((option)=>next.includes(option.value) !== value.includes(option.value));
|
|
263
|
+
if (changed) onToggle(changed.value, next.includes(changed.value));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
export function TestName({ test }) {
|
|
268
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
269
|
+
children: [
|
|
270
|
+
/*#__PURE__*/ _jsx(TextEdit, {
|
|
271
|
+
test: test,
|
|
272
|
+
label: C.name,
|
|
273
|
+
value: test.doc?.name ?? '',
|
|
274
|
+
reason: reasonFor(test, 'name'),
|
|
275
|
+
onCommit: (value)=>save(test, 'name', ()=>({
|
|
276
|
+
name: value
|
|
277
|
+
}))
|
|
278
|
+
}),
|
|
279
|
+
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
280
|
+
test: test,
|
|
281
|
+
path: "name"
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
export function Hypothesis({ test }) {
|
|
287
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
288
|
+
children: [
|
|
289
|
+
/*#__PURE__*/ _jsx(TextEdit, {
|
|
290
|
+
test: test,
|
|
291
|
+
label: C.hypothesis,
|
|
292
|
+
value: test.doc?.hypothesis ?? '',
|
|
293
|
+
multiline: true,
|
|
294
|
+
placeholder: C.hypothesisPlaceholder,
|
|
295
|
+
reason: reasonFor(test, 'hypothesis'),
|
|
296
|
+
onCommit: (value)=>save(test, 'hypothesis', ()=>({
|
|
297
|
+
hypothesis: value
|
|
298
|
+
}))
|
|
299
|
+
}),
|
|
300
|
+
/*#__PURE__*/ _jsx(FieldErrors, {
|
|
301
|
+
test: test,
|
|
302
|
+
path: "hypothesis"
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SectionId } from '../contracts.js';
|
|
2
2
|
/** Open disclosures before scrolling, then give keyboard users a meaningful landing. */
|
|
3
|
-
export declare function jumpToSection(section: SectionId): void;
|
|
3
|
+
export declare function jumpToSection(section: SectionId, arm?: string): void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/** Open disclosures before scrolling, then give keyboard users a meaningful landing. */ export function jumpToSection(section) {
|
|
1
|
+
/** Open disclosures before scrolling, then give keyboard users a meaningful landing. */ export function jumpToSection(section, arm) {
|
|
2
2
|
const target = document.getElementById(`section-${section}`);
|
|
3
3
|
if (target instanceof HTMLDetailsElement) target.open = true;
|
|
4
|
-
|
|
4
|
+
const row = arm ? document.getElementById(`xp-version-${arm}`) : null;
|
|
5
|
+
(row ?? target)?.scrollIntoView?.({
|
|
5
6
|
block: 'start'
|
|
6
7
|
});
|
|
7
|
-
document.getElementById(`title-${section}`)?.focus({
|
|
8
|
+
(row ?? document.getElementById(`title-${section}`))?.focus({
|
|
8
9
|
preventScroll: true
|
|
9
10
|
});
|
|
10
11
|
}
|