@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
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button, DialogBody, DialogCancel, DialogFooter, DialogHeader, DialogModal, useModal, useTranslation } from '@payloadcms/ui';
4
+ import { ExternalLinkIcon } from '../icons/ExternalLinkIcon.js';
5
+ import { cloudLimitDocumentCountModalSlug } from '../shared.js';
6
+ import './index.scss';
7
+ const baseClass = 'figma-cloud-limit-modal';
8
+ export function FigmaCloudLimitDocumentCountModal({ collectionLabel, collectionListURL, onRetry }) {
9
+ const { t } = useTranslation();
10
+ const { closeModal } = useModal();
11
+ return /*#__PURE__*/ _jsxs(DialogModal, {
12
+ size: "small",
13
+ slug: cloudLimitDocumentCountModalSlug,
14
+ children: [
15
+ /*#__PURE__*/ _jsx(DialogHeader, {
16
+ showClose: true,
17
+ title: t('figma:cloudLimitModalHeading')
18
+ }),
19
+ /*#__PURE__*/ _jsx(DialogBody, {
20
+ children: /*#__PURE__*/ _jsx("p", {
21
+ className: `${baseClass}__body`,
22
+ children: t('figma:cloudLimitModalBody')
23
+ })
24
+ }),
25
+ /*#__PURE__*/ _jsx(DialogFooter, {
26
+ children: /*#__PURE__*/ _jsxs("div", {
27
+ className: `${baseClass}__footer`,
28
+ children: [
29
+ collectionLabel && collectionListURL ? /*#__PURE__*/ _jsxs("a", {
30
+ className: `${baseClass}__review-btn`,
31
+ href: collectionListURL,
32
+ onClick: ()=>closeModal(cloudLimitDocumentCountModalSlug),
33
+ children: [
34
+ /*#__PURE__*/ _jsx("span", {
35
+ className: `${baseClass}__review-btn-label`,
36
+ children: t('figma:cloudLimitModalReviewCollection', {
37
+ collection: collectionLabel
38
+ })
39
+ }),
40
+ /*#__PURE__*/ _jsx(ExternalLinkIcon, {})
41
+ ]
42
+ }) : null,
43
+ /*#__PURE__*/ _jsxs("div", {
44
+ className: `${baseClass}__actions`,
45
+ children: [
46
+ /*#__PURE__*/ _jsx(DialogCancel, {
47
+ label: t('figma:cloudLimitModalConfirm')
48
+ }),
49
+ /*#__PURE__*/ _jsx(Button, {
50
+ buttonStyle: "primary",
51
+ margin: false,
52
+ onClick: ()=>{
53
+ closeModal(cloudLimitDocumentCountModalSlug);
54
+ onRetry();
55
+ },
56
+ size: "medium",
57
+ children: t('figma:cloudLimitModalRetry')
58
+ })
59
+ ]
60
+ })
61
+ ]
62
+ })
63
+ })
64
+ ]
65
+ });
66
+ }
@@ -0,0 +1,56 @@
1
+ .figma-cloud-limit-modal {
2
+ &__body {
3
+ margin: 0;
4
+ }
5
+
6
+ &__footer {
7
+ align-items: center;
8
+ display: flex;
9
+ gap: var(--spacer-4);
10
+ width: 100%;
11
+ }
12
+
13
+ &__review-btn {
14
+ align-items: center;
15
+ background: none;
16
+ border: none;
17
+ color: var(--color-text-brand);
18
+ cursor: pointer;
19
+ display: inline-flex;
20
+ flex-shrink: 1;
21
+ font-size: var(--text-body-medium-font-size);
22
+ gap: var(--spacer-1);
23
+ min-width: 0;
24
+ padding: 0;
25
+
26
+ .btn__content,
27
+ .btn__label {
28
+ min-width: 0;
29
+ }
30
+
31
+ &:hover {
32
+ color: var(--ramp-blue-700);
33
+ }
34
+
35
+ &:active {
36
+ color: var(--ramp-blue-800);
37
+ }
38
+ }
39
+
40
+ &__review-btn-label {
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ white-space: nowrap;
44
+ }
45
+
46
+ // Prevents the icon from shrinking when the label ellipses.
47
+ &__review-btn svg {
48
+ flex-shrink: 0;
49
+ }
50
+
51
+ &__actions {
52
+ display: flex;
53
+ gap: var(--spacer-2);
54
+ margin-inline-start: auto;
55
+ }
56
+ }
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function FigmaCloudLimitProvider({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,110 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { getTranslation } from '@payloadcms/translations';
4
+ import { FormErrorHandlerContext, useConfig, useFormErrorHandler, useModal, useTranslation } from '@payloadcms/ui';
5
+ import { DrawerDepthContext } from '@payloadcms/ui/elements/Drawer';
6
+ import { formatAdminURL, hasAutosaveEnabled } from 'payload/shared';
7
+ import { useCallback, useEffect, useRef, useState } from 'react';
8
+ import { FigmaCloudLimitDocumentCountModal } from '../CloudLimitModal/index.js';
9
+ import { cloudLimitDocumentCountModalSlug, cloudLimitErrorCodes, getCloudLimitErrorCode } from '../shared.js';
10
+ import { FigmaCloudLimitSlugRegistryContext } from '../SlugRegistryContext/index.js';
11
+ import { cloudLimitInterceptor } from '../utilities/cloudLimitInterceptor.js';
12
+ import { dismissSubmittingToast, showCloudLimitToast } from '../utilities/toasts.js';
13
+ export function FigmaCloudLimitProvider({ children }) {
14
+ const { openModal } = useModal();
15
+ const { i18n, t } = useTranslation();
16
+ const { config, getEntityConfig } = useConfig();
17
+ const parentErrorHandler = useFormErrorHandler();
18
+ const adminRoute = config.routes?.admin ?? '/admin';
19
+ const apiRoute = config.routes?.api ?? '/api';
20
+ const [modal, setModal] = useState({
21
+ drawerDepth: 0
22
+ });
23
+ const retryRef = useRef(undefined);
24
+ const registrationsRef = useRef([]);
25
+ const register = useCallback((registration)=>{
26
+ registrationsRef.current.push(registration);
27
+ return ()=>{
28
+ const index = registrationsRef.current.indexOf(registration);
29
+ if (index !== -1) {
30
+ registrationsRef.current.splice(index, 1);
31
+ }
32
+ };
33
+ }, []);
34
+ useEffect(()=>cloudLimitInterceptor(apiRoute, (key)=>t(key)), [
35
+ apiRoute,
36
+ t
37
+ ]);
38
+ const handleNonFieldError = useCallback((err, retry)=>{
39
+ const code = getCloudLimitErrorCode({
40
+ errors: [
41
+ err
42
+ ]
43
+ });
44
+ if (!code) {
45
+ return parentErrorHandler?.(err, retry) ?? false;
46
+ }
47
+ dismissSubmittingToast(t('general:submitting'));
48
+ if (code !== cloudLimitErrorCodes.documentCount) {
49
+ showCloudLimitToast(code, t);
50
+ return true;
51
+ }
52
+ const registrations = registrationsRef.current;
53
+ let activeRegistration;
54
+ for(let index = registrations.length - 1; index >= 0; index--){
55
+ if (registrations[index]?.isSubmitting) {
56
+ activeRegistration = registrations[index];
57
+ break;
58
+ }
59
+ }
60
+ activeRegistration ??= registrations[registrations.length - 1];
61
+ const adminPath = formatAdminURL({
62
+ adminRoute,
63
+ includeBasePath: true
64
+ });
65
+ const slug = activeRegistration?.slug ?? /^\/collections\/([^/?#]+)/.exec(window.location.pathname.slice(adminPath.length))?.[1];
66
+ const collectionConfig = slug ? getEntityConfig({
67
+ collectionSlug: slug
68
+ }) : undefined;
69
+ if (collectionConfig && hasAutosaveEnabled(collectionConfig)) {
70
+ showCloudLimitToast(code, t);
71
+ return true;
72
+ }
73
+ setModal({
74
+ collectionLabel: collectionConfig?.labels?.plural != null ? getTranslation(collectionConfig.labels.plural, i18n) : slug,
75
+ collectionListURL: slug ? formatAdminURL({
76
+ adminRoute,
77
+ includeBasePath: true,
78
+ path: `/collections/${slug}`
79
+ }) : undefined,
80
+ drawerDepth: activeRegistration?.drawerDepth ?? 0
81
+ });
82
+ retryRef.current = retry;
83
+ openModal(cloudLimitDocumentCountModalSlug);
84
+ return true;
85
+ }, [
86
+ adminRoute,
87
+ getEntityConfig,
88
+ i18n,
89
+ openModal,
90
+ parentErrorHandler,
91
+ t
92
+ ]);
93
+ return /*#__PURE__*/ _jsx(FigmaCloudLimitSlugRegistryContext, {
94
+ value: register,
95
+ children: /*#__PURE__*/ _jsxs(FormErrorHandlerContext, {
96
+ value: handleNonFieldError,
97
+ children: [
98
+ children,
99
+ /*#__PURE__*/ _jsx(DrawerDepthContext, {
100
+ value: modal.drawerDepth,
101
+ children: /*#__PURE__*/ _jsx(FigmaCloudLimitDocumentCountModal, {
102
+ collectionLabel: modal.collectionLabel,
103
+ collectionListURL: modal.collectionListURL,
104
+ onRetry: ()=>retryRef.current?.()
105
+ })
106
+ })
107
+ ]
108
+ })
109
+ });
110
+ }
@@ -0,0 +1,14 @@
1
+ .limit-hit-on-create {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ justify-content: center;
6
+ gap: var(--spacer-3);
7
+ min-block-size: calc(100dvh - var(--app-header-height, 0px));
8
+ }
9
+
10
+ .limit-hit-on-create__message {
11
+ margin: 0;
12
+ color: var(--color-text);
13
+ font-size: var(--text-body-medium-font-size);
14
+ }
@@ -0,0 +1,4 @@
1
+ import type { AdminViewServerProps } from 'payload';
2
+ import React from 'react';
3
+ import './index.css';
4
+ export declare const LimitReachedView: React.FC<AdminViewServerProps>;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getTranslation } from '@payloadcms/translations';
3
+ import { Button, SetStepNav } from '@payloadcms/ui';
4
+ import { formatAdminURL } from 'payload/shared';
5
+ import React from 'react';
6
+ import './index.css';
7
+ const baseClass = 'limit-hit-on-create';
8
+ export const LimitReachedView = ({ collectionConfig, initPageResult })=>{
9
+ const { req } = initPageResult;
10
+ const adminRoute = req.payload.config.routes.admin;
11
+ const tFigma = req.t;
12
+ if (!collectionConfig) {
13
+ return null;
14
+ }
15
+ const collectionLabel = getTranslation(collectionConfig.labels.plural, req.i18n);
16
+ const collectionListURL = formatAdminURL({
17
+ adminRoute,
18
+ includeBasePath: true,
19
+ path: `/collections/${collectionConfig.slug}`
20
+ });
21
+ return /*#__PURE__*/ _jsxs("main", {
22
+ className: baseClass,
23
+ children: [
24
+ /*#__PURE__*/ _jsx(SetStepNav, {
25
+ nav: [
26
+ {
27
+ label: collectionLabel,
28
+ url: collectionListURL
29
+ },
30
+ {
31
+ label: req.t('general:createNew')
32
+ }
33
+ ]
34
+ }),
35
+ /*#__PURE__*/ _jsx("p", {
36
+ className: `${baseClass}__message`,
37
+ children: tFigma('figma:cloudLimitDocumentCountError')
38
+ }),
39
+ /*#__PURE__*/ _jsx(Button, {
40
+ buttonStyle: "primary",
41
+ el: "link",
42
+ margin: false,
43
+ size: "medium",
44
+ url: formatAdminURL({
45
+ adminRoute,
46
+ includeBasePath: true
47
+ }),
48
+ children: req.t('general:backToDashboard')
49
+ })
50
+ ]
51
+ });
52
+ };
@@ -0,0 +1,7 @@
1
+ export type CollectionFormRegistration = {
2
+ drawerDepth: number;
3
+ isSubmitting: boolean;
4
+ slug: string | undefined;
5
+ };
6
+ export type RegisterCollectionForm = (registration: CollectionFormRegistration) => () => void;
7
+ export declare const FigmaCloudLimitSlugRegistryContext: import("react").Context<RegisterCollectionForm>;
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ import { createContext } from 'react';
3
+ export const FigmaCloudLimitSlugRegistryContext = /*#__PURE__*/ createContext(()=>()=>{});
@@ -0,0 +1 @@
1
+ export declare function FigmaCloudLimitSlugTracker(): null;
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { useDocumentInfo, useFormBackgroundProcessing, useFormProcessing } from '@payloadcms/ui';
3
+ import { useDrawerDepth } from '@payloadcms/ui/elements/Drawer';
4
+ import { use, useEffect } from 'react';
5
+ import { FigmaCloudLimitSlugRegistryContext } from '../SlugRegistryContext/index.js';
6
+ export function FigmaCloudLimitSlugTracker() {
7
+ const register = use(FigmaCloudLimitSlugRegistryContext);
8
+ const { collectionSlug } = useDocumentInfo();
9
+ const drawerDepth = useDrawerDepth();
10
+ const isBackgroundProcessing = useFormBackgroundProcessing();
11
+ const isProcessing = useFormProcessing();
12
+ useEffect(()=>{
13
+ const unregister = register({
14
+ slug: collectionSlug,
15
+ drawerDepth,
16
+ isSubmitting: isBackgroundProcessing || isProcessing
17
+ });
18
+ return unregister;
19
+ }, [
20
+ collectionSlug,
21
+ drawerDepth,
22
+ isBackgroundProcessing,
23
+ isProcessing,
24
+ register
25
+ ]);
26
+ return null;
27
+ }
@@ -0,0 +1,2 @@
1
+ /** External link icon (box with arrow pointing out). Used in cloud-limit UI. */
2
+ export declare function ExternalLinkIcon(): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /** External link icon (box with arrow pointing out). Used in cloud-limit UI. */ export function ExternalLinkIcon() {
4
+ return /*#__PURE__*/ _jsxs("svg", {
5
+ "aria-hidden": "true",
6
+ fill: "none",
7
+ height: "14",
8
+ stroke: "currentColor",
9
+ strokeLinecap: "round",
10
+ strokeLinejoin: "round",
11
+ strokeWidth: "2",
12
+ viewBox: "0 0 24 24",
13
+ width: "14",
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ children: [
16
+ /*#__PURE__*/ _jsx("path", {
17
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
18
+ }),
19
+ /*#__PURE__*/ _jsx("polyline", {
20
+ points: "15 3 21 3 21 9"
21
+ }),
22
+ /*#__PURE__*/ _jsx("line", {
23
+ x1: "10",
24
+ x2: "21",
25
+ y1: "14",
26
+ y2: "3"
27
+ })
28
+ ]
29
+ });
30
+ }
@@ -0,0 +1,2 @@
1
+ export declare const LIMIT_REACHED_VIEW_KEY = "figmaLimitReached";
2
+ export declare const LIMIT_REACHED_VIEW_PATH = "/limit-reached";
@@ -0,0 +1,4 @@
1
+ export const LIMIT_REACHED_VIEW_KEY = 'figmaLimitReached';
2
+ // Reserved collection-level admin route. Applications using custom string IDs must not use
3
+ // "limit-reached"; the custom view intentionally takes precedence over a document edit route.
4
+ export const LIMIT_REACHED_VIEW_PATH = '/limit-reached';
@@ -0,0 +1,9 @@
1
+ import type { Payload, PayloadRequest } from 'payload';
2
+ type Args = {
3
+ collectionSlug: string;
4
+ errorCode: unknown;
5
+ payload: Payload;
6
+ req?: Partial<Pick<PayloadRequest, 'pathname' | 'server'>>;
7
+ };
8
+ export declare function redirectInitialAutosaveCreate({ collectionSlug, errorCode, payload, req, }: Args): void;
9
+ export {};
@@ -0,0 +1,28 @@
1
+ import { formatAdminURL, hasAutosaveEnabled } from 'payload/shared';
2
+ import { LIMIT_REACHED_VIEW_PATH } from '../routes.js';
3
+ import { cloudLimitErrorCodes } from '../shared.js';
4
+ export function redirectInitialAutosaveCreate({ collectionSlug, errorCode, payload, req }) {
5
+ // Initial autosave creates an empty document, so documentDataSize is not expected in
6
+ // production. Keep it as a defensive/test-only fallback and intentionally route it
7
+ // through the same terminal create-failure view.
8
+ const isSupportedLimit = errorCode === cloudLimitErrorCodes.documentCount || errorCode === cloudLimitErrorCodes.documentDataSize;
9
+ const collectionConfig = payload.collections[collectionSlug]?.config;
10
+ const server = req?.server;
11
+ if (!isSupportedLimit || !collectionConfig || !server || !hasAutosaveEnabled(collectionConfig)) {
12
+ return;
13
+ }
14
+ const { admin: adminRoute } = payload.config.routes;
15
+ const createPath = formatAdminURL({
16
+ adminRoute,
17
+ includeBasePath: true,
18
+ path: `/collections/${collectionSlug}/create`
19
+ });
20
+ if (req.pathname?.replace(/\/$/, '') !== createPath.replace(/\/$/, '')) {
21
+ return;
22
+ }
23
+ server.redirect(formatAdminURL({
24
+ adminRoute,
25
+ includeBasePath: true,
26
+ path: `/collections/${collectionSlug}${LIMIT_REACHED_VIEW_PATH}`
27
+ }));
28
+ }
@@ -0,0 +1,10 @@
1
+ export declare const cloudLimitErrorCodes: {
2
+ readonly assetStorage: "cloud_limit.cms_assets_bytes_exceeded";
3
+ readonly documentCount: "cloud_limit.document_count_exceeded";
4
+ readonly documentDataSize: "cloud_limit.per_document_data_bytes_exceeded";
5
+ };
6
+ export type CloudLimitErrorCode = (typeof cloudLimitErrorCodes)[keyof typeof cloudLimitErrorCodes];
7
+ export declare function isCloudLimitErrorCode(code: unknown): code is CloudLimitErrorCode;
8
+ export declare function getCloudLimitErrorCode(json: unknown): CloudLimitErrorCode | undefined;
9
+ export declare const cloudLimitDocumentCountModalSlug = "figma-cloud-limit-document-count";
10
+ export declare const cloudLimitToastKeyByCode: Record<CloudLimitErrorCode, string>;
@@ -0,0 +1,52 @@
1
+ export const cloudLimitErrorCodes = {
2
+ assetStorage: 'cloud_limit.cms_assets_bytes_exceeded',
3
+ documentCount: 'cloud_limit.document_count_exceeded',
4
+ documentDataSize: 'cloud_limit.per_document_data_bytes_exceeded'
5
+ };
6
+ const knownCloudLimitCodes = Object.values(cloudLimitErrorCodes);
7
+ export function isCloudLimitErrorCode(code) {
8
+ return typeof code === 'string' && knownCloudLimitCodes.includes(code);
9
+ }
10
+ const cloudLimitCodeByMessagePattern = [
11
+ {
12
+ code: cloudLimitErrorCodes.documentCount,
13
+ pattern: /document count/i
14
+ },
15
+ {
16
+ code: cloudLimitErrorCodes.documentDataSize,
17
+ pattern: /document data size/i
18
+ },
19
+ {
20
+ code: cloudLimitErrorCodes.assetStorage,
21
+ pattern: /asset storage limit/i
22
+ }
23
+ ];
24
+ export function getCloudLimitErrorCode(json) {
25
+ const errors = json?.errors;
26
+ if (!Array.isArray(errors)) {
27
+ return undefined;
28
+ }
29
+ for (const err of errors){
30
+ const code = err?.data?.code;
31
+ if (isCloudLimitErrorCode(code)) {
32
+ return code;
33
+ }
34
+ const message = err?.message;
35
+ if (message?.startsWith('Content API ')) {
36
+ // Payload's bulk-upload response currently drops APIError.data.code. Match only the
37
+ // identifying phrase from each Content API message so variable values and minor wording
38
+ // changes do not break the fallback. Prefer the structured code above whenever present.
39
+ const match = cloudLimitCodeByMessagePattern.find(({ pattern })=>pattern.test(message));
40
+ if (match) {
41
+ return match.code;
42
+ }
43
+ }
44
+ }
45
+ return undefined;
46
+ }
47
+ export const cloudLimitDocumentCountModalSlug = 'figma-cloud-limit-document-count';
48
+ export const cloudLimitToastKeyByCode = {
49
+ [cloudLimitErrorCodes.assetStorage]: 'figma:cloudLimitAssetStorageError',
50
+ [cloudLimitErrorCodes.documentCount]: 'figma:cloudLimitDocumentCountError',
51
+ [cloudLimitErrorCodes.documentDataSize]: 'figma:cloudLimitDocumentDataSizeError'
52
+ };
@@ -0,0 +1,2 @@
1
+ import type { Translate } from './toasts.js';
2
+ export declare function cloudLimitInterceptor(apiRoute: string, translate: Translate): () => void;
@@ -0,0 +1,134 @@
1
+ 'use client';
2
+ import { toast } from '@payloadcms/ui';
3
+ import { formatAdminURL } from 'payload/shared';
4
+ import { getCloudLimitErrorCode } from '../shared.js';
5
+ import { showCloudLimitToast } from './toasts.js';
6
+ const ERROR_SUPPRESSION_MS = 1_000;
7
+ const SUMMARY_SUPPRESSION_MS = 60_000;
8
+ function restoreBulkErrorCodes(response, json) {
9
+ if (!json || typeof json !== 'object' || !Array.isArray(json.docs) || !Array.isArray(json.errors)) {
10
+ return undefined;
11
+ }
12
+ let hasLimitError = false;
13
+ const errors = json.errors.map((error)=>{
14
+ const code = getCloudLimitErrorCode({
15
+ errors: [
16
+ error
17
+ ]
18
+ });
19
+ if (!code || !error || typeof error !== 'object') {
20
+ return error;
21
+ }
22
+ hasLimitError = true;
23
+ const data = error.data;
24
+ return {
25
+ ...error,
26
+ data: {
27
+ ...typeof data === 'object' && data ? data : {},
28
+ code
29
+ }
30
+ };
31
+ });
32
+ if (!hasLimitError) {
33
+ return undefined;
34
+ }
35
+ const { message: _aggregateMessage, ...result } = json;
36
+ const headers = new Headers(response.headers);
37
+ headers.delete('content-encoding');
38
+ headers.delete('content-length');
39
+ return new Response(JSON.stringify({
40
+ ...result,
41
+ errors
42
+ }), {
43
+ headers,
44
+ status: response.status,
45
+ statusText: response.statusText
46
+ });
47
+ }
48
+ export function cloudLimitInterceptor(apiRoute, translate) {
49
+ const originalFetch = window.fetch;
50
+ const originalToastError = toast.error;
51
+ const suppressions = new Map();
52
+ let suppressSummary = false;
53
+ let summaryTimeout;
54
+ const patchedToastError = (...args)=>{
55
+ const message = typeof args[0] === 'string' ? args[0] : args[0]?.props?.errorMessage ?? '';
56
+ const match = [
57
+ ...suppressions
58
+ ].find(([rawMessage])=>message.includes(rawMessage));
59
+ if (match) {
60
+ const [, suppression] = match;
61
+ // Keep the suppression for its full lifetime so overlapping requests with the same raw
62
+ // error cannot leak duplicate Payload error toasts. The stable info-toast ID deduplicates
63
+ // the replacement notification.
64
+ showCloudLimitToast(suppression.code, translate);
65
+ if (suppression.isBulkUpload) {
66
+ suppressSummary = true;
67
+ window.clearTimeout(summaryTimeout);
68
+ summaryTimeout = window.setTimeout(()=>suppressSummary = false, SUMMARY_SUPPRESSION_MS);
69
+ }
70
+ return '';
71
+ }
72
+ if (suppressSummary && /^Failed to save \d+ files$/.test(message)) {
73
+ suppressSummary = false;
74
+ window.clearTimeout(summaryTimeout);
75
+ return '';
76
+ }
77
+ return originalToastError(...args);
78
+ };
79
+ const patchedFetch = async (...args)=>{
80
+ const response = await originalFetch(...args);
81
+ if (response.status < 400) {
82
+ return response;
83
+ }
84
+ try {
85
+ const json = await response.clone().json();
86
+ const bulkResponse = response.status === 400 ? restoreBulkErrorCodes(response, json) : undefined;
87
+ if (bulkResponse) {
88
+ return bulkResponse;
89
+ }
90
+ const input = args[0];
91
+ const pathname = new URL(input instanceof Request ? input.url : String(input), window.location.origin).pathname;
92
+ const method = (input instanceof Request ? input.method : args[1]?.method ?? 'GET').toUpperCase();
93
+ const apiPath = formatAdminURL({
94
+ apiRoute,
95
+ path: ''
96
+ }).replace(/\/$/, '');
97
+ const endpoint = pathname.startsWith(`${apiPath}/`) ? pathname.slice(apiPath.length + 1) : '';
98
+ const isUploadInstructions = endpoint === 'upload-instructions';
99
+ const isCollectionCreate = method === 'POST' && endpoint !== '' && !endpoint.includes('/');
100
+ if (!isUploadInstructions && !isCollectionCreate) {
101
+ return response;
102
+ }
103
+ const code = getCloudLimitErrorCode(json);
104
+ const rawMessage = json?.errors?.[0]?.message;
105
+ if (code && rawMessage) {
106
+ const previous = suppressions.get(rawMessage);
107
+ window.clearTimeout(previous?.timeout);
108
+ const suppression = {
109
+ code,
110
+ isBulkUpload: isCollectionCreate,
111
+ timeout: 0
112
+ };
113
+ suppression.timeout = window.setTimeout(()=>suppressions.delete(rawMessage), ERROR_SUPPRESSION_MS);
114
+ suppressions.set(rawMessage, suppression);
115
+ }
116
+ } catch {
117
+ // Leave Payload's default handling intact for malformed error responses.
118
+ }
119
+ return response;
120
+ };
121
+ window.fetch = patchedFetch;
122
+ toast.error = patchedToastError;
123
+ return ()=>{
124
+ suppressions.forEach(({ timeout })=>window.clearTimeout(timeout));
125
+ window.clearTimeout(summaryTimeout);
126
+ if (window.fetch === patchedFetch) {
127
+ window.fetch = originalFetch;
128
+ }
129
+ if (toast.error === patchedToastError) {
130
+ ;
131
+ toast.error = originalToastError;
132
+ }
133
+ };
134
+ }
@@ -0,0 +1,4 @@
1
+ import type { CloudLimitErrorCode } from '../shared.js';
2
+ export type Translate = (key: string) => string;
3
+ export declare function dismissSubmittingToast(label: string): void;
4
+ export declare function showCloudLimitToast(code: CloudLimitErrorCode, translate: Translate): void;