@payloadcms/plugin-form-builder 3.0.0-beta.13 → 3.0.0-beta.131

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 (95) hide show
  1. package/dist/collections/FormSubmissions/hooks/createCharge.d.ts +3 -0
  2. package/dist/collections/FormSubmissions/hooks/createCharge.d.ts.map +1 -0
  3. package/dist/collections/FormSubmissions/hooks/createCharge.js.map +1 -1
  4. package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts +6 -0
  5. package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts.map +1 -0
  6. package/dist/collections/FormSubmissions/hooks/sendEmail.js +12 -10
  7. package/dist/collections/FormSubmissions/hooks/sendEmail.js.map +1 -1
  8. package/dist/collections/FormSubmissions/index.d.ts +4 -0
  9. package/dist/collections/FormSubmissions/index.d.ts.map +1 -0
  10. package/dist/collections/FormSubmissions/index.js +66 -62
  11. package/dist/collections/FormSubmissions/index.js.map +1 -1
  12. package/dist/collections/Forms/DynamicFieldSelector.d.ts +6 -0
  13. package/dist/collections/Forms/DynamicFieldSelector.d.ts.map +1 -0
  14. package/dist/collections/Forms/DynamicFieldSelector.js +8 -6
  15. package/dist/collections/Forms/DynamicFieldSelector.js.map +1 -1
  16. package/dist/collections/Forms/DynamicPriceSelector.d.ts +3 -0
  17. package/dist/collections/Forms/DynamicPriceSelector.d.ts.map +1 -0
  18. package/dist/collections/Forms/DynamicPriceSelector.js +23 -14
  19. package/dist/collections/Forms/DynamicPriceSelector.js.map +1 -1
  20. package/dist/collections/Forms/fields.d.ts +6 -0
  21. package/dist/collections/Forms/fields.d.ts.map +1 -0
  22. package/dist/collections/Forms/fields.js +2 -5
  23. package/dist/collections/Forms/fields.js.map +1 -1
  24. package/dist/collections/Forms/index.d.ts +4 -0
  25. package/dist/collections/Forms/index.d.ts.map +1 -0
  26. package/dist/collections/Forms/index.js +155 -146
  27. package/dist/collections/Forms/index.js.map +1 -1
  28. package/dist/exports/client.d.ts +3 -0
  29. package/dist/exports/client.d.ts.map +1 -0
  30. package/dist/exports/client.js +4 -0
  31. package/dist/exports/client.js.map +1 -0
  32. package/dist/exports/types.d.ts +2 -0
  33. package/dist/exports/types.d.ts.map +1 -0
  34. package/dist/exports/types.js +3 -0
  35. package/dist/exports/types.js.map +1 -0
  36. package/dist/index.d.ts +6 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +2 -17
  39. package/dist/index.js.map +1 -1
  40. package/dist/types.d.ts +189 -0
  41. package/dist/types.d.ts.map +1 -0
  42. package/dist/types.js.map +1 -1
  43. package/dist/utilities/getPaymentTotal.d.ts +5 -0
  44. package/dist/utilities/getPaymentTotal.d.ts.map +1 -0
  45. package/dist/utilities/getPaymentTotal.js +4 -4
  46. package/dist/utilities/getPaymentTotal.js.map +1 -1
  47. package/dist/utilities/keyValuePairToHtmlTable.d.ts +4 -0
  48. package/dist/utilities/keyValuePairToHtmlTable.d.ts.map +1 -0
  49. package/dist/utilities/keyValuePairToHtmlTable.js +10 -0
  50. package/dist/utilities/keyValuePairToHtmlTable.js.map +1 -0
  51. package/dist/utilities/lexical/converters/heading.d.ts +3 -0
  52. package/dist/utilities/lexical/converters/heading.d.ts.map +1 -0
  53. package/dist/utilities/lexical/converters/heading.js.map +1 -1
  54. package/dist/utilities/lexical/converters/linebreak.d.ts +3 -0
  55. package/dist/utilities/lexical/converters/linebreak.d.ts.map +1 -0
  56. package/dist/utilities/lexical/converters/linebreak.js.map +1 -1
  57. package/dist/utilities/lexical/converters/link.d.ts +3 -0
  58. package/dist/utilities/lexical/converters/link.d.ts.map +1 -0
  59. package/dist/utilities/lexical/converters/link.js.map +1 -1
  60. package/dist/utilities/lexical/converters/list.d.ts +4 -0
  61. package/dist/utilities/lexical/converters/list.d.ts.map +1 -0
  62. package/dist/utilities/lexical/converters/list.js.map +1 -1
  63. package/dist/utilities/lexical/converters/paragraph.d.ts +3 -0
  64. package/dist/utilities/lexical/converters/paragraph.d.ts.map +1 -0
  65. package/dist/utilities/lexical/converters/paragraph.js.map +1 -1
  66. package/dist/utilities/lexical/converters/quote.d.ts +3 -0
  67. package/dist/utilities/lexical/converters/quote.d.ts.map +1 -0
  68. package/dist/utilities/lexical/converters/quote.js.map +1 -1
  69. package/dist/utilities/lexical/converters/text.d.ts +3 -0
  70. package/dist/utilities/lexical/converters/text.d.ts.map +1 -0
  71. package/dist/utilities/lexical/converters/text.js.map +1 -1
  72. package/dist/utilities/lexical/defaultConverters.d.ts +3 -0
  73. package/dist/utilities/lexical/defaultConverters.d.ts.map +1 -0
  74. package/dist/utilities/lexical/defaultConverters.js.map +1 -1
  75. package/dist/utilities/lexical/nodeFormat.d.ts +39 -0
  76. package/dist/utilities/lexical/nodeFormat.d.ts.map +1 -0
  77. package/dist/utilities/lexical/nodeFormat.js.map +1 -1
  78. package/dist/utilities/lexical/serializeLexical.d.ts +9 -0
  79. package/dist/utilities/lexical/serializeLexical.d.ts.map +1 -0
  80. package/dist/utilities/lexical/serializeLexical.js.map +1 -1
  81. package/dist/utilities/lexical/types.d.ts +14 -0
  82. package/dist/utilities/lexical/types.d.ts.map +1 -0
  83. package/dist/utilities/lexical/types.js.map +1 -1
  84. package/dist/utilities/replaceDoubleCurlys.d.ts +8 -0
  85. package/dist/utilities/replaceDoubleCurlys.d.ts.map +1 -0
  86. package/dist/utilities/replaceDoubleCurlys.js +18 -2
  87. package/dist/utilities/replaceDoubleCurlys.js.map +1 -1
  88. package/dist/utilities/slate/serializeSlate.d.ts +12 -0
  89. package/dist/utilities/slate/serializeSlate.d.ts.map +1 -0
  90. package/dist/utilities/slate/serializeSlate.js +19 -19
  91. package/dist/utilities/slate/serializeSlate.js.map +1 -1
  92. package/license.md +22 -0
  93. package/package.json +62 -41
  94. package/types.d.ts +0 -1
  95. package/types.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field } from 'payload/types'\n\nimport type { FieldConfig, PaymentFieldConfig } from '../../types.js'\n\nimport { DynamicFieldSelector } from './DynamicFieldSelector.js'\nimport { DynamicPriceSelector } from './DynamicPriceSelector.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 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 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: 'Default Value',\n },\n ],\n labels: {\n plural: 'Checkbox Fields',\n singular: 'Checkbox',\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: 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: 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\n// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\nexport const fields = {\n checkbox: Checkbox,\n country: Country,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n} as {\n [key: string]: ((fieldConfig?: FieldConfig | boolean) => Block) | Block\n}\n"],"names":["DynamicFieldSelector","DynamicPriceSelector","name","type","label","required","localized","width","Select","slug","fields","admin","labels","plural","singular","Text","TextArea","Number","Email","State","Country","Checkbox","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","filter","Boolean","Message","checkbox","country","email","message","number","payment","select","state","text","textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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YACF;YACAT;SACD,CAAC4B,MAAM,CAACC;QACTtB,QAAQ;YACNC,QAAQ;YACRC,UAAU;QACZ;IACF;IAEA,OAAOJ;AACT;AAEA,MAAMyB,UAAiB;IACrB1B,MAAM;IACNC,QAAQ;QACN;YACER,MAAM;YACNC,MAAM;YACNG,WAAW;QACb;KACD;IACDM,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF;AAEA,yEAAyE;AACzE,OAAO,MAAMJ,SAAS;IACpB0B,UAAUf;IACVgB,SAASjB;IACTkB,OAAOpB;IACPqB,SAASJ;IACTK,QAAQvB;IACRwB,SAASnB;IACToB,QAAQlC;IACRmC,OAAOxB;IACPyB,MAAM7B;IACN8B,UAAU7B;AACZ,EAEC"}
