@payloadcms/figma 0.1.0-alpha.0 → 0.1.0-alpha.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.
Files changed (320) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
  3. package/dist/adapters/asset-collection.js +242 -0
  4. package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
  5. package/dist/adapters/build-lambda-zip.js +111 -0
  6. package/dist/adapters/configureNextjsCache.d.ts +8 -0
  7. package/dist/adapters/configureNextjsCache.js +55 -0
  8. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
  9. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
  10. package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
  11. package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
  12. package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
  13. package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
  14. package/dist/adapters/deploy-output/isFile.d.ts +1 -0
  15. package/dist/adapters/deploy-output/isFile.js +4 -0
  16. package/dist/adapters/deploy-output/readJson.d.ts +1 -0
  17. package/dist/adapters/deploy-output/readJson.js +9 -0
  18. package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
  19. package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
  20. package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
  21. package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
  22. package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
  23. package/dist/adapters/deploy-output/resolveWithin.js +12 -0
  24. package/dist/adapters/fs-utils.d.ts +39 -0
  25. package/dist/adapters/fs-utils.js +135 -0
  26. package/dist/adapters/index.d.ts +4 -0
  27. package/dist/adapters/index.js +3 -0
  28. package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
  29. package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
  30. package/dist/adapters/nextjs.d.ts +12 -0
  31. package/dist/adapters/nextjs.js +67 -0
  32. package/dist/adapters/nitro.d.ts +8 -0
  33. package/dist/adapters/nitro.js +193 -0
  34. package/dist/adapters/secret-files.d.ts +25 -0
  35. package/dist/adapters/secret-files.js +50 -0
  36. package/dist/adapters/types.d.ts +42 -0
  37. package/dist/adapters/types.js +1 -0
  38. package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
  39. package/dist/adapters/vite.js +33 -0
  40. package/dist/api/check-project-subdomain-availability.d.ts +12 -0
  41. package/dist/api/check-project-subdomain-availability.js +32 -0
  42. package/dist/api/control-plane-error.d.ts +6 -0
  43. package/dist/api/control-plane-error.js +8 -0
  44. package/dist/api/control-plane-fetch.d.ts +7 -0
  45. package/dist/api/control-plane-fetch.js +37 -0
  46. package/dist/api/control-plane.d.ts +1 -9
  47. package/dist/api/control-plane.js +2 -48
  48. package/dist/api/create-project.d.ts +18 -0
  49. package/dist/api/create-project.js +37 -0
  50. package/dist/api/list-project-workspaces.d.ts +8 -0
  51. package/dist/api/list-project-workspaces.js +28 -0
  52. package/dist/api/project-resource-type.d.ts +1 -0
  53. package/dist/api/project-resource-type.js +1 -0
  54. package/dist/auth/headless-oauth-flow.d.ts +23 -0
  55. package/dist/auth/headless-oauth-flow.js +69 -0
  56. package/dist/auth/oauth-flow.d.ts +2 -0
  57. package/dist/auth/oauth-flow.js +13 -8
  58. package/dist/auth/token-store.d.ts +4 -1
  59. package/dist/auth/token-store.js +14 -0
  60. package/dist/auth/types.d.ts +12 -0
  61. package/dist/cli.d.ts +39 -0
  62. package/dist/cli.js +71 -36
  63. package/dist/commands/bootstrap.js +2 -1
  64. package/dist/commands/build-lambda-zip.js +1 -1
  65. package/dist/commands/deploy.d.ts +12 -0
  66. package/dist/commands/deploy.js +63 -25
  67. package/dist/commands/detect-project-resource-type.d.ts +3 -0
  68. package/dist/commands/detect-project-resource-type.js +28 -0
  69. package/dist/commands/init.d.ts +2 -2
  70. package/dist/commands/init.js +164 -79
  71. package/dist/commands/login.d.ts +11 -1
  72. package/dist/commands/login.js +66 -4
  73. package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
  74. package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
  75. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
  76. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
  77. package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
  78. package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
  79. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
  80. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
  81. package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
  82. package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
  83. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
  84. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
  85. package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
  86. package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
  87. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
  88. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
  89. package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
  90. package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
  91. package/dist/commands/prompt-to-create-project.d.ts +24 -0
  92. package/dist/commands/prompt-to-create-project.js +69 -0
  93. package/dist/commands/setup-agent.d.ts +12 -0
  94. package/dist/commands/setup-agent.js +123 -0
  95. package/dist/commands/write-project-configuration.d.ts +12 -0
  96. package/dist/commands/write-project-configuration.js +16 -0
  97. package/dist/db-content-api/generated/content-api-types.d.ts +661 -16
  98. package/dist/db-content-api/index.d.ts +3 -0
  99. package/dist/db-content-api/index.js +155 -161
  100. package/dist/db-content-api/utilities/clientVersionHeaders.d.ts +7 -0
  101. package/dist/db-content-api/utilities/clientVersionHeaders.js +15 -0
  102. package/dist/db-content-api/utilities/data/atomicOperations.d.ts +16 -0
  103. package/dist/db-content-api/utilities/data/atomicOperations.js +48 -0
  104. package/dist/db-content-api/utilities/data/convertRelationshipIds.d.ts +25 -0
  105. package/dist/db-content-api/utilities/data/convertRelationshipIds.js +109 -0
  106. package/dist/db-content-api/utilities/data/index.js +73 -57
  107. package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
  108. package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
  109. package/dist/db-content-api/utilities/data/isLocaleMap.d.ts +10 -0
  110. package/dist/db-content-api/utilities/data/isLocaleMap.js +13 -0
  111. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
  112. package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
  113. package/dist/db-content-api/utilities/data/resolveFieldLocalization.d.ts +18 -0
  114. package/dist/db-content-api/utilities/data/resolveFieldLocalization.js +21 -0
  115. package/dist/db-content-api/utilities/data/validateRelationships.js +19 -12
  116. package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
  117. package/dist/db-content-api/utilities/isRecord.js +19 -0
  118. package/dist/db-content-api/utilities/joins.d.ts +6 -8
  119. package/dist/db-content-api/utilities/joins.js +13 -22
  120. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
  121. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
  122. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
  123. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
  124. package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +21 -4
  125. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +118 -36
  126. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  127. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  128. package/dist/db-content-api/utilities/where.d.ts +3 -17
  129. package/dist/db-content-api/utilities/where.js +21 -21
  130. package/dist/exports/client.d.ts +2 -0
  131. package/dist/exports/client.js +2 -0
  132. package/dist/exports/views.d.ts +1 -0
  133. package/dist/exports/views.js +1 -0
  134. package/dist/imageSizeOptions.d.ts +23 -0
  135. package/dist/imageSizeOptions.js +26 -0
  136. package/dist/index.d.ts +2 -0
  137. package/dist/index.js +2 -0
  138. package/dist/lib/write-agent-config.d.ts +12 -0
  139. package/dist/lib/write-agent-config.js +52 -0
  140. package/dist/next/image-loader.d.ts +6 -0
  141. package/dist/next/image-loader.js +14 -0
  142. package/dist/oauth/components/LoginButton/index.js +66 -19
  143. package/dist/oauth/components/LoginButton/index.scss +121 -15
  144. package/dist/oauth/defaults.js +4 -1
  145. package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
  146. package/dist/oauth/index.js +8 -7
  147. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
  148. package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
  149. package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
  150. package/dist/plugin/build-config.d.ts +4 -2
  151. package/dist/plugin/build-config.js +95 -31
  152. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  153. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  154. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +8 -0
  155. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
  156. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
  157. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
  158. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
  159. package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
  160. package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
  161. package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
  162. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
  163. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  164. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
  165. package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
  166. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -0
  167. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  168. package/dist/plugin/cloud-limits/routes.d.ts +2 -0
  169. package/dist/plugin/cloud-limits/routes.js +4 -0
  170. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
  171. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
  172. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  173. package/dist/plugin/cloud-limits/shared.js +52 -0
  174. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
  175. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
  176. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
  177. package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
  178. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  179. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  180. package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
  181. package/dist/plugin/sandbox-upload-fetch.js +53 -0
  182. package/dist/skills/deploy-to-figma/SKILL.md +234 -0
  183. package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
  184. package/dist/storage-content-api/client-uploads/generate.js +2 -1
  185. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  186. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +27 -0
  187. package/dist/storage-content-api/index.js +1 -0
  188. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  189. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  190. package/dist/storage-content-api/staticHandler.js +2 -1
  191. package/dist/storage-content-api/types.d.ts +4 -1
  192. package/dist/translations/ar.d.ts +12 -0
  193. package/dist/translations/ar.js +12 -0
  194. package/dist/translations/az.d.ts +12 -0
  195. package/dist/translations/az.js +12 -0
  196. package/dist/translations/bg.d.ts +12 -0
  197. package/dist/translations/bg.js +12 -0
  198. package/dist/translations/bnBd.d.ts +12 -0
  199. package/dist/translations/bnBd.js +12 -0
  200. package/dist/translations/bnIn.d.ts +12 -0
  201. package/dist/translations/bnIn.js +12 -0
  202. package/dist/translations/ca.d.ts +12 -0
  203. package/dist/translations/ca.js +12 -0
  204. package/dist/translations/cs.d.ts +12 -0
  205. package/dist/translations/cs.js +12 -0
  206. package/dist/translations/da.d.ts +12 -0
  207. package/dist/translations/da.js +12 -0
  208. package/dist/translations/de.d.ts +12 -0
  209. package/dist/translations/de.js +12 -0
  210. package/dist/translations/en.d.ts +12 -0
  211. package/dist/translations/en.js +12 -0
  212. package/dist/translations/es.d.ts +12 -0
  213. package/dist/translations/es.js +12 -0
  214. package/dist/translations/et.d.ts +12 -0
  215. package/dist/translations/et.js +12 -0
  216. package/dist/translations/fa.d.ts +12 -0
  217. package/dist/translations/fa.js +12 -0
  218. package/dist/translations/fr.d.ts +12 -0
  219. package/dist/translations/fr.js +12 -0
  220. package/dist/translations/he.d.ts +12 -0
  221. package/dist/translations/he.js +12 -0
  222. package/dist/translations/hr.d.ts +12 -0
  223. package/dist/translations/hr.js +12 -0
  224. package/dist/translations/hu.d.ts +12 -0
  225. package/dist/translations/hu.js +12 -0
  226. package/dist/translations/hy.d.ts +12 -0
  227. package/dist/translations/hy.js +12 -0
  228. package/dist/translations/id.d.ts +12 -0
  229. package/dist/translations/id.js +12 -0
  230. package/dist/translations/index.d.ts +533 -0
  231. package/dist/translations/index.js +90 -0
  232. package/dist/translations/is.d.ts +12 -0
  233. package/dist/translations/is.js +12 -0
  234. package/dist/translations/it.d.ts +12 -0
  235. package/dist/translations/it.js +12 -0
  236. package/dist/translations/ja.d.ts +12 -0
  237. package/dist/translations/ja.js +12 -0
  238. package/dist/translations/ko.d.ts +12 -0
  239. package/dist/translations/ko.js +12 -0
  240. package/dist/translations/lt.d.ts +12 -0
  241. package/dist/translations/lt.js +12 -0
  242. package/dist/translations/lv.d.ts +12 -0
  243. package/dist/translations/lv.js +12 -0
  244. package/dist/translations/my.d.ts +12 -0
  245. package/dist/translations/my.js +12 -0
  246. package/dist/translations/nb.d.ts +12 -0
  247. package/dist/translations/nb.js +12 -0
  248. package/dist/translations/nl.d.ts +12 -0
  249. package/dist/translations/nl.js +12 -0
  250. package/dist/translations/pl.d.ts +12 -0
  251. package/dist/translations/pl.js +12 -0
  252. package/dist/translations/pt.d.ts +12 -0
  253. package/dist/translations/pt.js +12 -0
  254. package/dist/translations/ro.d.ts +12 -0
  255. package/dist/translations/ro.js +12 -0
  256. package/dist/translations/rs.d.ts +12 -0
  257. package/dist/translations/rs.js +12 -0
  258. package/dist/translations/rsLatin.d.ts +12 -0
  259. package/dist/translations/rsLatin.js +12 -0
  260. package/dist/translations/ru.d.ts +12 -0
  261. package/dist/translations/ru.js +12 -0
  262. package/dist/translations/sk.d.ts +12 -0
  263. package/dist/translations/sk.js +12 -0
  264. package/dist/translations/sl.d.ts +12 -0
  265. package/dist/translations/sl.js +12 -0
  266. package/dist/translations/sv.d.ts +12 -0
  267. package/dist/translations/sv.js +12 -0
  268. package/dist/translations/ta.d.ts +12 -0
  269. package/dist/translations/ta.js +12 -0
  270. package/dist/translations/th.d.ts +12 -0
  271. package/dist/translations/th.js +12 -0
  272. package/dist/translations/tr.d.ts +12 -0
  273. package/dist/translations/tr.js +12 -0
  274. package/dist/translations/uk.d.ts +12 -0
  275. package/dist/translations/uk.js +12 -0
  276. package/dist/translations/vi.d.ts +12 -0
  277. package/dist/translations/vi.js +12 -0
  278. package/dist/translations/zh.d.ts +12 -0
  279. package/dist/translations/zh.js +12 -0
  280. package/dist/translations/zhTw.d.ts +12 -0
  281. package/dist/translations/zhTw.js +12 -0
  282. package/dist/types.d.ts +11 -0
  283. package/dist/utils/assert-never.d.ts +1 -0
  284. package/dist/utils/assert-never.js +3 -0
  285. package/dist/utils/build-detection.d.ts +6 -1
  286. package/dist/utils/build-detection.js +68 -89
  287. package/dist/utils/deploy-adapter.d.ts +3 -35
  288. package/dist/utils/deploy-adapter.js +25 -14
  289. package/dist/utils/lambda-config.js +18 -23
  290. package/dist/utils/load-payload-config.d.ts +2 -2
  291. package/dist/utils/messages.js +24 -3
  292. package/dist/utils/next-image-loader-config.d.ts +2 -0
  293. package/dist/utils/next-image-loader-config.js +63 -0
  294. package/dist/utils/next-image-loader-file.d.ts +2 -0
  295. package/dist/utils/next-image-loader-file.js +11 -0
  296. package/dist/utils/payload-generate.d.ts +10 -0
  297. package/dist/utils/payload-generate.js +59 -0
  298. package/dist/utils/pnpm-builds.d.ts +14 -0
  299. package/dist/utils/pnpm-builds.js +125 -0
  300. package/dist/utils/s3-upload.js +4 -1
  301. package/package.json +31 -7
  302. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +0 -10
  303. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +0 -71
  304. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +0 -41
  305. package/dist/db-content-api/utilities/meta/buildMeta.js +0 -39
  306. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +0 -16
  307. package/dist/db-content-api/utilities/meta/buildPathTypes.js +0 -243
  308. package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +0 -12
  309. package/dist/db-content-api/utilities/meta/buildUniquePaths.js +0 -60
  310. package/dist/lib/download-skill.d.ts +0 -12
  311. package/dist/lib/download-skill.js +0 -77
  312. package/dist/utils/adapters/nextjs.d.ts +0 -8
  313. package/dist/utils/adapters/nextjs.js +0 -61
  314. package/dist/utils/adapters/nitro.d.ts +0 -8
  315. package/dist/utils/adapters/nitro.js +0 -172
  316. package/dist/utils/adapters/vite.js +0 -31
  317. package/dist/utils/asset-collection.js +0 -144
  318. package/dist/utils/build-lambda-zip.js +0 -90
  319. package/dist/utils/fs-utils.d.ts +0 -12
  320. package/dist/utils/fs-utils.js +0 -55
