@webbio/strapi-plugin-page-builder 0.12.7-platform → 0.12.8-platform
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/package.json +1 -1
- package/dist/server/bootstrap.js +17 -15
- package/dist/server/content-types/user-categories/schema.json +18 -0
- package/dist/server/services/email.js +2 -0
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/server/bootstrap.ts +25 -16
- package/server/services/email.ts +2 -0
package/package.json
CHANGED
package/server/bootstrap.ts
CHANGED
|
@@ -36,23 +36,32 @@ export default async ({ strapi }: { strapi: Strapi }) => {
|
|
|
36
36
|
models: [USER_PERMISSION_USER_PLUGIN],
|
|
37
37
|
async beforeUpdate(event) {
|
|
38
38
|
if (event.params.data.id) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
await strapi.service(PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
|
|
45
|
-
// @ts-ignore strapi typings
|
|
46
|
-
from: userToUpdate.platform.platformEmails.accountAcceptedMail.fromEmail,
|
|
47
|
-
to: event.params.data.email,
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
subject: userToUpdate.platform.platformEmails.accountAcceptedMail.subject,
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
text: userToUpdate.platform.platformEmails.accountAcceptedMail.message,
|
|
52
|
-
firstName: event.params.data.firstName,
|
|
53
|
-
lastName: event.params.data.lastName
|
|
54
|
-
});
|
|
39
|
+
const originalUserObject = await strapi.entityService?.findOne(
|
|
40
|
+
USER_PERMISSION_USER_PLUGIN,
|
|
41
|
+
event.params.data.id,
|
|
42
|
+
{
|
|
43
|
+
populate: { platform: { populate: { platformEmails: { populate: '*' } } } }
|
|
55
44
|
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
originalUserObject &&
|
|
49
|
+
event.params.data.activateUser &&
|
|
50
|
+
event.params.data.confirmed &&
|
|
51
|
+
!originalUserObject.confirmMailSend
|
|
52
|
+
) {
|
|
53
|
+
await strapi.service(PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
|
|
54
|
+
// @ts-ignore strapi typings
|
|
55
|
+
from: originalUserObject.platform.platformEmails.accountAcceptedMail.fromEmail,
|
|
56
|
+
to: event.params.data.email,
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
subject: originalUserObject.platform.platformEmails.accountAcceptedMail.subject,
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
text: originalUserObject.platform.platformEmails.accountAcceptedMail.message,
|
|
61
|
+
firstName: event.params.data.firstName,
|
|
62
|
+
lastName: event.params.data.lastName
|
|
63
|
+
});
|
|
64
|
+
event.params.data.confirmMailSend = true;
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
}
|
package/server/services/email.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as AWS from '@aws-sdk/client-ses';
|
|
2
2
|
import { txtEmail } from './private-content/mail-template/txtMail.email.template.text';
|
|
3
3
|
import { USER_PERMISSION_USER_PLUGIN } from '../../shared/utils/constants';
|
|
4
|
+
import { errors } from '@strapi/utils';
|
|
4
5
|
|
|
5
6
|
interface SendOptions {
|
|
6
7
|
from: string;
|
|
@@ -32,6 +33,7 @@ export default {
|
|
|
32
33
|
});
|
|
33
34
|
} catch (error) {
|
|
34
35
|
console.error(error);
|
|
36
|
+
throw new errors.ApplicationError('Failed to send email', error);
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
async sendAdminMail(user) {
|