@delmaredigital/payload-experiments 0.4.0-rc.6 → 0.4.0-rc.7

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.
Files changed (135) hide show
  1. package/dist/admin/blocks/BlockPanel.js +6 -4
  2. package/dist/admin/blocks/inject.js +1 -0
  3. package/dist/admin/blocks/model.d.ts +3 -2
  4. package/dist/admin/blocks/model.js +8 -4
  5. package/dist/admin/copy/blocks.d.ts +3 -2
  6. package/dist/admin/copy/blocks.js +7 -6
  7. package/dist/admin/surface/ResultsRoute.js +2 -1
  8. package/dist/admin/surface/TestsHome.d.ts +2 -1
  9. package/dist/admin/surface/TestsHome.js +91 -37
  10. package/dist/admin/surface/TestsSurface.js +3 -0
  11. package/dist/admin/surface/home.model.d.ts +2 -0
  12. package/dist/admin/surface/newTest/PageWizard.js +1 -0
  13. package/dist/admin/surface/newTest/newTest.css +1 -1
  14. package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
  15. package/dist/admin/views/TestsSurfaceClient.js +11 -0
  16. package/dist/admin/views/buildSurfaceProps.js +10 -3
  17. package/dist/blocks/bindings.js +3 -2
  18. package/dist/blocks/placementLanguages.d.ts +7 -0
  19. package/dist/blocks/placementLanguages.js +27 -0
  20. package/dist/blocks/placementLocale.d.ts +21 -7
  21. package/dist/blocks/placementLocale.js +218 -67
  22. package/dist/db/appends.d.ts +13 -0
  23. package/dist/db/appends.js +49 -0
  24. package/dist/db/bulkPlacementRemoval.js +8 -4
  25. package/dist/endpoints/contentLocale.d.ts +6 -0
  26. package/dist/endpoints/contentLocale.js +15 -0
  27. package/dist/endpoints/deleteImpact.d.ts +6 -0
  28. package/dist/endpoints/deleteImpact.js +206 -0
  29. package/dist/endpoints/index.js +7 -0
  30. package/dist/endpoints/pages.js +7 -3
  31. package/dist/endpoints/placementStatus.js +6 -1
  32. package/dist/endpoints/preflight.d.ts +1 -1
  33. package/dist/endpoints/preflight.js +17 -2
  34. package/dist/exports/adminClient.d.ts +1 -1
  35. package/dist/exports/adminClient.js +1 -1
  36. package/dist/exports/index.d.ts +1 -1
  37. package/dist/goals/fairness.js +38 -31
  38. package/dist/hooks/blockRemovalRule.d.ts +2 -2
  39. package/dist/hooks/blockRemovalRule.js +16 -14
  40. package/dist/hooks/pageGuard.d.ts +3 -0
  41. package/dist/hooks/pageGuard.js +33 -23
  42. package/dist/hooks/puckNestedTests.d.ts +8 -0
  43. package/dist/hooks/puckNestedTests.js +36 -0
  44. package/dist/lib/placementPages.d.ts +2 -1
  45. package/dist/lib/placementPages.js +10 -2
  46. package/dist/manifest/compile.d.ts +2 -1
  47. package/dist/manifest/compile.js +5 -1
  48. package/dist/puck/ExperimentPicker.js +40 -37
  49. package/dist/puck/editor/ConfigureTestDrawer.d.ts +8 -4
  50. package/dist/puck/editor/ConfigureTestDrawer.js +4 -2
  51. package/dist/puck/editor/ExperimentSlotEditor.js +135 -104
  52. package/dist/puck/editor/LeftoverVersions.d.ts +1 -1
  53. package/dist/puck/editor/LeftoverVersions.js +40 -43
  54. package/dist/puck/editor/VersionBuilder.d.ts +18 -1
  55. package/dist/puck/editor/VersionBuilder.js +217 -39
  56. package/dist/puck/editor/blockClipboard.d.ts +16 -0
  57. package/dist/puck/editor/blockClipboard.js +20 -0
  58. package/dist/puck/editor/copy.d.ts +8 -1
  59. package/dist/puck/editor/copy.js +9 -1
  60. package/dist/puck/editor/editor.chrome.css +117 -3
  61. package/dist/puck/editor/editor.css +130 -8
  62. package/dist/puck/editor/editor.model.d.ts +2 -1
  63. package/dist/puck/editor/editor.model.js +2 -2
  64. package/dist/puck/editor/localPlacements.d.ts +1 -0
  65. package/dist/puck/editor/localPlacements.js +12 -0
  66. package/dist/puck/editor/placementsCache.d.ts +18 -12
  67. package/dist/puck/editor/placementsCache.js +52 -47
  68. package/dist/puck/editor/usePlacementNotice.d.ts +1 -1
  69. package/dist/puck/editor/usePlacementNotice.js +4 -3
  70. package/dist/puck/experimentSlug.d.ts +2 -0
  71. package/dist/puck/experimentSlug.js +3 -0
  72. package/dist/puck/nestedTestCopy.d.ts +8 -0
  73. package/dist/puck/nestedTestCopy.js +22 -0
  74. package/dist/puck/nestedTests.d.ts +17 -0
  75. package/dist/puck/nestedTests.js +30 -0
  76. package/dist/puck/slotConfig.d.ts +1 -1
  77. package/dist/puck/slotConfig.js +17 -4
  78. package/dist/puck/visibility.d.ts +2 -3
  79. package/dist/puck/visibility.js +11 -7
  80. package/dist/server/recordContentChange.js +34 -19
  81. package/dist/server/resolveExperimentData.js +2 -2
  82. package/dist/testSurface/PreviewLinks.js +6 -2
  83. package/dist/testSurface/api.d.ts +6 -3
  84. package/dist/testSurface/api.js +10 -6
  85. package/dist/testSurface/contentLocaleURL.d.ts +2 -0
  86. package/dist/testSurface/contentLocaleURL.js +3 -0
  87. package/dist/testSurface/copy/common.d.ts +4 -0
  88. package/dist/testSurface/copy/common.js +8 -4
  89. package/dist/testSurface/copy/languages.d.ts +11 -0
  90. package/dist/testSurface/copy/languages.js +7 -0
  91. package/dist/testSurface/copy/readiness.d.ts +1 -1
  92. package/dist/testSurface/copy/readiness.js +1 -1
  93. package/dist/testSurface/copy/testPage.d.ts +21 -0
  94. package/dist/testSurface/copy/testPage.js +21 -0
  95. package/dist/testSurface/placementLabel.d.ts +8 -0
  96. package/dist/testSurface/placementLabel.js +24 -0
  97. package/dist/testSurface/placements/placementLabels.d.ts +2 -0
  98. package/dist/testSurface/placements/placementLabels.js +2 -1
  99. package/dist/testSurface/results/results.css +1 -1
  100. package/dist/testSurface/surface/contracts.d.ts +2 -0
  101. package/dist/testSurface/surface/editorPlacement.d.ts +5 -0
  102. package/dist/testSurface/surface/editorPlacement.js +18 -0
  103. package/dist/testSurface/surface/pageBlock/pageBlock.model.js +2 -1
  104. package/dist/testSurface/surface/pageBlock/parts.js +24 -6
  105. package/dist/testSurface/surface/readiness/readiness.model.js +9 -2
  106. package/dist/testSurface/surface/results/useResults.d.ts +4 -1
  107. package/dist/testSurface/surface/test/DeleteTest.d.ts +15 -0
  108. package/dist/testSurface/surface/test/DeleteTest.js +171 -0
  109. package/dist/testSurface/surface/test/TestSurface.js +29 -9
  110. package/dist/testSurface/surface/useTestDocument.d.ts +2 -1
  111. package/dist/testSurface/surface/useTestDocument.js +20 -4
  112. package/dist/testSurface/useApi.d.ts +4 -1
  113. package/dist/transitions/checkStart.d.ts +4 -1
  114. package/dist/transitions/checkStart.js +117 -14
  115. package/dist/transitions/contentFields.js +9 -5
  116. package/dist/transitions/makeContent.js +5 -4
  117. package/dist/transitions/nestedPlacementNames.d.ts +5 -0
  118. package/dist/transitions/nestedPlacementNames.js +33 -0
  119. package/dist/transitions/pageVersions.js +3 -1
  120. package/dist/transitions/placementInteractions.js +7 -4
  121. package/dist/transitions/placements.d.ts +26 -1
  122. package/dist/transitions/placements.js +219 -56
  123. package/dist/transitions/preflightData.d.ts +2 -1
  124. package/dist/transitions/preflightData.js +66 -3
  125. package/dist/transitions/start.js +4 -1
  126. package/dist/types/endpoints.d.ts +35 -1
  127. package/dist/types/endpoints.js +1 -1
  128. package/dist/types/surface.d.ts +2 -0
  129. package/dist/ui/Button.js +2 -2
  130. package/dist/ui/Inputs.d.ts +4 -3
  131. package/dist/ui/Inputs.js +9 -9
  132. package/dist/ui/SelectControl.d.ts +33 -0
  133. package/dist/ui/SelectControl.js +504 -0
  134. package/dist/ui/ui.css +13 -5
  135. package/package.json +3 -2