@@ -1,32 +1,53 @@
1
1
  // Built-in document fields the Content API manages itself (stored as columns and
2
2
  // injected into every schema). They must never be sent as declared fields, so any
3
- // top-level field with one of these names is dropped.
3
+ // top-level field with one of these names is dropped. This applies only to
4
+ // documents: blocks have no built-in fields, so a block field named `id` or
5
+ // `createdAt` is a real declared field and must be kept.
4
6
  const BUILT_IN_FIELD_NAMES = new Set([
5
7
  'createdAt',
6
8
  'id',
7
9
  'updatedAt'
8
10
  ]);
11
+ const BLOCK_TYPE_FIELD_NAME = 'blockType';
12
+ // The implicit block-type discriminator carried on every block row. It is not a
13
+ // declared block field, so it is injected into each block entity's paths.
14
+ const BLOCK_TYPE_FIELD = {
15
+ type: 'text',
16
+ hasMany: false,
17
+ localized: false,
18
+ unique: false
19
+ };
9
20
  export function buildDocumentSchema(config) {
10
- const collections = {};
11
- const blocksBySlug = new Map();
21
+ const globalBlocksBySlug = new Map();
12
22
  for (const block of config.blocks ?? []){
13
- blocksBySlug.set(block.slug, block);
23
+ globalBlocksBySlug.set(block.slug, block);
14
24
  }
25
+ const blockRegistry = {
26
+ blocksById: {},
27
+ globalBlocksBySlug,
28
+ idByBlock: new Map()
29
+ };
30
+ const collections = {};
15
31
  for (const collection of config.collections ?? []){
16
- collections[collection.slug] = buildCollectionSchema(collection.slug, collection.fields, blocksBySlug);
32
+ collections[collection.slug] = buildCollectionSchema(collection.slug, collection.fields, blockRegistry);
17
33
  }
18
34
  for (const global of config.globals ?? []){
19
35
  const slug = `_global-${global.slug}`;
20
- collections[slug] = buildCollectionSchema(slug, global.fields, blocksBySlug);
36
+ collections[slug] = buildCollectionSchema(slug, global.fields, blockRegistry);
21
37
  }
22
38
  return {
39
+ blocks: blockRegistry.blocksById,
23
40
  collections,
24
41
  version: 1
25
42
  };
26
43
  }
