@memberjunction/communication-sendgrid 2.111.0 → 2.112.0

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.
@@ -1,4 +1,4 @@
1
- import { BaseCommunicationProvider, CreateDraftParams, CreateDraftResult, ForwardMessageParams, ForwardMessageResult, GetMessagesParams, GetMessagesResult, MessageResult, ProcessedMessage, ReplyToMessageParams, ReplyToMessageResult } from "@memberjunction/communication-types";
1
+ import { BaseCommunicationProvider, CreateDraftParams, CreateDraftResult, ForwardMessageParams, ForwardMessageResult, GetMessagesParams, GetMessagesResult, MessageResult, ProcessedMessage, ReplyToMessageParams, ReplyToMessageResult } from '@memberjunction/communication-types';
2
2
  /**
3
3
  * Implementation of the SendGrid provider for sending and receiving messages
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridProvider.d.ts","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAMrR;;GAEG;AACH,qBACa,gBAAiB,SAAQ,yBAAyB;IAC3D;;OAEG;IACU,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IA0EjF;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI/E;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlF;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlF;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAMlF;AAED,wBAAgB,YAAY,SAE3B"}
1
+ {"version":3,"file":"SendGridProvider.d.ts","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,qCAAqC,CAAC;AAM7C;;GAEG;AACH,qBACa,gBAAiB,SAAQ,yBAAyB;IAC7D;;OAEG;IACU,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IA2EjF;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI/E;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlF;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlF;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOhF;AAED,wBAAgB,YAAY,SAE3B"}
@@ -14,7 +14,7 @@ const communication_types_1 = require("@memberjunction/communication-types");
14
14
  const global_1 = require("@memberjunction/global");
15
15
  const mail_1 = __importDefault(require("@sendgrid/mail"));
16
16
  const config_1 = require("./config");
17
- const core_1 = require("@memberjunction/core");
17
+ const global_2 = require("@memberjunction/global");
18
18
  /**
19
19
  * Implementation of the SendGrid provider for sending and receiving messages
20
20
  */
@@ -30,7 +30,7 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
30
30
  to: message.To,
31
31
  from: {
32
32
  email: from,
33
- name: message.FromName
33
+ name: message.FromName,
34
34
  },
35
35
  cc: message.CCRecipients,
36
36
  bcc: message.BCCRecipients,
@@ -39,16 +39,16 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
39
39
  html: message.ProcessedHTMLBody,
40
40
  trackingSettings: {
41
41
  subscriptionTracking: {
42
- enable: false
43
- }
44
- }
42
+ enable: false,
43
+ },
44
+ },
45
45
  };
46
46
  /*
47
- * Should be ready to go - but needs SG testing.
48
- if(message.Headers){
49
- msg.headers = Object.fromEntries(Object.entries(message.Headers).map(([key, value]) => [`X-${key}`, value])) as Record<string, string>;
50
- }
51
- */
47
+ * Should be ready to go - but needs SG testing.
48
+ if(message.Headers){
49
+ msg.headers = Object.fromEntries(Object.entries(message.Headers).map(([key, value]) => [`X-${key}`, value])) as Record<string, string>;
50
+ }
51
+ */
52
52
  if (message.SendAt) {
53
53
  const time = message.SendAt.getTime();
54
54
  const unitTime = Math.floor(time / 1000);
@@ -56,31 +56,34 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
56
56
  }