@@ -1,3 +1,4 @@
1
+ import { placementLanguageSuffix } from '../testSurface/copy/languages.js';
1
2
  import { asymmetricGoal } from '../goals/fairness.js';
2
3
  import { checkArms } from '../collections/experiments/armInvariants.js';
3
4
  import { normalisePath } from '../runtime/normalisePath.js';
@@ -19,11 +20,82 @@ export const relationshipId = (value)=>value == null ? undefined : typeof value
19
20
  * pageTarget, holdout included, normalised the same way ('' is '/'). Occupancy and lock keys use this. */ export const pageTargetPaths = (arms)=>[
20
21
  ...new Set(arms.filter((arm)=>typeof arm.pageTarget === 'string').map((arm)=>normalisePath(arm.pageTarget)))
21
22
  ].sort();
22
- const placementDetail = ({ collection, id, title })=>({
23
+ const placementDetail = ({ collection, id, title, locales, allLocales, locale, localeLabel })=>({
23
24
  collection,
24
25
  id,
25
- title
26
+ title: `${title}${placementLanguageSuffix({
27
+ allLocales,
28
+ locales: locales?.length ? locales : locale ? [
29
+ localeLabel ?? locale
30
+ ] : undefined
31
+ })}`
26
32
  });
33
+ /** Group only the languages with this finding, independently for each page and
34
+ * finding payload. Single-language occurrence details keep their original shape. */ function placementDetails(findings, all, input, findingKey = (detail)=>JSON.stringify(detail)) {
35
+ const groups = new Map();
36
+ const ordered = [];
37
+ for (const { placement, detail } of findings){
38
+ if (!placement.locale) {
39
+ ordered.push({
40
+ placement,
41
+ detail,
42
+ languages: new Map(),
43
+ members: []
44
+ });
45
+ continue;
46
+ }
47
+ const key = JSON.stringify([
48
+ placement.collection,
49
+ String(placement.id),
50
+ findingKey(detail)
51
+ ]);
52
+ let group = groups.get(key);
53
+ if (!group) {
54
+ group = {
55
+ placement,
56
+ detail,
57
+ languages: new Map(),
58
+ members: []
59
+ };
60
+ groups.set(key, group);
61
+ ordered.push(group);
62
+ }
63
+ group.languages.set(placement.locale, placement.localeLabel ?? placement.locale);
64
+ group.members.push(placement);
65
+ }
66
+ return ordered.map(({ placement, detail, languages, members })=>{
67
+ if (!placement.locale) return {
68
+ ...placementDetail(placement),
69
+ ...detail
70
+ };
71
+ const page = all.filter((other)=>other.collection === placement.collection && String(other.id) === String(placement.id));
72
+ const configured = input.placementLocaleCodes ?? (page.some((other)=>other.allLocales) ? [
73
+ ...new Set(page.flatMap((other)=>other.locale ? [
74
+ other.locale
75
+ ] : []))
76
+ ] : undefined);
77
+ const allLocales = configured?.length && configured.every((code)=>languages.has(code)) ? true : undefined;
78
+ const names = [
79
+ ...languages.values()
80
+ ];
81
+ const title = (members.find((row)=>row.locale === input.placementLocale) ?? members.find((row)=>row.locale === input.placementDefaultLocale) ?? placement).title;
82
+ return {
83
+ ...placementDetail({
84
+ ...placement,
85
+ title,
86
+ locale: undefined,
87
+ allLocales,
88
+ locales: names
89
+ }),
90
+ ...allLocales ? {
91
+ allLocales: true
92
+ } : {
93
+ locales: names
94
+ },
95
+ ...detail
96
+ };
97
+ });
98
+ }
27
99
  const positive = (value)=>typeof value === 'number' && Number.isFinite(value) && value > 0;
28
100
  function invalidParams(arms, point) {
29
101
  return arms.flatMap((arm)=>{
@@ -118,27 +190,58 @@ function invalidParams(arms, point) {
118
190
  add('no-placements', placementRemoved || e.kind !== 'block' || !input.placementError && placements.length > 0, input.placementError);
119
191
  add('placement-removed', !placementRemoved);
120
192
  const unpublished = placements.filter((p)=>!p.published && !placements.some((other)=>other.published && other.collection === p.collection && String(other.id) === String(p.id)));
121
- add('placement-unpublished', unpublished.length === 0, unpublished.map(placementDetail));
193
+ add('placement-unpublished', unpublished.length === 0, placementDetails(unpublished.map((placement)=>({
194
+ placement,
195
+ detail: {}
196
+ })), placements, input));
197
+ const nested = placements.filter((p)=>p.published).flatMap((placement)=>(placement.nestedTests ?? []).map((detail)=>({
198
+ placement,
199
+ detail
200
+ })));
201
+ const seenPairs = new Set();
202
+ const uniqueNested = nested.filter(({ placement, detail })=>{
203
+ const key = JSON.stringify([
204
+ placement.collection,
205
+ String(placement.id),
206
+ placement.locale,
207
+ detail.outerSlug ?? detail.outer,
208
+ detail.innerSlug ?? detail.inner
209
+ ]);
210
+ if (seenPairs.has(key)) return false;
211
+ seenPairs.add(key);
212
+ return true;
213
+ });
214
+ add('nested-tests', nested.length === 0, placementDetails(uniqueNested, placements, input));
122
215
  const duplicates = placements.filter((p)=>p.published && p.duplicateRows);
123
- add('duplicate-version-row', duplicates.length === 0, duplicates.map(placementDetail));
124
- for (const p of placements.filter((p)=>p.published))for (const slot of p.identicalSlots ?? []){
125
- if (e.arms.some((a)=>a.slot === slot && a.kind !== 'holdout')) checks.push({
216
+ add('duplicate-version-row', duplicates.length === 0, placementDetails(duplicates.map((placement)=>({
217
+ placement,
218
+ detail: {}
219
+ })), placements, input));
220
+ const identical = placements.filter((p)=>p.published).flatMap((placement)=>(placement.identicalSlots ?? []).filter((slot)=>e.arms.some((arm)=>arm.slot === slot && arm.kind !== 'holdout')).map((arm)=>({
221
+ placement,
222
+ detail: {
223
+ arm
224
+ }
225
+ })));
226
+ for (const detail of placementDetails(identical, placements, input)){
227
+ const { arm, ...page } = detail;
228
+ checks.push({
126
229
  code: 'version-identical',
127
230
  ok: true,
128
231
  warning: true,
129
232
  detail: {
130
- arm: slot,
131
- collection: p.collection,
132
- id: p.id,
133
- title: p.title
233
+ arm,
234
+ ...page
134
235
  }
135
236
  });
136
237
  }
137
238
  const empty = placements.filter((placement)=>placement.published && e.arms.some((arm)=>arm.kind !== 'holdout' && (!arm.slot || !(placement.slots[arm.slot] > 0))));
138
- add('empty-slot', e.kind !== 'block' || empty.length === 0, empty.map((placement)=>({
139
- ...placementDetail(placement),
140
- slots: placement.slots
141
- })));
239
+ add('empty-slot', e.kind !== 'block' || empty.length === 0, placementDetails(empty.map((placement)=>({
240
+ placement,
241
+ detail: {
242
+ slots: placement.slots
243
+ }
244
+ })), placements, input, (detail)=>JSON.stringify(e.arms.filter((arm)=>arm.kind !== 'holdout' && (!arm.slot || !(detail.slots[arm.slot] > 0))).map((arm)=>arm.key))));
142
245
  add('make-content-unsupported', true);
143
246
  const localized = placements.find((placement)=>placement.localized);
144
247
  if (localized) Object.assign(checks[checks.length - 1], {
@@ -11,10 +11,14 @@
11
11
  const blocks = config.blocks ?? [];
12
12
  return fields.some((field)=>{
13
13
  if (seen.has(field)) return false;
14
- const branch = new Set(seen).add(field);
15
- if ('localized' in field && field.localized) return true;
16
- if ('tabs' in field && field.tabs.some((tab)=>tab.localized || hasLocalizedFields(tab.fields, config, branch))) return true;
17
- if ('fields' in field && hasLocalizedFields(field.fields, config, branch)) return true;
18
- return field.type === 'blocks' && contentBlocks(field, blocks).some((block)=>hasLocalizedFields(block.fields, config, branch));
14
+ seen.add(field);
15
+ try {
16
+ if ('localized' in field && field.localized) return true;
17
+ if ('tabs' in field && field.tabs.some((tab)=>tab.localized || hasLocalizedFields(tab.fields, config, seen))) return true;
18
+ if ('fields' in field && hasLocalizedFields(field.fields, config, seen)) return true;
19
+ return field.type === 'blocks' && contentBlocks(field, blocks).some((block)=>hasLocalizedFields(block.fields, config, seen));
20
+ } finally{
21
+ seen.delete(field);
22
+ }
19
23
  });
20
24
  }
@@ -1,3 +1,5 @@
1
+ import { placementReader } from '../blocks/placementLocale.js';
2
+ import { puckExperimentSlug } from '../puck/experimentSlug.js';
1
3
  import { puckVisibility, hiddenOnSizes, visibilitySizes } from '../puck/visibility.js';
2
4
  import { Forbidden, NotFound, ValidationError, Locked, commitTransaction, initTransaction, killTransaction } from 'payload';
3
5
  import { latestDraftContent, publishedContent as readPublishedContent } from '../db/publishedContent.js';
@@ -10,7 +12,7 @@ import { lockContentDefaults } from '../db/appends.js';
10
12
  import { pooledExecutor, txExecutor } from '../db/executor.js';
11
13
  import { currentTxid, txidStatus } from '../db/txid.js';
12
14
  import { buildAndStoreManifest } from '../manifest/compile.js';
13
- import { documentEditor, puckCollections } from '../options.js';
15
+ import { puckCollections } from '../options.js';
14
16
  import { contentDone } from '../contentDone.js';
15
17
  import { archive } from './archive.js';
16
18
  import { relationshipId } from './checkStart.js';
@@ -37,8 +39,7 @@ const object = (value)=>value !== null && typeof value === 'object' && !Array.is
37
39
  node
38
40
  ];
39
41
  if (object(node) && node.type === 'ExperimentSlot' && object(node.props)) {
40
- const ref = node.props.experiment;
41
- if ((typeof ref === 'string' ? ref : object(ref) ? ref.slug : undefined) === slug) {
42
+ if (puckExperimentSlug(node.props.experiment) === slug) {
42
43
  const content = node.props[slot];
43
44
  if (!Array.isArray(content)) throw new Error('The winning content slot is missing.');
44
45
  const selected = unwrap(content, slug, slot, visibility);
@@ -412,7 +413,7 @@ export async function makeContent(req, { experimentId, options }) {
412
413
  const drafts = Boolean(config?.versions && config.versions.drafts);
413
414
  const published = await readPublishedContent(req, collection, id);
414
415
  if (!published) throw new NotFound();
415
- const editor = documentEditor(options, collection, published);
416
+ const editor = placementReader(req, collection, options).read(published, 'all-locales').editor;
416
417
  const blockRegistration = options.blocks?.collections.find((r)=>r.slug === collection);
417
418
  const contentField = editor === 'blocks' ? blockRegistration?.field : field;
418
419
  if (!contentField) throw new Error('This content field is no longer configured.');
@@ -0,0 +1,5 @@
1
+ import type { PayloadRequest } from 'payload';
2
+ import type { BlockPlacement } from './placements.js';
3
+ /** Read through manager access, on both preflight and Start's locked rescan. */
4
+ export declare function nestedPlacementNames(req: PayloadRequest, placements: readonly BlockPlacement[]): Promise<Map<string, string>>;
5
+ export declare const nameNestedPlacements: (placements: readonly BlockPlacement[], names: ReadonlyMap<string, string>) => BlockPlacement[];
@@ -0,0 +1,33 @@
1
+ /** Read through manager access, on both preflight and Start's locked rescan. */ export async function nestedPlacementNames(req, placements) {
2
+ const slugs = [
3
+ ...new Set(placements.flatMap((p)=>(p.nestedTests ?? []).flatMap((pair)=>[
4
+ pair.outer,
5
+ pair.inner
6
+ ])))
7
+ ];
8
+ if (!slugs.length) return new Map();
9
+ const found = await req.payload.find({
10
+ collection: 'xp-experiments',
11
+ req,
12
+ overrideAccess: false,
13
+ depth: 0,
14
+ pagination: false,
15
+ where: {
16
+ slug: {
17
+ in: slugs
18
+ }
19
+ }
20
+ });
21
+ return new Map(found.docs.map((doc)=>[
22
+ String(doc.slug),
23
+ String(doc.name)
24
+ ]));
25
+ }
26
+ export const nameNestedPlacements = (placements, names)=>placements.map((p)=>({
27
+ ...p,
28
+ nestedTests: p.nestedTests?.map((pair)=>({
29
+ ...pair,
30
+ outer: names.get(pair.outer) ?? pair.outer,
31
+ inner: names.get(pair.inner) ?? pair.inner
32
+ }))
33
+ }));
@@ -1,3 +1,4 @@
1
+ import { placementReader } from '../blocks/placementLocale.js';
1
2
  import { safeError } from '../log.js';
2
3
  import { isDeepStrictEqual } from 'node:util';
3
4
  import { pageVersionContent } from '../db/pageContent.js';
@@ -17,10 +18,11 @@ export async function identicalPageVersions(req, collection, arms) {
17
18
  if (!page?.published) return null;
18
19
  const raw = await pageVersionContent(req, collection.slug, page.id);
19
20
  if (!raw || raw._status === 'draft') return null;
21
+ const reader = placementReader(req, collection.slug);
20
22
  return {
21
23
  arm,
22
24
  id: page.id,
23
- value: comparableContent(collection.contentOf(raw))
25
+ value: reader.documentViews.map((view)=>comparableContent(collection.contentOf(reader.read(raw, 'all-locales', view).doc)))
24
26
  };
25
27
  } catch (cause) {
26
28
  req.payload.logger.error({
@@ -1,3 +1,5 @@
1
+ import { placementDocumentPaths } from '../blocks/placementLocale.js';
2
+ import { sortLockKeys } from '../db/locks.js';
1
3
  import { placementPathContent, placementTests } from '../db/placements.js';
2
4
  import { lockPagePaths } from '../db/locks.js';
3
5
  import { normalisePath } from '../runtime/normalisePath.js';
@@ -42,12 +44,13 @@ export async function placementPaths(req, options, docs) {
42
44
  if (!registration) continue;
43
45
  const row = await placementPathContent(req, doc.collection, doc.id);
44
46
  if (!row || row._status === 'draft') continue;
45
- const path = registration.pathOf(row);
46
- if (path !== null) paths.add(normalisePath(path));
47
+ for (const path of placementDocumentPaths(req, doc.collection, [
48
+ row
49
+ ], 'all-locales', (doc)=>registration.pathOf(doc)))paths.add(normalisePath(path));
47
50
  }
48
- return [
51
+ return sortLockKeys([
49
52
  ...paths
50
- ].sort();
53
+ ]);
51
54
  }
52
55
  const active = (test)=>test.status === 'running' || test.status === 'decided';
53
56
  export async function placementInteractions(req, exec, options, experiment, paths) {
@@ -3,8 +3,18 @@ import type { Arm, DocId, FlagPoint, PreviewPlacement, ResolvedOptions } from '.
3
3
  import type { ArmSlot } from '../types/puck.js';
4
4
  import { type PlacementLocaleView } from '../blocks/placementLocale.js';
5
5
  export interface BlockPlacement extends PreviewPlacement {
6
+ nestedTests?: Array<{
7
+ outer: string;
8
+ inner: string;
9
+ outerSlug?: string;
10
+ innerSlug?: string;
11
+ }>;
6
12
  editor?: 'puck' | 'blocks' | 'page';
7
13
  doc?: Record<string, unknown>;
14
+ locales?: string[];
15
+ allLocales?: true;
16
+ locale?: string;
17
+ localeLabel?: string;
8
18
  slots: Record<ArmSlot, number>;
9
19
  duplicateRows?: boolean;
10
20
  identicalSlots?: string[];
@@ -25,7 +35,9 @@ interface ScanOptions {
25
35
  puckCollections: NonNullable<ResolvedOptions['puck']>['collections'];
26
36
  blocksCollections: NonNullable<ResolvedOptions['blocks']>['collections'];
27
37
  compareVersions?: boolean;
28
- /** Hook reads must see every placement and must never invoke nested access checks (CORE-21). */
38
+ /** Read the current visitor surface without fetching newer unpublished drafts. */
39
+ publishedOnly?: boolean;
40
+ /** Hooks and manager-authorized visitor-impact reads must see every placement (CORE-21). */
29
41
  pageGuard?: true;
30
42
  change?: PlacementChange;
31
43
  }
@@ -35,6 +47,19 @@ interface ScanOptions {
35
47
  export declare function hasOtherPublishedBlockPlacement(req: PayloadRequest, options: ResolvedOptions, slug: string, excluded: (collection: string, id: DocId, view: PlacementLocaleView, doc: Record<string, unknown> & {
36
48
  id: DocId;
37
49
  }) => boolean): Promise<boolean>;
50
+ interface PublishedBlockPlacement {
51
+ id: DocId;
52
+ editor: 'puck' | 'blocks';
53
+ slots: BlockPlacement['slots'];
54
+ locale?: string;
55
+ }
56
+ /** Visitor-impact scan: one published read per collection page. Resolve every
57
+ * visitor locale, including configured fallbacks; the endpoint groups by page.
58
+ */
59
+ export declare function publishedBlockPlacementPages(req: PayloadRequest, options: Pick<ResolvedOptions, 'puck' | 'blocks'>, slug: string): AsyncGenerator<{
60
+ collection: string;
61
+ placements: PublishedBlockPlacement[];
62
+ }>;
38
63
  /** Each matching ExperimentSlot is checked separately, including multiple slots
39
64
  * in one document: content elsewhere in the document cannot hide an empty slot.
40
65
  */