@10x-media/form-builder 0.1.0-beta.0 → 0.1.0-beta.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 (644) hide show
  1. package/CHANGELOG.md +345 -0
  2. package/README.md +45 -1402
  3. package/dist/actions/body/converters.d.ts +20 -0
  4. package/dist/actions/body/converters.js +57 -0
  5. package/dist/actions/body/converters.js.map +1 -0
  6. package/dist/actions/body/escapeHtml.d.ts +6 -0
  7. package/dist/actions/body/escapeHtml.js +14 -0
  8. package/dist/actions/body/escapeHtml.js.map +1 -0
  9. package/dist/actions/body/serializeBody.d.ts +55 -0
  10. package/dist/actions/body/serializeBody.js +78 -0
  11. package/dist/actions/body/serializeBody.js.map +1 -0
  12. package/dist/actions/body/serializeSlate.js +31 -0
  13. package/dist/actions/body/serializeSlate.js.map +1 -0
  14. package/dist/actions/body/textOfBody.d.ts +13 -0
  15. package/dist/actions/body/textOfBody.js +35 -0
  16. package/dist/actions/body/textOfBody.js.map +1 -0
  17. package/dist/actions/body/wildcards.d.ts +10 -0
  18. package/dist/actions/body/wildcards.js +33 -0
  19. package/dist/actions/body/wildcards.js.map +1 -0
  20. package/dist/actions/buildActionBlocks.js +22 -0
  21. package/dist/actions/buildActionBlocks.js.map +1 -0
  22. package/dist/actions/builtin/confirmation.js +52 -0
  23. package/dist/actions/builtin/confirmation.js.map +1 -0
  24. package/dist/actions/builtin/emailAction.d.ts +17 -0
  25. package/dist/actions/builtin/emailAction.js +83 -0
  26. package/dist/actions/builtin/emailAction.js.map +1 -0
  27. package/dist/actions/builtin/emailTeam.js +22 -0
  28. package/dist/actions/builtin/emailTeam.js.map +1 -0
  29. package/dist/actions/builtin/index.d.ts +22 -0
  30. package/dist/actions/builtin/index.js +27 -0
  31. package/dist/actions/builtin/index.js.map +1 -0
  32. package/dist/actions/builtin/signedWebhook.js +53 -0
  33. package/dist/actions/builtin/signedWebhook.js.map +1 -0
  34. package/dist/actions/defineAction.d.ts +37 -0
  35. package/dist/actions/defineAction.js +6 -0
  36. package/dist/actions/defineAction.js.map +1 -0
  37. package/dist/actions/dispatch.js +49 -0
  38. package/dist/actions/dispatch.js.map +1 -0
  39. package/dist/actions/emailRecipients.d.ts +12 -0
  40. package/dist/actions/emailRecipients.js +116 -0
  41. package/dist/actions/emailRecipients.js.map +1 -0
  42. package/dist/actions/fromAddresses.d.ts +21 -0
  43. package/dist/actions/fromAddresses.js +74 -0
  44. package/dist/actions/fromAddresses.js.map +1 -0
  45. package/dist/actions/registry.d.ts +17 -0
  46. package/dist/actions/registry.js +12 -0
  47. package/dist/actions/registry.js.map +1 -0
  48. package/dist/actions/runActions.d.ts +9 -0
  49. package/dist/actions/runActions.js +43 -0
  50. package/dist/actions/runActions.js.map +1 -0
  51. package/dist/actions/sign.d.ts +7 -0
  52. package/dist/actions/sign.js +9 -0
  53. package/dist/actions/sign.js.map +1 -0
  54. package/dist/actions/task.js +87 -0
  55. package/dist/actions/task.js.map +1 -0
  56. package/dist/aggregation/aggregateResponses.d.ts +40 -0
  57. package/dist/aggregation/aggregateResponses.js +80 -0
  58. package/dist/aggregation/aggregateResponses.js.map +1 -0
  59. package/dist/aggregation/aggregateRows.d.ts +10 -0
  60. package/dist/aggregation/aggregateRows.js +64 -0
  61. package/dist/aggregation/aggregateRows.js.map +1 -0
  62. package/dist/aggregation/resolveResultsRequest.d.ts +61 -0
  63. package/dist/aggregation/resolveResultsRequest.js +113 -0
  64. package/dist/aggregation/resolveResultsRequest.js.map +1 -0
  65. package/dist/aggregation/types.d.ts +39 -0
  66. package/dist/calc/computeCalcFields.d.ts +15 -0
  67. package/dist/calc/computeCalcFields.js +28 -0
  68. package/dist/calc/computeCalcFields.js.map +1 -0
  69. package/dist/calc/evaluate.d.ts +8 -0
  70. package/dist/calc/evaluate.js +58 -0
  71. package/dist/calc/evaluate.js.map +1 -0
  72. package/dist/calc/normalizeCalc.d.ts +8 -0
  73. package/dist/calc/normalizeCalc.js +87 -0
  74. package/dist/calc/normalizeCalc.js.map +1 -0
  75. package/dist/calc/types.d.ts +34 -0
  76. package/dist/calc/types.js +22 -0
  77. package/dist/calc/types.js.map +1 -0
  78. package/dist/client/ByteSizeField.d.ts +29 -0
  79. package/dist/client/ByteSizeField.js +58 -0
  80. package/dist/client/ByteSizeField.js.map +1 -0
  81. package/dist/client/ClosePollButton.d.ts +15 -0
  82. package/dist/client/ClosePollButton.js +80 -0
  83. package/dist/client/ClosePollButton.js.map +1 -0
  84. package/dist/client/CondensedArray.d.ts +15 -0
  85. package/dist/client/CondensedArray.js +97 -0
  86. package/dist/client/CondensedArray.js.map +1 -0
  87. package/dist/client/ConditionBuilder.js +122 -0
  88. package/dist/client/ConditionBuilder.js.map +1 -0
  89. package/dist/client/ConditionRow.js +150 -0
  90. package/dist/client/ConditionRow.js.map +1 -0
  91. package/dist/client/ConsentBlockLabel.d.ts +15 -0
  92. package/dist/client/ConsentBlockLabel.js +71 -0
  93. package/dist/client/ConsentBlockLabel.js.map +1 -0
  94. package/dist/client/ConsentSourceRowLabel.d.ts +9 -0
  95. package/dist/client/ConsentSourceRowLabel.js +21 -0
  96. package/dist/client/ConsentSourceRowLabel.js.map +1 -0
  97. package/dist/client/EndpointOptionsSelect.d.ts +46 -0
  98. package/dist/client/EndpointOptionsSelect.js +106 -0
  99. package/dist/client/EndpointOptionsSelect.js.map +1 -0
  100. package/dist/client/FieldBlockLabel.d.ts +18 -0
  101. package/dist/client/FieldBlockLabel.js +34 -0
  102. package/dist/client/FieldBlockLabel.js.map +1 -0
  103. package/dist/client/FieldNameSelect.d.ts +37 -0
  104. package/dist/client/FieldNameSelect.js +72 -0
  105. package/dist/client/FieldNameSelect.js.map +1 -0
  106. package/dist/client/FlowBuilder.d.ts +15 -0
  107. package/dist/client/FlowBuilder.js +457 -0
  108. package/dist/client/FlowBuilder.js.map +1 -0
  109. package/dist/client/FormConditionField.d.ts +21 -0
  110. package/dist/client/FormConditionField.js +30 -0
  111. package/dist/client/FormConditionField.js.map +1 -0
  112. package/dist/client/RecipientsSelect.d.ts +31 -0
  113. package/dist/client/RecipientsSelect.js +174 -0
  114. package/dist/client/RecipientsSelect.js.map +1 -0
  115. package/dist/client/RuleDescription.d.ts +21 -0
  116. package/dist/client/RuleDescription.js +19 -0
  117. package/dist/client/RuleDescription.js.map +1 -0
  118. package/dist/client/admin.css +275 -0
  119. package/dist/client/endpointOptions.js +29 -0
  120. package/dist/client/endpointOptions.js.map +1 -0
  121. package/dist/client/flowAuthoring.js +142 -0
  122. package/dist/client/flowAuthoring.js.map +1 -0
  123. package/dist/client/synthesizeClientField.js +57 -0
  124. package/dist/client/synthesizeClientField.js.map +1 -0
  125. package/dist/client/toStaticLabel.js +13 -0
  126. package/dist/client/toStaticLabel.js.map +1 -0
  127. package/dist/collections/buttonFields.d.ts +34 -0
  128. package/dist/collections/buttonFields.js +35 -0
  129. package/dist/collections/buttonFields.js.map +1 -0
  130. package/dist/collections/cells/FieldCountCell.d.ts +15 -0
  131. package/dist/collections/cells/FieldCountCell.js +18 -0
  132. package/dist/collections/cells/FieldCountCell.js.map +1 -0
  133. package/dist/collections/cells/FlowStepsCell.d.ts +14 -0
  134. package/dist/collections/cells/FlowStepsCell.js +17 -0
  135. package/dist/collections/cells/FlowStepsCell.js.map +1 -0
  136. package/dist/collections/formSubmissions.js +204 -0
  137. package/dist/collections/formSubmissions.js.map +1 -0
  138. package/dist/collections/forms.js +482 -0
  139. package/dist/collections/forms.js.map +1 -0
  140. package/dist/collections/formsEndpoints.js +101 -0
  141. package/dist/collections/formsEndpoints.js.map +1 -0
  142. package/dist/collections/redirectFields.d.ts +29 -0
  143. package/dist/conditions/conditionType.js +21 -0
  144. package/dist/conditions/conditionType.js.map +1 -0
  145. package/dist/conditions/evaluate.d.ts +17 -0
  146. package/dist/conditions/evaluate.js +94 -0
  147. package/dist/conditions/evaluate.js.map +1 -0
  148. package/dist/conditions/fieldTypes.d.ts +11 -0
  149. package/dist/{fieldTypes-CzhhJXjg.js → conditions/fieldTypes.js} +6 -3
  150. package/dist/conditions/fieldTypes.js.map +1 -0
  151. package/dist/conditions/normalizeConditions.js +61 -0
  152. package/dist/conditions/normalizeConditions.js.map +1 -0
  153. package/dist/conditions/types.d.ts +8 -0
  154. package/dist/consent/applyConsentStatements.d.ts +14 -0
  155. package/dist/consent/applyConsentStatements.js +17 -0
  156. package/dist/consent/applyConsentStatements.js.map +1 -0
  157. package/dist/consent/captureConsent.d.ts +55 -0
  158. package/dist/consent/captureConsent.js +73 -0
  159. package/dist/consent/captureConsent.js.map +1 -0
  160. package/dist/consent/consentSourcesField.d.ts +66 -0
  161. package/dist/consent/consentSourcesField.js +90 -0
  162. package/dist/consent/consentSourcesField.js.map +1 -0
  163. package/dist/consent/resolveConsentEntries.d.ts +24 -0
  164. package/dist/consent/resolveConsentEntries.js +40 -0
  165. package/dist/consent/resolveConsentEntries.js.map +1 -0
  166. package/dist/consent/resolveConsentSourcesRequest.d.ts +37 -0
  167. package/dist/consent/resolveConsentSourcesRequest.js +54 -0
  168. package/dist/consent/resolveConsentSourcesRequest.js.map +1 -0
  169. package/dist/consent/resolveConsentStatements.d.ts +45 -0
  170. package/dist/consent/resolveConsentStatements.js +44 -0
  171. package/dist/consent/resolveConsentStatements.js.map +1 -0
  172. package/dist/consent/resolvePublishedVersionRef.d.ts +23 -0
  173. package/dist/consent/resolvePublishedVersionRef.js +30 -0
  174. package/dist/consent/resolvePublishedVersionRef.js.map +1 -0
  175. package/dist/consent/types.d.ts +61 -0
  176. package/dist/email/departments.d.ts +59 -0
  177. package/dist/email/departments.js +87 -0
  178. package/dist/email/departments.js.map +1 -0
  179. package/dist/email/departmentsField.d.ts +53 -0
  180. package/dist/email/departmentsField.js +73 -0
  181. package/dist/email/departmentsField.js.map +1 -0
  182. package/dist/events/noopSink.js +6 -0
  183. package/dist/events/noopSink.js.map +1 -0
  184. package/dist/events/resolveEventSink.js +8 -0
  185. package/dist/events/resolveEventSink.js.map +1 -0
  186. package/dist/events/types.d.ts +31 -0
  187. package/dist/exports/client.d.ts +15 -21
  188. package/dist/exports/client.js +15 -319
  189. package/dist/exports/i18n.d.ts +6 -138
  190. package/dist/exports/i18n.js +6 -3
  191. package/dist/exports/react.d.ts +63 -550
  192. package/dist/exports/react.js +55 -1563
  193. package/dist/exports/rsc.d.ts +9 -16
  194. package/dist/exports/rsc.js +9 -55
  195. package/dist/exports/types.d.ts +36 -5
  196. package/dist/fields/buildFieldBlocks.js +80 -0
  197. package/dist/fields/buildFieldBlocks.js.map +1 -0
  198. package/dist/fields/builtin/calculation.js +144 -0
  199. package/dist/fields/builtin/calculation.js.map +1 -0
  200. package/dist/fields/builtin/checkbox.js +21 -0
  201. package/dist/fields/builtin/checkbox.js.map +1 -0
  202. package/dist/fields/builtin/consent.js +47 -0
  203. package/dist/fields/builtin/consent.js.map +1 -0
  204. package/dist/fields/builtin/country.d.ts +13 -0
  205. package/dist/fields/builtin/country.js +30 -0
  206. package/dist/fields/builtin/country.js.map +1 -0
  207. package/dist/fields/builtin/date.js +31 -0
  208. package/dist/fields/builtin/date.js.map +1 -0
  209. package/dist/fields/builtin/email.js +18 -0
  210. package/dist/fields/builtin/email.js.map +1 -0
  211. package/dist/fields/builtin/file.d.ts +15 -0
  212. package/dist/fields/builtin/file.js +127 -0
  213. package/dist/fields/builtin/file.js.map +1 -0
  214. package/dist/fields/builtin/index.d.ts +26 -0
  215. package/dist/fields/builtin/index.js +49 -0
  216. package/dist/fields/builtin/index.js.map +1 -0
  217. package/dist/fields/builtin/message.js +30 -0
  218. package/dist/fields/builtin/message.js.map +1 -0
  219. package/dist/fields/builtin/number.js +17 -0
  220. package/dist/fields/builtin/number.js.map +1 -0
  221. package/dist/fields/builtin/repeater.js +49 -0
  222. package/dist/fields/builtin/repeater.js.map +1 -0
  223. package/dist/fields/builtin/select.js +49 -0
  224. package/dist/fields/builtin/select.js.map +1 -0
  225. package/dist/fields/builtin/state.d.ts +13 -0
  226. package/dist/fields/builtin/state.js +30 -0
  227. package/dist/fields/builtin/state.js.map +1 -0
  228. package/dist/fields/builtin/text.js +13 -0
  229. package/dist/fields/builtin/text.js.map +1 -0
  230. package/dist/fields/builtin/textarea.js +13 -0
  231. package/dist/fields/builtin/textarea.js.map +1 -0
  232. package/dist/fields/data/regions.d.ts +21 -0
  233. package/dist/fields/data/regions.js +1238 -0
  234. package/dist/fields/data/regions.js.map +1 -0
  235. package/dist/fields/defineFormField.d.ts +13 -0
  236. package/dist/fields/defineFormField.js +12 -0
  237. package/dist/fields/defineFormField.js.map +1 -0
  238. package/dist/fields/fieldKey.d.ts +15 -0
  239. package/dist/fields/fieldKey.js +16 -0
  240. package/dist/fields/fieldKey.js.map +1 -0
  241. package/dist/fields/fieldNamesOfType.js +30 -0
  242. package/dist/fields/fieldNamesOfType.js.map +1 -0
  243. package/dist/fields/instanceOptions.js +20 -0
  244. package/dist/fields/instanceOptions.js.map +1 -0
  245. package/dist/fields/localizedIf.d.ts +13 -0
  246. package/dist/fields/localizedIf.js +12 -0
  247. package/dist/fields/localizedIf.js.map +1 -0
  248. package/dist/fields/registry.d.ts +12 -0
  249. package/dist/fields/registry.js +39 -0
  250. package/dist/fields/registry.js.map +1 -0
  251. package/dist/fields/sharedConfig.js +151 -0
  252. package/dist/fields/sharedConfig.js.map +1 -0
  253. package/dist/fields/types.d.ts +152 -0
  254. package/dist/flow/engine.d.ts +19 -0
  255. package/dist/flow/engine.js +29 -0
  256. package/dist/flow/engine.js.map +1 -0
  257. package/dist/flow/normalizeFlow.js +54 -0
  258. package/dist/flow/normalizeFlow.js.map +1 -0
  259. package/dist/flow/stepLabel.js +15 -0
  260. package/dist/flow/stepLabel.js.map +1 -0
  261. package/dist/flow/types.d.ts +32 -0
  262. package/dist/flow/types.js +11 -0
  263. package/dist/flow/types.js.map +1 -0
  264. package/dist/form/pollState.d.ts +22 -0
  265. package/dist/form/pollState.js +17 -0
  266. package/dist/form/pollState.js.map +1 -0
  267. package/dist/form/toFormDocument.d.ts +102 -0
  268. package/dist/form/toFormDocument.js +87 -0
  269. package/dist/form/toFormDocument.js.map +1 -0
  270. package/dist/form/types.d.ts +65 -0
  271. package/dist/index.d.ts +88 -4
  272. package/dist/index.js +111 -1898
  273. package/dist/index.js.map +1 -1
  274. package/dist/options.d.ts +229 -0
  275. package/dist/plugin/access.js +12 -0
  276. package/dist/plugin/access.js.map +1 -0
  277. package/dist/plugin/applyRegistryConfig.d.ts +11 -0
  278. package/dist/plugin/applyRegistryConfig.js +20 -0
  279. package/dist/plugin/applyRegistryConfig.js.map +1 -0
  280. package/dist/plugin/collectionOverrides.d.ts +22 -0
  281. package/dist/plugin/customState.js +26 -0
  282. package/dist/plugin/customState.js.map +1 -0
  283. package/dist/plugin/registerCollections.js +60 -0
  284. package/dist/plugin/registerCollections.js.map +1 -0
  285. package/dist/plugin/registerTranslations.js +19 -0
  286. package/dist/plugin/registerTranslations.js.map +1 -0
  287. package/dist/plugin/uploadsCollection.d.ts +16 -0
  288. package/dist/plugin/uploadsCollection.js +53 -0
  289. package/dist/plugin/uploadsCollection.js.map +1 -0
  290. package/dist/poll/applyPollOptions.js +18 -0
  291. package/dist/poll/applyPollOptions.js.map +1 -0
  292. package/dist/poll/buildPollOptionSourceFields.js +50 -0
  293. package/dist/poll/buildPollOptionSourceFields.js.map +1 -0
  294. package/dist/poll/closeJob.d.ts +52 -0
  295. package/dist/poll/closeJob.js +119 -0
  296. package/dist/poll/closeJob.js.map +1 -0
  297. package/dist/poll/definePollOptionSource.d.ts +44 -0
  298. package/dist/poll/definePollOptionSource.js +6 -0
  299. package/dist/poll/definePollOptionSource.js.map +1 -0
  300. package/dist/poll/definePollType.d.ts +34 -0
  301. package/dist/poll/definePollType.js +6 -0
  302. package/dist/poll/definePollType.js.map +1 -0
  303. package/dist/poll/effectivePollOptions.d.ts +38 -0
  304. package/dist/poll/effectivePollOptions.js +64 -0
  305. package/dist/poll/effectivePollOptions.js.map +1 -0
  306. package/dist/poll/mostVoted.d.ts +21 -0
  307. package/dist/poll/mostVoted.js +32 -0
  308. package/dist/poll/mostVoted.js.map +1 -0
  309. package/dist/poll/outcomeBeforeChange.js +91 -0
  310. package/dist/poll/outcomeBeforeChange.js.map +1 -0
  311. package/dist/poll/outcomeFields.d.ts +38 -0
  312. package/dist/poll/outcomeFields.js +52 -0
  313. package/dist/poll/outcomeFields.js.map +1 -0
  314. package/dist/poll/pollTypeRegistry.d.ts +34 -0
  315. package/dist/poll/pollTypeRegistry.js +69 -0
  316. package/dist/poll/pollTypeRegistry.js.map +1 -0
  317. package/dist/poll/registry.d.ts +17 -0
  318. package/dist/poll/registry.js +12 -0
  319. package/dist/poll/registry.js.map +1 -0
  320. package/dist/poll/resolvePollCloseRequest.js +105 -0
  321. package/dist/poll/resolvePollCloseRequest.js.map +1 -0
  322. package/dist/poll/resolvePollOptions.d.ts +29 -0
  323. package/dist/poll/resolvePollOptions.js +52 -0
  324. package/dist/poll/resolvePollOptions.js.map +1 -0
  325. package/dist/poll/resolvePollOptionsRequest.js +50 -0
  326. package/dist/poll/resolvePollOptionsRequest.js.map +1 -0
  327. package/dist/poll/resolvePollOutcome.d.ts +34 -0
  328. package/dist/poll/resolvePollOutcome.js +76 -0
  329. package/dist/poll/resolvePollOutcome.js.map +1 -0
  330. package/dist/poll/resultsField.js +21 -0
  331. package/dist/poll/resultsField.js.map +1 -0
  332. package/dist/prefill/valuesFromSearchParams.d.ts +18 -0
  333. package/dist/prefill/valuesFromSearchParams.js +41 -0
  334. package/dist/prefill/valuesFromSearchParams.js.map +1 -0
  335. package/dist/presentations/defaults.d.ts +33 -0
  336. package/dist/presentations/defaults.js +35 -0
  337. package/dist/presentations/defaults.js.map +1 -0
  338. package/dist/presentations/types.d.ts +19 -0
  339. package/dist/react/Form.d.ts +128 -0
  340. package/dist/react/Form.js +619 -0
  341. package/dist/react/Form.js.map +1 -0
  342. package/dist/react/FormContext.d.ts +59 -0
  343. package/dist/react/FormContext.js +14 -0
  344. package/dist/react/FormContext.js.map +1 -0
  345. package/dist/react/FormControls.d.ts +55 -0
  346. package/dist/react/FormControls.js +56 -0
  347. package/dist/react/FormControls.js.map +1 -0
  348. package/dist/react/FormFields.d.ts +18 -0
  349. package/dist/react/FormFields.js +114 -0
  350. package/dist/react/FormFields.js.map +1 -0
  351. package/dist/react/FormLayout.d.ts +22 -0
  352. package/dist/react/FormLayout.js +15 -0
  353. package/dist/react/FormLayout.js.map +1 -0
  354. package/dist/react/FormResults.d.ts +28 -0
  355. package/dist/react/FormResults.js +93 -0
  356. package/dist/react/FormResults.js.map +1 -0
  357. package/dist/react/FormSteps.d.ts +17 -0
  358. package/dist/react/FormSteps.js +35 -0
  359. package/dist/react/FormSteps.js.map +1 -0
  360. package/dist/react/Honeypot.d.ts +22 -0
  361. package/dist/react/Honeypot.js +38 -0
  362. package/dist/react/Honeypot.js.map +1 -0
  363. package/dist/react/Poll.d.ts +43 -0
  364. package/dist/react/Poll.js +135 -0
  365. package/dist/react/Poll.js.map +1 -0
  366. package/dist/react/captcha/HcaptchaCaptcha.d.ts +28 -0
  367. package/dist/react/captcha/HcaptchaCaptcha.js +53 -0
  368. package/dist/react/captcha/HcaptchaCaptcha.js.map +1 -0
  369. package/dist/react/captcha/RecaptchaCaptcha.d.ts +41 -0
  370. package/dist/react/captcha/RecaptchaCaptcha.js +93 -0
  371. package/dist/react/captcha/RecaptchaCaptcha.js.map +1 -0
  372. package/dist/react/captcha/TurnstileCaptcha.d.ts +28 -0
  373. package/dist/react/captcha/TurnstileCaptcha.js +53 -0
  374. package/dist/react/captcha/TurnstileCaptcha.js.map +1 -0
  375. package/dist/react/captcha/types.d.ts +8 -0
  376. package/dist/react/captcha/useCaptchaScript.js +45 -0
  377. package/dist/react/captcha/useCaptchaScript.js.map +1 -0
  378. package/dist/react/captcha/vendors.js +8 -0
  379. package/dist/react/captcha/vendors.js.map +1 -0
  380. package/dist/react/cn.d.ts +6 -0
  381. package/dist/react/cn.js +8 -0
  382. package/dist/react/cn.js.map +1 -0
  383. package/dist/react/contract.d.ts +31 -0
  384. package/dist/react/contract.js +7 -0
  385. package/dist/react/contract.js.map +1 -0
  386. package/dist/react/events.js +14 -0
  387. package/dist/react/events.js.map +1 -0
  388. package/dist/react/fetchResults.d.ts +25 -0
  389. package/dist/react/fetchResults.js +31 -0
  390. package/dist/react/fetchResults.js.map +1 -0
  391. package/dist/react/presentation/Backdrop.d.ts +18 -0
  392. package/dist/react/presentation/Backdrop.js +14 -0
  393. package/dist/react/presentation/Backdrop.js.map +1 -0
  394. package/dist/react/presentation/DialogSurface.d.ts +35 -0
  395. package/dist/react/presentation/DialogSurface.js +53 -0
  396. package/dist/react/presentation/DialogSurface.js.map +1 -0
  397. package/dist/react/presentation/presentations.d.ts +7 -0
  398. package/dist/react/presentation/presentations.js +32 -0
  399. package/dist/react/presentation/presentations.js.map +1 -0
  400. package/dist/react/presentation/registry.d.ts +11 -0
  401. package/dist/react/presentation/registry.js +12 -0
  402. package/dist/react/presentation/registry.js.map +1 -0
  403. package/dist/react/presentation/types.d.ts +19 -0
  404. package/dist/react/presentation/useDismiss.d.ts +19 -0
  405. package/dist/react/presentation/useDismiss.js +33 -0
  406. package/dist/react/presentation/useDismiss.js.map +1 -0
  407. package/dist/react/presentation/useFocusTrap.d.ts +8 -0
  408. package/dist/react/presentation/useFocusTrap.js +35 -0
  409. package/dist/react/presentation/useFocusTrap.js.map +1 -0
  410. package/dist/react/presentation/useScrollLock.d.ts +6 -0
  411. package/dist/react/presentation/useScrollLock.js +18 -0
  412. package/dist/react/presentation/useScrollLock.js.map +1 -0
  413. package/dist/react/primitives/Checkbox.d.ts +28 -0
  414. package/dist/react/primitives/Checkbox.js +21 -0
  415. package/dist/react/primitives/Checkbox.js.map +1 -0
  416. package/dist/react/primitives/FieldShell.d.ts +29 -0
  417. package/dist/react/primitives/FieldShell.js +44 -0
  418. package/dist/react/primitives/FieldShell.js.map +1 -0
  419. package/dist/react/primitives/Input.d.ts +30 -0
  420. package/dist/react/primitives/Input.js +21 -0
  421. package/dist/react/primitives/Input.js.map +1 -0
  422. package/dist/react/primitives/Select.d.ts +34 -0
  423. package/dist/react/primitives/Select.js +26 -0
  424. package/dist/react/primitives/Select.js.map +1 -0
  425. package/dist/react/primitives/Textarea.d.ts +28 -0
  426. package/dist/react/primitives/Textarea.js +20 -0
  427. package/dist/react/primitives/Textarea.js.map +1 -0
  428. package/dist/react/recall.js +20 -0
  429. package/dist/react/recall.js.map +1 -0
  430. package/dist/react/registry.d.ts +16 -0
  431. package/dist/react/registry.js +16 -0
  432. package/dist/react/registry.js.map +1 -0
  433. package/dist/react/renderers/calculation.js +27 -0
  434. package/dist/react/renderers/calculation.js.map +1 -0
  435. package/dist/react/renderers/checkbox.js +32 -0
  436. package/dist/react/renderers/checkbox.js.map +1 -0
  437. package/dist/react/renderers/consent.js +97 -0
  438. package/dist/react/renderers/consent.js.map +1 -0
  439. package/dist/react/renderers/date.js +33 -0
  440. package/dist/react/renderers/date.js.map +1 -0
  441. package/dist/react/renderers/email.js +34 -0
  442. package/dist/react/renderers/email.js.map +1 -0
  443. package/dist/react/renderers/file.js +107 -0
  444. package/dist/react/renderers/file.js.map +1 -0
  445. package/dist/react/renderers/index.d.ts +8 -0
  446. package/dist/react/renderers/index.js +35 -0
  447. package/dist/react/renderers/index.js.map +1 -0
  448. package/dist/react/renderers/message.js +41 -0
  449. package/dist/react/renderers/message.js.map +1 -0
  450. package/dist/react/renderers/number.js +37 -0
  451. package/dist/react/renderers/number.js.map +1 -0
  452. package/dist/react/renderers/region.js +43 -0
  453. package/dist/react/renderers/region.js.map +1 -0
  454. package/dist/react/renderers/repeater.js +131 -0
  455. package/dist/react/renderers/repeater.js.map +1 -0
  456. package/dist/react/renderers/select.js +35 -0
  457. package/dist/react/renderers/select.js.map +1 -0
  458. package/dist/react/renderers/text.js +34 -0
  459. package/dist/react/renderers/text.js.map +1 -0
  460. package/dist/react/renderers/textarea.js +33 -0
  461. package/dist/react/renderers/textarea.js.map +1 -0
  462. package/dist/react/resolveForm.js +16 -0
  463. package/dist/react/resolveForm.js.map +1 -0
  464. package/dist/react/state.d.ts +52 -0
  465. package/dist/react/state.js +125 -0
  466. package/dist/react/state.js.map +1 -0
  467. package/dist/react/submitForm.d.ts +31 -0
  468. package/dist/react/submitForm.js +58 -0
  469. package/dist/react/submitForm.js.map +1 -0
  470. package/dist/react/uploadFile.d.ts +23 -0
  471. package/dist/react/uploadFile.js +39 -0
  472. package/dist/react/uploadFile.js.map +1 -0
  473. package/dist/react/useField.d.ts +13 -0
  474. package/dist/react/useField.js +49 -0
  475. package/dist/react/useField.js.map +1 -0
  476. package/dist/react/useFormState.d.ts +8 -0
  477. package/dist/react/useFormState.js +9 -0
  478. package/dist/react/useFormState.js.map +1 -0
  479. package/dist/react/useFormStep.d.ts +8 -0
  480. package/dist/react/useFormStep.js +9 -0
  481. package/dist/react/useFormStep.js.map +1 -0
  482. package/dist/react/validateField.js +27 -0
  483. package/dist/react/validateField.js.map +1 -0
  484. package/dist/recall/interpolate.d.ts +11 -0
  485. package/dist/recall/interpolate.js +17 -0
  486. package/dist/recall/interpolate.js.map +1 -0
  487. package/dist/recall/resolver.d.ts +22 -0
  488. package/dist/recall/resolver.js +48 -0
  489. package/dist/recall/resolver.js.map +1 -0
  490. package/dist/spam/captcha.d.ts +13 -0
  491. package/dist/spam/captcha.js +12 -0
  492. package/dist/spam/captcha.js.map +1 -0
  493. package/dist/spam/clientIp.js +9 -0
  494. package/dist/spam/clientIp.js.map +1 -0
  495. package/dist/spam/constants.d.ts +12 -0
  496. package/dist/spam/constants.js +21 -0
  497. package/dist/spam/constants.js.map +1 -0
  498. package/dist/spam/identify.d.ts +12 -0
  499. package/dist/spam/identify.js +17 -0
  500. package/dist/spam/identify.js.map +1 -0
  501. package/dist/spam/providers/hcaptcha.d.ts +17 -0
  502. package/dist/spam/providers/hcaptcha.js +18 -0
  503. package/dist/spam/providers/hcaptcha.js.map +1 -0
  504. package/dist/spam/providers/recaptcha.d.ts +23 -0
  505. package/dist/spam/providers/recaptcha.js +23 -0
  506. package/dist/spam/providers/recaptcha.js.map +1 -0
  507. package/dist/spam/providers/siteverify.js +34 -0
  508. package/dist/spam/providers/siteverify.js.map +1 -0
  509. package/dist/spam/providers/turnstile.d.ts +17 -0
  510. package/dist/spam/providers/turnstile.js +18 -0
  511. package/dist/spam/providers/turnstile.js.map +1 -0
  512. package/dist/spam/rateLimiter.d.ts +18 -0
  513. package/dist/spam/rateLimiter.js +41 -0
  514. package/dist/spam/rateLimiter.js.map +1 -0
  515. package/dist/spam/reserved.js +30 -0
  516. package/dist/spam/reserved.js.map +1 -0
  517. package/dist/spam/resolveSpam.d.ts +12 -0
  518. package/dist/spam/resolveSpam.js +43 -0
  519. package/dist/spam/resolveSpam.js.map +1 -0
  520. package/dist/spam/spamGuard.js +81 -0
  521. package/dist/spam/spamGuard.js.map +1 -0
  522. package/dist/spam/types.d.ts +88 -0
  523. package/dist/spam/uploadHooks.js +33 -0
  524. package/dist/spam/uploadHooks.js.map +1 -0
  525. package/dist/submissions/SubmissionAnswers.d.ts +14 -0
  526. package/dist/submissions/SubmissionAnswers.js +137 -0
  527. package/dist/submissions/SubmissionAnswers.js.map +1 -0
  528. package/dist/submissions/SubmissionAnswersClient.js +178 -0
  529. package/dist/submissions/SubmissionAnswersClient.js.map +1 -0
  530. package/dist/submissions/coerceBoolean.js +14 -0
  531. package/dist/submissions/coerceBoolean.js.map +1 -0
  532. package/dist/submissions/createSubmission.d.ts +36 -0
  533. package/dist/submissions/createSubmission.js +26 -0
  534. package/dist/submissions/createSubmission.js.map +1 -0
  535. package/dist/submissions/runSubmission.d.ts +10 -0
  536. package/dist/submissions/runSubmission.js +306 -0
  537. package/dist/submissions/runSubmission.js.map +1 -0
  538. package/dist/submissions/types.d.ts +41 -0
  539. package/dist/submissions/validateSubmission.js +110 -0
  540. package/dist/submissions/validateSubmission.js.map +1 -0
  541. package/dist/submissions/votedCookie.d.ts +13 -0
  542. package/dist/submissions/votedCookie.js +27 -0
  543. package/dist/submissions/votedCookie.js.map +1 -0
  544. package/dist/translations/clientRuntimeKeys.d.ts +17 -0
  545. package/dist/translations/clientRuntimeKeys.js +46 -0
  546. package/dist/translations/clientRuntimeKeys.js.map +1 -0
  547. package/dist/translations/de.d.ts +12 -0
  548. package/dist/translations/de.js +309 -0
  549. package/dist/translations/de.js.map +1 -0
  550. package/dist/translations/en.d.ts +12 -0
  551. package/dist/translations/en.js +309 -0
  552. package/dist/translations/en.js.map +1 -0
  553. package/dist/translations/index.d.ts +23 -0
  554. package/dist/translations/index.js +37 -0
  555. package/dist/translations/index.js.map +1 -0
  556. package/dist/translations/keys.d.ts +308 -0
  557. package/dist/translations/keys.js +308 -0
  558. package/dist/translations/keys.js.map +1 -0
  559. package/dist/translations/makeTranslate.d.ts +15 -0
  560. package/dist/translations/makeTranslate.js +20 -0
  561. package/dist/translations/makeTranslate.js.map +1 -0
  562. package/dist/translations/server.js +32 -0
  563. package/dist/translations/server.js.map +1 -0
  564. package/dist/translations/useTranslation.js +12 -0
  565. package/dist/translations/useTranslation.js.map +1 -0
  566. package/dist/uploads/captureFileRef.d.ts +34 -0
  567. package/dist/uploads/captureFileRef.js +43 -0
  568. package/dist/uploads/captureFileRef.js.map +1 -0
  569. package/dist/uploads/formatBytes.d.ts +9 -0
  570. package/dist/uploads/formatBytes.js +25 -0
  571. package/dist/uploads/formatBytes.js.map +1 -0
  572. package/dist/uploads/resolveFileRef.d.ts +26 -0
  573. package/dist/uploads/resolveFileRef.js +45 -0
  574. package/dist/uploads/resolveFileRef.js.map +1 -0
  575. package/dist/uploads/types.d.ts +19 -0
  576. package/dist/validation/buildRuleBlocks.js +47 -0
  577. package/dist/validation/buildRuleBlocks.js.map +1 -0
  578. package/dist/validation/builtin/email.js +20 -0
  579. package/dist/validation/builtin/email.js.map +1 -0
  580. package/dist/validation/builtin/index.d.ts +14 -0
  581. package/dist/validation/builtin/index.js +38 -0
  582. package/dist/validation/builtin/index.js.map +1 -0
  583. package/dist/validation/builtin/matchesField.js +16 -0
  584. package/dist/validation/builtin/matchesField.js.map +1 -0
  585. package/dist/validation/builtin/max.js +22 -0
  586. package/dist/validation/builtin/max.js.map +1 -0
  587. package/dist/validation/builtin/maxDate.js +24 -0
  588. package/dist/validation/builtin/maxDate.js.map +1 -0
  589. package/dist/validation/builtin/maxLength.js +27 -0
  590. package/dist/validation/builtin/maxLength.js.map +1 -0
  591. package/dist/validation/builtin/min.js +22 -0
  592. package/dist/validation/builtin/min.js.map +1 -0
  593. package/dist/validation/builtin/minDate.js +24 -0
  594. package/dist/validation/builtin/minDate.js.map +1 -0
  595. package/dist/validation/builtin/minLength.js +27 -0
  596. package/dist/validation/builtin/minLength.js.map +1 -0
  597. package/dist/validation/builtin/notAlreadySubmitted.js +34 -0
  598. package/dist/validation/builtin/notAlreadySubmitted.js.map +1 -0
  599. package/dist/validation/builtin/oneOf.js +35 -0
  600. package/dist/validation/builtin/oneOf.js.map +1 -0
  601. package/dist/validation/builtin/pattern.js +50 -0
  602. package/dist/validation/builtin/pattern.js.map +1 -0
  603. package/dist/validation/builtin/url.js +23 -0
  604. package/dist/validation/builtin/url.js.map +1 -0
  605. package/dist/validation/builtin/validateDateBound.js +18 -0
  606. package/dist/validation/builtin/validateDateBound.js.map +1 -0
  607. package/dist/validation/builtin/validateRegexParams.js +44 -0
  608. package/dist/validation/builtin/validateRegexParams.js.map +1 -0
  609. package/dist/validation/defineValidationRule.d.ts +12 -0
  610. package/dist/validation/defineValidationRule.js +11 -0
  611. package/dist/validation/defineValidationRule.js.map +1 -0
  612. package/dist/validation/emailPattern.js +10 -0
  613. package/dist/validation/emailPattern.js.map +1 -0
  614. package/dist/validation/fieldTargetParam.d.ts +22 -0
  615. package/dist/validation/fieldTargetParam.js +38 -0
  616. package/dist/validation/fieldTargetParam.js.map +1 -0
  617. package/dist/validation/message.js +14 -0
  618. package/dist/validation/message.js.map +1 -0
  619. package/dist/validation/registry.d.ts +11 -0
  620. package/dist/validation/registry.js +13 -0
  621. package/dist/validation/registry.js.map +1 -0
  622. package/dist/validation/runValidation.js +90 -0
  623. package/dist/validation/runValidation.js.map +1 -0
  624. package/dist/validation/types.d.ts +70 -0
  625. package/dist/validation/validateUrl.js +22 -0
  626. package/dist/validation/validateUrl.js.map +1 -0
  627. package/package.json +12 -7
  628. package/styles/form-builder.css +21 -11
  629. package/dist/constants-B-BUfetP.d.ts +0 -288
  630. package/dist/exports/client.js.map +0 -1
  631. package/dist/exports/react.js.map +0 -1
  632. package/dist/exports/rsc.js.map +0 -1
  633. package/dist/fieldTypes-B8jkNRob.d.ts +0 -188
  634. package/dist/fieldTypes-CzhhJXjg.js.map +0 -1
  635. package/dist/index-DfFYGbVF.d.ts +0 -481
  636. package/dist/keys-N5xGiUsh.js +0 -132
  637. package/dist/keys-N5xGiUsh.js.map +0 -1
  638. package/dist/registry-CoCyhtvB.js +0 -282
  639. package/dist/registry-CoCyhtvB.js.map +0 -1
  640. package/dist/resolver-OeQyVH2N.js +0 -665
  641. package/dist/resolver-OeQyVH2N.js.map +0 -1
  642. package/dist/translations-edMqq_2e.js +0 -152
  643. package/dist/translations-edMqq_2e.js.map +0 -1
  644. package/dist/types-DsJ_6kGJ.d.ts +0 -23
