@easy-cms/plugin-form-builder 1.30.1 → 1.32.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/dist/index.js +18 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ var INFO = {
|
|
|
197
197
|
name: "@easy-cms/plugin-form-builder",
|
|
198
198
|
// The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
|
|
199
199
|
apiVersion: 1,
|
|
200
|
-
...true ? { version: "1.
|
|
200
|
+
...true ? { version: "1.32.0" } : {}
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
// src/spam.ts
|
|
@@ -619,7 +619,7 @@ function formBuilderPlugin(options = {}) {
|
|
|
619
619
|
rateKey = keys.current;
|
|
620
620
|
}
|
|
621
621
|
const page = typeof body.page === "string" ? body.page.slice(0, 500) : null;
|
|
622
|
-
await cms.create(
|
|
622
|
+
const submission = await cms.create(
|
|
623
623
|
submissions,
|
|
624
624
|
{
|
|
625
625
|
form: form.id,
|
|
@@ -631,6 +631,20 @@ function formBuilderPlugin(options = {}) {
|
|
|
631
631
|
},
|
|
632
632
|
{ context }
|
|
633
633
|
);
|
|
634
|
+
const emailField = rowsOf(form).find(
|
|
635
|
+
(r) => r.blockType === "email" && typeof r.name === "string"
|
|
636
|
+
);
|
|
637
|
+
const from = emailField ? values[emailField.name] : void 0;
|
|
638
|
+
cms.emit(
|
|
639
|
+
"form.submitted",
|
|
640
|
+
{
|
|
641
|
+
form: { id: form.id, title: form.title ?? form.slug ?? "" },
|
|
642
|
+
submission: submission.id,
|
|
643
|
+
...typeof from === "string" && from ? { email: from } : {},
|
|
644
|
+
locale
|
|
645
|
+
},
|
|
646
|
+
{ collection: submissions, id: submission.id }
|
|
647
|
+
);
|
|
634
648
|
for (const email of buildEmails({
|
|
635
649
|
form,
|
|
636
650
|
fields: rowsOf(form),
|
|
@@ -796,6 +810,8 @@ function formBuilderPlugin(options = {}) {
|
|
|
796
810
|
return {
|
|
797
811
|
...config,
|
|
798
812
|
collections: [...config.collections ?? [], formsCollection, submissionsCollection],
|
|
813
|
+
// A submission, for webhooks and notifications (#356).
|
|
814
|
+
events: [.../* @__PURE__ */ new Set([...config.events ?? [], "form.submitted"])],
|
|
799
815
|
admin: {
|
|
800
816
|
...config.admin,
|
|
801
817
|
modules: [.../* @__PURE__ */ new Set([...config.admin?.modules ?? [], ADMIN_MODULE])],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/plugin-form-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "Forms for Easy CMS: build forms in the admin, collect submissions, email notifications, spam protection and an <easy-form> element",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@easy-cms/richtext": "^1.
|
|
29
|
+
"@easy-cms/richtext": "^1.32.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@easy-cms/core": "^1.
|
|
32
|
+
"@easy-cms/core": "^1.32.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"happy-dom": "^21.0.4",
|
|
36
|
-
"@easy-cms/core": "^1.
|
|
37
|
-
"@easy-cms/db-sqlite": "^1.
|
|
36
|
+
"@easy-cms/core": "^1.32.0",
|
|
37
|
+
"@easy-cms/db-sqlite": "^1.32.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=22.12"
|