@clxmedia/emailhub-client 1.1.6 → 1.1.7

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
@@ -1,69 +1,5 @@
1
+ import { EmailHubConfig, EmailHubEnvironment, EmailHubMessage, EmailHubPriorityLevel, EmailHubSenderProfile } from "@clxmedia/types/emailhub";
1
2
  import { HttpStatusCode } from "axios";
2
- export declare enum EmailHubPriorityLevel {
3
- NORMAL = "normal",
4
- BULK = "bulk"
5
- }
6
- export declare enum EmailHubEnvironment {
7
- emailhub = "emailhub",
8
- localhost = "localhost"
9
- }
10
- export interface EmailHubAttachment {
11
- ContentType: string;
12
- Filename: string;
13
- Base64Content: string;
14
- }
15
- export interface EmailHubInlineAttachment extends EmailHubAttachment {
16
- ContentID: string;
17
- }
18
- export interface EmailHubRecipient {
19
- Email: string;
20
- Name?: string;
21
- }
22
- export interface EmailHubMessage {
23
- From: {
24
- Email: string;
25
- Name: string;
26
- };
27
- To: EmailHubRecipient[];
28
- Cc?: EmailHubRecipient[];
29
- Bcc?: EmailHubRecipient[];
30
- ReplyTo?: EmailHubRecipient | undefined;
31
- Subject: string;
32
- TextPart?: string;
33
- HTMLPart?: string;
34
- CustomID?: string;
35
- Attachments?: EmailHubAttachment[];
36
- InlinedAttachments?: EmailHubInlineAttachment[];
37
- }
38
- export interface EmailHubSender {
39
- guid: string;
40
- secret: string;
41
- }
42
- export interface EmailHubConfig {
43
- sender: EmailHubSender;
44
- server?: string;
45
- }
46
- export interface CredentialBody {
47
- client_email?: string;
48
- private_key?: string;
49
- }
50
- export interface EmailHubSenderProfile {
51
- id: number;
52
- guid: string;
53
- domain_name: string;
54
- domain_id: string;
55
- mailjet_sender_id: string;
56
- dkim_txt_name: string;
57
- dkim_txt_value: string;
58
- dkim_status: string;
59
- token_txt_name: string;
60
- token_txt_value: string;
61
- spf_txt_value: string;
62
- spf_status: string;
63
- created_at: string;
64
- updated_at?: string;
65
- verified_at?: string;
66
- }
67
3
  export declare class MockEmailHubClient {
68
4
  readonly environment: EmailHubEnvironment;
69
5
  private extendedLogging;
package/dist/client.js CHANGED
@@ -9,22 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EmailHubClient = exports.MockEmailHubClient = exports.EmailHubEnvironment = exports.EmailHubPriorityLevel = void 0;
12
+ exports.EmailHubClient = exports.MockEmailHubClient = void 0;
13
13
  const pubsub_1 = require("@google-cloud/pubsub");
14
+ const emailhub_1 = require("@clxmedia/types/emailhub");
14
15
  const luxon_1 = require("luxon");
15
16
  const uuid = require("uuid");
16
17
  const Pako = require("pako");
17
18
  const axios_1 = require("axios");
18
- var EmailHubPriorityLevel;
19
- (function (EmailHubPriorityLevel) {
20
- EmailHubPriorityLevel["NORMAL"] = "normal";
21
- EmailHubPriorityLevel["BULK"] = "bulk";
22
- })(EmailHubPriorityLevel = exports.EmailHubPriorityLevel || (exports.EmailHubPriorityLevel = {}));
23
- var EmailHubEnvironment;
24
- (function (EmailHubEnvironment) {
25
- EmailHubEnvironment["emailhub"] = "emailhub";
26
- EmailHubEnvironment["localhost"] = "localhost";
27
- })(EmailHubEnvironment = exports.EmailHubEnvironment || (exports.EmailHubEnvironment = {}));
28
19
  const DEFAULT_EMAIL_HUB_URL = 'https://emailhub.clxp.us';
29
20
  const DEFAULT_EMAIL_REGEX = /^([a-z0-9])([a-z\.0-9_%\-\+\*'’!#`&\$/]*)@(.+)\.(.+)$/;
30
21
  const mockEmailHubSenderProfile = {
@@ -46,7 +37,7 @@ const mockEmailHubSenderProfile = {
46
37
  };
47
38
  class MockEmailHubClient {
48
39
  constructor(extendedLogging = false) {
49
- this.environment = EmailHubEnvironment.localhost;
40
+ this.environment = emailhub_1.EmailHubEnvironment.localhost;
50
41
  this.extendedLogging = extendedLogging;
51
42
  }
52
43
  createSenderProfile(_domain) {
@@ -79,7 +70,7 @@ class MockEmailHubClient {
79
70
  exports.MockEmailHubClient = MockEmailHubClient;
80
71
  class EmailHubClient {
81
72
  constructor(cfg) {
82
- this.environment = EmailHubEnvironment.emailhub;
73
+ this.environment = emailhub_1.EmailHubEnvironment.emailhub;
83
74
  this.sender = cfg.sender;
84
75
  this.server = cfg.server ? cfg.server : DEFAULT_EMAIL_HUB_URL;
85
76
  }
@@ -155,7 +146,7 @@ class EmailHubClient {
155
146
  yield this.loadPubSubClient();
156
147
  const xMailGuid = msg && msg.CustomID ? msg.CustomID : uuid.v4();
157
148
  msg.CustomID = xMailGuid;
158
- const topic = options && options.priority && options.priority === EmailHubPriorityLevel.BULK ? 'send-new-email-bulk' : 'send-new-email';
149
+ const topic = options && options.priority && options.priority === emailhub_1.EmailHubPriorityLevel.BULK ? 'send-new-email-bulk' : 'send-new-email';
159
150
  if (this.pubsubClient !== null) {
160
151
  try {
161
152
  yield this.pubsubClient.topic(`projects/xperience-prod/topics/${topic}`)
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { EmailHubClient, EmailHubMessage, EmailHubAttachment, EmailHubConfig, EmailHubInlineAttachment, EmailHubRecipient, EmailHubPriorityLevel, EmailHubSender, MockEmailHubClient, EmailHubEnvironment, EmailHubSenderProfile } from './client';
1
+ export { EmailHubClient, MockEmailHubClient, } from './client';
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailHubEnvironment = exports.MockEmailHubClient = exports.EmailHubPriorityLevel = exports.EmailHubClient = void 0;
3
+ exports.MockEmailHubClient = 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
- Object.defineProperty(exports, "EmailHubPriorityLevel", { enumerable: true, get: function () { return client_1.EmailHubPriorityLevel; } });
7
6
  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.6",
3
+ "version": "1.1.7",
4
4
  "description": "CLXperience EmailHub Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",
@@ -57,7 +57,8 @@
57
57
  "tsc-watch": "5.0.3",
58
58
  "tsconfig-paths": "4.1.0",
59
59
  "tslint": "6.1.3",
60
- "typescript": "4.7.4"
60
+ "typescript": "4.7.4",
61
+ "@clxmedia/types": "1.0.3"
61
62
  },
62
63
  "jest": {
63
64
  "moduleFileExtensions": [
@@ -73,4 +74,4 @@
73
74
  "coverageDirectory": "../coverage",
74
75
  "testEnvironment": "node"
75
76
  }
76
- }
77
+ }