@payloadcms/plugin-form-builder 4.0.0-internal.656159a → 4.0.0-internal.697830c

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 (206) hide show
  1. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.d.ts.map +1 -1
  2. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.js +7 -14
  3. package/dist/collections/FormSubmissions/fields/defaultPaymentFields.js.map +1 -1
  4. package/dist/collections/FormSubmissions/hooks/createCharge.d.ts.map +1 -1
  5. package/dist/collections/FormSubmissions/hooks/handleUploads.d.ts.map +1 -1
  6. package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts.map +1 -1
  7. package/dist/collections/FormSubmissions/index.d.ts.map +1 -1
  8. package/dist/collections/Forms/fields.d.ts.map +1 -1
  9. package/dist/collections/Forms/fields.js +78 -156
  10. package/dist/collections/Forms/fields.js.map +1 -1
  11. package/dist/collections/Forms/index.d.ts +1 -1
  12. package/dist/collections/Forms/index.d.ts.map +1 -1
  13. package/dist/collections/Forms/index.js +19 -54
  14. package/dist/collections/Forms/index.js.map +1 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -23
  18. package/dist/index.js.map +1 -1
  19. package/dist/utilities/getPaymentTotal.d.ts.map +1 -1
  20. package/dist/utilities/lexical/nodeFormat.d.ts.map +1 -1
  21. package/dist/utilities/replaceDoubleCurlys.d.ts.map +1 -1
  22. package/package.json +4 -15
  23. package/dist/translations/index.d.ts +0 -6
  24. package/dist/translations/index.d.ts.map +0 -1
  25. package/dist/translations/index.js +0 -92
  26. package/dist/translations/index.js.map +0 -1
  27. package/dist/translations/languages/ar.d.ts +0 -4
  28. package/dist/translations/languages/ar.d.ts.map +0 -1
  29. package/dist/translations/languages/ar.js +0 -101
  30. package/dist/translations/languages/ar.js.map +0 -1
  31. package/dist/translations/languages/az.d.ts +0 -4
  32. package/dist/translations/languages/az.d.ts.map +0 -1
  33. package/dist/translations/languages/az.js +0 -101
  34. package/dist/translations/languages/az.js.map +0 -1
  35. package/dist/translations/languages/bg.d.ts +0 -4
  36. package/dist/translations/languages/bg.d.ts.map +0 -1
  37. package/dist/translations/languages/bg.js +0 -101
  38. package/dist/translations/languages/bg.js.map +0 -1
  39. package/dist/translations/languages/bnBd.d.ts +0 -4
  40. package/dist/translations/languages/bnBd.d.ts.map +0 -1
  41. package/dist/translations/languages/bnBd.js +0 -101
  42. package/dist/translations/languages/bnBd.js.map +0 -1
  43. package/dist/translations/languages/bnIn.d.ts +0 -4
  44. package/dist/translations/languages/bnIn.d.ts.map +0 -1
  45. package/dist/translations/languages/bnIn.js +0 -101
  46. package/dist/translations/languages/bnIn.js.map +0 -1
  47. package/dist/translations/languages/ca.d.ts +0 -4
  48. package/dist/translations/languages/ca.d.ts.map +0 -1
  49. package/dist/translations/languages/ca.js +0 -101
  50. package/dist/translations/languages/ca.js.map +0 -1
  51. package/dist/translations/languages/cs.d.ts +0 -4
  52. package/dist/translations/languages/cs.d.ts.map +0 -1
  53. package/dist/translations/languages/cs.js +0 -101
  54. package/dist/translations/languages/cs.js.map +0 -1
  55. package/dist/translations/languages/da.d.ts +0 -4
  56. package/dist/translations/languages/da.d.ts.map +0 -1
  57. package/dist/translations/languages/da.js +0 -101
  58. package/dist/translations/languages/da.js.map +0 -1
  59. package/dist/translations/languages/de.d.ts +0 -4
  60. package/dist/translations/languages/de.d.ts.map +0 -1
  61. package/dist/translations/languages/de.js +0 -101
  62. package/dist/translations/languages/de.js.map +0 -1
  63. package/dist/translations/languages/en.d.ts +0 -98
  64. package/dist/translations/languages/en.d.ts.map +0 -1
  65. package/dist/translations/languages/en.js +0 -101
  66. package/dist/translations/languages/en.js.map +0 -1
  67. package/dist/translations/languages/es.d.ts +0 -4
  68. package/dist/translations/languages/es.d.ts.map +0 -1
  69. package/dist/translations/languages/es.js +0 -101
  70. package/dist/translations/languages/es.js.map +0 -1
  71. package/dist/translations/languages/et.d.ts +0 -4
  72. package/dist/translations/languages/et.d.ts.map +0 -1
  73. package/dist/translations/languages/et.js +0 -101
  74. package/dist/translations/languages/et.js.map +0 -1
  75. package/dist/translations/languages/fa.d.ts +0 -4
  76. package/dist/translations/languages/fa.d.ts.map +0 -1
  77. package/dist/translations/languages/fa.js +0 -101
  78. package/dist/translations/languages/fa.js.map +0 -1
  79. package/dist/translations/languages/fr.d.ts +0 -4
  80. package/dist/translations/languages/fr.d.ts.map +0 -1
  81. package/dist/translations/languages/fr.js +0 -101
  82. package/dist/translations/languages/fr.js.map +0 -1
  83. package/dist/translations/languages/he.d.ts +0 -4
  84. package/dist/translations/languages/he.d.ts.map +0 -1
  85. package/dist/translations/languages/he.js +0 -101
  86. package/dist/translations/languages/he.js.map +0 -1
  87. package/dist/translations/languages/hr.d.ts +0 -4
  88. package/dist/translations/languages/hr.d.ts.map +0 -1
  89. package/dist/translations/languages/hr.js +0 -101
  90. package/dist/translations/languages/hr.js.map +0 -1
  91. package/dist/translations/languages/hu.d.ts +0 -4
  92. package/dist/translations/languages/hu.d.ts.map +0 -1
  93. package/dist/translations/languages/hu.js +0 -101
  94. package/dist/translations/languages/hu.js.map +0 -1
  95. package/dist/translations/languages/hy.d.ts +0 -4
  96. package/dist/translations/languages/hy.d.ts.map +0 -1
  97. package/dist/translations/languages/hy.js +0 -101
  98. package/dist/translations/languages/hy.js.map +0 -1
  99. package/dist/translations/languages/id.d.ts +0 -4
  100. package/dist/translations/languages/id.d.ts.map +0 -1
  101. package/dist/translations/languages/id.js +0 -101
  102. package/dist/translations/languages/id.js.map +0 -1
  103. package/dist/translations/languages/is.d.ts +0 -4
  104. package/dist/translations/languages/is.d.ts.map +0 -1
  105. package/dist/translations/languages/is.js +0 -101
  106. package/dist/translations/languages/is.js.map +0 -1
  107. package/dist/translations/languages/it.d.ts +0 -4
  108. package/dist/translations/languages/it.d.ts.map +0 -1
  109. package/dist/translations/languages/it.js +0 -101
  110. package/dist/translations/languages/it.js.map +0 -1
  111. package/dist/translations/languages/ja.d.ts +0 -4
  112. package/dist/translations/languages/ja.d.ts.map +0 -1
  113. package/dist/translations/languages/ja.js +0 -101
  114. package/dist/translations/languages/ja.js.map +0 -1
  115. package/dist/translations/languages/ko.d.ts +0 -4
  116. package/dist/translations/languages/ko.d.ts.map +0 -1
  117. package/dist/translations/languages/ko.js +0 -101
  118. package/dist/translations/languages/ko.js.map +0 -1
  119. package/dist/translations/languages/lt.d.ts +0 -4
  120. package/dist/translations/languages/lt.d.ts.map +0 -1
  121. package/dist/translations/languages/lt.js +0 -101
  122. package/dist/translations/languages/lt.js.map +0 -1
  123. package/dist/translations/languages/lv.d.ts +0 -4
  124. package/dist/translations/languages/lv.d.ts.map +0 -1
  125. package/dist/translations/languages/lv.js +0 -101
  126. package/dist/translations/languages/lv.js.map +0 -1
  127. package/dist/translations/languages/my.d.ts +0 -4
  128. package/dist/translations/languages/my.d.ts.map +0 -1
  129. package/dist/translations/languages/my.js +0 -101
  130. package/dist/translations/languages/my.js.map +0 -1
  131. package/dist/translations/languages/nb.d.ts +0 -4
  132. package/dist/translations/languages/nb.d.ts.map +0 -1
  133. package/dist/translations/languages/nb.js +0 -101
  134. package/dist/translations/languages/nb.js.map +0 -1
  135. package/dist/translations/languages/nl.d.ts +0 -4
  136. package/dist/translations/languages/nl.d.ts.map +0 -1
  137. package/dist/translations/languages/nl.js +0 -101
  138. package/dist/translations/languages/nl.js.map +0 -1
  139. package/dist/translations/languages/pl.d.ts +0 -4
  140. package/dist/translations/languages/pl.d.ts.map +0 -1
  141. package/dist/translations/languages/pl.js +0 -101
  142. package/dist/translations/languages/pl.js.map +0 -1
  143. package/dist/translations/languages/pt.d.ts +0 -4
  144. package/dist/translations/languages/pt.d.ts.map +0 -1
  145. package/dist/translations/languages/pt.js +0 -101
  146. package/dist/translations/languages/pt.js.map +0 -1
  147. package/dist/translations/languages/ro.d.ts +0 -4
  148. package/dist/translations/languages/ro.d.ts.map +0 -1
  149. package/dist/translations/languages/ro.js +0 -101
  150. package/dist/translations/languages/ro.js.map +0 -1
  151. package/dist/translations/languages/rs.d.ts +0 -4
  152. package/dist/translations/languages/rs.d.ts.map +0 -1
  153. package/dist/translations/languages/rs.js +0 -101
  154. package/dist/translations/languages/rs.js.map +0 -1
  155. package/dist/translations/languages/rsLatin.d.ts +0 -4
  156. package/dist/translations/languages/rsLatin.d.ts.map +0 -1
  157. package/dist/translations/languages/rsLatin.js +0 -101
  158. package/dist/translations/languages/rsLatin.js.map +0 -1
  159. package/dist/translations/languages/ru.d.ts +0 -4
  160. package/dist/translations/languages/ru.d.ts.map +0 -1
  161. package/dist/translations/languages/ru.js +0 -101
  162. package/dist/translations/languages/ru.js.map +0 -1
  163. package/dist/translations/languages/sk.d.ts +0 -4
  164. package/dist/translations/languages/sk.d.ts.map +0 -1
  165. package/dist/translations/languages/sk.js +0 -101
  166. package/dist/translations/languages/sk.js.map +0 -1
  167. package/dist/translations/languages/sl.d.ts +0 -4
  168. package/dist/translations/languages/sl.d.ts.map +0 -1
  169. package/dist/translations/languages/sl.js +0 -101
  170. package/dist/translations/languages/sl.js.map +0 -1
  171. package/dist/translations/languages/sv.d.ts +0 -4
  172. package/dist/translations/languages/sv.d.ts.map +0 -1
  173. package/dist/translations/languages/sv.js +0 -101
  174. package/dist/translations/languages/sv.js.map +0 -1
  175. package/dist/translations/languages/ta.d.ts +0 -4
  176. package/dist/translations/languages/ta.d.ts.map +0 -1
  177. package/dist/translations/languages/ta.js +0 -101
  178. package/dist/translations/languages/ta.js.map +0 -1
  179. package/dist/translations/languages/th.d.ts +0 -4
  180. package/dist/translations/languages/th.d.ts.map +0 -1
  181. package/dist/translations/languages/th.js +0 -101
  182. package/dist/translations/languages/th.js.map +0 -1
  183. package/dist/translations/languages/tr.d.ts +0 -4
  184. package/dist/translations/languages/tr.d.ts.map +0 -1
  185. package/dist/translations/languages/tr.js +0 -101
  186. package/dist/translations/languages/tr.js.map +0 -1
  187. package/dist/translations/languages/uk.d.ts +0 -4
  188. package/dist/translations/languages/uk.d.ts.map +0 -1
  189. package/dist/translations/languages/uk.js +0 -101
  190. package/dist/translations/languages/uk.js.map +0 -1
  191. package/dist/translations/languages/vi.d.ts +0 -4
  192. package/dist/translations/languages/vi.d.ts.map +0 -1
  193. package/dist/translations/languages/vi.js +0 -101
  194. package/dist/translations/languages/vi.js.map +0 -1
  195. package/dist/translations/languages/zh.d.ts +0 -4
  196. package/dist/translations/languages/zh.d.ts.map +0 -1
  197. package/dist/translations/languages/zh.js +0 -101
  198. package/dist/translations/languages/zh.js.map +0 -1
  199. package/dist/translations/languages/zhTw.d.ts +0 -4
  200. package/dist/translations/languages/zhTw.d.ts.map +0 -1
  201. package/dist/translations/languages/zhTw.js +0 -101
  202. package/dist/translations/languages/zhTw.js.map +0 -1
  203. package/dist/translations/types.d.ts +0 -5
  204. package/dist/translations/types.d.ts.map +0 -1
  205. package/dist/translations/types.js +0 -3
  206. package/dist/translations/types.js.map +0 -1
