@payloadcms/plugin-form-builder 1.0.7 → 1.0.9

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.
package/README.md CHANGED
@@ -5,14 +5,15 @@
5
5
  A plugin for [Payload CMS](https://github.com/payloadcms/payload) to easily allow your admin editors to build and manage forms from the admin panel.
6
6
 
7
7
  Core features:
8
- - Creates a `forms` collection where you can:
9
- - Build dynamic forms with any number of fields
10
- - Add payment fields that can handle dynamic prices
11
- - Build completely custom and dynamic emails
12
- - Creates a `formSubmissions` collection that:
13
- - Validates and saves the form data submitted by your frontend
14
- - Sends emails (if applicable)
15
- - Handles payment processing (if applicable)
8
+
9
+ - Creates a `forms` collection where you can:
10
+ - Build dynamic forms with any number of fields
11
+ - Add payment fields that can handle dynamic prices
12
+ - Build completely custom and dynamic emails
13
+ - Creates a `formSubmissions` collection that:
14
+ - Validates and saves the form data submitted by your frontend
15
+ - Sends emails (if applicable)
16
+ - Handles payment processing (if applicable)
16
17
 
17
18
  ## Installation
18
19
 
@@ -24,22 +25,20 @@ Core features:
24
25
 
25
26
  ## Basic Usage
26
27
 
27
- In the `plugins` array of your [Payload config](https://payloadcms.com/docs/configuration/overview), call the plugin with [options](#options):
28
+ In the `plugins` array of your [Payload config](https://payloadcms.com/docs/configuration/overview), call the plugin with [options](#options):
28
29
 
29
30
  ```js
30
- import { buildConfig } from 'payload/config';
31
- import formBuilder from '@payloadcms/plugin-form-builder';
31
+ import { buildConfig } from "payload/config";
32
+ import formBuilder from "@payloadcms/plugin-form-builder";
32
33
 
33
34
  const config = buildConfig({
34
35
  collections: [
35
36
  {
36
- slug: 'pages',
37
- fields: []
38
- }
37
+ slug: "pages",
38
+ fields: [],
39
+ },
39
40
  ],
40
- plugins: [
41
- formBuilder()
42
- ]
41
+ plugins: [formBuilder()],
43
42
  });
44
43
 
45
44
  export default config;
@@ -48,180 +47,243 @@ export default config;
48
47
  ### Options
49
48
 
50
49
  - `fields`
51
- An object of field types to allow your admin editors to build forms with. Pass either a boolean value or a partial [Payload Block](https://payloadcms.com/docs/fields/blocks#block-configs) to override default settings. See [Fields](#fields) for more details.
52
-
53
- ```
54
- fields: {
55
- text: true,
56
- textarea: true,
57
- select: true,
58
- email: true,
59
- state: true,
60
- country: true,
61
- checkbox: true,
62
- number: true,
63
- message: true,
64
- payment: false
65
- }
66
- ```
67
-
68
- You can also provide your own custom field definitions by passing a new [Payload Block](https://payloadcms.com/docs/fields/blocks#block-configs) object into `fields`.
50
+ An object of field types to allow your admin editors to build forms with. Pass either a boolean value or a partial [Payload Block](https://payloadcms.com/docs/fields/blocks#block-configs) to override default settings. See [Fields](#fields) for more details.
69
51
 
52
+ ```js
53
+ fields: {
54
+ text: true,
55
+ textarea: true,
56
+ select: true,
57
+ email: true,
58
+ state: true,
59
+ country: true,
60
+ checkbox: true,
61
+ number: true,
62
+ message: true,
63
+ payment: false
64
+ }
65
+ ```
66
+
67
+ You can also provide your own custom field definitions by passing a new [Payload Block](https://payloadcms.com/docs/fields/blocks#block-configs) object into `fields`.
70
68
 
71
69
  - `redirectRelationships`
72
70
 
73
- An array of collection slugs that, when enabled, are populated as options in form redirect fields.
71
+ An array of collection slugs that, when enabled, are populated as options in form redirect fields.
74
72
 
75
- ```
76
- redirectRelationships: ['pages']
77
- ```
73
+ ```js
74
+ redirectRelationships: ["pages"];
75
+ ```
78
76
 
79
77
  - `handlePayment`
80
78
 
81
- A [beforeChange]([beforeChange](https://payloadcms.com/docs/hooks/globals#beforechange)) hook that is called upon form submissions. You can integrate into any third-party payment processing API here. There is a `getPaymentTotal` function that will calculate the total cost after all conditions have been applied.
82
-
83
- ```
84
- import { getPaymentTotal } from '@payloadcms/plugin-form-builder';
85
- ...
86
- handlePayment: async ({ form, submissionData }) => {
87
- // first calculate the price
88
- const paymentField = form.fields?.find((field) => field.blockType === 'payment');
89
- const price = getPaymentTotal({
90
- basePrice: paymentField.basePrice,
91
- priceConditions: paymentField.priceConditions,
92
- fieldValues: submissionData,
93
- });
94
- // then asynchronously process the payment here
95
- }
96
- ```
79
+ A [beforeChange](<[beforeChange](https://payloadcms.com/docs/hooks/globals#beforechange)>) hook that is called upon form submissions. You can integrate into any third-party payment processing API here. There is a `getPaymentTotal` function that will calculate the total cost after all conditions have been applied.
80
+
81
+ ```js
82
+ import { getPaymentTotal } from '@payloadcms/plugin-form-builder';
83
+ ...
84
+ handlePayment: async ({ form, submissionData }) => {
85
+ // first calculate the price
86
+ const paymentField = form.fields?.find((field) => field.blockType === 'payment');
87
+ const price = getPaymentTotal({
88
+ basePrice: paymentField.basePrice,
89
+ priceConditions: paymentField.priceConditions,
90
+ fieldValues: submissionData,
91
+ });
92
+ // then asynchronously process the payment here
93
+ }
94
+ ```
97
95
 
98
96
  - `beforeEmail`
99
97
 
100
- A [beforeChange]([beforeChange](https://payloadcms.com/docs/hooks/globals#beforechange)) hook that is called just after emails are prepared, but before they are sent. This is a great place to inject your own HTML template to add custom styles.
98
+ A [beforeChange](<[beforeChange](https://payloadcms.com/docs/hooks/globals#beforechange)>) hook that is called just after emails are prepared, but before they are sent. This is a great place to inject your own HTML template to add custom styles.
101
99
 
102
- ```
103
- beforeEmails: (emailsToSend) => {
104
- // modify the emails in any way before they are sent
105
- return emails.map((email) => ({
106
- ...email,
107
- html: email.html // transform the html in any way you'd like (maybe wrap it in an html template?)
108
- }))
109
- };
110
- ```
100
+ ```js
101
+ beforeEmail: (emailsToSend) => {
102
+ // modify the emails in any way before they are sent
103
+ return emails.map((email) => ({
104
+ ...email,
105
+ html: email.html, // transform the html in any way you'd like (maybe wrap it in an html template?)
106
+ }));
107
+ };
108
+ ```
111
109
 
112
110
  - `formOverrides`
113
111
 
114
- Override anything on the form collection by sending a [Payload Collection Config](https://payloadcms.com/docs/configuration/collections). Your overrides will be merged into the default `forms` collection.
112
+ Override anything on the form collection by sending a [Payload Collection Config](https://payloadcms.com/docs/configuration/collections). Your overrides will be merged into the default `forms` collection.
115
113
 
116
- ```
117
- formOverrides: {
118
- slug: 'contact-forms'
119
- }
120
- ```
114
+ ```js
115
+ formOverrides: {
116
+ slug: "contact-forms";
117
+ }
118
+ ```
121
119
 
122
120
  - `formSubmissionOverrides`
123
- By default, this plugin relies on [Payload access control](https://payloadcms.com/docs/access-control/collections) to restrict the `update` and `read` operations. This is because anyone should be able to create a form submission, even from a public-facing website - but no one should be able to update a submission one it has been created, or read a submission unless they have permission.
121
+ By default, this plugin relies on [Payload access control](https://payloadcms.com/docs/access-control/collections) to restrict the `update` and `read` operations. This is because anyone should be able to create a form submission, even from a public-facing website - but no one should be able to update a submission one it has been created, or read a submission unless they have permission.
124
122
 
125
- You can override access control and anything else on the form submission collection by sending a [Payload Collection Config](https://payloadcms.com/docs/configuration/collections). Your overrides will be merged into the default `formSubmissions` collection.
123
+ You can override access control and anything else on the form submission collection by sending a [Payload Collection Config](https://payloadcms.com/docs/configuration/collections). Your overrides will be merged into the default `formSubmissions` collection.
126
124
 
127
- ```
128
- formSubmissionOverrides: {
129
- slug: 'leads'
130
- }
131
- ```
125
+ ```js
126
+ formSubmissionOverrides: {
127
+ slug: "leads";
128
+ }
129
+ ```
132
130
 
133
131
  ## Fields
134
132
 
135
133
  Each form field is defined as a [Payload Block](https://payloadcms.com/docs/fields/blocks) with the following subfields:
136
134
 
137
- - Text
138
- - `name`: string
139
- - `label`: string
140
- - `defaultValue`: string
141
- - `width`: string
142
- - `required`: checkbox
143
- - Textarea
144
- - `name`: string
145
- - `label`: string
146
- - `defaultValue`: string
147
- - `width`: string
148
- - `required`: checkbox
149
- - Select
150
- - `name`: string
151
- - `label`: string
152
- - `defaultValue`: string
153
- - `width`: string
154
- - `options`: array
155
- - `required`: checkbox
156
- - Email
157
- - `name`: string
158
- - `label`: string
159
- - `defaultValue`: string
160
- - `width`: string
161
- - `required`: checkbox
162
- - State
163
- - `name`: string
164
- - `label`: string
165
- - `defaultValue`: string
166
- - `width`: string
167
- - `required`: checkbox
168
- - Country
169
- - `name`: string
170
- - `label`: string
171
- - `defaultValue`: string
172
- - `width`: string
173
- - `required`: checkbox
174
- - Checkbox
175
- - `name`: string
176
- - `label`: string
177
- - `defaultValue`: checkbox
178
- - `width`: string
179
- - `required`: checkbox
180
- - Number
181
- - `name`: string
182
- - `label`: string
183
- - `defaultValue`: number
184
- - `width`: string
185
- - `required`: checkbox
186
- - Message
187
- - `message`: richText
188
- - Payment
189
- - `name`: string
190
- - `label`: string
191
- - `defaultValue`: number
192
- - `width`: string
193
- - `required`: checkbox
194
- - `priceConditions`: array
195
- - `fieldToUse`: relationship, dynamically populated based on the fields in your form
196
- - `condition`: string - `equals`, `notEquals` | `hasValue`
197
- - `valueForOperator`: string - only if `condition` is `equals` or `notEquals`
198
- - `operator`: string - `add`, `subtract`, `multiply`, `divide`
199
- - `valueType`: string - `static`, `valueOfField`
200
- - `value`: string - only if `valueType` is `static`
201
-
202
- ## Email
203
-
204
- This plugin relies on the [email configuration](https://payloadcms.com/docs/email/overview) defined in your `payload.init()`. It will read from your config and attempt to send your emails using the credentials provided.
205
-
206
- ## TypeScript
207
-
208
- All types can be directly imported:
209
- ```js
210
- import {
211
- FormConfig,
212
- Form,
213
- FormSubmission,
214
- FieldsConfig,
215
- BeforePayment,
216
- HandlePayment
217
- } from '@payloadcms/plugin-form-builder/dist/types';
218
- ```
135
+ - Text
136
+ - `name`: string
137
+ - `label`: string
138
+ - `defaultValue`: string
139
+ - `width`: string
140
+ - `required`: checkbox
141
+ - Textarea
142
+ - `name`: string
143
+ - `label`: string
144
+ - `defaultValue`: string
145
+ - `width`: string
146
+ - `required`: checkbox
147
+ - Select
148
+ - `name`: string
149
+ - `label`: string
150
+ - `defaultValue`: string
151
+ - `width`: string
152
+ - `options`: array
153
+ - `required`: checkbox
154
+ - Email
155
+ - `name`: string
156
+ - `label`: string
157
+ - `defaultValue`: string
158
+ - `width`: string
159
+ - `required`: checkbox
160
+ - State
161
+ - `name`: string
162
+ - `label`: string
163
+ - `defaultValue`: string
164
+ - `width`: string
165
+ - `required`: checkbox
166
+ - Country
167
+ - `name`: string
168
+ - `label`: string
169
+ - `defaultValue`: string
170
+ - `width`: string
171
+ - `required`: checkbox
172
+ - Checkbox
173
+ - `name`: string
174
+ - `label`: string
175
+ - `defaultValue`: checkbox
176
+ - `width`: string
177
+ - `required`: checkbox
178
+ - Number
179
+ - `name`: string
180
+ - `label`: string
181
+ - `defaultValue`: number
182
+ - `width`: string
183
+ - `required`: checkbox
184
+ - Message
185
+ - `message`: richText
186
+ - Payment
187
+ - `name`: string
188
+ - `label`: string
189
+ - `defaultValue`: number
190
+ - `width`: string
191
+ - `required`: checkbox
192
+ - `priceConditions`: array
193
+ - `fieldToUse`: relationship, dynamically populated based on the fields in your form
194
+ - `condition`: string - `equals`, `notEquals` | `hasValue`
195
+ - `valueForOperator`: string - only if `condition` is `equals` or `notEquals`
196
+ - `operator`: string - `add`, `subtract`, `multiply`, `divide`
197
+ - `valueType`: string - `static`, `valueOfField`
198
+ - `value`: string - only if `valueType` is `static`
199
+
200
+ ## Email
201
+
202
+ This plugin relies on the [email configuration](https://payloadcms.com/docs/email/overview) defined in your `payload.init()`. It will read from your config and attempt to send your emails using the credentials provided.
203
+
204
+ ## TypeScript
205
+
206
+ All types can be directly imported:
207
+
208
+ ```js
209
+ import {
210
+ PluginConfig,
211
+ Form,
212
+ FormSubmission,
213
+ FieldsConfig,
214
+ BeforePayment,
215
+ HandlePayment,
216
+ } from "@payloadcms/plugin-form-builder/dist/types";
217
+ ```
218
+
219
+ ## Development
220
+
221
+ To actively develop or debug this plugin you can either work directly within the demo directory of this repo, or link your own project.
222
+
223
+ 1. #### Internal Demo
224
+
225
+ This repo includes a fully working, self-seeding instance of Payload that installs the plugin directly from the source code. This is the easiest way to get started. To spin up this demo, follow these steps:
226
+
227
+ 1. First clone the repo
228
+ 1. Then, `cd YOUR_PLUGIN_REPO && yarn && cd demo && cp env.example .env && yarn && yarn dev`
229
+ 1. Now open `http://localhost:3000/admin` in your browser
230
+ 1. Enter username `dev@payloadcms.com` and password `test`
231
+
232
+ That's it! Changes made in `./src` will be reflected in your demo. Keep in mind that the demo database is automatically seeded on every startup, any changes you make to the data get destroyed each time you reboot the app.
233
+
234
+ 1. #### Linked Project
235
+
236
+ You can alternatively link your own project to the source code:
237
+
238
+ 1. First clone the repo
239
+ 1. Then, `cd YOUR_PLUGIN_REPO && yarn && yarn build && yarn link`
240
+ 1. Now `cd` back into your own project and run, `yarn link @payloadcms/plugin-form-builder`
241
+ 1. If this plugin using React in any way, continue to the next step. Otherwise skip to step 7.
242
+ 1. From your own project, `cd node_modules/react && yarn link && cd ../react-dom && yarn link && cd ../../`
243
+ 1. Then, `cd YOUR_PLUGIN_REPO && yarn link react react-dom`
244
+
245
+ All set! You can now boot up your own project as normal, and your local copy of the plugin source code will be used. Keep in mind that changes to the source code require a rebuild, `yarn build`.
246
+
247
+ You might also need to alias these modules in your Webpack config. To do this, open your project's Payload config and add the following:
248
+
249
+ ```js
250
+ import { buildConfig } from "payload/config";
251
+
252
+ export default buildConfig({
253
+ admin: {
254
+ webpack: (config) => ({
255
+ ...config,
256
+ resolve: {
257
+ ...config.resolve,
258
+ alias: {
259
+ ...config.resolve.alias,
260
+ react: path.join(__dirname, "../node_modules/react"),
261
+ "react-dom": path.join(__dirname, "../node_modules/react-dom"),
262
+ payload: path.join(__dirname, "../node_modules/payload"),
263
+ "@payloadcms/plugin-form-builder": path.join(
264
+ __dirname,
265
+ "../../payload/plugin-form-builder/src"
266
+ ),
267
+ },
268
+ },
269
+ }),
270
+ },
271
+ });
272
+ ```
273
+
274
+ ## Troubleshooting
275
+
276
+ Below are some common troubleshooting tips. To help other developers, please contribute to this section as you troubleshoot your own application.
277
+
278
+ ### SendGrid 403 Forbidden Error
279
+
280
+ - If you are using [SendGrid Link Branding](https://docs.sendgrid.com/ui/account-and-settings/how-to-set-up-link-branding) to remove the "via sendgrid.net" part of your email, you must also setup [Domain Authentication](https://docs.sendgrid.com/ui/account-and-settings/how-to-set-up-domain-authentication). This means you can only send emails from an address on this domain — so the `from` addresses in your form submission emails **_cannot_** be anything other than `something@your_domain.com`. This means that from `{{email}}` will not work, but `website@your_domain.com` will. You can still send the form's email address in the body of the email.
219
281
 
220
- ## Screenshots
282
+ ## Screenshots
221
283
 
222
- ![screenshot 1](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-1.jpg?raw=true)
223
- ![screenshot 2](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-2.jpg?raw=true)
224
- ![screenshot 3](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-3.jpg?raw=true)
225
- ![screenshot 4](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-4.jpg?raw=true)
226
- ![screenshot 5](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-5.jpg?raw=true)
227
- ![screenshot 6](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-6.jpg?raw=true)
284
+ ![screenshot 1](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-1.jpg?raw=true)
285
+ ![screenshot 2](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-2.jpg?raw=true)
286
+ ![screenshot 3](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-3.jpg?raw=true)
287
+ ![screenshot 4](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-4.jpg?raw=true)
288
+ ![screenshot 5](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-5.jpg?raw=true)
289
+ ![screenshot 6](https://github.com/payloadcms/plugin-form-builder/blob/main/images/screenshot-6.jpg?raw=true)
@@ -1,3 +1,3 @@
1
- import { FormConfig } from "../../../types";
2
- declare const createCharge: (beforeChangeData: any, formConfig: FormConfig) => Promise<any>;
1
+ import { PluginConfig } from "../../../types";
2
+ declare const createCharge: (beforeChangeData: any, formConfig: PluginConfig) => Promise<any>;
3
3
  export default createCharge;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -1 +1 @@
1
- {"version":3,"file":"createCharge.js","sourceRoot":"","sources":["../../../../src/collections/FormSubmissions/hooks/createCharge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,YAAY,GAAG,UAAO,gBAAqB,EAAE,UAAsB;;;;;gBAErE,SAAS,GAEP,gBAAgB,UAFT,EACT,IAAI,GACF,gBAAgB,KADd,CACe;gBAEjB,sBAAsB,GAAG,IAAI,CAAC;qBAE9B,CAAA,SAAS,KAAK,QAAQ,CAAA,EAAtB,wBAAsB;gBAEtB,aAAa,GACX,CAAA,UAAU,IAAI,EAAE,CAAA,cADL,CACM;qBAEjB,CAAA,OAAO,aAAa,KAAK,UAAU,CAAA,EAAnC,wBAAmC;gBACZ,qBAAM,aAAa,CAAC,gBAAgB,CAAC,EAAA;;gBAA9D,sBAAsB,GAAG,SAAqC,CAAC;;oBAInE,sBAAO,sBAAsB,EAAC;;;KAC/B,CAAC;AAEF,kBAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"createCharge.js","sourceRoot":"","sources":["../../../../src/collections/FormSubmissions/hooks/createCharge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,YAAY,GAAG,UAAO,gBAAqB,EAAE,UAAwB;;;;;gBAEvE,SAAS,GAEP,gBAAgB,UAFT,EACT,IAAI,GACF,gBAAgB,KADd,CACe;gBAEjB,sBAAsB,GAAG,IAAI,CAAC;qBAE9B,CAAA,SAAS,KAAK,QAAQ,CAAA,EAAtB,wBAAsB;gBAEtB,aAAa,GACX,CAAA,UAAU,IAAI,EAAE,CAAA,cADL,CACM;qBAEjB,CAAA,OAAO,aAAa,KAAK,UAAU,CAAA,EAAnC,wBAAmC;gBACZ,qBAAM,aAAa,CAAC,gBAAgB,CAAC,EAAA;;gBAA9D,sBAAsB,GAAG,SAAqC,CAAC;;oBAInE,sBAAO,sBAAsB,EAAC;;;KAC/B,CAAC;AAEF,kBAAe,YAAY,CAAA"}
@@ -1,3 +1,3 @@
1
- import { FormConfig } from '../../../types';
2
- declare const sendEmail: (beforeChangeData: any, formConfig: FormConfig) => Promise<any>;
1
+ import { PluginConfig } from '../../../types';
2
+ declare const sendEmail: (beforeChangeData: any, formConfig: PluginConfig) => Promise<any>;
3
3
  export default sendEmail;
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -93,7 +93,7 @@ var sendEmail = function (beforeChangeData, formConfig) { return __awaiter(void
93
93
  from: from,
94
94
  replyTo: replyTo,
95
95
  subject: (0, replaceDoubleCurlys_1.replaceDoubleCurlys)(subject, submissionData_1),
96
- html: "<div>".concat((0, serializeRichText_1.serialize)(message, submissionData_1))
96
+ html: "<div>".concat((0, serializeRichText_1.serialize)(message, submissionData_1), "</div>")
97
97
  });
98
98
  }
99
99
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"sendEmail.js","sourceRoot":"","sources":["../../../../src/collections/FormSubmissions/hooks/sendEmail.ts"],"names":[],"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I,UAAA,EAAK,IAAI,cAAf,QAAiB,CAAF;oBAAO,OAAA,cAAM,IAAI,EAAG,CAAA;iBAAA,CAAC,CAAA;gBAElE,qBAAM,OAAO,CAAC,GAAG,CACf,YAAY,CAAC,GAAG,CAAC,UAAO,KAAK;;;;;oCACnB,EAAE,GAAK,KAAK,GAAV,CAAW;;;;oCAEE,qBAAM,SAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAA;;oCAA7C,YAAY,GAAG,SAA8B;oCACnD,sBAAO,YAAY,EAAC;;;oCAEpB,OAAO,CAAC,KAAK,CAAC,gDAAyC,EAAE,sBAAmB,CAAC,CAAC;oCAC9E,OAAO,CAAC,KAAK,CAAC,KAAG,CAAC,CAAC;;;;;yBAEtB,CAAC,CACH,EAAA;;gBAXD,SAWC,CAAC;;;;gBAGJ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;;;;;gBAGnC,OAAO,CAAC,KAAK,CAAC,wEAAiE,gBAAgB,MAAG,CAAC,CAAC;gBACpG,OAAO,CAAC,KAAK,CAAC,KAAG,CAAC,CAAC;;qBAIvB,sBAAO,IAAI,EAAC;;;KACb,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { CollectionConfig } from 'payload/types';
2
- import { FormConfig } from '../../types';
3
- export declare const generateSubmissionCollection: (formConfig: FormConfig) => CollectionConfig;
2
+ import { PluginConfig } from '../../types';
3
+ export declare const generateSubmissionCollection: (formConfig: PluginConfig) => CollectionConfig;
@@ -28,20 +28,18 @@ var sendEmail_1 = __importDefault(require("./hooks/sendEmail"));
28
28
  var createCharge_1 = __importDefault(require("./hooks/createCharge"));
29
29
  // all settings can be overridden by the config
30
30
  var generateSubmissionCollection = function (formConfig) {
31
- var _a, _b, _c, _d, _e, _f, _g;
31
+ var _a, _b, _c, _d, _e, _f, _g, _h;
32
32
  var newConfig = {
33
33
  slug: ((_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _a === void 0 ? void 0 : _a.slug) || 'formSubmissions',
34
34
  access: __assign({ create: function () { return true; }, update: function () { return false; }, read: function (_a) {
35
35
  var user = _a.req.user;
36
36
  return !!user;
37
37
  } }, ((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _b === void 0 ? void 0 : _b.access) || {}),
38
- admin: {
39
- enableRichTextRelationship: false
40
- },
38
+ admin: __assign(__assign({}, ((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _c === void 0 ? void 0 : _c.admin) || {}), { enableRichTextRelationship: false }),
41
39
  hooks: __assign({ beforeChange: __spreadArray([
42
40
  function (data) { return (0, createCharge_1.default)(data, formConfig); },
43
41
  function (data) { return (0, sendEmail_1.default)(data, formConfig); }
44
- ], ((_d = (_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _c === void 0 ? void 0 : _c.hooks) === null || _d === void 0 ? void 0 : _d.beforeChange) || [], true) }, ((_e = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _e === void 0 ? void 0 : _e.hooks) || {}),
42
+ ], ((_e = (_d = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _d === void 0 ? void 0 : _d.hooks) === null || _e === void 0 ? void 0 : _e.beforeChange) || [], true) }, ((_f = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _f === void 0 ? void 0 : _f.hooks) || {}),
45
43
  fields: __spreadArray([
46
44
  {
47
45
  name: 'form',
@@ -84,9 +82,9 @@ var generateSubmissionCollection = function (formConfig) {
84
82
  },
85
83
  ],
86
84
  }
87
- ], ((_f = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _f === void 0 ? void 0 : _f.fields) || [], true),
85
+ ], ((_g = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formSubmissionOverrides) === null || _g === void 0 ? void 0 : _g.fields) || [], true),
88
86
  };
89
- var paymentFieldConfig = (_g = formConfig === null || formConfig === void 0 ? void 0 : formConfig.fields) === null || _g === void 0 ? void 0 : _g.payment;
87
+ var paymentFieldConfig = (_h = formConfig === null || formConfig === void 0 ? void 0 : formConfig.fields) === null || _h === void 0 ? void 0 : _h.payment;
90
88
  if (paymentFieldConfig) {
91
89
  newConfig.fields.push({
92
90
  name: 'payment',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/FormSubmissions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gEAA0C;AAC1C,sEAAgD;AAEhD,+CAA+C;AACxC,IAAM,4BAA4B,GAAG,UAAC,UAAsB;;IACjE,IAAM,SAAS,GAAqB;QAClC,IAAI,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,uBAAuB,0CAAE,IAAI,KAAI,iBAAiB;QACpE,MAAM,aACJ,MAAM,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI,EAClB,MAAM,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK,EACnB,IAAI,EAAE,UAAC,EAAiB;oBAAR,IAAI,cAAA;gBAAS,OAAA,CAAC,CAAC,IAAI;YAAN,CAAM,IAChC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,uBAAuB,0CAAE,MAAM,KAAI,EAAE,CACrD;QACD,KAAK,EAAE;YACL,0BAA0B,EAAE,KAAK;SAClC;QACD,KAAK,aACH,YAAY;gBACV,UAAC,IAAI,IAAK,OAAA,IAAA,sBAAY,EAAC,IAAI,EAAE,UAAU,CAAC,EAA9B,CAA8B;gBACxC,UAAC,IAAI,IAAK,OAAA,IAAA,mBAAS,EAAC,IAAI,EAAE,UAAU,CAAC,EAA3B,CAA2B;eAClC,CAAA,MAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,uBAAuB,0CAAE,KAAK,0CAAE,YAAY,KAAI,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AI,EAAE,OAAO;oBACb,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,MAAM;iBACb;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,QAAQ;oBACf,IAAI,EAAE,MAAM;iBACb;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL,WAAW,EAAE,iBAAiB;qBAC/B;iBACF;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,MAAM;iBACb;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,aAAa;oBACpB,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;4BACd,IAAI,EAAE,MAAM;yBACb;wBACD;4BACE,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;4BACd,IAAI,EAAE,MAAM;yBACb;wBACD;4BACE,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,QAAQ;4BACf,IAAI,EAAE,MAAM;yBACb;qBACF;iBACF;aACF;SACF,CAAC,CAAA;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA;AAhIY,QAAA,4BAA4B,gCAgIxC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/FormSubmissions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gEAA0C;AAC1C,sEAAgD;AAEhD,+CAA+C;AACxC,IAAM,4BAA4B,GAAG,UAAC,UAAwB;;IACnE,IAAM,SAAS,GAAqB;QAClC,IAAI,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,uBAAuB,0CAAE,IAAI,KAAI,iBAAiB;QACpE,MAAM,aACJ,MAAM,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI,EAClB,MAAM,EAAE,cAAM,OAAA,KAAK,EAAL,CAA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;4BACE,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,QAAQ;4BACf,IAAI,EAAE,MAAM;yBACb;qBACF;iBACF;aACF;SACF,CAAC,CAAA;KACH;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA;AAjIY,QAAA,4BAA4B,gCAiIxC"}
@@ -1,3 +1,3 @@
1
1
  import { CollectionConfig } from 'payload/types';
2
- import { FormConfig } from '../../types';
3
- export declare const generateFormCollection: (formConfig: FormConfig) => CollectionConfig;
2
+ import { PluginConfig } from '../../types';
3
+ export declare const generateFormCollection: (formConfig: PluginConfig) => CollectionConfig;
@@ -28,7 +28,7 @@ var deepmerge_1 = __importDefault(require("deepmerge"));
28
28
  var fields_1 = __importDefault(require("./fields"));
29
29
  // all settings can be overridden by the config
30
30
  var generateFormCollection = function (formConfig) {
31
- var _a, _b, _c;
31
+ var _a, _b, _c, _d;
32
32
  var redirect = {
33
33
  name: 'redirect',
34
34
  type: 'group',
@@ -82,11 +82,8 @@ var generateFormCollection = function (formConfig) {
82
82
  }
83
83
  var config = {
84
84
  slug: ((_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _a === void 0 ? void 0 : _a.slug) || 'forms',
85
- admin: {
86
- useAsTitle: 'title',
87
- enableRichTextRelationship: false,
88
- },
89
- access: __assign({ read: function () { return true; } }, ((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _b === void 0 ? void 0 : _b.access) || {}),
85
+ admin: __assign(__assign({}, ((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _b === void 0 ? void 0 : _b.admin) || {}), { useAsTitle: 'title', enableRichTextRelationship: false }),
86
+ access: __assign({ read: function () { return true; } }, ((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _c === void 0 ? void 0 : _c.access) || {}),
90
87
  fields: __spreadArray([
91
88
  {
92
89
  name: 'title',
@@ -236,7 +233,7 @@ var generateFormCollection = function (formConfig) {
236
233
  },
237
234
  ],
238
235
  }
239
- ], ((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _c === void 0 ? void 0 : _c.fields) || [], true),
236
+ ], ((_d = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _d === void 0 ? void 0 : _d.fields) || [], true),
240
237
  };
241
238
  return config;
242
239
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAA8B;AAE9B,oDAA8B;AAE9B,+CAA+C;AACxC,IAAM,sBAAsB,GAAG,UAAC,UAAsB;;IAE3D,IAAM,QAAQ,GAAU;QACtB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,UAAC,CAAC,EAAE,WAAW,IAAK,OAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,MAAK,UAAU,EAA5C,CAA4C;SAC5E;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;KACF,CAAC;IAEF,IAAI,UAAU,CAAC,qBAAqB,EAAE;QACpC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;YACtB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE,UAAU,CAAC,qBAAqB;YAC5C,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE;gBACL,SAAS,EAAE,UAAC,CAAC,EAAE,WAAW,IAAK,OAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,MAAK,WAAW,EAAjC,CAAiC;aACjE;SACF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BACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,YAAY,EAAE,iCAAiC;wBAC/C,QAAQ,EAAE,IAAI;qBACf;oBACD;wBACE,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE;4BACL,WAAW,EAAE,sDAAsD;yBACpE;qBACF;iBACF;aACF;WACE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,0CAAE,MAAM,KAAI,EAAE,OAC3C;KACF,CAAA;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjOW,QAAA,sBAAsB,0BAiOjC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAA8B;AAE9B,oDAA8B;AAE9B,+CAA+C;AACxC,IAAM,sBAAsB,GAAG,UAAC,UAAwB;;IAE7D,IAAM,QAAQ,GAAU;QACtB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,UAAC,CAAC,EAAE,WAAW,IAAK,OAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,MAAK,UAAU,EAA5C,CAA4C;SAC5E;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;KACF,CAAC;IAEF,IAAI,UAAU,CAAC,qBAAqB,EAAE;QACpC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;YACtB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,cAAc;YACpB,UAAU,EA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;4BACN;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,WAAW;gCACjB,KAAK,EAAE,YAAY;gCACnB,KAAK,EAAE;oCACL,KAAK,EAAE,KAAK;oCACZ,WAAW,EAAE,6BAA6B;iCAC3C;6BACF;4BACD;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,eAAe;gCACrB,KAAK,EAAE,iBAAiB;gCACxB,KAAK,EAAE;oCACL,KAAK,EAAE,KAAK;iCACb;6BACF;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,YAAY,EAAE,iCAAiC;wBAC/C,QAAQ,EAAE,IAAI;qBACf;oBACD;wBACE,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE;4BACL,WAAW,EAAE,sDAAsD;yBACpE;qBACF;iBACF;aACF;WACE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,0CAAE,MAAM,KAAI,EAAE,OAC3C;KACF,CAAA;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlOW,QAAA,sBAAsB,0BAkOjC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Config } from 'payload/config';
2
- import { FormConfig } from './types';
2
+ import { PluginConfig } from './types';
3
3
  export { getPaymentTotal } from './utilities/getPaymentTotal';
4
- declare const FormBuilder: (incomingFormConfig: FormConfig) => (config: Config) => Config;
4
+ declare const FormBuilder: (incomingFormConfig: PluginConfig) => (config: Config) => Config;
5
5
  export default FormBuilder;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,6CAA6D;AAC7D,iEAA6E;AAE7E,2BAA2B;AAE3B,+DAA6D;AAApD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ACX,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,IAAI,EACd,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,KAAK,IACX,kBAAkB,CAAC,MAAM,IAE/B,CAAC;IAEF,6BACK,MAAM;QACT,WAAW;QACX,qBAAqB;QACrB,mCAAmC;QACnC,wBAAwB;QACxB,iBAAiB;QACjB,kCAAkC;QAClC,iBAAiB;QACjB,0CAA0C;QAC1C,yIAAyI;QACzI,4IAA4I;QAC5I,WAAW;QACX,SAAS;QACT,OAAO;QACP,KAAK;QACL,WAAW,kCACN,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,EAAE;YAC5B,IAAA,8BAAsB,EAAC,UAAU,CAAC;YAClC,IAAA,8CAA4B,EAAC,UAAU,CAAC;qBAE1C;AACJ,CAAC,EAxCyD,CAwCzD,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -1,2 +1,2 @@
1
- declare var _default: {};
1
+ declare const _default: {};
2
2
  export default _default;
package/dist/types.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { Block, CollectionConfig, Field } from 'payload/types';
2
- export declare type BlockConfig = {
2
+ export type BlockConfig = {
3
3
  block: Block;
4
4
  validate?: (value: unknown) => boolean | string;
5
5
  };
6
6
  export declare function isValidBlockConfig(blockConfig: BlockConfig | string): blockConfig is BlockConfig;
7
- export declare type FieldValues = {
7
+ export type FieldValues = {
8
8
  [key: string]: string | number | boolean | null | undefined;
9
9
  };
10
- export declare type PaymentFieldConfig = Partial<Field> & {
10
+ export type PaymentFieldConfig = Partial<Field> & {
11
11
  paymentProcessor: Partial<SelectField>;
12
12
  };
13
- export declare type FieldConfig = Partial<Field> | PaymentFieldConfig;
14
- export declare type FieldsConfig = {
13
+ export type FieldConfig = Partial<Field> | PaymentFieldConfig;
14
+ export type FieldsConfig = {
15
15
  select?: boolean | FieldConfig;
16
16
  text?: boolean | FieldConfig;
17
17
  textarea?: boolean | FieldConfig;
@@ -23,9 +23,9 @@ export declare type FieldsConfig = {
23
23
  message?: boolean | FieldConfig;
24
24
  payment?: boolean | FieldConfig;
25
25
  };
26
- export declare type BeforeEmail = (emails: FormattedEmail[]) => FormattedEmail[] | Promise<FormattedEmail[]>;
27
- export declare type HandlePayment = (data: any) => void;
28
- export declare type FormConfig = {
26
+ export type BeforeEmail = (emails: FormattedEmail[]) => FormattedEmail[] | Promise<FormattedEmail[]>;
27
+ export type HandlePayment = (data: any) => void;
28
+ export type PluginConfig = {
29
29
  fields?: FieldsConfig;
30
30
  formSubmissionOverrides?: Partial<CollectionConfig>;
31
31
  formOverrides?: Partial<CollectionConfig>;
@@ -33,7 +33,7 @@ export declare type FormConfig = {
33
33
  handlePayment?: HandlePayment;
34
34
  redirectRelationships?: string[];
35
35
  };
36
- export declare type TextField = {
36
+ export type TextField = {
37
37
  blockType: 'text';
38
38
  blockName?: string;
39
39
  width?: string;
@@ -42,7 +42,7 @@ export declare type TextField = {
42
42
  defaultValue?: string;
43
43
  required?: boolean;
44
44
  };
45
- export declare type TextAreaField = {
45
+ export type TextAreaField = {
46
46
  blockType: 'textarea';
47
47
  blockName?: string;
48
48
  width?: string;
@@ -51,11 +51,11 @@ export declare type TextAreaField = {
51
51
  defaultValue?: string;
52
52
  required?: boolean;
53
53
  };
54
- export declare type SelectFieldOption = {
54
+ export type SelectFieldOption = {
55
55
  label: string;
56
56
  value: string;
57
57
  };
58
- export declare type SelectField = {
58
+ export type SelectField = {
59
59
  blockType: 'select';
60
60
  blockName?: string;
61
61
  width?: string;
@@ -65,7 +65,7 @@ export declare type SelectField = {
65
65
  required?: boolean;
66
66
  options: SelectFieldOption[];
67
67
  };
68
- export declare type PriceCondition = {
68
+ export type PriceCondition = {
69
69
  fieldToUse: string;
70
70
  condition: 'equals' | 'notEquals' | 'hasValue';
71
71
  valueForCondition: string;
@@ -73,7 +73,7 @@ export declare type PriceCondition = {
73
73
  valueType: 'static' | 'valueOfField';
74
74
  valueForOperator: string | number;
75
75
  };
76
- export declare type PaymentField = {
76
+ export type PaymentField = {
77
77
  blockType: 'payment';
78
78
  blockName?: string;
79
79
  width?: string;
@@ -85,7 +85,7 @@ export declare type PaymentField = {
85
85
  basePrice: number;
86
86
  priceConditions: PriceCondition[];
87
87
  };
88
- export declare type EmailField = {
88
+ export type EmailField = {
89
89
  blockType: 'email';
90
90
  blockName?: string;
91
91
  width?: string;
@@ -94,7 +94,7 @@ export declare type EmailField = {
94
94
  defaultValue?: string;
95
95
  required?: boolean;
96
96
  };
97
- export declare type StateField = {
97
+ export type StateField = {
98
98
  blockType: 'state';
99
99
  blockName?: string;
100
100
  width?: string;
@@ -103,7 +103,7 @@ export declare type StateField = {
103
103
  defaultValue?: string;
104
104
  required?: boolean;
105
105
  };
106
- export declare type CountryField = {
106
+ export type CountryField = {
107
107
  blockType: 'country';
108
108
  blockName?: string;
109
109
  width?: string;
@@ -112,7 +112,7 @@ export declare type CountryField = {
112
112
  defaultValue?: string;
113
113
  required?: boolean;
114
114
  };
115
- export declare type CheckboxField = {
115
+ export type CheckboxField = {
116
116
  blockType: 'checkbox';
117
117
  blockName?: string;
118
118
  width?: string;
@@ -121,13 +121,13 @@ export declare type CheckboxField = {
121
121
  defaultValue?: boolean;
122
122
  required?: boolean;
123
123
  };
124
- export declare type MessageField = {
124
+ export type MessageField = {
125
125
  blockType: 'message';
126
126
  blockName?: string;
127
127
  message: unknown;
128
128
  };
129
- export declare type FormFieldBlock = TextField | TextAreaField | SelectField | EmailField | StateField | CountryField | CheckboxField | MessageField | PaymentField;
130
- export declare type Email = {
129
+ export type FormFieldBlock = TextField | TextAreaField | SelectField | EmailField | StateField | CountryField | CheckboxField | MessageField | PaymentField;
130
+ export type Email = {
131
131
  emailTo: string;
132
132
  emailFrom: string;
133
133
  emailFromName?: string;
@@ -137,14 +137,14 @@ export declare type Email = {
137
137
  subject: string;
138
138
  message?: any;
139
139
  };
140
- export declare type FormattedEmail = {
140
+ export type FormattedEmail = {
141
141
  to: string;
142
142
  from: string;
143
143
  subject: string;
144
144
  html: string;
145
145
  replyTo: string;
146
146
  };
147
- export declare type Redirect = {
147
+ export type Redirect = {
148
148
  type: 'reference' | 'custom';
149
149
  reference?: {
150
150
  relationTo: string;
@@ -152,7 +152,7 @@ export declare type Redirect = {
152
152
  };
153
153
  url: string;
154
154
  };
155
- export declare type Form = {
155
+ export type Form = {
156
156
  id: string;
157
157
  title: string;
158
158
  fields: FormFieldBlock[];
@@ -162,11 +162,11 @@ export declare type Form = {
162
162
  redirect?: Redirect;
163
163
  emails: Email[];
164
164
  };
165
- export declare type SubmissionValue = {
165
+ export type SubmissionValue = {
166
166
  field: string;
167
167
  value: unknown;
168
168
  };
169
- export declare type FormSubmission = {
169
+ export type FormSubmission = {
170
170
  form: string | Form;
171
171
  submissionData: SubmissionValue[];
172
172
  };
@@ -1,7 +1,7 @@
1
- declare type EmailVariable = {
1
+ type EmailVariable = {
2
2
  field: string;
3
3
  value: string;
4
4
  };
5
- declare type EmailVariables = EmailVariable[];
6
- export declare const replaceDoubleCurlys: (str: string, variables?: EmailVariables | undefined) => string;
5
+ type EmailVariables = EmailVariable[];
6
+ export declare const replaceDoubleCurlys: (str: string, variables?: EmailVariables) => string;
7
7
  export {};
@@ -1,4 +1,4 @@
1
- declare type Node = {
1
+ type Node = {
2
2
  bold?: boolean;
3
3
  code?: boolean;
4
4
  italic?: boolean;
@@ -6,5 +6,5 @@ declare type Node = {
6
6
  url?: string;
7
7
  children?: Node[];
8
8
  };
9
- export declare const serialize: (children?: Node[] | undefined, submissionData?: any) => string | undefined;
9
+ export declare const serialize: (children?: Node[], submissionData?: any) => string | undefined;
10
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-form-builder",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
+ "homepage:": "https://payloadcms.com",
5
+ "repository": "git@github.com:payloadcms/plugin-form-builder.git",
4
6
  "description": "Form builder plugin for Payload CMS",
5
7
  "main": "dist/index.js",
6
8
  "types": "dist/index.d.ts",
@@ -22,13 +24,13 @@
22
24
  "author": "dev@payloadcms.com",
23
25
  "license": "MIT",
24
26
  "peerDependencies": {
25
- "payload": "^0.18.5",
27
+ "payload": "^0.18.5 || ^1.0.0",
26
28
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
27
29
  },
28
30
  "devDependencies": {
29
31
  "@types/escape-html": "^1.0.1",
30
- "payload": "^0.18.5",
31
- "react": "^17.0.2",
32
+ "payload": "^1.0.6",
33
+ "react": "^18.0.0",
32
34
  "typescript": "^4.5.5"
33
35
  },
34
36
  "files": [