@payloadcms/plugin-seo 1.0.1 → 1.0.2

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 (48) hide show
  1. package/dist/collections/FormSubmissions/hooks/createCharge.d.ts +3 -0
  2. package/dist/collections/FormSubmissions/hooks/createCharge.js +53 -0
  3. package/dist/collections/FormSubmissions/hooks/createCharge.js.map +1 -0
  4. package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts +3 -0
  5. package/dist/collections/FormSubmissions/hooks/sendEmail.js +151 -0
  6. package/dist/collections/FormSubmissions/hooks/sendEmail.js.map +1 -0
  7. package/dist/collections/FormSubmissions/index.d.ts +3 -0
  8. package/dist/collections/FormSubmissions/index.js +137 -0
  9. package/dist/collections/FormSubmissions/index.js.map +1 -0
  10. package/dist/collections/Forms/DynamicFieldSelector.d.ts +3 -0
  11. package/dist/collections/Forms/DynamicFieldSelector.js +62 -0
  12. package/dist/collections/Forms/DynamicFieldSelector.js.map +1 -0
  13. package/dist/collections/Forms/DynamicPriceSelector.d.ts +3 -0
  14. package/dist/collections/Forms/DynamicPriceSelector.js +76 -0
  15. package/dist/collections/Forms/DynamicPriceSelector.js.map +1 -0
  16. package/dist/collections/Forms/fields.d.ts +6 -0
  17. package/dist/collections/Forms/fields.js +481 -0
  18. package/dist/collections/Forms/fields.js.map +1 -0
  19. package/dist/collections/Forms/index.d.ts +3 -0
  20. package/dist/collections/Forms/index.js +194 -0
  21. package/dist/collections/Forms/index.js.map +1 -0
  22. package/dist/fields/MetaImage.js +1 -2
  23. package/dist/fields/MetaImage.js.map +1 -1
  24. package/dist/mocks/serverModule.d.ts +2 -0
  25. package/dist/mocks/serverModule.js +4 -0
  26. package/dist/mocks/serverModule.js.map +1 -0
  27. package/dist/utilities/deepMerge.d.ts +2 -0
  28. package/dist/utilities/deepMerge.js +44 -0
  29. package/dist/utilities/deepMerge.js.map +1 -0
  30. package/dist/utilities/generateMetaDescription.d.ts +2 -0
  31. package/dist/utilities/generateMetaDescription.js +57 -0
  32. package/dist/utilities/generateMetaDescription.js.map +1 -0
  33. package/dist/utilities/generateMetaImage.d.ts +2 -0
  34. package/dist/utilities/generateMetaImage.js +14 -0
  35. package/dist/utilities/generateMetaImage.js.map +1 -0
  36. package/dist/utilities/generateMetaTitle.d.ts +2 -0
  37. package/dist/utilities/generateMetaTitle.js +74 -0
  38. package/dist/utilities/generateMetaTitle.js.map +1 -0
  39. package/dist/utilities/replaceDoubleCurlys.d.ts +7 -0
  40. package/dist/utilities/replaceDoubleCurlys.js +20 -0
  41. package/dist/utilities/replaceDoubleCurlys.js.map +1 -0
  42. package/dist/utilities/serializeRichText.d.ts +10 -0
  43. package/dist/utilities/serializeRichText.js +49 -0
  44. package/dist/utilities/serializeRichText.js.map +1 -0
  45. package/dist/utilities/stringifyRichText.d.ts +3 -0
  46. package/dist/utilities/stringifyRichText.js +16 -0
  47. package/dist/utilities/stringifyRichText.js.map +1 -0
  48. package/package.json +5 -6