@@ -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: ({ 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+D;QAC/DA,EAAE;AACN;AAEA,MAAMI,cAAqB;IACzBP,MAAM;IACNC,MAAM;IACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;QAC/DA,EAAE;AACN;AAEA,MAAMK,QAAe;IACnBC,MAAM;IACNC,QAAQ;QACN;YACET,MAAM;YACNS,QAAQ;gBACN;oBACE,GAAGV,IAAI;oBACPW,OAAO;wBACLL,OAAO;oBACT;gBACF;gBACA;oBACE,GAAGJ,KAAK;oBACRS,OAAO;wBACLL,OAAO;oBACT;gBACF;aACD;QACH;QACA;YACEL,MAAM;YACNS,QAAQ;gBACN;oBACE,GAAGJ,KAAK;oBACRK,OAAO;wBACLL,OAAO;oBACT;gBACF;gBACA;oBACEN,MAAM;oBACNC,MAAM;oBACNU,OAAO;wBACLL,OAAO;oBACT;oBACAJ,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;wBAC/DA,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iBACD;YACH;YACA;gBACEF,MAAM;gBACNS,QAAQ;oBACN;wBACE,GAAGN,QAAQ;wBACXO,OAAO;4BACLL,OAAO;wBACT;oBACF;oBACA;wBACEN,MAAM;wBACNC,MAAM;wBACNU,OAAO;4BACLL,OAAO;wBACT;wBACAJ,OAAO,CAAC,EAAEC,CAAC,EAAE,GACX,+DAA+D;4BAC/DA,EAAE;oBACN;iBACD;YACH;SACD;QACDS,QAAQ;YACNC,QAAQ,CAAC,EAAEV,CAAC,EAAE,GACZ,+DAA+D;gBAC/DA,EAAE;YACJW,UAAU,CAAC,EAAEX,CAAC,EAAE,GACd,+DAA+D;gBAC/DA,EAAE;QACN;IACF;AACF;AAEA,OAAO,MAAMO,SAET;IACF8B,UAAUlB;IACVmB,SAASpB;IACTqB,MAAMnB;IACNoB,OAAOxB;IACPyB,SAAST;IACTU,QAAQ3B;IACR4B,SAAStB;IACTuB,OAAOvC;IACPwC,QAAQjC;IACRkC,OAAO7B;IACP8B,MAAMlC;IACNmC,UAAUlC;IACVmC,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: '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,MAA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{ 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,eACrB,uBAAuB,gBACrB,MAAM,CAAC,aAAa,CAAC,KAClC,gBA+SF,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,GACjC,YAAY,uBAAuB,EACnC,cAAc,MAAM,CAAC,aAAa,CAAC,KAClC,gBAqPF,CAAA"}
@@ -36,13 +36,10 @@ export const generateFormCollection = (formConfig, collections)=>{
36
36
  {
37
37
  name: 'url',
38
38
  type: 'text',
39
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
40
- t('plugin-form-builder:urlToRedirectTo'),
39
+ label: 'URL to redirect to',
41
40
  required: true
42
41
  }
43
- ],
44
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
45
- t('plugin-form-builder:redirect')
42
+ ]
46
43
  };
