gemcap-be-common 1.3.28 → 1.3.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.3.28",
3
+ "version": "1.3.30",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,7 +3,10 @@
3
3
 
4
4
  <p>Dear ${AUDITOR_NAME}</p>
5
5
 
6
- <p>Here is your link for all of your Black Feather prospects. When logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a href="https://analytics.traxabl.com/auditors">link</a>.</p>
6
+ <p>You have been assigned the role of auditor/ examiner for a new Black Feather prospect; $Prospect Name.
7
+ Here is the link to the new prospect and another Black Feather prospects that you are currently assigned to. When
8
+ logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a
9
+ href="https://analytics.traxabl.com/auditors">link</a>.</p>
7
10
 
8
11
  <p>Your password is ${PASSWORD}.</p>
9
12
 
@@ -3,7 +3,10 @@
3
3
 
4
4
  <p>Dear ${AUDITOR_NAME}</p>
5
5
 
6
- <p>Here is your link for all of your Black Feather prospects. When logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a href="https://analytics.traxabl.com/auditors">link</a>.</p>
6
+ <p>You have been assigned the role of auditor/ examiner for a new Black Feather prospect; $Prospect Name.
7
+ Here is the link to the new prospect and another Black Feather prospects that you are currently assigned to. When
8
+ logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a
9
+ href="https://analytics.traxabl.com/auditors">link</a>.</p>
7
10
 
8
11
  <p>Your password is ${PASSWORD}.</p>
9
12
 
@@ -3,7 +3,10 @@
3
3
 
4
4
  <p>Dear ${AUDITOR_NAME}</p>
5
5
 
6
- <p>Here is your link for all of your Black Feather prospects. When logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a href="https://analytics.traxabl.com/auditors">link</a>.</p>
6
+ <p>You have been assigned the role of auditor/ examiner for a new Black Feather prospect; $Prospect Name.
7
+ Here is the link to the new prospect and another Black Feather prospects that you are currently assigned to. When
8
+ logging in, you will be requested to enter a one-time-password below. Only this email address can use this <a
9
+ href="https://analytics.traxabl.com/auditors">link</a>.</p>
7
10
 
8
11
  <p>Your password is ${PASSWORD}.</p>
9
12
 
