@delmaredigital/payload-experiments 0.4.0-rc.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -15
- package/dist/admin/MetricSourceSelect.js +10 -3
- package/dist/admin/armSelect/armSelect.model.d.ts +1 -1
- package/dist/admin/blocks/BlockPanel.d.ts +1 -0
- package/dist/admin/blocks/BlockPanel.js +75 -29
- package/dist/admin/blocks/model.js +7 -6
- package/dist/admin/copy/blocks.d.ts +14 -11
- package/dist/admin/copy/blocks.js +33 -22
- package/dist/admin/copy/goals.d.ts +15 -8
- package/dist/admin/copy/goals.js +18 -8
- package/dist/admin/copy/newTest.d.ts +10 -7
- package/dist/admin/copy/newTest.js +14 -7
- package/dist/admin/copy/status.d.ts +1 -1
- package/dist/admin/copy/status.js +2 -1
- package/dist/admin/pageCollections.d.ts +1 -0
- package/dist/admin/pageCollections.js +3 -0
- package/dist/admin/placementStatus.model.js +5 -3
- package/dist/admin/status.model.d.ts +1 -0
- package/dist/admin/status.model.js +2 -1
- package/dist/admin/surface/ResultsRoute.js +12 -10
- package/dist/admin/surface/SurfaceShell.d.ts +4 -2
- package/dist/admin/surface/SurfaceShell.js +28 -3
- package/dist/admin/surface/TestRowMenu.d.ts +13 -0
- package/dist/admin/surface/TestRowMenu.js +163 -0
- package/dist/admin/surface/TestsHome.d.ts +4 -3
- package/dist/admin/surface/TestsHome.js +224 -52
- package/dist/admin/surface/TestsSurface.js +2 -1
- package/dist/admin/surface/goals/DeleteGoalDialog.d.ts +7 -0
- package/dist/admin/surface/goals/DeleteGoalDialog.js +42 -0
- package/dist/admin/surface/goals/GoalForm.d.ts +1 -0
- package/dist/admin/surface/goals/GoalForm.js +280 -198
- package/dist/admin/surface/goals/GoalsList.js +102 -33
- package/dist/admin/surface/goals/data.d.ts +2 -0
- package/dist/admin/surface/goals/data.js +9 -0
- package/dist/admin/surface/goals/goals.css +3 -2
- package/dist/admin/surface/goals/goals.model.d.ts +2 -2
- package/dist/admin/surface/goals/goals.model.js +7 -12
- package/dist/admin/surface/home.model.d.ts +15 -8
- package/dist/admin/surface/home.model.js +22 -18
- package/dist/admin/surface/newTest/NewTest.d.ts +3 -3
- package/dist/admin/surface/newTest/NewTest.js +156 -96
- package/dist/admin/surface/newTest/PageWizard.d.ts +4 -1
- package/dist/admin/surface/newTest/PageWizard.js +99 -68
- package/dist/admin/surface/newTest/newTest.css +28 -11
- package/dist/admin/surface/results/ResultsHeader.d.ts +1 -1
- package/dist/admin/surface/results/ResultsHeader.js +98 -66
- package/dist/admin/surface/surface.css +29 -0
- package/dist/admin/surface/test/TestPage.js +46 -38
- package/dist/admin/surface/useXpStepNav.d.ts +11 -0
- package/dist/admin/surface/useXpStepNav.js +14 -0
- package/dist/admin/views/TestsSurfaceClient.js +27 -3
- package/dist/admin/views/buildSurfaceProps.js +18 -66
- package/dist/arms/copy.d.ts +13 -3
- package/dist/arms/copy.js +5 -4
- package/dist/blocks/createExperimentBlock.js +1 -1
- package/dist/blocks/formState.js +2 -2
- package/dist/collections/experiments/armInvariants.js +8 -5
- package/dist/collections/experiments/config.js +8 -3
- package/dist/collections/experiments/deleteGuard.js +2 -2
- package/dist/collections/experiments/lockHook.js +21 -2
- package/dist/collections/experiments/pickSlug.js +2 -0
- package/dist/collections/metrics.js +12 -5
- package/dist/collections/metricsGuards.js +2 -0
- package/dist/collections/serialize.js +8 -6
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/db/adapter.d.ts +9 -1
- package/dist/db/adapter.js +77 -1
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +2 -4
- package/dist/db/events.d.ts +9 -0
- package/dist/db/events.js +42 -8
- package/dist/db/executor.d.ts +7 -1
- package/dist/db/executor.js +7 -3
- package/dist/db/pageCopies.d.ts +5 -0
- package/dist/db/pageCopies.js +31 -0
- package/dist/db/results.d.ts +5 -1
- package/dist/db/results.js +21 -5
- package/dist/db/snapshots.d.ts +2 -0
- package/dist/endpoints/deleteImpact.js +2 -1
- package/dist/endpoints/duplicateOriginal.d.ts +38 -0
- package/dist/endpoints/duplicateOriginal.js +414 -0
- package/dist/endpoints/editorSurface.js +1 -1
- package/dist/endpoints/events.js +103 -39
- package/dist/endpoints/index.js +22 -8
- package/dist/endpoints/pages.js +245 -66
- package/dist/endpoints/placementStatus.js +8 -4
- package/dist/endpoints/results.d.ts +1 -1
- package/dist/endpoints/results.js +9 -2
- package/dist/endpoints/routeId.d.ts +2 -2
- package/dist/endpoints/routeId.js +11 -5
- package/dist/endpoints/summary.js +46 -12
- package/dist/endpoints/testVersion.d.ts +2 -0
- package/dist/endpoints/testVersion.js +38 -0
- package/dist/endpoints/transitions.js +41 -29
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +6 -0
- package/dist/events/request.d.ts +6 -2
- package/dist/events/request.js +35 -8
- package/dist/events/rows.d.ts +1 -1
- package/dist/events/rows.js +24 -8
- package/dist/events/writable.d.ts +9 -0
- package/dist/events/writable.js +13 -0
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/goals/fairness.js +2 -2
- package/dist/goals/picker/copy.js +1 -1
- package/dist/goals/sourceLabel.d.ts +2 -0
- package/dist/goals/sourceLabel.js +4 -0
- package/dist/hooks/hostHook.js +6 -2
- package/dist/hooks/pageGuard.js +4 -0
- package/dist/hooks/trackPageCopies.d.ts +11 -0
- package/dist/hooks/trackPageCopies.js +7 -0
- package/dist/labels/arms.d.ts +3 -0
- package/dist/labels/arms.js +8 -0
- package/dist/lib/fetchAllDocs.d.ts +1 -1
- package/dist/manifest/compile.js +8 -5
- package/dist/onInit.js +14 -0
- package/dist/options.d.ts +2 -0
- package/dist/options.js +23 -2
- package/dist/plugin.js +56 -2
- package/dist/proxy/pageNavigation.d.ts +4 -0
- package/dist/proxy/pageNavigation.js +28 -0
- package/dist/proxy/resolve.js +52 -25
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +7 -7
- package/dist/puck/editor/ConfigureTestDrawer.js +40 -29
- package/dist/puck/editor/ExperimentSlotEditor.d.ts +2 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +376 -139
- package/dist/puck/editor/LeftoverVersions.js +17 -32
- package/dist/puck/editor/QuickTestActions.d.ts +6 -3
- package/dist/puck/editor/QuickTestActions.js +55 -33
- package/dist/puck/editor/ResultsReadout.d.ts +4 -1
- package/dist/puck/editor/ResultsReadout.js +28 -15
- package/dist/puck/editor/VersionBuilder.d.ts +17 -4
- package/dist/puck/editor/VersionBuilder.js +175 -112
- package/dist/puck/editor/armWrites.js +2 -2
- package/dist/puck/editor/armsCache.js +1 -3
- package/dist/puck/editor/copy.d.ts +14 -7
- package/dist/puck/editor/copy.js +26 -13
- package/dist/puck/editor/editor.chrome.css +10 -8
- package/dist/puck/editor/editor.css +15 -9
- package/dist/puck/editor/editor.model.d.ts +1 -0
- package/dist/puck/editor/placementsCache.d.ts +4 -0
- package/dist/puck/editor/usePageSaveReadiness.d.ts +6 -0
- package/dist/puck/editor/usePageSaveReadiness.js +31 -0
- package/dist/puck/nestedTestCopy.js +2 -2
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +1 -1
- package/dist/results/aggregate.d.ts +6 -3
- package/dist/results/aggregate.js +9 -9
- package/dist/results/analyse.d.ts +2 -0
- package/dist/results/analyse.js +2 -2
- package/dist/results/health.d.ts +8 -0
- package/dist/results/health.js +28 -0
- package/dist/results/identityCredit.d.ts +1 -0
- package/dist/results/identityCredit.js +4 -1
- package/dist/results/verdict.d.ts +4 -4
- package/dist/results/verdict.js +15 -11
- package/dist/runtime/cookie.d.ts +10 -2
- package/dist/runtime/cookie.js +38 -6
- package/dist/runtime/cookieOptions.d.ts +6 -0
- package/dist/runtime/cookieOptions.js +14 -0
- package/dist/runtime/proxyRuntime.d.ts +1 -0
- package/dist/runtime/proxyRuntime.js +18 -8
- package/dist/runtime/signing.d.ts +1 -0
- package/dist/runtime/signing.js +5 -0
- package/dist/sanitizeReadinessDetail.d.ts +2 -2
- package/dist/sanitizeReadinessDetail.js +20 -2
- package/dist/server/getAssignments.js +11 -10
- package/dist/server/recordContentChange.d.ts +1 -1
- package/dist/server/recordContentChange.js +11 -2
- package/dist/server/resolveExperimentBlocks.js +2 -4
- package/dist/server/resolveExperimentData.js +2 -5
- package/dist/server/runResults.js +54 -15
- package/dist/server/startExperiment.d.ts +20 -0
- package/dist/server/startExperiment.js +70 -0
- package/dist/server/trackConversion.js +10 -13
- package/dist/testSurface/PreviewLinks.d.ts +2 -1
- package/dist/testSurface/PreviewLinks.js +3 -3
- package/dist/testSurface/actions/DecideDialog.d.ts +10 -4
- package/dist/testSurface/actions/DecideDialog.js +93 -63
- package/dist/testSurface/actions/LifecycleAction.d.ts +17 -0
- package/dist/testSurface/actions/LifecycleAction.js +107 -0
- package/dist/testSurface/actions/MakeContentResult.d.ts +4 -3
- package/dist/testSurface/actions/MakeContentResult.js +10 -2
- package/dist/testSurface/actions/actions.model.d.ts +13 -5
- package/dist/testSurface/actions/actions.model.js +75 -22
- package/dist/testSurface/actions/decide.model.d.ts +1 -0
- package/dist/testSurface/actions/decide.model.js +1 -0
- package/dist/testSurface/allocation.model.js +6 -3
- package/dist/testSurface/api.d.ts +9 -6
- package/dist/testSurface/api.js +43 -23
- package/dist/testSurface/copy/actions.d.ts +37 -14
- package/dist/testSurface/copy/actions.js +40 -17
- package/dist/testSurface/copy/advanced.d.ts +10 -0
- package/dist/testSurface/copy/advanced.js +10 -0
- package/dist/testSurface/copy/arms.d.ts +1 -1
- package/dist/testSurface/copy/arms.js +1 -1
- package/dist/testSurface/copy/audience.d.ts +4 -3
- package/dist/testSurface/copy/audience.js +5 -4
- package/dist/testSurface/copy/common.d.ts +8 -6
- package/dist/testSurface/copy/common.js +8 -6
- package/dist/testSurface/copy/languages.d.ts +1 -0
- package/dist/testSurface/copy/languages.js +1 -0
- package/dist/testSurface/copy/metrics.d.ts +7 -0
- package/dist/testSurface/copy/metrics.js +9 -0
- package/dist/testSurface/copy/pages.d.ts +67 -7
- package/dist/testSurface/copy/pages.js +74 -7
- package/dist/testSurface/copy/readiness.d.ts +20 -7
- package/dist/testSurface/copy/readiness.js +36 -10
- package/dist/testSurface/copy/recommendation.d.ts +1 -22
- package/dist/testSurface/copy/recommendation.js +2 -22
- package/dist/testSurface/copy/results.d.ts +21 -12
- package/dist/testSurface/copy/results.js +24 -13
- package/dist/testSurface/copy/review.d.ts +13 -10
- package/dist/testSurface/copy/review.js +14 -10
- package/dist/testSurface/copy/setting.d.ts +1 -2
- package/dist/testSurface/copy/setting.js +1 -2
- package/dist/testSurface/copy/surface.d.ts +11 -2
- package/dist/testSurface/copy/surface.js +14 -11
- package/dist/testSurface/copy/testPage.d.ts +36 -12
- package/dist/testSurface/copy/testPage.js +53 -16
- package/dist/testSurface/format/date.d.ts +5 -2
- package/dist/testSurface/format/date.js +24 -8
- package/dist/testSurface/format/roundProgress.d.ts +6 -0
- package/dist/testSurface/format/roundProgress.js +15 -0
- package/dist/testSurface/format/useDateFormatter.d.ts +3 -0
- package/dist/testSurface/format/useDateFormatter.js +8 -0
- package/dist/testSurface/labels.d.ts +1 -2
- package/dist/testSurface/labels.js +2 -3
- package/dist/testSurface/lockedNotice.model.d.ts +2 -0
- package/dist/testSurface/lockedNotice.model.js +31 -0
- package/dist/testSurface/readPreflight.d.ts +4 -0
- package/dist/testSurface/readPreflight.js +6 -0
- package/dist/testSurface/readinessRead.d.ts +3 -0
- package/dist/testSurface/readinessRead.js +4 -0
- package/dist/testSurface/results/CiChart.js +2 -1
- package/dist/testSurface/results/DataTable.d.ts +1 -1
- package/dist/testSurface/results/DataTable.js +4 -3
- package/dist/testSurface/results/VerdictHero.d.ts +3 -2
- package/dist/testSurface/results/VerdictHero.js +5 -1
- package/dist/testSurface/results/legacy.d.ts +0 -5
- package/dist/testSurface/results/legacy.js +0 -14
- package/dist/testSurface/results/results.css +2 -2
- package/dist/testSurface/results/results.model.d.ts +9 -4
- package/dist/testSurface/results/results.model.js +31 -23
- package/dist/testSurface/results/snapshot.d.ts +2 -0
- package/dist/testSurface/results/snapshot.js +3 -0
- package/dist/testSurface/surface/contracts.d.ts +13 -1
- package/dist/testSurface/surface/editorPlacement.d.ts +3 -3
- package/dist/testSurface/surface/editorPlacement.js +2 -2
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +3 -3
- package/dist/testSurface/surface/pageBlock/parts.js +25 -12
- package/dist/testSurface/surface/pagePicker/CopyRoute.d.ts +8 -1
- package/dist/testSurface/surface/pagePicker/CopyRoute.js +243 -22
- package/dist/testSurface/surface/pagePicker/PageCombobox.d.ts +15 -4
- package/dist/testSurface/surface/pagePicker/PageCombobox.js +300 -197
- package/dist/testSurface/surface/pagePicker/pagePicker.css +73 -10
- package/dist/testSurface/surface/pagePicker/pagePicker.model.d.ts +5 -3
- package/dist/testSurface/surface/pagePicker/pagePicker.model.js +17 -2
- package/dist/testSurface/surface/readiness/ActionDialogs.d.ts +9 -5
- package/dist/testSurface/surface/readiness/ActionDialogs.js +241 -230
- package/dist/testSurface/surface/readiness/Banner.d.ts +5 -1
- package/dist/testSurface/surface/readiness/Banner.js +113 -141
- package/dist/testSurface/surface/readiness/SaveStatus.d.ts +8 -4
- package/dist/testSurface/surface/readiness/SaveStatus.js +23 -22
- package/dist/testSurface/surface/readiness/readiness.model.d.ts +20 -6
- package/dist/testSurface/surface/readiness/readiness.model.js +168 -21
- package/dist/testSurface/surface/readiness/useTransition.d.ts +6 -4
- package/dist/testSurface/surface/readiness/useTransition.js +57 -14
- package/dist/testSurface/surface/results/ReleasePages.d.ts +6 -3
- package/dist/testSurface/surface/results/ReleasePages.js +42 -41
- package/dist/testSurface/surface/results/ResultsBody.d.ts +11 -4
- package/dist/testSurface/surface/results/ResultsBody.js +221 -118
- package/dist/testSurface/surface/results/recommendation.model.d.ts +6 -9
- package/dist/testSurface/surface/results/recommendation.model.js +15 -59
- package/dist/testSurface/surface/results/useResults.d.ts +13 -8
- package/dist/testSurface/surface/results/useResults.js +3 -2
- package/dist/testSurface/surface/setting/parts.js +89 -46
- package/dist/testSurface/surface/setting/setting.css +2 -1
- package/dist/testSurface/surface/test/AdvancedSection.js +11 -4
- package/dist/testSurface/surface/test/DeleteTest.d.ts +10 -2
- package/dist/testSurface/surface/test/DeleteTest.js +173 -74
- package/dist/testSurface/surface/test/GoalSection.js +18 -14
- package/dist/testSurface/surface/test/LengthSection.js +24 -13
- package/dist/testSurface/surface/test/PageHoldout.d.ts +1 -1
- package/dist/testSurface/surface/test/PageHoldout.js +11 -8
- package/dist/testSurface/surface/test/ReadinessBar.d.ts +2 -1
- package/dist/testSurface/surface/test/ReadinessBar.js +4 -10
- package/dist/testSurface/surface/test/Section.js +8 -0
- package/dist/testSurface/surface/test/TargetingSection.js +82 -12
- package/dist/testSurface/surface/test/TestSurface.js +73 -37
- package/dist/testSurface/surface/test/VersionsSection.js +141 -91
- package/dist/testSurface/surface/test/fields.d.ts +32 -6
- package/dist/testSurface/surface/test/fields.js +166 -52
- package/dist/testSurface/surface/test/pageParts.js +27 -12
- package/dist/testSurface/surface/test/testPage.css +9 -2
- package/dist/testSurface/surface/test/testPage.model.d.ts +1 -0
- package/dist/testSurface/surface/test/testPage.model.js +6 -0
- package/dist/testSurface/surface/testDocument.model.d.ts +3 -0
- package/dist/testSurface/surface/testDocument.model.js +4 -1
- package/dist/testSurface/surface/useTestDocument.d.ts +21 -5
- package/dist/testSurface/surface/useTestDocument.js +472 -167
- package/dist/testSurface/surface/watchTestDocument.d.ts +15 -0
- package/dist/testSurface/surface/watchTestDocument.js +181 -0
- package/dist/testSurface/surfaceUrls.d.ts +1 -0
- package/dist/testSurface/surfaceUrls.js +4 -0
- package/dist/testSurface/useApi.d.ts +8 -5
- package/dist/testSurface/useOnTestReturn.d.ts +2 -0
- package/dist/testSurface/useOnTestReturn.js +27 -0
- package/dist/testSurface/useReadinessPolling.js +3 -1
- package/dist/transitions/addMetric.d.ts +2 -5
- package/dist/transitions/addMetric.js +5 -1
- package/dist/transitions/allocate.d.ts +2 -2
- package/dist/transitions/allocate.js +3 -1
- package/dist/transitions/archive.d.ts +1 -1
- package/dist/transitions/archive.js +3 -2
- package/dist/transitions/checkStart.d.ts +1 -0
- package/dist/transitions/checkStart.js +17 -6
- package/dist/transitions/decide.d.ts +1 -1
- package/dist/transitions/decide.js +5 -3
- package/dist/transitions/deleteExperiment.d.ts +2 -2
- package/dist/transitions/deleteExperiment.js +17 -7
- package/dist/transitions/kernel.d.ts +4 -0
- package/dist/transitions/kernel.js +9 -4
- package/dist/transitions/makeContent.d.ts +2 -1
- package/dist/transitions/makeContent.js +12 -8
- package/dist/transitions/nestedPlacementNames.d.ts +2 -2
- package/dist/transitions/nestedPlacementNames.js +4 -5
- package/dist/transitions/pageAddress.d.ts +6 -0
- package/dist/transitions/pageAddress.js +71 -0
- package/dist/transitions/pageVersions.d.ts +1 -1
- package/dist/transitions/phaseRecord.d.ts +2 -0
- package/dist/transitions/phaseRecord.js +5 -0
- package/dist/transitions/placementInteractions.d.ts +3 -3
- package/dist/transitions/placementInteractions.js +8 -7
- package/dist/transitions/placements.d.ts +2 -0
- package/dist/transitions/placements.js +5 -5
- package/dist/transitions/preflightData.d.ts +3 -2
- package/dist/transitions/preflightData.js +77 -43
- package/dist/transitions/releaseHoldout.d.ts +2 -1
- package/dist/transitions/releaseHoldout.js +3 -1
- package/dist/transitions/releasePages.d.ts +2 -1
- package/dist/transitions/releasePages.js +3 -1
- package/dist/transitions/resolveCaps.d.ts +2 -4
- package/dist/transitions/start.d.ts +7 -9
- package/dist/transitions/start.js +75 -39
- package/dist/transitions/startReads.d.ts +7 -0
- package/dist/transitions/startReads.js +28 -0
- package/dist/transitions/stop.d.ts +2 -1
- package/dist/transitions/stop.js +3 -2
- package/dist/types/armKey.d.ts +2 -0
- package/dist/types/armKey.js +1 -0
- package/dist/types/contracts.d.ts +17 -4
- package/dist/types/endpoints.d.ts +89 -17
- package/dist/types/endpoints.js +1 -1
- package/dist/types/runtime.d.ts +15 -9
- package/dist/types/snapshot.d.ts +2 -0
- package/dist/types/surface.d.ts +7 -9
- package/dist/ui/ChipsInput.d.ts +8 -1
- package/dist/ui/ChipsInput.js +17 -4
- package/dist/ui/Dialog.d.ts +21 -2
- package/dist/ui/Dialog.js +101 -4
- package/dist/ui/Inputs.js +0 -1
- package/dist/ui/ui.css +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A/B testing for Payload CMS and Next.js, from the content you already manage. Test a block on a page, a whole page against another page, or a setting your developer makes testable. Pick a goal, including click goals you name and attach to buttons and links, then compare the Original with your new versions. Results appear in the admin: they count only people who actually saw the content, warn when traffic looks wrong, and check guardrail goals (goals you don't want to hurt). You pick a winner and can make it permanent. Your data stays in your own Postgres database. There is no vendor.
|
|
4
4
|
|
|
5
|
-
> ⚠️ Upgrading to 0.4? Run `payload migrate:create` for four nullable plugin columns (`xp_experiments.page_collection` and its `_xp_experiments_v` counterpart, `xp_phases.placement_docs`, `xp_state.retired_slugs`), plus the Experiment block and `xpGoal` columns if you adopt them, then `payload generate:importmap`. Saves on pages, blocks and Puck collections can now be refused while a test runs on them (`page-busy`, `interacting-tests`); Puck tests whose slot is only on a draft can't start until the page is published; host `metricSources` ids may not start with `click:`; `admin.editorUrl` now receives a required `editor` argument. See the [CHANGELOG's BREAKING section](https://github.com/delmaredigital/payload-experiments/blob/main/CHANGELOG.md).
|
|
6
|
-
|
|
7
5
|
## Install
|
|
8
6
|
|
|
9
7
|
```bash
|
|
@@ -12,7 +10,7 @@ pnpm add @delmaredigital/payload-experiments
|
|
|
12
10
|
|
|
13
11
|
### Requirements
|
|
14
12
|
|
|
15
|
-
Use Node.js `>=22.23.4`, the Next.js App Router, and Postgres through `@payloadcms/db-postgres` with transactions enabled. Puck is optional. Install the peers your application uses:
|
|
13
|
+
Use Node.js `>=22.23.4`, the Next.js App Router, and Postgres through `@payloadcms/db-postgres` with transactions enabled and `READ COMMITTED` (or its PostgreSQL equivalent, `READ UNCOMMITTED`) as the default isolation level. Puck is optional. Install the peers your application uses:
|
|
16
14
|
|
|
17
15
|
| Peer | Version |
|
|
18
16
|
| --- | --- |
|
|
@@ -28,23 +26,20 @@ These examples use your existing Payload app and Pages collection. Imports start
|
|
|
28
26
|
|
|
29
27
|
### 1. Set a secret and create the runtimes
|
|
30
28
|
|
|
31
|
-
Set a private `XP_SECRET` in your server environment.
|
|
29
|
+
Set a private `XP_SECRET` of at least 32 characters in your server environment. Use the shared Postgres pool from the [rate limiter example](https://plugins.delmaredigital.com/docs/experiments/installation#rate-limit-browser-traffic).
|
|
32
30
|
|
|
33
31
|
```ts
|
|
34
32
|
// src/experiments/proxyRuntime.ts
|
|
35
|
-
import { Pool } from 'pg'
|
|
36
33
|
import {
|
|
37
34
|
defineExperimentsProxyRuntime,
|
|
38
35
|
createPostgresManifestLoader,
|
|
39
36
|
} from '@delmaredigital/payload-experiments/runtime/proxy'
|
|
37
|
+
import { allowNewVisitor, pool } from '@/experiments/rateLimit'
|
|
40
38
|
|
|
41
|
-
const pool = new Pool({
|
|
42
|
-
connectionString: process.env.DATABASE_URI,
|
|
43
|
-
connectionTimeoutMillis: 5_000,
|
|
44
|
-
})
|
|
45
39
|
export const proxyRuntime = defineExperimentsProxyRuntime({
|
|
46
40
|
secret: process.env.XP_SECRET!,
|
|
47
41
|
apiRoute: '/api', // match Payload's routes.api
|
|
42
|
+
rateLimitUnit: allowNewVisitor,
|
|
48
43
|
loadManifest: createPostgresManifestLoader({ pool }),
|
|
49
44
|
})
|
|
50
45
|
```
|
|
@@ -74,17 +69,16 @@ Add this to your existing `payload.config.ts` plugins array. Your permission che
|
|
|
74
69
|
import { createExperimentsPlugin } from '@delmaredigital/payload-experiments'
|
|
75
70
|
import { serverRuntime } from '@/experiments/serverRuntime'
|
|
76
71
|
import { canManageTests } from '@/access/tests'
|
|
77
|
-
import {
|
|
72
|
+
import { allowExperimentEvents } from '@/experiments/rateLimit'
|
|
78
73
|
|
|
79
74
|
createExperimentsPlugin({
|
|
80
75
|
runtime: serverRuntime,
|
|
81
76
|
access: { manage: canManageTests },
|
|
82
|
-
events: { rateLimit:
|
|
77
|
+
events: { rateLimit: allowExperimentEvents },
|
|
83
78
|
})
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
`{ req, unitId }` and returns `true` to permit or `false` to drop a request.
|
|
81
|
+
Use shared rate limiters keyed by a trusted client address. `events.rateLimit` receives `{ req, unitId }`, with `unitId` available as context only. `rateLimitUnit` receives the `NextRequest` before a new visitor cookie is issued. Each adapter returns `true` to allow the operation. Set either option to `false` only when a firewall or equivalent upstream control limits the corresponding events or page requests, since doing so disables the plugin's rate limit for that traffic. Serve the browser events route on the same origin as your pages and set `events.origin` or Payload's `serverURL` to that public origin. See the [shared rate limiter example](https://plugins.delmaredigital.com/docs/experiments/installation#rate-limit-browser-traffic).
|
|
88
82
|
Keep identifying attributes out of `events.dimensions`. Use the proxy runtime's `cookie.consent` to enrol only after consent (`ExperimentsProxyRuntimeOptions`); `eraseUser(payload, { userId })` from `/rsc` handles privacy erasure (typed by that exported function).
|
|
89
83
|
|
|
90
84
|
### 3. Run migrations and generate the import map
|
|
@@ -161,13 +155,13 @@ full prefetch of pages that count content on server render is unsupported.
|
|
|
161
155
|
|
|
162
156
|
## Running a test
|
|
163
157
|
|
|
164
|
-
1. Start from the content: add
|
|
158
|
+
1. Start from the content: add a **Test block** (in Puck's **A/B tests** category),
|
|
165
159
|
or open **Tests** in the admin to test whole pages or a registered setting.
|
|
166
160
|
2. Keep the **Original**, use **Copy Original here** in Puck to make a version,
|
|
167
161
|
and make your changes. For whole pages, use Payload's **Duplicate** action, give the
|
|
168
162
|
copy its own address, publish it, then choose it as a version in the test.
|
|
169
163
|
3. Pick a **goal**: a signup, purchase, or a named click goal on a button or
|
|
170
|
-
link.
|
|
164
|
+
link. Mark goals you don't want to hurt as **Must not get worse**.
|
|
171
165
|
4. Save, follow the setup checks, preview each version ([wire preview links](#preview-and-editor-links)), and **Start**. The
|
|
172
166
|
results explain whether to keep running or choose a winner.
|
|
173
167
|
5. Use **Decide** to pick the winner, then **Make it the content** to make it permanent.
|
|
@@ -3,12 +3,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { SelectInput, useField } from '@payloadcms/ui';
|
|
4
4
|
import { metricSourceHint, metricSourceOptions, sourceFor } from '../testSurface/metricSource.model.js';
|
|
5
5
|
import { METRICS_COPY } from '../testSurface/copy/metrics.js';
|
|
6
|
+
import { goalSourceLabel } from '../goals/sourceLabel.js';
|
|
6
7
|
export function MetricSourceSelect({ path, field, readOnly }) {
|
|
7
8
|
const { value, setValue } = useField({
|
|
8
9
|
path
|
|
9
10
|
});
|
|
10
11
|
const sources = field.admin?.custom?.sources ?? [];
|
|
11
|
-
const
|
|
12
|
+
const source = sourceFor(value, sources);
|
|
13
|
+
const hint = metricSourceHint(source);
|
|
14
|
+
const options = metricSourceOptions(sources);
|
|
15
|
+
if (value && !source) options.push({
|
|
16
|
+
value,
|
|
17
|
+
label: goalSourceLabel(value)
|
|
18
|
+
});
|
|
12
19
|
const locked = Boolean(readOnly || field.admin?.readOnly);
|
|
13
20
|
return /*#__PURE__*/ _jsxs("div", {
|
|
14
21
|
children: [
|
|
@@ -18,8 +25,8 @@ export function MetricSourceSelect({ path, field, readOnly }) {
|
|
|
18
25
|
label: field.label ?? METRICS_COPY.source,
|
|
19
26
|
description: field.admin?.description,
|
|
20
27
|
required: field.required,
|
|
21
|
-
options:
|
|
22
|
-
value:
|
|
28
|
+
options: options,
|
|
29
|
+
value: source?.id ?? value ?? '',
|
|
23
30
|
readOnly: locked,
|
|
24
31
|
onChange: (option)=>{
|
|
25
32
|
if (!locked) setValue(option && !Array.isArray(option) ? option.value : null);
|
|
@@ -23,7 +23,7 @@ export declare function bindArmSelect({ live, candidates, stored }: {
|
|
|
23
23
|
pickable: boolean;
|
|
24
24
|
options: {
|
|
25
25
|
label: string;
|
|
26
|
-
value: import("../../types/
|
|
26
|
+
value: import("../../types/armKey.js").ArmKey;
|
|
27
27
|
}[];
|
|
28
28
|
stale: string | null;
|
|
29
29
|
banner: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UIFieldClientProps } from 'payload';
|
|
2
|
+
import '../theme.css';
|
|
2
3
|
export declare function BlockStatusField({ path }: UIFieldClientProps): import("react").JSX.Element | null;
|
|
3
4
|
export declare function BlockSlotRowLabel(): import("react").JSX.Element;
|
|
4
5
|
export declare function CopyOriginalField({ path }: UIFieldClientProps): import("react").JSX.Element | null;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Banner, Button,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Banner, Button, toast, useFormInitializing, useRowLabel } from '@payloadcms/ui';
|
|
4
4
|
import { formatAdminURL } from 'payload/shared';
|
|
5
|
-
import { useEffect,
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { ConfirmDialog } from '../../ui/Dialog.js';
|
|
7
|
+
import { actionTitle } from '../../testSurface/copy/actions.js';
|
|
8
|
+
import { READINESS_COPY } from '../../testSurface/copy/readiness.js';
|
|
9
|
+
import '../theme.css';
|
|
6
10
|
import { copyOriginalIntoVersion, syncExperimentSlots, unwrapExperimentBlock } from '../../blocks/formState.js';
|
|
7
11
|
import { BLOCK_COPY, blockSyncNotice, blockUnwrapNotice, blockDeleteConfirmation, blockUnwrapConfirmation, blockRunningUnwrap, blockDecidedUnwrap, blockFinishedCopy } from '../../admin/copy/blocks.js';
|
|
8
12
|
import { API_MESSAGES } from '../../testSurface/copy/common.js';
|
|
@@ -11,6 +15,7 @@ import { createApi } from '../../testSurface/api.js';
|
|
|
11
15
|
import { useBlockStatus, setBlockStatus } from './statusCache.js';
|
|
12
16
|
import { useBlockForm } from './useBlockForm.js';
|
|
13
17
|
import { BlockChangedError, RefusalError } from './formApi.js';
|
|
18
|
+
import { notifyTestDocument } from '../../testSurface/surface/watchTestDocument.js';
|
|
14
19
|
function errorMessage(error) {
|
|
15
20
|
return error instanceof BlockChangedError || error instanceof RefusalError ? error.message : API_MESSAGES.failed;
|
|
16
21
|
}
|
|
@@ -21,8 +26,7 @@ export function BlockStatusField({ path }) {
|
|
|
21
26
|
const synced = useRef(false), syncing = useRef(false);
|
|
22
27
|
const [notice, setNotice] = useState(false), [error, setError] = useState(), [busy, setBusy] = useState(false);
|
|
23
28
|
const [syncError, setSyncError] = useState();
|
|
24
|
-
const
|
|
25
|
-
const modalSlug = `xp-unwrap-${useId()}`;
|
|
29
|
+
const [confirmation, setConfirmation] = useState();
|
|
26
30
|
const canSync = !initializing && manager && block && field && liveStatus(status) && [
|
|
27
31
|
'draft',
|
|
28
32
|
'stopped'
|
|
@@ -55,13 +59,13 @@ export function BlockStatusField({ path }) {
|
|
|
55
59
|
if (!status || !manager) return null;
|
|
56
60
|
const draft = liveStatus(status) && status.status === 'draft';
|
|
57
61
|
const stopped = liveStatus(status) && status.status === 'stopped';
|
|
58
|
-
async function unwrap() {
|
|
62
|
+
async function unwrap(deleteDraft = false) {
|
|
59
63
|
if (!block || !field || busy) return;
|
|
60
64
|
setBusy(true);
|
|
61
65
|
setError(undefined);
|
|
62
66
|
let deleted = false;
|
|
63
67
|
try {
|
|
64
|
-
if (
|
|
68
|
+
if (deleteDraft) {
|
|
65
69
|
const api = createApi(config.routes.api);
|
|
66
70
|
const found = await api.findTestIdBySlug(block.experiment);
|
|
67
71
|
if (!found.ok) throw new RefusalError(found.message);
|
|
@@ -70,11 +74,13 @@ export function BlockStatusField({ path }) {
|
|
|
70
74
|
});
|
|
71
75
|
if (!removed.ok) throw new RefusalError(removed.message);
|
|
72
76
|
deleted = true;
|
|
77
|
+
notifyTestDocument(config.routes.api, found.data);
|
|
73
78
|
setBlockStatus(config.routes.api, block.experiment, {
|
|
74
79
|
deleted: true
|
|
75
80
|
});
|
|
76
81
|
}
|
|
77
82
|
await replace(unwrapExperimentBlock(block, field));
|
|
83
|
+
setConfirmation(undefined);
|
|
78
84
|
toast.success(blockUnwrapNotice(Boolean(collection?.versions?.drafts), deleted));
|
|
79
85
|
} catch (error) {
|
|
80
86
|
setError(deleted ? BLOCK_COPY.finishUnwrap : errorMessage(error));
|
|
@@ -83,7 +89,8 @@ export function BlockStatusField({ path }) {
|
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
const sentence = statusSentence(status);
|
|
86
|
-
const
|
|
92
|
+
const controlLabel = slotLabel('control', status);
|
|
93
|
+
const linkedCopy = liveStatus(status) ? status.status === 'running' ? blockRunningUnwrap : status.status === 'decided' ? blockDecidedUnwrap : status.status === 'archived' && status.winnerArm && !status.discarded ? blockFinishedCopy(slotLabel(status.winnerArm, status), status.winnerArm === 'control', status.winnerArm !== 'control' && canUnwrapOriginal(status, block), controlLabel) : undefined : undefined;
|
|
87
94
|
const href = formatAdminURL({
|
|
88
95
|
adminRoute: config.routes.admin,
|
|
89
96
|
path: `/experiments/by-slug/${encodeURIComponent(block?.experiment ?? '')}`
|
|
@@ -105,24 +112,52 @@ export function BlockStatusField({ path }) {
|
|
|
105
112
|
linkedCopy.after
|
|
106
113
|
]
|
|
107
114
|
}) : null,
|
|
115
|
+
linkedCopy && liveStatus(status) && status.status === 'archived' && !canUnwrapOriginal(status, block) ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ _jsx("p", {
|
|
118
|
+
children: BLOCK_COPY.archivedReplaceWhy
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ _jsx("ol", {
|
|
121
|
+
children: BLOCK_COPY.archivedReplaceSteps.map((step)=>/*#__PURE__*/ _jsx("li", {
|
|
122
|
+
children: step
|
|
123
|
+
}, step))
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}) : null,
|
|
108
127
|
notice ? /*#__PURE__*/ _jsx("p", {
|
|
109
128
|
role: "status",
|
|
110
129
|
children: blockSyncNotice(Boolean(collection?.versions?.drafts))
|
|
111
130
|
}) : null,
|
|
112
131
|
canUnwrapOriginal(status, block) || draft || stopped ? /*#__PURE__*/ _jsx(Button, {
|
|
113
132
|
disabled: busy,
|
|
114
|
-
onClick: ()=>
|
|
133
|
+
onClick: (event)=>{
|
|
134
|
+
if (draft || stopped) {
|
|
135
|
+
event?.currentTarget?.focus();
|
|
136
|
+
setError(undefined);
|
|
137
|
+
setConfirmation({
|
|
138
|
+
name: status.name,
|
|
139
|
+
draft
|
|
140
|
+
});
|
|
141
|
+
} else void unwrap();
|
|
142
|
+
},
|
|
115
143
|
children: draft ? BLOCK_COPY.removeAndUnwrap : BLOCK_COPY.unwrap
|
|
116
144
|
}) : null,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
body: draft ? blockDeleteConfirmation(status.name) : blockUnwrapConfirmation(status.name),
|
|
121
|
-
confirmLabel: draft ? BLOCK_COPY.deleteAndUnwrap : BLOCK_COPY.unwrap,
|
|
145
|
+
confirmation ? /*#__PURE__*/ _jsx(ConfirmDialog, {
|
|
146
|
+
title: actionTitle(confirmation.draft ? BLOCK_COPY.deleteAndUnwrap : BLOCK_COPY.unwrap, confirmation.name),
|
|
147
|
+
description: confirmation.draft ? blockDeleteConfirmation(confirmation.name, controlLabel) : blockUnwrapConfirmation(confirmation.name, controlLabel),
|
|
122
148
|
cancelLabel: BLOCK_COPY.cancel,
|
|
123
|
-
|
|
149
|
+
onClose: ()=>setConfirmation(undefined),
|
|
150
|
+
busy: busy,
|
|
151
|
+
busyLabel: READINESS_COPY.changing,
|
|
152
|
+
error: error,
|
|
153
|
+
confirm: {
|
|
154
|
+
label: confirmation.draft ? BLOCK_COPY.deleteAndUnwrap : BLOCK_COPY.unwrap,
|
|
155
|
+
destructive: true,
|
|
156
|
+
disabled: confirmation.draft ? !draft : !stopped,
|
|
157
|
+
onClick: ()=>unwrap(confirmation.draft)
|
|
158
|
+
}
|
|
124
159
|
}) : null,
|
|
125
|
-
error ? /*#__PURE__*/ _jsx("p", {
|
|
160
|
+
error && !confirmation ? /*#__PURE__*/ _jsx("p", {
|
|
126
161
|
role: "alert",
|
|
127
162
|
children: error
|
|
128
163
|
}) : null,
|
|
@@ -152,8 +187,7 @@ export function CopyOriginalField({ path }) {
|
|
|
152
187
|
const rowPath = path.slice(0, path.lastIndexOf('.'));
|
|
153
188
|
const slot = form.getDataByPath(`${rowPath}.slot`);
|
|
154
189
|
const [busy, setBusy] = useState(false), [error, setError] = useState();
|
|
155
|
-
const
|
|
156
|
-
const modalSlug = `xp-copy-original-${useId()}`;
|
|
190
|
+
const [confirming, setConfirming] = useState(false);
|
|
157
191
|
if (!manager || !field || !block || !slot || slot === 'control' || !liveStatus(status) || ![
|
|
158
192
|
'draft',
|
|
159
193
|
'stopped',
|
|
@@ -167,32 +201,44 @@ export function CopyOriginalField({ path }) {
|
|
|
167
201
|
await replace([
|
|
168
202
|
copyOriginalIntoVersion(block, slot, field)
|
|
169
203
|
]);
|
|
204
|
+
setConfirming(false);
|
|
170
205
|
} catch (error) {
|
|
171
206
|
setError(errorMessage(error));
|
|
172
207
|
} finally{
|
|
173
208
|
setBusy(false);
|
|
174
209
|
}
|
|
175
210
|
}
|
|
176
|
-
function requestCopy() {
|
|
177
|
-
if (block?.slots.find((row)=>row.slot === slot)?.blocks?.length)
|
|
178
|
-
|
|
211
|
+
function requestCopy(event) {
|
|
212
|
+
if (block?.slots.find((row)=>row.slot === slot)?.blocks?.length) {
|
|
213
|
+
event?.currentTarget?.focus();
|
|
214
|
+
setError(undefined);
|
|
215
|
+
setConfirming(true);
|
|
216
|
+
} else void copy();
|
|
179
217
|
}
|
|
218
|
+
const controlLabel = slotLabel('control', status);
|
|
180
219
|
return /*#__PURE__*/ _jsxs("div", {
|
|
181
220
|
children: [
|
|
182
221
|
/*#__PURE__*/ _jsx(Button, {
|
|
183
222
|
disabled: busy,
|
|
184
223
|
onClick: requestCopy,
|
|
185
|
-
children: BLOCK_COPY.copy
|
|
224
|
+
children: BLOCK_COPY.copy(controlLabel)
|
|
186
225
|
}),
|
|
187
|
-
/*#__PURE__*/ _jsx(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
confirmLabel: BLOCK_COPY.replace,
|
|
226
|
+
/*#__PURE__*/ _jsx(ConfirmDialog, {
|
|
227
|
+
open: confirming,
|
|
228
|
+
title: actionTitle(BLOCK_COPY.replaceVersion, status.name),
|
|
229
|
+
description: BLOCK_COPY.confirmCopy(controlLabel),
|
|
192
230
|
cancelLabel: BLOCK_COPY.cancel,
|
|
193
|
-
|
|
231
|
+
onClose: ()=>setConfirming(false),
|
|
232
|
+
busy: busy,
|
|
233
|
+
busyLabel: READINESS_COPY.changing,
|
|
234
|
+
error: error,
|
|
235
|
+
confirm: {
|
|
236
|
+
label: BLOCK_COPY.replace,
|
|
237
|
+
destructive: true,
|
|
238
|
+
onClick: copy
|
|
239
|
+
}
|
|
194
240
|
}),
|
|
195
|
-
error ? /*#__PURE__*/ _jsx("p", {
|
|
241
|
+
error && !confirming ? /*#__PURE__*/ _jsx("p", {
|
|
196
242
|
role: "alert",
|
|
197
243
|
children: error
|
|
198
244
|
}) : null
|
|
@@ -4,30 +4,31 @@ export function liveStatus(status) {
|
|
|
4
4
|
return !!status && 'status' in status;
|
|
5
5
|
}
|
|
6
6
|
export function slotLabel(slot, status) {
|
|
7
|
-
return (liveStatus(status) ? status.arms.find((arm)=>arm.key !== 'holdout' &&
|
|
7
|
+
return (liveStatus(status) ? status.arms.find((arm)=>arm.key !== 'holdout' && arm.key === slot)?.label : undefined) || BLOCK_COPY.slotLabels[slot] || slot;
|
|
8
8
|
}
|
|
9
9
|
export function statusSentence(status) {
|
|
10
10
|
if (!liveStatus(status)) return BLOCK_COPY.deleted;
|
|
11
|
+
const controlLabel = slotLabel('control', status);
|
|
11
12
|
const winner = status.arms.find((arm)=>arm.key === status.winnerArm);
|
|
12
13
|
const winnerLabel = winner?.label || BLOCK_COPY.slotLabels[status.winnerArm ?? 'control'] || status.winnerArm || BLOCK_COPY.slotLabels.control;
|
|
13
14
|
switch(status.status){
|
|
14
15
|
case 'draft':
|
|
15
|
-
return blockDraftStatus(status.name);
|
|
16
|
+
return blockDraftStatus(status.name, controlLabel);
|
|
16
17
|
case 'running':
|
|
17
18
|
return BLOCK_COPY.running;
|
|
18
19
|
case 'stopped':
|
|
19
|
-
return BLOCK_COPY.stopped;
|
|
20
|
+
return BLOCK_COPY.stopped(controlLabel);
|
|
20
21
|
case 'decided':
|
|
21
|
-
return blockDecidedStatus(winnerLabel, status.rollout);
|
|
22
|
+
return blockDecidedStatus(winnerLabel, status.rollout, controlLabel);
|
|
22
23
|
case 'archived':
|
|
23
|
-
return status.discarded ? BLOCK_COPY.discarded : status.winnerArm ? blockFinishedStatus(winnerLabel, status.winnerArm === 'control') : BLOCK_COPY.neverDecided;
|
|
24
|
+
return status.discarded ? BLOCK_COPY.discarded(controlLabel) : status.winnerArm ? blockFinishedStatus(winnerLabel, status.winnerArm === 'control', controlLabel) : BLOCK_COPY.neverDecided(controlLabel);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
export function canUnwrapOriginal(status, block) {
|
|
27
28
|
if (!liveStatus(status)) return true;
|
|
28
29
|
if (status.status !== 'archived') return false;
|
|
29
30
|
if (status.discarded || !status.winnerArm || status.winnerArm === 'control') return true;
|
|
30
|
-
const slot = status.
|
|
31
|
+
const slot = status.winnerArm;
|
|
31
32
|
return !!block && slotBlocks(block, slot).length === 0;
|
|
32
33
|
}
|
|
33
34
|
export function labelText(value) {
|
|
@@ -4,12 +4,13 @@ export declare const BLOCK_COPY: {
|
|
|
4
4
|
empty: string;
|
|
5
5
|
blockChanged: string;
|
|
6
6
|
replace: string;
|
|
7
|
+
replaceVersion: string;
|
|
7
8
|
cancel: string;
|
|
8
9
|
retry: string;
|
|
9
10
|
saveFirst: string;
|
|
10
11
|
setup: string;
|
|
11
|
-
copy: string;
|
|
12
|
-
confirmCopy: string;
|
|
12
|
+
copy: (label?: string) => string;
|
|
13
|
+
confirmCopy: (label?: string) => string;
|
|
13
14
|
unwrap: string;
|
|
14
15
|
removeAndUnwrap: string;
|
|
15
16
|
deleteAndUnwrap: string;
|
|
@@ -17,17 +18,19 @@ export declare const BLOCK_COPY: {
|
|
|
17
18
|
noLongerDraft: "This test is no longer a draft. Reload the page.";
|
|
18
19
|
finishUnwrap: string;
|
|
19
20
|
deleted: string;
|
|
20
|
-
discarded: string;
|
|
21
|
-
neverDecided: string;
|
|
21
|
+
discarded: (label?: string) => string;
|
|
22
|
+
neverDecided: (label?: string) => string;
|
|
22
23
|
running: string;
|
|
23
|
-
stopped: string;
|
|
24
|
+
stopped: (label?: string) => string;
|
|
25
|
+
archivedReplaceWhy: string;
|
|
26
|
+
archivedReplaceSteps: string[];
|
|
24
27
|
slotLabels: Record<string, string>;
|
|
25
28
|
wrapRefusals: Record<string, string>;
|
|
26
29
|
};
|
|
27
30
|
export declare const blockPosition: (label: string, position: number) => string;
|
|
28
31
|
export declare const blockTestName: (title: string, label: string) => string;
|
|
29
|
-
export declare const blockDraftStatus: (name: string) => string;
|
|
30
|
-
export declare const blockDecidedStatus: (winner: string, rollout: boolean) => string;
|
|
32
|
+
export declare const blockDraftStatus: (name: string, label?: string) => string;
|
|
33
|
+
export declare const blockDecidedStatus: (winner: string, rollout: boolean, label?: string) => string;
|
|
31
34
|
export type BlockLinkedCopy = {
|
|
32
35
|
before: string;
|
|
33
36
|
link: string;
|
|
@@ -35,10 +38,10 @@ export type BlockLinkedCopy = {
|
|
|
35
38
|
};
|
|
36
39
|
export declare const blockRunningUnwrap: BlockLinkedCopy;
|
|
37
40
|
export declare const blockDecidedUnwrap: BlockLinkedCopy;
|
|
38
|
-
export declare
|
|
39
|
-
export declare const blockFinishedStatus: (winner: string, originalWon?: boolean) => string;
|
|
40
|
-
export declare const blockDeleteConfirmation: (name: string) => string;
|
|
41
|
-
export declare const blockUnwrapConfirmation: (name: string) => string;
|
|
41
|
+
export declare function blockFinishedCopy(winner: string, originalWon?: boolean, emptyWinner?: boolean, label?: string): BlockLinkedCopy;
|
|
42
|
+
export declare const blockFinishedStatus: (winner: string, originalWon?: boolean, label?: string) => string;
|
|
43
|
+
export declare const blockDeleteConfirmation: (name: string, label?: string) => string;
|
|
44
|
+
export declare const blockUnwrapConfirmation: (name: string, label?: string) => string;
|
|
42
45
|
export declare const blockUnwrapNotice: (drafts: boolean, deleted: boolean) => string;
|
|
43
46
|
export declare const blockSaveNotice: (drafts: boolean) => "Save a draft of this page to add the test." | "Save this page to add the test.";
|
|
44
47
|
export declare const blockSyncNotice: (drafts: boolean) => "Versions were updated to match the test. Save draft to keep them." | "Versions were updated to match the test. Save to keep them.";
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { API_MESSAGES } from '../../testSurface/copy/common.js';
|
|
2
|
+
import { ARM_LABELS, controlVersionName } from '../../labels/arms.js';
|
|
2
3
|
export const BLOCK_COPY = {
|
|
3
4
|
testBlock: 'Test a block on this page',
|
|
4
5
|
pick: 'Choose a block',
|
|
5
|
-
empty: 'There are no blocks
|
|
6
|
+
empty: 'There are no saved blocks to test yet.',
|
|
6
7
|
blockChanged: 'This block changed while you were working. Nothing was replaced. Try again.',
|
|
7
8
|
replace: 'Replace',
|
|
9
|
+
replaceVersion: 'Replace a version in',
|
|
8
10
|
cancel: 'Cancel',
|
|
9
11
|
retry: 'Try again',
|
|
10
|
-
saveFirst: 'Save your changes
|
|
12
|
+
saveFirst: 'Save your changes to test this block.',
|
|
11
13
|
setup: 'Set up the test',
|
|
12
|
-
copy:
|
|
13
|
-
confirmCopy:
|
|
14
|
+
copy: (label)=>`Copy ${controlVersionName(label)} into this version`,
|
|
15
|
+
confirmCopy: (label)=>`Replace this version's content with a copy of ${controlVersionName(label)}? Edits you made to this version will be lost.`,
|
|
14
16
|
unwrap: 'Unwrap',
|
|
15
17
|
removeAndUnwrap: 'Remove the test and unwrap',
|
|
16
18
|
deleteAndUnwrap: 'Delete and unwrap',
|
|
17
19
|
alreadyDeleted: API_MESSAGES.testAlreadyDeleted,
|
|
18
20
|
noLongerDraft: API_MESSAGES.testNoLongerDraft,
|
|
19
21
|
finishUnwrap: 'The test was removed; use Unwrap to finish.',
|
|
20
|
-
deleted:
|
|
21
|
-
discarded:
|
|
22
|
-
neverDecided:
|
|
22
|
+
deleted: `This block's test was deleted; the page shows ${controlVersionName()}.`,
|
|
23
|
+
discarded: (label)=>`Winner discarded: this block shows ${controlVersionName(label)}. Use Unwrap to replace it with the content of ${controlVersionName(label)}.`,
|
|
24
|
+
neverDecided: (label)=>`Archived without a winner: this block shows ${controlVersionName(label)}. Use Unwrap to replace it with the content of ${controlVersionName(label)}.`,
|
|
23
25
|
running: "Running: visitors see different versions. Edit a version's tab to change it; the change is noted on the results.",
|
|
24
|
-
stopped:
|
|
26
|
+
stopped: (label)=>`Stopped: visitors see ${controlVersionName(label)}.`,
|
|
27
|
+
archivedReplaceWhy: 'To keep the winner on this page without the test, replace the Test block.',
|
|
28
|
+
archivedReplaceSteps: [
|
|
29
|
+
'Copy the winning content into ordinary page blocks.',
|
|
30
|
+
'Remove the Test block.'
|
|
31
|
+
],
|
|
25
32
|
slotLabels: {
|
|
26
|
-
control:
|
|
27
|
-
variantA:
|
|
28
|
-
variantB:
|
|
29
|
-
variantC:
|
|
33
|
+
control: ARM_LABELS.control,
|
|
34
|
+
variantA: ARM_LABELS.variantA,
|
|
35
|
+
variantB: ARM_LABELS.variantB,
|
|
36
|
+
variantC: ARM_LABELS.variantC
|
|
30
37
|
},
|
|
31
38
|
wrapRefusals: {
|
|
32
|
-
'wrap-target-missing': 'Reload
|
|
39
|
+
'wrap-target-missing': 'Reload to see the current page.',
|
|
33
40
|
'locked-placement': 'Another editor has this page open. Try again when it is unlocked.',
|
|
34
41
|
'invalid-status': 'This action is not available in the current status.',
|
|
35
42
|
'unknown-collection': "That page type isn't set up for tests.",
|
|
@@ -38,8 +45,8 @@ export const BLOCK_COPY = {
|
|
|
38
45
|
};
|
|
39
46
|
export const blockPosition = (label, position)=>`${label} (block ${position})`;
|
|
40
47
|
export const blockTestName = (title, label)=>`${title}: ${label}`;
|
|
41
|
-
export const blockDraftStatus = (name)=>`This block is being tested in the draft test ${name}. Visitors see
|
|
42
|
-
export const blockDecidedStatus = (winner, rollout)=>`Decided: visitors see ${winner}${rollout ?
|
|
48
|
+
export const blockDraftStatus = (name, label)=>`This block is being tested in the draft test ${name}. Visitors see ${controlVersionName(label)} until it starts.`;
|
|
49
|
+
export const blockDecidedStatus = (winner, rollout, label)=>`Decided: visitors see ${winner}${rollout ? `; a holdout still sees ${controlVersionName(label)}` : ''}.`;
|
|
43
50
|
export const blockRunningUnwrap = {
|
|
44
51
|
before: 'Stop ',
|
|
45
52
|
link: 'the test',
|
|
@@ -50,17 +57,21 @@ export const blockDecidedUnwrap = {
|
|
|
50
57
|
link: 'the test',
|
|
51
58
|
after: '.'
|
|
52
59
|
};
|
|
53
|
-
export
|
|
54
|
-
|
|
60
|
+
export function blockFinishedCopy(winner, originalWon = false, emptyWinner = false, label) {
|
|
61
|
+
const control = controlVersionName(label);
|
|
62
|
+
const before = emptyWinner ? `Archived: the winner has no content here, so visitors see ${control}. Unwrap leaves the page as visitors see it now. View the results on ` : originalWon ? `Archived: ${control} won. This block shows ${winner}. Use Unwrap to keep its content without the Test block. View the results on ` : `Archived: this block keeps serving ${winner}, with ${control} as a fallback if it is empty. View the results on `;
|
|
63
|
+
return {
|
|
64
|
+
before,
|
|
55
65
|
link: 'the test',
|
|
56
66
|
after: '.'
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export const blockFinishedStatus = (winner, originalWon = false, label)=>{
|
|
70
|
+
const copy = blockFinishedCopy(winner, originalWon, false, label);
|
|
60
71
|
return copy.before + copy.link + copy.after;
|
|
61
72
|
};
|
|
62
|
-
export const blockDeleteConfirmation = (name)=>`Delete the draft test ${name} and put
|
|
63
|
-
export const blockUnwrapConfirmation = (name)
|
|
73
|
+
export const blockDeleteConfirmation = (name, label)=>`Delete the draft test ${name} and put ${controlVersionName(label)} back in its place? Deleting the test can't be undone.`;
|
|
74
|
+
export const blockUnwrapConfirmation = (name, label)=>`${controlVersionName(label, true)} replaces this block when you save the page. The test ${name} and its results are kept.`;
|
|
64
75
|
export const blockUnwrapNotice = (drafts, deleted)=>`${deleted ? 'The draft test was deleted and the block unwrapped.' : 'The block was unwrapped.'} ${drafts ? 'Save draft' : 'Save'} to keep it.`;
|
|
65
76
|
export const blockSaveNotice = (drafts)=>drafts ? 'Save a draft of this page to add the test.' : 'Save this page to add the test.';
|
|
66
77
|
export const blockSyncNotice = (drafts)=>drafts ? 'Versions were updated to match the test. Save draft to keep them.' : 'Versions were updated to match the test. Save to keep them.';
|
|
@@ -8,6 +8,7 @@ export declare const GOALS_COPY: {
|
|
|
8
8
|
readonly name: "Name";
|
|
9
9
|
readonly source: "Measured by";
|
|
10
10
|
readonly directionColumn: "Better when";
|
|
11
|
+
readonly nameRequired: "Enter a name for this goal.";
|
|
11
12
|
readonly direction: "Better when it goes";
|
|
12
13
|
readonly increase: "More is better";
|
|
13
14
|
readonly decrease: "Less is better";
|
|
@@ -25,18 +26,19 @@ export declare const GOALS_COPY: {
|
|
|
25
26
|
readonly slugLocked: "The short name stays the same once a test uses this goal.";
|
|
26
27
|
readonly sourceLocked: "What this goal measures stays the same once a test uses it.";
|
|
27
28
|
readonly chooseSource: "Choose an outcome";
|
|
28
|
-
readonly window: "Count results for (
|
|
29
|
+
readonly window: "Count results for (days)";
|
|
30
|
+
readonly windowError: "Enter a whole number of days, at least 1.";
|
|
29
31
|
readonly minimum: "Minimum completions before deciding";
|
|
32
|
+
readonly minimumError: "Enter a number of at least 1.";
|
|
30
33
|
readonly advanced: "Advanced";
|
|
31
34
|
readonly capping: "Limit very large values";
|
|
32
35
|
readonly capType: "Limit by";
|
|
33
|
-
readonly capValue: "
|
|
34
|
-
readonly noCap: "
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly capHelp: "For past amounts, enter a number such as 0.99 to limit only the largest 1%; or enter a fixed amount.";
|
|
36
|
+
readonly capValue: "Fixed amount";
|
|
37
|
+
readonly noCap: "Don't limit";
|
|
38
|
+
readonly absolute: "Limit to a fixed amount";
|
|
39
|
+
readonly fixedAmountError: "Enter an amount of zero or more.";
|
|
38
40
|
readonly threshold: "Warn when it gets worse by (%)";
|
|
39
|
-
readonly
|
|
41
|
+
readonly createGoal: "Create goal";
|
|
40
42
|
readonly saving: "Saving…";
|
|
41
43
|
readonly cancel: "Cancel";
|
|
42
44
|
readonly remove: "Delete goal";
|
|
@@ -49,9 +51,13 @@ export declare const GOALS_COPY: {
|
|
|
49
51
|
readonly notFound: "This goal no longer exists.";
|
|
50
52
|
readonly backToTest: "Back to the test";
|
|
51
53
|
readonly useGoal: "Use this goal";
|
|
52
|
-
readonly open: "Open";
|
|
53
54
|
readonly search: "Search goals";
|
|
54
55
|
readonly clearSearch: "Clear search";
|
|
56
|
+
readonly roles: {
|
|
57
|
+
readonly primary: "Main goal";
|
|
58
|
+
readonly secondary: "Also tracked";
|
|
59
|
+
readonly guardrails: "Must not get worse";
|
|
60
|
+
};
|
|
55
61
|
readonly fields: "Goal details";
|
|
56
62
|
readonly deleteTitle: "Delete this goal?";
|
|
57
63
|
readonly deleteBody: "This cannot be undone.";
|
|
@@ -64,3 +70,4 @@ export declare function goalInUse(count: number): string;
|
|
|
64
70
|
export declare function goalDeleteLockedStart(count: number): string;
|
|
65
71
|
export declare function goalsNoMatches(search: string): string;
|
|
66
72
|
export declare function goalShowAll(count: number): string;
|
|
73
|
+
export declare function largestValues(quantile: string): string;
|