47
44
  if (formConfig.redirectRelationships) {
48
45
  redirect.fields.unshift({
@@ -51,8 +48,7 @@ export const generateFormCollection = (formConfig, collections)=>{
51
48
  admin: {
52
49
  condition: (_, siblingData)=>siblingData?.type === 'reference'
53
50
  },
54
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
55
- t('plugin-form-builder:documentToLinkTo'),
51
+ label: 'Document to link to',
56
52
  maxDepth: 2,
57
53
  relationTo: formConfig.redirectRelationships,
58
54
  required: true
@@ -66,20 +62,17 @@ export const generateFormCollection = (formConfig, collections)=>{
66
62
  defaultValue: 'reference',
67
63
  options: [
68
64
  {
69
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
70
- t('plugin-form-builder:internalLink'),
65
+ label: 'Internal link',
71
66
  value: 'reference'
72
67
  },
73
68
  {
74
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
75
- t('plugin-form-builder:customURL'),
69
+ label: 'Custom URL',
76
70
  value: 'custom'
77
71
  }
78
72
  ]
79
73
  });
80
74
  if (redirect.fields[2].type !== 'row') {
81
- redirect.fields[2].label = ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
82
- t('plugin-form-builder:customURL');
75
+ redirect.fields[2].label = 'Custom URL';
83
76
  }
84
77
  redirect.fields[2].admin = {
85
78
  condition: (_, siblingData)=>siblingData?.type === 'custom'
@@ -89,8 +82,6 @@ export const generateFormCollection = (formConfig, collections)=>{
89
82
  {
90
83
  name: 'title',
91
84
  type: 'text',
92
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
93
- t('plugin-form-builder:title'),
94
85
  required: true
95
86
  },
96
87
  {
@@ -121,43 +112,28 @@ export const generateFormCollection = (formConfig, collections)=>{
121
112
  return block;
122
113
  }
123
114
  return null;
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
- }
115
+ }).filter(Boolean)
133
116
  },
134
117
  {
135
118
  name: 'submitButtonLabel',
136
119
  type: 'text',
137
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
138
- t('plugin-form-builder:submitButton'),
139
120
  localized: true
140
121
  },
141
122
  {
142
123
  name: 'confirmationType',
143
124
  type: 'radio',
144
125
  admin: {
145
- description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
146
- t('plugin-form-builder:chooseConfirmationType'),
126
+ description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
147
127
  layout: 'horizontal'
148
128
  },
149
129
  defaultValue: 'message',
150
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
151
- t('plugin-form-builder:confirmationType'),
152
130
  options: [
153
131
  {
154
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
155
- t('plugin-form-builder:message'),
132
+ label: 'Message',
156
133
  value: 'message'
157
134
  },
158
135
  {
159
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
160
- t('plugin-form-builder:redirect'),
136
+ label: 'Redirect',
161
137
  value: 'redirect'
162
138
  }
163
139
  ]
@@ -168,8 +144,6 @@ export const generateFormCollection = (formConfig, collections)=>{
168
144
  admin: {
169
145
  condition: (_, siblingData)=>siblingData?.confirmationType === 'message'
170
146
  },
171
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
172
- t('plugin-form-builder:confirmationMessage'),
173
147
  localized: true,
174
148
  required: true
175
149
  },
@@ -181,8 +155,7 @@ export const generateFormCollection = (formConfig, collections)=>{
181
155
  read: ({ req: { user } })=>!!user
182
156
  },
183
157
  admin: {
184
- description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
185
- t('plugin-form-builder:emailsDescription')
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."
186
159
  },
187
160
  fields: [
188
161
  {
@@ -195,8 +168,7 @@ export const generateFormCollection = (formConfig, collections)=>{
195
168
  placeholder: '"Email Sender" <sender@email.com>',
196
169
  width: '100%'
197
170
  },
198
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
199
- t('plugin-form-builder:emailTo')
171
+ label: 'Email To'
200
172
  },
201
173
  {
202
174
  name: 'cc',
@@ -206,8 +178,7 @@ export const generateFormCollection = (formConfig, collections)=>{
206
178
  maxWidth: '50%'
207
179
  }
208
180
  },
209
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
210
- t('plugin-form-builder:cc')
181
+ label: 'CC'
211
182
  },
212
183
  {
213
184
  name: 'bcc',
@@ -217,8 +188,7 @@ export const generateFormCollection = (formConfig, collections)=>{
217
188
  maxWidth: '50%'
218
189
  }
219
190
  },
220
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
221
- t('plugin-form-builder:bcc')
191
+ label: 'BCC'
222
192
  }
223
193
  ]
224
194
  },
