payload-dynamic-forms 0.0.0-stage → 0.2.0

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +461 -2
  3. package/dist/access.d.ts +7 -0
  4. package/dist/access.js +10 -0
  5. package/dist/access.js.map +1 -0
  6. package/dist/collections/attachments.d.ts +6 -0
  7. package/dist/collections/attachments.js +67 -0
  8. package/dist/collections/attachments.js.map +1 -0
  9. package/dist/collections/blocks.d.ts +27 -0
  10. package/dist/collections/blocks.js +495 -0
  11. package/dist/collections/blocks.js.map +1 -0
  12. package/dist/collections/forms.d.ts +3 -0
  13. package/dist/collections/forms.js +558 -0
  14. package/dist/collections/forms.js.map +1 -0
  15. package/dist/collections/overrides.d.ts +7 -0
  16. package/dist/collections/overrides.js +49 -0
  17. package/dist/collections/overrides.js.map +1 -0
  18. package/dist/collections/ruleFields.d.ts +6 -0
  19. package/dist/collections/ruleFields.js +97 -0
  20. package/dist/collections/ruleFields.js.map +1 -0
  21. package/dist/collections/submissions.d.ts +7 -0
  22. package/dist/collections/submissions.js +225 -0
  23. package/dist/collections/submissions.js.map +1 -0
  24. package/dist/delivery/run.d.ts +37 -0
  25. package/dist/delivery/run.js +234 -0
  26. package/dist/delivery/run.js.map +1 -0
  27. package/dist/delivery/webhook.d.ts +41 -0
  28. package/dist/delivery/webhook.js +120 -0
  29. package/dist/delivery/webhook.js.map +1 -0
  30. package/dist/endpoints/public.d.ts +4 -0
  31. package/dist/endpoints/public.js +27 -0
  32. package/dist/endpoints/public.js.map +1 -0
  33. package/dist/endpoints/resend.d.ts +4 -0
  34. package/dist/endpoints/resend.js +58 -0
  35. package/dist/endpoints/resend.js.map +1 -0
  36. package/dist/endpoints/submit.d.ts +4 -0
  37. package/dist/endpoints/submit.js +320 -0
  38. package/dist/endpoints/submit.js.map +1 -0
  39. package/dist/exports/shared.d.ts +13 -0
  40. package/dist/exports/shared.js +13 -0
  41. package/dist/exports/shared.js.map +1 -0
  42. package/dist/formBlock.d.ts +13 -0
  43. package/dist/formBlock.js +25 -0
  44. package/dist/formBlock.js.map +1 -0
  45. package/dist/hooks/resendTick.d.ts +8 -0
  46. package/dist/hooks/resendTick.js +55 -0
  47. package/dist/hooks/resendTick.js.map +1 -0
  48. package/dist/hooks/validateForm.d.ts +8 -0
  49. package/dist/hooks/validateForm.js +251 -0
  50. package/dist/hooks/validateForm.js.map +1 -0
  51. package/dist/index.d.ts +18 -0
  52. package/dist/index.js +130 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/security/crypto.d.ts +9 -0
  55. package/dist/security/crypto.js +54 -0
  56. package/dist/security/crypto.js.map +1 -0
  57. package/dist/security/rateLimit.d.ts +13 -0
  58. package/dist/security/rateLimit.js +28 -0
  59. package/dist/security/rateLimit.js.map +1 -0
  60. package/dist/security/request.d.ts +3 -0
  61. package/dist/security/request.js +13 -0
  62. package/dist/security/request.js.map +1 -0
  63. package/dist/security/turnstile.d.ts +28 -0
  64. package/dist/security/turnstile.js +56 -0
  65. package/dist/security/turnstile.js.map +1 -0
  66. package/dist/server/forms.d.ts +73 -0
  67. package/dist/server/forms.js +215 -0
  68. package/dist/server/forms.js.map +1 -0
  69. package/dist/server/resend.d.ts +27 -0
  70. package/dist/server/resend.js +84 -0
  71. package/dist/server/resend.js.map +1 -0
  72. package/dist/shared/answers.d.ts +47 -0
  73. package/dist/shared/answers.js +282 -0
  74. package/dist/shared/answers.js.map +1 -0
  75. package/dist/shared/operators.d.ts +41 -0
  76. package/dist/shared/operators.js +54 -0
  77. package/dist/shared/operators.js.map +1 -0
  78. package/dist/shared/rules.d.ts +58 -0
  79. package/dist/shared/rules.js +324 -0
  80. package/dist/shared/rules.js.map +1 -0
  81. package/dist/shared/steps.d.ts +28 -0
  82. package/dist/shared/steps.js +109 -0
  83. package/dist/shared/steps.js.map +1 -0
  84. package/dist/shared/tokens.d.ts +25 -0
  85. package/dist/shared/tokens.js +96 -0
  86. package/dist/shared/tokens.js.map +1 -0
  87. package/dist/shared/types.d.ts +181 -0
  88. package/dist/shared/types.js +5 -0
  89. package/dist/shared/types.js.map +1 -0
  90. package/dist/shared/whatsapp.d.ts +20 -0
  91. package/dist/shared/whatsapp.js +26 -0
  92. package/dist/shared/whatsapp.js.map +1 -0
  93. package/dist/shared/words.d.ts +9 -0
  94. package/dist/shared/words.js +41 -0
  95. package/dist/shared/words.js.map +1 -0
  96. package/dist/types.d.ts +182 -0
  97. package/dist/types.js +3 -0
  98. package/dist/types.js.map +1 -0
  99. package/package.json +114 -4
