@punks/backend-entity-manager 0.0.407 → 0.0.408

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/cjs/index.js CHANGED
@@ -23765,18 +23765,20 @@ let UserInvitationSendHandler = class UserInvitationSendHandler {
23765
23765
  if (!user) {
23766
23766
  throw new Error(`User not found ${input.userId}`);
23767
23767
  }
23768
- await this.sendRegistrationEmail({
23769
- user,
23770
- callback: {
23771
- tokenPlaceholder: input.callback.tokenPlaceholder,
23772
- urlTemplate: input.callback.urlTemplate,
23773
- },
23774
- languageId: input.languageId,
23775
- emailTemplateId: input.emailTemplateId,
23776
- });
23777
- }
23778
- async sendRegistrationEmail({ user, callback, languageId, emailTemplateId, }) {
23779
23768
  const token = await this.generateEmailVerifyToken(user);
23769
+ const callbackUrl = input.callback.urlTemplate.replace(input.callback.tokenPlaceholder, token);
23770
+ if (input.emailTemplateId) {
23771
+ await this.sendRegistrationEmail({
23772
+ user,
23773
+ callbackUrl,
23774
+ languageId: input.languageId,
23775
+ emailTemplateId: input.emailTemplateId,
23776
+ token,
23777
+ });
23778
+ }
23779
+ return { token, callbackUrl };
23780
+ }
23781
+ async sendRegistrationEmail({ user, callbackUrl, languageId, emailTemplateId, }) {
23780
23782
  await this.emailService.sendTemplatedEmail({
23781
23783
  to: [user.email],
23782
23784
  templateId: emailTemplateId ?? AuthenticationEmailTemplates.Registration,
@@ -23784,7 +23786,7 @@ let UserInvitationSendHandler = class UserInvitationSendHandler {
23784
23786
  payload: {
23785
23787
  firstName: user.profile.firstName,
23786
23788
  lastName: user.profile.lastName,
23787
- callbackUrl: callback.urlTemplate.replace(callback.tokenPlaceholder, token),
23789
+ callbackUrl,
23788
23790
  },
23789
23791
  });
23790
23792
  }
@@ -23824,8 +23826,8 @@ exports.AuthenticationService = class AuthenticationService {
23824
23826
  async userCreate(input) {
23825
23827
  return await this.userCreationHandler.execute(input);
23826
23828
  }
23827
- async userInvitationSend(input) {
23828
- await this.userInvitationHandler.execute(input);
23829
+ async userInvite(input) {
23830
+ return await this.userInvitationHandler.execute(input);
23829
23831
  }
23830
23832
  async userDisable(input) {
23831
23833
  await this.userDisableHandler.execute(input);