@payloadcms/plugin-form-builder 1.0.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.
- package/README.md +220 -0
- package/dist/collections/FormSubmissions/hooks/createCharge.d.ts +3 -0
- package/dist/collections/FormSubmissions/hooks/createCharge.js +58 -0
- package/dist/collections/FormSubmissions/hooks/createCharge.js.map +1 -0
- package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts +3 -0
- package/dist/collections/FormSubmissions/hooks/sendEmail.js +152 -0
- package/dist/collections/FormSubmissions/hooks/sendEmail.js.map +1 -0
- package/dist/collections/FormSubmissions/index.d.ts +3 -0
- package/dist/collections/FormSubmissions/index.js +147 -0
- package/dist/collections/FormSubmissions/index.js.map +1 -0
- package/dist/collections/Forms/DynamicFieldSelector.d.ts +3 -0
- package/dist/collections/Forms/DynamicFieldSelector.js +66 -0
- package/dist/collections/Forms/DynamicFieldSelector.js.map +1 -0
- package/dist/collections/Forms/DynamicPriceSelector.d.ts +3 -0
- package/dist/collections/Forms/DynamicPriceSelector.js +81 -0
- package/dist/collections/Forms/DynamicPriceSelector.js.map +1 -0
- package/dist/collections/Forms/fields.d.ts +6 -0
- package/dist/collections/Forms/fields.js +457 -0
- package/dist/collections/Forms/fields.js.map +1 -0
- package/dist/collections/Forms/index.d.ts +3 -0
- package/dist/collections/Forms/index.js +212 -0
- package/dist/collections/Forms/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/mocks/serverModule.d.ts +2 -0
- package/dist/mocks/serverModule.js +4 -0
- package/dist/mocks/serverModule.js.map +1 -0
- package/dist/types.d.ts +160 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/getPaymentTotal.d.ts +4 -0
- package/dist/utilities/getPaymentTotal.js +44 -0
- package/dist/utilities/getPaymentTotal.js.map +1 -0
- package/dist/utilities/replaceDoubleCurlys.d.ts +7 -0
- package/dist/utilities/replaceDoubleCurlys.js +20 -0
- package/dist/utilities/replaceDoubleCurlys.js.map +1 -0
- package/dist/utilities/serializeRichText.d.ts +10 -0
- package/dist/utilities/serializeRichText.js +49 -0
- package/dist/utilities/serializeRichText.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.generateFormCollection = void 0;
|
|
27
|
+
var fields_1 = __importDefault(require("./fields"));
|
|
28
|
+
// all settings can be overridden by the config
|
|
29
|
+
var generateFormCollection = function (formConfig) {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
return ({
|
|
32
|
+
slug: ((_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _a === void 0 ? void 0 : _a.slug) || 'forms',
|
|
33
|
+
admin: {
|
|
34
|
+
useAsTitle: 'title',
|
|
35
|
+
enableRichTextRelationship: false,
|
|
36
|
+
},
|
|
37
|
+
access: __assign({ read: function () { return true; } }, ((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _b === void 0 ? void 0 : _b.access) || {}),
|
|
38
|
+
fields: __spreadArray([
|
|
39
|
+
{
|
|
40
|
+
name: 'title',
|
|
41
|
+
type: 'text',
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'fields',
|
|
46
|
+
type: 'blocks',
|
|
47
|
+
blocks: Object.entries((formConfig === null || formConfig === void 0 ? void 0 : formConfig.fields) || {}).map(function (_a) {
|
|
48
|
+
var fieldKey = _a[0], fieldConfig = _a[1];
|
|
49
|
+
// let the config enable/disable fields with either boolean values or objects
|
|
50
|
+
if (fieldConfig !== false) {
|
|
51
|
+
var block = fields_1.default[fieldKey];
|
|
52
|
+
if (typeof block === 'function') {
|
|
53
|
+
block = block(fieldConfig);
|
|
54
|
+
}
|
|
55
|
+
return block;
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}).filter(Boolean),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'submitButtonLabel',
|
|
62
|
+
type: 'text',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'confirmationType',
|
|
66
|
+
type: 'radio',
|
|
67
|
+
admin: {
|
|
68
|
+
description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
|
|
69
|
+
layout: 'horizontal',
|
|
70
|
+
},
|
|
71
|
+
options: [
|
|
72
|
+
{
|
|
73
|
+
label: 'Message',
|
|
74
|
+
value: 'message',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: 'Redirect',
|
|
78
|
+
value: 'redirect',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
defaultValue: 'message',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'confirmationMessage',
|
|
85
|
+
type: 'richText',
|
|
86
|
+
required: true,
|
|
87
|
+
admin: {
|
|
88
|
+
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'message'; },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'redirect',
|
|
93
|
+
type: 'group',
|
|
94
|
+
admin: {
|
|
95
|
+
hideGutter: true,
|
|
96
|
+
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'redirect'; },
|
|
97
|
+
},
|
|
98
|
+
fields: [
|
|
99
|
+
{
|
|
100
|
+
name: 'type',
|
|
101
|
+
type: 'radio',
|
|
102
|
+
options: [
|
|
103
|
+
{
|
|
104
|
+
label: 'Internal link',
|
|
105
|
+
value: 'reference',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'Custom URL',
|
|
109
|
+
value: 'custom',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
defaultValue: 'reference',
|
|
113
|
+
admin: {
|
|
114
|
+
layout: 'horizontal',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'reference',
|
|
119
|
+
label: 'Document to link to',
|
|
120
|
+
type: 'relationship',
|
|
121
|
+
relationTo: formConfig.redirectRelationships || [],
|
|
122
|
+
required: true,
|
|
123
|
+
maxDepth: 2,
|
|
124
|
+
admin: {
|
|
125
|
+
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'reference'; },
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'url',
|
|
130
|
+
label: 'Custom URL',
|
|
131
|
+
type: 'text',
|
|
132
|
+
required: true,
|
|
133
|
+
admin: {
|
|
134
|
+
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'custom'; },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'emails',
|
|
141
|
+
type: 'array',
|
|
142
|
+
admin: {
|
|
143
|
+
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}}.',
|
|
144
|
+
},
|
|
145
|
+
fields: [
|
|
146
|
+
{
|
|
147
|
+
type: 'row',
|
|
148
|
+
fields: [
|
|
149
|
+
{
|
|
150
|
+
type: 'text',
|
|
151
|
+
name: 'emailTo',
|
|
152
|
+
label: 'Email To',
|
|
153
|
+
required: true,
|
|
154
|
+
admin: {
|
|
155
|
+
width: '50%',
|
|
156
|
+
placeholder: 'Email Sender <sender@email.com>'
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
type: 'text',
|
|
161
|
+
name: 'emailFrom',
|
|
162
|
+
label: 'Email From',
|
|
163
|
+
admin: {
|
|
164
|
+
width: '50%',
|
|
165
|
+
placeholder: 'Email Recipient <{{email}}>',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'row',
|
|
172
|
+
fields: [
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
name: 'replyTo',
|
|
176
|
+
label: 'Reply To',
|
|
177
|
+
admin: {
|
|
178
|
+
width: '50%',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: 'text',
|
|
183
|
+
name: 'bcc',
|
|
184
|
+
label: 'BCC',
|
|
185
|
+
admin: {
|
|
186
|
+
width: '50%',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
type: 'text',
|
|
193
|
+
name: 'subject',
|
|
194
|
+
label: 'Subject',
|
|
195
|
+
defaultValue: 'You\'ve received a new message.',
|
|
196
|
+
required: true,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: 'richText',
|
|
200
|
+
name: 'message',
|
|
201
|
+
label: 'Message',
|
|
202
|
+
admin: {
|
|
203
|
+
description: 'Enter the message that should be sent in this email.',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
}
|
|
208
|
+
], ((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _c === void 0 ? void 0 : _c.fields) || [], true),
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
exports.generateFormCollection = generateFormCollection;
|
|
212
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oDAA8B;AAE9B,+CAA+C;AACxC,IAAM,sBAAsB,GAAG,UAAC,UAAsB;;IAAuB,OAAA,CAAC;QACnF,IAAI,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,0CAAE,IAAI,KAAI,OAAO;QAChD,KAAK,EAAE;YACL,UAAU,EAAE,OAAO;YACnB,0BAA0B,EAAE,KAAK;SAClC;QACD,MAAM,aACJ,IAAI,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI,IACb,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,0CAAE,MAAM,KAAI,EAAE,CAC3C;QACD,MAAM;YACJ;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,EAAE,CAAC,CAAC,GA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CACd,KAAK,EAAE;oCACL,KAAK,EAAE,KAAK;oCACZ,WAAW,EAAE,iCAAiC;iCAC/C;6BACF;4BACD;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;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,KAAK;wBACX,MAAM,EAAE;4BACN;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,SAAS;gCACf,KAAK,EAAE,UAAU;gCACjB,KAAK,EAAE;oCACL,KAAK,EAAE,KAAK;iCACb;6BACF;4BACD;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,KAAK;gCACX,KAAK,EAAE,KAAK;gCACZ,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,CAAC,CAAA;CAAA,CAAC;AAtLU,QAAA,sBAAsB,0BAsLhC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.getPaymentTotal = void 0;
|
|
24
|
+
var Forms_1 = require("./collections/Forms");
|
|
25
|
+
var FormSubmissions_1 = require("./collections/FormSubmissions");
|
|
26
|
+
// import path from 'path';
|
|
27
|
+
var getPaymentTotal_1 = require("./utilities/getPaymentTotal");
|
|
28
|
+
Object.defineProperty(exports, "getPaymentTotal", { enumerable: true, get: function () { return getPaymentTotal_1.getPaymentTotal; } });
|
|
29
|
+
var FormBuilder = function (incomingFormConfig) { return function (config) {
|
|
30
|
+
var formConfig = __assign(__assign({}, incomingFormConfig), { fields: __assign({ text: true, select: true, email: true, state: true, country: true, number: true, checkbox: true, message: true, payment: false }, incomingFormConfig.fields) });
|
|
31
|
+
return __assign(__assign({}, config), {
|
|
32
|
+
// admin: {
|
|
33
|
+
// ...config.admin,
|
|
34
|
+
// webpack: (webpackConfig) => ({
|
|
35
|
+
// ...webpackConfig,
|
|
36
|
+
// resolve: {
|
|
37
|
+
// ...webpackConfig.resolve,
|
|
38
|
+
// alias: {
|
|
39
|
+
// ...webpackConfig.resolve.alias,
|
|
40
|
+
// [path.resolve(__dirname, 'collections/FormSubmissions/hooks/sendEmail.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
|
|
41
|
+
// [path.resolve(__dirname, 'collections/FormSubmissions/hooks/createCharge.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
|
|
42
|
+
// },
|
|
43
|
+
// },
|
|
44
|
+
// })
|
|
45
|
+
// },
|
|
46
|
+
collections: __spreadArray(__spreadArray([], (config === null || config === void 0 ? void 0 : config.collections) || [], true), [
|
|
47
|
+
(0, Forms_1.generateFormCollection)(formConfig),
|
|
48
|
+
(0, FormSubmissions_1.generateSubmissionCollection)(formConfig),
|
|
49
|
+
], false) });
|
|
50
|
+
}; };
|
|
51
|
+
exports.default = FormBuilder;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,6CAA6D;AAC7D,iEAA6E;AAE7E,2BAA2B;AAE3B,+DAA6D;AAApD,kHAAA,eAAe,OAAA;AAExB,IAAM,WAAW,GAAG,UAAC,kBAA8B,IAAK,OAAA,UAAC,MAAc;IACrE,IAAM,UAAU,yBACX,kBAAkB,KACrB,MAAM,aACJ,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,IAAI,EACX,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,EAvCuD,CAuCvD,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverModule.js","sourceRoot":"","sources":["../../src/mocks/serverModule.js"],"names":[],"mappings":";;AAAA,kBAAe,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Block, CollectionConfig, Field } from 'payload/types';
|
|
2
|
+
export declare type BlockConfig = {
|
|
3
|
+
block: Block;
|
|
4
|
+
validate?: (value: unknown) => boolean | string;
|
|
5
|
+
};
|
|
6
|
+
export declare function isValidBlockConfig(blockConfig: BlockConfig | string): blockConfig is BlockConfig;
|
|
7
|
+
export declare type FieldValues = {
|
|
8
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare type PaymentFieldConfig = Partial<Field> & {
|
|
11
|
+
paymentProcessor: Partial<SelectField>;
|
|
12
|
+
};
|
|
13
|
+
export declare type FieldConfig = Partial<Field> | PaymentFieldConfig;
|
|
14
|
+
export declare type FieldsConfig = {
|
|
15
|
+
select?: boolean | FieldConfig;
|
|
16
|
+
text?: boolean | FieldConfig;
|
|
17
|
+
email?: boolean | FieldConfig;
|
|
18
|
+
state?: boolean | FieldConfig;
|
|
19
|
+
country?: boolean | FieldConfig;
|
|
20
|
+
checkbox?: boolean | FieldConfig;
|
|
21
|
+
number?: boolean | FieldConfig;
|
|
22
|
+
message?: boolean | FieldConfig;
|
|
23
|
+
payment?: boolean | FieldConfig;
|
|
24
|
+
};
|
|
25
|
+
export declare type BeforeEmail = (emails: FormattedEmail[]) => FormattedEmail[] | Promise<FormattedEmail[]>;
|
|
26
|
+
export declare type HandlePayment = (data: any) => void;
|
|
27
|
+
export declare type FormConfig = {
|
|
28
|
+
fields?: FieldsConfig;
|
|
29
|
+
formSubmissionOverrides?: Partial<CollectionConfig>;
|
|
30
|
+
formOverrides?: Partial<CollectionConfig>;
|
|
31
|
+
beforeEmail?: BeforeEmail;
|
|
32
|
+
handlePayment?: HandlePayment;
|
|
33
|
+
redirectRelationships?: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare type TextField = {
|
|
36
|
+
blockType: 'text';
|
|
37
|
+
blockName?: string;
|
|
38
|
+
width?: string;
|
|
39
|
+
name: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
defaultValue?: string;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare type SelectFieldOption = {
|
|
45
|
+
label: string;
|
|
46
|
+
value: string;
|
|
47
|
+
};
|
|
48
|
+
export declare type SelectField = {
|
|
49
|
+
blockType: 'select';
|
|
50
|
+
blockName?: string;
|
|
51
|
+
width?: string;
|
|
52
|
+
name: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
defaultValue?: string;
|
|
55
|
+
required?: boolean;
|
|
56
|
+
options: SelectFieldOption[];
|
|
57
|
+
};
|
|
58
|
+
export declare type PriceCondition = {
|
|
59
|
+
fieldToUse: string;
|
|
60
|
+
condition: 'equals' | 'notEquals' | 'hasValue';
|
|
61
|
+
valueForCondition: string;
|
|
62
|
+
operator: 'add' | 'subtract' | 'multiply' | 'divide';
|
|
63
|
+
valueType: 'static' | 'valueOfField';
|
|
64
|
+
valueForOperator: string | number;
|
|
65
|
+
};
|
|
66
|
+
export declare type PaymentField = {
|
|
67
|
+
blockType: 'payment';
|
|
68
|
+
blockName?: string;
|
|
69
|
+
width?: string;
|
|
70
|
+
name: string;
|
|
71
|
+
label?: string;
|
|
72
|
+
defaultValue?: string;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
paymentProcessor: string;
|
|
75
|
+
basePrice: number;
|
|
76
|
+
priceConditions: PriceCondition[];
|
|
77
|
+
};
|
|
78
|
+
export declare type EmailField = {
|
|
79
|
+
blockType: 'email';
|
|
80
|
+
blockName?: string;
|
|
81
|
+
width?: string;
|
|
82
|
+
name: string;
|
|
83
|
+
label?: string;
|
|
84
|
+
defaultValue?: string;
|
|
85
|
+
required?: boolean;
|
|
86
|
+
};
|
|
87
|
+
export declare type StateField = {
|
|
88
|
+
blockType: 'state';
|
|
89
|
+
blockName?: string;
|
|
90
|
+
width?: string;
|
|
91
|
+
name: string;
|
|
92
|
+
label?: string;
|
|
93
|
+
defaultValue?: string;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
};
|
|
96
|
+
export declare type CountryField = {
|
|
97
|
+
blockType: 'country';
|
|
98
|
+
blockName?: string;
|
|
99
|
+
width?: string;
|
|
100
|
+
name: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
defaultValue?: string;
|
|
103
|
+
required?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export declare type CheckboxField = {
|
|
106
|
+
blockType: 'checkbox';
|
|
107
|
+
blockName?: string;
|
|
108
|
+
width?: string;
|
|
109
|
+
name: string;
|
|
110
|
+
label?: string;
|
|
111
|
+
defaultValue?: boolean;
|
|
112
|
+
required?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export declare type MessageField = {
|
|
115
|
+
blockType: 'message';
|
|
116
|
+
blockName?: string;
|
|
117
|
+
message: unknown;
|
|
118
|
+
};
|
|
119
|
+
export declare type FormFieldBlock = TextField | SelectField | EmailField | StateField | CountryField | CheckboxField | MessageField | PaymentField;
|
|
120
|
+
export declare type Email = {
|
|
121
|
+
emailTo: string;
|
|
122
|
+
emailFrom: string;
|
|
123
|
+
bcc?: string;
|
|
124
|
+
replyTo?: string;
|
|
125
|
+
subject: string;
|
|
126
|
+
message?: any;
|
|
127
|
+
};
|
|
128
|
+
export declare type FormattedEmail = {
|
|
129
|
+
to: string;
|
|
130
|
+
from: string;
|
|
131
|
+
subject: string;
|
|
132
|
+
html: string;
|
|
133
|
+
replyTo: string;
|
|
134
|
+
};
|
|
135
|
+
export declare type Redirect = {
|
|
136
|
+
type: 'reference' | 'custom';
|
|
137
|
+
reference?: {
|
|
138
|
+
relationTo: string;
|
|
139
|
+
value: string | unknown;
|
|
140
|
+
};
|
|
141
|
+
url: string;
|
|
142
|
+
};
|
|
143
|
+
export declare type Form = {
|
|
144
|
+
id: string;
|
|
145
|
+
title: string;
|
|
146
|
+
fields: FormFieldBlock[];
|
|
147
|
+
submitButtonLabel?: string;
|
|
148
|
+
confirmationType: 'message' | 'redirect';
|
|
149
|
+
confirmationMessage?: any;
|
|
150
|
+
redirect?: Redirect;
|
|
151
|
+
emails: Email[];
|
|
152
|
+
};
|
|
153
|
+
export declare type SubmissionValue = {
|
|
154
|
+
field: string;
|
|
155
|
+
value: unknown;
|
|
156
|
+
};
|
|
157
|
+
export declare type FormSubmission = {
|
|
158
|
+
form: string | Form;
|
|
159
|
+
submissionData: SubmissionValue[];
|
|
160
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidBlockConfig = void 0;
|
|
4
|
+
function isValidBlockConfig(blockConfig) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
return typeof blockConfig !== 'string'
|
|
7
|
+
&& typeof ((_a = blockConfig === null || blockConfig === void 0 ? void 0 : blockConfig.block) === null || _a === void 0 ? void 0 : _a.slug) === 'string'
|
|
8
|
+
&& Array.isArray((_b = blockConfig === null || blockConfig === void 0 ? void 0 : blockConfig.block) === null || _b === void 0 ? void 0 : _b.fields);
|
|
9
|
+
}
|
|
10
|
+
exports.isValidBlockConfig = isValidBlockConfig;
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAOA,SAAgB,kBAAkB,CAAC,WAAiC;;IAClE,OAAO,OAAO,WAAW,KAAK,QAAQ;WACjC,OAAO,CAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,IAAI,CAAA,KAAK,QAAQ;WAC5C,KAAK,CAAC,OAAO,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAJD,gDAIC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPaymentTotal = void 0;
|
|
4
|
+
var getPaymentTotal = function (args) {
|
|
5
|
+
var _a = args.basePrice, basePrice = _a === void 0 ? 0 : _a, priceConditions = args.priceConditions, fieldValues = args.fieldValues;
|
|
6
|
+
var total = basePrice;
|
|
7
|
+
if (Array.isArray(priceConditions) && priceConditions.length > 0) {
|
|
8
|
+
priceConditions.forEach(function (priceCondition) {
|
|
9
|
+
var condition = priceCondition.condition, valueForCondition = priceCondition.valueForCondition, fieldToUse = priceCondition.fieldToUse, operator = priceCondition.operator, valueType = priceCondition.valueType, valueForOperator = priceCondition.valueForOperator;
|
|
10
|
+
var valueOfField = fieldValues === null || fieldValues === void 0 ? void 0 : fieldValues[fieldToUse];
|
|
11
|
+
if (valueOfField) {
|
|
12
|
+
if (condition === 'hasValue'
|
|
13
|
+
|| condition === 'equals' && valueOfField === valueForCondition
|
|
14
|
+
|| condition === 'notEquals' && valueOfField !== valueForCondition) {
|
|
15
|
+
var valueToUse = Number(valueType === 'valueOfField' ? valueOfField : valueForOperator);
|
|
16
|
+
switch (operator) {
|
|
17
|
+
case 'add': {
|
|
18
|
+
total += valueToUse;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
case 'subtract': {
|
|
22
|
+
total -= valueToUse;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'multiply': {
|
|
26
|
+
total *= valueToUse;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case 'divide': {
|
|
30
|
+
total /= valueToUse;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
default: {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return total;
|
|
42
|
+
};
|
|
43
|
+
exports.getPaymentTotal = getPaymentTotal;
|
|
44
|
+
//# sourceMappingURL=getPaymentTotal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPaymentTotal.js","sourceRoot":"","sources":["../../src/utilities/getPaymentTotal.ts"],"names":[],"mappings":";;;AAEO,IAAM,eAAe,GAAG,UAAC,IAE/B;IAEG,IAAA,KAGE,IAAI,UAHO,EAAb,SAAS,mBAAG,CAAC,KAAA,EACb,eAAe,GAEb,IAAI,gBAFS,EACf,WAAW,GACT,IAAI,YADK,CACJ;IAET,IAAI,KAAK,GAAG,SAAS,CAAC;IAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;QAChE,eAAe,CAAC,OAAO,CAAC,UAAC,cAA8B;YAEnD,IAAA,SAAS,GAMP,cAAc,UANP,EACT,iBAAiB,GAKf,cAAc,kBALC,EACjB,UAAU,GAIR,cAAc,WAJN,EACV,QAAQ,GAGN,cAAc,SAHR,EACR,SAAS,GAEP,cAAc,UAFP,EACT,gBAAgB,GACd,cAAc,iBADA,CACC;YAEnB,IAAM,YAAY,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,UAAU,CAAC,CAAC;YAE/C,IAAI,YAAY,EAAE;gBAChB,IACE,SAAS,KAAK,UAAU;uBACrB,SAAS,KAAK,QAAQ,IAAI,YAAY,KAAK,iBAAiB;uBAC5D,SAAS,KAAK,WAAW,IAAI,YAAY,KAAK,iBAAiB,EAClE;oBACA,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;oBAC1F,QAAQ,QAAQ,EAAE;wBAChB,KAAK,KAAK,CAAC,CAAC;4BACV,KAAK,IAAI,UAAU,CAAC;4BACpB,MAAM;yBACP;wBACD,KAAK,UAAU,CAAC,CAAC;4BACf,KAAK,IAAI,UAAU,CAAC;4BACpB,MAAM;yBACP;wBACD,KAAK,UAAU,CAAC,CAAC;4BACf,KAAK,IAAI,UAAU,CAAC;4BACpB,MAAM;yBACP;wBACD,KAAK,QAAQ,CAAC,CAAC;4BACb,KAAK,IAAI,UAAU,CAAC;4BACpB,MAAM;yBACP;wBACD,OAAO,CAAC,CAAC;4BACP,MAAM;yBACP;qBACF;iBACF;aACF;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAA;AA1DY,QAAA,eAAe,mBA0D3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceDoubleCurlys = void 0;
|
|
4
|
+
var replaceDoubleCurlys = function (str, variables) {
|
|
5
|
+
var regex = /{{(.+?)}}/g;
|
|
6
|
+
if (str && variables) {
|
|
7
|
+
return str.replace(regex, function (_, variable) {
|
|
8
|
+
var foundVariable = variables.find(function (_a) {
|
|
9
|
+
var fieldName = _a.field;
|
|
10
|
+
return variable === fieldName;
|
|
11
|
+
});
|
|
12
|
+
if (foundVariable)
|
|
13
|
+
return foundVariable.value;
|
|
14
|
+
return variable;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return str;
|
|
18
|
+
};
|
|
19
|
+
exports.replaceDoubleCurlys = replaceDoubleCurlys;
|
|
20
|
+
//# sourceMappingURL=replaceDoubleCurlys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceDoubleCurlys.js","sourceRoot":"","sources":["../../src/utilities/replaceDoubleCurlys.ts"],"names":[],"mappings":";;;AAOO,IAAM,mBAAmB,GAAG,UAAC,GAAW,EAAE,SAA0B;IACzE,IAAM,KAAK,GAAG,YAAY,CAAC;IAC3B,IAAI,GAAG,IAAI,SAAS,EAAE;QACpB,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,UAAC,CAAC,EAAE,QAAQ;YACpC,IAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,UAAC,EAAoB;oBAAX,SAAS,WAAA;gBAAO,OAAA,QAAQ,KAAK,SAAS;YAAtB,CAAsB,CAAC,CAAC;YACvF,IAAI,aAAa;gBAAE,OAAO,aAAa,CAAC,KAAK,CAAC;YAC9C,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAA;KACH;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAA;AAVY,QAAA,mBAAmB,uBAU/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Node = {
|
|
2
|
+
bold?: boolean;
|
|
3
|
+
code?: boolean;
|
|
4
|
+
italic?: boolean;
|
|
5
|
+
type?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
children?: Node[];
|
|
8
|
+
};
|
|
9
|
+
export declare const serialize: (children?: Node[] | undefined, submissionData?: any) => string | undefined;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
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.serialize = void 0;
|
|
7
|
+
var escape_html_1 = __importDefault(require("escape-html"));
|
|
8
|
+
var slate_1 = require("slate");
|
|
9
|
+
var replaceDoubleCurlys_1 = require("./replaceDoubleCurlys");
|
|
10
|
+
var serialize = function (children, submissionData) { return children === null || children === void 0 ? void 0 : children.map(function (node, i) {
|
|
11
|
+
if (slate_1.Text.isText(node)) {
|
|
12
|
+
var text = "<span>".concat((0, escape_html_1.default)((0, replaceDoubleCurlys_1.replaceDoubleCurlys)(node.text, submissionData)), "</span>");
|
|
13
|
+
if (node.bold) {
|
|
14
|
+
text = ("\n <strong>\n ".concat(text, "\n </strong>\n "));
|
|
15
|
+
}
|
|
16
|
+
if (node.code) {
|
|
17
|
+
text = ("\n <code>\n ".concat(text, "\n </code>\n "));
|
|
18
|
+
}
|
|
19
|
+
if (node.italic) {
|
|
20
|
+
text = ("\n <em >\n ".concat(text, "\n </em>\n "));
|
|
21
|
+
}
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
if (!node) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
switch (node.type) {
|
|
28
|
+
case 'h1':
|
|
29
|
+
return ("\n <h1>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </h1>\n "));
|
|
30
|
+
case 'h6':
|
|
31
|
+
return ("\n <h6>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </h6>\n "));
|
|
32
|
+
case 'quote':
|
|
33
|
+
return ("\n <blockquote>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </blockquote>\n "));
|
|
34
|
+
case 'ul':
|
|
35
|
+
return ("\n <ul>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </ul>\n "));
|
|
36
|
+
case 'ol':
|
|
37
|
+
return ("\n <ol>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </ol>\n "));
|
|
38
|
+
case 'li':
|
|
39
|
+
return ("\n <li>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </li>\n "));
|
|
40
|
+
case 'indent':
|
|
41
|
+
return ("\n <p style=\"padding-left: 20px\">\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </p>\n "));
|
|
42
|
+
case 'link':
|
|
43
|
+
return ("\n <a href={".concat((0, escape_html_1.default)(node.url), "}>\n ").concat((0, exports.serialize)(node.children, submissionData), "\n </a>\n "));
|
|
44
|
+
default:
|
|
45
|
+
return ("\n <p>\n ".concat((0, exports.serialize)(node.children, submissionData), "\n </p>\n "));
|
|
46
|
+
}
|
|
47
|
+
}).filter(Boolean).join(''); };
|
|
48
|
+
exports.serialize = serialize;
|
|
49
|
+
//# sourceMappingURL=serializeRichText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializeRichText.js","sourceRoot":"","sources":["../../src/utilities/serializeRichText.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAqC;AACrC,+BAA6B;AAC7B,6DAA4D;AAWrD,IAAM,SAAS,GAAG,UAAC,QAAiB,EAAE,cAAoB,IAAyB,OAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,UAAC,IAAU,EAAE,CAAC;IACpH,IAAI,YAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACrB,IAAI,IAAI,GAAG,gBAAS,IAAA,qBAAU,EAAC,IAAA,yCAAmB,EAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,YAAS,CAAC;QAExF,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,GAAG,CAAC,wCAEF,IAAI,gCAET,CAAC,CAAC;SACJ;QAED,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,GAAG,CAAC,sCAEF,IAAI,8BAET,CAAC,CAAC;SACJ;QAED,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,GAAG,CAAC,qCAEF,IAAI,4BAET,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,IAAI;YACP,OAAO,CAAC,oCAEF,IAAA,iBAAS,EAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,4BAE7C,CAAC,CAAC;QACL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