@payloadcms/plugin-form-builder 4.0.0-internal.bc5cf8c → 4.0.0-internal.c7d5de4

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 (207) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.d.ts.map +1 -1
  3. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.js +14 -7
  4. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.js.map +1 -1
  5. package/dist/collections/FormSubmissions/hooks/createCharge.d.ts.map +1 -1
  6. package/dist/collections/FormSubmissions/hooks/handleUploads.d.ts.map +1 -1
  7. package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts.map +1 -1
  8. package/dist/collections/FormSubmissions/index.d.ts.map +1 -1
  9. package/dist/collections/Forms/fields.d.ts.map +1 -1
  10. package/dist/collections/Forms/fields.js +156 -78
  11. package/dist/collections/Forms/fields.js.map +1 -1
  12. package/dist/collections/Forms/index.d.ts +1 -1
  13. package/dist/collections/Forms/index.d.ts.map +1 -1
  14. package/dist/collections/Forms/index.js +54 -19
  15. package/dist/collections/Forms/index.js.map +1 -1
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +29 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/translations/index.d.ts +6 -0
  21. package/dist/translations/index.d.ts.map +1 -0
  22. package/dist/translations/index.js +92 -0
  23. package/dist/translations/index.js.map +1 -0
  24. package/dist/translations/languages/ar.d.ts +4 -0
  25. package/dist/translations/languages/ar.d.ts.map +1 -0
  26. package/dist/translations/languages/ar.js +101 -0
  27. package/dist/translations/languages/ar.js.map +1 -0
  28. package/dist/translations/languages/az.d.ts +4 -0
  29. package/dist/translations/languages/az.d.ts.map +1 -0
  30. package/dist/translations/languages/az.js +101 -0
  31. package/dist/translations/languages/az.js.map +1 -0
  32. package/dist/translations/languages/bg.d.ts +4 -0
  33. package/dist/translations/languages/bg.d.ts.map +1 -0
  34. package/dist/translations/languages/bg.js +101 -0
  35. package/dist/translations/languages/bg.js.map +1 -0
  36. package/dist/translations/languages/bnBd.d.ts +4 -0
  37. package/dist/translations/languages/bnBd.d.ts.map +1 -0
  38. package/dist/translations/languages/bnBd.js +101 -0
  39. package/dist/translations/languages/bnBd.js.map +1 -0
  40. package/dist/translations/languages/bnIn.d.ts +4 -0
  41. package/dist/translations/languages/bnIn.d.ts.map +1 -0
  42. package/dist/translations/languages/bnIn.js +101 -0
  43. package/dist/translations/languages/bnIn.js.map +1 -0
  44. package/dist/translations/languages/ca.d.ts +4 -0
  45. package/dist/translations/languages/ca.d.ts.map +1 -0
  46. package/dist/translations/languages/ca.js +101 -0
  47. package/dist/translations/languages/ca.js.map +1 -0
  48. package/dist/translations/languages/cs.d.ts +4 -0
  49. package/dist/translations/languages/cs.d.ts.map +1 -0
  50. package/dist/translations/languages/cs.js +101 -0
  51. package/dist/translations/languages/cs.js.map +1 -0
  52. package/dist/translations/languages/da.d.ts +4 -0
  53. package/dist/translations/languages/da.d.ts.map +1 -0
  54. package/dist/translations/languages/da.js +101 -0
  55. package/dist/translations/languages/da.js.map +1 -0
  56. package/dist/translations/languages/de.d.ts +4 -0
  57. package/dist/translations/languages/de.d.ts.map +1 -0
  58. package/dist/translations/languages/de.js +101 -0
  59. package/dist/translations/languages/de.js.map +1 -0
  60. package/dist/translations/languages/en.d.ts +98 -0
  61. package/dist/translations/languages/en.d.ts.map +1 -0
  62. package/dist/translations/languages/en.js +101 -0
  63. package/dist/translations/languages/en.js.map +1 -0
  64. package/dist/translations/languages/es.d.ts +4 -0
  65. package/dist/translations/languages/es.d.ts.map +1 -0
  66. package/dist/translations/languages/es.js +101 -0
  67. package/dist/translations/languages/es.js.map +1 -0
  68. package/dist/translations/languages/et.d.ts +4 -0
  69. package/dist/translations/languages/et.d.ts.map +1 -0
  70. package/dist/translations/languages/et.js +101 -0
  71. package/dist/translations/languages/et.js.map +1 -0
  72. package/dist/translations/languages/fa.d.ts +4 -0
  73. package/dist/translations/languages/fa.d.ts.map +1 -0
  74. package/dist/translations/languages/fa.js +101 -0
  75. package/dist/translations/languages/fa.js.map +1 -0
  76. package/dist/translations/languages/fr.d.ts +4 -0
  77. package/dist/translations/languages/fr.d.ts.map +1 -0
  78. package/dist/translations/languages/fr.js +101 -0
  79. package/dist/translations/languages/fr.js.map +1 -0
  80. package/dist/translations/languages/he.d.ts +4 -0
  81. package/dist/translations/languages/he.d.ts.map +1 -0
  82. package/dist/translations/languages/he.js +101 -0
  83. package/dist/translations/languages/he.js.map +1 -0
  84. package/dist/translations/languages/hr.d.ts +4 -0
  85. package/dist/translations/languages/hr.d.ts.map +1 -0
  86. package/dist/translations/languages/hr.js +101 -0
  87. package/dist/translations/languages/hr.js.map +1 -0
  88. package/dist/translations/languages/hu.d.ts +4 -0
  89. package/dist/translations/languages/hu.d.ts.map +1 -0
  90. package/dist/translations/languages/hu.js +101 -0
  91. package/dist/translations/languages/hu.js.map +1 -0
  92. package/dist/translations/languages/hy.d.ts +4 -0
  93. package/dist/translations/languages/hy.d.ts.map +1 -0
  94. package/dist/translations/languages/hy.js +101 -0
  95. package/dist/translations/languages/hy.js.map +1 -0
  96. package/dist/translations/languages/id.d.ts +4 -0
  97. package/dist/translations/languages/id.d.ts.map +1 -0
  98. package/dist/translations/languages/id.js +101 -0
  99. package/dist/translations/languages/id.js.map +1 -0
  100. package/dist/translations/languages/is.d.ts +4 -0
  101. package/dist/translations/languages/is.d.ts.map +1 -0
  102. package/dist/translations/languages/is.js +101 -0
  103. package/dist/translations/languages/is.js.map +1 -0
  104. package/dist/translations/languages/it.d.ts +4 -0
  105. package/dist/translations/languages/it.d.ts.map +1 -0
  106. package/dist/translations/languages/it.js +101 -0
  107. package/dist/translations/languages/it.js.map +1 -0
  108. package/dist/translations/languages/ja.d.ts +4 -0
  109. package/dist/translations/languages/ja.d.ts.map +1 -0
  110. package/dist/translations/languages/ja.js +101 -0
  111. package/dist/translations/languages/ja.js.map +1 -0
  112. package/dist/translations/languages/ko.d.ts +4 -0
  113. package/dist/translations/languages/ko.d.ts.map +1 -0
  114. package/dist/translations/languages/ko.js +101 -0
  115. package/dist/translations/languages/ko.js.map +1 -0
  116. package/dist/translations/languages/lt.d.ts +4 -0
  117. package/dist/translations/languages/lt.d.ts.map +1 -0
  118. package/dist/translations/languages/lt.js +101 -0
  119. package/dist/translations/languages/lt.js.map +1 -0
  120. package/dist/translations/languages/lv.d.ts +4 -0
  121. package/dist/translations/languages/lv.d.ts.map +1 -0
  122. package/dist/translations/languages/lv.js +101 -0
  123. package/dist/translations/languages/lv.js.map +1 -0
  124. package/dist/translations/languages/my.d.ts +4 -0
  125. package/dist/translations/languages/my.d.ts.map +1 -0
  126. package/dist/translations/languages/my.js +101 -0
  127. package/dist/translations/languages/my.js.map +1 -0
  128. package/dist/translations/languages/nb.d.ts +4 -0
  129. package/dist/translations/languages/nb.d.ts.map +1 -0
  130. package/dist/translations/languages/nb.js +101 -0
  131. package/dist/translations/languages/nb.js.map +1 -0
  132. package/dist/translations/languages/nl.d.ts +4 -0
  133. package/dist/translations/languages/nl.d.ts.map +1 -0
  134. package/dist/translations/languages/nl.js +101 -0
  135. package/dist/translations/languages/nl.js.map +1 -0
  136. package/dist/translations/languages/pl.d.ts +4 -0
  137. package/dist/translations/languages/pl.d.ts.map +1 -0
  138. package/dist/translations/languages/pl.js +101 -0
  139. package/dist/translations/languages/pl.js.map +1 -0
  140. package/dist/translations/languages/pt.d.ts +4 -0
  141. package/dist/translations/languages/pt.d.ts.map +1 -0
  142. package/dist/translations/languages/pt.js +101 -0
  143. package/dist/translations/languages/pt.js.map +1 -0
  144. package/dist/translations/languages/ro.d.ts +4 -0
  145. package/dist/translations/languages/ro.d.ts.map +1 -0
  146. package/dist/translations/languages/ro.js +101 -0
  147. package/dist/translations/languages/ro.js.map +1 -0
  148. package/dist/translations/languages/rs.d.ts +4 -0
  149. package/dist/translations/languages/rs.d.ts.map +1 -0
  150. package/dist/translations/languages/rs.js +101 -0
  151. package/dist/translations/languages/rs.js.map +1 -0
  152. package/dist/translations/languages/rsLatin.d.ts +4 -0
  153. package/dist/translations/languages/rsLatin.d.ts.map +1 -0
  154. package/dist/translations/languages/rsLatin.js +101 -0
  155. package/dist/translations/languages/rsLatin.js.map +1 -0
  156. package/dist/translations/languages/ru.d.ts +4 -0
  157. package/dist/translations/languages/ru.d.ts.map +1 -0
  158. package/dist/translations/languages/ru.js +101 -0
  159. package/dist/translations/languages/ru.js.map +1 -0
  160. package/dist/translations/languages/sk.d.ts +4 -0
  161. package/dist/translations/languages/sk.d.ts.map +1 -0
  162. package/dist/translations/languages/sk.js +101 -0
  163. package/dist/translations/languages/sk.js.map +1 -0
  164. package/dist/translations/languages/sl.d.ts +4 -0
  165. package/dist/translations/languages/sl.d.ts.map +1 -0
  166. package/dist/translations/languages/sl.js +101 -0
  167. package/dist/translations/languages/sl.js.map +1 -0
  168. package/dist/translations/languages/sv.d.ts +4 -0
  169. package/dist/translations/languages/sv.d.ts.map +1 -0
  170. package/dist/translations/languages/sv.js +101 -0
  171. package/dist/translations/languages/sv.js.map +1 -0
  172. package/dist/translations/languages/ta.d.ts +4 -0
  173. package/dist/translations/languages/ta.d.ts.map +1 -0
  174. package/dist/translations/languages/ta.js +101 -0
  175. package/dist/translations/languages/ta.js.map +1 -0
  176. package/dist/translations/languages/th.d.ts +4 -0
  177. package/dist/translations/languages/th.d.ts.map +1 -0
  178. package/dist/translations/languages/th.js +101 -0
  179. package/dist/translations/languages/th.js.map +1 -0
  180. package/dist/translations/languages/tr.d.ts +4 -0
  181. package/dist/translations/languages/tr.d.ts.map +1 -0
  182. package/dist/translations/languages/tr.js +101 -0
  183. package/dist/translations/languages/tr.js.map +1 -0
  184. package/dist/translations/languages/uk.d.ts +4 -0
  185. package/dist/translations/languages/uk.d.ts.map +1 -0
  186. package/dist/translations/languages/uk.js +101 -0
  187. package/dist/translations/languages/uk.js.map +1 -0
  188. package/dist/translations/languages/vi.d.ts +4 -0
  189. package/dist/translations/languages/vi.d.ts.map +1 -0
  190. package/dist/translations/languages/vi.js +101 -0
  191. package/dist/translations/languages/vi.js.map +1 -0
  192. package/dist/translations/languages/zh.d.ts +4 -0
  193. package/dist/translations/languages/zh.d.ts.map +1 -0
  194. package/dist/translations/languages/zh.js +101 -0
  195. package/dist/translations/languages/zh.js.map +1 -0
  196. package/dist/translations/languages/zhTw.d.ts +4 -0
  197. package/dist/translations/languages/zhTw.d.ts.map +1 -0
  198. package/dist/translations/languages/zhTw.js +101 -0
  199. package/dist/translations/languages/zhTw.js.map +1 -0
  200. package/dist/translations/types.d.ts +5 -0
  201. package/dist/translations/types.d.ts.map +1 -0
  202. package/dist/translations/types.js +3 -0
  203. package/dist/translations/types.js.map +1 -0
  204. package/dist/utilities/getPaymentTotal.d.ts.map +1 -1
  205. package/dist/utilities/lexical/nodeFormat.d.ts.map +1 -1
  206. package/dist/utilities/replaceDoubleCurlys.d.ts.map +1 -1
  207. package/package.json +15 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field, UploadCollectionSlug } from 'payload'\n\nimport type { PaymentFieldConfig } from '../../types.js'\n\nconst name: Field = {\n name: 'name',\n type: 'text',\n label: 'Name (lowercase, no special characters)',\n required: true,\n}\n\nconst label: Field = {\n name: 'label',\n type: 'text',\n label: 'Label',\n localized: true,\n}\n\nconst required: Field = {\n name: 'required',\n type: 'checkbox',\n label: 'Required',\n}\n\nconst width: Field = {\n name: 'width',\n type: 'number',\n label: 'Field Width (percentage)',\n}\n\nconst placeholder: Field = {\n name: 'placeholder',\n type: 'text',\n label: 'Placeholder',\n}\n\nconst Radio: Block = {\n slug: 'radio',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Label',\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Radio Attribute Options',\n labels: {\n plural: 'Options',\n singular: 'Option',\n },\n },\n required,\n ],\n labels: {\n plural: 'Radio Fields',\n singular: 'Radio',\n },\n}\n\nconst Select: Block = {\n slug: 'select',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...placeholder,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Label',\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Select Attribute Options',\n labels: {\n plural: 'Options',\n singular: 'Option',\n },\n },\n required,\n ],\n labels: {\n plural: 'Select Fields',\n singular: 'Select',\n },\n}\n\nconst Text: Block = {\n slug: 'text',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Fields',\n singular: 'Text',\n },\n}\n\nconst TextArea: Block = {\n slug: 'textarea',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Area Fields',\n singular: 'Text Area',\n },\n}\n\nconst Number: Block = {\n slug: 'number',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Number Fields',\n singular: 'Number',\n },\n}\n\nconst Email: Block = {\n slug: 'email',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Email Fields',\n singular: 'Email',\n },\n}\n\nconst State: Block = {\n slug: 'state',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'State Fields',\n singular: 'State',\n },\n}\n\nconst Country: Block = {\n slug: 'country',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Country Fields',\n singular: 'Country',\n },\n}\n\nconst Checkbox: Block = {\n slug: 'checkbox',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'checkbox',\n label: 'Checked by default',\n },\n ],\n labels: {\n plural: 'Checkbox Fields',\n singular: 'Checkbox',\n },\n}\n\nconst Date: Block = {\n slug: 'date',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'date',\n label: 'Default Value',\n },\n ],\n labels: {\n plural: 'Date Fields',\n singular: 'Date',\n },\n}\n\nconst Payment = (fieldConfig: PaymentFieldConfig): Block => {\n let paymentProcessorField = null\n if (fieldConfig?.paymentProcessor) {\n paymentProcessorField = {\n name: 'paymentProcessor',\n type: 'select',\n label: 'Payment Processor',\n options: [],\n ...fieldConfig.paymentProcessor,\n }\n }\n\n const fields = {\n slug: 'payment',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'basePrice',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Base Price',\n },\n ],\n },\n paymentProcessorField,\n {\n name: 'priceConditions',\n type: 'array',\n fields: [\n {\n name: 'fieldToUse',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-form-builder/client#DynamicFieldSelector',\n },\n },\n },\n {\n name: 'condition',\n type: 'select',\n defaultValue: 'hasValue',\n label: 'Condition',\n options: [\n {\n label: 'Has Any Value',\n value: 'hasValue',\n },\n {\n label: 'Equals',\n value: 'equals',\n },\n {\n label: 'Does Not Equal',\n value: 'notEquals',\n },\n ],\n },\n {\n name: 'valueForCondition',\n type: 'text',\n admin: {\n condition: (_: any, { condition }: any) =>\n condition === 'equals' || condition === 'notEquals',\n },\n label: 'Value',\n },\n {\n name: 'operator',\n type: 'select',\n defaultValue: 'add',\n options: [\n {\n label: 'Add',\n value: 'add',\n },\n {\n label: 'Subtract',\n value: 'subtract',\n },\n {\n label: 'Multiply',\n value: 'multiply',\n },\n {\n label: 'Divide',\n value: 'divide',\n },\n ],\n },\n {\n name: 'valueType',\n type: 'radio',\n admin: {\n width: '100%',\n },\n defaultValue: 'static',\n label: 'Value Type',\n options: [\n {\n label: 'Static Value',\n value: 'static',\n },\n {\n label: 'Value Of Field',\n value: 'valueOfField',\n },\n ],\n },\n {\n name: 'valueForOperator',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-form-builder/client#DynamicPriceSelector',\n },\n },\n label: 'Value',\n },\n ],\n label: 'Price Conditions',\n labels: {\n plural: 'Price Conditions',\n singular: 'Price Condition',\n },\n },\n required,\n ].filter(Boolean) as Field[],\n labels: {\n plural: 'Payment Fields',\n singular: 'Payment',\n },\n }\n\n return fields\n}\n\nconst Message: Block = {\n slug: 'message',\n fields: [\n {\n name: 'message',\n type: 'richText',\n localized: true,\n },\n ],\n labels: {\n plural: 'Message Blocks',\n singular: 'Message',\n },\n}\n\nconst Upload = (uploadCollections: UploadCollectionSlug[]): Block => {\n return {\n slug: 'upload',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'uploadCollection',\n type: 'select',\n admin: {\n description: 'Select which upload collection to store files in',\n },\n label: 'Upload Collection',\n options: uploadCollections.map((slug) => ({ label: slug, value: slug })),\n required: true,\n },\n {\n name: 'mimeTypes',\n type: 'array',\n admin: {\n description:\n 'Restrict allowed file types (e.g., image/*, application/pdf). Leave empty to allow all types.',\n },\n fields: [\n {\n name: 'mimeType',\n type: 'text',\n label: 'MIME Type',\n required: true,\n },\n ],\n label: 'Allowed File Types',\n labels: {\n plural: 'MIME Types',\n singular: 'MIME Type',\n },\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'maxFileSize',\n type: 'number',\n admin: {\n description: 'Maximum file size in bytes. Leave empty for no limit.',\n width: '50%',\n },\n label: 'Max File Size (bytes)',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'multiple',\n type: 'checkbox',\n admin: {\n width: '50%',\n },\n label: 'Allow Multiple Files',\n },\n ],\n },\n ],\n labels: {\n plural: 'Upload Fields',\n singular: 'Upload',\n },\n }\n}\n\nexport const fields: {\n [key: string]: ((arg?: any) => Block) | Block\n} = {\n checkbox: Checkbox,\n country: Country,\n date: Date,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n radio: Radio,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n upload: Upload,\n}\n"],"names":["name","type","label","required","localized","width","placeholder","Radio","slug","fields","admin","labels","plural","singular","Select","Text","TextArea","Number","Email","State","Country","Checkbox","Date","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","filter","Boolean","Message","Upload","uploadCollections","description","map","checkbox","country","date","email","message","number","payment","radio","select","state","text","textarea","upload"],"mappings":"AAIA,MAAMA,OAAc;IAClBA,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,UAAU;AACZ;AAEA,MAAMD,QAAe;IACnBF,MA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ACE,GAAGH,KAAK;wBACRQ,OAAO;4BACLL,OAAO;wBACT;oBACF;iBACD;YACH;YACA;gBACEL,MAAM;gBACNC,MAAM;gBACNS,OAAO;oBACL6B,aAAa;gBACf;gBACArC,OAAO;gBACPyB,SAASW,kBAAkBE,GAAG,CAAC,CAAChC,OAAU,CAAA;wBAAEN,OAAOM;wBAAMuB,OAAOvB;oBAAK,CAAA;gBACrEL,UAAU;YACZ;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNS,OAAO;oBACL6B,aACE;gBACJ;gBACA9B,QAAQ;oBACN;wBACET,MAAM;wBACNC,MAAM;wBACNC,OAAO;wBACPC,UAAU;oBACZ;iBACD;gBACDD,OAAO;gBACPS,QAAQ;oBACNC,QAAQ;oBACRC,UAAU;gBACZ;YACF;YACA;gBACEZ,MAAM;gBACNQ,QAAQ;oBACN;wBACE,GAAGJ,KAAK;wBACRK,OAAO;4BACLL,OAAO;wBACT;oBACF;oBACA;wBACEL,MAAM;wBACNC,MAAM;wBACNS,OAAO;4BACL6B,aAAa;4BACblC,OAAO;wBACT;wBACAH,OAAO;oBACT;iBACD;YACH;YACA;gBACED,MAAM;gBACNQ,QAAQ;oBACN;wBACE,GAAGN,QAAQ;wBACXO,OAAO;4BACLL,OAAO;wBACT;oBACF;oBACA;wBACEL,MAAM;wBACNC,MAAM;wBACNS,OAAO;4BACLL,OAAO;wBACT;wBACAH,OAAO;oBACT;iBACD;YACH;SACD;QACDS,QAAQ;YACNC,QAAQ;YACRC,UAAU;QACZ;IACF;AACF;AAEA,OAAO,MAAMJ,SAET;IACFgC,UAAUpB;IACVqB,SAAStB;IACTuB,MAAMrB;IACNsB,OAAO1B;IACP2B,SAAST;IACTU,QAAQ7B;IACR8B,SAASxB;IACTyB,OAAOzC;IACP0C,QAAQnC;IACRoC,OAAO/B;IACPgC,MAAMpC;IACNqC,UAAUpC;IACVqC,QAAQhB;AACV,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field, UploadCollectionSlug } from 'payload'\n\nimport type { PaymentFieldConfig } from '../../types.js'\n\nconst name: Field = {\n name: 'name',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:name'),\n required: true,\n}\n\nconst label: Field = {\n name: 'label',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:label'),\n localized: true,\n}\n\nconst required: Field = {\n name: 'required',\n type: 'checkbox',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:required'),\n}\n\nconst width: Field = {\n name: 'width',\n type: 'number',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:fieldWidth'),\n}\n\nconst placeholder: Field = {\n name: 'placeholder',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:placeholder'),\n}\n\nconst Radio: Block = {\n slug: 'radio',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n localized: true,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:label'),\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:value'),\n required: true,\n },\n ],\n },\n ],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:radioOptions'),\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:optionPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:optionSingular'),\n },\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:radioPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:radioSingular'),\n },\n}\n\nconst Select: Block = {\n slug: 'select',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n localized: true,\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...placeholder,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:label'),\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:value'),\n required: true,\n },\n ],\n },\n ],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:selectOptions'),\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:optionPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:optionSingular'),\n },\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:selectPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:selectSingular'),\n },\n}\n\nconst Text: Block = {\n slug: 'text',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:textPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:textSingular'),\n },\n}\n\nconst TextArea: Block = {\n slug: 'textarea',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:textareaPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:textareaSingular'),\n },\n}\n\nconst Number: Block = {\n slug: 'number',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n },\n ],\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:numberPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:numberSingular'),\n },\n}\n\nconst Email: Block = {\n slug: 'email',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:emailPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:emailSingular'),\n },\n}\n\nconst State: Block = {\n slug: 'state',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:statePlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:stateSingular'),\n },\n}\n\nconst Country: Block = {\n slug: 'country',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:countryPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:countrySingular'),\n },\n}\n\nconst Checkbox: Block = {\n slug: 'checkbox',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'checkbox',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:checkedByDefault'),\n },\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:checkboxPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:checkboxSingular'),\n },\n}\n\nconst Date: Block = {\n slug: 'date',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'date',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:defaultValue'),\n },\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:datePlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:dateSingular'),\n },\n}\n\nconst Payment = (fieldConfig: PaymentFieldConfig): Block => {\n let paymentProcessorField: Field | null = null\n if (fieldConfig?.paymentProcessor) {\n paymentProcessorField = {\n name: 'paymentProcessor',\n type: 'select',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:paymentProcessor'),\n options: [],\n ...fieldConfig.paymentProcessor,\n }\n }\n\n const fields: Block = {\n slug: 'payment',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'basePrice',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:basePrice'),\n },\n ],\n },\n ...(paymentProcessorField ? [paymentProcessorField] : []),\n {\n name: 'priceConditions',\n type: 'array',\n fields: [\n {\n name: 'fieldToUse',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-form-builder/client#DynamicFieldSelector',\n },\n },\n },\n {\n name: 'condition',\n type: 'select',\n defaultValue: 'hasValue',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:condition'),\n options: [\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:hasAnyValue'),\n value: 'hasValue',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:equals'),\n value: 'equals',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:doesNotEqual'),\n value: 'notEquals',\n },\n ],\n },\n {\n name: 'valueForCondition',\n type: 'text',\n admin: {\n condition: (_: any, { condition }: any) =>\n condition === 'equals' || condition === 'notEquals',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:value'),\n },\n {\n name: 'operator',\n type: 'select',\n defaultValue: 'add',\n options: [\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:add'),\n value: 'add',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:subtract'),\n value: 'subtract',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:multiply'),\n value: 'multiply',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:divide'),\n value: 'divide',\n },\n ],\n },\n {\n name: 'valueType',\n type: 'radio',\n admin: {\n width: '100%',\n },\n defaultValue: 'static',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:valueType'),\n options: [\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:staticValue'),\n value: 'static',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:valueOfField'),\n value: 'valueOfField',\n },\n ],\n },\n {\n name: 'valueForOperator',\n type: 'text',\n admin: {\n components: {\n Field: '@payloadcms/plugin-form-builder/client#DynamicPriceSelector',\n },\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:value'),\n },\n ],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:priceConditions'),\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:priceConditionsPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:priceConditionsSingular'),\n },\n },\n required,\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:paymentFieldPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:paymentFieldSingular'),\n },\n }\n\n return fields\n}\n\nconst Message: Block = {\n slug: 'message',\n fields: [\n {\n name: 'message',\n type: 'richText',\n localized: true,\n },\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:messagePlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:messageSingular'),\n },\n}\n\nconst Upload = (uploadCollections: UploadCollectionSlug[]): Block => {\n return {\n slug: 'upload',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'uploadCollection',\n type: 'select',\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:uploadCollectionDescription'),\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:uploadCollection'),\n options: uploadCollections.map((slug) => ({ label: slug, value: slug })),\n required: true,\n },\n {\n name: 'mimeTypes',\n type: 'array',\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:allowedFileTypesDescription'),\n },\n fields: [\n {\n name: 'mimeType',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:mimeType'),\n required: true,\n },\n ],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:allowedFileTypes'),\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:mimeTypePlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:mimeTypeSingular'),\n },\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'maxFileSize',\n type: 'number',\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:maxFileSizeDescription'),\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:maxFileSize'),\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'multiple',\n type: 'checkbox',\n admin: {\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:allowMultipleFiles'),\n },\n ],\n },\n ],\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:uploadFieldPlural'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:uploadFieldSingular'),\n },\n }\n}\n\nexport const fields: {\n [key: string]: ((arg?: any) => Block) | Block\n} = {\n checkbox: Checkbox,\n country: Country,\n date: Date,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n radio: Radio,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n upload: Upload,\n}\n"],"names":["name","type","label","t","required","localized","width","placeholder","Radio","slug","fields","admin","labels","plural","singular","Select","Text","TextArea","Number","Email","State","Country","Checkbox","Date","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","Message","Upload","uploadCollections","description","map","checkbox","country","date","email","message","number","payment","radio","select","state","text","textarea","upload"],"mappings":"AAIA,MAAMA,OAAc;IAClBA,MAAM;IACNC,MAAM;IACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;QAC/DA,EAAE;IACJC,UAAU;AACZ;AAEA,MAAMF,QAAe;IACnBF,MAAM;IACNC,MAAM;IACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;QAC/DA,EAAE;IACJE,WAAW;AACb;AAEA,MAAMD,WAAkB;IACtBJ,MAAM;IACNC,MAAM;IACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;QAC/DA,EAAE;AACN;AAEA,MAAMG,QAAe;IACnBN,MAAM;IACNC,MAAM;IACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+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}
@@ -1,4 +1,4 @@
1
1
  import type { CollectionConfig, Config } from 'payload';
2
2
  import type { FormBuilderPluginConfig } from '../../types.js';
3
- export declare const generateFormCollection: (formConfig: FormBuilderPluginConfig, collections?: Config["collections"]) => CollectionConfig;
3
+ export declare const generateFormCollection: (formConfig: FormBuilderPluginConfig, collections?: Config['collections']) => CollectionConfig;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,gBAAgB,EAAE,MAAM,EAAS,MAAM,SAAS,CAAA;AAIrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AA+B7D,eAAO,MAAM,sBAAsB,GACjC,YAAY,uBAAuB,EACnC,cAAc,MAAM,CAAC,aAAa,CAAC,KAClC,gBAqPF,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,gBAAgB,EAAE,MAAM,EAAS,MAAM,SAAS,CAAA;AAIrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AA+B7D,eAAO,MAAM,sBAAsB,eACrB,uBAAuB,gBACrB,MAAM,CAAC,aAAa,CAAC,KAClC,gBA+SF,CAAA"}
@@ -36,10 +36,13 @@ export const generateFormCollection = (formConfig, collections)=>{
36
36
  {
37
37
  name: 'url',
38
38
  type: 'text',
39
- label: 'URL to redirect to',
39
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
40
+ t('plugin-form-builder:urlToRedirectTo'),
40
41
  required: true
41
42
  }
42
- ]
43
+ ],
44
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
45
+ t('plugin-form-builder:redirect')
43
46
  };
44
47
  if (formConfig.redirectRelationships) {
45
48
  redirect.fields.unshift({
@@ -48,7 +51,8 @@ export const generateFormCollection = (formConfig, collections)=>{
48
51
  admin: {
49
52
  condition: (_, siblingData)=>siblingData?.type === 'reference'
50
53
  },
51
- label: 'Document to link to',
54
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
55
+ t('plugin-form-builder:documentToLinkTo'),
52
56
  maxDepth: 2,
53
57
  relationTo: formConfig.redirectRelationships,
54
58
  required: true
@@ -62,17 +66,20 @@ export const generateFormCollection = (formConfig, collections)=>{
62
66
  defaultValue: 'reference',
63
67
  options: [
64
68
  {
65
- label: 'Internal link',
69
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
70
+ t('plugin-form-builder:internalLink'),
66
71
  value: 'reference'
67
72
  },
68
73
  {
69
- label: 'Custom URL',
74
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
75
+ t('plugin-form-builder:customURL'),
70
76
  value: 'custom'
71
77
  }
72
78
  ]
73
79
  });
74
80
  if (redirect.fields[2].type !== 'row') {
75
- redirect.fields[2].label = 'Custom URL';
81
+ redirect.fields[2].label = ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
82
+ t('plugin-form-builder:customURL');
76
83
  }
77
84
  redirect.fields[2].admin = {
78
85
  condition: (_, siblingData)=>siblingData?.type === 'custom'
@@ -82,6 +89,8 @@ export const generateFormCollection = (formConfig, collections)=>{
82
89
  {
83
90
  name: 'title',
84
91
  type: 'text',
92
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
93
+ t('plugin-form-builder:title'),
85
94
  required: true
86
95
  },
87
96
  {
@@ -112,28 +121,43 @@ export const generateFormCollection = (formConfig, collections)=>{
112
121
  return block;
113
122
  }
114
123
  return null;
115
- }).filter(Boolean)
124
+ }).filter(Boolean),
125
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
126
+ t('plugin-form-builder:fields'),
127
+ labels: {
128
+ plural: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
129
+ t('plugin-form-builder:fields'),
130
+ singular: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
131
+ t('plugin-form-builder:field')
132
+ }
116
133
  },
117
134
  {
118
135
  name: 'submitButtonLabel',
119
136
  type: 'text',
137
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
138
+ t('plugin-form-builder:submitButton'),
120
139
  localized: true
121
140
  },
122
141
  {
123
142
  name: 'confirmationType',
124
143
  type: 'radio',
125
144
  admin: {
126
- description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
145
+ description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
146
+ t('plugin-form-builder:chooseConfirmationType'),
127
147
  layout: 'horizontal'
128
148
  },
129
149
  defaultValue: 'message',
150
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
151
+ t('plugin-form-builder:confirmationType'),
130
152
  options: [
131
153
  {
132
- label: 'Message',
154
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
155
+ t('plugin-form-builder:message'),
133
156
  value: 'message'
134
157
  },
135
158
  {
136
- label: 'Redirect',
159
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
160
+ t('plugin-form-builder:redirect'),
137
161
  value: 'redirect'
138
162
  }
139
163
  ]
@@ -144,6 +168,8 @@ export const generateFormCollection = (formConfig, collections)=>{
144
168
  admin: {
145
169
  condition: (_, siblingData)=>siblingData?.confirmationType === 'message'
146
170
  },
171
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
172
+ t('plugin-form-builder:confirmationMessage'),
147
173
  localized: true,
148
174
  required: true
149
175
  },
@@ -155,7 +181,8 @@ export const generateFormCollection = (formConfig, collections)=>{
155
181
  read: ({ req: { user } })=>!!user
156
182
  },
157
183
  admin: {
158
- description: "Send custom emails when the form submits. Use comma separated lists to send the same email to multiple recipients. To reference a value from this form, wrap that field's name with double curly brackets, i.e. {{firstName}}. You can use a wildcard {{*}} to output all data and {{*:table}} to format it as an HTML table in the email."
184
+ description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
185
+ t('plugin-form-builder:emailsDescription')
159
186
  },
160
187
  fields: [
161
188
  {
@@ -168,7 +195,8 @@ export const generateFormCollection = (formConfig, collections)=>{
168
195
  placeholder: '"Email Sender" <sender@email.com>',
169
196
  width: '100%'
170
197
  },
171
- label: 'Email To'
198
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
199
+ t('plugin-form-builder:emailTo')
172
200
  },
173
201
  {
174
202
  name: 'cc',
@@ -178,7 +206,8 @@ export const generateFormCollection = (formConfig, collections)=>{
178
206
  maxWidth: '50%'
179
207
  }
180
208
  },
181
- label: 'CC'
209
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
210
+ t('plugin-form-builder:cc')
182
211
  },
183
212
  {
184
213
  name: 'bcc',
@@ -188,7 +217,8 @@ export const generateFormCollection = (formConfig, collections)=>{
188
217
  maxWidth: '50%'
189
218
  }
190
219
  },
191
- label: 'BCC'
220
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
221
+ t('plugin-form-builder:bcc')
192
222
  }
193
223
  ]
194
224
  },