@@ -232,8 +202,7 @@ export const generateFormCollection = (formConfig, collections)=>{
232
202
  placeholder: '"Reply To" <reply-to@email.com>',
233
203
  width: '50%'
234
204
  },
235
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
236
- t('plugin-form-builder:replyTo')
205
+ label: 'Reply To'
237
206
  },
238
207
  {
239
208
  name: 'emailFrom',
@@ -242,8 +211,7 @@ export const generateFormCollection = (formConfig, collections)=>{
242
211
  placeholder: '"Email From" <email-from@email.com>',
243
212
  width: '50%'
244
213
  },
245
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
246
- t('plugin-form-builder:emailFrom')
214
+ label: 'Email From'
247
215
  }
248
216
  ]
249
217
  },
@@ -251,8 +219,7 @@ export const generateFormCollection = (formConfig, collections)=>{
251
219
  name: 'subject',
252
220
  type: 'text',
253
221
  defaultValue: "You've received a new message.",
254
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
255
- t('plugin-form-builder:subject'),
222
+ label: 'Subject',
256
223
  localized: true,
257
224
  required: true
258
225
  },
@@ -260,11 +227,9 @@ export const generateFormCollection = (formConfig, collections)=>{
260
227
  name: 'message',
261
228
  type: 'richText',
262
229
  admin: {
263
- description: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
264
- t('plugin-form-builder:messageDescription')
230
+ description: 'Enter the message that should be sent in this email.'
265
231
  },
266
- label: ({ t })=>// @ts-expect-error - translations are not typed in plugins yet
267
- t('plugin-form-builder:message'),
232
+ label: 'Message',
268
233
  localized: true
269
234
  }
