@payloadcms/plugin-form-builder 1.0.14-canary.0 → 1.0.14
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/package.json +1 -1
- package/dist/collections/FormSubmissions/hooks/createCharge.d.ts +0 -3
- package/dist/collections/FormSubmissions/hooks/createCharge.js +0 -58
- package/dist/collections/FormSubmissions/hooks/createCharge.js.map +0 -1
- package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts +0 -3
- package/dist/collections/FormSubmissions/hooks/sendEmail.js +0 -131
- package/dist/collections/FormSubmissions/hooks/sendEmail.js.map +0 -1
- package/dist/collections/FormSubmissions/index.d.ts +0 -3
- package/dist/collections/FormSubmissions/index.js +0 -139
- package/dist/collections/FormSubmissions/index.js.map +0 -1
- package/dist/collections/Forms/DynamicFieldSelector.d.ts +0 -3
- package/dist/collections/Forms/DynamicFieldSelector.js +0 -66
- package/dist/collections/Forms/DynamicFieldSelector.js.map +0 -1
- package/dist/collections/Forms/DynamicPriceSelector.d.ts +0 -3
- package/dist/collections/Forms/DynamicPriceSelector.js +0 -87
- package/dist/collections/Forms/DynamicPriceSelector.js.map +0 -1
- package/dist/collections/Forms/fields.d.ts +0 -6
- package/dist/collections/Forms/fields.js +0 -503
- package/dist/collections/Forms/fields.js.map +0 -1
- package/dist/collections/Forms/index.d.ts +0 -3
- package/dist/collections/Forms/index.js +0 -233
- package/dist/collections/Forms/index.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -55
- package/dist/index.js.map +0 -1
- package/dist/mocks/serverModule.d.ts +0 -2
- package/dist/mocks/serverModule.js +0 -4
- package/dist/mocks/serverModule.js.map +0 -1
- package/dist/types.d.ts +0 -174
- package/dist/types.js +0 -11
- package/dist/types.js.map +0 -1
- package/dist/utilities/calculatePaymentTotal.d.ts +0 -4
- package/dist/utilities/calculatePaymentTotal.js +0 -47
- package/dist/utilities/calculatePaymentTotal.js.map +0 -1
- package/dist/utilities/deepMerge.d.ts +0 -2
- package/dist/utilities/deepMerge.js +0 -44
- package/dist/utilities/deepMerge.js.map +0 -1
- package/dist/utilities/getPaymentTotal.d.ts +0 -4
- package/dist/utilities/getPaymentTotal.js +0 -44
- package/dist/utilities/getPaymentTotal.js.map +0 -1
- package/dist/utilities/replaceDoubleCurlys.d.ts +0 -7
- package/dist/utilities/replaceDoubleCurlys.js +0 -20
- package/dist/utilities/replaceDoubleCurlys.js.map +0 -1
- package/dist/utilities/serializeRichText.d.ts +0 -10
- package/dist/utilities/serializeRichText.js +0 -51
- package/dist/utilities/serializeRichText.js.map +0 -1
|
@@ -1,233 +0,0 @@
|
|
|
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 deepmerge_1 = __importDefault(require("deepmerge"));
|
|
28
|
-
var fields_1 = require("./fields");
|
|
29
|
-
// all settings can be overridden by the config
|
|
30
|
-
var generateFormCollection = function (formConfig) {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
|
-
var redirect = {
|
|
33
|
-
name: 'redirect',
|
|
34
|
-
type: 'group',
|
|
35
|
-
admin: {
|
|
36
|
-
hideGutter: true,
|
|
37
|
-
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'redirect'; },
|
|
38
|
-
},
|
|
39
|
-
fields: [
|
|
40
|
-
{
|
|
41
|
-
name: 'url',
|
|
42
|
-
label: 'URL to redirect to',
|
|
43
|
-
type: 'text',
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
};
|
|
48
|
-
if (formConfig.redirectRelationships) {
|
|
49
|
-
redirect.fields.unshift({
|
|
50
|
-
name: 'reference',
|
|
51
|
-
label: 'Document to link to',
|
|
52
|
-
type: 'relationship',
|
|
53
|
-
relationTo: formConfig.redirectRelationships,
|
|
54
|
-
required: true,
|
|
55
|
-
maxDepth: 2,
|
|
56
|
-
admin: {
|
|
57
|
-
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'reference'; },
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
redirect.fields.unshift({
|
|
61
|
-
name: 'type',
|
|
62
|
-
type: 'radio',
|
|
63
|
-
options: [
|
|
64
|
-
{
|
|
65
|
-
label: 'Internal link',
|
|
66
|
-
value: 'reference',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
label: 'Custom URL',
|
|
70
|
-
value: 'custom',
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
defaultValue: 'reference',
|
|
74
|
-
admin: {
|
|
75
|
-
layout: 'horizontal',
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
if (redirect.fields[2].type !== 'row')
|
|
79
|
-
redirect.fields[2].label = 'Custom URL';
|
|
80
|
-
redirect.fields[2].admin = {
|
|
81
|
-
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.type) === 'custom'; },
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
var config = __assign(__assign({}, ((formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) || {})), { slug: ((_a = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _a === void 0 ? void 0 : _a.slug) || 'forms', admin: __assign({ useAsTitle: 'title', enableRichTextRelationship: false }, (((_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _b === void 0 ? void 0 : _b.admin) || {})), access: __assign({ read: function () { return true; } }, (((_c = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _c === void 0 ? void 0 : _c.access) || {})), fields: __spreadArray([
|
|
85
|
-
{
|
|
86
|
-
name: 'title',
|
|
87
|
-
type: 'text',
|
|
88
|
-
required: true,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'fields',
|
|
92
|
-
type: 'blocks',
|
|
93
|
-
blocks: Object.entries((formConfig === null || formConfig === void 0 ? void 0 : formConfig.fields) || {})
|
|
94
|
-
.map(function (_a) {
|
|
95
|
-
var fieldKey = _a[0], fieldConfig = _a[1];
|
|
96
|
-
// let the config enable/disable fields with either boolean values or objects
|
|
97
|
-
if (fieldConfig !== false) {
|
|
98
|
-
var block = fields_1.fields[fieldKey];
|
|
99
|
-
if (block === undefined && typeof fieldConfig === 'object') {
|
|
100
|
-
return fieldConfig;
|
|
101
|
-
}
|
|
102
|
-
if (typeof block === 'object' && typeof fieldConfig === 'object') {
|
|
103
|
-
return (0, deepmerge_1.default)(block, fieldConfig, {
|
|
104
|
-
arrayMerge: function (_, sourceArray) { return sourceArray; },
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (typeof block === 'function') {
|
|
108
|
-
return block(fieldConfig);
|
|
109
|
-
}
|
|
110
|
-
return block;
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
})
|
|
114
|
-
.filter(Boolean),
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'submitButtonLabel',
|
|
118
|
-
type: 'text',
|
|
119
|
-
localized: true,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: 'confirmationType',
|
|
123
|
-
type: 'radio',
|
|
124
|
-
admin: {
|
|
125
|
-
description: 'Choose whether to display an on-page message or redirect to a different page after they submit the form.',
|
|
126
|
-
layout: 'horizontal',
|
|
127
|
-
},
|
|
128
|
-
options: [
|
|
129
|
-
{
|
|
130
|
-
label: 'Message',
|
|
131
|
-
value: 'message',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: 'Redirect',
|
|
135
|
-
value: 'redirect',
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
defaultValue: 'message',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: 'confirmationMessage',
|
|
142
|
-
type: 'richText',
|
|
143
|
-
localized: true,
|
|
144
|
-
required: true,
|
|
145
|
-
admin: {
|
|
146
|
-
condition: function (_, siblingData) { return (siblingData === null || siblingData === void 0 ? void 0 : siblingData.confirmationType) === 'message'; },
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
redirect,
|
|
150
|
-
{
|
|
151
|
-
name: 'emails',
|
|
152
|
-
type: 'array',
|
|
153
|
-
admin: {
|
|
154
|
-
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}}.",
|
|
155
|
-
},
|
|
156
|
-
fields: [
|
|
157
|
-
{
|
|
158
|
-
type: 'row',
|
|
159
|
-
fields: [
|
|
160
|
-
{
|
|
161
|
-
type: 'text',
|
|
162
|
-
name: 'emailTo',
|
|
163
|
-
label: 'Email To',
|
|
164
|
-
admin: {
|
|
165
|
-
width: '100%',
|
|
166
|
-
placeholder: '"Email Sender" <sender@email.com>',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
type: 'text',
|
|
171
|
-
name: 'cc',
|
|
172
|
-
label: 'CC',
|
|
173
|
-
admin: {
|
|
174
|
-
width: '50%',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
type: 'text',
|
|
179
|
-
name: 'bcc',
|
|
180
|
-
label: 'BCC',
|
|
181
|
-
admin: {
|
|
182
|
-
width: '50%',
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
type: 'row',
|
|
189
|
-
fields: [
|
|
190
|
-
{
|
|
191
|
-
type: 'text',
|
|
192
|
-
name: 'replyTo',
|
|
193
|
-
label: 'Reply To',
|
|
194
|
-
admin: {
|
|
195
|
-
width: '50%',
|
|
196
|
-
placeholder: '"Reply To" <reply-to@email.com>',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
type: 'text',
|
|
201
|
-
name: 'emailFrom',
|
|
202
|
-
label: 'Email From',
|
|
203
|
-
admin: {
|
|
204
|
-
width: '50%',
|
|
205
|
-
placeholder: '"Email From" <email-from@email.com>',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
type: 'text',
|
|
212
|
-
name: 'subject',
|
|
213
|
-
label: 'Subject',
|
|
214
|
-
defaultValue: "You've received a new message.",
|
|
215
|
-
required: true,
|
|
216
|
-
localized: true,
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
type: 'richText',
|
|
220
|
-
name: 'message',
|
|
221
|
-
label: 'Message',
|
|
222
|
-
localized: true,
|
|
223
|
-
admin: {
|
|
224
|
-
description: 'Enter the message that should be sent in this email.',
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
}
|
|
229
|
-
], (((_d = formConfig === null || formConfig === void 0 ? void 0 : formConfig.formOverrides) === null || _d === void 0 ? void 0 : _d.fields) || []), true) });
|
|
230
|
-
return config;
|
|
231
|
-
};
|
|
232
|
-
exports.generateFormCollection = generateFormCollection;
|
|
233
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA6B;AAI7B,mCAAiC;AAEjC,+CAA+C;AACxC,IAAM,sBAAsB,GAAG,UAAC,UAAwB;;IAC7D,IAAM,QAAQ,GAAU;QACtB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,UAAC,CAAC,EAAE,WAAW,IAAK,OAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,MAAK,UAAU,EAA5C,CAA4C;SAC5E;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,IAAI;aACf;SACF;KACF,CAAA;IAED,IAAI,UAAU,CAAC,qBAAqB,EAAE;QACpC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;YACtB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE,UAAU,CAAC,qBAAqB;YAC5C,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE;gBACL,SAAS,EAAE,UAAC,CAAC,EAAE,WAAW,IAAK,OAAA,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,MAAK,WAAW,EAAjC,CAAiC;aACjE;SACF,CAAC,CAAA;QAEF,QAAQ,CAAC,MAAM,CAAC,OAAO,CAA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,IAAI,EAAE,WAAW;gCACjB,KAAK,EAAE,YAAY;gCACnB,KAAK,EAAE;oCACL,KAAK,EAAE,KAAK;oCACZ,WAAW,EAAE,qCAAqC;iCACnD;6BACF;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,YAAY,EAAE,gCAAgC;wBAC9C,QAAQ,EAAE,IAAI;wBACd,SAAS,EAAE,IAAI;qBAChB;oBACD;wBACE,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,SAAS,EAAE,IAAI;wBACf,KAAK,EAAE;4BACL,WAAW,EAAE,sDAAsD;yBACpE;qBACF;iBACF;aACF;WACE,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,0CAAE,MAAM,KAAI,EAAE,CAAC,UAE/C,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAjOY,QAAA,sBAAsB,0BAiOlC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config } from 'payload/config';
|
|
2
|
-
import type { PluginConfig } from './types';
|
|
3
|
-
export { fields } from './collections/Forms/fields';
|
|
4
|
-
export { getPaymentTotal } from './utilities/getPaymentTotal';
|
|
5
|
-
declare const FormBuilder: (incomingFormConfig: PluginConfig) => (config: Config) => Config;
|
|
6
|
-
export default FormBuilder;
|
package/dist/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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 = exports.fields = void 0;
|
|
24
|
-
var Forms_1 = require("./collections/Forms");
|
|
25
|
-
var FormSubmissions_1 = require("./collections/FormSubmissions");
|
|
26
|
-
var fields_1 = require("./collections/Forms/fields");
|
|
27
|
-
Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
|
|
28
|
-
var getPaymentTotal_1 = require("./utilities/getPaymentTotal");
|
|
29
|
-
Object.defineProperty(exports, "getPaymentTotal", { enumerable: true, get: function () { return getPaymentTotal_1.getPaymentTotal; } });
|
|
30
|
-
var FormBuilder = function (incomingFormConfig) {
|
|
31
|
-
return function (config) {
|
|
32
|
-
var formConfig = __assign(__assign({}, incomingFormConfig), { fields: __assign({ text: true, textarea: true, select: true, email: true, state: true, country: true, number: true, checkbox: true, message: true, payment: false }, incomingFormConfig.fields) });
|
|
33
|
-
return __assign(__assign({}, config), {
|
|
34
|
-
// admin: {
|
|
35
|
-
// ...config.admin,
|
|
36
|
-
// webpack: (webpackConfig) => ({
|
|
37
|
-
// ...webpackConfig,
|
|
38
|
-
// resolve: {
|
|
39
|
-
// ...webpackConfig.resolve,
|
|
40
|
-
// alias: {
|
|
41
|
-
// ...webpackConfig.resolve.alias,
|
|
42
|
-
// [path.resolve(__dirname, 'collections/FormSubmissions/hooks/sendEmail.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
|
|
43
|
-
// [path.resolve(__dirname, 'collections/FormSubmissions/hooks/createCharge.ts')]: path.resolve(__dirname, 'mocks/serverModule.js'),
|
|
44
|
-
// },
|
|
45
|
-
// },
|
|
46
|
-
// })
|
|
47
|
-
// },
|
|
48
|
-
collections: __spreadArray(__spreadArray([], ((config === null || config === void 0 ? void 0 : config.collections) || []), true), [
|
|
49
|
-
(0, Forms_1.generateFormCollection)(formConfig),
|
|
50
|
-
(0, FormSubmissions_1.generateSubmissionCollection)(formConfig),
|
|
51
|
-
], false) });
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
exports.default = FormBuilder;
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAA4D;AAC5D,iEAA4E;AAG5E,qDAAmD;AAA1C,gGAAA,MAAM,OAAA;AACf,+DAA6D;AAApD,kHAAA,eAAe,OAAA;AAExB,IAAM,WAAW,GACf,UAAC,kBAAgC;IACjC,OAAA,UAAC,MAAc;QACb,IAAM,UAAU,yBACX,kBAAkB,KACrB,MAAM,aACJ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,EACd,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,CAAA;QAED,6BACK,MAAM;YACT,WAAW;YACX,qBAAqB;YACrB,mCAAmC;YACnC,wBAAwB;YACxB,iBAAiB;YACjB,kCAAkC;YAClC,iBAAiB;YACjB,0CAA0C;YAC1C,yIAAyI;YACzI,4IAA4I;YAC5I,WAAW;YACX,SAAS;YACT,OAAO;YACP,KAAK;YACL,WAAW,kCACN,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,EAAE,CAAC;gBAC9B,IAAA,8BAAsB,EAAC,UAAU,CAAC;gBAClC,IAAA,8CAA4B,EAAC,UAAU,CAAC;yBAE3C;IACH,CAAC;AAxCD,CAwCC,CAAA;AAEH,kBAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverModule.js","sourceRoot":"","sources":["../../src/mocks/serverModule.js"],"names":[],"mappings":";;AAAA,kBAAe,EAAE,CAAA"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import type { Block, CollectionConfig, Field } from 'payload/types';
|
|
2
|
-
export interface BlockConfig {
|
|
3
|
-
block: Block;
|
|
4
|
-
validate?: (value: unknown) => boolean | string;
|
|
5
|
-
}
|
|
6
|
-
export declare function isValidBlockConfig(blockConfig: BlockConfig | string): blockConfig is BlockConfig;
|
|
7
|
-
export interface FieldValues {
|
|
8
|
-
[key: string]: string | number | boolean | null | undefined;
|
|
9
|
-
}
|
|
10
|
-
export type PaymentFieldConfig = Partial<Field> & {
|
|
11
|
-
paymentProcessor: Partial<SelectField>;
|
|
12
|
-
};
|
|
13
|
-
export type FieldConfig = Partial<Field> | PaymentFieldConfig;
|
|
14
|
-
export interface FieldsConfig {
|
|
15
|
-
select?: boolean | FieldConfig;
|
|
16
|
-
text?: boolean | FieldConfig;
|
|
17
|
-
textarea?: boolean | FieldConfig;
|
|
18
|
-
email?: boolean | FieldConfig;
|
|
19
|
-
state?: boolean | FieldConfig;
|
|
20
|
-
country?: boolean | FieldConfig;
|
|
21
|
-
checkbox?: boolean | FieldConfig;
|
|
22
|
-
number?: boolean | FieldConfig;
|
|
23
|
-
message?: boolean | FieldConfig;
|
|
24
|
-
payment?: boolean | FieldConfig;
|
|
25
|
-
[key: string]: boolean | FieldConfig | undefined;
|
|
26
|
-
}
|
|
27
|
-
export type BeforeEmail = (emails: FormattedEmail[]) => FormattedEmail[] | Promise<FormattedEmail[]>;
|
|
28
|
-
export type HandlePayment = (data: any) => void;
|
|
29
|
-
export interface PluginConfig {
|
|
30
|
-
fields?: FieldsConfig;
|
|
31
|
-
formSubmissionOverrides?: Partial<CollectionConfig>;
|
|
32
|
-
formOverrides?: Partial<CollectionConfig>;
|
|
33
|
-
beforeEmail?: BeforeEmail;
|
|
34
|
-
handlePayment?: HandlePayment;
|
|
35
|
-
redirectRelationships?: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface TextField {
|
|
38
|
-
blockType: 'text';
|
|
39
|
-
blockName?: string;
|
|
40
|
-
width?: number;
|
|
41
|
-
name: string;
|
|
42
|
-
label?: string;
|
|
43
|
-
defaultValue?: string;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface TextAreaField {
|
|
47
|
-
blockType: 'textarea';
|
|
48
|
-
blockName?: string;
|
|
49
|
-
width?: number;
|
|
50
|
-
name: string;
|
|
51
|
-
label?: string;
|
|
52
|
-
defaultValue?: string;
|
|
53
|
-
required?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface SelectFieldOption {
|
|
56
|
-
label: string;
|
|
57
|
-
value: string;
|
|
58
|
-
}
|
|
59
|
-
export interface SelectField {
|
|
60
|
-
blockType: 'select';
|
|
61
|
-
blockName?: string;
|
|
62
|
-
width?: number;
|
|
63
|
-
name: string;
|
|
64
|
-
label?: string;
|
|
65
|
-
defaultValue?: string;
|
|
66
|
-
required?: boolean;
|
|
67
|
-
options: SelectFieldOption[];
|
|
68
|
-
}
|
|
69
|
-
export interface PriceCondition {
|
|
70
|
-
fieldToUse: string;
|
|
71
|
-
condition: 'equals' | 'notEquals' | 'hasValue';
|
|
72
|
-
valueForCondition: string;
|
|
73
|
-
operator: 'add' | 'subtract' | 'multiply' | 'divide';
|
|
74
|
-
valueType: 'static' | 'valueOfField';
|
|
75
|
-
valueForOperator: string | number;
|
|
76
|
-
}
|
|
77
|
-
export interface PaymentField {
|
|
78
|
-
blockType: 'payment';
|
|
79
|
-
blockName?: string;
|
|
80
|
-
width?: number;
|
|
81
|
-
name: string;
|
|
82
|
-
label?: string;
|
|
83
|
-
defaultValue?: string;
|
|
84
|
-
required?: boolean;
|
|
85
|
-
paymentProcessor: string;
|
|
86
|
-
basePrice: number;
|
|
87
|
-
priceConditions: PriceCondition[];
|
|
88
|
-
}
|
|
89
|
-
export interface EmailField {
|
|
90
|
-
blockType: 'email';
|
|
91
|
-
blockName?: string;
|
|
92
|
-
width?: number;
|
|
93
|
-
name: string;
|
|
94
|
-
label?: string;
|
|
95
|
-
defaultValue?: string;
|
|
96
|
-
required?: boolean;
|
|
97
|
-
}
|
|
98
|
-
export interface StateField {
|
|
99
|
-
blockType: 'state';
|
|
100
|
-
blockName?: string;
|
|
101
|
-
width?: number;
|
|
102
|
-
name: string;
|
|
103
|
-
label?: string;
|
|
104
|
-
defaultValue?: string;
|
|
105
|
-
required?: boolean;
|
|
106
|
-
}
|
|
107
|
-
export interface CountryField {
|
|
108
|
-
blockType: 'country';
|
|
109
|
-
blockName?: string;
|
|
110
|
-
width?: number;
|
|
111
|
-
name: string;
|
|
112
|
-
label?: string;
|
|
113
|
-
defaultValue?: string;
|
|
114
|
-
required?: boolean;
|
|
115
|
-
}
|
|
116
|
-
export interface CheckboxField {
|
|
117
|
-
blockType: 'checkbox';
|
|
118
|
-
blockName?: string;
|
|
119
|
-
width?: number;
|
|
120
|
-
name: string;
|
|
121
|
-
label?: string;
|
|
122
|
-
defaultValue?: boolean;
|
|
123
|
-
required?: boolean;
|
|
124
|
-
}
|
|
125
|
-
export interface MessageField {
|
|
126
|
-
blockType: 'message';
|
|
127
|
-
blockName?: string;
|
|
128
|
-
message: unknown;
|
|
129
|
-
}
|
|
130
|
-
export type FormFieldBlock = TextField | TextAreaField | SelectField | EmailField | StateField | CountryField | CheckboxField | MessageField | PaymentField;
|
|
131
|
-
export interface Email {
|
|
132
|
-
emailTo: string;
|
|
133
|
-
emailFrom: string;
|
|
134
|
-
cc?: string;
|
|
135
|
-
bcc?: string;
|
|
136
|
-
replyTo?: string;
|
|
137
|
-
subject: string;
|
|
138
|
-
message?: any;
|
|
139
|
-
}
|
|
140
|
-
export interface FormattedEmail {
|
|
141
|
-
to: string;
|
|
142
|
-
cc?: string;
|
|
143
|
-
bcc?: string;
|
|
144
|
-
from: string;
|
|
145
|
-
subject: string;
|
|
146
|
-
html: string;
|
|
147
|
-
replyTo: string;
|
|
148
|
-
}
|
|
149
|
-
export interface Redirect {
|
|
150
|
-
type: 'reference' | 'custom';
|
|
151
|
-
reference?: {
|
|
152
|
-
relationTo: string;
|
|
153
|
-
value: string | unknown;
|
|
154
|
-
};
|
|
155
|
-
url: string;
|
|
156
|
-
}
|
|
157
|
-
export interface Form {
|
|
158
|
-
id: string;
|
|
159
|
-
title: string;
|
|
160
|
-
fields: FormFieldBlock[];
|
|
161
|
-
submitButtonLabel?: string;
|
|
162
|
-
confirmationType: 'message' | 'redirect';
|
|
163
|
-
confirmationMessage?: any;
|
|
164
|
-
redirect?: Redirect;
|
|
165
|
-
emails: Email[];
|
|
166
|
-
}
|
|
167
|
-
export interface SubmissionValue {
|
|
168
|
-
field: string;
|
|
169
|
-
value: unknown;
|
|
170
|
-
}
|
|
171
|
-
export interface FormSubmission {
|
|
172
|
-
form: string | Form;
|
|
173
|
-
submissionData: SubmissionValue[];
|
|
174
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAOA,SAAgB,kBAAkB,CAAC,WAAiC;;IAClE,OAAO,CACL,OAAO,WAAW,KAAK,QAAQ;QAC/B,OAAO,CAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,IAAI,CAAA,KAAK,QAAQ;QAC5C,KAAK,CAAC,OAAO,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,MAAM,CAAC,CAC1C,CAAA;AACH,CAAC;AAND,gDAMC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculatePaymentTotal = void 0;
|
|
4
|
-
var calculatePaymentTotal = 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
|
-
console.log(priceCondition);
|
|
12
|
-
if (valueOfField) {
|
|
13
|
-
if (condition === 'hasValue'
|
|
14
|
-
|| condition === 'equals' && valueOfField === valueForCondition
|
|
15
|
-
|| condition === 'notEquals' && valueOfField !== valueForCondition) {
|
|
16
|
-
var valueToUse = Number(valueType === 'valueOfField' ? valueOfField : valueForOperator);
|
|
17
|
-
console.log('valueToUse', valueToUse);
|
|
18
|
-
switch (operator) {
|
|
19
|
-
case 'add': {
|
|
20
|
-
total += valueToUse;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
case 'subtract': {
|
|
24
|
-
total -= valueToUse;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
case 'multiply': {
|
|
28
|
-
total *= valueToUse;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
case 'divide': {
|
|
32
|
-
total /= valueToUse;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
default: {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
console.log(args, total);
|
|
44
|
-
return total;
|
|
45
|
-
};
|
|
46
|
-
exports.calculatePaymentTotal = calculatePaymentTotal;
|
|
47
|
-
//# sourceMappingURL=calculatePaymentTotal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculatePaymentTotal.js","sourceRoot":"","sources":["../../src/utilities/calculatePaymentTotal.ts"],"names":[],"mappings":";;;AAEO,IAAM,qBAAqB,GAAG,UAAC,IAErC;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,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AA,qBAAqB,yBA8DjC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
exports.isObject = void 0;
|
|
15
|
-
function isObject(item) {
|
|
16
|
-
return Boolean(item && typeof item === 'object' && !Array.isArray(item));
|
|
17
|
-
}
|
|
18
|
-
exports.isObject = isObject;
|
|
19
|
-
function deepMerge(target, source) {
|
|
20
|
-
var output = __assign({}, target);
|
|
21
|
-
if (isObject(target) && isObject(source)) {
|
|
22
|
-
Object.keys(source).forEach(function (key) {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
if (isObject(source[key])) {
|
|
26
|
-
if (!(key in target)) {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
Object.assign(output, (_a = {}, _a[key] = source[key], _a));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
output[key] = deepMerge(target[key], source[key]);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
Object.assign(output, (_b = {}, _b[key] = source[key], _b));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return output;
|
|
42
|
-
}
|
|
43
|
-
exports.default = deepMerge;
|
|
44
|
-
//# sourceMappingURL=deepMerge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepMerge.js","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,SAAgB,QAAQ,CAAC,IAAa;IACpC,OAAO,OAAO,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,4BAEC;AAED,SAAwB,SAAS,CAAO,MAAS,EAAE,MAAS;IAC1D,IAAM,MAAM,gBAAQ,MAAM,CAAE,CAAC;IAC7B,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;;YAC9B,aAAa;YACb,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE;oBACpB,aAAa;oBACb,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG,CAAC;iBAC/C;qBAAM;oBACL,aAAa;oBACb,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;iBACnD;aACF;iBAAM;gBACL,aAAa;gBACb,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AArBD,4BAqBC"}
|