1
+ {"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field } from 'payload'\n\nimport type { FieldConfig, 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 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 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: 'Default Value',\n },\n ],\n labels: {\n plural: 'Checkbox Fields',\n singular: 'Checkbox',\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\nexport const fields = {\n checkbox: Checkbox,\n country: Country,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n} as {\n [key: string]: ((fieldConfig?: boolean | FieldConfig) => Block) | Block\n}\n"],"names":["name","type","label","required","localized","width","Select","slug","fields","admin","labels","plural","singular","Text","TextArea","Number","Email","State","Country","Checkbox","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","filter","Boolean","Message","checkbox","country","email","message","number","payment","select","state","text","textarea"],"mappings":"AAIA,MAAMA,OAAc;IAClBA,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,UAAU;AACZ;AAEA,MAAMD,QAAe;IACnBF,MAAM;IACNC,MAAM;IACNC,OAAO;IACPE,WAAW;AACb;AAEA,MAAMD,WAAkB;IACtBH,MAAM;IACNC,MAAM;IACNC,OAAO;AACT;AAEA,MAAMG,QAAe;IACnBL,MAAM;IACNC,MAAM;IACNC,OAAO;AACT;AAEA,MAAMI,SAAgB;IACpBC,MAAM;IACNC,QAAQ;QACN;YACEP,MAAM;YACNO,QAAQ;gBACN;oBACE,GAAGR,IAAI;oBACPS,OAAO;wBACLJ,OAAO;oBACT;gBACF;gBACA;oBACE,GAAGH,KAAK;oBACRO,OAAO;wBACLJ,OAAO;oBACT;gBACF;aACD;QACH;QACA;YACEJ,MAAM;YACNO,QAAQ;gBACN;oBACE,GAAGH,KAAK;oBACRI,OAAO;wBACLJ,OAAO;oBACT;gBACF;gBACA;oBACEL,MAAM;oBACNC,MAAM;oBACNQ,OAAO;wBACLJ,OAAO;oBACT;oBACAH,OAAO;oBACPE,WAAW;gBACb;aACD;QACH;QACA;YACEJ,MAAM;YACNC,MAAM;YACNO,QAAQ;gBACN;oBACEP,MAAM;oBACNO,QAAQ;wBACN;4BACER,MAAM;4BACNC,MAAM;4BACNQ,OAAO;gCACLJ,OAAO;4BACT;4BACAH,OAAO;4BACPE,WAAW;4BACXD,UAAU;wBACZ;wBACA;4BACEH,MAAM;4BACNC,MAAM;4BACNQ,OAAO;gCACLJ,OAAO;4BACT;4BACAH,OAAO;4BACPC,UAAU;wBACZ;qBACD;gBACH;aAC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AASjB;IACTkB,OAAOpB;IACPqB,SAASJ;IACTK,QAAQvB;IACRwB,SAASnB;IACToB,QAAQlC;IACRmC,OAAOxB;IACPyB,MAAM7B;IACN8B,UAAU7B;AACZ,EAEC"}
@@ -0,0 +1,4 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ import type { FormBuilderPluginConfig } from '../../types.js';
3
+ export declare const generateFormCollection: (formConfig: FormBuilderPluginConfig) => CollectionConfig;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAI7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAK7D,eAAO,MAAM,sBAAsB,eAAgB,uBAAuB,KAAG,gBA4O5E,CAAA"}
@@ -1,4 +1,4 @@
1
- import merge from 'deepmerge';
1
+ import { deepMergeWithSourceArrays } from 'payload';
2
2
  import { fields } from './fields.js';
