@webbio/strapi-plugin-page-builder 0.12.5-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbio/strapi-plugin-page-builder",
3
- "version": "0.12.5-platform",
3
+ "version": "0.12.8-platform",
4
4
  "description": "This is the description of the plugin.",
5
5
  "scripts": {
6
6
  "develop": "tsc -p tsconfig.server.json -w",
@@ -30,23 +30,25 @@ exports.default = async ({ strapi }) => {
30
30
  async beforeUpdate(event) {
31
31
  var _a;
32
32
  if (event.params.data.id) {
33
- const userToUpdate = await ((_a = strapi.entityService) === null || _a === void 0 ? void 0 : _a.findOne(constants_1.USER_PERMISSION_USER_PLUGIN, event.params.data.id, {
33
+ const originalUserObject = await ((_a = strapi.entityService) === null || _a === void 0 ? void 0 : _a.findOne(constants_1.USER_PERMISSION_USER_PLUGIN, event.params.data.id, {
34
34
  populate: { platform: { populate: { platformEmails: { populate: '*' } } } }
35
35
  }));
36
- if (userToUpdate) {
37
- if (event.params.data.activateUser && event.params.data.confirmed && !userToUpdate.confirmMailSend) {
38
- await strapi.service(constants_1.PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
39
- // @ts-ignore strapi typings
40
- from: userToUpdate.platform.platformEmails.accountAcceptedMail.fromEmail,
41
- to: event.params.data.email,
42
- // @ts-ignore
43
- subject: userToUpdate.platform.platformEmails.accountAcceptedMail.subject,
44
- // @ts-ignore
45
- text: userToUpdate.platform.platformEmails.accountAcceptedMail.message,
46
- firstName: event.params.data.firstName,
47
- lastName: event.params.data.lastName
48
- });
49
- }
36
+ if (originalUserObject &&
37
+ event.params.data.activateUser &&
38
+ event.params.data.confirmed &&
39
+ !originalUserObject.confirmMailSend) {
40
+ await strapi.service(constants_1.PAGE_BUILDER_EMAIL_PLUGIN).sendMail({
41
+ // @ts-ignore strapi typings
42
+ from: originalUserObject.platform.platformEmails.accountAcceptedMail.fromEmail,
43
+ to: event.params.data.email,
44
+ // @ts-ignore
45
+ subject: originalUserObject.platform.platformEmails.accountAcceptedMail.subject,
46
+ // @ts-ignore
47
+ text: originalUserObject.platform.platformEmails.accountAcceptedMail.message,
48
+ firstName: event.params.data.firstName,
49
+ lastName: event.params.data.lastName
50
+ });
51
+ event.params.data.confirmMailSend = true;
50
52
  }
51
53
  }
52
54
  }
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const AWS = __importStar(require("@aws-sdk/client-ses"));
27
27
  const txtMail_email_template_text_1 = require("./private-content/mail-template/txtMail.email.template.text");
28
28
  const constants_1 = require("../../shared/utils/constants");
29
+ const utils_1 = require("@strapi/utils");
29
30
  exports.default = {
30
31
  async sendMail(options) {
31
32
  const { from, to, subject, text, variables } = options;
@@ -47,6 +48,7 @@ exports.default = {
47
48
  }
48
49
  catch (error) {
49
50
  console.error(error);
51
+ throw new utils_1.errors.ApplicationError('Failed to send email', error);
50
52
  }
51
53
  },
52
54
  async sendAdminMail(user) {
@@ -111,8 +113,7 @@ exports.default = {
111
113
  data: { resetPasswordToken }
112
114
  });
113
115
  // @ts-ignore
114
- const searchParams = new URLSearchParams({ token: resetPasswordToken });
115
- const resetPasswordUrl = `${user.platform.domain}/wachtwoord-resetten/?${searchParams.toString()}`;
116
+ const resetPasswordUrl = `${user.platform.domain}/wachtwoord-resetten/${resetPasswordToken}`;
116
117
  await this.sendMail({
117
118
  // @ts-ignore
118
119
  from: user.platform.platformEmails.resetPasswordMail.fromEmail,