57
57
  try {
58
58
  //not using await syntax here because we dont get a return value
59
- return mail_1.default.send(msg).then((result) => {
59
+ return mail_1.default
60
+ .send(msg)
61
+ .then((result) => {
60
62
  if (result && result.length > 0 && result[0].statusCode >= 200 && result[0].statusCode < 300) {
61
- (0, core_1.LogStatus)(`Email sent to ${msg.to}: ${result[0].statusCode}`);
63
+ (0, global_2.LogStatus)(`Email sent to ${msg.to}: ${result[0].statusCode}`);
62
64
  return {
63
65
  Message: message,
64
66
  Success: true,
65
- Error: ''
67
+ Error: '',
66
68
  };
67
69
  }
68
70
  else {
69
- (0, core_1.LogError)(`Error sending email to ${msg.to}:`, undefined, result);
70
- (0, core_1.LogError)(result[0].body);
71
+ (0, global_2.LogError)(`Error sending email to ${msg.to}:`, undefined, result);
72
+ (0, global_2.LogError)(result[0].body);
71
73
  return {
72
74
  Message: message,
73
75
  Success: false,
74
- Error: result[0].toString()
76
+ Error: result[0].toString(),
75
77
  };
76
78
  }
77
- }).catch((error) => {
78
- (0, core_1.LogError)(`Error sending email to ${msg.to}:`, undefined, error);
79
- (0, core_1.LogError)(error?.response?.body);
79
+ })
80
+ .catch((error) => {
81
+ (0, global_2.LogError)(`Error sending email to ${msg.to}:`, undefined, error);
82
+ (0, global_2.LogError)(error?.response?.body);
80
83
  return {
81
84
  Message: message,
82
85
  Success: false,
83
- Error: error.message
86
+ Error: error.message,
84
87
  };
85
88
  });
86
89
  }
@@ -88,7 +91,7 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
88
91
  return {
89
92
  Message: message,
90
93
  Success: false,
91
- Error: error.message
94
+ Error: error.message,
92
95
  };
93
96
  }
94
97
  }
@@ -96,19 +99,19 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
96
99
  * Fetches messages from the provider
97
100
  */
98
101
  async GetMessages(params) {
99
- throw new Error("SendGridProvider does not support fetching messages");
102
+ throw new Error('SendGridProvider does not support fetching messages');
100
103
  }
101
104
  /**
102
105
  * Forwards a message to another client using the provider
103
106
  */
104
107
  ForwardMessage(params) {
105
- throw new Error("SendGridProvider does not support forwarding messages");
108
+ throw new Error('SendGridProvider does not support forwarding messages');
106
109
  }
107
110
  /**
108
111
  * Replies to a message using the provider
109
112
  */
110
113
  ReplyToMessage(params) {
111
- throw new Error("SendGridProvider does not support replying to messages");
114
+ throw new Error('SendGridProvider does not support replying to messages');
112
115
  }
113
116
  /**
114
117
  * SendGrid does not support creating draft messages
@@ -116,7 +119,7 @@ let SendGridProvider = class SendGridProvider extends communication_types_1.Base
116
119
  async CreateDraft(params) {
117
120
  return {
118
121
  Success: false,
119
- ErrorMessage: 'SendGrid does not support creating draft messages. Drafts are only supported by email providers with mailbox access (Gmail, MS Graph).'
122
+ ErrorMessage: 'SendGrid does not support creating draft messages. Drafts are only supported by email providers with mailbox access (Gmail, MS Graph).',
120
123
  };
121
124
  }
122
125
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridProvider.js","sourceRoot":"","sources":["../src/SendGridProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6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": "@memberjunction/communication-sendgrid",
3
- "version": "2.111.0",
3
+ "version": "2.112.0",
4
4
  "description": "MemberJunction: SendGrid Provider for the MJ Communication Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,10 +19,9 @@
19
19
  "typescript": "^5.4.5"
20
20
  },
21
21
  "dependencies": {
22
- "@memberjunction/global": "2.111.0",
23
- "@memberjunction/core": "2.111.0",
24
- "@memberjunction/core-entities": "2.111.0",
25
- "@memberjunction/communication-types": "2.111.0",
22
+ "@memberjunction/global": "2.112.0",
23
+ "@memberjunction/core-entities": "2.112.0",
24
+ "@memberjunction/communication-types": "2.112.0",
26
25
  "@sendgrid/mail": "^8.1.3"
27
26
  },
28
27
  "repository": {