3
3
  // all settings can be overridden by the config
4
4
  export const generateFormCollection = (formConfig)=>{
@@ -48,11 +48,161 @@ export const generateFormCollection = (formConfig)=>{
48
48
  }
49
49
  ]
50
50
  });
51
- if (redirect.fields[2].type !== 'row') redirect.fields[2].label = 'Custom URL';
51
+ if (redirect.fields[2].type !== 'row') {
52
+ redirect.fields[2].label = 'Custom URL';
53
+ }
52
54
  redirect.fields[2].admin = {
53
55
  condition: (_, siblingData)=>siblingData?.type === 'custom'
54
56
  };
55
57
  }
58
+ const defaultFields = [
59
+ {
60
+ name: 'title',
61
+ type: 'text',
62
+ required: true
63
+ },
64
+ {
65
+ name: 'fields',
66
+ type: 'blocks',
67
+ blocks: Object.entries(formConfig?.fields || {}).map(([fieldKey, fieldConfig])=>{
68
+ // let the config enable/disable fields with either boolean values or objects
69
+ if (fieldConfig !== false) {
70
+ const block = fields[fieldKey];
71
+ if (block === undefined && typeof fieldConfig === 'object') {
72
+ return fieldConfig;
73
+ }
74
+ if (typeof block === 'object' && typeof fieldConfig === 'object') {
75
+ return deepMergeWithSourceArrays(block, fieldConfig);
76
+ }
77
+ if (typeof block === 'function') {
78
+ return block(fieldConfig);
79
+ }
80
+ return block;
81
+ }
82
+ return null;
83
+ }).filter(Boolean)
84
+ },
85
+ {
86
+ name: 'submitButtonLabel',
87
+ type: 'text',
88
+ localized: true
89
+ },
90
+ {
91
+ name: 'confirmationType',
92
+ type: 'radio',
93
+ admin: {
94
+ description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
95
+ layout: 'horizontal'
96
+ },
97
+ defaultValue: 'message',
98
+ options: [
99
+ {
100
+ label: 'Message',
101
+ value: 'message'
102
+ },
103
+ {
104
+ label: 'Redirect',
105
+ value: 'redirect'
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ name: 'confirmationMessage',
111
+ type: 'richText',
112
+ admin: {
113
+ condition: (_, siblingData)=>siblingData?.confirmationType === 'message'
114
+ },
115
+ localized: true,
116
+ required: true
117
+ },
118
+ redirect,
119
+ {
120
+ name: 'emails',
121
+ type: 'array',
122
+ access: {
123
+ read: ({ req: { user } })=>!!user
124
+ },
125
+ admin: {
126
+ 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."
127
+ },
128
+ fields: [
129
+ {
130
+ type: 'row',
131
+ fields: [
132
+ {
133
+ name: 'emailTo',
134
+ type: 'text',
135
+ admin: {
136
+ placeholder: '"Email Sender" <sender@email.com>',
137
+ width: '100%'
138
+ },
139
+ label: 'Email To'
140
+ },
141
+ {
142
+ name: 'cc',
143
+ type: 'text',
144
+ admin: {
145
+ style: {
146
+ maxWidth: '50%'
147
+ }
148
+ },
149
+ label: 'CC'
150
+ },
151
+ {
152
+ name: 'bcc',
153
+ type: 'text',
154
+ admin: {
155
+ style: {
156
+ maxWidth: '50%'
157
+ }
158
+ },
159
+ label: 'BCC'
160
+ }
161
+ ]
162
+ },
163
+ {
164
+ type: 'row',
165
+ fields: [
166
+ {
167
+ name: 'replyTo',
168
+ type: 'text',
169
+ admin: {
170
+ placeholder: '"Reply To" <reply-to@email.com>',
171
+ width: '50%'
172
+ },
173
+ label: 'Reply To'
174
+ },
175
+ {
176
+ name: 'emailFrom',
177
+ type: 'text',
178
+ admin: {
179
+ placeholder: '"Email From" <email-from@email.com>',
180
+ width: '50%'
181
+ },
182
+ label: 'Email From'
183
+ }
184
+ ]
185
+ },
186
+ {
187
+ name: 'subject',
188
+ type: 'text',
189
+ defaultValue: "You've received a new message.",
190
+ label: 'Subject',
191
+ localized: true,
192
+ required: true
193
+ },
194
+ {
195
+ name: 'message',
196
+ type: 'richText',
197
+ admin: {
198
+ description: 'Enter the message that should be sent in this email.'
199
+ },
200
+ label: 'Message',
201
+ localized: true
202
+ }
203
+ ]
204
+ }
205
+ ];
56
206
  const config = {
57
207
  ...formConfig?.formOverrides || {},
58
208
  slug: formConfig?.formOverrides?.slug || 'forms',
@@ -65,150 +215,9 @@ export const generateFormCollection = (formConfig)=>{
65
215
  useAsTitle: 'title',
66
216
  ...formConfig?.formOverrides?.admin || {}
67
217
  },
68
- fields: [
69
- {
70
- name: 'title',
71
- type: 'text',
72
- required: true
73
- },
74
- {
75
- name: 'fields',
76
- type: 'blocks',
77
- blocks: Object.entries(formConfig?.fields || {}).map(([fieldKey, fieldConfig])=>{
78
- // let the config enable/disable fields with either boolean values or objects
79
- if (fieldConfig !== false) {
80
- const block = fields[fieldKey];
81
- if (block === undefined && typeof fieldConfig === 'object') {
82
- return fieldConfig;
83
- }
84
- if (typeof block === 'object' && typeof fieldConfig === 'object') {
85
- return merge(block, fieldConfig, {
86
- arrayMerge: (_, sourceArray)=>sourceArray
87
- });
88
- }
89
- if (typeof block === 'function') {
90
- return block(fieldConfig);
91
- }
92
- return block;
93
- }
94
- return null;
95
- }).filter(Boolean)
96
- },
97
- {
98
- name: 'submitButtonLabel',
99
- type: 'text',
100
- localized: true
101
- },
102
- {
103
- name: 'confirmationType',
104
- type: 'radio',
105
- admin: {
106
- description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
107
- layout: 'horizontal'
108
- },
109
- defaultValue: 'message',
110
- options: [
111
- {
112
- label: 'Message',
113
- value: 'message'
114
- },
115
- {
116
- label: 'Redirect',
117
- value: 'redirect'
118
- }
119
- ]
120
- },
121
- {
122
- name: 'confirmationMessage',
123
- type: 'richText',
124
- admin: {
125
- condition: (_, siblingData)=>siblingData?.confirmationType === 'message'
126
- },
127
- localized: true,
128
- required: true
129
- },
130
- redirect,
131
- {
132
- name: 'emails',
133
- type: 'array',
134
- admin: {
135
- 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}}."
136
- },
137
- fields: [
138
- {
139
- type: 'row',
140
- fields: [
141
- {
142
- name: 'emailTo',
143
- type: 'text',
144
- admin: {
145
- placeholder: '"Email Sender" <sender@email.com>',
146
- width: '100%'
147
- },
148
- label: 'Email To'
149
- },
150
- {
151
- name: 'cc',
152
- type: 'text',
153
- admin: {
154
- width: '50%'
155
- },
156
- label: 'CC'
157
- },
158
- {
159
- name: 'bcc',
160
- type: 'text',
161
- admin: {
162
- width: '50%'
163
- },
164
- label: 'BCC'
165
- }
166
- ]
167
- },
168
- {
169
- type: 'row',
170
- fields: [
171
- {
172
- name: 'replyTo',
173
- type: 'text',
174
- admin: {
175
- placeholder: '"Reply To" <reply-to@email.com>',
176
- width: '50%'
177
- },
178
- label: 'Reply To'
179
- },
180
- {
181
- name: 'emailFrom',
182
- type: 'text',
183
- admin: {
184
- placeholder: '"Email From" <email-from@email.com>',
185
- width: '50%'
186
- },
187
- label: 'Email From'
188
- }
189
- ]
190
- },
191
- {
192
- name: 'subject',
193
- type: 'text',
194
- defaultValue: "You've received a new message.",
195
- label: 'Subject',
196
- localized: true,
197
- required: true
198
- },
199
- {
200
- name: 'message',
201
- type: 'richText',
202
- admin: {
203
- description: 'Enter the message that should be sent in this email.'
204
- },
205
- label: 'Message',
206
- localized: true
207
- }
208
- ]
209
- },
210
- ...formConfig?.formOverrides?.fields || []
211
- ]
218
+ fields: formConfig?.formOverrides?.fields && typeof formConfig?.formOverrides?.fields === 'function' ? formConfig.formOverrides.fields({
219
+ defaultFields
220
+ }) : defaultFields
212
221
  };
