@clxmedia/emailhub-client 1.0.9 → 1.1.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.
package/dist/client.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare class EmailHubClient {
48
48
  private pubsubClient;
49
49
  constructor(cfg: EmailHubConfig);
50
50
  private loadPubSubClient;
51
+ static validateEmailAddress(email?: string, regex?: RegExp): boolean;
51
52
  sendEmail(msg: EmailHubMessage, options?: {
52
53
  priority?: EmailHubPriorityLevel;
53
54
  }): Promise<string>;
package/dist/client.js CHANGED
@@ -20,6 +20,7 @@ var EmailHubPriorityLevel;
20
20
  EmailHubPriorityLevel["BULK"] = "bulk";
21
21
  })(EmailHubPriorityLevel = exports.EmailHubPriorityLevel || (exports.EmailHubPriorityLevel = {}));
22
22
  const DEFAULT_EMAIL_HUB_URL = 'https://emailhub.clxp.us';
23
+ const DEFAULT_EMAIL_REGEX = /^([a-z0-9])([a-z\.0-9_%\-\+\*'’!#`&\$/]*)@(.+)\.(.+)$/;
23
24
  class EmailHubClient {
24
25
  constructor(cfg) {
25
26
  this.sender = cfg.sender;
@@ -42,6 +43,12 @@ class EmailHubClient {
42
43
  }
43
44
  });
44
45
  }
46
+ static validateEmailAddress(email, regex = DEFAULT_EMAIL_REGEX) {
47
+ if (!email) {
48
+ return false;
49
+ }
50
+ return regex.test(email.toLocaleLowerCase());
51
+ }
45
52
  sendEmail(msg, options) {
46
53
  return __awaiter(this, void 0, void 0, function* () {
47
54
  yield this.loadPubSubClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/emailhub-client",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "CLXperience EmailHub Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",