@clxmedia/emailhub-client 1.1.4 → 1.1.6

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
@@ -66,6 +66,8 @@ export interface EmailHubSenderProfile {
66
66
  }
67
67
  export declare class MockEmailHubClient {
68
68
  readonly environment: EmailHubEnvironment;
69
+ private extendedLogging;
70
+ constructor(extendedLogging?: boolean);
69
71
  createSenderProfile(_domain: string): Promise<{
70
72
  guid: string;
71
73
  id: number;
@@ -103,7 +105,6 @@ export declare class MockEmailHubClient {
103
105
  deleteSenderProfile(): Promise<void>;
104
106
  sendEmail(msg: EmailHubMessage, options?: {
105
107
  priority?: EmailHubPriorityLevel;
106
- writeToLog?: boolean;
107
108
  }): Promise<string>;
108
109
  }
109
110
  export declare class EmailHubClient {
@@ -112,7 +113,7 @@ export declare class EmailHubClient {
112
113
  private server;
113
114
  private pubsubClient;
114
115
  constructor(cfg: EmailHubConfig);
115
- static new(cfg: EmailHubConfig): EmailHubClient | MockEmailHubClient;
116
+ static new(cfg: EmailHubConfig, extendedLogging?: boolean): EmailHubClient | MockEmailHubClient;
116
117
  private loadPubSubClient;
117
118
  static validateEmailAddress(email?: string, regex?: RegExp): boolean;
118
119
  createSenderProfile(domain: string): Promise<EmailHubSenderProfile>;
package/dist/client.js CHANGED
@@ -45,8 +45,9 @@ const mockEmailHubSenderProfile = {
45
45
  verified_at: undefined
46
46
  };
47
47
  class MockEmailHubClient {
48
- constructor() {
48
+ constructor(extendedLogging = false) {
49
49
  this.environment = EmailHubEnvironment.localhost;
50
+ this.extendedLogging = extendedLogging;
50
51
  }
51
52
  createSenderProfile(_domain) {
52
53
  return __awaiter(this, void 0, void 0, function* () {
@@ -65,12 +66,13 @@ class MockEmailHubClient {
65
66
  }
66
67
  sendEmail(msg, options) {
67
68
  return __awaiter(this, void 0, void 0, function* () {
68
- if (options === null || options === void 0 ? void 0 : options.writeToLog) {
69
- console.log('----------------Begin mock email send-----------------');
69
+ if (this.extendedLogging) {
70
+ console.log(`----------------Begin mock email send: Priority: [${(options === null || options === void 0 ? void 0 : options.priority) || 'default'}]-----------------`);
70
71
  console.log(JSON.stringify(msg));
71
72
  console.log('----------------End mock email send-----------------');
72
73
  }
73
- return uuid.v4();
74
+ const xMailGuid = msg && msg.CustomID ? msg.CustomID : uuid.v4();
75
+ return xMailGuid;
74
76
  });
75
77
  }
76
78
  }
@@ -81,8 +83,8 @@ class EmailHubClient {
81
83
  this.sender = cfg.sender;
82
84
  this.server = cfg.server ? cfg.server : DEFAULT_EMAIL_HUB_URL;
83
85
  }
84
- static new(cfg) {
85
- return (cfg.sender.guid && cfg.sender.secret) ? new EmailHubClient(cfg) : new MockEmailHubClient();
86
+ static new(cfg, extendedLogging = false) {
87
+ return (cfg.sender.guid && cfg.sender.secret) ? new EmailHubClient(cfg) : new MockEmailHubClient(extendedLogging);
86
88
  }
87
89
  loadPubSubClient() {
88
90
  return __awaiter(this, void 0, void 0, function* () {
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { EmailHubClient, EmailHubMessage, EmailHubAttachment, EmailHubConfig, EmailHubInlineAttachment, EmailHubRecipient, EmailHubPriorityLevel, EmailHubSender } from './client';
1
+ export { EmailHubClient, EmailHubMessage, EmailHubAttachment, EmailHubConfig, EmailHubInlineAttachment, EmailHubRecipient, EmailHubPriorityLevel, EmailHubSender, MockEmailHubClient, EmailHubEnvironment, EmailHubSenderProfile } from './client';
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailHubPriorityLevel = exports.EmailHubClient = void 0;
3
+ exports.EmailHubEnvironment = exports.MockEmailHubClient = exports.EmailHubPriorityLevel = exports.EmailHubClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "EmailHubClient", { enumerable: true, get: function () { return client_1.EmailHubClient; } });
6
6
  Object.defineProperty(exports, "EmailHubPriorityLevel", { enumerable: true, get: function () { return client_1.EmailHubPriorityLevel; } });
7
+ Object.defineProperty(exports, "MockEmailHubClient", { enumerable: true, get: function () { return client_1.MockEmailHubClient; } });
8
+ Object.defineProperty(exports, "EmailHubEnvironment", { enumerable: true, get: function () { return client_1.EmailHubEnvironment; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/emailhub-client",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "CLXperience EmailHub Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",