@@ -202,7 +232,8 @@ export const generateFormCollection = (formConfig, collections)=>{
202
232
  placeholder: '"Reply To" <reply-to@email.com>',
203
233
  width: '50%'
204
234
  },
205
- label: 'Reply To'
235
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
236
+ t('plugin-form-builder:replyTo')
206
237
  },
207
238
  {
208
239
  name: 'emailFrom',
@@ -211,7 +242,8 @@ export const generateFormCollection = (formConfig, collections)=>{
211
242
  placeholder: '"Email From" <email-from@email.com>',
212
243
  width: '50%'
213
244
  },
214
- label: 'Email From'
245
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
246
+ t('plugin-form-builder:emailFrom')
215
247
  }
216
248
  ]
217
249
  },
@@ -219,7 +251,8 @@ export const generateFormCollection = (formConfig, collections)=>{
219
251
  name: 'subject',
220
252
  type: 'text',
221
253
  defaultValue: "You've received a new message.",
222
- label: 'Subject',
254
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
255
+ t('plugin-form-builder:subject'),
223
256
  localized: true,
224
257
  required: true
225
258
  },
@@ -227,9 +260,11 @@ export const generateFormCollection = (formConfig, collections)=>{
227
260
  name: 'message',
228
261
  type: 'richText',
229
262
  admin: {
230
- description: 'Enter the message that should be sent in this email.'
263
+ description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
264
+ t('plugin-form-builder:messageDescription')
231
265
  },
232
- label: 'Message',
266
+ label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
267
+ t('plugin-form-builder:message'),
233
268
  localized: true
234
269
  }