27
- function buildCollectionSchema(name, fields, blocksBySlug) {
44
+ function buildCollectionSchema(name, fields, blockRegistry) {
28
45
  const paths = {};
29
- collectPaths(fields, '', false, paths, blocksBySlug);
46
+ collectPaths(fields, paths, {
47
+ blockRegistry,
48
+ inBlock: false,
49
+ prefix: ''
50
+ });
30
51
  // `_payloadAutosave` marks a version as an autosave draft. The Content API wraps
31
52
  // version schemas under the `version` envelope, so this becomes `version._payloadAutosave`
32
53
  // there. This adds the field to both the document and document version schemas as there
@@ -44,24 +65,27 @@ function buildCollectionSchema(name, fields, blocksBySlug) {
44
65
  paths
45
66
  };
46
67
  }
47
- function collectPaths(fields, prefix, absorbed, paths, blocksBySlug) {
68
+ function collectPaths(fields, paths, context) {
69
+ const { prefix } = context;
48
70
  for (const field of fields){
49
71
  if (field.type === 'row' || field.type === 'collapsible' || field.type === 'group' && (!('name' in field) || !field.name)) {
50
- collectPaths(field.fields, prefix, absorbed, paths, blocksBySlug);
72
+ collectPaths(field.fields, paths, context);
51
73
  continue;
52
74
  }
53
75
  if (field.type === 'tabs') {
54
76
  for (const tab of field.tabs){
55
- const tabOwnLocalized = 'localized' in tab && tab.localized === true;
56
77
  if ('name' in tab && tab.name) {
57
78
  paths[`${prefix}${tab.name}`] = {
58
79
  type: 'group',
59
80
  hasMany: false,
60
- localized: tabOwnLocalized && !absorbed
81
+ localized: 'localized' in tab && tab.localized === true
61
82
  };
62
- collectPaths(tab.fields, `${prefix}${tab.name}.`, absorbed || tabOwnLocalized, paths, blocksBySlug);
83
+ collectPaths(tab.fields, paths, {
84
+ ...context,
85
+ prefix: `${prefix}${tab.name}.`
86
+ });
63
87
  } else {
64
- collectPaths(tab.fields, prefix, absorbed, paths, blocksBySlug);
88
+ collectPaths(tab.fields, paths, context);
65
89
  }
66
90
  }
67
91
  continue;
@@ -69,20 +93,21 @@ function collectPaths(fields, prefix, absorbed, paths, blocksBySlug) {
69
93
  if (field.type === 'ui' || !('name' in field) || !field.name) {
70
94
  continue;
71
95
  }
72
- collectNamedField(field, prefix, absorbed, paths, blocksBySlug);
96
+ collectNamedField(field, paths, context);
73
97
  }
74
98
  }
75
- function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
99
+ function collectNamedField(field, paths, context) {
100
+ const { inBlock, prefix } = context;
76
101
  if (!('name' in field) || !field.name) {
77
102
  return;
78
103
  }
79
- // Built-in fields are supplied by the Content API, never declared here.
80
- if (prefix === '' && BUILT_IN_FIELD_NAMES.has(field.name)) {
104
+ // Built-in fields are supplied by the Content API, never declared here. Blocks
105
+ // have no built-ins, so their fields are never pruned.
106
+ if (prefix === '' && !inBlock && BUILT_IN_FIELD_NAMES.has(field.name)) {
81
107
  return;
82
108
  }
83
109
  const path = `${prefix}${field.name}`;
84
- const localized = 'localized' in field && field.localized === true && !absorbed;
85
- const childAbsorbed = absorbed || 'localized' in field && field.localized === true;
110
+ const localized = 'localized' in field && field.localized === true;
86
111
  const hasMany = 'hasMany' in field ? Boolean(field.hasMany) : false;
87
112
  const unique = 'unique' in field ? Boolean(field.unique) : false;
88
113
  switch(field.type){
@@ -91,28 +116,19 @@ function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
91
116
  type: 'array',
92
117
  localized
93
118
  };
94
- collectPaths(field.fields, `${path}.`, childAbsorbed, paths, blocksBySlug);
119
+ collectPaths(field.fields, paths, {
120
+ ...context,
121
+ prefix: `${path}.`
122
+ });
95
123
  return;
96
124
  case 'blocks':
97
125
  {
126
+ const blocks = collectBlocks(field, context);
98
127
  paths[path] = {
99
128
  type: 'blocks',
129
+ blocks,
100
130
  localized
101
131
  };
102
- paths[`${path}.blockType`] = {
103
- type: 'text',
104
- hasMany: false,
105
- localized: false,
106
- unique: false
107
- };
108
- const blockFields = [];
109
- for (const block of field.blocks){
110
- const resolved = typeof block === 'string' ? blocksBySlug.get(block) : block;
111
- if (resolved) {
112
- blockFields.push(...resolved.fields);
113
- }
114
- }
115
- collectPaths(blockFields, `${path}.`, childAbsorbed, paths, blocksBySlug);
116
132
  return;
117
133
  }
118
134
  case 'checkbox':
@@ -127,6 +143,7 @@ function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
127
143
  case 'code':
128
144
  case 'email':
129
145
  case 'point':
146
+ case 'slug':
130
147
  case 'textarea':
131
148
  paths[path] = {
132
149
  type: field.type,
@@ -140,7 +157,10 @@ function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
140
157
  hasMany,
141
158
  localized
142
159
  };
143
- collectPaths(field.fields, `${path}.`, childAbsorbed, paths, blocksBySlug);
160
+ collectPaths(field.fields, paths, {
161
+ ...context,
162
+ prefix: `${path}.`
163
+ });
144
164
  return;
145
165
  case 'join':
146
166
  paths[path] = {
@@ -180,3 +200,65 @@ function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
180
200
  return;
181
201
  }
182
202
  }
203
+ function collectBlocks(field, context) {
204
+ const blocks = {};
205
+ // Each block type is stored as its own entity; the field records only the
206
+ // block-type -> entity-id mapping. This lets same-named fields across block
207
+ // types keep independent schemas instead of collapsing to one shape.
208
+ for (const ref of field.blocks){
209
+ const blockId = resolveBlockId(ref, context);
210
+ if (blockId != null) {
211
+ const slug = typeof ref === 'string' ? ref : ref.slug;
212
+ blocks[slug] = blockId;
213
+ }
214
+ }
215
+ return blocks;
216
+ }
217
+ // Resolves the block a field references (by inline config or slug), applying
218
+ // Payload's block-type resolution: a globally-registered block wins over a
219
+ // field-local inline block of the same slug. Returns the assigned entity id, or
220
+ // `null` when the slug cannot be resolved.
221
+ function resolveBlockId(ref, context) {
222
+ const { blockRegistry } = context;
223
+ const block = resolveBlockReferenceToBlock(ref, context);
224
+ if (block == null) {
225
+ return null;
226
+ }
227
+ const existingBlockId = blockRegistry.idByBlock.get(block);
228
+ if (existingBlockId != null) {
229
+ return existingBlockId;
230
+ }
231
+ const newBlockId = `block_${blockRegistry.idByBlock.size}`;
232
+ blockRegistry.idByBlock.set(block, newBlockId);
233
+ const newBlockPaths = {
234
+ [BLOCK_TYPE_FIELD_NAME]: {
235
+ ...BLOCK_TYPE_FIELD
236
+ }
237
+ };
238
+ // A block entity is its own path namespace, so prefixing resets here. A block
239
+ // entity is shared by every `blocks` field that references it — including a
240
+ // localized one — so it records each field's declared `localized` flag and
241
+ // lets the Content API resolve locale absorption per reference while walking
242
+ // the path. Everything collected below lives in a block, not a document.
243
+ collectPaths(block.fields, newBlockPaths, {
244
+ blockRegistry,
245
+ inBlock: true,
246
+ prefix: ''
247
+ });
248
+ blockRegistry.blocksById[newBlockId] = {
249
+ name: block.slug,
250
+ paths: newBlockPaths
251
+ };
252
+ return newBlockId;
253
+ }
254
+ function resolveBlockReferenceToBlock(ref, context) {
255
+ // Local blocks are stored inline in the field definition.
256
+ const slug = typeof ref === 'string' ? ref : ref.slug;
257
+ const localBlock = typeof ref === 'string' ? undefined : ref;
258
+ // Global blocks are stored as slugs that reference blocks
259
+ // defined at the config level.
260
+ const globalBlock = context.blockRegistry.globalBlocksBySlug.get(slug);
261
+ // Global blocks must take precedence. This mirrors existing Payload
262
+ // behavior.
263
+ return globalBlock ?? localBlock;
264
+ }
@@ -0,0 +1,3 @@
1
+ import type { Config, SanitizedConfig } from 'payload';
2
+ import type { DocumentSchemaWire } from './buildDocumentSchema.js';
3
+ export declare function getDocumentSchema(config: Config | SanitizedConfig): DocumentSchemaWire;
@@ -0,0 +1,24 @@
1
+ import { buildDocumentSchema } from './buildDocumentSchema.js';
2
+ // The schema built by `getDocumentSchema`, keyed by the config it was built from.
3
+ // Weakly held so a config discarded by HMR takes its schema with it.
4
+ let schemaByConfig = new WeakMap();
5
+ // Retrieves a document schema for the given config, building it if necessary.
6
+ // The last output is memoized, so if this config matches the last config we just return
7
+ // the previous output instead of rebuilding it.
8
+ export function getDocumentSchema(config) {
9
+ const existing = schemaByConfig.get(config);
10
+ if (existing != null) {
11
+ return existing;
12
+ }
13
+ const schema = buildDocumentSchema(config);
14
+ // Clear the cache of any previous config, so only the most recent one is held.
15
+ // This ensures that we never accidentally leak memory by holding on to more
16
+ // and more schemas if the configs are never garbage collected.
17
+ schemaByConfig = new WeakMap([
18
+ [
19
+ config,
20
+ schema
21
+ ]
22
+ ]);
23
+ return schema;
24
+ }
@@ -1,19 +1,5 @@
1
- import type { Where } from 'payload';
1
+ import type { Payload, Where } from 'payload';
2
2
  import type { components } from '../generated/content-api-types.js';
3
- type WhereClause = components['schemas']['WhereClause'];
4
- type ConvertOptions = {
5
- /** Internal flag to track if we're inside a logical operator (and/or) */
6
- insideLogicalOperator?: boolean;
7
- /** If true, transform 'parent' field to 'documentId' (used for version queries) */
8
- parentToDocumentId?: boolean;
9
- /**
10
- * If true, strip 'version.' prefix from field paths (used for version queries).
11
- *
12
- * Payload queries version content with paths like 'version._status.en', but Content API
13
- * stores version data directly in the 'data' column (not nested under 'version').
14
- * The 'version' wrapper is only added in API responses for client compatibility.
15
- */
16
- stripVersionPrefix?: boolean;
17
- };
18
- export declare function convertPayloadWhereToContentAPI(where: undefined | Where, options?: ConvertOptions): WhereClause;
3
+ type WhereClauseV1 = components['schemas']['WhereClauseV1'];
4
+ export declare function convertPayloadWhereToContentAPI(where: undefined | Where, payload: Payload, collectionSlug: string, isVersions: boolean): WhereClauseV1;
19
5
  export {};
@@ -1,4 +1,21 @@
1
- export function convertPayloadWhereToContentAPI(where, options = {}) {
1
+ import { stringifyIdsInWhere } from './meta/stringifyIdsInWhere.js';
2
+ // Payload's format: { fieldName: { operator: value }, and: [...], or: [...] }
3
+ // Content API expects: { and: [{ path, operator, value }], or: [{ path, operator, value }] }
4
+ //
5
+ // The format stays different. This allows the Content API to evolve its filter schema,
6
+ // for example to support composite types like Point, which are not lexicographically sortable.
7
+ // Semantics must remain identical to Payload.
8
+ export function convertPayloadWhereToContentAPI(where, payload, collectionSlug, isVersions) {
9
+ // Normalize id-bearing operands to the wire's string form (custom numeric ids), then
10
+ // convert Payload's where shape to the Content API's. The two steps are inseparable —
11
+ // every id filter must be coerced — so they live behind this single entry point.
12
+ return convertStructure(stringifyIdsInWhere(where, payload, collectionSlug, isVersions), {
13
+ insideLogicalOperator: false
14
+ });
15
+ }
16
+ // The structural Payload → Content API conversion. Assumes id operands have already been
17
+ // coerced to the wire's string form (see `convertPayloadWhereToContentAPI`).
18
+ function convertStructure(where, options) {
2
19
  // Empty where {} should be { and: [] } not undefined
3
20
  // Content API requires a where clause structure even for "no filter"
4
21
  if (!where || Object.keys(where).length === 0) {
@@ -10,7 +27,7 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
10
27
  for (const [key, value] of Object.entries(where)){
11
28
  const keyLower = key.toLowerCase();
12
29
  if (keyLower === 'and' || keyLower === 'or') {
13
- const nestedConditions = value.map((item)=>convertPayloadWhereToContentAPI(item, {
30
+ const nestedConditions = value.map((item)=>convertStructure(item, {
14
31
  ...options,
15
32
  insideLogicalOperator: true
16
33
  })).filter((condition)=>{
@@ -30,18 +47,7 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
30
47
  });
31
48
  }
32
49
  } else {
33
- // TODO: fix this in content api
34
- // WORKAROUND: Payload uses 'parent' for version queries, but Content API expects 'documentId'
35
- let fieldPath = key.replace(/__/g, '.');
36
- if (options.parentToDocumentId && key === 'parent') {
37
- fieldPath = 'documentId';
38
- }
39
- // Strip 'version.' prefix from field paths for version queries
40
- // Payload uses paths like 'version._status.en' but Content API stores version data
41
- // directly in the 'data' column, not nested under 'version'
42
- if (options.stripVersionPrefix && fieldPath.startsWith('version.')) {
43
- fieldPath = fieldPath.slice('version.'.length);
44
- }
50
+ const fieldPath = key.replace(/__/g, '.');
45
51
  // Convert field conditions: { fieldName: { operator: value } }
46
52
  // to: { path: fieldName, operator, value }
47
53
  // Handle Payload's shorthand: { fieldName: value } → { fieldName: { equals: value } }
@@ -53,7 +59,7 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
53
59
  conditions.push({
54
60
  operator: 'equals',
55
61
  path: fieldPath,
56
- value: fieldPath === 'id' && typeof value === 'number' ? String(value) : value
62
+ value
57
63
  });
58
64
  continue;
59
65
  }
@@ -78,12 +84,6 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
78
84
  if (finalValue === 'null') {
79
85
  finalValue = null;
80
86
  }
81
- // Content API stores all document IDs as strings.
82
- // Payload sends numeric values for collections with custom numeric ID fields,
83
- // so we must stringify to match.
84
- if (fieldPath === 'id' && typeof finalValue === 'number') {
85
- finalValue = String(finalValue);
86
- }
87
87
  conditions.push({
88
88
  operator: op,
89
89
  path: fieldPath,
@@ -2,3 +2,5 @@ export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
2
2
  export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
3
3
  export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
4
4
  export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
5
+ export { FigmaCloudLimitProvider } from '../plugin/cloud-limits/CloudLimitProvider/index.js';
6
+ export { FigmaCloudLimitSlugTracker } from '../plugin/cloud-limits/SlugTracker/index.js';
@@ -2,3 +2,5 @@ export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
2
2
  export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
3
3
  export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
4
4
  export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
5
+ export { FigmaCloudLimitProvider } from '../plugin/cloud-limits/CloudLimitProvider/index.js';
6
+ export { FigmaCloudLimitSlugTracker } from '../plugin/cloud-limits/SlugTracker/index.js';
@@ -0,0 +1 @@
1
+ export { LimitReachedView } from '../plugin/cloud-limits/LimitReachedView/index.js';
@@ -0,0 +1 @@
1
+ export { LimitReachedView } from '../plugin/cloud-limits/LimitReachedView/index.js';
@@ -0,0 +1,23 @@
1
+ import type { RequestInitCfPropertiesImage } from '@cloudflare/workers-types';
2
+ type CloudflareWorkerImageOptions = RequestInitCfPropertiesImage;
3
+ export declare const supportedCloudflareImageOptionKeys: readonly ["anim", "background", "blur", "border", "brightness", "compression", "contrast", "dpr", "fit", "flip", "format", "gamma", "gravity", "height", "metadata", "quality", "rotate", "saturation", "segment", "sharpen", "trim", "upscale", "width", "zoom"];
4
+ type SupportedCloudflareImageOptionKey = (typeof supportedCloudflareImageOptionKeys)[number];
5
+ type SupportedCloudflareImageOptions = Pick<CloudflareWorkerImageOptions, SupportedCloudflareImageOptionKey>;
6
+ type CloudflareImageSizeFormat = Exclude<NonNullable<SupportedCloudflareImageOptions['format']>, 'json' | 'svg'>;
7
+ type CloudflareImageSizeOptionsExceptFormat = Omit<SupportedCloudflareImageOptions, 'format'>;
8
+ /**
9
+ * Options accepted for a reusable Payload image-size preset.
10
+ *
11
+ * Presets can control the generated image, but cannot use remote overlays or
12
+ * forward authentication to an image origin. Formats that do not produce a
13
+ * supported stored image are also excluded.
14
+ */
15
+ export type CloudflareImageSizeOptions = {
16
+ format?: CloudflareImageSizeFormat;
17
+ } & CloudflareImageSizeOptionsExceptFormat;
18
+ declare module 'payload' {
19
+ interface RegisteredImageSizeOptions {
20
+ figma: CloudflareImageSizeOptions;
21
+ }
22
+ }
23
+ export {};
@@ -0,0 +1,26 @@
1
+ export const supportedCloudflareImageOptionKeys = [
2
+ 'anim',
3
+ 'background',
4
+ 'blur',
5
+ 'border',
6
+ 'brightness',
7
+ 'compression',
8
+ 'contrast',
9
+ 'dpr',
10
+ 'fit',
11
+ 'flip',
12
+ 'format',
13
+ 'gamma',
14
+ 'gravity',
15
+ 'height',
16
+ 'metadata',
17
+ 'quality',
18
+ 'rotate',
19
+ 'saturation',
20
+ 'segment',
21
+ 'sharpen',
22
+ 'trim',
23
+ 'upscale',
24
+ 'width',
25
+ 'zoom'
26
+ ];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { contentAPIAdapter } from './db-content-api/index.js';
2
+ export type { CloudflareImageSizeOptions } from './imageSizeOptions.js';
2
3
  export { figmaContentSystem } from './plugin/adapter.js';
3
4
  export type { FigmaContentSystemOptions } from './plugin/adapter.js';
4
5
  export { buildFigmaConfig } from './plugin/build-config.js';
5
6
  export type { FigmaConfig } from './plugin/build-config.js';
7
+ export { passesMakeViewerWriteGate } from './plugin/make-permission-access/make-permission-access.js';
package/dist/index.js CHANGED
@@ -4,3 +4,5 @@ export { contentAPIAdapter } from './db-content-api/index.js';
4
4
  export { figmaContentSystem } from './plugin/adapter.js';
5
5
  // Export buildConfig wrapper and its config type
6
6
  export { buildFigmaConfig } from './plugin/build-config.js';
7
+ // Export the Make permission predicate for slug-specific baseAccess overrides.
8
+ export { passesMakeViewerWriteGate } from './plugin/make-permission-access/make-permission-access.js';
@@ -0,0 +1,12 @@
1
+ export type WriteAgentConfigResult = {
2
+ agentsMd: 'appended' | 'created' | 'unchanged';
3
+ claudeMd: 'appended' | 'created' | 'unchanged';
4
+ };
5
+ /**
6
+ * Write the root AI-agent pointer files so assistants can find the Payload
7
+ * skill bundled in node_modules. Idempotent: creates when absent, appends the
8
+ * pointer when a file exists without it, and no-ops when already present.
9
+ */
10
+ export declare function writeAgentConfigFiles(args: {
11
+ projectDir: string;
12
+ }): Promise<WriteAgentConfigResult>;
@@ -0,0 +1,52 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ const SKILL_POINTER_PATH = 'node_modules/payload/skills/payload/SKILL.md';
4
+ const AGENTS_BLOCK = `# AI Agent
5
+
6
+ For any Payload-related work, reference the skill at
7
+ \`${SKILL_POINTER_PATH}\`.
8
+ `;
9
+ const CLAUDE_IMPORT = '@AGENTS.md';
10
+ /**
11
+ * Write the root AI-agent pointer files so assistants can find the Payload
12
+ * skill bundled in node_modules. Idempotent: creates when absent, appends the
13
+ * pointer when a file exists without it, and no-ops when already present.
14
+ */ export async function writeAgentConfigFiles(args) {
15
+ const agentsMd = await ensureFileContains({
16
+ content: AGENTS_BLOCK,
17
+ filePath: path.join(args.projectDir, 'AGENTS.md'),
18
+ marker: SKILL_POINTER_PATH
19
+ });
20
+ const claudeMd = await ensureFileContains({
21
+ content: `${CLAUDE_IMPORT}\n`,
22
+ filePath: path.join(args.projectDir, 'CLAUDE.md'),
23
+ marker: CLAUDE_IMPORT
24
+ });
25
+ return {
26
+ agentsMd,
27
+ claudeMd
28
+ };
29
+ }
30
+ async function ensureFileContains(args) {
31
+ const existing = await readFileOrNull(args.filePath);
32
+ if (existing === null) {
33
+ await fs.writeFile(args.filePath, args.content, 'utf8');
34
+ return 'created';
35
+ }
36
+ if (existing.includes(args.marker)) {
37
+ return 'unchanged';
38
+ }
39
+ const separator = existing.endsWith('\n') ? '\n' : '\n\n';
40
+ await fs.writeFile(args.filePath, `${existing}${separator}${args.content}`, 'utf8');
41
+ return 'appended';
42
+ }
43
+ async function readFileOrNull(filePath) {
44
+ try {
45
+ return await fs.readFile(filePath, 'utf8');
46
+ } catch (err) {
47
+ if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
48
+ return null;
49
+ }
50
+ throw err;
51
+ }
52
+ }
@@ -0,0 +1,6 @@
1
+ export type FigmaNextImageLoaderProps = {
2
+ quality?: number;
3
+ src: string;
4
+ width: number;
5
+ };
6
+ export declare function figmaNextImageLoader({ quality, src, width }: FigmaNextImageLoaderProps): string;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ const PAYLOAD_FILE_PATH_PATTERN = /^\/(?!\/)(?:.+\/)?api\/[^/]+\/file\/.+$/;
3
+ export function figmaNextImageLoader({ quality, src, width }) {
4
+ const [pathname, search = ''] = src.split('?');
5
+ if (!PAYLOAD_FILE_PATH_PATTERN.test(pathname)) {
6
+ return src;
7
+ }
8
+ const searchParams = new URLSearchParams(search);
9
+ searchParams.set('w', String(width));
10
+ if (quality !== undefined) {
11
+ searchParams.set('q', String(quality));
12
+ }
13
+ return `${pathname}?${searchParams}`;
14
+ }
@@ -6,6 +6,17 @@ import { getSearchParam } from '../../utils/getSearchParam.js';
6
6
  import { resolveParentTargetOrigin, setupIframeAutoLogin } from './iframeAutoLogin.js';
7
7
  import './index.scss';
8
8
  const baseClass = 'oauth-login';
9
+ const COLLECTION_SKELETON_KEYS = [
10
+ 'collection-1',
11
+ 'collection-2',
12
+ 'collection-3',
13
+ 'collection-4'
14
+ ];
15
+ const GLOBAL_SKELETON_KEYS = [
16
+ 'global-1',
17
+ 'global-2',
18
+ 'global-3'
19
+ ];
9
20
  // Max time we wait for the parent (figma.com) to respond with a code after
10
21
  // posting `mint-cms-oauth-code`. If we hit this without a reply, we assume
11
22
  // the parent isn't going to respond and fall back to the manual login button.
@@ -49,6 +60,57 @@ const FigmaIcon = ()=>/*#__PURE__*/ _jsx("svg", {
49
60
  fillRule: "evenodd"
50
61
  })
51
62
  });
63
+ const PayloadAdminLoadingShimmer = ()=>/*#__PURE__*/ _jsx("div", {
64
+ "aria-label": "Signing in",
65
+ "aria-live": "polite",
66
+ className: `${baseClass}__admin-shimmer`,
67
+ role: "status",
68
+ children: /*#__PURE__*/ _jsxs("div", {
69
+ "aria-hidden": "true",
70
+ className: `${baseClass}__admin-shimmer-main`,
71
+ children: [
72
+ /*#__PURE__*/ _jsxs("div", {
73
+ className: `${baseClass}__shimmer-heading-row`,
74
+ children: [
75
+ /*#__PURE__*/ _jsx("div", {
76
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-heading-icon`
77
+ }),
78
+ /*#__PURE__*/ _jsx("div", {
79
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-heading-label`
80
+ })
81
+ ]
82
+ }),
83
+ /*#__PURE__*/ _jsxs("div", {
84
+ className: `${baseClass}__shimmer-section`,
85
+ children: [
86
+ /*#__PURE__*/ _jsx("div", {
87
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-section-label`
88
+ }),
89
+ /*#__PURE__*/ _jsx("div", {
90
+ className: `${baseClass}__shimmer-card-grid`,
91
+ children: COLLECTION_SKELETON_KEYS.map((key)=>/*#__PURE__*/ _jsx("div", {
92
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-card`
93
+ }, key))
94
+ })
95
+ ]
96
+ }),
97
+ /*#__PURE__*/ _jsxs("div", {
98
+ className: `${baseClass}__shimmer-section`,
99
+ children: [
100
+ /*#__PURE__*/ _jsx("div", {
101
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-section-label`
102
+ }),
103
+ /*#__PURE__*/ _jsx("div", {
104
+ className: `${baseClass}__shimmer-card-grid`,
105
+ children: GLOBAL_SKELETON_KEYS.map((key)=>/*#__PURE__*/ _jsx("div", {
106
+ className: `${baseClass}__shimmer-block ${baseClass}__shimmer-card`
107
+ }, key))
108
+ })
109
+ ]
110
+ })
111
+ ]
112
+ })
113
+ });
52
114
  export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
53
115
  const { config: { admin: { user: userSlug }, routes: { api }, serverURL } } = useConfig();
54
116
  const [authorizeURL, setAuthorizeURL] = useState('');
@@ -150,26 +212,11 @@ export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
150
212
  endpointSlug
151
213
  ]);
152
214
  if (!shouldRenderButton) {
153
- // In the iframe auto-login window, show a "Signing in…" hint so the
154
- // user sees something is happening instead of a blank slot until the
155
- // flow either navigates them away or times out into the manual button.
215
+ // In the iframe auto-login window, show a Payload admin-shaped shimmer
216
+ // until the flow either navigates them away or times out into the manual
217
+ // button.
156
218
  if (isInIframe === true && !disabled) {
157
- return /*#__PURE__*/ _jsx("div", {
158
- className: baseClass,
159
- children: /*#__PURE__*/ _jsxs("div", {
160
- className: `${baseClass}__signing-in`,
161
- role: "status",
162
- children: [
163
- /*#__PURE__*/ _jsx("span", {
164
- children: "Signing in"
165
- }),
166
- /*#__PURE__*/ _jsx("div", {
167
- "aria-hidden": "true",
168
- className: `${baseClass}__spinner`
169
- })
170
- ]
171
- })
172
- });
219
+ return /*#__PURE__*/ _jsx(PayloadAdminLoadingShimmer, {});
173
220
  }
174
221
  return null;
175
222
  }