@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PayloadRequest } from 'payload';
|
|
2
|
+
type StartReadQuery = Parameters<PayloadRequest['payload']['find']>[0] & {
|
|
3
|
+
collection: 'xp-experiments' | 'xp-metrics' | 'xp-layers';
|
|
4
|
+
};
|
|
5
|
+
export declare function findStartDocuments(req: PayloadRequest, query: StartReadQuery, system?: boolean): Promise<import("payload").PaginatedDocs<import("payload").JsonObject & import("payload").TypeWithID>>;
|
|
6
|
+
export declare function readStartState(req: PayloadRequest, system?: boolean): Promise<import("payload").JsonObject>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function findStartDocuments(req, query, system = false) {
|
|
2
|
+
// §7.8: Start from trusted host code reads plugin readiness data without a manager actor.
|
|
3
|
+
if (system) return req.payload.find({
|
|
4
|
+
...query,
|
|
5
|
+
req,
|
|
6
|
+
overrideAccess: true
|
|
7
|
+
});
|
|
8
|
+
return req.payload.find({
|
|
9
|
+
...query,
|
|
10
|
+
req,
|
|
11
|
+
overrideAccess: false
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function readStartState(req, system = false) {
|
|
15
|
+
// §7.8: system Start needs the effective flag defaults even without a manager actor.
|
|
16
|
+
if (system) return req.payload.findGlobal({
|
|
17
|
+
slug: 'xp-state',
|
|
18
|
+
req,
|
|
19
|
+
overrideAccess: true,
|
|
20
|
+
depth: 0
|
|
21
|
+
});
|
|
22
|
+
return req.payload.findGlobal({
|
|
23
|
+
slug: 'xp-state',
|
|
24
|
+
req,
|
|
25
|
+
overrideAccess: false,
|
|
26
|
+
depth: 0
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PayloadRequest } from 'payload';
|
|
2
2
|
import type { DocId } from '../types/contracts.js';
|
|
3
|
-
|
|
3
|
+
import type { RoundBody } from '../types/endpoints.js';
|
|
4
|
+
export declare function stop(req: PayloadRequest, { experimentId, phase: expectedPhase }: RoundBody & {
|
|
4
5
|
experimentId: DocId;
|
|
5
6
|
}): Promise<{
|
|
6
7
|
doc: import("payload").JsonObject & import("payload").TypeWithID;
|
package/dist/transitions/stop.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { relationshipId } from './checkStart.js';
|
|
2
2
|
import { withTransition } from './kernel.js';
|
|
3
|
-
import { setPhaseEndedAt } from './phaseRecord.js';
|
|
3
|
+
import { requireCurrentRound, setPhaseEndedAt } from './phaseRecord.js';
|
|
4
4
|
import { readExperiment, refuse, updateExperiment } from './start.js';
|
|
5
|
-
export async function stop(req, { experimentId }) {
|
|
5
|
+
export async function stop(req, { experimentId, phase: expectedPhase }) {
|
|
6
6
|
const before = await readExperiment(req, experimentId);
|
|
7
7
|
const { result: doc, revision } = await withTransition(req, {
|
|
8
8
|
experimentId,
|
|
9
9
|
layerId: relationshipId(before.layer)
|
|
10
10
|
}, async ({ req })=>{
|
|
11
11
|
const current = await readExperiment(req, experimentId);
|
|
12
|
+
requireCurrentRound(expectedPhase, current.phase);
|
|
12
13
|
if (current.status !== 'running') refuse('invalid-status');
|
|
13
14
|
const at = new Date().toISOString();
|
|
14
15
|
await setPhaseEndedAt(req, experimentId, current.phase, at);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Leaf module: UI code imports this without pulling server types. */ export { };
|
|
@@ -16,7 +16,8 @@ export type ExposurePolicy = 'render' | 'viewport' | 'pageview' | 'manual';
|
|
|
16
16
|
export type ExperimentKind = 'block' | 'page' | 'flag' | 'code';
|
|
17
17
|
export type Status = 'draft' | 'running' | 'stopped' | 'decided' | 'archived';
|
|
18
18
|
export type UnitType = 'visitor' | 'user';
|
|
19
|
-
|
|
19
|
+
import type { ArmKey } from './armKey.js';
|
|
20
|
+
export type { ArmKey };
|
|
20
21
|
export type ArmKind = 'control' | 'variant' | 'holdout';
|
|
21
22
|
export interface TargetingRule {
|
|
22
23
|
attribute: string;
|
|
@@ -93,10 +94,11 @@ export interface FlagPoint {
|
|
|
93
94
|
req: PayloadRequest;
|
|
94
95
|
}): Promise<void>;
|
|
95
96
|
}
|
|
96
|
-
/**
|
|
97
|
+
/** Combine a trusted client-address cap with a limit for the verified unit. */
|
|
97
98
|
export type RateLimiter = (args: {
|
|
98
99
|
req: PayloadRequest;
|
|
99
100
|
unitId: string;
|
|
101
|
+
unitType: UnitType;
|
|
100
102
|
}) => boolean | Promise<boolean>;
|
|
101
103
|
export type ExperimentsAccess = (args: {
|
|
102
104
|
req: PayloadRequest;
|
|
@@ -107,6 +109,15 @@ export interface ExperimentsPageCollection {
|
|
|
107
109
|
copyHint?: string;
|
|
108
110
|
copyUrl?: string;
|
|
109
111
|
copyLabel?: string;
|
|
112
|
+
/** Enable draft copying for this collection. Omit or set false to use manual setup. */
|
|
113
|
+
copy?: boolean | {
|
|
114
|
+
/** Override fields for the proposed address, or return null for manual setup. Can run more than once and must not write. */
|
|
115
|
+
overrides: (doc: Record<string, unknown>, context: {
|
|
116
|
+
req: PayloadRequest;
|
|
117
|
+
path: string;
|
|
118
|
+
suffix: string;
|
|
119
|
+
}) => Record<string, unknown> | null | Promise<Record<string, unknown> | null>;
|
|
120
|
+
};
|
|
110
121
|
pathOf: (doc: Record<string, unknown>) => string | null;
|
|
111
122
|
/** Lookup with the supplied req and overrideAccess: false. Under an anonymous req (results checks) only published pages are visible, so a hit is { published: true } or null. Under a req that can read drafts (Start), a draft-only page may be reported as { published: false }. */
|
|
112
123
|
findByPath: (path: string, req: PayloadRequest) => Promise<{
|
|
@@ -173,11 +184,13 @@ export interface ExperimentsPluginOptions<TUser extends {
|
|
|
173
184
|
field?: string;
|
|
174
185
|
}>;
|
|
175
186
|
};
|
|
176
|
-
events
|
|
187
|
+
events: {
|
|
177
188
|
retentionDays?: number;
|
|
178
189
|
maxBodyBytes?: number;
|
|
179
|
-
rateLimit
|
|
190
|
+
rateLimit: RateLimiter | false;
|
|
180
191
|
dimensions?: string[];
|
|
192
|
+
/** Public HTTP(S) origin for clients without Fetch Metadata. Defaults to Payload's serverURL. */
|
|
193
|
+
origin?: string;
|
|
181
194
|
};
|
|
182
195
|
}
|
|
183
196
|
/** Options required by the route table; CORE-02c resolves optional defaults. */
|
|
@@ -7,7 +7,7 @@ import type { Snapshot, VerdictCode } from './snapshot.js';
|
|
|
7
7
|
export type ArmIssueCode = 'weights-total' | 'control-count' | 'control-first' | 'holdout-last' | 'holdout-count' | 'variant-count' | 'duplicate-key' | 'duplicate-slot' | 'slot-required' | 'invalid-key';
|
|
8
8
|
/** Content-report dismiss/restore refusals (CORE-44). */
|
|
9
9
|
export type ContentEntryRefusal = 'not-decided' | 'entry-not-found' | 'entry-ok' | 'entry-dismissed' | 'entry-not-dismissed';
|
|
10
|
-
export type RefusalCode = ArmIssueCode | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | 'invalid-status' | 'stale-draft' | 'stale-edit' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
|
|
10
|
+
export type RefusalCode = ArmIssueCode | 'copy-unavailable' | 'copy-not-enabled' | 'copy-no-access' | 'copy-unique-field' | 'copy-orphaned' | 'transaction-lost' | 'nested-tests' | 'goal-in-some-versions' | 'placement-unchecked' | 'placement-unpublished' | 'duplicate-version-row' | 'interacting-tests' | 'placements-changed' | 'page-busy' | 'wrap-target-missing' | 'version-identical' | 'version-same-address' | 'unknown-collection' | 'not-found' | ContentEntryRefusal | 'no-planned-duration' | 'no-primary-metric' | 'no-placements' | 'placement-removed' | 'empty-slot' | 'page-in-use' | 'page-no-targets' | 'page-target-unpublished' | 'page-user-unit' | 'version-page-unavailable' | 'version-page-unchecked' | 'flag-no-point' | 'flag-params-invalid' | 'flag-point-busy' | 'flag-placement-missing' | 'layer-full' | 'layer-unit-mismatch' | 'unknown-metric-source' | 'unit-source-mismatch' | 'no-reach-per-day' | 'invalid-status' | 'first-start-only' | 'stale-draft' | 'stale-edit' | 'round-changed' | 'commit-unverified' | 'allocation-lower' | 'confirmation-required' | 'invalid-winner' | 'slices-taken' | 'locked-placement' | 'not-implemented' | 'forbidden' | 'unauthenticated' | 'body-too-large' | 'invalid-body' | 'too-many-ids' | 'invalid-phase' | 'invalid-ids' | 'recompute-failed' | 'analysis-failed' | 'undeclared-targeting-key' | 'invalid-targeting-rule' | 'block-path-rule' | 'duplicate-metric';
|
|
11
11
|
export type ErrorEnvelope = {
|
|
12
12
|
errors: Array<{
|
|
13
13
|
code: RefusalCode;
|
|
@@ -19,8 +19,31 @@ export type TransitionSuccess = {
|
|
|
19
19
|
doc: Record<string, unknown>;
|
|
20
20
|
revision: number;
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
23
|
-
|
|
22
|
+
export type StartExperimentWarning = {
|
|
23
|
+
metricId: DocId;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
export type StartExperimentFirstStartDetail = {
|
|
27
|
+
status: Status;
|
|
28
|
+
phase: number;
|
|
29
|
+
};
|
|
30
|
+
export type StartExperimentResult = {
|
|
31
|
+
status: 'started';
|
|
32
|
+
phase: number;
|
|
33
|
+
revision: number;
|
|
34
|
+
warnings: StartExperimentWarning[];
|
|
35
|
+
} | {
|
|
36
|
+
status: 'refused';
|
|
37
|
+
code: 'first-start-only';
|
|
38
|
+
message: string;
|
|
39
|
+
detail: StartExperimentFirstStartDetail;
|
|
40
|
+
} | {
|
|
41
|
+
status: 'refused';
|
|
42
|
+
code: Exclude<RefusalCode, 'not-found' | 'commit-unverified' | 'first-start-only'> | 'transaction-open';
|
|
43
|
+
message: string;
|
|
44
|
+
detail?: unknown;
|
|
45
|
+
} | {
|
|
46
|
+
status: 'not-found';
|
|
24
47
|
};
|
|
25
48
|
export type AddMetricWarning = {
|
|
26
49
|
code: 'goal-in-some-versions' | 'goal-added-mid-test' | 'placement-unchecked';
|
|
@@ -29,16 +52,23 @@ export type AddMetricWarning = {
|
|
|
29
52
|
export type AddMetricResult = TransitionSuccess & {
|
|
30
53
|
warnings: AddMetricWarning[];
|
|
31
54
|
};
|
|
32
|
-
export type AddMetricBody = {
|
|
55
|
+
export type AddMetricBody = RoundBody & {
|
|
33
56
|
metric: DocId;
|
|
34
57
|
role: 'secondary' | 'guardrail';
|
|
35
58
|
};
|
|
36
|
-
|
|
59
|
+
/** When omitted, the action applies to the current round. */
|
|
60
|
+
export type RoundBody = {
|
|
61
|
+
phase?: number;
|
|
62
|
+
};
|
|
63
|
+
export type AllocateBody = RoundBody & {
|
|
64
|
+
allocation: number;
|
|
65
|
+
};
|
|
66
|
+
export type DecideBody = RoundBody & {
|
|
37
67
|
winnerArm: string;
|
|
38
68
|
note?: string;
|
|
39
69
|
confirmation?: string;
|
|
40
70
|
};
|
|
41
|
-
export type ArchiveBody = {
|
|
71
|
+
export type ArchiveBody = RoundBody & {
|
|
42
72
|
mode: 'stopped' | 'after-content' | 'discard' | 'hard-coded';
|
|
43
73
|
confirmation?: string;
|
|
44
74
|
};
|
|
@@ -64,10 +94,23 @@ export type MakeContentResult = TransitionSuccess & {
|
|
|
64
94
|
}>;
|
|
65
95
|
};
|
|
66
96
|
export type PreflightResult = {
|
|
97
|
+
/** Saved document version used for these checks. */
|
|
98
|
+
document?: {
|
|
99
|
+
status: Status;
|
|
100
|
+
phase?: number;
|
|
101
|
+
updatedAt?: string;
|
|
102
|
+
};
|
|
103
|
+
/** Content language selection and labels when block placements are localized. */
|
|
104
|
+
contentLocales?: {
|
|
105
|
+
selected: string;
|
|
106
|
+
labels: Record<string, string>;
|
|
107
|
+
};
|
|
67
108
|
goalNotes?: Array<{
|
|
68
109
|
metricId: DocId;
|
|
69
110
|
message: string;
|
|
70
111
|
}>;
|
|
112
|
+
/** Advisory only. This does not affect Start readiness. */
|
|
113
|
+
browserWritablePrimaryId?: DocId;
|
|
71
114
|
checks: Array<{
|
|
72
115
|
code: ReadinessCode;
|
|
73
116
|
ok: boolean;
|
|
@@ -91,10 +134,12 @@ export type PreflightResult = {
|
|
|
91
134
|
title: string;
|
|
92
135
|
locales?: string[];
|
|
93
136
|
allLocales?: true;
|
|
137
|
+
localeCodes?: string[];
|
|
94
138
|
slotCount?: number;
|
|
95
139
|
url?: string;
|
|
96
140
|
editorUrl?: string;
|
|
97
141
|
slots?: Record<ArmSlot, number>;
|
|
142
|
+
partlyFilledSlots?: ArmSlot[];
|
|
98
143
|
ok: boolean;
|
|
99
144
|
detail?: string;
|
|
100
145
|
}>;
|
|
@@ -119,6 +164,7 @@ export interface PhaseSummary {
|
|
|
119
164
|
phaseKind: 'test' | 'rollout';
|
|
120
165
|
startedAt: string;
|
|
121
166
|
endedAt: string | null;
|
|
167
|
+
plannedDurationDays?: number;
|
|
122
168
|
arms: Array<{
|
|
123
169
|
key: string;
|
|
124
170
|
label: string;
|
|
@@ -130,6 +176,7 @@ export interface PhaseSummary {
|
|
|
130
176
|
kind: MetricSource['kind'];
|
|
131
177
|
role: 'primary' | 'secondary' | 'guardrail';
|
|
132
178
|
clickGoal?: true;
|
|
179
|
+
browserWritable?: true;
|
|
133
180
|
resolvedCap?: number | null;
|
|
134
181
|
historyUnits?: number;
|
|
135
182
|
capNotice?: 'no-history';
|
|
@@ -186,16 +233,13 @@ export type EventBody = {
|
|
|
186
233
|
attributes?: Record<string, string | number | boolean>;
|
|
187
234
|
}>;
|
|
188
235
|
};
|
|
189
|
-
export type AccessKind = 'manage' | 'readResults' | 'surface' | 'manifestKey' | '
|
|
236
|
+
export type AccessKind = 'manage' | 'readResults' | 'surface' | 'manifestKey' | 'browserEvents';
|
|
190
237
|
export type EndpointContext<TUser extends {
|
|
191
238
|
id: string | number;
|
|
192
239
|
} = {
|
|
193
240
|
id: string | number;
|
|
194
241
|
}> = {
|
|
195
242
|
options: ResolvedOptions<TUser>;
|
|
196
|
-
unit?: {
|
|
197
|
-
visitorId: string;
|
|
198
|
-
};
|
|
199
243
|
};
|
|
200
244
|
export type ClickKeysResult = {
|
|
201
245
|
keys: Array<{
|
|
@@ -204,15 +248,25 @@ export type ClickKeysResult = {
|
|
|
204
248
|
label: string;
|
|
205
249
|
}>;
|
|
206
250
|
};
|
|
251
|
+
export type PageRow = {
|
|
252
|
+
id: DocId;
|
|
253
|
+
title: string;
|
|
254
|
+
path: string | null;
|
|
255
|
+
pathKey: string | null;
|
|
256
|
+
published: boolean;
|
|
257
|
+
address?: string;
|
|
258
|
+
draftAddress?: string;
|
|
259
|
+
status?: 'published' | 'draft' | 'changed';
|
|
260
|
+
updatedAt?: string;
|
|
261
|
+
editor?: 'puck' | 'blocks';
|
|
262
|
+
editorUrl?: string;
|
|
263
|
+
};
|
|
207
264
|
export type PagesResult = {
|
|
208
|
-
docs:
|
|
209
|
-
id: DocId;
|
|
210
|
-
title: string;
|
|
211
|
-
path: string | null;
|
|
212
|
-
pathKey: string | null;
|
|
213
|
-
published: boolean;
|
|
214
|
-
}>;
|
|
265
|
+
docs: PageRow[];
|
|
215
266
|
hasNextPage: boolean;
|
|
267
|
+
pageLimitReached?: boolean;
|
|
268
|
+
totalDocs?: number;
|
|
269
|
+
pagingCounter?: number;
|
|
216
270
|
};
|
|
217
271
|
export type PlacementStatusBody = {
|
|
218
272
|
docs?: Array<{
|
|
@@ -228,6 +282,7 @@ export type PageTestStatus = {
|
|
|
228
282
|
role: 'original' | 'version';
|
|
229
283
|
winner: boolean;
|
|
230
284
|
armLabel: string;
|
|
285
|
+
controlLabel?: string;
|
|
231
286
|
winnerLabel?: string;
|
|
232
287
|
winnerTitle?: string;
|
|
233
288
|
winnerPath?: string;
|
|
@@ -295,3 +350,20 @@ export type DeleteImpactResult = {
|
|
|
295
350
|
addresses: string[];
|
|
296
351
|
afterPaths?: Record<string, string>;
|
|
297
352
|
};
|
|
353
|
+
export type CopyPagePlan = {
|
|
354
|
+
title: string;
|
|
355
|
+
path: string;
|
|
356
|
+
phase: number;
|
|
357
|
+
updatedAt: string;
|
|
358
|
+
originalId: DocId;
|
|
359
|
+
originalUpdatedAt: string;
|
|
360
|
+
};
|
|
361
|
+
export type CopyPageResult = {
|
|
362
|
+
doc: Record<string, unknown>;
|
|
363
|
+
copy: {
|
|
364
|
+
id: DocId;
|
|
365
|
+
title: string;
|
|
366
|
+
path: string;
|
|
367
|
+
editorUrl: string;
|
|
368
|
+
};
|
|
369
|
+
};
|
package/dist/types/endpoints.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -2,15 +2,21 @@ import type { Payload } from 'payload';
|
|
|
2
2
|
import type { NextRequest } from 'next/server';
|
|
3
3
|
import type { Attributes } from './contracts.js';
|
|
4
4
|
import type { Manifest } from './manifest.js';
|
|
5
|
+
type CookieOptions = {
|
|
6
|
+
name?: string;
|
|
7
|
+
maxAgeDays?: number;
|
|
8
|
+
/** Reject pre-rc.9 visitor IDs, including upgraded cookies, starting on this UTC date. Can only shorten the release cutoff. */
|
|
9
|
+
legacyCutoff?: string;
|
|
10
|
+
domain?: string;
|
|
11
|
+
/** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
12
|
+
consent?(req: NextRequest): boolean;
|
|
13
|
+
};
|
|
5
14
|
export interface ExperimentsProxyRuntimeOptions {
|
|
6
15
|
secret: string | string[];
|
|
7
16
|
apiRoute: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
domain?: string; /** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
12
|
-
consent?(req: NextRequest): boolean;
|
|
13
|
-
};
|
|
17
|
+
/** Limit new visitor IDs by trusted client address, or pass false when protected upstream. */
|
|
18
|
+
rateLimitUnit: false | ((req: NextRequest) => boolean | Promise<boolean>);
|
|
19
|
+
cookie?: CookieOptions;
|
|
14
20
|
loadManifest?: (opts?: {
|
|
15
21
|
ifRevision?: number;
|
|
16
22
|
}) => Promise<Manifest | 'not-modified' | null>;
|
|
@@ -27,11 +33,10 @@ export interface ExperimentsProxyRuntimeOptions {
|
|
|
27
33
|
export interface ExperimentsProxyRuntime {
|
|
28
34
|
readonly secrets: readonly string[];
|
|
29
35
|
readonly apiRoute: string;
|
|
30
|
-
readonly
|
|
36
|
+
readonly rateLimitUnit: ExperimentsProxyRuntimeOptions['rateLimitUnit'];
|
|
37
|
+
readonly cookie: CookieOptions & {
|
|
31
38
|
name: string;
|
|
32
39
|
maxAgeDays: number;
|
|
33
|
-
domain?: string; /** Called with a request whose URL is a placeholder outside the proxy; read cookies and headers only. */
|
|
34
|
-
consent?(req: NextRequest): boolean;
|
|
35
40
|
};
|
|
36
41
|
readonly loadManifest?: ExperimentsProxyRuntimeOptions['loadManifest'];
|
|
37
42
|
readonly getUnit?: ExperimentsProxyRuntimeOptions['getUnit'];
|
|
@@ -57,3 +62,4 @@ export interface ExperimentsServerRuntime<TUser extends {
|
|
|
57
62
|
userIdOf: NonNullable<ExperimentsServerRuntimeOptions<TUser>['userIdOf']>;
|
|
58
63
|
attributesOf: NonNullable<ExperimentsServerRuntimeOptions<TUser>['attributesOf']>;
|
|
59
64
|
}
|
|
65
|
+
export {};
|
package/dist/types/snapshot.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type SnapshotHealth = {
|
|
|
12
12
|
id?: string | number;
|
|
13
13
|
path?: string;
|
|
14
14
|
};
|
|
15
|
+
} | {
|
|
16
|
+
code: 'rapid-browser-events';
|
|
15
17
|
};
|
|
16
18
|
import type { GaussianPrior } from '@delmaredigital/experiments-stats';
|
|
17
19
|
import type { DocId, MetricSource } from './contracts.js';
|
package/dist/types/surface.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type { DocId } from './contracts.js';
|
|
2
1
|
import type { SerializedAttributeKeys, SerializedFlagPoint, SerializedMetricSource } from './admin.js';
|
|
3
2
|
export type TestsRoute = 'home' | 'new' | 'test' | 'results' | 'goals' | 'goalNew' | 'goal';
|
|
3
|
+
export type BlockPageCollection = {
|
|
4
|
+
slug: string;
|
|
5
|
+
label: string;
|
|
6
|
+
editors: Array<'puck' | 'blocks'>;
|
|
7
|
+
};
|
|
4
8
|
export interface TestsSurfaceProps {
|
|
5
9
|
route: TestsRoute;
|
|
6
10
|
id?: string;
|
|
@@ -13,18 +17,12 @@ export interface TestsSurfaceProps {
|
|
|
13
17
|
userId?: string | number;
|
|
14
18
|
userCollection?: string;
|
|
15
19
|
isAdmin: boolean;
|
|
16
|
-
|
|
17
|
-
collection: string;
|
|
18
|
-
collectionLabel: string;
|
|
19
|
-
id: DocId;
|
|
20
|
-
title: string;
|
|
21
|
-
editorUrl: string;
|
|
22
|
-
editor: 'puck' | 'blocks';
|
|
23
|
-
}>;
|
|
20
|
+
blockPageCollections?: BlockPageCollection[];
|
|
24
21
|
pageCollections?: Array<{
|
|
25
22
|
slug: string;
|
|
26
23
|
label: string;
|
|
27
24
|
contentChecks: boolean;
|
|
25
|
+
copyEnabled?: true;
|
|
28
26
|
copyHint?: string;
|
|
29
27
|
copyUrl?: string;
|
|
30
28
|
copyLabel?: string;
|
package/dist/ui/ChipsInput.d.ts
CHANGED
|
@@ -9,5 +9,12 @@ export interface ChipsInputProps {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
id: string;
|
|
12
|
+
draft?: {
|
|
13
|
+
value: string;
|
|
14
|
+
change: (value: string) => void;
|
|
15
|
+
submit: (value: string) => void;
|
|
16
|
+
discard: () => void;
|
|
17
|
+
describedBy?: string;
|
|
18
|
+
};
|
|
12
19
|
}
|
|
13
|
-
export declare function ChipsInput({ value, onChange, label, description, help, error, placeholder, disabled, id }: ChipsInputProps): import("react").JSX.Element;
|
|
20
|
+
export declare function ChipsInput({ value, onChange, label, description, help, error, placeholder, disabled, id, draft: managedDraft }: ChipsInputProps): import("react").JSX.Element;
|
package/dist/ui/ChipsInput.js
CHANGED
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import './ui.css';
|
|
5
|
-
export function ChipsInput({ value, onChange, label, description, help = description, error, placeholder, disabled = false, id }) {
|
|
6
|
-
const [
|
|
5
|
+
export function ChipsInput({ value, onChange, label, description, help = description, error, placeholder, disabled = false, id, draft: managedDraft }) {
|
|
6
|
+
const [localDraft, setLocalDraft] = useState('');
|
|
7
|
+
const draft = managedDraft?.value ?? localDraft;
|
|
8
|
+
const setDraft = managedDraft?.change ?? setLocalDraft;
|
|
7
9
|
const input = useRef(null);
|
|
8
10
|
const commit = (text)=>{
|
|
9
11
|
if (disabled) return;
|
|
12
|
+
if (managedDraft) {
|
|
13
|
+
managedDraft.submit(text);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
10
16
|
const next = [
|
|
11
17
|
...new Set([
|
|
12
18
|
...value,
|
|
@@ -60,13 +66,20 @@ export function ChipsInput({ value, onChange, label, description, help = descrip
|
|
|
60
66
|
"aria-invalid": Boolean(error) || undefined,
|
|
61
67
|
"aria-describedby": [
|
|
62
68
|
help ? `${id}-description` : '',
|
|
63
|
-
error ? `${id}-error` : ''
|
|
69
|
+
error ? `${id}-error` : '',
|
|
70
|
+
managedDraft?.describedBy
|
|
64
71
|
].filter(Boolean).join(' ') || undefined,
|
|
65
72
|
onChange: (event)=>setDraft(event.target.value),
|
|
66
73
|
onBlur: ()=>{
|
|
67
74
|
if (draft.trim()) commit(draft);
|
|
68
75
|
},
|
|
69
76
|
onKeyDown: (event)=>{
|
|
77
|
+
if (event.key === 'Escape' && managedDraft && draft) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
managedDraft.discard();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
70
83
|
if (disabled || event.nativeEvent.isComposing) return;
|
|
71
84
|
if (event.key === 'Enter' || event.key === ',') {
|
|
72
85
|
event.preventDefault();
|
|
@@ -78,7 +91,7 @@ export function ChipsInput({ value, onChange, label, description, help = descrip
|
|
|
78
91
|
}
|
|
79
92
|
},
|
|
80
93
|
onPaste: (event)=>{
|
|
81
|
-
if (disabled) return;
|
|
94
|
+
if (disabled || managedDraft) return;
|
|
82
95
|
const pasted = event.clipboardData.getData('text');
|
|
83
96
|
if (!pasted.includes(',')) return;
|
|
84
97
|
event.preventDefault();
|
package/dist/ui/Dialog.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import './ui.css';
|
|
|
3
3
|
/** Native modal stays in its rendering document, including a Puck canvas iframe.
|
|
4
4
|
* `initialFocus="cancel"` targets the focusable control marked `data-dialog-cancel`.
|
|
5
5
|
*/
|
|
6
|
-
export declare function Dialog({ open, title, onClose, children, dismissible, initialFocus, className, headerActions, closeOnBackdrop }: {
|
|
6
|
+
export declare function Dialog({ open, title, descriptionId, onClose, children, dismissible, initialFocus, className, headerActions, closeOnBackdrop }: {
|
|
7
7
|
open: boolean;
|
|
8
8
|
className?: string;
|
|
9
9
|
headerActions?: ReactNode;
|
|
@@ -11,6 +11,25 @@ export declare function Dialog({ open, title, onClose, children, dismissible, in
|
|
|
11
11
|
dismissible?: boolean;
|
|
12
12
|
initialFocus?: 'cancel';
|
|
13
13
|
title: string;
|
|
14
|
-
|
|
14
|
+
descriptionId?: string;
|
|
15
|
+
onClose: () => void | false;
|
|
15
16
|
children: ReactNode;
|
|
16
17
|
}): import("react").JSX.Element;
|
|
18
|
+
export declare function ConfirmDialog({ open, title, description, children, error, busy, busyLabel, cancelLabel, onClose, confirm, secondaryAction }: {
|
|
19
|
+
open?: boolean;
|
|
20
|
+
title: string;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
error?: string | null;
|
|
24
|
+
busy?: boolean;
|
|
25
|
+
busyLabel?: string;
|
|
26
|
+
cancelLabel: string;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
secondaryAction?: ReactNode;
|
|
29
|
+
confirm?: {
|
|
30
|
+
label: string;
|
|
31
|
+
onClick: () => void | Promise<void>;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
destructive?: boolean;
|
|
34
|
+
};
|
|
35
|
+
}): import("react").JSX.Element;
|