rez_core 3.1.143 → 3.1.145

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": "rez_core",
3
- "version": "3.1.143",
3
+ "version": "3.1.145",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -18,8 +18,10 @@ import {
18
18
  UpdateUserIntegrationDto,
19
19
  } from '../dto/create-config.dto';
20
20
  import { FieldMapperService } from '../../mapper/service/field-mapper.service';
21
- import { COMM_TEMPLATE } from '../../../constant/global.constant';
21
+ import { COMM_TEMPLATE, ENTITYTYPE_MEDIA } from '../../../constant/global.constant';
22
22
  import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
23
+ import { MediaDataService } from '../../meta/service/media-data.service';
24
+ import axios from 'axios';
23
25
 
24
26
  export interface SendMessageDto {
25
27
  levelId: number;
@@ -87,6 +89,7 @@ export class IntegrationService {
87
89
  private readonly gmailApiStrategy: GmailApiStrategy,
88
90
  private readonly sendGridApiStrategy: SendGridApiStrategy,
89
91
  private readonly configService: ConfigService,
92
+ private readonly mediaService: MediaDataService,
90
93
  @Inject('FieldMapperService') private readonly fieldMapperService: FieldMapperService,
91
94
  private readonly entityService: EntityServiceImpl,
92
95
  @Inject(forwardRef(() => IntegrationQueueService))
@@ -1315,6 +1318,16 @@ export class IntegrationService {
1315
1318
  if (!commTemplate.template_id) {
1316
1319
  let richText = commTemplate.rich_text;
1317
1320
 
1321
+ if (!richText) {
1322
+ if (commTemplate.markup_id) {
1323
+ let url = await this.mediaService.getMediaDownloadUrl(commTemplate.markup_id, {}, 60000);
1324
+ if (url) {
1325
+ let response = await axios.get(url.signedUrl, { responseType: 'text' });
1326
+ richText = response.data
1327
+ }
1328
+ }
1329
+ }
1330
+
1318
1331
  richText = richText.replace(/\{\{(\w+)\}\}/g, (match, key) => {
1319
1332
  const value = variables[key];
1320
1333
  return value !== undefined ? String(value) : match;
@@ -166,10 +166,8 @@ export class SendGridApiStrategy implements IntegrationStrategy {
166
166
  } catch (error) {
167
167
  let errorMessage = 'Failed to fetch verified senders';
168
168
 
169
- if (error.response?.status === 401) {
169
+ if (error.response?.status === 401 || error.response?.status === 403) {
170
170
  errorMessage = 'Invalid SendGrid API key';
171
- } else if (error.response?.status === 403) {
172
- errorMessage = 'SendGrid API key does not have required permissions';
173
171
  } else if (error.response?.data?.errors) {
174
172
  errorMessage = error.response.data.errors
175
173
  .map((err: any) => err.message)
@@ -1,58 +0,0 @@
1
-
2
- <!DOCTYPE html>
3
- <html lang="en">
4
- <head>
5
- <meta charset="UTF-8" />
6
- <title>CRM Lead Email</title>
7
- </head>
8
- <body style="font-family: Arial, sans-serif; background-color:#f8f9fa; margin:0; padding:0;">
9
- <table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f8f9fa; padding:20px 0;">
10
- <tr>
11
- <td align="center">
12
- <table width="600" cellpadding="0" cellspacing="0" style="background:#ffffff; border-radius:10px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.1);">
13
-
14
- <!-- Header -->
15
- <tr>
16
- <td align="center" style="background:rgb(122, 90, 248); padding:20px; display:flex; align-items:center; justify-content:center;">
17
- <!-- Brand Logo -->
18
- <svg width="40" height="40" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" style="margin-right:10px;">
19
- <path d="M12.1499 4.60863C18.2057 2.06336 25.0975 5.10519 27.5434 11.4028C29.9892 17.7004 27.0628 24.869 21.0071 27.4143C17.7694 28.7751 14.2927 28.5388 11.3842 27.0618L24.2254 21.6645C24.4815 21.5569 24.5138 21.1932 24.2809 21.0386L21.8971 19.4568C21.8045 19.3953 21.6889 19.3842 21.5871 19.4271L8.44882 24.9492C7.65364 24.1678 6.95488 23.2628 6.38251 22.2473L17.9301 17.3937C18.1715 17.2923 18.2181 16.9577 18.0143 16.7892L15.9432 15.0759C15.8473 14.9966 15.7179 14.9771 15.6044 15.0248L5.2076 19.3947C4.89843 18.275 4.74991 17.1395 4.75 16.0177L19.7917 9.69552C20.0479 9.58782 20.08 9.22398 19.847 9.06952L17.4614 7.48843C17.3688 7.42706 17.2533 7.41602 17.1515 7.45877L5.25787 12.4578C6.25937 9.01688 8.6955 6.06056 12.1499 4.60863Z" fill="white"/>
20
- </svg>
21
- <!-- Brand Name -->
22
- <span style="color:#ffffff; font-size:24px; font-weight:bold;">Ether</span>
23
- </td>
24
- </tr>
25
-
26
- <!-- Body -->
27
- <tr>
28
- <td style="padding:30px; color:#333333; font-size:16px; line-height:1.6;">
29
- <p>Dear <strong>{{lead_name}}</strong>,</p>
30
-
31
- <p>We have received your enquiry for admission of <strong>{{student_name}}</strong>.</p>
32
-
33
- <p>You are now a step closer to the admission process.</p>
34
-
35
- <p>Your Admission enquiry number is <strong>{{lead_id}}</strong>.</p>
36
-
37
- <p>Our admissions team will contact you to schedule a meeting.</p>
38
-
39
- <p>
40
- Meanwhile, to get a better understanding of our school’s ethos, values, and culture,
41
- we invite you to visit our
42
- <a href="{{website_url}}" style="color:#7a5af8; text-decoration:none; font-weight:bold;">website</a>
43
- or our
44
- <a href="{{facebook_url}}" style="color:#7a5af8; text-decoration:none; font-weight:bold;">Facebook page</a>.
45
- </p>
46
-
47
- <p style="color:#666666; font-size:14px; margin-top:30px;">
48
- This is a system-generated email. Kindly do not respond to it.
49
- </p>
50
- </td>
51
- </tr>
52
-
53
- </table>
54
- </td>
55
- </tr>
56
- </table>
57
- </body>
58
- </html>