270
235
  ]
@@ -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: ({ 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,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,CAACC,GAAGC,cAAgBA,aAAaC,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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,MA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BACLuB,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"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { FormBuilderPluginConfig } from './types.js';
2
2
  export { fields } from './collections/Forms/fields.js';
3
- export { translations as formBuilderTranslations } from './translations/index.js';
4
3
  export { getPaymentTotal } from './utilities/getPaymentTotal.js';
5
4
  export declare const formBuilderPlugin: (options: FormBuilderPluginConfig) => import("payload").Plugin;
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,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,gEAyC5B,CAAA"}
package/dist/index.js CHANGED
@@ -1,17 +1,11 @@
1
1
  import { definePlugin } from 'payload';
2
- import { deepMergeSimple } from 'payload/shared';
3
2
  import { generateFormCollection } from './collections/Forms/index.js';
4
3
  import { generateSubmissionCollection } from './collections/FormSubmissions/index.js';
5
- import { translations } from './translations/index.js';
6
4
  export { fields } from './collections/Forms/fields.js';
7
- export { translations as formBuilderTranslations } from './translations/index.js';
8
5
  export { getPaymentTotal } from './utilities/getPaymentTotal.js';
9
6
  export const formBuilderPlugin = definePlugin({
10
7
  slug: '@payloadcms/plugin-form-builder',
11
8
  plugin: ({ config, options: incomingFormConfig })=>{
12
- if (!config.i18n) {
13
- config.i18n = {};
14
- }
15
9
  const formConfig = {
16
10
  ...incomingFormConfig,
17
11
  fields: {
@@ -35,29 +29,13 @@ export const formBuilderPlugin = definePlugin({
35
29
  // eslint-disable-next-line no-console
36
30
  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.');
37
31
  }
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
- }
50
32
  return {
51
33
  ...config,
52
34
  collections: [
53
35
  ...config?.collections || [],
54
36
  generateFormCollection(formConfig, config?.collections),
55
37
  generateSubmissionCollection(formConfig)
56
- ],
57
- i18n: {
58
- ...config.i18n,
59
- translations: deepMergeSimple(flattenedTranslations, config.i18n?.translations ?? {})
60
- }
38
+ ]
61
39
  };
62
40
  }
63
41
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { definePlugin } 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 = definePlugin<FormBuilderPluginConfig>({\n slug: '@payloadcms/plugin-form-builder',\n plugin: ({ config, options: incomingFormConfig }) => {\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})\n"],"names":["definePlugin","generateFormCollection","generateSubmissionCollection","fields","getPaymentTotal","formBuilderPlugin","slug","plugin","config","options","incomingFormConfig","formConfig","checkbox","country","email","message","number","payment","select","state","text","textarea","upload","isUploadFieldEnabled","hasUploadCollections","Array","isArray","uploadCollections","length","console","warn","collections"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAS;AAItC,SAASC,sBAAsB,QAAQ,+BAA8B;AACrE,SAASC,4BAA4B,QAAQ,yCAAwC;AAErF,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASC,eAAe,QAAQ,iCAAgC;AAEhE,OAAO,MAAMC,oBAAoBL,aAAsC;IACrEM,MAAM;IACNC,QAAQ,CAAC,EAAEC,MAAM,EAAEC,SAASC,kBAAkB,EAAE;QAC9C,MAAMC,aAAsC;YAC1C,GAAGD,kBAAkB;YACrBP,QAAQ;gBACNS,UAAU;gBACVC,SAAS;gBACTC,OAAO;gBACPC,SAAS;gBACTC,QAAQ;gBACRC,SAAS;gBACTC,QAAQ;gBACRC,OAAO;gBACPC,MAAM;gBACNC,UAAU;gBACVC,QAAQ;gBACR,GAAGZ,mBAAmBP,MAAM;YAC9B;QACF;QAEA,MAAMoB,uBAAuBZ,WAAWR,MAAM,EAAEmB,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,GAAGtB,MAAM;YACTuB,aAAa;mBACPvB,QAAQuB,eAAe,EAAE;gBAC7B9B,uBAAuBU,YAAYH,QAAQuB;gBAC3C7B,6BAA6BS;aAC9B;QACH;IACF;AACF,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPaymentTotal.d.ts","sourceRoot":"","sources":["../../src/utilities/getPaymentTotal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAA;AAE5E,eAAO,MAAM,eAAe,SACpB;IACJ,WAAW,EAAE,WAAW,CAAA;CACzB,GAAG,OAAO,CAAC,YAAY,CAAC,KACxB,MA8CF,CAAA"}
1
+ {"version":3,"file":"getPaymentTotal.d.ts","sourceRoot":"","sources":["../../src/utilities/getPaymentTotal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAA;AAE5E,eAAO,MAAM,eAAe,GAC1B,MAAM;IACJ,WAAW,EAAE,WAAW,CAAA;CACzB,GAAG,OAAO,CAAC,YAAY,CAAC,KACxB,MA8CF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeFormat.d.ts","sourceRoot":"","sources":["../../../src/utilities/lexical/nodeFormat.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;aACrB,gBAAgB,EAAE,CAAC;aACnB,aAAa,EAAE,CAAC;aAEhB,cAAc,EAAE,CAAC;aACjB,eAAe,EAAE,CAAC;aAClB,cAAc,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,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bb,CAAA;AAEV,eAAO,MAAM,iBAAiB,QAQL,CAAA;AAGzB,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C,eAAO,MAAM,iBAAiB,SAAS,CAAA;AAYvC,eAAO,MAAM,SAAS,QAA8C,CAAA;AAEpE,eAAO,MAAM,SAAS,QAA8C,CAAA;AAEpE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,MAAM,CAS5D,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,MAAM,CAG9D,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,MAAM,CAOnE,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAOtD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAIpD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAIjD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"replaceDoubleCurlys.d.ts","sourceRoot":"","sources":["../../src/utilities/replaceDoubleCurlys.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,KAAK,cAAc,GAAG,aAAa,EAAE,CAAA;AAErC,eAAO,MAAM,mBAAmB,QAAS,MAAM,cAAc,cAAc,KAAG,MA8B7E,CAAA"}
1
+ {"version":3,"file":"replaceDoubleCurlys.d.ts","sourceRoot":"","sources":["../../src/utilities/replaceDoubleCurlys.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,KAAK,cAAc,GAAG,aAAa,EAAE,CAAA;AAErC,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,YAAY,cAAc,KAAG,MA8B7E,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-form-builder",
3
- "version": "4.0.0-internal.656159a",
3
+ "version": "4.0.0-internal.697830c",
4
4
  "description": "Form builder plugin for Payload CMS",
5
5
  "keywords": [
6
6
  "payload",
@@ -44,16 +44,6 @@
44
44
  "import": "./dist/exports/client.js",
45
45
  "types": "./dist/exports/client.d.ts",
46
46
  "default": "./dist/exports/client.js"
47
- },
48
- "./translations/languages/all": {
49
- "import": "./dist/translations/index.js",
50
- "types": "./dist/translations/index.d.ts",
51
- "default": "./dist/translations/index.js"
52
- },
53
- "./translations/languages/*": {
54
- "import": "./dist/translations/languages/*.js",
55
- "types": "./dist/translations/languages/*.d.ts",
56
- "default": "./dist/translations/languages/*.js"
57
47
  }
58
48
  },
59
49
  "main": "./dist/index.js",
@@ -63,8 +53,7 @@
63
53
  ],
64
54
  "dependencies": {
65
55
  "escape-html": "^1.0.3",
66
- "@payloadcms/translations": "4.0.0-internal.656159a",
67
- "@payloadcms/ui": "4.0.0-internal.656159a"
56
+ "@payloadcms/ui": "4.0.0-internal.697830c"
68
57
  },
69
58
  "devDependencies": {
70
59
  "@types/escape-html": "^1.0.4",
@@ -73,12 +62,12 @@
73
62
  "copyfiles": "^2.4.1",
74
63
  "cross-env": "10.1.0",
75
64
  "@payloadcms/eslint-config": "3.28.0",
76
- "payload": "4.0.0-internal.656159a"
65
+ "payload": "4.0.0-internal.697830c"
77
66
  },
78
67
  "peerDependencies": {
79
68
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
80
69
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
81
- "payload": "4.0.0-internal.656159a"
70
+ "payload": "4.0.0-internal.697830c"
82
71
  },
83
72
  "publishConfig": {
84
73
  "registry": "https://registry.npmjs.org/"
@@ -1,6 +0,0 @@
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