213
222
  return config;
214
223
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/Forms/index.ts"],"sourcesContent":["import type { Block, CollectionConfig, Field } from 'payload/types'\n\nimport merge from 'deepmerge'\n\nimport type { FieldConfig, PluginConfig } from '../../types.js'\n\nimport { fields } from './fields.js'\n\n// all settings can be overridden by the config\nexport const generateFormCollection = (formConfig: PluginConfig): 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') redirect.fields[2].label = 'Custom URL'\n\n redirect.fields[2].admin = {\n condition: (_, siblingData) => siblingData?.type === 'custom',\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 {\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 merge<FieldConfig>(block, fieldConfig, {\n arrayMerge: (_, sourceArray) => sourceArray,\n })\n }\n\n if (typeof block === 'function') {\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 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}}.\",\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 width: '50%',\n },\n label: 'CC',\n },\n {\n name: 'bcc',\n type: 'text',\n admin: {\n width: '50%',\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 ...(formConfig?.formOverrides?.fields || []),\n ],\n }\n\n return config\n}\n"],"names":["merge","fields","generateFormCollection","formConfig","redirect","name","type","admin","condition","_","siblingData","confirmationType","hideGutter","label","required","redirectRelationships","unshift","maxDepth","relationTo","layout","defaultValue","options","value","config","formOverrides","slug","access","read","enableRichTextRelationship","useAsTitle","blocks","Object","entries","map","fieldKey","fieldConfig","block","undefined","arrayMerge","sourceArray","filter","Boolean","localized","description","placeholder","width"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,WAAW,YAAW;AAI7B,SAASC,MAAM,QAAQ,cAAa;AAEpC,+CAA+C;AAC/C,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAMC,WAAkB;QACtBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,qBAAqB;YACjEC,YAAY;QACd;QACAX,QAAQ;YACN;gBACEI,MAAM;gBACNC,MAAM;gBACNO,OA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NC,OAAO;oCACLqC,aAAa;oCACbC,OAAO;gCACT;gCACAhC,OAAO;4BACT;4BACA;gCACER,MAAM;gCACNC,MAAM;gCACNC,OAAO;oCACLqC,aAAa;oCACbC,OAAO;gCACT;gCACAhC,OAAO;4BACT;yBACD;oBACH;oBACA;wBACER,MAAM;wBACNC,MAAM;wBACNc,cAAc;wBACdP,OAAO;wBACP6B,WAAW;wBACX5B,UAAU;oBACZ;oBACA;wBACET,MAAM;wBACNC,MAAM;wBACNC,OAAO;4BACLoC,aAAa;wBACf;wBACA9B,OAAO;wBACP6B,WAAW;oBACb;iBACD;YACH;eACIvC,YAAYqB,eAAevB,UAAU,EAAE;SAC5C;IACH;IAEA,OAAOsB;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/Forms/index.ts"],"sourcesContent":["import type { Block, CollectionConfig, Field } from 'payload'\n\nimport { deepMergeWithSourceArrays } from 'payload'\n\nimport type { FormBuilderPluginConfig } from '../../types.js'\n\nimport { fields } from './fields.js'\n\n// all settings can be overridden by the config\nexport const generateFormCollection = (formConfig: FormBuilderPluginConfig): 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 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","generateFormCollection","formConfig","redirect","name","type","admin","condition","_","siblingData","confirmationType","hideGutter","label","required","redirectRelationships","unshift","maxDepth","relationTo","layout","defaultValue","options","value","defaultFields","blocks","Object","entries","map","fieldKey","fieldConfig","block","undefined","filter","Boolean","localized","description","access","read","req","user","placeholder","width","style","maxWidth","config","formOverrides","slug","enableRichTextRelationship","useAsTitle"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,UAAS;AAInD,SAASC,MAAM,QAAQ,cAAa;AAEpC,+CAA+C;AAC/C,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAMC,WAAkB;QACtBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,qBAAq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O;4BACT;4BACA5B,OAAO;wBACT;qBACD;gBACH;gBACA;oBACER,MAAM;oBACNC,MAAM;oBACNc,cAAc;oBACdP,OAAO;oBACPqB,WAAW;oBACXpB,UAAU;gBACZ;gBACA;oBACET,MAAM;oBACNC,MAAM;oBACNC,OAAO;wBACL4B,aAAa;oBACf;oBACAtB,OAAO;oBACPqB,WAAW;gBACb;aACD;QACH;KACD;IAED,MAAMU,SAA2B;QAC/B,GAAIzC,YAAY0C,iBAAiB,CAAC,CAAC;QACnCC,MAAM3C,YAAY0C,eAAeC,QAAQ;QACzCV,QAAQ;YACNC,MAAM,IAAM;YACZ,GAAIlC,YAAY0C,eAAeT,UAAU,CAAC,CAAC;QAC7C;QACA7B,OAAO;YACLwC,4BAA4B;YAC5BC,YAAY;YACZ,GAAI7C,YAAY0C,eAAetC,SAAS,CAAC,CAAC;QAC5C;QACAN,QACEE,YAAY0C,eAAe5C,UAAU,OAAOE,YAAY0C,eAAe5C,WAAW,aAC9EE,WAAW0C,aAAa,CAAC5C,MAAM,CAAC;YAAEsB;QAAc,KAChDA;IACR;IAEA,OAAOqB;AACT,EAAC"}
@@ -0,0 +1,3 @@
1
+ export { DynamicFieldSelector } from '../collections/Forms/DynamicFieldSelector.js';
2
+ export { DynamicPriceSelector } from '../collections/Forms/DynamicPriceSelector.js';
3
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { DynamicFieldSelector } from '../collections/Forms/DynamicFieldSelector.js';
2
+ export { DynamicPriceSelector } from '../collections/Forms/DynamicPriceSelector.js';
3
+
4
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { DynamicFieldSelector } from '../collections/Forms/DynamicFieldSelector.js'\nexport { DynamicPriceSelector } from '../collections/Forms/DynamicPriceSelector.js'\n"],"names":["DynamicFieldSelector","DynamicPriceSelector"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,+CAA8C;AACnF,SAASC,oBAAoB,QAAQ,+CAA8C"}
@@ -0,0 +1,2 @@
1
+ export type { BeforeEmail, BlockConfig, CheckboxField, CountryField, Email, EmailField, FieldConfig, FieldsConfig, FieldValues, Form, FormattedEmail, FormBuilderPluginConfig as PluginConfig, FormFieldBlock, FormSubmission, HandlePayment, isValidBlockConfig, MessageField, PaymentField, PaymentFieldConfig, PriceCondition, Redirect, SelectField, SelectFieldOption, StateField, SubmissionValue, TextAreaField, TextField, } from '../types.js';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,cAAc,EACd,uBAAuB,IAAI,YAAY,EACvC,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,aAAa,EACb,SAAS,GACV,MAAM,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type {\n BeforeEmail,\n BlockConfig,\n CheckboxField,\n CountryField,\n Email,\n EmailField,\n FieldConfig,\n FieldsConfig,\n FieldValues,\n Form,\n FormattedEmail,\n FormBuilderPluginConfig as PluginConfig,\n FormFieldBlock,\n FormSubmission,\n HandlePayment,\n isValidBlockConfig,\n MessageField,\n PaymentField,\n PaymentFieldConfig,\n PriceCondition,\n Redirect,\n SelectField,\n SelectFieldOption,\n StateField,\n SubmissionValue,\n TextAreaField,\n TextField,\n} from '../types.js'\n"],"names":[],"mappings":"AAAA,WA4BoB"}
@@ -0,0 +1,6 @@
1
+ import type { Config } from 'payload';
2
+ import type { FormBuilderPluginConfig } from './types.js';
3
+ export { fields } from './collections/Forms/fields.js';
4
+ export { getPaymentTotal } from './utilities/getPaymentTotal.js';
5
+ export declare const formBuilderPlugin: (incomingFormConfig: FormBuilderPluginConfig) => (config: Config) => Config;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,uBACP,uBAAuB,cACnC,MAAM,KAAG,MA0BjB,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { generateSubmissionCollection } from './collections/FormSubmissions/index.js';
2
1
  import { generateFormCollection } from './collections/Forms/index.js';