@@ -0,0 +1,481 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var DynamicFieldSelector_1 = require("./DynamicFieldSelector");
15
+ var DynamicPriceSelector_1 = require("./DynamicPriceSelector");
16
+ var name = {
17
+ name: 'name',
18
+ label: 'Name (lowercase, no special characters)',
19
+ type: 'text',
20
+ required: true,
21
+ };
22
+ var label = {
23
+ name: 'label',
24
+ label: 'Label',
25
+ type: 'text',
26
+ required: true,
27
+ };
28
+ var required = {
29
+ name: 'required',
30
+ label: 'Required',
31
+ type: 'checkbox',
32
+ };
33
+ var width = {
34
+ name: 'width',
35
+ label: 'Field Width (percentage)',
36
+ type: 'number',
37
+ };
38
+ var Select = {
39
+ slug: 'select',
40
+ labels: {
41
+ singular: 'Select',
42
+ plural: 'Select Fields',
43
+ },
44
+ fields: [
45
+ {
46
+ type: 'row',
47
+ fields: [
48
+ __assign(__assign({}, name), { admin: {
49
+ width: '50%',
50
+ } }),
51
+ __assign(__assign({}, label), { admin: {
52
+ width: '50%',
53
+ } }),
54
+ ],
55
+ },
56
+ {
57
+ type: 'row',
58
+ fields: [
59
+ __assign(__assign({}, width), { admin: {
60
+ width: '50%',
61
+ } }),
62
+ {
63
+ name: 'defaultValue',
64
+ label: 'Default Value',
65
+ type: 'text',
66
+ admin: {
67
+ width: '50%',
68
+ },
69
+ },
70
+ ],
71
+ },
72
+ {
73
+ name: 'options',
74
+ label: 'Select Attribute Options',
75
+ type: 'array',
76
+ labels: {
77
+ singular: 'Option',
78
+ plural: 'Options',
79
+ },
80
+ fields: [
81
+ {
82
+ type: 'row',
83
+ fields: [
84
+ {
85
+ name: 'label',
86
+ label: 'Label',
87
+ type: 'text',
88
+ required: true,
89
+ admin: {
90
+ width: '50%',
91
+ },
92
+ },
93
+ {
94
+ name: 'value',
95
+ label: 'Value',
96
+ type: 'text',
97
+ required: true,
98
+ admin: {
99
+ width: '50%',
100
+ },
101
+ },
102
+ ],
103
+ },
104
+ ],
105
+ },
106
+ required,
107
+ ],
108
+ };
109
+ var Text = {
110
+ slug: 'text',
111
+ labels: {
112
+ singular: 'Text',
113
+ plural: 'Text Fields',
114
+ },
115
+ fields: [
116
+ {
117
+ type: 'row',
118
+ fields: [
119
+ __assign(__assign({}, name), { admin: {
120
+ width: '50%',
121
+ } }),
122
+ __assign(__assign({}, label), { admin: {
123
+ width: '50%',
124
+ } }),
125
+ ],
126
+ },
127
+ {
128
+ type: 'row',
129
+ fields: [
130
+ __assign(__assign({}, width), { admin: {
131
+ width: '50%',
132
+ } }),
133
+ {
134
+ name: 'defaultValue',
135
+ label: 'Default Value',
136
+ type: 'text',
137
+ admin: {
138
+ width: '50%',
139
+ },
140
+ },
141
+ ],
142
+ },
143
+ required,
144
+ ],
145
+ };
146
+ var Number = {
147
+ slug: 'number',
148
+ labels: {
149
+ singular: 'Number',
150
+ plural: 'Number Fields',
151
+ },
152
+ fields: [
153
+ {
154
+ type: 'row',
155
+ fields: [
156
+ __assign(__assign({}, name), { admin: {
157
+ width: '50%',
158
+ } }),
159
+ __assign(__assign({}, label), { admin: {
160
+ width: '50%',
161
+ } }),
162
+ ],
163
+ },
164
+ {
165
+ type: 'row',
166
+ fields: [
167
+ __assign(__assign({}, width), { admin: {
168
+ width: '50%',
169
+ } }),
170
+ {
171
+ name: 'defaultValue',
172
+ label: 'Default Value',
173
+ type: 'number',
174
+ admin: {
175
+ width: '50%',
176
+ },
177
+ },
178
+ ],
179
+ },
180
+ required,
181
+ ],
182
+ };
183
+ var Email = {
184
+ slug: 'email',
185
+ labels: {
186
+ singular: 'Email',
187
+ plural: 'Email Fields',
188
+ },
189
+ fields: [
190
+ {
191
+ type: 'row',
192
+ fields: [
193
+ __assign(__assign({}, name), { admin: {
194
+ width: '50%',
195
+ } }),
196
+ __assign(__assign({}, label), { admin: {
197
+ width: '50%',
198
+ } }),
199
+ ],
200
+ },
201
+ width,
202
+ required,
203
+ ],
204
+ };
205
+ var State = {
206
+ slug: 'state',
207
+ labels: {
208
+ singular: 'State',
209
+ plural: 'State Fields',
210
+ },
211
+ fields: [
212
+ {
213
+ type: 'row',
214
+ fields: [
215
+ __assign(__assign({}, name), { admin: {
216
+ width: '50%',
217
+ } }),
218
+ __assign(__assign({}, label), { admin: {
219
+ width: '50%',
220
+ } }),
221
+ ],
222
+ },
223
+ width,
224
+ required,
225
+ ],
226
+ };
227
+ var Country = {
228
+ slug: 'country',
229
+ labels: {
230
+ singular: 'Country',
231
+ plural: 'Country Fields',
232
+ },
233
+ fields: [
234
+ {
235
+ type: 'row',
236
+ fields: [
237
+ __assign(__assign({}, name), { admin: {
238
+ width: '50%',
239
+ } }),
240
+ __assign(__assign({}, label), { admin: {
241
+ width: '50%',
242
+ } }),
243
+ ],
244
+ },
245
+ width,
246
+ required,
247
+ ],
248
+ };
249
+ var Checkbox = {
250
+ slug: 'checkbox',
251
+ labels: {
252
+ singular: 'Checkbox',
253
+ plural: 'Checkbox Fields',
254
+ },
255
+ fields: [
256
+ {
257
+ type: 'row',
258
+ fields: [
259
+ __assign(__assign({}, name), { admin: {
260
+ width: '50%',
261
+ } }),
262
+ __assign(__assign({}, label), { admin: {
263
+ width: '50%',
264
+ } }),
265
+ ],
266
+ },
267
+ {
268
+ type: 'row',
269
+ fields: [
270
+ __assign(__assign({}, width), { admin: {
271
+ width: '50%',
272
+ } }),
273
+ __assign(__assign({}, required), { admin: {
274
+ width: '50%',
275
+ } }),
276
+ ],
277
+ },
278
+ {
279
+ name: 'defaultValue',
280
+ label: 'Default Value',
281
+ type: 'checkbox',
282
+ },
283
+ ],
284
+ };
285
+ var Payment = function (fieldConfig) {
286
+ var paymentProcessorField = null;
287
+ if (fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.paymentProcessor) {
288
+ paymentProcessorField = __assign({ type: 'select', options: [], name: 'paymentProcessor', label: 'Payment Processor' }, fieldConfig.paymentProcessor);
289
+ }
290
+ return ({
291
+ slug: 'payment',
292
+ labels: {
293
+ singular: 'Payment',
294
+ plural: 'Payment Fields',
295
+ },
296
+ fields: [
297
+ {
298
+ type: 'row',
299
+ fields: [
300
+ __assign(__assign({}, label), { admin: {
301
+ width: '50%',
302
+ } }),
303
+ __assign(__assign({}, width), { admin: {
304
+ width: '50%',
305
+ } }),
306
+ ],
307
+ },
308
+ {
309
+ type: 'row',
310
+ fields: [
311
+ paymentProcessorField,
312
+ {
313
+ name: 'priceType',
314
+ label: 'Price Type',
315
+ type: 'radio',
316
+ admin: {
317
+ width: '100%',
318
+ },
319
+ defaultValue: 'static',
320
+ options: [
321
+ {
322
+ label: 'Static Price',
323
+ value: 'static'
324
+ },
325
+ {
326
+ label: 'Dynamic Price',
327
+ value: 'dynamic'
328
+ }
329
+ ]
330
+ },
331
+ {
332
+ name: 'staticPrice',
333
+ type: 'number',
334
+ label: 'Price',
335
+ admin: {
336
+ condition: function (_, _a) {
337
+ var priceType = _a.priceType;
338
+ return priceType === 'static';
339
+ }
340
+ },
341
+ },
342
+ {
343
+ name: 'dynamicPrice',
344
+ labels: {
345
+ singular: 'Condition',
346
+ plural: 'Conditions',
347
+ },
348
+ type: 'array',
349
+ label: 'Price',
350
+ admin: {
351
+ condition: function (_, _a) {
352
+ var priceType = _a.priceType;
353
+ return priceType === 'dynamic';
354
+ }
355
+ },
356
+ fields: [
357
+ {
358
+ name: 'fieldToUse',
359
+ type: 'text',
360
+ admin: {
361
+ components: {
362
+ Field: DynamicFieldSelector_1.DynamicFieldSelector,
363
+ },
364
+ },
365
+ },
366
+ {
367
+ name: 'condition',
368
+ label: 'Condition',
369
+ type: 'select',
370
+ defaultValue: 'hasValue',
371
+ options: [
372
+ {
373
+ value: 'hasValue',
374
+ label: 'Has Any Value'
375
+ },
376
+ {
377
+ value: 'equals',
378
+ label: 'Equals'
379
+ },
380
+ {
381
+ value: 'notEquals',
382
+ label: 'Does Not Equal'
383
+ }
384
+ ]
385
+ },
386
+ {
387
+ name: 'valueForCondition',
388
+ label: 'Value',
389
+ type: 'text',
390
+ admin: {
391
+ condition: function (_, _a) {
392
+ var condition = _a.condition;
393
+ return condition === 'equals' || condition === 'notEquals';
394
+ }
395
+ }
396
+ },
397
+ {
398
+ name: 'operator',
399
+ type: 'select',
400
+ defaultValue: 'add',
401
+ options: [
402
+ {
403
+ value: 'add',
404
+ label: 'Add'
405
+ },
406
+ {
407
+ value: 'subtract',
408
+ label: 'Subtract'
409
+ },
410
+ {
411
+ value: 'multiply',
412
+ label: 'Multiply'
413
+ },
414
+ {
415
+ value: 'divide',
416
+ label: 'Divide'
417
+ }
418
+ ]
419
+ },
420
+ {
421
+ name: 'valueType',
422
+ label: 'Value Type',
423
+ type: 'radio',
424
+ admin: {
425
+ width: '100%',
426
+ },
427
+ defaultValue: 'static',
428
+ options: [
429
+ {
430
+ label: 'Static Value',
431
+ value: 'static'
432
+ },
433
+ {
434
+ label: 'Dynamic Value',
435
+ value: 'dynamic'
436
+ }
437
+ ]
438
+ },
439
+ {
440
+ name: 'valueForOperator',
441
+ label: 'Value',
442
+ type: 'text',
443
+ admin: {
444
+ components: {
445
+ Field: DynamicPriceSelector_1.DynamicPriceSelector,
446
+ },
447
+ },
448
+ },
449
+ ]
450
+ },
451
+ ].filter(Boolean),
452
+ },
453
+ required,
454
+ ]
455
+ });
456
+ };
457
+ var Message = {
458
+ slug: 'message',
459
+ labels: {
460
+ singular: 'Message',
461
+ plural: 'Message Blocks',
462
+ },
463
+ fields: [
464
+ {
465
+ name: 'message',
466
+ type: 'richText',
467
+ },
468
+ ],
469
+ };
470
+ exports.default = {
471
+ select: Select,
472
+ checkbox: Checkbox,
473
+ text: Text,
474
+ email: Email,
475
+ message: Message,
476
+ number: Number,
477
+ country: Country,
478
+ state: State,
479
+ payment: Payment
480
+ };
481
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/collections/Forms/fields.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,+DAA8D;AAC9D,+DAA8D;AAE9D,IAAM,IAAI,GAAU;IAClB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,yCAAyC;IAChD,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,IAAM,KAAK,GAAU;IACnB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,IAAM,QAAQ,GAAU;IACtB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,IAAM,KAAK,GAAU;IACnB,IAAI,EAAE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ACf,IAAI,EAAE,UAAU;SACjB;KACF;CACF,CAAC;AAEF,kBAAe;IACb,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,OAAO;CAGjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CollectionConfig } from 'payload/types';
2
+ import { FormConfig } from '../../types';
3
+ export declare const generateFormCollection: (formConfig: FormConfig) => CollectionConfig;
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateFormCollection = void 0;
7
+ var fields_1 = __importDefault(require("./fields"));
8
+ var deepMerge_1 = __importDefault(require("../../utilities/deepMerge"));
9
+ // all settings can be overridden by the config
10
+ var generateFormCollection = function (formConfig) {
11
+ var _a;
12
+ return (0, deepMerge_1.default)({
13
+ slug: ((_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _a === void 0 ? void 0 : _a.slug) || 'forms',
14
+ admin: {
15
+ useAsTitle: 'title',
16
+ enableRichTextRelationship: false,
17
+ },
18
+ access: {
19
+ read: function () { return true; },
20
+ },
21
+ fields: [
22
+ {
23
+ name: 'title',
24
+ type: 'text',
25
+ required: true,
26
+ },
27
+ {
28
+ name: 'fields',
29
+ type: 'blocks',
30
+ blocks: Object.entries((formConfig === null || formConfig === void 0 ? void 0 : formConfig.fields) || {}).map(function (_a) {
31
+ var fieldKey = _a[0], fieldConfig = _a[1];
32
+ // let the config enable/disable fields with either boolean values or objects
33
+ if (fieldConfig !== false) {
34
+ var block = fields_1.default[fieldKey];
35
+ if (typeof block === 'function') {
36
+ block = block(fieldConfig);
37
+ }
38
+ return block;
39
+ }
40
+ return null;
41
+ }).filter(Boolean),
42
+ },
43
+ {
44
+ name: 'submitButtonLabel',
45
+ type: 'text',
46
+ },
47
+ {
48
+ name: 'confirmationType',
49
+ type: 'radio',
50
+ admin: {
51
+ description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
52
+ layout: 'horizontal',
53
+ },
54
+ options: [
55
+ {
56
+ label: 'Message',
57
+ value: 'message',
58
+ },
59
+ {
60
+ label: 'Redirect',
61
+ value: 'redirect',
62
+ },
63
+ ],
64
+ defaultValue: 'message',
65
+ },
66
+ {
67
+ name: 'confirmationMessage',
68
+ type: 'richText',
69
+ required: true,
70
+ admin: {
71
+ condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'message'; },
72
+ },
73
+ },
74
+ {
75
+ name: 'redirect',
76
+ type: 'group',
77
+ admin: {
78
+ hideGutter: true,
79
+ condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'redirect'; },
80
+ },
81
+ fields: [
82
+ {
83
+ name: 'type',
84
+ type: 'radio',
85
+ options: [
86
+ {
87
+ label: 'Internal link',
88
+ value: 'reference',
89
+ },
90
+ {
91
+ label: 'Custom URL',
92
+ value: 'custom',
93
+ },
94
+ ],
95
+ defaultValue: 'reference',
96
+ admin: {
97
+ layout: 'horizontal',
98
+ },
99
+ },
100
+ {
101
+ name: 'reference',
102
+ label: 'Document to link to',
103
+ type: 'relationship',
104
+ relationTo: formConfig.redirectRelationships || [],
105
+ required: true,
106
+ maxDepth: 2,
107
+ admin: {
108
+ condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'reference'; },
109
+ },
110
+ },
111
+ {
112
+ name: 'url',
113
+ label: 'Custom URL',
114
+ type: 'text',
115
+ required: true,
116
+ admin: {
117
+ condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'custom'; },
118
+ },
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ name: 'emails',
124
+ type: 'array',
125
+ admin: {
126
+ description: 'Send custom emails when the form submits. Use comma separated lists to send the same email to multiple recipients. To reference a value from this form, wrap that field\'s name with double curly brackets, i.e. {{firstName}}.',
127
+ },
128
+ fields: [
129
+ {
130
+ type: 'row',
131
+ fields: [
132
+ {
133
+ type: 'text',
134
+ name: 'emailTo',
135
+ label: 'Email To',
136
+ required: true,
137
+ admin: {
138
+ width: '50%',
139
+ },
140
+ },
141
+ {
142
+ type: 'text',
143
+ name: 'emailFrom',
144
+ label: 'Email From',
145
+ admin: {
146
+ width: '50%',
147
+ placeholder: '{{email}}',
148
+ },
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ type: 'row',
154
+ fields: [
155
+ {
156
+ type: 'text',
157
+ name: 'replyTo',
158
+ label: 'Reply To',
159
+ admin: {
160
+ width: '50%',
161
+ },
162
+ },
163
+ {
164
+ type: 'text',
165
+ name: 'bcc',
166
+ label: 'BCC',
167
+ admin: {
168
+ width: '50%',
169
+ },
170
+ },
171
+ ],
172
+ },
173
+ {
174
+ type: 'text',
175
+ name: 'subject',
176
+ label: 'Subject',
177
+ defaultValue: 'You\'ve received a new message.',
178
+ required: true,
179
+ },
180
+ {
181
+ type: 'richText',
182
+ name: 'message',
183
+ label: 'Message',
184
+ admin: {
185
+ description: 'Enter the email message that should be sent in this email.',
186
+ },
187
+ },
188
+ ],
189
+ },
190
+ ],
191
+ }, formConfig.formOverrides || {});
192
+ };
193
+ exports.generateFormCollection = generateFormCollection;
194
+ //# sourceMappingURL=index.js.map