@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
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { EXPERIMENT_BLOCK_SLUG, hostBlocks } from '../../blocks/model.js';
|
|
2
|
+
import { BLOCK_COPY } from '../../admin/copy/blocks.js';
|
|
3
|
+
/** The only form-state failure with block-specific editor copy. */ export class BlockChangedError extends Error {
|
|
4
|
+
constructor(){
|
|
5
|
+
super(BLOCK_COPY.blockChanged);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** An API refusal already translated into editor-facing copy. */ export class RefusalError extends Error {
|
|
9
|
+
}
|
|
10
|
+
export const wrapMode = 'form-api';
|
|
11
|
+
/** Client twin: unnamed layout containers do not contribute to a data path. */ export function findClientBlocksField(fields, name) {
|
|
12
|
+
for (const field of fields){
|
|
13
|
+
if (field.type === 'blocks' && field.name === name) return field;
|
|
14
|
+
if (field.type === 'row' || field.type === 'collapsible') {
|
|
15
|
+
const found = findClientBlocksField(field.fields, name);
|
|
16
|
+
if (found) return found;
|
|
17
|
+
}
|
|
18
|
+
if (field.type === 'tabs') for (const tab of field.tabs){
|
|
19
|
+
if ('name' in tab && tab.name) continue;
|
|
20
|
+
const found = findClientBlocksField(tab.fields, name);
|
|
21
|
+
if (found) return found;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Only schema structure is needed by the pure helpers, never server validators.
|
|
26
|
+
* Resolve references at every depth, including inside the Experiment slots field.
|
|
27
|
+
*/ export function adaptClientBlocksField(field, config) {
|
|
28
|
+
function block(block) {
|
|
29
|
+
return {
|
|
30
|
+
...block,
|
|
31
|
+
fields: block.fields.map(adapt)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function adapt(field) {
|
|
35
|
+
if (field.type === 'blocks') return {
|
|
36
|
+
...field,
|
|
37
|
+
blocks: [
|
|
38
|
+
...field.blocks.map(block),
|
|
39
|
+
...(field.blockReferences ?? []).flatMap((reference)=>{
|
|
40
|
+
const resolved = typeof reference === 'string' ? config.blocks?.find((item)=>item.slug === reference) : reference;
|
|
41
|
+
return resolved ? [
|
|
42
|
+
block(resolved)
|
|
43
|
+
] : [];
|
|
44
|
+
})
|
|
45
|
+
],
|
|
46
|
+
blockReferences: []
|
|
47
|
+
};
|
|
48
|
+
if ('fields' in field) return {
|
|
49
|
+
...field,
|
|
50
|
+
fields: field.fields.map(adapt)
|
|
51
|
+
};
|
|
52
|
+
if (field.type === 'tabs') return {
|
|
53
|
+
...field,
|
|
54
|
+
tabs: field.tabs.map((tab)=>({
|
|
55
|
+
...tab,
|
|
56
|
+
fields: tab.fields.map(adapt)
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
59
|
+
return field;
|
|
60
|
+
}
|
|
61
|
+
return adapt(field);
|
|
62
|
+
}
|
|
63
|
+
export function experimentBlockSlug(field) {
|
|
64
|
+
return field.blocks.find((block)=>block.fields.some((field)=>'name' in field && field.name === 'xpBlockStatus'))?.slug ?? EXPERIMENT_BLOCK_SLUG;
|
|
65
|
+
}
|
|
66
|
+
export function rowLocation(path) {
|
|
67
|
+
const match = /^([^.]+)\.(\d+)(?:\.|$)/.exec(path);
|
|
68
|
+
return match ? {
|
|
69
|
+
field: match[1],
|
|
70
|
+
index: Number(match[2])
|
|
71
|
+
} : undefined;
|
|
72
|
+
}
|
|
73
|
+
export function dataAt(data, path) {
|
|
74
|
+
return path.split('.').reduce((value, key)=>value && typeof value === 'object' ? value[key] : undefined, data);
|
|
75
|
+
}
|
|
76
|
+
/** Stable object keys; array order and scalar values remain significant. */ function stringify(value) {
|
|
77
|
+
return JSON.stringify(value, (_, item)=>item && typeof item === 'object' && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0)) : item);
|
|
78
|
+
}
|
|
79
|
+
/** Payload 3.90.2 and 4 beta.6 use the same row APIs. Sync replaces the whole
|
|
80
|
+
* wrapper so add/drop/reorder and the server-rendered component slots stay together.
|
|
81
|
+
* N=0 needs UPDATE: removeFieldRow alone serializes the empty field as number 0.
|
|
82
|
+
*/ export async function replaceBlockRow(args) {
|
|
83
|
+
const { form, getFormState, collectionSlug, id, field, index, rows } = args;
|
|
84
|
+
const data = form.getData(), before = hostBlocks(data[field]);
|
|
85
|
+
if (args.expectedBlock && stringify(form.getDataByPath(`${field}.${index}`)) !== stringify(args.expectedBlock)) throw new BlockChangedError();
|
|
86
|
+
// Compare the same reader on both sides: getData() keeps empty row counts as 0.
|
|
87
|
+
const original = stringify(form.getDataByPath(field));
|
|
88
|
+
const next = [
|
|
89
|
+
...before.slice(0, index),
|
|
90
|
+
...rows,
|
|
91
|
+
...before.slice(index + 1)
|
|
92
|
+
];
|
|
93
|
+
const result = await getFormState({
|
|
94
|
+
collectionSlug,
|
|
95
|
+
id,
|
|
96
|
+
schemaPath: collectionSlug,
|
|
97
|
+
data: {
|
|
98
|
+
...data,
|
|
99
|
+
[field]: next
|
|
100
|
+
},
|
|
101
|
+
docPermissions: args.docPermissions,
|
|
102
|
+
docPreferences: args.docPreferences ?? {
|
|
103
|
+
fields: {}
|
|
104
|
+
},
|
|
105
|
+
operation: id == null ? 'create' : 'update',
|
|
106
|
+
renderAllFields: true,
|
|
107
|
+
skipValidation: true
|
|
108
|
+
});
|
|
109
|
+
if (stringify(form.getDataByPath(field)) !== original) throw new BlockChangedError();
|
|
110
|
+
if (!result.state) throw new Error('Missing server form state');
|
|
111
|
+
const state = result.state;
|
|
112
|
+
function subFieldState(rowIndex) {
|
|
113
|
+
const prefix = `${field}.${rowIndex}.`;
|
|
114
|
+
return Object.fromEntries(Object.entries(state).filter(([path])=>path.startsWith(prefix)).map(([path, value])=>[
|
|
115
|
+
path.slice(prefix.length),
|
|
116
|
+
value
|
|
117
|
+
]));
|
|
118
|
+
}
|
|
119
|
+
if (!rows.length) {
|
|
120
|
+
form.removeFieldRow({
|
|
121
|
+
path: field,
|
|
122
|
+
rowIndex: index
|
|
123
|
+
});
|
|
124
|
+
if (next.length === 0) form.dispatchFields({
|
|
125
|
+
type: 'UPDATE',
|
|
126
|
+
path: field,
|
|
127
|
+
value: [],
|
|
128
|
+
disableFormData: false
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
form.replaceFieldRow({
|
|
133
|
+
path: field,
|
|
134
|
+
rowIndex: index,
|
|
135
|
+
schemaPath: `${collectionSlug}.${field}`,
|
|
136
|
+
blockType: rows[0].blockType,
|
|
137
|
+
subFieldState: subFieldState(index)
|
|
138
|
+
});
|
|
139
|
+
for(let offset = 1; offset < rows.length; offset++)form.addFieldRow({
|
|
140
|
+
path: field,
|
|
141
|
+
rowIndex: index + offset,
|
|
142
|
+
schemaPath: `${collectionSlug}.${field}`,
|
|
143
|
+
blockType: rows[offset].blockType,
|
|
144
|
+
subFieldState: subFieldState(index + offset)
|
|
145
|
+
});
|
|
146
|
+
// REPLACE_ROW invents a metadata id even when the data id is unchanged.
|
|
147
|
+
// Keep server row metadata (including custom labels) and the wrapper React key:
|
|
148
|
+
// otherwise a sync remounts the status field and loses its save notice.
|
|
149
|
+
const oldRows = form.getFields()[field]?.rows ?? [];
|
|
150
|
+
const serverRows = state[field]?.rows;
|
|
151
|
+
if (serverRows) form.dispatchFields({
|
|
152
|
+
type: 'UPDATE',
|
|
153
|
+
path: field,
|
|
154
|
+
rows: serverRows.map((row)=>({
|
|
155
|
+
...oldRows.find((old)=>old.id === row.id),
|
|
156
|
+
...row
|
|
157
|
+
}))
|
|
158
|
+
});
|
|
159
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Field } from 'payload';
|
|
2
|
+
/** Copy the coordinates supplied by CORE-L2, including every containing array. */
|
|
3
|
+
export declare function injectTestBlock(fields: Field[], registration: {
|
|
4
|
+
field: string;
|
|
5
|
+
blockSlug?: string;
|
|
6
|
+
appliesTo?: (doc: Record<string, unknown>) => boolean;
|
|
7
|
+
}): Field[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { findRegisteredBlocksField } from '../../blocks/formState.js';
|
|
2
|
+
import { XP_TEST_BLOCK } from '../paths.js';
|
|
3
|
+
/** Copy the coordinates supplied by CORE-L2, including every containing array. */ export function injectTestBlock(fields, registration) {
|
|
4
|
+
const found = findRegisteredBlocksField(fields, registration.field);
|
|
5
|
+
if (!found) return fields;
|
|
6
|
+
const ui = {
|
|
7
|
+
name: 'xpTestBlock',
|
|
8
|
+
type: 'ui',
|
|
9
|
+
admin: {
|
|
10
|
+
// Payload supplies the active locale's form data here; there is no raw adapter row.
|
|
11
|
+
condition: (data)=>{
|
|
12
|
+
try {
|
|
13
|
+
return registration.appliesTo ? registration.appliesTo(data) === true : true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
components: {
|
|
19
|
+
Field: {
|
|
20
|
+
path: XP_TEST_BLOCK,
|
|
21
|
+
clientProps: {
|
|
22
|
+
blocksField: registration.field,
|
|
23
|
+
blockSlug: registration.blockSlug
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function insert(value, path) {
|
|
30
|
+
const [key, ...rest] = path;
|
|
31
|
+
if (key === undefined) return value;
|
|
32
|
+
const copy = Array.isArray(value) ? [
|
|
33
|
+
...value
|
|
34
|
+
] : {
|
|
35
|
+
...value
|
|
36
|
+
};
|
|
37
|
+
if (!rest.length) copy.splice(Number(key) + 1, 0, ui);
|
|
38
|
+
else copy[key] = insert(value[key], rest);
|
|
39
|
+
return copy;
|
|
40
|
+
}
|
|
41
|
+
return insert(fields, found.path);
|
|
42
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PlacementStatusResult } from '../../types/endpoints.js';
|
|
2
|
+
import { type HostBlock } from '../../blocks/model.js';
|
|
3
|
+
import type { RowsField } from './formApi.js';
|
|
4
|
+
export type BlockStatus = PlacementStatusResult['slugs'][string];
|
|
5
|
+
export type LiveBlockStatus = Extract<BlockStatus, {
|
|
6
|
+
status: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function liveStatus(status: BlockStatus | null): status is LiveBlockStatus;
|
|
9
|
+
export declare function slotLabel(slot: string, status: BlockStatus | null): string;
|
|
10
|
+
export declare function statusSentence(status: BlockStatus): string;
|
|
11
|
+
export declare function canUnwrapOriginal(status: BlockStatus, block?: HostBlock): boolean;
|
|
12
|
+
export declare function labelText(value: unknown): string | undefined;
|
|
13
|
+
export declare function blockChoices(value: unknown, field: RowsField, blockSlug: string): {
|
|
14
|
+
block: HostBlock;
|
|
15
|
+
index: number;
|
|
16
|
+
label: string;
|
|
17
|
+
option: string;
|
|
18
|
+
}[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { hostBlocks, slotBlocks } from '../../blocks/model.js';
|
|
2
|
+
import { BLOCK_COPY, blockDecidedStatus, blockDraftStatus, blockFinishedStatus, blockPosition } from '../../admin/copy/blocks.js';
|
|
3
|
+
export function liveStatus(status) {
|
|
4
|
+
return !!status && 'status' in status;
|
|
5
|
+
}
|
|
6
|
+
export function slotLabel(slot, status) {
|
|
7
|
+
return (liveStatus(status) ? status.arms.find((arm)=>arm.key !== 'holdout' && arm.key === slot)?.label : undefined) || BLOCK_COPY.slotLabels[slot] || slot;
|
|
8
|
+
}
|
|
9
|
+
export function statusSentence(status) {
|
|
10
|
+
if (!liveStatus(status)) return BLOCK_COPY.deleted;
|
|
11
|
+
const winner = status.arms.find((arm)=>arm.key === status.winnerArm);
|
|
12
|
+
const winnerLabel = winner?.label || BLOCK_COPY.slotLabels[status.winnerArm ?? 'control'] || status.winnerArm || BLOCK_COPY.slotLabels.control;
|
|
13
|
+
switch(status.status){
|
|
14
|
+
case 'draft':
|
|
15
|
+
return blockDraftStatus(status.name);
|
|
16
|
+
case 'running':
|
|
17
|
+
return BLOCK_COPY.running;
|
|
18
|
+
case 'stopped':
|
|
19
|
+
return BLOCK_COPY.stopped;
|
|
20
|
+
case 'decided':
|
|
21
|
+
return blockDecidedStatus(winnerLabel, status.rollout);
|
|
22
|
+
case 'archived':
|
|
23
|
+
return status.discarded ? BLOCK_COPY.discarded : status.winnerArm ? blockFinishedStatus(winnerLabel, status.winnerArm === 'control') : BLOCK_COPY.neverDecided;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function canUnwrapOriginal(status, block) {
|
|
27
|
+
if (!liveStatus(status)) return true;
|
|
28
|
+
if (status.status !== 'archived') return false;
|
|
29
|
+
if (status.discarded || !status.winnerArm || status.winnerArm === 'control') return true;
|
|
30
|
+
const slot = status.winnerArm;
|
|
31
|
+
return !!block && slotBlocks(block, slot).length === 0;
|
|
32
|
+
}
|
|
33
|
+
export function labelText(value) {
|
|
34
|
+
return typeof value === 'string' ? value : value && typeof value === 'object' ? Object.values(value).find((item)=>typeof item === 'string') : undefined;
|
|
35
|
+
}
|
|
36
|
+
export function blockChoices(value, field, blockSlug) {
|
|
37
|
+
return hostBlocks(value).flatMap((block, index)=>{
|
|
38
|
+
if (block.blockType === blockSlug) return [];
|
|
39
|
+
const label = labelText(field.blocks.find((config)=>config.slug === block.blockType)?.labels?.singular) || block.blockType;
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
block,
|
|
43
|
+
index,
|
|
44
|
+
label,
|
|
45
|
+
option: blockPosition(label, index + 1)
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockStatus } from './model.js';
|
|
2
|
+
export declare const validBlockSlug: (slug: unknown) => slug is string;
|
|
3
|
+
/** Update a mounted owner's snapshot and invalidate an older pending read. */
|
|
4
|
+
export declare function setBlockStatus(api: string, slug: string, value: BlockStatus): void;
|
|
5
|
+
/** Only status fields own reads. StrictMode replays the same mount token; a
|
|
6
|
+
* different owner after the last cleanup starts fresh, even in the same commit.
|
|
7
|
+
* Deferred eviction removes every entry with no live owner after that commit.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBlockStatus(api: string, slug: unknown, owner?: boolean): BlockStatus | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useSyncExternalStore } from 'react';
|
|
2
|
+
import { createApi } from '../../testSurface/api.js';
|
|
3
|
+
const cache = new Map();
|
|
4
|
+
// Subscribers do not create status entries: a label alone owns no cached data.
|
|
5
|
+
const listeners = new Map();
|
|
6
|
+
const keyOf = (api, slug)=>JSON.stringify([
|
|
7
|
+
api,
|
|
8
|
+
slug
|
|
9
|
+
]);
|
|
10
|
+
const publish = (key)=>listeners.get(key)?.callbacks.forEach((listener)=>listener());
|
|
11
|
+
export const validBlockSlug = (slug)=>typeof slug === 'string' && slug.length > 0 && slug.length <= 64;
|
|
12
|
+
/** Update a mounted owner's snapshot and invalidate an older pending read. */ export function setBlockStatus(api, slug, value) {
|
|
13
|
+
const key = keyOf(api, slug), current = cache.get(key);
|
|
14
|
+
if (!current) return;
|
|
15
|
+
current.revision++;
|
|
16
|
+
current.value = value;
|
|
17
|
+
publish(key);
|
|
18
|
+
}
|
|
19
|
+
/** Only status fields own reads. StrictMode replays the same mount token; a
|
|
20
|
+
* different owner after the last cleanup starts fresh, even in the same commit.
|
|
21
|
+
* Deferred eviction removes every entry with no live owner after that commit.
|
|
22
|
+
*/ export function useBlockStatus(api, slug, owner = false) {
|
|
23
|
+
const key = validBlockSlug(slug) ? keyOf(api, slug) : undefined;
|
|
24
|
+
const token = useRef({});
|
|
25
|
+
const subscribe = useCallback((listener)=>{
|
|
26
|
+
if (!key) return ()=>{};
|
|
27
|
+
let current = listeners.get(key);
|
|
28
|
+
if (!current) {
|
|
29
|
+
current = {
|
|
30
|
+
callbacks: new Set()
|
|
31
|
+
};
|
|
32
|
+
listeners.set(key, current);
|
|
33
|
+
}
|
|
34
|
+
current.callbacks.add(listener);
|
|
35
|
+
return ()=>{
|
|
36
|
+
current.callbacks = new Set([
|
|
37
|
+
...current.callbacks
|
|
38
|
+
].filter((item)=>item !== listener));
|
|
39
|
+
if (!current.callbacks.size) listeners.delete(key);
|
|
40
|
+
};
|
|
41
|
+
}, [
|
|
42
|
+
key
|
|
43
|
+
]);
|
|
44
|
+
const status = useSyncExternalStore(subscribe, ()=>{
|
|
45
|
+
const current = key ? cache.get(key) : undefined;
|
|
46
|
+
// A new owner must not sync with the previous mount's snapshot before its
|
|
47
|
+
// effect registers ownership (or starts the fresh read).
|
|
48
|
+
return current && (!owner || current.mounts.has(token.current)) ? current.value : null;
|
|
49
|
+
}, ()=>null);
|
|
50
|
+
useEffect(()=>{
|
|
51
|
+
if (!key || !owner || !validBlockSlug(slug)) return;
|
|
52
|
+
let current = cache.get(key);
|
|
53
|
+
if (!current || !current.owners && !current.mounts.has(token.current)) {
|
|
54
|
+
current = {
|
|
55
|
+
value: null,
|
|
56
|
+
owners: 0,
|
|
57
|
+
mounts: new WeakSet(),
|
|
58
|
+
revision: 0
|
|
59
|
+
};
|
|
60
|
+
cache.set(key, current);
|
|
61
|
+
}
|
|
62
|
+
const owned = current;
|
|
63
|
+
owned.owners++;
|
|
64
|
+
owned.mounts.add(token.current);
|
|
65
|
+
publish(key);
|
|
66
|
+
const revision = owned.revision;
|
|
67
|
+
if (!owned.pending) owned.pending = createApi(api).placementStatus({
|
|
68
|
+
slugs: [
|
|
69
|
+
slug
|
|
70
|
+
]
|
|
71
|
+
}).then((result)=>{
|
|
72
|
+
if (cache.get(key) !== owned || owned.revision !== revision) return;
|
|
73
|
+
owned.value = result.ok ? result.data?.slugs[slug] ?? null : null;
|
|
74
|
+
publish(key);
|
|
75
|
+
});
|
|
76
|
+
return ()=>{
|
|
77
|
+
owned.owners--;
|
|
78
|
+
queueMicrotask(()=>{
|
|
79
|
+
if (!owned.owners && cache.get(key) === owned) {
|
|
80
|
+
cache.delete(key);
|
|
81
|
+
publish(key);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}, [
|
|
86
|
+
api,
|
|
87
|
+
key,
|
|
88
|
+
slug,
|
|
89
|
+
owner
|
|
90
|
+
]);
|
|
91
|
+
return status;
|
|
92
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useConfig, useDocumentInfo, useForm } from '@payloadcms/ui';
|
|
2
|
+
import { adaptClientBlocksField, rowLocation } from './formApi.js';
|
|
3
|
+
import type { ClientCollectionConfig } from 'payload';
|
|
4
|
+
import type { ExperimentBlock, HostBlock } from '../../blocks/model.js';
|
|
5
|
+
/** Declared so the d.ts build can name Payload UI's form types through public exports. */
|
|
6
|
+
export type BlockFormApi = {
|
|
7
|
+
form: ReturnType<typeof useForm>;
|
|
8
|
+
document: ReturnType<typeof useDocumentInfo>;
|
|
9
|
+
config: ReturnType<typeof useConfig>['config'];
|
|
10
|
+
collection: ClientCollectionConfig | undefined;
|
|
11
|
+
field: ReturnType<typeof adaptClientBlocksField> | undefined;
|
|
12
|
+
block: ExperimentBlock | undefined;
|
|
13
|
+
manager: boolean;
|
|
14
|
+
replace: (rows: HostBlock[]) => Promise<void>;
|
|
15
|
+
location: ReturnType<typeof rowLocation>;
|
|
16
|
+
};
|
|
17
|
+
export declare function useBlockForm(path: string): BlockFormApi;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useAuth, useConfig, useDocumentInfo, useForm, useFormFields, useServerFunctions } from '@payloadcms/ui';
|
|
3
|
+
import { adaptClientBlocksField, findClientBlocksField, replaceBlockRow, rowLocation } from './formApi.js';
|
|
4
|
+
export function useBlockForm(path) {
|
|
5
|
+
const form = useForm(), document = useDocumentInfo(), { config, getEntityConfig } = useConfig();
|
|
6
|
+
const { getFormState } = useServerFunctions(), { permissions } = useAuth();
|
|
7
|
+
// useForm's getters are stable; subscribe so changed slug/row paths are read again.
|
|
8
|
+
useFormFields(([fields])=>fields);
|
|
9
|
+
const location = rowLocation(path);
|
|
10
|
+
const collection = document.collectionSlug ? getEntityConfig({
|
|
11
|
+
collectionSlug: document.collectionSlug
|
|
12
|
+
}) : undefined;
|
|
13
|
+
const clientField = location && collection ? findClientBlocksField(collection.fields, location.field) : undefined;
|
|
14
|
+
const field = useMemo(()=>clientField ? adaptClientBlocksField(clientField, config) : undefined, [
|
|
15
|
+
clientField,
|
|
16
|
+
config
|
|
17
|
+
]);
|
|
18
|
+
const block = location ? form.getDataByPath(`${location.field}.${location.index}`) : undefined;
|
|
19
|
+
const testPermissions = permissions?.collections?.['xp-experiments'];
|
|
20
|
+
const manager = testPermissions?.update === true;
|
|
21
|
+
async function replace(rows) {
|
|
22
|
+
if (!location || !document.collectionSlug) return;
|
|
23
|
+
await replaceBlockRow({
|
|
24
|
+
form,
|
|
25
|
+
getFormState,
|
|
26
|
+
collectionSlug: document.collectionSlug,
|
|
27
|
+
id: document.id,
|
|
28
|
+
...location,
|
|
29
|
+
rows,
|
|
30
|
+
expectedBlock: block,
|
|
31
|
+
docPermissions: document.docPermissions,
|
|
32
|
+
docPreferences: await document.getDocPreferences?.()
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
form,
|
|
37
|
+
document,
|
|
38
|
+
config,
|
|
39
|
+
collection,
|
|
40
|
+
field,
|
|
41
|
+
block,
|
|
42
|
+
manager,
|
|
43
|
+
replace,
|
|
44
|
+
location
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import '../theme.css';
|
|
4
|
-
import { theme } from '
|
|
4
|
+
import { theme } from '../../testSurface/theme.js';
|
|
5
5
|
export function RootViewMessage({ children, alert = false }) {
|
|
6
6
|
return /*#__PURE__*/ _jsx("div", {
|
|
7
7
|
role: alert ? 'alert' : undefined,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const BLOCK_COPY: {
|
|
2
|
+
testBlock: string;
|
|
3
|
+
pick: string;
|
|
4
|
+
empty: string;
|
|
5
|
+
blockChanged: string;
|
|
6
|
+
replace: string;
|
|
7
|
+
replaceVersion: string;
|
|
8
|
+
cancel: string;
|
|
9
|
+
retry: string;
|
|
10
|
+
saveFirst: string;
|
|
11
|
+
setup: string;
|
|
12
|
+
copy: string;
|
|
13
|
+
confirmCopy: string;
|
|
14
|
+
unwrap: string;
|
|
15
|
+
removeAndUnwrap: string;
|
|
16
|
+
deleteAndUnwrap: string;
|
|
17
|
+
alreadyDeleted: "This test was already deleted. Reload the page.";
|
|
18
|
+
noLongerDraft: "This test is no longer a draft. Reload the page.";
|
|
19
|
+
finishUnwrap: string;
|
|
20
|
+
deleted: string;
|
|
21
|
+
discarded: string;
|
|
22
|
+
neverDecided: string;
|
|
23
|
+
running: string;
|
|
24
|
+
stopped: string;
|
|
25
|
+
archivedReplaceWhy: string;
|
|
26
|
+
archivedReplaceSteps: string[];
|
|
27
|
+
slotLabels: Record<string, string>;
|
|
28
|
+
wrapRefusals: Record<string, string>;
|
|
29
|
+
};
|
|
30
|
+
export declare const blockPosition: (label: string, position: number) => string;
|
|
31
|
+
export declare const blockTestName: (title: string, label: string) => string;
|
|
32
|
+
export declare const blockDraftStatus: (name: string) => string;
|
|
33
|
+
export declare const blockDecidedStatus: (winner: string, rollout: boolean) => string;
|
|
34
|
+
export type BlockLinkedCopy = {
|
|
35
|
+
before: string;
|
|
36
|
+
link: string;
|
|
37
|
+
after: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const blockRunningUnwrap: BlockLinkedCopy;
|
|
40
|
+
export declare const blockDecidedUnwrap: BlockLinkedCopy;
|
|
41
|
+
export declare const blockFinishedCopy: (winner: string, originalWon?: boolean, emptyWinner?: boolean) => BlockLinkedCopy;
|
|
42
|
+
export declare const blockFinishedStatus: (winner: string, originalWon?: boolean) => string;
|
|
43
|
+
export declare const blockDeleteConfirmation: (name: string) => string;
|
|
44
|
+
export declare const blockUnwrapConfirmation: (name: string) => string;
|
|
45
|
+
export declare const blockUnwrapNotice: (drafts: boolean, deleted: boolean) => string;
|
|
46
|
+
export declare const blockSaveNotice: (drafts: boolean) => "Save a draft of this page to add the test." | "Save this page to add the test.";
|
|
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.";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { API_MESSAGES } from '../../testSurface/copy/common.js';
|
|
2
|
+
export const BLOCK_COPY = {
|
|
3
|
+
testBlock: 'Test a block on this page',
|
|
4
|
+
pick: 'Choose a block',
|
|
5
|
+
empty: 'There are no saved blocks to test yet.',
|
|
6
|
+
blockChanged: 'This block changed while you were working. Nothing was replaced. Try again.',
|
|
7
|
+
replace: 'Replace',
|
|
8
|
+
replaceVersion: 'Replace a version in',
|
|
9
|
+
cancel: 'Cancel',
|
|
10
|
+
retry: 'Try again',
|
|
11
|
+
saveFirst: 'Save your changes to test this block.',
|
|
12
|
+
setup: 'Set up the test',
|
|
13
|
+
copy: 'Copy the Original into this version',
|
|
14
|
+
confirmCopy: "Replace this version's content with a copy of the Original? Edits you made to this version will be lost.",
|
|
15
|
+
unwrap: 'Unwrap',
|
|
16
|
+
removeAndUnwrap: 'Remove the test and unwrap',
|
|
17
|
+
deleteAndUnwrap: 'Delete and unwrap',
|
|
18
|
+
alreadyDeleted: API_MESSAGES.testAlreadyDeleted,
|
|
19
|
+
noLongerDraft: API_MESSAGES.testNoLongerDraft,
|
|
20
|
+
finishUnwrap: 'The test was removed; use Unwrap to finish.',
|
|
21
|
+
deleted: "This block's test was deleted; the page shows the Original.",
|
|
22
|
+
discarded: 'Winner discarded: this block shows the Original. Use Unwrap to replace it with the Original content.',
|
|
23
|
+
neverDecided: 'Archived without a winner: this block shows the Original. Use Unwrap to replace it with the Original content.',
|
|
24
|
+
running: "Running: visitors see different versions. Edit a version's tab to change it; the change is noted on the results.",
|
|
25
|
+
stopped: 'Stopped: visitors see the Original.',
|
|
26
|
+
archivedReplaceWhy: 'To keep the winner on this page without the test, replace the Experiment block.',
|
|
27
|
+
archivedReplaceSteps: [
|
|
28
|
+
'Copy the winning content into ordinary page blocks.',
|
|
29
|
+
'Remove the Experiment block.'
|
|
30
|
+
],
|
|
31
|
+
slotLabels: {
|
|
32
|
+
control: 'Original',
|
|
33
|
+
variantA: 'Variant A',
|
|
34
|
+
variantB: 'Variant B',
|
|
35
|
+
variantC: 'Variant C'
|
|
36
|
+
},
|
|
37
|
+
wrapRefusals: {
|
|
38
|
+
'wrap-target-missing': 'Reload to see the current page.',
|
|
39
|
+
'locked-placement': 'Another editor has this page open. Try again when it is unlocked.',
|
|
40
|
+
'invalid-status': 'This action is not available in the current status.',
|
|
41
|
+
'unknown-collection': "That page type isn't set up for tests.",
|
|
42
|
+
'invalid-body': 'Choose a block test.'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const blockPosition = (label, position)=>`${label} (block ${position})`;
|
|
46
|
+
export const blockTestName = (title, label)=>`${title}: ${label}`;
|
|
47
|
+
export const blockDraftStatus = (name)=>`This block is being tested in the draft test ${name}. Visitors see the Original until it starts.`;
|
|
48
|
+
export const blockDecidedStatus = (winner, rollout)=>`Decided: visitors see ${winner}${rollout ? '; a holdout still sees the Original' : ''}.`;
|
|
49
|
+
export const blockRunningUnwrap = {
|
|
50
|
+
before: 'Stop ',
|
|
51
|
+
link: 'the test',
|
|
52
|
+
after: ' to unwrap.'
|
|
53
|
+
};
|
|
54
|
+
export const blockDecidedUnwrap = {
|
|
55
|
+
before: 'To put the winner into this page, use "Make it the content" on ',
|
|
56
|
+
link: 'the test',
|
|
57
|
+
after: '.'
|
|
58
|
+
};
|
|
59
|
+
export const blockFinishedCopy = (winner, originalWon = false, emptyWinner = false)=>({
|
|
60
|
+
before: emptyWinner ? 'Archived: the winner has no content here, so visitors see the Original. Unwrap leaves the page as visitors see it now. View the results on ' : originalWon ? `Archived: the Original won. This block shows ${winner}. Use Unwrap to keep its content without the Experiment block. View the results on ` : `Archived: this block keeps serving ${winner}, with the Original as a fallback if it is empty. View the results on `,
|
|
61
|
+
link: 'the test',
|
|
62
|
+
after: '.'
|
|
63
|
+
});
|
|
64
|
+
export const blockFinishedStatus = (winner, originalWon = false)=>{
|
|
65
|
+
const copy = blockFinishedCopy(winner, originalWon);
|
|
66
|
+
return copy.before + copy.link + copy.after;
|
|
67
|
+
};
|
|
68
|
+
export const blockDeleteConfirmation = (name)=>`Delete the draft test ${name} and put the Original back in its place? Deleting the test can't be undone.`;
|
|
69
|
+
export const blockUnwrapConfirmation = (name)=>`The Original replaces this block when you save the page. The test ${name} and its results are kept.`;
|
|
70
|
+
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.`;
|
|
71
|
+
export const blockSaveNotice = (drafts)=>drafts ? 'Save a draft of this page to add the test.' : 'Save this page to add the test.';
|
|
72
|
+
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.';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const GOALS_COPY: {
|
|
2
|
+
readonly slugRule: "Use 1–64 lowercase letters, numbers, underscores or hyphens, starting with a letter or number.";
|
|
3
|
+
readonly duplicateSlug: "Another goal already uses this short name. Change it under Advanced.";
|
|
4
|
+
readonly duplicateSlugMain: "Another goal already uses this short name. Choose another.";
|
|
2
5
|
readonly title: "Goals";
|
|
3
6
|
readonly goal: "Goal";
|
|
4
7
|
readonly newGoal: "New goal";
|
|
@@ -10,6 +13,7 @@ export declare const GOALS_COPY: {
|
|
|
10
13
|
readonly decrease: "Less is better";
|
|
11
14
|
readonly usedBy: "Used by";
|
|
12
15
|
readonly status: "Status";
|
|
16
|
+
readonly showLess: "Show less";
|
|
13
17
|
readonly inUse: "In use";
|
|
14
18
|
readonly unused: "Not used yet";
|
|
15
19
|
readonly empty: "No goals yet. A goal is what a test tries to improve.";
|
|
@@ -52,8 +56,11 @@ export declare const GOALS_COPY: {
|
|
|
52
56
|
readonly deleteTitle: "Delete this goal?";
|
|
53
57
|
readonly deleteBody: "This cannot be undone.";
|
|
54
58
|
readonly confirmDelete: "Delete";
|
|
59
|
+
readonly thoseTests: "those tests";
|
|
60
|
+
readonly deleteLockedEnd: " first.";
|
|
55
61
|
};
|
|
56
62
|
export declare function goalUsedBy(count: number): string;
|
|
57
63
|
export declare function goalInUse(count: number): string;
|
|
58
|
-
export declare function
|
|
64
|
+
export declare function goalDeleteLockedStart(count: number): string;
|
|
59
65
|
export declare function goalsNoMatches(search: string): string;
|
|
66
|
+
export declare function goalShowAll(count: number): string;
|
package/dist/admin/copy/goals.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { CLICK_GOAL_COPY } from '../../goals/picker/copy.js';
|
|
1
2
|
export const GOALS_COPY = {
|
|
3
|
+
slugRule: CLICK_GOAL_COPY.slugRule,
|
|
4
|
+
duplicateSlug: CLICK_GOAL_COPY.duplicateSlug,
|
|
5
|
+
duplicateSlugMain: 'Another goal already uses this short name. Choose another.',
|
|
2
6
|
title: 'Goals',
|
|
3
7
|
goal: 'Goal',
|
|
4
8
|
newGoal: 'New goal',
|
|
@@ -10,6 +14,7 @@ export const GOALS_COPY = {
|
|
|
10
14
|
decrease: 'Less is better',
|
|
11
15
|
usedBy: 'Used by',
|
|
12
16
|
status: 'Status',
|
|
17
|
+
showLess: 'Show less',
|
|
13
18
|
inUse: 'In use',
|
|
14
19
|
unused: 'Not used yet',
|
|
15
20
|
empty: 'No goals yet. A goal is what a test tries to improve.',
|
|
@@ -38,7 +43,7 @@ export const GOALS_COPY = {
|
|
|
38
43
|
remove: 'Delete goal',
|
|
39
44
|
thresholdError: 'Enter a percentage of zero or more, or leave blank for 5%.',
|
|
40
45
|
deleting: 'Deleting…',
|
|
41
|
-
saveError:
|
|
46
|
+
saveError: CLICK_GOAL_COPY.saveError,
|
|
42
47
|
deleteError: "Couldn't delete the goal. Try again.",
|
|
43
48
|
breadcrumb: 'Breadcrumb',
|
|
44
49
|
missing: 'This goal no longer exists.',
|
|
@@ -51,7 +56,9 @@ export const GOALS_COPY = {
|
|
|
51
56
|
fields: 'Goal details',
|
|
52
57
|
deleteTitle: 'Delete this goal?',
|
|
53
58
|
deleteBody: 'This cannot be undone.',
|
|
54
|
-
confirmDelete: 'Delete'
|
|
59
|
+
confirmDelete: 'Delete',
|
|
60
|
+
thoseTests: 'those tests',
|
|
61
|
+
deleteLockedEnd: ' first.'
|
|
55
62
|
};
|
|
56
63
|
export function goalUsedBy(count) {
|
|
57
64
|
return `Used by ${count} ${count === 1 ? 'test' : 'tests'}`;
|
|
@@ -59,9 +66,12 @@ export function goalUsedBy(count) {
|
|
|
59
66
|
export function goalInUse(count) {
|
|
60
67
|
return `In use by ${count} ${count === 1 ? 'test' : 'tests'}`;
|
|
61
68
|
}
|
|
62
|
-
export function
|
|
63
|
-
return `${goalUsedBy(count)}. Remove it from
|
|
69
|
+
export function goalDeleteLockedStart(count) {
|
|
70
|
+
return `${goalUsedBy(count)}. Remove it from `;
|
|
64
71
|
}
|
|
65
72
|
export function goalsNoMatches(search) {
|
|
66
73
|
return `No goals match “${search}”.`;
|
|
67
74
|
}
|
|
75
|
+
export function goalShowAll(count) {
|
|
76
|
+
return `Show all ${count}`;
|
|
77
|
+
}
|