2
+ import { generateSubmissionCollection } from './collections/FormSubmissions/index.js';
3
3
  export { fields } from './collections/Forms/fields.js';
4
4
  export { getPaymentTotal } from './utilities/getPaymentTotal.js';
5
- const FormBuilder = (incomingFormConfig)=>(config)=>{
5
+ export const formBuilderPlugin = (incomingFormConfig)=>(config)=>{
6
6
  const formConfig = {
7
7
  ...incomingFormConfig,
8
8
  fields: {
@@ -21,20 +21,6 @@ const FormBuilder = (incomingFormConfig)=>(config)=>{
21
21
  };
22
22
  return {
23
23
  ...config,
24
- // admin: {
25
- // ...config.admin,
26
- // webpack: (webpackConfig) => ({
27
- // ...webpackConfig,
28
- // resolve: {
29
- // ...webpackConfig.resolve,
30
- // alias: {
31
- // ...webpackConfig.resolve.alias,
32
- // [path.resolve(__dirname, 'collections/FormSubmissions/hooks/sendEmail.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
33
- // [path.resolve(__dirname, 'collections/FormSubmissions/hooks/createCharge.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
34
- // },
35
- // },
36
- // })
37
- // },
38
24
  collections: [
39
25
  ...config?.collections || [],
40
26
  generateFormCollection(formConfig),
@@ -42,6 +28,5 @@ const FormBuilder = (incomingFormConfig)=>(config)=>{
42
28
  ]
43
29
  };
44
30
  };
45
- export default FormBuilder;
46
31
 
47
32
  //# 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/config'\n\nimport type { PluginConfig } from './types.js'\n\nimport { generateSubmissionCollection } from './collections/FormSubmissions/index.js'\nimport { generateFormCollection } from './collections/Forms/index.js'\n\nexport { fields } from './collections/Forms/fields.js'\nexport { getPaymentTotal } from './utilities/getPaymentTotal.js'\n\nconst FormBuilder =\n (incomingFormConfig: PluginConfig) =>\n (config: Config): Config => {\n const formConfig: PluginConfig = {\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 ...incomingFormConfig.fields,\n },\n }\n\n return {\n ...config,\n // admin: {\n // ...config.admin,\n // webpack: (webpackConfig) => ({\n // ...webpackConfig,\n // resolve: {\n // ...webpackConfig.resolve,\n // alias: {\n // ...webpackConfig.resolve.alias,\n // [path.resolve(__dirname, 'collections/FormSubmissions/hooks/sendEmail.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),\n // [path.resolve(__dirname, 'collections/FormSubmissions/hooks/createCharge.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),\n // },\n // },\n // })\n // },\n collections: [\n ...(config?.collections || []),\n generateFormCollection(formConfig),\n generateSubmissionCollection(formConfig),\n ],\n }\n }\n\nexport default FormBuilder\n"],"names":["generateSubmissionCollection","generateFormCollection","fields","getPaymentTotal","FormBuilder","incomingFormConfig","config","formConfig","checkbox","country","email","message","number","payment","select","state","text","textarea","collections"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,4BAA4B,QAAQ,yCAAwC;AACrF,SAASC,sBAAsB,QAAQ,+BAA8B;AAErE,SAASC,MAAM,QAAQ,gCAA+B;AACtD,SAASC,eAAe,QAAQ,iCAAgC;AAEhE,MAAMC,cACJ,CAACC,qBACD,CAACC;QACC,MAAMC,aAA2B;YAC/B,GAAGF,kBAAkB;YACrBH,QAAQ;gBACNM,UAAU;gBACVC,SAAS;gBACTC,OAAO;gBACPC,SAAS;gBACTC,QAAQ;gBACRC,SAAS;gBACTC,QAAQ;gBACRC,OAAO;gBACPC,MAAM;gBACNC,UAAU;gBACV,GAAGZ,mBAAmBH,MAAM;YAC9B;QACF;QAEA,OAAO;YACL,GAAGI,MAAM;YACT,WAAW;YACX,qBAAqB;YACrB,mCAAmC;YACnC,wBAAwB;YACxB,iBAAiB;YACjB,kCAAkC;YAClC,iBAAiB;YACjB,0CAA0C;YAC1C,yIAAyI;YACzI,4IAA4I;YAC5I,WAAW;YACX,SAAS;YACT,OAAO;YACP,KAAK;YACLY,aAAa;mBACPZ,QAAQY,eAAe,EAAE;gBAC7BjB,uBAAuBM;gBACvBP,6BAA6BO;aAC9B;QACH;IACF;AAEF,eAAeH,YAAW"}
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 ...incomingFormConfig.fields,\n },\n }\n\n return {\n ...config,\n collections: [\n ...(config?.collections || []),\n generateFormCollection(formConfig),\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","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;gBACV,GAAGZ,mBAAmBH,MAAM;YAC9B;QACF;QAEA,OAAO;YACL,GAAGI,MAAM;YACTY,aAAa;mBACPZ,QAAQY,eAAe,EAAE;gBAC7BlB,uBAAuBO;gBACvBN,6BAA6BM;aAC9B;QACH;IACF,EAAC"}