@@ -0,0 +1,558 @@
1
+ import { slugField } from 'payload';
2
+ import { adminFieldAccess, loggedIn } from '../access.js';
3
+ import { validateFormBeforeSave } from '../hooks/validateForm.js';
4
+ import { DEFAULT_WHATSAPP_ROW_TEMPLATE, DEFAULT_WHATSAPP_TEMPLATE } from '../shared/whatsapp.js';
5
+ import { WORD_KEYS } from '../shared/words.js';
6
+ import { nextStepRulesField, ruleGroupField } from './ruleFields.js';
7
+ const WORD_HELP = {
8
+ errorPrefix: 'Shown above the field errors.',
9
+ fileRejected: 'Field error for a file that is refused. {{label}} is the field label.',
10
+ invalid: 'Field error for a bad value. {{label}} is the field label.',
11
+ no: 'An unticked checkbox in emails, WhatsApp messages, webhooks and the stored snapshot.',
12
+ required: 'Field error for a missing answer. {{label}} is the field label.',
13
+ stepProgress: '{{current}} and {{total}} are the step numbers.',
14
+ yes: 'A ticked checkbox in emails, WhatsApp messages, webhooks and the stored snapshot.'
15
+ };
16
+ function wordingField(options) {
17
+ return {
18
+ name: 'wording',
19
+ type: 'group',
20
+ admin: {
21
+ description: 'Every word visitors read besides the questions. New forms start with the defaults.'
22
+ },
23
+ fields: WORD_KEYS.map((key)=>({
24
+ name: key,
25
+ type: key === 'success' || key === 'closed' ? 'textarea' : 'text',
26
+ admin: WORD_HELP[key] ? {
27
+ description: WORD_HELP[key]
28
+ } : undefined,
29
+ defaultValue: options.words[key],
30
+ localized: true
31
+ })),
32
+ label: 'Form wording'
33
+ };
34
+ }
35
+ /** The webhook row's admin-only secret fields; left out with `webhooks.secretsInAdmin: false`. */ function secretFields(secret) {
36
+ return [
37
+ {
38
+ name: 'headers',
39
+ type: 'array',
40
+ access: {
41
+ create: secret,
42
+ read: secret,
43
+ update: secret
44
+ },
45
+ admin: {
46
+ description: 'Secret headers (admins only).',
47
+ initCollapsed: true
48
+ },
49
+ fields: [
50
+ {
51
+ type: 'row',
52
+ fields: [
53
+ {
54
+ name: 'key',
55
+ type: 'text',
56
+ admin: {
57
+ width: '50%'
58
+ },
59
+ required: true
60
+ },
61
+ {
62
+ name: 'value',
63
+ type: 'text',
64
+ admin: {
65
+ width: '50%'
66
+ },
67
+ required: true
68
+ }
69
+ ]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ name: 'signingSecret',
75
+ type: 'text',
76
+ access: {
77
+ create: secret,
78
+ read: secret,
79
+ update: secret
80
+ },
81
+ admin: {
82
+ description: 'Signs the body: X-Form-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>">, plus the Standard Webhooks headers. Empty: the plugin config\'s secret, if any (admins only).'
83
+ }
84
+ }
85
+ ];
86
+ }
87
+ function deliveryField(options) {
88
+ const secret = adminFieldAccess(options.isAdmin);
89
+ return {
90
+ name: 'delivery',
91
+ type: 'group',
92
+ access: {
93
+ read: loggedIn
94
+ },
95
+ fields: [
96
+ {
97
+ name: 'store',
98
+ type: 'checkbox',
99
+ admin: {
100
+ description: 'Save each submission. Off: nothing is written; email, webhooks and WhatsApp still run.'
101
+ },
102
+ defaultValue: true,
103
+ label: 'Store submissions'
104
+ },
105
+ {
106
+ name: 'emails',
107
+ type: 'array',
108
+ admin: {
109
+ initCollapsed: true
110
+ },
111
+ fields: [
112
+ {
113
+ type: 'row',
114
+ fields: [
115
+ {
116
+ name: 'label',
117
+ type: 'text',
118
+ admin: {
119
+ width: '50%'
120
+ },
121
+ required: true
122
+ },
123
+ {
124
+ name: 'kind',
125
+ type: 'select',
126
+ admin: {
127
+ width: '30%'
128
+ },
129
+ dbName: 'k',
130
+ defaultValue: 'team',
131
+ options: [
132
+ {
133
+ label: 'Team (fixed addresses)',
134
+ value: 'team'
135
+ },
136
+ {
137
+ label: 'Visitor copy',
138
+ value: 'visitor'
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ name: 'enabled',
144
+ type: 'checkbox',
145
+ admin: {
146
+ width: '20%'
147
+ },
148
+ defaultValue: true
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ name: 'to',
154
+ type: 'text',
155
+ admin: {
156
+ condition: (_d, sibling)=>sibling?.kind !== 'visitor',
157
+ description: 'Fixed addresses, separated by commas. No {{tokens}}: use a visitor copy instead.'
158
+ }
159
+ },
160
+ {
161
+ name: 'visitorField',
162
+ type: 'text',
163
+ admin: {
164
+ condition: (_d, sibling)=>sibling?.kind === 'visitor',
165
+ description: 'Key of the email field whose answer gets the copy.'
166
+ }
167
+ },
168
+ {
169
+ type: 'row',
170
+ fields: [
171
+ {
172
+ name: 'cc',
173
+ type: 'text',
174
+ admin: {
175
+ width: '50%'
176
+ }
177
+ },
178
+ {
179
+ name: 'bcc',
180
+ type: 'text',
181
+ admin: {
182
+ width: '50%'
183
+ }
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ type: 'row',
189
+ fields: [
190
+ {
191
+ name: 'from',
192
+ type: 'text',
193
+ admin: {
194
+ description: "Empty: the email adapter's default.",
195
+ width: '50%'
196
+ }
197
+ },
198
+ {
199
+ name: 'replyToField',
200
+ type: 'text',
201
+ admin: {
202
+ description: 'Key of an email field to reply to.',
203
+ width: '50%'
204
+ }
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ name: 'subject',
210
+ type: 'text',
211
+ defaultValue: 'New submission: {{formTitle}}'
212
+ },
213
+ {
214
+ name: 'body',
215
+ type: 'textarea',
216
+ admin: {
217
+ description: 'Tokens: {{key}}, {{key.attribute}}, {{*}}, {{*:table}}, {{formTitle}}, {{submissionId}}.'
218
+ },
219
+ defaultValue: '{{*:table}}'
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ name: 'webhooks',
225
+ type: 'array',
226
+ admin: {
227
+ initCollapsed: true
228
+ },
229
+ fields: [
230
+ {
231
+ type: 'row',
232
+ fields: [
233
+ {
234
+ name: 'label',
235
+ type: 'text',
236
+ admin: {
237
+ width: '50%'
238
+ },
239
+ required: true
240
+ },
241
+ {
242
+ name: 'method',
243
+ type: 'select',
244
+ admin: {
245
+ width: '30%'
246
+ },
247
+ dbName: 'mth',
248
+ defaultValue: 'POST',
249
+ options: [
250
+ 'POST',
251
+ 'PUT',
252
+ 'PATCH'
253
+ ]
254
+ },
255
+ {
256
+ name: 'enabled',
257
+ type: 'checkbox',
258
+ admin: {
259
+ width: '20%'
260
+ },
261
+ defaultValue: true
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ name: 'url',
267
+ type: 'text',
268
+ admin: {
269
+ description: 'https only.'
270
+ },
271
+ required: true
272
+ },
273
+ {
274
+ type: 'row',
275
+ fields: [
276
+ {
277
+ name: 'payloadMode',
278
+ type: 'select',
279
+ admin: {
280
+ width: '40%'
281
+ },
282
+ dbName: 'pmd',
283
+ defaultValue: 'full',
284
+ options: [
285
+ {
286
+ label: 'Full (form, submission, answers)',
287
+ value: 'full'
288
+ },
289
+ {
290
+ label: 'Answers only',
291
+ value: 'answersOnly'
292
+ }
293
+ ]
294
+ },
295
+ {
296
+ name: 'timeoutMs',
297
+ type: 'number',
298
+ admin: {
299
+ width: '30%'
300
+ },
301
+ defaultValue: 8000,
302
+ max: 30000,
303
+ min: 500
304
+ },
305
+ {
306
+ name: 'retries',
307
+ type: 'number',
308
+ admin: {
309
+ width: '30%'
310
+ },
311
+ defaultValue: 0,
312
+ max: 3,
313
+ min: 0
314
+ }
315
+ ]
316
+ },
317
+ ...options.webhooks.secretsInAdmin ? secretFields(secret) : []
318
+ ]
319
+ },
320
+ {
321
+ name: 'whatsapp',
322
+ type: 'group',
323
+ fields: [
324
+ {
325
+ name: 'enabled',
326
+ type: 'checkbox',
327
+ defaultValue: false,
328
+ label: 'Build a WhatsApp link'
329
+ },
330
+ {
331
+ name: 'number',
332
+ type: 'text',
333
+ admin: {
334
+ condition: (_d, sibling)=>Boolean(sibling?.enabled),
335
+ description: 'Empty: the app\'s number.'
336
+ }
337
+ },
338
+ {
339
+ name: 'messageTemplate',
340
+ type: 'textarea',
341
+ admin: {
342
+ condition: (_d, sibling)=>Boolean(sibling?.enabled)
343
+ },
344
+ defaultValue: DEFAULT_WHATSAPP_TEMPLATE,
345
+ localized: true
346
+ },
347
+ {
348
+ name: 'rowTemplate',
349
+ type: 'text',
350
+ admin: {
351
+ condition: (_d, sibling)=>Boolean(sibling?.enabled)
352
+ },
353
+ defaultValue: DEFAULT_WHATSAPP_ROW_TEMPLATE,
354
+ localized: true
355
+ }
356
+ ],
357
+ label: 'WhatsApp'
358
+ }
359
+ ],
360
+ label: 'Delivery'
361
+ };
362
+ }
363
+ export function formsCollection(options, blocks, endpoints) {
364
+ return {
365
+ slug: options.slugs.forms,
366
+ access: {
367
+ create: loggedIn,
368
+ delete: loggedIn,
369
+ read: ({ req })=>req.user ? true : {
370
+ _status: {
371
+ equals: 'published'
372
+ }
373
+ },
374
+ update: loggedIn
375
+ },
376
+ admin: {
377
+ defaultColumns: [
378
+ 'title',
379
+ 'slug',
380
+ 'intakeState',
381
+ '_status',
382
+ 'updatedAt'
383
+ ],
384
+ group: 'Forms',
385
+ useAsTitle: 'title'
386
+ },
387
+ defaultPopulate: {
388
+ slug: true,
389
+ intakeState: true,
390
+ presentationMode: true,
391
+ sections: true,
392
+ successRedirectURL: true,
393
+ successType: true,
394
+ title: true,
395
+ wording: true
396
+ },
397
+ endpoints,
398
+ fields: [
399
+ {
400
+ name: 'title',
401
+ type: 'text',
402
+ localized: true,
403
+ required: true
404
+ },
405
+ slugField({
406
+ useAsSlug: 'title'
407
+ }),
408
+ {
409
+ type: 'tabs',
410
+ tabs: [
411
+ {
412
+ fields: [
413
+ {
414
+ type: 'row',
415
+ fields: [
416
+ {
417
+ name: 'presentationMode',
418
+ type: 'select',
419
+ admin: {
420
+ width: '50%'
421
+ },
422
+ dbName: 'pm',
423
+ defaultValue: 'singlePage',
424
+ options: [
425
+ {
426
+ label: 'Single page',
427
+ value: 'singlePage'
428
+ },
429
+ {
430
+ label: 'Step by step',
431
+ value: 'steps'
432
+ }
433
+ ],
434
+ required: true
435
+ },
436
+ {
437
+ name: 'intakeState',
438
+ type: 'select',
439
+ admin: {
440
+ width: '50%'
441
+ },
442
+ dbName: 'ist',
443
+ defaultValue: 'open',
444
+ options: [
445
+ {
446
+ label: 'Open',
447
+ value: 'open'
448
+ },
449
+ {
450
+ label: 'Closed',
451
+ value: 'closed'
452
+ }
453
+ ],
454
+ required: true
455
+ }
456
+ ]
457
+ },
458
+ {
459
+ name: 'sections',
460
+ type: 'array',
461
+ admin: {
462
+ initCollapsed: true
463
+ },
464
+ fields: [
465
+ {
466
+ type: 'row',
467
+ fields: [
468
+ {
469
+ name: 'key',
470
+ type: 'text',
471
+ admin: {
472
+ width: '40%'
473
+ },
474
+ required: true
475
+ },
476
+ {
477
+ name: 'title',
478
+ type: 'text',
479
+ admin: {
480
+ width: '60%'
481
+ },
482
+ localized: true
483
+ }
484
+ ]
485
+ },
486
+ {
487
+ name: 'description',
488
+ type: 'textarea',
489
+ localized: true
490
+ },
491
+ {
492
+ name: 'fields',
493
+ type: 'blocks',
494
+ admin: {
495
+ initCollapsed: true
496
+ },
497
+ blocks
498
+ },
499
+ ruleGroupField('visibilityRules', 'Show section when'),
500
+ nextStepRulesField()
501
+ ],
502
+ minRows: 1,
503
+ required: true
504
+ }
505
+ ],
506
+ label: 'Structure'
507
+ },
508
+ {
509
+ fields: [
510
+ {
511
+ name: 'successType',
512
+ type: 'radio',
513
+ dbName: 'st',
514
+ defaultValue: 'message',
515
+ options: [
516
+ {
517
+ label: 'Show the success words',
518
+ value: 'message'
519
+ },
520
+ {
521
+ label: 'Redirect',
522
+ value: 'redirect'
523
+ }
524
+ ]
525
+ },
526
+ {
527
+ name: 'successRedirectURL',
528
+ type: 'text',
529
+ admin: {
530
+ condition: (_d, sibling)=>sibling?.successType === 'redirect'
531
+ }
532
+ },
533
+ wordingField(options)
534
+ ],
535
+ label: 'Words'
536
+ },
537
+ {
538
+ fields: [
539
+ deliveryField(options)
540
+ ],
541
+ label: 'Delivery'
542
+ }
543
+ ]
544
+ }
545
+ ],
546
+ hooks: {
547
+ beforeValidate: [
548
+ validateFormBeforeSave(options)
549
+ ]
550
+ },
551
+ versions: {
552
+ drafts: true,
553
+ maxPerDoc: 20
554
+ }
555
+ };
556
+ }
557
+
558
+ //# sourceMappingURL=forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/forms.ts"],"sourcesContent":["import type { Block, CollectionConfig, Endpoint, Field, FieldAccess } from 'payload'\n\nimport { slugField } from 'payload'\n\nimport type { ResolvedOptions } from '../types.js'\n\nimport { adminFieldAccess, loggedIn } from '../access.js'\nimport { validateFormBeforeSave } from '../hooks/validateForm.js'\nimport { DEFAULT_WHATSAPP_ROW_TEMPLATE, DEFAULT_WHATSAPP_TEMPLATE } from '../shared/whatsapp.js'\nimport { WORD_KEYS } from '../shared/words.js'\nimport { nextStepRulesField, ruleGroupField } from './ruleFields.js'\n\nconst WORD_HELP: Record<string, string> = {\n errorPrefix: 'Shown above the field errors.',\n fileRejected: 'Field error for a file that is refused. {{label}} is the field label.',\n invalid: 'Field error for a bad value. {{label}} is the field label.',\n no: 'An unticked checkbox in emails, WhatsApp messages, webhooks and the stored snapshot.',\n required: 'Field error for a missing answer. {{label}} is the field label.',\n stepProgress: '{{current}} and {{total}} are the step numbers.',\n yes: 'A ticked checkbox in emails, WhatsApp messages, webhooks and the stored snapshot.',\n}\n\nfunction wordingField(options: ResolvedOptions): Field {\n return {\n name: 'wording',\n type: 'group',\n admin: { description: 'Every word visitors read besides the questions. New forms start with the defaults.' },\n fields: WORD_KEYS.map(\n (key): Field =>\n ({\n name: key,\n type: key === 'success' || key === 'closed' ? 'textarea' : 'text',\n admin: WORD_HELP[key] ? { description: WORD_HELP[key] } : undefined,\n defaultValue: options.words[key],\n localized: true,\n }) as Field,\n ),\n label: 'Form wording',\n }\n}\n\n/** The webhook row's admin-only secret fields; left out with `webhooks.secretsInAdmin: false`. */\nfunction secretFields(secret: FieldAccess): Field[] {\n return [\n {\n name: 'headers',\n type: 'array',\n access: { create: secret, read: secret, update: secret },\n admin: { description: 'Secret headers (admins only).', initCollapsed: true },\n fields: [\n {\n type: 'row',\n fields: [\n { name: 'key', type: 'text', admin: { width: '50%' }, required: true },\n { name: 'value', type: 'text', admin: { width: '50%' }, required: true },\n ],\n },\n ],\n },\n {\n name: 'signingSecret',\n type: 'text',\n access: { create: secret, read: secret, update: secret },\n admin: {\n description:\n 'Signs the body: X-Form-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of \"<t>.<body>\">, plus the Standard Webhooks headers. Empty: the plugin config\\'s secret, if any (admins only).',\n },\n },\n ]\n}\n\nfunction deliveryField(options: ResolvedOptions): Field {\n const secret = adminFieldAccess(options.isAdmin)\n return {\n name: 'delivery',\n type: 'group',\n access: { read: loggedIn },\n fields: [\n {\n name: 'store',\n type: 'checkbox',\n admin: { description: 'Save each submission. Off: nothing is written; email, webhooks and WhatsApp still run.' },\n defaultValue: true,\n label: 'Store submissions',\n },\n {\n name: 'emails',\n type: 'array',\n admin: { initCollapsed: true },\n fields: [\n {\n type: 'row',\n fields: [\n { name: 'label', type: 'text', admin: { width: '50%' }, required: true },\n {\n name: 'kind',\n type: 'select',\n admin: { width: '30%' },\n dbName: 'k',\n defaultValue: 'team',\n options: [\n { label: 'Team (fixed addresses)', value: 'team' },\n { label: 'Visitor copy', value: 'visitor' },\n ],\n },\n { name: 'enabled', type: 'checkbox', admin: { width: '20%' }, defaultValue: true },\n ],\n },\n {\n name: 'to',\n type: 'text',\n admin: {\n condition: (_d, sibling) => sibling?.kind !== 'visitor',\n description: 'Fixed addresses, separated by commas. No {{tokens}}: use a visitor copy instead.',\n },\n },\n {\n name: 'visitorField',\n type: 'text',\n admin: {\n condition: (_d, sibling) => sibling?.kind === 'visitor',\n description: 'Key of the email field whose answer gets the copy.',\n },\n },\n {\n type: 'row',\n fields: [\n { name: 'cc', type: 'text', admin: { width: '50%' } },\n { name: 'bcc', type: 'text', admin: { width: '50%' } },\n ],\n },\n {\n type: 'row',\n fields: [\n { name: 'from', type: 'text', admin: { description: \"Empty: the email adapter's default.\", width: '50%' } },\n { name: 'replyToField', type: 'text', admin: { description: 'Key of an email field to reply to.', width: '50%' } },\n ],\n },\n { name: 'subject', type: 'text', defaultValue: 'New submission: {{formTitle}}' },\n {\n name: 'body',\n type: 'textarea',\n admin: { description: 'Tokens: {{key}}, {{key.attribute}}, {{*}}, {{*:table}}, {{formTitle}}, {{submissionId}}.' },\n defaultValue: '{{*:table}}',\n },\n ],\n },\n {\n name: 'webhooks',\n type: 'array',\n admin: { initCollapsed: true },\n fields: [\n {\n type: 'row',\n fields: [\n { name: 'label', type: 'text', admin: { width: '50%' }, required: true },\n {\n name: 'method',\n type: 'select',\n admin: { width: '30%' },\n dbName: 'mth',\n defaultValue: 'POST',\n options: ['POST', 'PUT', 'PATCH'],\n },\n { name: 'enabled', type: 'checkbox', admin: { width: '20%' }, defaultValue: true },\n ],\n },\n { name: 'url', type: 'text', admin: { description: 'https only.' }, required: true },\n {\n type: 'row',\n fields: [\n {\n name: 'payloadMode',\n type: 'select',\n admin: { width: '40%' },\n dbName: 'pmd',\n defaultValue: 'full',\n options: [\n { label: 'Full (form, submission, answers)', value: 'full' },\n { label: 'Answers only', value: 'answersOnly' },\n ],\n },\n { name: 'timeoutMs', type: 'number', admin: { width: '30%' }, defaultValue: 8000, max: 30000, min: 500 },\n { name: 'retries', type: 'number', admin: { width: '30%' }, defaultValue: 0, max: 3, min: 0 },\n ],\n },\n ...(options.webhooks.secretsInAdmin ? secretFields(secret) : []),\n ],\n },\n {\n name: 'whatsapp',\n type: 'group',\n fields: [\n { name: 'enabled', type: 'checkbox', defaultValue: false, label: 'Build a WhatsApp link' },\n {\n name: 'number',\n type: 'text',\n admin: { condition: (_d, sibling) => Boolean(sibling?.enabled), description: 'Empty: the app\\'s number.' },\n },\n {\n name: 'messageTemplate',\n type: 'textarea',\n admin: { condition: (_d, sibling) => Boolean(sibling?.enabled) },\n defaultValue: DEFAULT_WHATSAPP_TEMPLATE,\n localized: true,\n },\n {\n name: 'rowTemplate',\n type: 'text',\n admin: { condition: (_d, sibling) => Boolean(sibling?.enabled) },\n defaultValue: DEFAULT_WHATSAPP_ROW_TEMPLATE,\n localized: true,\n },\n ],\n label: 'WhatsApp',\n },\n ],\n label: 'Delivery',\n }\n}\n\nexport function formsCollection(options: ResolvedOptions, blocks: Block[], endpoints: Endpoint[]): CollectionConfig {\n return {\n slug: options.slugs.forms,\n access: {\n create: loggedIn,\n delete: loggedIn,\n read: ({ req }) => (req.user ? true : { _status: { equals: 'published' } }),\n update: loggedIn,\n },\n admin: {\n defaultColumns: ['title', 'slug', 'intakeState', '_status', 'updatedAt'],\n group: 'Forms',\n useAsTitle: 'title',\n },\n defaultPopulate: {\n slug: true,\n intakeState: true,\n presentationMode: true,\n sections: true,\n successRedirectURL: true,\n successType: true,\n title: true,\n wording: true,\n },\n endpoints,\n fields: [\n { name: 'title', type: 'text', localized: true, required: true },\n slugField({ useAsSlug: 'title' }),\n {\n type: 'tabs',\n tabs: [\n {\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'presentationMode',\n type: 'select',\n admin: { width: '50%' },\n dbName: 'pm',\n defaultValue: 'singlePage',\n options: [\n { label: 'Single page', value: 'singlePage' },\n { label: 'Step by step', value: 'steps' },\n ],\n required: true,\n },\n {\n name: 'intakeState',\n type: 'select',\n admin: { width: '50%' },\n dbName: 'ist',\n defaultValue: 'open',\n options: [\n { label: 'Open', value: 'open' },\n { label: 'Closed', value: 'closed' },\n ],\n required: true,\n },\n ],\n },\n {\n name: 'sections',\n type: 'array',\n admin: { initCollapsed: true },\n fields: [\n {\n type: 'row',\n fields: [\n { name: 'key', type: 'text', admin: { width: '40%' }, required: true },\n { name: 'title', type: 'text', admin: { width: '60%' }, localized: true },\n ],\n },\n { name: 'description', type: 'textarea', localized: true },\n {\n name: 'fields',\n type: 'blocks',\n admin: { initCollapsed: true },\n blocks,\n },\n ruleGroupField('visibilityRules', 'Show section when'),\n nextStepRulesField(),\n ],\n minRows: 1,\n required: true,\n },\n ],\n label: 'Structure',\n },\n {\n fields: [\n {\n name: 'successType',\n type: 'radio',\n dbName: 'st',\n defaultValue: 'message',\n options: [\n { label: 'Show the success words', value: 'message' },\n { label: 'Redirect', value: 'redirect' },\n ],\n },\n {\n name: 'successRedirectURL',\n type: 'text',\n admin: { condition: (_d, sibling) => sibling?.successType === 'redirect' },\n },\n wordingField(options),\n ],\n label: 'Words',\n },\n { fields: [deliveryField(options)], label: 'Delivery' },\n ],\n },\n ],\n hooks: {\n beforeValidate: [validateFormBeforeSave(options)],\n },\n versions: {\n drafts: true,\n maxPerDoc: 20,\n },\n }\n}\n"],"names":["slugField","adminFieldAccess","loggedIn","validateFormBeforeSave","DEFAULT_WHATSAPP_ROW_TEMPLATE","DEFAULT_WHATSAPP_TEMPLATE","WORD_KEYS","nextStepRulesField","ruleGroupField","WORD_HELP","errorPrefix","fileRejected","invalid","no","required","stepProgress","yes","wordingField","options","name","type","admin","description","fields","map","key","undefined","defaultValue","words","localized","label","secretFields","secret","access","create","read","update","initCollapsed","width","deliveryField","isAdmin","dbName","value","condition","_d","sibling","kind","max","min","webhooks","secretsInAdmin","Boolean","enabled","formsCollection","blocks","endpoints","slug","slugs","forms","delete","req","user","_status","equals","defaultColumns","group","useAsTitle","defaultPopulate","intakeState","presentationMode","sections","successRedirectURL","successType","title","wording","useAsSlug","tabs","minRows","hooks","beforeValidate","versions","drafts","maxPerDoc"],"mappings":"AAEA,SAASA,SAAS,QAAQ,UAAS;AAInC,SAASC,gBAAgB,EAAEC,QAAQ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ASC,MAAM;gDAAQC,OAAO;oDAAEiB,OAAO;gDAAM;gDAAGT,WAAW;4CAAK;yCACzE;oCACH;oCACA;wCAAEV,MAAM;wCAAeC,MAAM;wCAAYS,WAAW;oCAAK;oCACzD;wCACEV,MAAM;wCACNC,MAAM;wCACNC,OAAO;4CAAEgB,eAAe;wCAAK;wCAC7BiB;oCACF;oCACA9C,eAAe,mBAAmB;oCAClCD;iCACD;gCACDsE,SAAS;gCACT/D,UAAU;4BACZ;yBACD;wBACDgB,OAAO;oBACT;oBACA;wBACEP,QAAQ;4BACN;gCACEJ,MAAM;gCACNC,MAAM;gCACNqB,QAAQ;gCACRd,cAAc;gCACdT,SAAS;oCACP;wCAAEY,OAAO;wCAA0BY,OAAO;oCAAU;oCACpD;wCAAEZ,OAAO;wCAAYY,OAAO;oCAAW;iCACxC;4BACH;4BACA;gCACEvB,MAAM;gCACNC,MAAM;gCACNC,OAAO;oCAAEsB,WAAW,CAACC,IAAIC,UAAYA,SAAS2B,gBAAgB;gCAAW;4BAC3E;4BACAvD,aAAaC;yBACd;wBACDY,OAAO;oBACT;oBACA;wBAAEP,QAAQ;4BAACgB,cAAcrB;yBAAS;wBAAEY,OAAO;oBAAW;iBACvD;YACH;SACD;QACDgD,OAAO;YACLC,gBAAgB;gBAAC5E,uBAAuBe;aAAS;QACnD;QACA8D,UAAU;YACRC,QAAQ;YACRC,WAAW;QACb;IACF;AACF"}
@@ -0,0 +1,7 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ import type { CollectionOverride } from '../types.js';
3
+ /**
4
+ * Applies an override in the official form builder's style: any collection property replaces the
5
+ * default (access, admin and upload are merged key by key) and `fields` receives `{ defaultFields }`.
6
+ */
7
+ export declare function applyOverrides(base: CollectionConfig, override: CollectionOverride | undefined): CollectionConfig;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Applies an override in the official form builder's style: any collection property replaces the
3
+ * default (access, admin and upload are merged key by key) and `fields` receives `{ defaultFields }`.
4
+ */ export function applyOverrides(base, override) {
5
+ if (!override) {
6
+ return base;
7
+ }
8
+ const { fields, ...rest } = override;
9
+ const merged = {
10
+ ...base,
11
+ ...rest
12
+ };
13
+ if (rest.access) {
14
+ merged.access = {
15
+ ...base.access,
16
+ ...rest.access
17
+ };
18
+ }
19
+ if (rest.admin) {
20
+ merged.admin = {
21
+ ...base.admin,
22
+ ...rest.admin
23
+ };
24
+ }
25
+ if (rest.hooks) {
26
+ merged.hooks = {
27
+ ...base.hooks,
28
+ ...rest.hooks
29
+ };
30
+ }
31
+ if (rest.upload && typeof rest.upload === 'object' && base.upload && typeof base.upload === 'object') {
32
+ merged.upload = {
33
+ ...base.upload,
34
+ ...rest.upload
35
+ };
36
+ }
37
+ if (rest.endpoints && base.endpoints) {
38
+ merged.endpoints = [
39
+ ...base.endpoints,
40
+ ...rest.endpoints
41
+ ];
42
+ }
43
+ merged.fields = fields ? fields({
44
+ defaultFields: base.fields
45
+ }) : base.fields;
46
+ return merged;
47
+ }
48
+
49
+ //# sourceMappingURL=overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/overrides.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport type { CollectionOverride } from '../types.js'\n\n/**\n * Applies an override in the official form builder's style: any collection property replaces the\n * default (access, admin and upload are merged key by key) and `fields` receives `{ defaultFields }`.\n */\nexport function applyOverrides(base: CollectionConfig, override: CollectionOverride | undefined): CollectionConfig {\n if (!override) {\n return base\n }\n const { fields, ...rest } = override\n const merged: CollectionConfig = { ...base, ...rest } as CollectionConfig\n if (rest.access) {\n merged.access = { ...base.access, ...rest.access }\n }\n if (rest.admin) {\n merged.admin = { ...base.admin, ...rest.admin }\n }\n if (rest.hooks) {\n merged.hooks = { ...base.hooks, ...rest.hooks }\n }\n if (rest.upload && typeof rest.upload === 'object' && base.upload && typeof base.upload === 'object') {\n merged.upload = { ...base.upload, ...rest.upload }\n }\n if (rest.endpoints && base.endpoints) {\n merged.endpoints = [...base.endpoints, ...rest.endpoints]\n }\n merged.fields = fields ? fields({ defaultFields: base.fields }) : base.fields\n return merged\n}\n"],"names":["applyOverrides","base","override","fields","rest","merged","access","admin","hooks","upload","endpoints","defaultFields"],"mappings":"AAIA;;;CAGC,GACD,OAAO,SAASA,eAAeC,IAAsB,EAAEC,QAAwC;IAC7F,IAAI,CAACA,UAAU;QACb,OAAOD;IACT;IACA,MAAM,EAAEE,MAAM,EAAE,GAAGC,MAAM,GAAGF;IAC5B,MAAMG,SAA2B;QAAE,GAAGJ,IAAI;QAAE,GAAGG,IAAI;IAAC;IACpD,IAAIA,KAAKE,MAAM,EAAE;QACfD,OAAOC,MAAM,GAAG;YAAE,GAAGL,KAAKK,MAAM;YAAE,GAAGF,KAAKE,MAAM;QAAC;IACnD;IACA,IAAIF,KAAKG,KAAK,EAAE;QACdF,OAAOE,KAAK,GAAG;YAAE,GAAGN,KAAKM,KAAK;YAAE,GAAGH,KAAKG,KAAK;QAAC;IAChD;IACA,IAAIH,KAAKI,KAAK,EAAE;QACdH,OAAOG,KAAK,GAAG;YAAE,GAAGP,KAAKO,KAAK;YAAE,GAAGJ,KAAKI,KAAK;QAAC;IAChD;IACA,IAAIJ,KAAKK,MAAM,IAAI,OAAOL,KAAKK,MAAM,KAAK,YAAYR,KAAKQ,MAAM,IAAI,OAAOR,KAAKQ,MAAM,KAAK,UAAU;QACpGJ,OAAOI,MAAM,GAAG;YAAE,GAAGR,KAAKQ,MAAM;YAAE,GAAGL,KAAKK,MAAM;QAAC;IACnD;IACA,IAAIL,KAAKM,SAAS,IAAIT,KAAKS,SAAS,EAAE;QACpCL,OAAOK,SAAS,GAAG;eAAIT,KAAKS,SAAS;eAAKN,KAAKM,SAAS;SAAC;IAC3D;IACAL,OAAOF,MAAM,GAAGA,SAASA,OAAO;QAAEQ,eAAeV,KAAKE,MAAM;IAAC,KAAKF,KAAKE,MAAM;IAC7E,OAAOE;AACT"}
@@ -0,0 +1,6 @@
1
+ import type { Field } from 'payload';
2
+ /** One rule row: field key (or `key.attribute`), operator from the shared list, value. */
3
+ export declare function ruleRowFields(): Field[];
4
+ /** A show/hide rule group (`all` or `any` of its rows; empty shows). */
5
+ export declare function ruleGroupField(name?: string, label?: string): Field;
6
+ export declare function nextStepRulesField(): Field;