payload-dynamic-forms 0.0.0-stage → 0.1.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 +404 -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 +553 -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 +36 -0
  25. package/dist/delivery/run.js +187 -0
  26. package/dist/delivery/run.js.map +1 -0
  27. package/dist/delivery/webhook.d.ts +26 -0
  28. package/dist/delivery/webhook.js +71 -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 +124 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/security/crypto.d.ts +2 -0
  55. package/dist/security/crypto.js +17 -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 +133 -0
  97. package/dist/types.js +3 -0
  98. package/dist/types.js.map +1 -0
  99. package/package.json +113 -4
@@ -0,0 +1,553 @@
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
+ function deliveryField(options) {
36
+ const secret = adminFieldAccess(options.isAdmin);
37
+ return {
38
+ name: 'delivery',
39
+ type: 'group',
40
+ access: {
41
+ read: loggedIn
42
+ },
43
+ fields: [
44
+ {
45
+ name: 'store',
46
+ type: 'checkbox',
47
+ admin: {
48
+ description: 'Save each submission. Off: nothing is written; email, webhooks and WhatsApp still run.'
49
+ },
50
+ defaultValue: true,
51
+ label: 'Store submissions'
52
+ },
53
+ {
54
+ name: 'emails',
55
+ type: 'array',
56
+ admin: {
57
+ initCollapsed: true
58
+ },
59
+ fields: [
60
+ {
61
+ type: 'row',
62
+ fields: [
63
+ {
64
+ name: 'label',
65
+ type: 'text',
66
+ admin: {
67
+ width: '50%'
68
+ },
69
+ required: true
70
+ },
71
+ {
72
+ name: 'kind',
73
+ type: 'select',
74
+ admin: {
75
+ width: '30%'
76
+ },
77
+ dbName: 'k',
78
+ defaultValue: 'team',
79
+ options: [
80
+ {
81
+ label: 'Team (fixed addresses)',
82
+ value: 'team'
83
+ },
84
+ {
85
+ label: 'Visitor copy',
86
+ value: 'visitor'
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ name: 'enabled',
92
+ type: 'checkbox',
93
+ admin: {
94
+ width: '20%'
95
+ },
96
+ defaultValue: true
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ name: 'to',
102
+ type: 'text',
103
+ admin: {
104
+ condition: (_d, sibling)=>sibling?.kind !== 'visitor',
105
+ description: 'Fixed addresses, separated by commas. No {{tokens}}: use a visitor copy instead.'
106
+ }
107
+ },
108
+ {
109
+ name: 'visitorField',
110
+ type: 'text',
111
+ admin: {
112
+ condition: (_d, sibling)=>sibling?.kind === 'visitor',
113
+ description: 'Key of the email field whose answer gets the copy.'
114
+ }
115
+ },
116
+ {
117
+ type: 'row',
118
+ fields: [
119
+ {
120
+ name: 'cc',
121
+ type: 'text',
122
+ admin: {
123
+ width: '50%'
124
+ }
125
+ },
126
+ {
127
+ name: 'bcc',
128
+ type: 'text',
129
+ admin: {
130
+ width: '50%'
131
+ }
132
+ }
133
+ ]
134
+ },
135
+ {
136
+ type: 'row',
137
+ fields: [
138
+ {
139
+ name: 'from',
140
+ type: 'text',
141
+ admin: {
142
+ description: "Empty: the email adapter's default.",
143
+ width: '50%'
144
+ }
145
+ },
146
+ {
147
+ name: 'replyToField',
148
+ type: 'text',
149
+ admin: {
150
+ description: 'Key of an email field to reply to.',
151
+ width: '50%'
152
+ }
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ name: 'subject',
158
+ type: 'text',
159
+ defaultValue: 'New submission: {{formTitle}}'
160
+ },
161
+ {
162
+ name: 'body',
163
+ type: 'textarea',
164
+ admin: {
165
+ description: 'Tokens: {{key}}, {{key.attribute}}, {{*}}, {{*:table}}, {{formTitle}}, {{submissionId}}.'
166
+ },
167
+ defaultValue: '{{*:table}}'
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ name: 'webhooks',
173
+ type: 'array',
174
+ admin: {
175
+ initCollapsed: true
176
+ },
177
+ fields: [
178
+ {
179
+ type: 'row',
180
+ fields: [
181
+ {
182
+ name: 'label',
183
+ type: 'text',
184
+ admin: {
185
+ width: '50%'
186
+ },
187
+ required: true
188
+ },
189
+ {
190
+ name: 'method',
191
+ type: 'select',
192
+ admin: {
193
+ width: '30%'
194
+ },
195
+ dbName: 'mth',
196
+ defaultValue: 'POST',
197
+ options: [
198
+ 'POST',
199
+ 'PUT',
200
+ 'PATCH'
201
+ ]
202
+ },
203
+ {
204
+ name: 'enabled',
205
+ type: 'checkbox',
206
+ admin: {
207
+ width: '20%'
208
+ },
209
+ defaultValue: true
210
+ }
211
+ ]
212
+ },
213
+ {
214
+ name: 'url',
215
+ type: 'text',
216
+ admin: {
217
+ description: 'https only.'
218
+ },
219
+ required: true
220
+ },
221
+ {
222
+ type: 'row',
223
+ fields: [
224
+ {
225
+ name: 'payloadMode',
226
+ type: 'select',
227
+ admin: {
228
+ width: '40%'
229
+ },
230
+ dbName: 'pmd',
231
+ defaultValue: 'full',
232
+ options: [
233
+ {
234
+ label: 'Full (form, submission, answers)',
235
+ value: 'full'
236
+ },
237
+ {
238
+ label: 'Answers only',
239
+ value: 'answersOnly'
240
+ }
241
+ ]
242
+ },
243
+ {
244
+ name: 'timeoutMs',
245
+ type: 'number',
246
+ admin: {
247
+ width: '30%'
248
+ },
249
+ defaultValue: 8000,
250
+ max: 30000,
251
+ min: 500
252
+ },
253
+ {
254
+ name: 'retries',
255
+ type: 'number',
256
+ admin: {
257
+ width: '30%'
258
+ },
259
+ defaultValue: 0,
260
+ max: 3,
261
+ min: 0
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ name: 'headers',
267
+ type: 'array',
268
+ access: {
269
+ create: secret,
270
+ read: secret,
271
+ update: secret
272
+ },
273
+ admin: {
274
+ description: 'Secret headers (admins only).',
275
+ initCollapsed: true
276
+ },
277
+ fields: [
278
+ {
279
+ type: 'row',
280
+ fields: [
281
+ {
282
+ name: 'key',
283
+ type: 'text',
284
+ admin: {
285
+ width: '50%'
286
+ },
287
+ required: true
288
+ },
289
+ {
290
+ name: 'value',
291
+ type: 'text',
292
+ admin: {
293
+ width: '50%'
294
+ },
295
+ required: true
296
+ }
297
+ ]
298
+ }
299
+ ]
300
+ },
301
+ {
302
+ name: 'signingSecret',
303
+ type: 'text',
304
+ access: {
305
+ create: secret,
306
+ read: secret,
307
+ update: secret
308
+ },
309
+ admin: {
310
+ description: 'Signs the body: X-Form-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>"> (admins only).'
311
+ }
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ name: 'whatsapp',
317
+ type: 'group',
318
+ fields: [
319
+ {
320
+ name: 'enabled',
321
+ type: 'checkbox',
322
+ defaultValue: false,
323
+ label: 'Build a WhatsApp link'
324
+ },
325
+ {
326
+ name: 'number',
327
+ type: 'text',
328
+ admin: {
329
+ condition: (_d, sibling)=>Boolean(sibling?.enabled),
330
+ description: 'Empty: the app\'s number.'
331
+ }
332
+ },
333
+ {
334
+ name: 'messageTemplate',
335
+ type: 'textarea',
336
+ admin: {
337
+ condition: (_d, sibling)=>Boolean(sibling?.enabled)
338
+ },
339
+ defaultValue: DEFAULT_WHATSAPP_TEMPLATE,
340
+ localized: true
341
+ },
342
+ {
343
+ name: 'rowTemplate',
344
+ type: 'text',
345
+ admin: {
346
+ condition: (_d, sibling)=>Boolean(sibling?.enabled)
347
+ },
348
+ defaultValue: DEFAULT_WHATSAPP_ROW_TEMPLATE,
349
+ localized: true
350
+ }
351
+ ],
352
+ label: 'WhatsApp'
353
+ }
354
+ ],
355
+ label: 'Delivery'
356
+ };
357
+ }
358
+ export function formsCollection(options, blocks, endpoints) {
359
+ return {
360
+ slug: options.slugs.forms,
361
+ access: {
362
+ create: loggedIn,
363
+ delete: loggedIn,
364
+ read: ({ req })=>req.user ? true : {
365
+ _status: {
366
+ equals: 'published'
367
+ }
368
+ },
369
+ update: loggedIn
370
+ },
371
+ admin: {
372
+ defaultColumns: [
373
+ 'title',
374
+ 'slug',
375
+ 'intakeState',
376
+ '_status',
377
+ 'updatedAt'
378
+ ],
379
+ group: 'Forms',
380
+ useAsTitle: 'title'
381
+ },
382
+ defaultPopulate: {
383
+ slug: true,
384
+ intakeState: true,
385
+ presentationMode: true,
386
+ sections: true,
387
+ successRedirectURL: true,
388
+ successType: true,
389
+ title: true,
390
+ wording: true
391
+ },
392
+ endpoints,
393
+ fields: [
394
+ {
395
+ name: 'title',
396
+ type: 'text',
397
+ localized: true,
398
+ required: true
399
+ },
400
+ slugField({
401
+ useAsSlug: 'title'
402
+ }),
403
+ {
404
+ type: 'tabs',
405
+ tabs: [
406
+ {
407
+ fields: [
408
+ {
409
+ type: 'row',
410
+ fields: [
411
+ {
412
+ name: 'presentationMode',
413
+ type: 'select',
414
+ admin: {
415
+ width: '50%'
416
+ },
417
+ dbName: 'pm',
418
+ defaultValue: 'singlePage',
419
+ options: [
420
+ {
421
+ label: 'Single page',
422
+ value: 'singlePage'
423
+ },
424
+ {
425
+ label: 'Step by step',
426
+ value: 'steps'
427
+ }
428
+ ],
429
+ required: true
430
+ },
431
+ {
432
+ name: 'intakeState',
433
+ type: 'select',
434
+ admin: {
435
+ width: '50%'
436
+ },
437
+ dbName: 'ist',
438
+ defaultValue: 'open',
439
+ options: [
440
+ {
441
+ label: 'Open',
442
+ value: 'open'
443
+ },
444
+ {
445
+ label: 'Closed',
446
+ value: 'closed'
447
+ }
448
+ ],
449
+ required: true
450
+ }
451
+ ]
452
+ },
453
+ {
454
+ name: 'sections',
455
+ type: 'array',
456
+ admin: {
457
+ initCollapsed: true
458
+ },
459
+ fields: [
460
+ {
461
+ type: 'row',
462
+ fields: [
463
+ {
464
+ name: 'key',
465
+ type: 'text',
466
+ admin: {
467
+ width: '40%'
468
+ },
469
+ required: true
470
+ },
471
+ {
472
+ name: 'title',
473
+ type: 'text',
474
+ admin: {
475
+ width: '60%'
476
+ },
477
+ localized: true
478
+ }
479
+ ]
480
+ },
481
+ {
482
+ name: 'description',
483
+ type: 'textarea',
484
+ localized: true
485
+ },
486
+ {
487
+ name: 'fields',
488
+ type: 'blocks',
489
+ admin: {
490
+ initCollapsed: true
491
+ },
492
+ blocks
493
+ },
494
+ ruleGroupField('visibilityRules', 'Show section when'),
495
+ nextStepRulesField()
496
+ ],
497
+ minRows: 1,
498
+ required: true
499
+ }
500
+ ],
501
+ label: 'Structure'
502
+ },
503
+ {
504
+ fields: [
505
+ {
506
+ name: 'successType',
507
+ type: 'radio',
508
+ dbName: 'st',
509
+ defaultValue: 'message',
510
+ options: [
511
+ {
512
+ label: 'Show the success words',
513
+ value: 'message'
514
+ },
515
+ {
516
+ label: 'Redirect',
517
+ value: 'redirect'
518
+ }
519
+ ]
520
+ },
521
+ {
522
+ name: 'successRedirectURL',
523
+ type: 'text',
524
+ admin: {
525
+ condition: (_d, sibling)=>sibling?.successType === 'redirect'
526
+ }
527
+ },
528
+ wordingField(options)
529
+ ],
530
+ label: 'Words'
531
+ },
532
+ {
533
+ fields: [
534
+ deliveryField(options)
535
+ ],
536
+ label: 'Delivery'
537
+ }
538
+ ]
539
+ }
540
+ ],
541
+ hooks: {
542
+ beforeValidate: [
543
+ validateFormBeforeSave(options)
544
+ ]
545
+ },
546
+ versions: {
547
+ drafts: true,
548
+ maxPerDoc: 20
549
+ }
550
+ };
551
+ }
552
+
553
+ //# sourceMappingURL=forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/forms.ts"],"sourcesContent":["import type { Block, CollectionConfig, Endpoint, Field } 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\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 {\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: { description: 'Signs the body: X-Form-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of \"<t>.<body>\"> (admins only).' },\n },\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","deliveryField","secret","isAdmin","access","read","initCollapsed","width","dbName","value","condition","_d","sibling","kind","max","min","create","update","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,QAAQ,eAAc;AACzD,SAASC,sBAAsB,QAAQ,2BAA0B;AACjE,SAASC,6BAA6B,EAAEC,yBAAyB,QAAQ,wBAAuB;AAChG,SAASC,SAAS,QAAQ,qBAAoB;AAC9C,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,kBAAiB;AAEpE,MAAMC,YAAoC;IACxCC,aAAa;IACbC,cAAc;IACdC,SAAS;IACTC,IAAI;IACJC,UAAU;IACVC,cAAc;IACdC,KAAK;AACP;AAEA,SAASC,aAAaC,OAAwB;IAC5C,OAAO;QACLC,MAAM;QACNC,MAAM;QACNC,OAAO;YAAE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iCACxC;4BACH;4BACA;gCACEpB,MAAM;gCACNC,MAAM;gCACNC,OAAO;oCAAEmB,WAAW,CAACC,IAAIC,UAAYA,SAAS2B,gBAAgB;gCAAW;4BAC3E;4BACApD,aAAaC;yBACd;wBACDY,OAAO;oBACT;oBACA;wBAAEP,QAAQ;4BAACQ,cAAcb;yBAAS;wBAAEY,OAAO;oBAAW;iBACvD;YACH;SACD;QACD6C,OAAO;YACLC,gBAAgB;gBAACzE,uBAAuBe;aAAS;QACnD;QACA2D,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;