@@ -87,18 +87,21 @@ export declare class NodemailerService {
87
87
  sendProspectForm(email: Partial<IEmail>, replacements: {
88
88
  link: string;
89
89
  contactName: string;
90
+ prospectName: string;
90
91
  }, stage: 'one' | 'two'): Promise<void>;
91
92
  sendProspectReminder(email: Partial<IEmail>, replacements: {
92
93
  link: string;
93
94
  contactName: string;
94
95
  hasEmptyFields: boolean;
95
96
  requiredGroups: string[];
97
+ prospectName: string;
96
98
  }): Promise<void>;
97
- sendAuditorResetPasswordEmail(emailData: {
99
+ sendAuditorResetPasswordEmail(replacements: {
98
100
  email: string;
99
101
  password: string;
100
102
  name: string;
101
103
  subject: string;
104
+ prospectName?: string;
102
105
  }): Promise<void>;
103
106
  }
104
107
  export {};
@@ -97,14 +97,14 @@ class NodemailerService {
97
97
  };
98
98
  this.transporter = nodemailer_1.default.createTransport(this.config.mailerConfig);
99
99
  }
100
- getSender(senderType) {
100
+ getSender(senderType, senderExtraName) {
101
101
  switch (senderType) {
102
102
  case ESenderType.REGULAR:
103
103
  return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
104
104
  case ESenderType.FINANCIAL:
105
105
  return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
106
106
  case ESenderType.NEW_BUSINESS:
107
- return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
107
+ return `${this.senders[senderType].senderName}${senderExtraName} <${this.senders[senderType].senderEmail}>`;
108
108
  default:
109
109
  return `"${this.config.appTitle}>" <${this.config.sender}>`;
110
110
  }
@@ -654,7 +654,7 @@ class NodemailerService {
654
654
  this.transporter.sendMail({
655
655
  from: this.getSender(ESenderType.NEW_BUSINESS),
656
656
  to: [...this.config.hiddenRecipient, ...email.addresses],
657
- cc: this.getSender(ESenderType.NEW_BUSINESS),
657
+ cc: this.getSender(ESenderType.NEW_BUSINESS, `: ${replacements.prospectName}`),
658
658
  subject: email.subject,
659
659
  text: replacedData,
660
660
  html: replacedData,
@@ -683,7 +683,7 @@ class NodemailerService {
683
683
  this.transporter.sendMail({
684
684
  from: this.getSender(ESenderType.NEW_BUSINESS),
685
685
  to: [...this.config.hiddenRecipient, ...email.addresses],
686
- cc: this.getSender(ESenderType.NEW_BUSINESS),
686
+ cc: this.getSender(ESenderType.NEW_BUSINESS, `: ${replacements.prospectName}`),
687
687
  subject: email.subject,
688
688
  text: replacedData,
689
689
  html: replacedData,
@@ -695,20 +695,20 @@ class NodemailerService {
695
695
  this.sentryService.catchErrorBySentry(null, e);
696
696
  }
697
697
  }
698
- async sendAuditorResetPasswordEmail(emailData) {
698
+ async sendAuditorResetPasswordEmail(replacements) {
699
699
  const textPath = path_1.default.resolve(__dirname, '../public/emails', 'auditor-reset.html');
700
700
  const text = await fs.promises.readFile(textPath, 'utf8');
701
701
  const signature = await this.getSignatureAsync(ESenderType.NEW_BUSINESS);
702
702
  const replacedData = text
703
- .replaceAll('${AUDITOR_NAME}', emailData.name)
704
- .replaceAll('${PASSWORD}', emailData.password)
703
+ .replaceAll('${AUDITOR_NAME}', replacements.name)
704
+ .replaceAll('${PASSWORD}', replacements.password)
705
705
  .replaceAll('${signature}', signature);
706
706
  try {
707
707
  this.transporter.sendMail({
708
708
  from: this.getSender(ESenderType.NEW_BUSINESS),
709
- to: [...this.config.hiddenRecipient, emailData.email],
710
- cc: this.getSender(ESenderType.NEW_BUSINESS),
711
- subject: emailData.subject,
709
+ to: [...this.config.hiddenRecipient, replacements.email],
710
+ cc: this.getSender(ESenderType.NEW_BUSINESS, replacements.prospectName ? `: ${replacements.prospectName}` : undefined),
711
+ subject: replacements.subject,
712
712
  text: replacedData,
713
713
  html: replacedData,
714
714
  }, async (err, info) => {
@@ -110,14 +110,14 @@ export class NodemailerService {
110
110
  this.transporter = nodemailer.createTransport(this.config.mailerConfig);
111
111
  }
112
112
 
113
- private getSender(senderType: ESenderType) {
113
+ private getSender(senderType: ESenderType, senderExtraName?: string) {
114
114
  switch (senderType) {
115
115
  case ESenderType.REGULAR:
116
116
  return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
117
117
  case ESenderType.FINANCIAL:
118
118
  return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
119
119
  case ESenderType.NEW_BUSINESS:
120
- return `${this.senders[senderType].senderName} <${this.senders[senderType].senderEmail}>`;
120
+ return `${this.senders[senderType].senderName}${senderExtraName} <${this.senders[senderType].senderEmail}>`;
121
121
  default:
122
122
  return `"${this.config.appTitle}>" <${this.config.sender}>`;
123
123
  }
@@ -724,7 +724,11 @@ export class NodemailerService {
724
724
  }
725
725
  }
726
726
 
727
- async sendProspectForm(email: Partial<IEmail>, replacements: { link: string, contactName: string }, stage: 'one' | 'two') {
727
+ async sendProspectForm(email: Partial<IEmail>, replacements: {
728
+ link: string,
729
+ contactName: string,
730
+ prospectName: string,
731
+ }, stage: 'one' | 'two') {
728
732
  const stageTemplate = stage === 'one' ? 'prospect-form-one' : 'prospect-form-two';
729
733
  const textPath = path.resolve(__dirname, '../public/emails', `${stageTemplate}.html`);
730
734
  const text = await fs.promises.readFile(textPath, 'utf8');
@@ -737,7 +741,7 @@ export class NodemailerService {
737
741
  this.transporter.sendMail({
738
742
  from: this.getSender(ESenderType.NEW_BUSINESS),
739
743
  to: [...this.config.hiddenRecipient, ...email.addresses],
740
- cc: this.getSender(ESenderType.NEW_BUSINESS),
744
+ cc: this.getSender(ESenderType.NEW_BUSINESS, `: ${replacements.prospectName}`),
741
745
  subject: email.subject,
742
746
  text: replacedData,
743
747
  html: replacedData,
@@ -753,7 +757,8 @@ export class NodemailerService {
753
757
  link: string,
754
758
  contactName: string,
755
759
  hasEmptyFields: boolean,
756
- requiredGroups: string[]
760
+ requiredGroups: string[],
761
+ prospectName: string,
757
762
  }) {
758
763
  const textPath = path.resolve(__dirname, '../public/emails', 'prospect-form-reminder.html');
759
764
  const text = await fs.promises.readFile(textPath, 'utf8');
@@ -771,7 +776,7 @@ export class NodemailerService {
771
776
  this.transporter.sendMail({
772
777
  from: this.getSender(ESenderType.NEW_BUSINESS),
773
778
  to: [...this.config.hiddenRecipient, ...email.addresses],
774
- cc: this.getSender(ESenderType.NEW_BUSINESS),
779
+ cc: this.getSender(ESenderType.NEW_BUSINESS, `: ${replacements.prospectName}`),
775
780
  subject: email.subject,
776
781
  text: replacedData,
777
782
  html: replacedData,
@@ -783,20 +788,26 @@ export class NodemailerService {
783
788
  }
784
789
  }
785
790
 
786
- async sendAuditorResetPasswordEmail(emailData: { email: string; password: string; name: string; subject: string }) {
791
+ async sendAuditorResetPasswordEmail(replacements: {
792
+ email: string;
793
+ password: string;
794
+ name: string;
795
+ subject: string,
796
+ prospectName?: string,
797
+ }) {
787
798
  const textPath = path.resolve(__dirname, '../public/emails', 'auditor-reset.html');
788
799
  const text = await fs.promises.readFile(textPath, 'utf8');
789
800
  const signature = await this.getSignatureAsync(ESenderType.NEW_BUSINESS);
790
801
  const replacedData = text
791
- .replaceAll('${AUDITOR_NAME}', emailData.name)
792
- .replaceAll('${PASSWORD}', emailData.password)
802
+ .replaceAll('${AUDITOR_NAME}', replacements.name)
803
+ .replaceAll('${PASSWORD}', replacements.password)
793
804
  .replaceAll('${signature}', signature);
794
805
  try {
795
806
  this.transporter.sendMail({
796
807
  from: this.getSender(ESenderType.NEW_BUSINESS),
797
- to: [...this.config.hiddenRecipient, emailData.email],
798
- cc: this.getSender(ESenderType.NEW_BUSINESS),
799
- subject: emailData.subject,
808
+ to: [...this.config.hiddenRecipient, replacements.email],
809
+ cc: this.getSender(ESenderType.NEW_BUSINESS, replacements.prospectName ? `: ${replacements.prospectName}` : undefined),
810
+ subject: replacements.subject,
800
811
  text: replacedData,
801
812
  html: replacedData,
802
813
  }, async (err, info) => {