@@ -0,0 +1,229 @@
1
+ import { TranslationsOption } from "./translations/index.js";
2
+ import { RichTextBodyOption } from "./actions/body/serializeBody.js";
3
+ import { ConsentSourcesResolver } from "./consent/types.js";
4
+ import { FieldTypesConfig } from "./fields/registry.js";
5
+ import { FormEventSink } from "./events/types.js";
6
+ import { PollOptionSourcesConfig } from "./poll/registry.js";
7
+ import { FromAddressesResolver } from "./actions/fromAddresses.js";
8
+ import { ActionsConfig } from "./actions/registry.js";
9
+ import { FormResultsAccess } from "./aggregation/resolveResultsRequest.js";
10
+ import { ButtonsOption } from "./collections/buttonFields.js";
11
+ import { ConsentSnapshotMode } from "./consent/captureConsent.js";
12
+ import { DepartmentEmailsResolver } from "./email/departments.js";
13
+ import { RecipientsConfig } from "./actions/emailRecipients.js";
14
+ import { ResponseOption } from "./collections/redirectFields.js";
15
+ import { CollectionOverrides } from "./plugin/collectionOverrides.js";
16
+ import { SpamOption } from "./spam/types.js";
17
+ import { UploadsOption } from "./plugin/uploadsCollection.js";
18
+ import { OutcomeFieldsOverride } from "./poll/outcomeFields.js";
19
+ import { PollTypesConfig } from "./poll/pollTypeRegistry.js";
20
+ import { ValidationRulesConfig } from "./validation/registry.js";
21
+ import { CollectionSlug } from "payload";
22
+
23
+ //#region src/options.d.ts
24
+ type FormBuilderPluginOptions = {
25
+ disabled?: boolean;
26
+ /**
27
+ * Per-locale overrides for this plugin's UI strings, keyed by the typed
28
+ * translation keys exported from `@10x-media/form-builder/i18n`. Values win
29
+ * over the built-in locales key-by-key; locales the plugin does not ship are
30
+ * added whole. App-level `i18n.translations` still wins over both.
31
+ */
32
+ translations?: TranslationsOption; /** Pluggable sink for form lifecycle events. Defaults to a no-op; analytics adapters or a future analytics plugin subscribe here. */
33
+ events?: FormEventSink;
34
+ /**
35
+ * Content-bearing author fields (labels, placeholders, option labels, action subjects and
36
+ * bodies) are localized by default. Payload strips the `localized` flag on hosts without
37
+ * `localization` configured, so the default is safe everywhere. Set `false` to keep form
38
+ * content single-locale even on localized hosts. Spread-overrides of the prebuilt default
39
+ * exports (`defaultFieldDefinitionsByType`, `defaultActionDefinitions`) carry `localized`
40
+ * flags from the default-true set; when opting out, derive overrides from
41
+ * `buildDefaultFieldDefinitions(false)` / `buildDefaultActionDefinitions({ localize: false })` instead.
42
+ * Consent statements are unaffected either way: they live on the host's own
43
+ * `consentSourcesField()`, which carries its own `localized` option.
44
+ */
45
+ localizeContent?: boolean; /** Add, override, or remove field types. `false` removes a built-in, `true` keeps it, an object adds or replaces one. */
46
+ fields?: FieldTypesConfig; /** Add, override, or remove validation rule types. `false` removes a built-in, `true` keeps it, an object adds or replaces one. */
47
+ rules?: ValidationRulesConfig; /** Add, override, or remove post-submit action types. `false` removes a built-in, `true` keeps it, an object adds or replaces one. */
48
+ actions?: ActionsConfig;
49
+ /**
50
+ * Customize how the plugin's rich text is authored and rendered. `editor` is the default
51
+ * Lexical/richText editor for every plugin richText field (message content, consent
52
+ * statement, response message, action bodies); `bodyEditor` overrides the action body
53
+ * fields and `responseEditor` overrides the success response message field, each falling
54
+ * back to `editor`. `converters` spread over the default
55
+ * Lexical node converters; `serialize` replaces the whole action-body pipeline (e.g. to
56
+ * target chat or plain-text channels instead of email HTML). A custom `serialize` receives
57
+ * the submitted `form` (id/title) and `req`, enabling per-tenant lookups or handing the raw
58
+ * body off to a renderer like react-email.
59
+ */
60
+ richText?: RichTextBodyOption;
61
+ /**
62
+ * Email routing for the `emailTeam` and `confirmation` actions. Both sub-options are opt-in by the
63
+ * presence of a resolver (not a `false`/`true`/object flag) and share a shape: a `req`-scoped
64
+ * resolver, evaluated per request via an endpoint, whose choice is validated at save time only and
65
+ * never re-checked when the action sends (the config is admin-authored, not visitor-controlled).
66
+ *
67
+ * `fromAddresses` gives both actions a `from` select whose options come from the resolver; absent,
68
+ * neither action has a `from` field and every send uses the email adapter's default sender. The
69
+ * intended use is multi-tenant hosts where each tenant may only send from particular addresses
70
+ * (derive the tenant from `req`, return its allowed senders). Values are the literal string
71
+ * `payload.sendEmail` accepts as `from` (e.g. `'Name <addr@x.com>'` or a plain address).
72
+ *
73
+ * `departments` turns the `emailTeam` `to` into a select whose options come from the resolver
74
+ * (a `/:id/departments` endpoint); the intended use is to place `departmentsField()` on a document
75
+ * you own and read it back with `resolveDepartmentOptions`, which resolves each department's address
76
+ * for the requesting locale. Because `to` is localized, each admin locale stores its own resolved
77
+ * address and a submission's locale selects the address it routes to (Payload-native, no per-send
78
+ * lookup). Storing the resolved address, rather than a department id resolved live at send (consent's
79
+ * model), is deliberate: the routing target a form was saved with stays audit-stable even if the
80
+ * resolver's data later changes, so do not "fix" it into a live lookup. Multi-tenant hosts scope
81
+ * which document they read by the tenant derived from `req`; absent, the recipient fields simply
82
+ * offer no preset department options (still free-typed emails and field tokens).
83
+ */
84
+ email?: {
85
+ fromAddresses?: FromAddressesResolver;
86
+ departments?: DepartmentEmailsResolver; /** Narrows the recipient fields' behavior (free-typed emails, field tokens). See {@link RecipientsConfig}. */
87
+ recipients?: RecipientsConfig;
88
+ };
89
+ /**
90
+ * Where the consent statements a form can reference come from. Absent (the default): no sources,
91
+ * so the built-in `consent` field type is not registered at all and authors cannot add a consent
92
+ * field with nothing to reference (a developer-registered custom `consent` type via `fields`
93
+ * still wins).
94
+ *
95
+ * `sources` is an async `req`-scoped resolver returning the sources available to this request.
96
+ * The intended shape: place `consentSourcesField()` on a collection or global you own and read it
97
+ * back here. Multi-tenant hosts scope that read by the tenant derived from `req`, so a tenant's
98
+ * authors only ever see, and their visitors only ever agree to, their own statements. A form
99
+ * stores only a source's row `id`; the statement is resolved live per request (see
100
+ * `resolveConsentStatements`) and the proof is rebuilt from the source at submit, so neither is
101
+ * ever a copy the client could stale or forge.
102
+ */
103
+ consent?: {
104
+ sources: ConsentSourcesResolver;
105
+ /**
106
+ * What each submission snapshots of the agreed consent wording, for a versioned audit trail.
107
+ * `'both'` (default) stores a `statementHash`, the plain `statementText`, and the source name;
108
+ * `'hash'` keeps only the tamper-evident hash; `'text'` only the readable text; `false` keeps the
109
+ * lean id-only proof. The proof stays id-based regardless; this only adds the wording snapshot.
110
+ */
111
+ snapshot?: ConsentSnapshotMode;
112
+ /**
113
+ * Whether to resolve each form's consent statements on every read via an afterRead hook (the
114
+ * default, `true`). It attaches `consentStatements` to the form doc so a host can render the
115
+ * wording without a second call, at the cost of one source lookup per form read (N on a list).
116
+ * Set `false` to skip that hook and resolve statements yourself with the exported
117
+ * `resolveConsentStatements` when you render a form; submit-time proof capture is unaffected either
118
+ * way (it always re-resolves from the source).
119
+ */
120
+ resolveOnRead?: boolean;
121
+ };
122
+ /**
123
+ * Form-level button labels: `submitLabel` at the bottom of the Fields tab, `prevLabel` and
124
+ * `nextLabel` in a row at the bottom of the Flow tab (shown once the flow has a step). The
125
+ * rendered chrome resolves each label as `<Form>` prop, then the stored value, then the
126
+ * translated default. `fields` composes them: it receives the three default fields as a
127
+ * `{ submit, prev, next }` map with the content localization flag already applied and returns
128
+ * the map, so wrapping a default in a row with a host field (e.g. an icon select) or replacing
129
+ * one is explicit. `FormDocument.buttons` reassembles only those three known labels, so a
130
+ * host-added sibling field is still stored but is read off the raw document, not `doc.buttons`.
131
+ */
132
+ buttons?: ButtonsOption;
133
+ /**
134
+ * The success-response group. `redirect.fields` composes the fields inside the `response.redirect`
135
+ * group, mirroring `buttons.fields`: it receives the default fields (the `url` text field, plus the
136
+ * polymorphic `reference` relationship when `redirectRelationships` is set) and returns the group's
137
+ * final field array, so a host can prepend a custom link field (the pattern most projects already
138
+ * have), swap `url` for their own picker, reorder, or filter. Omit it and the group stays the
139
+ * built-in `url` (+ optional `reference`), unchanged.
140
+ *
141
+ * The plugin's built-in redirect handling reads `redirect.url` (and `redirect.reference` when
142
+ * configured); `toFormDocument` passes the whole `response` group through, so a host that replaces
143
+ * `url` with their own link field owns resolving it to a destination in their frontend, the same as
144
+ * the internal-reference case.
145
+ */
146
+ response?: ResponseOption;
147
+ /**
148
+ * Collections whose documents `response.redirect` can reference (`response.redirect.reference`),
149
+ * letting an author redirect a visitor to an internal document instead of a URL after a
150
+ * successful submit. Absent (the default): no `reference` field exists at all, matching today's
151
+ * URL-only redirect. Always polymorphic, even for a single slug (a `CollectionSlug[]` array, not
152
+ * a bare `CollectionSlug`), so a host adding a second collection later never changes the stored
153
+ * shape, the same precedent as `consentSourcesField()`'s `page` picker. The plugin never resolves
154
+ * the reference to a URL itself (it has no notion of the host's routing); `toFormDocument` passes
155
+ * the raw `{ relationTo, value }` pair through on `FormDocument.response.redirect.reference` for
156
+ * the host to resolve. Mirrors the `redirectRelationships` option of Payload's native
157
+ * `plugin-form-builder`.
158
+ */
159
+ redirectRelationships?: CollectionSlug[];
160
+ /**
161
+ * File uploads are bring-your-own. Default `false`: no upload collection is involved and the
162
+ * built-in `file` field type is removed from the registry, so form authors cannot add a field
163
+ * with nowhere to land (a developer-registered custom `file` type via `fields` still wins).
164
+ * `{ collection: 'slug' }` points at a host-owned upload collection (created by the app with
165
+ * its storage adapter); the plugin validates it at boot, appends its hidden `owner` field when
166
+ * absent, and prepends the spam upload hooks.
167
+ */
168
+ uploads?: UploadsOption; /** Honeypot + rate-limiting (on by default) + a captcha adapter seam + upload-ownership scoping. `false` disables the whole subsystem. */
169
+ spam?: SpamOption;
170
+ /**
171
+ * Aggregate-results endpoint options. `access` gates anonymous reads after the form is loaded
172
+ * and before anything is served; absent keeps the plugin-default gating (poll opt-in +
173
+ * visibility + enumerable-field guard). Multi-tenant hosts should compare `form.tenant` against
174
+ * the tenant derived from `req` so one tenant's poll counts are never readable under another
175
+ * tenant's id. Authenticated callers bypass this seam.
176
+ */
177
+ results?: {
178
+ access?: FormResultsAccess;
179
+ };
180
+ /**
181
+ * Poll behavior. `votedCookie: true` sets an httpOnly `fb-voted-{formId}=1` cookie on each
182
+ * successful submission to a poll-enabled form, letting SSR hosts read the voted state via
183
+ * `hasVotedCookie` and pass it to `<Poll hasVoted>`. Default `false`.
184
+ * `sources` registers poll option sources (`definePollOptionSource`), letting authors populate
185
+ * a poll's choices from host domain data with stable values; there are no built-ins. With at
186
+ * least one source registered, the forms poll group gains an `optionSource` select plus its
187
+ * per-source `sourceConfig`, and submissions to a sourced poll only accept resolved values.
188
+ * `outcomeFields` composes the poll `outcome` group: it receives the two default fields
189
+ * (`winningValues`, `resolvedAt`) and returns the group's final field array verbatim, so a host
190
+ * can swap `winningValues` for its own component (e.g. a relationship picker over the voteable
191
+ * records). Membership validation runs server-side regardless, so a swap cannot bypass it.
192
+ * `types` registers outcome strategies (`definePollType`) shown in the poll `type` select. The
193
+ * built-ins `manual` (default, hand-picked), `mostVoted` (auto-resolves to the top choice(s) on
194
+ * close), and `source` (delegates to the option source) are always registered; a host entry keyed
195
+ * by (or carrying) a built-in slug replaces it. A closed poll whose strategy is not `manual`
196
+ * auto-resolves via a scheduled job when a runner is present, or on the next results read otherwise.
197
+ */
198
+ poll?: {
199
+ votedCookie?: boolean;
200
+ sources?: PollOptionSourcesConfig;
201
+ types?: PollTypesConfig;
202
+ outcomeFields?: OutcomeFieldsOverride;
203
+ };
204
+ /**
205
+ * When `true`, the raw `values`, `descriptors`, and `consent` JSON fields are visible in the
206
+ * submission admin view. Default `false`, because the `SubmissionAnswers` UI component already
207
+ * represents those fields fully and they are noisy shown alongside it.
208
+ */
209
+ showSubmissionRawFields?: boolean;
210
+ /**
211
+ * Override individual plugin-managed collections using explicit spreads. Each key accepts a
212
+ * `CollectionOverrides` object: top-level keys are spread with the plugin's defaults (spread
213
+ * order per key determines who wins), hooks are appended after the plugin's own hooks, and
214
+ * `fields` is a function that receives the default fields and returns the final array so
215
+ * additions/removals are always intentional.
216
+ */
217
+ overrides?: {
218
+ forms?: CollectionOverrides;
219
+ formSubmissions?: CollectionOverrides;
220
+ };
221
+ };
222
+ declare module 'payload' {
223
+ interface RegisteredPlugins {
224
+ '@10x-media/form-builder': FormBuilderPluginOptions;
225
+ }
226
+ }
227
+ //#endregion
228
+ export { FormBuilderPluginOptions };
229
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1,12 @@
1
+ //#region src/plugin/access.ts
2
+ /**
3
+ * Standard "must be logged in" access guard. Typed structurally so it satisfies both Payload's
4
+ * collection-level `Access` and field-level `FieldAccess`. Shared across all form-builder
5
+ * collections so the pattern is not repeated inline. Candidate for extraction to a shared
6
+ * `config/payload-access` package once more plugins in this monorepo need it.
7
+ */
8
+ const isLoggedIn = ({ req }) => Boolean(req.user);
9
+ //#endregion
10
+ export { isLoggedIn };
11
+
12
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","names":[],"sources":["../../src/plugin/access.ts"],"sourcesContent":["/**\n * Standard \"must be logged in\" access guard. Typed structurally so it satisfies both Payload's\n * collection-level `Access` and field-level `FieldAccess`. Shared across all form-builder\n * collections so the pattern is not repeated inline. Candidate for extraction to a shared\n * `config/payload-access` package once more plugins in this monorepo need it.\n */\nexport const isLoggedIn = ({ req }: { req: { user?: unknown } }): boolean => Boolean(req.user)\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc,EAAE,UAAgD,QAAQ,IAAI,IAAI"}
@@ -0,0 +1,11 @@
1
+ //#region src/plugin/applyRegistryConfig.d.ts
2
+ /** Any registry entry: an object carrying a string `type` discriminator, keyed by that type. */
3
+ type TypedDefinition = {
4
+ type: string;
5
+ };
6
+ /** Per-type opt-in: `false` removes a type, `true` keeps the seeded default, a definition adds or replaces one. */
7
+ type RegistryOption<T extends TypedDefinition> = boolean | T;
8
+ type RegistryConfig<T extends TypedDefinition> = Record<string, RegistryOption<T>>;
9
+ //#endregion
10
+ export { RegistryConfig };
11
+ //# sourceMappingURL=applyRegistryConfig.d.ts.map
@@ -0,0 +1,20 @@
1
+ //#region src/plugin/applyRegistryConfig.ts
2
+ /**
3
+ * Apply a per-type opt-in override map onto a seeded registry, in place. `false` removes the type,
4
+ * `true` keeps whatever default is already seeded (a no-op when none exists), and a definition adds
5
+ * or replaces one with its `type` forced to the config key, so the authored slug (derived from
6
+ * `type`) and the lookup key can never drift apart and silently orphan the entry. Shared by the
7
+ * field-type, validation-rule, action, poll-source, and poll-type registries.
8
+ */
9
+ const applyRegistryConfig = (registry, config) => {
10
+ for (const [type, option] of Object.entries(config)) if (option === false) registry.delete(type);
11
+ else if (option !== true) registry.set(type, {
12
+ ...option,
13
+ type
14
+ });
15
+ return registry;
16
+ };
17
+ //#endregion
18
+ export { applyRegistryConfig };
19
+
20
+ //# sourceMappingURL=applyRegistryConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyRegistryConfig.js","names":[],"sources":["../../src/plugin/applyRegistryConfig.ts"],"sourcesContent":["/** Any registry entry: an object carrying a string `type` discriminator, keyed by that type. */\nexport type TypedDefinition = { type: string }\n\n/** Per-type opt-in: `false` removes a type, `true` keeps the seeded default, a definition adds or replaces one. */\nexport type RegistryOption<T extends TypedDefinition> = boolean | T\n\nexport type RegistryConfig<T extends TypedDefinition> = Record<string, RegistryOption<T>>\n\n/**\n * Apply a per-type opt-in override map onto a seeded registry, in place. `false` removes the type,\n * `true` keeps whatever default is already seeded (a no-op when none exists), and a definition adds\n * or replaces one with its `type` forced to the config key, so the authored slug (derived from\n * `type`) and the lookup key can never drift apart and silently orphan the entry. Shared by the\n * field-type, validation-rule, action, poll-source, and poll-type registries.\n */\nexport const applyRegistryConfig = <T extends TypedDefinition>(\n\tregistry: Map<string, T>,\n\tconfig: RegistryConfig<T>\n): Map<string, T> => {\n\tfor (const [type, option] of Object.entries(config)) {\n\t\tif (option === false) {\n\t\t\tregistry.delete(type)\n\t\t} else if (option !== true) {\n\t\t\tregistry.set(type, { ...option, type })\n\t\t}\n\t}\n\treturn registry\n}\n"],"mappings":";;;;;;;;AAeA,MAAa,uBACZ,UACA,WACoB;CACpB,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,MAAM,GACjD,IAAI,WAAW,OACd,SAAS,OAAO,IAAI;MACd,IAAI,WAAW,MACrB,SAAS,IAAI,MAAM;EAAE,GAAG;EAAQ;CAAK,CAAC;CAGxC,OAAO;AACR"}
@@ -0,0 +1,22 @@
1
+ import { CollectionConfig, Field } from "payload";
2
+
3
+ //#region src/plugin/collectionOverrides.d.ts
4
+ /**
5
+ * Instead of accepting a static field array (which deepMerge would silently replace), the consumer
6
+ * receives the plugin's default fields and returns the final array. This makes the intent explicit:
7
+ * append, prepend, filter out, or wrap any field without risk of accidentally wiping the defaults.
8
+ */
9
+ type FieldsOverride = (args: {
10
+ defaultFields: Field[];
11
+ }) => Field[];
12
+ /**
13
+ * Typed override surface for plugin-managed collections. Top-level keys use explicit spread order
14
+ * (see each collection builder) so the consumer always knows which values they can override and
15
+ * which are locked by the plugin for correctness or security.
16
+ */
17
+ type CollectionOverrides = {
18
+ fields?: FieldsOverride;
19
+ } & Partial<Omit<CollectionConfig, 'fields'>>;
20
+ //#endregion
21
+ export { CollectionOverrides, FieldsOverride };
22
+ //# sourceMappingURL=collectionOverrides.d.ts.map
@@ -0,0 +1,26 @@
1
+ //#region src/plugin/customState.ts
2
+ /** Root key under `config.custom` where the plugin stashes runtime state for root-level helpers. */
3
+ const CUSTOM_KEY = "@10x-media/form-builder";
4
+ /**
5
+ * Merge `patch` into the plugin's slice of `config.custom`, leaving every other key untouched.
6
+ * Root-level helpers (`resolvePollOptions`, `resolveConsentStatements`) are called by hosts with a
7
+ * `payload` instance and no plugin state, so the plugin parks what they need on the config at boot
8
+ * and they read it back through `payload.config`. Both readers share one key, so the plugin's slice
9
+ * is patched rather than replaced.
10
+ */
11
+ const stashCustomState = (custom, patch) => {
12
+ const existing = custom?.[CUSTOM_KEY] != null && typeof custom[CUSTOM_KEY] === "object" ? custom[CUSTOM_KEY] : {};
13
+ return {
14
+ ...custom ?? {},
15
+ [CUSTOM_KEY]: {
16
+ ...existing,
17
+ ...patch
18
+ }
19
+ };
20
+ };
21
+ /** The plugin's slice of `payload.config.custom`, or an empty object when the plugin never booted. */
22
+ const customStateOf = (payload) => payload.config.custom?.[CUSTOM_KEY] ?? {};
23
+ //#endregion
24
+ export { customStateOf, stashCustomState };
25
+
26
+ //# sourceMappingURL=customState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customState.js","names":[],"sources":["../../src/plugin/customState.ts"],"sourcesContent":["import type { Payload } from 'payload'\n\n/** Root key under `config.custom` where the plugin stashes runtime state for root-level helpers. */\nconst CUSTOM_KEY = '@10x-media/form-builder'\n\n/**\n * Merge `patch` into the plugin's slice of `config.custom`, leaving every other key untouched.\n * Root-level helpers (`resolvePollOptions`, `resolveConsentStatements`) are called by hosts with a\n * `payload` instance and no plugin state, so the plugin parks what they need on the config at boot\n * and they read it back through `payload.config`. Both readers share one key, so the plugin's slice\n * is patched rather than replaced.\n */\nexport const stashCustomState = <TState extends Record<string, unknown>>(\n\tcustom: Record<string, unknown> | undefined,\n\tpatch: TState\n): Record<string, unknown> => {\n\tconst existing =\n\t\tcustom?.[CUSTOM_KEY] != null && typeof custom[CUSTOM_KEY] === 'object'\n\t\t\t? (custom[CUSTOM_KEY] as Record<string, unknown>)\n\t\t\t: {}\n\treturn { ...(custom ?? {}), [CUSTOM_KEY]: { ...existing, ...patch } }\n}\n\n/** The plugin's slice of `payload.config.custom`, or an empty object when the plugin never booted. */\nexport const customStateOf = <TState extends Record<string, unknown>>(\n\tpayload: Payload\n): Partial<TState> => (payload.config.custom?.[CUSTOM_KEY] as Partial<TState> | undefined) ?? {}\n"],"mappings":";;AAGA,MAAM,aAAa;;;;;;;;AASnB,MAAa,oBACZ,QACA,UAC6B;CAC7B,MAAM,WACL,SAAS,eAAe,QAAQ,OAAO,OAAO,gBAAgB,WAC1D,OAAO,cACR,CAAC;CACL,OAAO;EAAE,GAAI,UAAU,CAAC;GAAK,aAAa;GAAE,GAAG;GAAU,GAAG;EAAM;CAAE;AACrE;;AAGA,MAAa,iBACZ,YACsB,QAAQ,OAAO,SAAS,eAA+C,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { registerPollCloseTask } from "../poll/closeJob.js";
2
+ import { buildFormsCollection } from "../collections/forms.js";
3
+ import { buildSubmissionsCollection } from "../collections/formSubmissions.js";
4
+ import { registerActionsTask } from "../actions/task.js";
5
+ import { attachUploadsCollection } from "./uploadsCollection.js";
6
+ //#region src/plugin/registerCollections.ts
7
+ const registerCollections = ({ config, registry, ruleRegistry, consentSources, consentSnapshot, consentResolveOnRead, actionRegistry, richText, hasJobsPlugin, events, uploads, spam, showSubmissionRawFields, localizeContent, resultsAccess, votedCookie, pollSourceRegistry, pollTypeRegistry, outcomeFields, buttons, response, fromAddresses, departments, redirectRelationships, overrides }) => {
8
+ registerActionsTask(config, actionRegistry, richText);
9
+ registerPollCloseTask(config);
10
+ const hasRunner = Boolean(config.jobs?.autoRun) || hasJobsPlugin;
11
+ const uploadSlug = uploads === false ? void 0 : uploads.collection;
12
+ if (uploads !== false) attachUploadsCollection({
13
+ config,
14
+ slug: uploads.collection,
15
+ spam
16
+ });
17
+ config.collections = [
18
+ ...config.collections ?? [],
19
+ buildSubmissionsCollection({
20
+ registry,
21
+ ruleRegistry,
22
+ consentSources,
23
+ consentSnapshot,
24
+ actionRegistry,
25
+ richText,
26
+ events,
27
+ hasRunner,
28
+ uploadSlug,
29
+ spam,
30
+ votedCookie,
31
+ pollSourceRegistry,
32
+ showRawFields: showSubmissionRawFields,
33
+ overrides: overrides?.formSubmissions
34
+ }),
35
+ buildFormsCollection({
36
+ registry,
37
+ ruleRegistry,
38
+ consentSources,
39
+ consentResolveOnRead,
40
+ actionRegistry,
41
+ localizeContent,
42
+ richText,
43
+ uploadsCollectionSlug: uploadSlug,
44
+ resultsAccess,
45
+ pollSourceRegistry,
46
+ pollTypeRegistry,
47
+ outcomeFields,
48
+ buttons,
49
+ response,
50
+ fromAddresses,
51
+ departments,
52
+ redirectRelationships,
53
+ overrides: overrides?.forms
54
+ })
55
+ ];
56
+ };
57
+ //#endregion
58
+ export { registerCollections };
59
+
60
+ //# sourceMappingURL=registerCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerCollections.js","names":[],"sources":["../../src/plugin/registerCollections.ts"],"sourcesContent":["import type { CollectionSlug, Config } from 'payload'\nimport type { RichTextBodyOption } from '../actions/body/serializeBody'\nimport type { FromAddressesResolver } from '../actions/fromAddresses'\nimport type { ActionRegistry } from '../actions/registry'\nimport { registerActionsTask } from '../actions/task'\nimport type { FormResultsAccess } from '../aggregation/resolveResultsRequest'\nimport type { ButtonsOption } from '../collections/buttonFields'\nimport { buildSubmissionsCollection } from '../collections/formSubmissions'\nimport { buildFormsCollection } from '../collections/forms'\nimport type { ResponseOption } from '../collections/redirectFields'\nimport type { ConsentSnapshotMode } from '../consent/captureConsent'\nimport type { ConsentSourcesResolver } from '../consent/types'\nimport type { DepartmentEmailsResolver } from '../email/departments'\nimport type { FormEventSink } from '../events/types'\nimport type { FieldTypeRegistry } from '../fields/registry'\nimport { registerPollCloseTask } from '../poll/closeJob'\nimport type { OutcomeFieldsOverride } from '../poll/outcomeFields'\nimport type { PollTypeRegistry } from '../poll/pollTypeRegistry'\nimport type { PollOptionSourceRegistry } from '../poll/registry'\nimport type { ResolvedSpamConfig } from '../spam/types'\nimport type { ValidationRuleRegistry } from '../validation/registry'\nimport type { CollectionOverrides } from './collectionOverrides'\nimport { attachUploadsCollection, type UploadsOption } from './uploadsCollection'\n\ntype RegisterCollectionsArgs = {\n\tconfig: Config\n\tregistry: FieldTypeRegistry\n\truleRegistry: ValidationRuleRegistry\n\tconsentSources?: ConsentSourcesResolver\n\tconsentSnapshot?: ConsentSnapshotMode\n\t/** Plugin `consent.resolveOnRead` (default true); false skips the per-read consent afterRead hook. */\n\tconsentResolveOnRead?: boolean\n\tactionRegistry: ActionRegistry\n\trichText?: RichTextBodyOption\n\thasJobsPlugin: boolean\n\tevents?: FormEventSink\n\tuploads: UploadsOption\n\tspam: ResolvedSpamConfig | false\n\tshowSubmissionRawFields: boolean\n\tlocalizeContent: boolean\n\tresultsAccess?: FormResultsAccess\n\tvotedCookie: boolean\n\tpollSourceRegistry: PollOptionSourceRegistry\n\tpollTypeRegistry: PollTypeRegistry\n\toutcomeFields?: OutcomeFieldsOverride\n\tbuttons?: ButtonsOption\n\tresponse?: ResponseOption\n\tfromAddresses?: FromAddressesResolver\n\tdepartments?: DepartmentEmailsResolver\n\tredirectRelationships?: CollectionSlug[]\n\toverrides?: {\n\t\tforms?: CollectionOverrides\n\t\tformSubmissions?: CollectionOverrides\n\t}\n}\n\nexport const registerCollections = ({\n\tconfig,\n\tregistry,\n\truleRegistry,\n\tconsentSources,\n\tconsentSnapshot,\n\tconsentResolveOnRead,\n\tactionRegistry,\n\trichText,\n\thasJobsPlugin,\n\tevents,\n\tuploads,\n\tspam,\n\tshowSubmissionRawFields,\n\tlocalizeContent,\n\tresultsAccess,\n\tvotedCookie,\n\tpollSourceRegistry,\n\tpollTypeRegistry,\n\toutcomeFields,\n\tbuttons,\n\tresponse,\n\tfromAddresses,\n\tdepartments,\n\tredirectRelationships,\n\toverrides,\n}: RegisterCollectionsArgs): void => {\n\tregisterActionsTask(config, actionRegistry, richText)\n\tregisterPollCloseTask(config)\n\tconst hasRunner = Boolean(config.jobs?.autoRun) || hasJobsPlugin\n\n\tconst uploadSlug = uploads === false ? undefined : uploads.collection\n\tif (uploads !== false) {\n\t\tattachUploadsCollection({ config, slug: uploads.collection, spam })\n\t}\n\n\t// Payload has no nav-sort option, so it lists collections in registration order. Register\n\t// `form-submissions` before `forms` so the \"Forms\" nav group reads alphabetically\n\t// (`form-submissions` < `forms`); ordering plugin nav groups against a host's own collections\n\t// stays a host concern.\n\tconfig.collections = [\n\t\t...(config.collections ?? []),\n\t\tbuildSubmissionsCollection({\n\t\t\tregistry,\n\t\t\truleRegistry,\n\t\t\tconsentSources,\n\t\t\tconsentSnapshot,\n\t\t\tactionRegistry,\n\t\t\trichText,\n\t\t\tevents,\n\t\t\thasRunner,\n\t\t\tuploadSlug,\n\t\t\tspam,\n\t\t\tvotedCookie,\n\t\t\tpollSourceRegistry,\n\t\t\tshowRawFields: showSubmissionRawFields,\n\t\t\toverrides: overrides?.formSubmissions,\n\t\t}),\n\t\tbuildFormsCollection({\n\t\t\tregistry,\n\t\t\truleRegistry,\n\t\t\tconsentSources,\n\t\t\tconsentResolveOnRead,\n\t\t\tactionRegistry,\n\t\t\tlocalizeContent,\n\t\t\trichText,\n\t\t\tuploadsCollectionSlug: uploadSlug,\n\t\t\tresultsAccess,\n\t\t\tpollSourceRegistry,\n\t\t\tpollTypeRegistry,\n\t\t\toutcomeFields,\n\t\t\tbuttons,\n\t\t\tresponse,\n\t\t\tfromAddresses,\n\t\t\tdepartments,\n\t\t\tredirectRelationships,\n\t\t\toverrides: overrides?.forms,\n\t\t}),\n\t]\n}\n"],"mappings":";;;;;;AAwDA,MAAa,uBAAuB,EACnC,QACA,UACA,cACA,gBACA,iBACA,sBACA,gBACA,UACA,eACA,QACA,SACA,MACA,yBACA,iBACA,eACA,aACA,oBACA,kBACA,eACA,SACA,UACA,eACA,aACA,uBACA,gBACoC;CACpC,oBAAoB,QAAQ,gBAAgB,QAAQ;CACpD,sBAAsB,MAAM;CAC5B,MAAM,YAAY,QAAQ,OAAO,MAAM,OAAO,KAAK;CAEnD,MAAM,aAAa,YAAY,QAAQ,KAAA,IAAY,QAAQ;CAC3D,IAAI,YAAY,OACf,wBAAwB;EAAE;EAAQ,MAAM,QAAQ;EAAY;CAAK,CAAC;CAOnE,OAAO,cAAc;EACpB,GAAI,OAAO,eAAe,CAAC;EAC3B,2BAA2B;GAC1B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,eAAe;GACf,WAAW,WAAW;EACvB,CAAC;EACD,qBAAqB;GACpB;GACA;GACA;GACA;GACA;GACA;GACA;GACA,uBAAuB;GACvB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,WAAW,WAAW;EACvB,CAAC;CACF;AACD"}
@@ -0,0 +1,19 @@
1
+ import { toNested, translations } from "../translations/index.js";
2
+ import { deepMergeSimple } from "payload/shared";
3
+ //#region src/plugin/registerTranslations.ts
4
+ /**
5
+ * Merge this plugin's translations into the host config. Plugin-level
6
+ * `overrides` win over the built-ins key-by-key and may add locales the plugin
7
+ * does not ship. A host value wins over both (`deepMergeSimple` lets the second
8
+ * argument override), so projects can override any string.
9
+ */
10
+ const registerTranslations = (config, overrides) => {
11
+ const nested = {};
12
+ for (const [locale, flat] of Object.entries(overrides ?? {})) nested[locale] = toNested(flat);
13
+ config.i18n ??= {};
14
+ config.i18n.translations = deepMergeSimple(deepMergeSimple(translations, nested), config.i18n.translations ?? {});
15
+ };
16
+ //#endregion
17
+ export { registerTranslations };
18
+
19
+ //# sourceMappingURL=registerTranslations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerTranslations.js","names":[],"sources":["../../src/plugin/registerTranslations.ts"],"sourcesContent":["import type { Config } from 'payload'\nimport { deepMergeSimple } from 'payload/shared'\n\nimport { type TranslationsOption, toNested, translations } from '../translations'\n\ntype Translations = NonNullable<NonNullable<Config['i18n']>['translations']>\n\n/**\n * Merge this plugin's translations into the host config. Plugin-level\n * `overrides` win over the built-ins key-by-key and may add locales the plugin\n * does not ship. A host value wins over both (`deepMergeSimple` lets the second\n * argument override), so projects can override any string.\n */\nexport const registerTranslations = (config: Config, overrides?: TranslationsOption): void => {\n\tconst nested: Record<string, Record<string, Record<string, string>>> = {}\n\tfor (const [locale, flat] of Object.entries(overrides ?? {})) {\n\t\tnested[locale] = toNested(flat)\n\t}\n\tconfig.i18n ??= {}\n\tconfig.i18n.translations = deepMergeSimple<Translations>(\n\t\tdeepMergeSimple(translations, nested),\n\t\tconfig.i18n.translations ?? {}\n\t)\n}\n"],"mappings":";;;;;;;;;AAaA,MAAa,wBAAwB,QAAgB,cAAyC;CAC7F,MAAM,SAAiE,CAAC;CACxE,KAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,aAAa,CAAC,CAAC,GAC1D,OAAO,UAAU,SAAS,IAAI;CAE/B,OAAO,SAAS,CAAC;CACjB,OAAO,KAAK,eAAe,gBAC1B,gBAAgB,cAAc,MAAM,GACpC,OAAO,KAAK,gBAAgB,CAAC,CAC9B;AACD"}
@@ -0,0 +1,16 @@
1
+ import { Config } from "payload";
2
+
3
+ //#region src/plugin/uploadsCollection.d.ts
4
+ /**
5
+ * Uploads are bring-your-own: `false` (the default) disables file fields entirely, an object points
6
+ * at a host-owned upload collection (created by the app with its storage adapter of choice).
7
+ * `mimeTypes` optionally constrains the file field's MIME picker for hosts that enforce types by other
8
+ * means than the collection's own `upload.mimeTypes` (which is read automatically when this is absent).
9
+ */
10
+ type UploadsOption = false | {
11
+ collection: string;
12
+ mimeTypes?: string[];
13
+ };
14
+ //#endregion
15
+ export { UploadsOption };
16
+ //# sourceMappingURL=uploadsCollection.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { buildUploadOwnerStamp, buildUploadRateLimit } from "../spam/uploadHooks.js";
2
+ //#region src/plugin/uploadsCollection.ts
3
+ /**
4
+ * The MIME types the file field's picker should offer: the host upload collection's own
5
+ * `upload.mimeTypes`, or undefined (no constraint, so the picker keeps its full list). Read at
6
+ * plugin-factory time, before the field registry freezes; `attachUploadsCollection` runs too late.
7
+ */
8
+ const readUploadCollectionMimeTypes = (config, slug) => {
9
+ const upload = (config.collections?.find((collection) => collection.slug === slug))?.upload;
10
+ return typeof upload === "object" && Array.isArray(upload.mimeTypes) ? upload.mimeTypes : void 0;
11
+ };
12
+ /** Descends presentational rows only: an `owner` field nested in a group/tabs/collapsible is not detected, so a top-level one gets appended alongside it. */
13
+ const hasFieldNamed = (fields, name) => fields.some((field) => {
14
+ if ("name" in field && field.name === name) return true;
15
+ return field.type === "row" && hasFieldNamed(field.fields, name);
16
+ });
17
+ /**
18
+ * Wire the plugin's upload concerns into the host-owned upload collection named by
19
+ * `uploads.collection`. The collection must already exist in `config.collections` and carry an
20
+ * `upload` config; anything else is a plugin misconfiguration and throws at boot. The plugin
21
+ * appends its hidden `owner` text field unless the host already defines a field named `owner`
22
+ * (then that field is reused and must stay a text-compatible identity slot), and prepends the
23
+ * spam upload hooks (rate limit, owner stamp) ahead of the host's own hooks so abuse checks run
24
+ * first. The host entry is replaced with a new object; the host's config is never mutated.
25
+ */
26
+ const attachUploadsCollection = ({ config, slug, spam }) => {
27
+ const collections = config.collections ?? [];
28
+ const target = collections.find((collection) => collection.slug === slug);
29
+ if (!target) throw new Error(`@10x-media/form-builder: uploads.collection "${slug}" was not found in config.collections. Create an upload-enabled collection (with your storage adapter) and pass its slug, e.g. formBuilder({ uploads: { collection: 'media' } }).`);
30
+ if (!target.upload) throw new Error(`@10x-media/form-builder: uploads.collection "${slug}" has no \`upload\` config. File fields store Payload uploads, so the collection must be an upload collection (set \`upload: true\` or an upload options object on it).`);
31
+ const fields = hasFieldNamed(target.fields, "owner") ? target.fields : [...target.fields, {
32
+ name: "owner",
33
+ type: "text",
34
+ admin: {
35
+ readOnly: true,
36
+ hidden: true
37
+ }
38
+ }];
39
+ const attached = {
40
+ ...target,
41
+ fields,
42
+ ...spam ? { hooks: {
43
+ ...target.hooks ?? {},
44
+ beforeOperation: [buildUploadRateLimit(spam), ...target.hooks?.beforeOperation ?? []],
45
+ beforeValidate: [buildUploadOwnerStamp(spam), ...target.hooks?.beforeValidate ?? []]
46
+ } } : {}
47
+ };
48
+ config.collections = collections.map((collection) => collection.slug === slug ? attached : collection);
49
+ };
50
+ //#endregion
51
+ export { attachUploadsCollection, readUploadCollectionMimeTypes };
52
+
53
+ //# sourceMappingURL=uploadsCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadsCollection.js","names":[],"sources":["../../src/plugin/uploadsCollection.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field } from 'payload'\nimport type { ResolvedSpamConfig } from '../spam/types'\nimport { buildUploadOwnerStamp, buildUploadRateLimit } from '../spam/uploadHooks'\n\n/**\n * Uploads are bring-your-own: `false` (the default) disables file fields entirely, an object points\n * at a host-owned upload collection (created by the app with its storage adapter of choice).\n * `mimeTypes` optionally constrains the file field's MIME picker for hosts that enforce types by other\n * means than the collection's own `upload.mimeTypes` (which is read automatically when this is absent).\n */\nexport type UploadsOption = false | { collection: string; mimeTypes?: string[] }\n\n/**\n * The MIME types the file field's picker should offer: the host upload collection's own\n * `upload.mimeTypes`, or undefined (no constraint, so the picker keeps its full list). Read at\n * plugin-factory time, before the field registry freezes; `attachUploadsCollection` runs too late.\n */\nexport const readUploadCollectionMimeTypes = (\n\tconfig: Config,\n\tslug: string\n): string[] | undefined => {\n\tconst target = config.collections?.find((collection) => collection.slug === slug)\n\tconst upload = target?.upload\n\treturn typeof upload === 'object' && Array.isArray(upload.mimeTypes)\n\t\t? upload.mimeTypes\n\t\t: undefined\n}\n\n/** Descends presentational rows only: an `owner` field nested in a group/tabs/collapsible is not detected, so a top-level one gets appended alongside it. */\nconst hasFieldNamed = (fields: Field[], name: string): boolean =>\n\tfields.some((field) => {\n\t\tif ('name' in field && field.name === name) {\n\t\t\treturn true\n\t\t}\n\t\treturn field.type === 'row' && hasFieldNamed(field.fields, name)\n\t})\n\ntype AttachUploadsCollectionArgs = {\n\tconfig: Config\n\tslug: string\n\tspam: ResolvedSpamConfig | false\n}\n\n/**\n * Wire the plugin's upload concerns into the host-owned upload collection named by\n * `uploads.collection`. The collection must already exist in `config.collections` and carry an\n * `upload` config; anything else is a plugin misconfiguration and throws at boot. The plugin\n * appends its hidden `owner` text field unless the host already defines a field named `owner`\n * (then that field is reused and must stay a text-compatible identity slot), and prepends the\n * spam upload hooks (rate limit, owner stamp) ahead of the host's own hooks so abuse checks run\n * first. The host entry is replaced with a new object; the host's config is never mutated.\n */\nexport const attachUploadsCollection = ({\n\tconfig,\n\tslug,\n\tspam,\n}: AttachUploadsCollectionArgs): void => {\n\tconst collections = config.collections ?? []\n\tconst target = collections.find((collection) => collection.slug === slug)\n\tif (!target) {\n\t\tthrow new Error(\n\t\t\t`@10x-media/form-builder: uploads.collection \"${slug}\" was not found in config.collections. ` +\n\t\t\t\t`Create an upload-enabled collection (with your storage adapter) and pass its slug, ` +\n\t\t\t\t`e.g. formBuilder({ uploads: { collection: 'media' } }).`\n\t\t)\n\t}\n\tif (!target.upload) {\n\t\tthrow new Error(\n\t\t\t`@10x-media/form-builder: uploads.collection \"${slug}\" has no \\`upload\\` config. ` +\n\t\t\t\t`File fields store Payload uploads, so the collection must be an upload collection ` +\n\t\t\t\t`(set \\`upload: true\\` or an upload options object on it).`\n\t\t)\n\t}\n\n\tconst fields = hasFieldNamed(target.fields, 'owner')\n\t\t? target.fields\n\t\t: [\n\t\t\t\t...target.fields,\n\t\t\t\t{ name: 'owner', type: 'text', admin: { readOnly: true, hidden: true } } as Field,\n\t\t\t]\n\n\tconst attached: CollectionConfig = {\n\t\t...target,\n\t\tfields,\n\t\t...(spam\n\t\t\t? {\n\t\t\t\t\thooks: {\n\t\t\t\t\t\t...(target.hooks ?? {}),\n\t\t\t\t\t\tbeforeOperation: [buildUploadRateLimit(spam), ...(target.hooks?.beforeOperation ?? [])],\n\t\t\t\t\t\tbeforeValidate: [buildUploadOwnerStamp(spam), ...(target.hooks?.beforeValidate ?? [])],\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t}\n\n\tconfig.collections = collections.map((collection) =>\n\t\tcollection.slug === slug ? attached : collection\n\t)\n}\n"],"mappings":";;;;;;;AAiBA,MAAa,iCACZ,QACA,SAC0B;CAE1B,MAAM,UADS,OAAO,aAAa,MAAM,eAAe,WAAW,SAAS,IAAI,IACzD;CACvB,OAAO,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,SAAS,IAChE,OAAO,YACP,KAAA;AACJ;;AAGA,MAAM,iBAAiB,QAAiB,SACvC,OAAO,MAAM,UAAU;CACtB,IAAI,UAAU,SAAS,MAAM,SAAS,MACrC,OAAO;CAER,OAAO,MAAM,SAAS,SAAS,cAAc,MAAM,QAAQ,IAAI;AAChE,CAAC;;;;;;;;;;AAiBF,MAAa,2BAA2B,EACvC,QACA,MACA,WACwC;CACxC,MAAM,cAAc,OAAO,eAAe,CAAC;CAC3C,MAAM,SAAS,YAAY,MAAM,eAAe,WAAW,SAAS,IAAI;CACxE,IAAI,CAAC,QACJ,MAAM,IAAI,MACT,gDAAgD,KAAK,kLAGtD;CAED,IAAI,CAAC,OAAO,QACX,MAAM,IAAI,MACT,gDAAgD,KAAK,wKAGtD;CAGD,MAAM,SAAS,cAAc,OAAO,QAAQ,OAAO,IAChD,OAAO,SACP,CACA,GAAG,OAAO,QACV;EAAE,MAAM;EAAS,MAAM;EAAQ,OAAO;GAAE,UAAU;GAAM,QAAQ;EAAK;CAAE,CACxE;CAEF,MAAM,WAA6B;EAClC,GAAG;EACH;EACA,GAAI,OACD,EACA,OAAO;GACN,GAAI,OAAO,SAAS,CAAC;GACrB,iBAAiB,CAAC,qBAAqB,IAAI,GAAG,GAAI,OAAO,OAAO,mBAAmB,CAAC,CAAE;GACtF,gBAAgB,CAAC,sBAAsB,IAAI,GAAG,GAAI,OAAO,OAAO,kBAAkB,CAAC,CAAE;EACtF,EACD,IACC,CAAC;CACL;CAEA,OAAO,cAAc,YAAY,KAAK,eACrC,WAAW,SAAS,OAAO,WAAW,UACvC;AACD"}
@@ -0,0 +1,18 @@
1
+ //#region src/poll/applyPollOptions.ts
2
+ /**
3
+ * Replace the options of the field instance named `resultsField` with source-resolved options,
4
+ * without mutating the input. No-op when `resultsField` is unset or matches no instance
5
+ * (nameless bare rows never match), so hand-authored options stay untouched on forms without
6
+ * an option source.
7
+ */
8
+ const applyPollOptions = (fields, resultsField, options) => {
9
+ if (typeof resultsField !== "string" || resultsField.length === 0) return fields;
10
+ return fields.map((instance) => instance.name === resultsField ? {
11
+ ...instance,
12
+ options
13
+ } : instance);
14
+ };
15
+ //#endregion
16
+ export { applyPollOptions };
17
+
18
+ //# sourceMappingURL=applyPollOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyPollOptions.js","names":[],"sources":["../../src/poll/applyPollOptions.ts"],"sourcesContent":["import type { PollOption } from './definePollOptionSource'\n\n/**\n * Replace the options of the field instance named `resultsField` with source-resolved options,\n * without mutating the input. No-op when `resultsField` is unset or matches no instance\n * (nameless bare rows never match), so hand-authored options stay untouched on forms without\n * an option source.\n */\nexport const applyPollOptions = <T extends { name?: string }>(\n\tfields: T[],\n\tresultsField: string | null | undefined,\n\toptions: PollOption[]\n): T[] => {\n\tif (typeof resultsField !== 'string' || resultsField.length === 0) {\n\t\treturn fields\n\t}\n\treturn fields.map((instance) =>\n\t\tinstance.name === resultsField ? { ...instance, options } : instance\n\t)\n}\n"],"mappings":";;;;;;;AAQA,MAAa,oBACZ,QACA,cACA,YACS;CACT,IAAI,OAAO,iBAAiB,YAAY,aAAa,WAAW,GAC/D,OAAO;CAER,OAAO,OAAO,KAAK,aAClB,SAAS,SAAS,eAAe;EAAE,GAAG;EAAU;CAAQ,IAAI,QAC7D;AACD"}
@@ -0,0 +1,50 @@
1
+ import { keys } from "../translations/keys.js";
2
+ import { labelForKey, resolveDefinitionLabel } from "../translations/server.js";
3
+ //#region src/poll/buildPollOptionSourceFields.ts
4
+ /**
5
+ * Builds the `optionSource` select and `sourceConfig` group for the forms poll group; returns
6
+ * nothing when no sources are registered, so the fields only exist for hosts that opted in.
7
+ * Fields inside `sourceConfig` are annotated with `admin.condition` so only the fields of the
8
+ * currently selected source type are visible; like consent's `sourceConfig`, field names within
9
+ * the group must be unique across all registered sources. Unlike consent's `source` select there
10
+ * is no default: hand-authored options remain the baseline and a source is an explicit opt-in per
11
+ * form (the select stays clearable).
12
+ */
13
+ const buildPollOptionSourceFields = (registry) => {
14
+ const sources = [...registry.values()];
15
+ if (sources.length === 0) return [];
16
+ const sourceConfigFields = sources.flatMap((source) => (source.config ?? []).map((field) => {
17
+ const existingAdmin = typeof field.admin === "object" && field.admin !== null ? field.admin : {};
18
+ return {
19
+ ...field,
20
+ admin: {
21
+ ...existingAdmin,
22
+ condition: (data) => data?.poll?.optionSource === source.type
23
+ }
24
+ };
25
+ }));
26
+ return [{
27
+ name: "optionSource",
28
+ type: "select",
29
+ label: labelForKey(keys.pollOptionSource),
30
+ admin: { description: labelForKey(keys.pollOptionSourceDescription) },
31
+ options: sources.map((source) => ({
32
+ label: resolveDefinitionLabel(source.label),
33
+ value: source.type
34
+ }))
35
+ }, {
36
+ name: "sourceConfig",
37
+ type: "group",
38
+ label: labelForKey(keys.pollSourceConfig),
39
+ admin: { condition: (_data, siblingData) => Boolean(siblingData?.optionSource) },
40
+ fields: sourceConfigFields.length > 0 ? sourceConfigFields : [{
41
+ name: "_placeholder",
42
+ type: "text",
43
+ admin: { hidden: true }
44
+ }]
45
+ }];
46
+ };
47
+ //#endregion
48
+ export { buildPollOptionSourceFields };
49
+
50
+ //# sourceMappingURL=buildPollOptionSourceFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildPollOptionSourceFields.js","names":[],"sources":["../../src/poll/buildPollOptionSourceFields.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport { keys } from '../translations/keys'\nimport { labelForKey, resolveDefinitionLabel } from '../translations/server'\nimport type { PollOptionSourceRegistry } from './registry'\n\n/**\n * Builds the `optionSource` select and `sourceConfig` group for the forms poll group; returns\n * nothing when no sources are registered, so the fields only exist for hosts that opted in.\n * Fields inside `sourceConfig` are annotated with `admin.condition` so only the fields of the\n * currently selected source type are visible; like consent's `sourceConfig`, field names within\n * the group must be unique across all registered sources. Unlike consent's `source` select there\n * is no default: hand-authored options remain the baseline and a source is an explicit opt-in per\n * form (the select stays clearable).\n */\nexport const buildPollOptionSourceFields = (registry: PollOptionSourceRegistry): Field[] => {\n\tconst sources = [...registry.values()]\n\tif (sources.length === 0) {\n\t\treturn []\n\t}\n\n\tconst sourceConfigFields: Field[] = sources.flatMap((source) =>\n\t\t(source.config ?? []).map((field) => {\n\t\t\tconst existingAdmin =\n\t\t\t\ttypeof field.admin === 'object' && field.admin !== null ? field.admin : {}\n\t\t\treturn {\n\t\t\t\t...field,\n\t\t\t\tadmin: {\n\t\t\t\t\t...existingAdmin,\n\t\t\t\t\tcondition: (data: unknown) =>\n\t\t\t\t\t\t(data as { poll?: { optionSource?: string } })?.poll?.optionSource === source.type,\n\t\t\t\t},\n\t\t\t} as Field\n\t\t})\n\t)\n\n\treturn [\n\t\t{\n\t\t\tname: 'optionSource',\n\t\t\ttype: 'select',\n\t\t\tlabel: labelForKey(keys.pollOptionSource),\n\t\t\tadmin: {\n\t\t\t\tdescription: labelForKey(keys.pollOptionSourceDescription),\n\t\t\t},\n\t\t\toptions: sources.map((source) => ({\n\t\t\t\tlabel: resolveDefinitionLabel(source.label),\n\t\t\t\tvalue: source.type,\n\t\t\t})),\n\t\t},\n\t\t{\n\t\t\tname: 'sourceConfig',\n\t\t\ttype: 'group',\n\t\t\tlabel: labelForKey(keys.pollSourceConfig),\n\t\t\tadmin: {\n\t\t\t\tcondition: (_data, siblingData) => Boolean(siblingData?.optionSource),\n\t\t\t},\n\t\t\tfields:\n\t\t\t\tsourceConfigFields.length > 0\n\t\t\t\t\t? sourceConfigFields\n\t\t\t\t\t: [{ name: '_placeholder', type: 'text', admin: { hidden: true } }],\n\t\t},\n\t]\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,+BAA+B,aAAgD;CAC3F,MAAM,UAAU,CAAC,GAAG,SAAS,OAAO,CAAC;CACrC,IAAI,QAAQ,WAAW,GACtB,OAAO,CAAC;CAGT,MAAM,qBAA8B,QAAQ,SAAS,YACnD,OAAO,UAAU,CAAC,GAAG,KAAK,UAAU;EACpC,MAAM,gBACL,OAAO,MAAM,UAAU,YAAY,MAAM,UAAU,OAAO,MAAM,QAAQ,CAAC;EAC1E,OAAO;GACN,GAAG;GACH,OAAO;IACN,GAAG;IACH,YAAY,SACV,MAA+C,MAAM,iBAAiB,OAAO;GAChF;EACD;CACD,CAAC,CACF;CAEA,OAAO,CACN;EACC,MAAM;EACN,MAAM;EACN,OAAO,YAAY,KAAK,gBAAgB;EACxC,OAAO,EACN,aAAa,YAAY,KAAK,2BAA2B,EAC1D;EACA,SAAS,QAAQ,KAAK,YAAY;GACjC,OAAO,uBAAuB,OAAO,KAAK;GAC1C,OAAO,OAAO;EACf,EAAE;CACH,GACA;EACC,MAAM;EACN,MAAM;EACN,OAAO,YAAY,KAAK,gBAAgB;EACxC,OAAO,EACN,YAAY,OAAO,gBAAgB,QAAQ,aAAa,YAAY,EACrE;EACA,QACC,mBAAmB,SAAS,IACzB,qBACA,CAAC;GAAE,MAAM;GAAgB,MAAM;GAAQ,OAAO,EAAE,QAAQ,KAAK;EAAE,CAAC;CACrE,CACD;AACD"}