235
270
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/Forms/index.ts"],"sourcesContent":["import type { Block, CollectionConfig, Config, Field } from 'payload'\n\nimport { deepMergeWithSourceArrays } from 'payload'\n\nimport type { FormBuilderPluginConfig } from '../../types.js'\n\nimport { fields } from './fields.js'\n\nconst applyUploadCollectionLabels = (args: {\n block: Block\n collections: Config['collections']\n uploadCollections: FormBuilderPluginConfig['uploadCollections']\n}): Block => {\n const { block, collections, uploadCollections } = args\n const collectionsBySlug = new Map(\n (collections || []).map((collection) => [collection.slug, collection]),\n )\n\n for (const field of block.fields) {\n if ('name' in field && field.name === 'uploadCollection' && field.type === 'select') {\n // Replace the default slug labels with the source collection's labels.singular.\n // Select option labels accept strings, locale records and label functions —\n // Payload's admin resolves them at render time via getTranslation.\n field.options = (uploadCollections || []).map((slug) => {\n const singular = collectionsBySlug.get(slug)?.labels?.singular\n return { label: singular ?? slug, value: slug }\n })\n break\n }\n }\n\n return block\n}\n\n// all settings can be overridden by the config\nexport const generateFormCollection = (\n formConfig: FormBuilderPluginConfig,\n collections?: Config['collections'],\n): CollectionConfig => {\n const redirect: Field = {\n name: 'redirect',\n type: 'group',\n admin: {\n condition: (_, siblingData) => siblingData?.confirmationType === 'redirect',\n hideGutter: true,\n },\n fields: [\n {\n name: 'url',\n type: 'text',\n label: 'URL to redirect to',\n required: true,\n },\n ],\n }\n\n if (formConfig.redirectRelationships) {\n redirect.fields.unshift({\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: 'Document to link to',\n maxDepth: 2,\n relationTo: formConfig.redirectRelationships,\n required: true,\n })\n\n redirect.fields.unshift({\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n options: [\n {\n label: 'Internal link',\n value: 'reference',\n },\n {\n label: 'Custom URL',\n value: 'custom',\n },\n ],\n })\n\n if (redirect.fields[2]!.type !== 'row') {\n redirect.fields[2]!.label = 'Custom URL'\n }\n\n redirect.fields[2]!.admin = {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n }\n }\n\n const defaultFields: Field[] = [\n {\n name: 'title',\n type: 'text',\n required: true,\n },\n {\n name: 'fields',\n type: 'blocks',\n blocks: Object.entries(formConfig?.fields || {})\n .map(([fieldKey, fieldConfig]) => {\n // let the config enable/disable fields with either boolean values or objects\n if (fieldConfig !== false) {\n const block = fields[fieldKey]\n\n if (block === undefined && typeof fieldConfig === 'object') {\n return fieldConfig\n }\n\n if (typeof block === 'object' && typeof fieldConfig === 'object') {\n return deepMergeWithSourceArrays(block, fieldConfig)\n }\n\n if (typeof block === 'function') {\n // Special handling for upload field - factory takes slug list; after it runs,\n // inject resolved collection labels into the uploadCollection select.\n if (fieldKey === 'upload') {\n return applyUploadCollectionLabels({\n block: block(formConfig.uploadCollections || []),\n collections,\n uploadCollections: formConfig.uploadCollections,\n })\n }\n return block(fieldConfig)\n }\n\n return block\n }\n\n return null\n })\n .filter(Boolean) as Block[],\n },\n {\n name: 'submitButtonLabel',\n type: 'text',\n localized: true,\n },\n {\n name: 'confirmationType',\n type: 'radio',\n admin: {\n description:\n 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',\n layout: 'horizontal',\n },\n defaultValue: 'message',\n options: [\n {\n label: 'Message',\n value: 'message',\n },\n {\n label: 'Redirect',\n value: 'redirect',\n },\n ],\n },\n {\n name: 'confirmationMessage',\n type: 'richText',\n admin: {\n condition: (_, siblingData) => siblingData?.confirmationType === 'message',\n },\n localized: true,\n required: true,\n },\n redirect,\n {\n name: 'emails',\n type: 'array',\n access: {\n read: ({ req: { user } }) => !!user,\n },\n admin: {\n description:\n \"Send custom emails when the form submits. Use comma separated lists to send the same email to multiple recipients. To reference a value from this form, wrap that field's name with double curly brackets, i.e. {{firstName}}. You can use a wildcard {{*}} to output all data and {{*:table}} to format it as an HTML table in the email.\",\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'emailTo',\n type: 'text',\n admin: {\n placeholder: '\"Email Sender\" <sender@email.com>',\n width: '100%',\n },\n label: 'Email To',\n },\n {\n name: 'cc',\n type: 'text',\n admin: {\n style: {\n maxWidth: '50%',\n },\n },\n label: 'CC',\n },\n {\n name: 'bcc',\n type: 'text',\n admin: {\n style: {\n maxWidth: '50%',\n },\n },\n label: 'BCC',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'replyTo',\n type: 'text',\n admin: {\n placeholder: '\"Reply To\" <reply-to@email.com>',\n width: '50%',\n },\n label: 'Reply To',\n },\n {\n name: 'emailFrom',\n type: 'text',\n admin: {\n placeholder: '\"Email From\" <email-from@email.com>',\n width: '50%',\n },\n label: 'Email From',\n },\n ],\n },\n {\n name: 'subject',\n type: 'text',\n defaultValue: \"You've received a new message.\",\n label: 'Subject',\n localized: true,\n required: true,\n },\n {\n name: 'message',\n type: 'richText',\n admin: {\n description: 'Enter the message that should be sent in this email.',\n },\n label: 'Message',\n localized: true,\n },\n ],\n },\n ]\n\n const config: CollectionConfig = {\n ...(formConfig?.formOverrides || {}),\n slug: formConfig?.formOverrides?.slug || 'forms',\n access: {\n read: () => true,\n ...(formConfig?.formOverrides?.access || {}),\n },\n admin: {\n enableRichTextRelationship: false,\n useAsTitle: 'title',\n ...(formConfig?.formOverrides?.admin || {}),\n },\n fields:\n formConfig?.formOverrides?.fields && typeof formConfig?.formOverrides?.fields === 'function'\n ? formConfig.formOverrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return config\n}\n"],"names":["deepMergeWithSourceArrays","fields","applyUploadCollectionLabels","args","block","collections","uploadCollections","collectionsBySlug","Map","map","collection","slug","field","name","type","options","singular","get","labels","label","value","generateFormCollection","formConfig","redirect","admin","condition","_","siblingData","confirmationType","hideGutter","required","redirectRelationships","unshift","maxDepth","relationTo","layout","defaultValue","defaultFields","blocks","Object","entries","fieldKey","fieldConfig","undefined","filter","Boolean","localized","description","access","read","req","user","placeholder","width","style","maxWidth","config","formOverrides","enableRichTextRelationship","useAsTitle"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,UAAS;AAInD,SAASC,MAAM,QAAQ,cAAa;AAEpC,MAAMC,8BAA8B,CAACC;IAKnC,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,iBAAiB,EAAE,GAAGH;IAClD,MAAMI,oBAAoB,IAAIC,IAC5B,AAACH,CAAAA,eAAe,EAAE,AAAD,EAAGI,GAAG,CAAC,CAACC,aAAe;YAACA,WAAWC,IAAI;YAAED;SAAW;IAGvE,KAAK,MAAME,SAASR,MAAMH,MAAM,CAAE;QAChC,IAAI,UAAUW,SAASA,MAAMC,IAAI,KAAK,sBAAsBD,MAAME,IAAI,KAAK,UAAU;YACnF,gFAAgF;YAChF,4EAA4E;YAC5E,mEAAmE;YACnEF,MAAMG,OAAO,GAAG,AAACT,CAAAA,qBAAqB,EAAE,AAAD,EAAGG,GAAG,CAAC,CAACE;gBAC7C,MAAMK,WAAWT,kBAAkBU,GAAG,CAACN,OAAOO,QAAQF;gBACtD,OAAO;oBAAEG,OAAOH,YAAYL;oBAAMS,OAAOT;gBAAK;YAChD;YACA;QACF;IACF;IAEA,OAAOP;AACT;AAEA,+CAA+C;AAC/C,OAAO,MAAMiB,yBAAyB,CACpCC,YACAjB;IAEA,MAAMkB,WAAkB;QACtBV,MAAM;QACNC,MAAM;QACNU,OAAO;YACLC,WAAW,CAAC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LC,UAAU;gCACZ;4BACF;4BACApC,OAAO;wBACT;qBACD;gBACH;gBACA;oBACEL,MAAM;oBACNb,QAAQ;wBACN;4BACEY,MAAM;4BACNC,MAAM;4BACNU,OAAO;gCACL4B,aAAa;gCACbC,OAAO;4BACT;4BACAlC,OAAO;wBACT;wBACA;4BACEN,MAAM;4BACNC,MAAM;4BACNU,OAAO;gCACL4B,aAAa;gCACbC,OAAO;4BACT;4BACAlC,OAAO;wBACT;qBACD;gBACH;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNsB,cAAc;oBACdjB,OAAO;oBACP2B,WAAW;oBACXhB,UAAU;gBACZ;gBACA;oBACEjB,MAAM;oBACNC,MAAM;oBACNU,OAAO;wBACLuB,aAAa;oBACf;oBACA5B,OAAO;oBACP2B,WAAW;gBACb;aACD;QACH;KACD;IAED,MAAMU,SAA2B;QAC/B,GAAIlC,YAAYmC,iBAAiB,CAAC,CAAC;QACnC9C,MAAMW,YAAYmC,eAAe9C,QAAQ;QACzCqC,QAAQ;YACNC,MAAM,IAAM;YACZ,GAAI3B,YAAYmC,eAAeT,UAAU,CAAC,CAAC;QAC7C;QACAxB,OAAO;YACLkC,4BAA4B;YAC5BC,YAAY;YACZ,GAAIrC,YAAYmC,eAAejC,SAAS,CAAC,CAAC;QAC5C;QACAvB,QACEqB,YAAYmC,eAAexD,UAAU,OAAOqB,YAAYmC,eAAexD,WAAW,aAC9EqB,WAAWmC,aAAa,CAACxD,MAAM,CAAC;YAAEoC;QAAc,KAChDA;IACR;IAEA,OAAOmB;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/Forms/index.ts"],"sourcesContent":["import type { Block, CollectionConfig, Config, Field } from 'payload'\n\nimport { deepMergeWithSourceArrays } from 'payload'\n\nimport type { FormBuilderPluginConfig } from '../../types.js'\n\nimport { fields } from './fields.js'\n\nconst applyUploadCollectionLabels = (args: {\n block: Block\n collections: Config['collections']\n uploadCollections: FormBuilderPluginConfig['uploadCollections']\n}): Block => {\n const { block, collections, uploadCollections } = args\n const collectionsBySlug = new Map(\n (collections || []).map((collection) => [collection.slug, collection]),\n )\n\n for (const field of block.fields) {\n if ('name' in field && field.name === 'uploadCollection' && field.type === 'select') {\n // Replace the default slug labels with the source collection's labels.singular.\n // Select option labels accept strings, locale records and label functions —\n // Payload's admin resolves them at render time via getTranslation.\n field.options = (uploadCollections || []).map((slug) => {\n const singular = collectionsBySlug.get(slug)?.labels?.singular\n return { label: singular ?? slug, value: slug }\n })\n break\n }\n }\n\n return block\n}\n\n// all settings can be overridden by the config\nexport const generateFormCollection = (\n formConfig: FormBuilderPluginConfig,\n collections?: Config['collections'],\n): CollectionConfig => {\n const redirect: Field = {\n name: 'redirect',\n type: 'group',\n admin: {\n condition: (_, siblingData) => siblingData?.confirmationType === 'redirect',\n hideGutter: true,\n },\n fields: [\n {\n name: 'url',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:urlToRedirectTo'),\n required: true,\n },\n ],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:redirect'),\n }\n\n if (formConfig.redirectRelationships) {\n redirect.fields.unshift({\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:documentToLinkTo'),\n maxDepth: 2,\n relationTo: formConfig.redirectRelationships,\n required: true,\n })\n\n redirect.fields.unshift({\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n options: [\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:internalLink'),\n value: 'reference',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:customURL'),\n value: 'custom',\n },\n ],\n })\n\n if (redirect.fields[2]!.type !== 'row') {\n redirect.fields[2]!.label = ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:customURL')\n }\n\n redirect.fields[2]!.admin = {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n }\n }\n\n const defaultFields: Field[] = [\n {\n name: 'title',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:title'),\n required: true,\n },\n {\n name: 'fields',\n type: 'blocks',\n blocks: Object.entries(formConfig?.fields || {})\n .map(([fieldKey, fieldConfig]) => {\n // let the config enable/disable fields with either boolean values or objects\n if (fieldConfig !== false) {\n const block = fields[fieldKey]\n\n if (block === undefined && typeof fieldConfig === 'object') {\n return fieldConfig\n }\n\n if (typeof block === 'object' && typeof fieldConfig === 'object') {\n return deepMergeWithSourceArrays(block, fieldConfig)\n }\n\n if (typeof block === 'function') {\n // Special handling for upload field - factory takes slug list; after it runs,\n // inject resolved collection labels into the uploadCollection select.\n if (fieldKey === 'upload') {\n return applyUploadCollectionLabels({\n block: block(formConfig.uploadCollections || []),\n collections,\n uploadCollections: formConfig.uploadCollections,\n })\n }\n return block(fieldConfig)\n }\n\n return block\n }\n\n return null\n })\n .filter(Boolean) as Block[],\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:fields'),\n labels: {\n plural: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:fields'),\n singular: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:field'),\n },\n },\n {\n name: 'submitButtonLabel',\n type: 'text',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:submitButton'),\n localized: true,\n },\n {\n name: 'confirmationType',\n type: 'radio',\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:chooseConfirmationType'),\n layout: 'horizontal',\n },\n defaultValue: 'message',\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:confirmationType'),\n options: [\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:message'),\n value: 'message',\n },\n {\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:redirect'),\n value: 'redirect',\n },\n ],\n },\n {\n name: 'confirmationMessage',\n type: 'richText',\n admin: {\n condition: (_, siblingData) => siblingData?.confirmationType === 'message',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:confirmationMessage'),\n localized: true,\n required: true,\n },\n redirect,\n {\n name: 'emails',\n type: 'array',\n access: {\n read: ({ req: { user } }) => !!user,\n },\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:emailsDescription'),\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'emailTo',\n type: 'text',\n admin: {\n placeholder: '\"Email Sender\" <sender@email.com>',\n width: '100%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:emailTo'),\n },\n {\n name: 'cc',\n type: 'text',\n admin: {\n style: {\n maxWidth: '50%',\n },\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:cc'),\n },\n {\n name: 'bcc',\n type: 'text',\n admin: {\n style: {\n maxWidth: '50%',\n },\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:bcc'),\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'replyTo',\n type: 'text',\n admin: {\n placeholder: '\"Reply To\" <reply-to@email.com>',\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:replyTo'),\n },\n {\n name: 'emailFrom',\n type: 'text',\n admin: {\n placeholder: '\"Email From\" <email-from@email.com>',\n width: '50%',\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:emailFrom'),\n },\n ],\n },\n {\n name: 'subject',\n type: 'text',\n defaultValue: \"You've received a new message.\",\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:subject'),\n localized: true,\n required: true,\n },\n {\n name: 'message',\n type: 'richText',\n admin: {\n description: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:messageDescription'),\n },\n label: ({ t }) =>\n // @ts-expect-error - translations are not typed in plugins yet\n t('plugin-form-builder:message'),\n localized: true,\n },\n ],\n },\n ]\n\n const config: CollectionConfig = {\n ...(formConfig?.formOverrides || {}),\n slug: formConfig?.formOverrides?.slug || 'forms',\n access: {\n read: () => true,\n ...(formConfig?.formOverrides?.access || {}),\n },\n admin: {\n enableRichTextRelationship: false,\n useAsTitle: 'title',\n ...(formConfig?.formOverrides?.admin || {}),\n },\n fields:\n formConfig?.formOverrides?.fields && typeof formConfig?.formOverrides?.fields === 'function'\n ? formConfig.formOverrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return config\n}\n"],"names":["deepMergeWithSourceArrays","fields","applyUploadCollectionLabels","args","block","collections","uploadCollections","collectionsBySlug","Map","map","collection","slug","field","name","type","options","singular","get","labels","label","value","generateFormCollection","formConfig","redirect","admin","condition","_","siblingData","confirmationType","hideGutter","t","required","redirectRelationships","unshift","maxDepth","relationTo","layout","defaultValue","defaultFields","blocks","Object","entries","fieldKey","fieldConfig","undefined","filter","Boolean","plural","localized","description","access","read","req","user","placeholder","width","style","maxWidth","config","formOverrides","enableRichTextRelationship","useAsTitle"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,UAAS;AAInD,SAASC,MAAM,QAAQ,cAAa;AAEpC,MAAMC,8BAA8B,CAACC;IAKnC,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,iBAAiB,EAAE,GAAGH;IAClD,MAAMI,oBAAoB,IAAIC,IAC5B,AAACH,CAAAA,eAAe,EAAE,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,GACjB,+DAA+D;4BAC/DA,EAAE;oBACN;oBACAX,OAAO,CAAC,EAAEW,CAAC,EAAE,GACX,+DAA+D;wBAC/DA,EAAE;oBACJkB,WAAW;gBACb;aACD;QACH;KACD;IAED,MAAMU,SAA2B;QAC/B,GAAIpC,YAAYqC,iBAAiB,CAAC,CAAC;QACnChD,MAAMW,YAAYqC,eAAehD,QAAQ;QACzCuC,QAAQ;YACNC,MAAM,IAAM;YACZ,GAAI7B,YAAYqC,eAAeT,UAAU,CAAC,CAAC;QAC7C;QACA1B,OAAO;YACLoC,4BAA4B;YAC5BC,YAAY;YACZ,GAAIvC,YAAYqC,eAAenC,SAAS,CAAC,CAAC;QAC5C;QACAvB,QACEqB,YAAYqC,eAAe1D,UAAU,OAAOqB,YAAYqC,eAAe1D,WAAW,aAC9EqB,WAAWqC,aAAa,CAAC1D,MAAM,CAAC;YAAEqC;QAAc,KAChDA;IACR;IAEA,OAAOoB;AACT,EAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Config } from 'payload';
2
1
  import type { FormBuilderPluginConfig } from './types.js';
3
2
  export { fields } from './collections/Forms/fields.js';
3
+ export { translations as formBuilderTranslations } from './translations/index.js';
4
4
  export { getPaymentTotal } from './utilities/getPaymentTotal.js';
5
- export declare const formBuilderPlugin: (incomingFormConfig: FormBuilderPluginConfig) => (config: Config) => Config;
5
+ export declare const formBuilderPlugin: (options: FormBuilderPluginConfig) => import("payload").Plugin;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAKzD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,eAAO,MAAM,iBAAiB,GAC3B,oBAAoB,uBAAuB,MAC3C,QAAQ,MAAM,KAAG,MAsCjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAMzD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAE,YAAY,IAAI,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,eAAO,MAAM,iBAAiB,gEAgE5B,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,17 @@
1
+ import { definePlugin } from 'payload';
2
+ import { deepMergeSimple } from 'payload/shared';
1
3
  import { generateFormCollection } from './collections/Forms/index.js';
2
4
  import { generateSubmissionCollection } from './collections/FormSubmissions/index.js';
5
+ import { translations } from './translations/index.js';
3
6
  export { fields } from './collections/Forms/fields.js';
7
+ export { translations as formBuilderTranslations } from './translations/index.js';
4
8
  export { getPaymentTotal } from './utilities/getPaymentTotal.js';
5
- export const formBuilderPlugin = (incomingFormConfig)=>(config)=>{
9
+ export const formBuilderPlugin = definePlugin({
10
+ slug: '@payloadcms/plugin-form-builder',
11
+ plugin: ({ config, options: incomingFormConfig })=>{
12
+ if (!config.i18n) {
13
+ config.i18n = {};
14
+ }
6
15
  const formConfig = {
7
16
  ...incomingFormConfig,
8
17
  fields: {
@@ -26,14 +35,31 @@ export const formBuilderPlugin = (incomingFormConfig)=>(config)=>{
26
35
  // eslint-disable-next-line no-console
27
36
  console.warn('[plugin-form-builder] fields.upload is enabled but uploadCollections is empty or missing. Upload fields will not be registered. Set uploadCollections to an array of upload-enabled collection slugs.');
28
37
  }
38
+ /**
39
+ * Merge plugin translations — only for languages the user has enabled.
40
+ * Plugins run before sanitize, so `supportedLanguages` may be undefined; sanitize will
41
+ * default it to `{ en }`, so we mirror that here to avoid merging 40+ unused tables.
42
+ */ const supportedLanguageKeys = config.i18n?.supportedLanguages ? Object.keys(config.i18n.supportedLanguages) : [
43
+ 'en'
44
+ ];
45
+ const flattenedTranslations = {};
46
+ for (const lang of supportedLanguageKeys){
47
+ const entry = translations[lang] ?? translations.en;
48
+ flattenedTranslations[lang] = entry.translations;
49
+ }
29
50
  return {
30
51
  ...config,
31
52
  collections: [
32
53
  ...config?.collections || [],
33
54
  generateFormCollection(formConfig, config?.collections),
34
55
  generateSubmissionCollection(formConfig)
35
- ]
56
+ ],
57
+ i18n: {
58
+ ...config.i18n,
59
+ translations: deepMergeSimple(flattenedTranslations, config.i18n?.translations ?? {})
60
+ }
36
61
  };
37
- };
62
+ }
63
+ });
38
64
 
39
65
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport type { FormBuilderPluginConfig } from './types.js'\n\nimport { generateFormCollection } from './collections/Forms/index.js'\nimport { generateSubmissionCollection } from './collections/FormSubmissions/index.js'\n\nexport { fields } from './collections/Forms/fields.js'\nexport { getPaymentTotal } from './utilities/getPaymentTotal.js'\n\nexport const formBuilderPlugin =\n (incomingFormConfig: FormBuilderPluginConfig) =>\n (config: Config): Config => {\n const formConfig: FormBuilderPluginConfig = {\n ...incomingFormConfig,\n fields: {\n checkbox: true,\n country: true,\n email: true,\n message: true,\n number: true,\n payment: false,\n select: true,\n state: true,\n text: true,\n textarea: true,\n upload: false,\n ...incomingFormConfig.fields,\n },\n }\n\n const isUploadFieldEnabled = formConfig.fields?.upload !== false\n const hasUploadCollections =\n Array.isArray(formConfig.uploadCollections) && formConfig.uploadCollections.length > 0\n\n if (isUploadFieldEnabled && !hasUploadCollections) {\n // eslint-disable-next-line no-console\n console.warn(\n '[plugin-form-builder] fields.upload is enabled but uploadCollections is empty or missing. Upload fields will not be registered. Set uploadCollections to an array of upload-enabled collection slugs.',\n )\n }\n\n return {\n ...config,\n collections: [\n ...(config?.collections || []),\n generateFormCollection(formConfig, config?.collections),\n generateSubmissionCollection(formConfig),\n ],\n }\n }\n"],"names":["generateFormCollection","generateSubmissionCollection","fields","getPaymentTotal","formBuilderPlugin","incomingFormConfig","config","formConfig","checkbox","country","email","message","number","payment","select","state","text","textarea","upload","isUploadFieldEnabled","hasUploadCollections","Array","isArray","uploadCollections","length","console","warn","collections"],"mappings":"AAIA,SAASA,sBAAsB,QAAQ,+BAA8B;AACrE,SAASC,4BAA4B,QAAQ,yCAAwC;AAErF,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASC,eAAe,QAAQ,iCAAgC;AAEhE,OAAO,MAAMC,oBACX,CAACC,qBACD,CAACC;QACC,MAAMC,aAAsC;YAC1C,GAAGF,kBAAkB;YACrBH,QAAQ;gBACNM,UAAU;gBACVC,SAAS;gBACTC,OAAO;gBACPC,SAAS;gBACTC,QAAQ;gBACRC,SAAS;gBACTC,QAAQ;gBACRC,OAAO;gBACPC,MAAM;gBACNC,UAAU;gBACVC,QAAQ;gBACR,GAAGb,mBAAmBH,MAAM;YAC9B;QACF;QAEA,MAAMiB,uBAAuBZ,WAAWL,MAAM,EAAEgB,WAAW;QAC3D,MAAME,uBACJC,MAAMC,OAAO,CAACf,WAAWgB,iBAAiB,KAAKhB,WAAWgB,iBAAiB,CAACC,MAAM,GAAG;QAEvF,IAAIL,wBAAwB,CAACC,sBAAsB;YACjD,sCAAsC;YACtCK,QAAQC,IAAI,CACV;QAEJ;QAEA,OAAO;YACL,GAAGpB,MAAM;YACTqB,aAAa;mBACPrB,QAAQqB,eAAe,EAAE;gBAC7B3B,uBAAuBO,YAAYD,QAAQqB;gBAC3C1B,6BAA6BM;aAC9B;QACH;IACF,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { definePlugin } from 'payload'\nimport { deepMergeSimple } from 'payload/shared'\n\nimport type { PluginDefaultTranslationsObject } from './translations/types.js'\nimport type { FormBuilderPluginConfig } from './types.js'\n\nimport { generateFormCollection } from './collections/Forms/index.js'\nimport { generateSubmissionCollection } from './collections/FormSubmissions/index.js'\nimport { translations } from './translations/index.js'\n\nexport { fields } from './collections/Forms/fields.js'\nexport { translations as formBuilderTranslations } from './translations/index.js'\nexport { getPaymentTotal } from './utilities/getPaymentTotal.js'\n\nexport const formBuilderPlugin = definePlugin<FormBuilderPluginConfig>({\n slug: '@payloadcms/plugin-form-builder',\n plugin: ({ config, options: incomingFormConfig }) => {\n if (!config.i18n) {\n config.i18n = {}\n }\n\n const formConfig: FormBuilderPluginConfig = {\n ...incomingFormConfig,\n fields: {\n checkbox: true,\n country: true,\n email: true,\n message: true,\n number: true,\n payment: false,\n select: true,\n state: true,\n text: true,\n textarea: true,\n upload: false,\n ...incomingFormConfig.fields,\n },\n }\n\n const isUploadFieldEnabled = formConfig.fields?.upload !== false\n const hasUploadCollections =\n Array.isArray(formConfig.uploadCollections) && formConfig.uploadCollections.length > 0\n\n if (isUploadFieldEnabled && !hasUploadCollections) {\n // eslint-disable-next-line no-console\n console.warn(\n '[plugin-form-builder] fields.upload is enabled but uploadCollections is empty or missing. Upload fields will not be registered. Set uploadCollections to an array of upload-enabled collection slugs.',\n )\n }\n\n /**\n * Merge plugin translations — only for languages the user has enabled.\n * Plugins run before sanitize, so `supportedLanguages` may be undefined; sanitize will\n * default it to `{ en }`, so we mirror that here to avoid merging 40+ unused tables.\n */\n const supportedLanguageKeys = config.i18n?.supportedLanguages\n ? Object.keys(config.i18n.supportedLanguages)\n : ['en']\n\n const flattenedTranslations: Record<string, PluginDefaultTranslationsObject> = {}\n for (const lang of supportedLanguageKeys) {\n const entry = translations[lang as keyof typeof translations] ?? translations.en!\n flattenedTranslations[lang] = entry.translations\n }\n\n return {\n ...config,\n collections: [\n ...(config?.collections || []),\n generateFormCollection(formConfig, config?.collections),\n generateSubmissionCollection(formConfig),\n ],\n i18n: {\n ...config.i18n,\n translations: deepMergeSimple(flattenedTranslations, config.i18n?.translations ?? {}),\n },\n }\n },\n})\n"],"names":["definePlugin","deepMergeSimple","generateFormCollection","generateSubmissionCollection","translations","fields","formBuilderTranslations","getPaymentTotal","formBuilderPlugin","slug","plugin","config","options","incomingFormConfig","i18n","formConfig","checkbox","country","email","message","number","payment","select","state","text","textarea","upload","isUploadFieldEnabled","hasUploadCollections","Array","isArray","uploadCollections","length","console","warn","supportedLanguageKeys","supportedLanguages","Object","keys","flattenedTranslations","lang","entry","en","collections"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAS;AACtC,SAASC,eAAe,QAAQ,iBAAgB;AAKhD,SAASC,sBAAsB,QAAQ,+BAA8B;AACrE,SAASC,4BAA4B,QAAQ,yCAAwC;AACrF,SAASC,YAAY,QAAQ,0BAAyB;AAEtD,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASD,gBAAgBE,uBAAuB,QAAQ,0BAAyB;AACjF,SAASC,eAAe,QAAQ,iCAAgC;AAEhE,OAAO,MAAMC,oBAAoBR,aAAsC;IACrES,MAAM;IACNC,QAAQ,CAAC,EAAEC,MAAM,EAAEC,SAASC,kBAAkB,EAAE;QAC9C,IAAI,CAACF,OAAOG,IAAI,EAAE;YAChBH,OAAOG,IAAI,GAAG,CAAC;QACjB;QAEA,MAAMC,aAAsC;YAC1C,GAAGF,kBAAkB;YACrBR,QAAQ;gBACNW,UAAU;gBACVC,SAAS;gBACTC,OAAO;gBACPC,SAAS;gBACTC,QAAQ;gBACRC,SAAS;gBACTC,QAAQ;gBACRC,OAAO;gBACPC,MAAM;gBACNC,UAAU;gBACVC,QAAQ;gBACR,GAAGb,mBAAmBR,MAAM;YAC9B;QACF;QAEA,MAAMsB,uBAAuBZ,WAAWV,MAAM,EAAEqB,WAAW;QAC3D,MAAME,uBACJC,MAAMC,OAAO,CAACf,WAAWgB,iBAAiB,KAAKhB,WAAWgB,iBAAiB,CAACC,MAAM,GAAG;QAEvF,IAAIL,wBAAwB,CAACC,sBAAsB;YACjD,sCAAsC;YACtCK,QAAQC,IAAI,CACV;QAEJ;QAEA;;;;KAIC,GACD,MAAMC,wBAAwBxB,OAAOG,IAAI,EAAEsB,qBACvCC,OAAOC,IAAI,CAAC3B,OAAOG,IAAI,CAACsB,kBAAkB,IAC1C;YAAC;SAAK;QAEV,MAAMG,wBAAyE,CAAC;QAChF,KAAK,MAAMC,QAAQL,sBAAuB;YACxC,MAAMM,QAAQrC,YAAY,CAACoC,KAAkC,IAAIpC,aAAasC,EAAE;YAChFH,qBAAqB,CAACC,KAAK,GAAGC,MAAMrC,YAAY;QAClD;QAEA,OAAO;YACL,GAAGO,MAAM;YACTgC,aAAa;mBACPhC,QAAQgC,eAAe,EAAE;gBAC7BzC,uBAAuBa,YAAYJ,QAAQgC;gBAC3CxC,6BAA6BY;aAC9B;YACDD,MAAM;gBACJ,GAAGH,OAAOG,IAAI;gBACdV,cAAcH,gBAAgBsC,uBAAuB5B,OAAOG,IAAI,EAAEV,gBAAgB,CAAC;YACrF;QACF;IACF;AACF,GAAE"}
@@ -0,0 +1,6 @@
1
+ import type { GenericTranslationsObject, NestedKeysStripped, SupportedLanguages } from '@payloadcms/translations';
2
+ import type { PluginDefaultTranslationsObject } from './types.js';
3
+ export declare const translations: SupportedLanguages<PluginDefaultTranslationsObject>;
4
+ export type PluginFormBuilderTranslations = GenericTranslationsObject;
5
+ export type PluginFormBuilderTranslationKeys = NestedKeysStripped<PluginFormBuilderTranslations>;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AA+CjE,eAAO,MAAM,YAAY,EA6CpB,kBAAkB,CAAC,+BAA+B,CAAC,CAAA;AAExD,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAA;AAErE,MAAM,MAAM,gCAAgC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAA"}