@prezly/sdk 11.8.0 → 11.8.1-cjs

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.
Files changed (131) hide show
  1. package/dist/Client.js +33 -27
  2. package/dist/api/ApiClient.js +19 -12
  3. package/dist/api/DeferredJobsApiClient.js +19 -12
  4. package/dist/api/constants.js +9 -2
  5. package/dist/api/index.js +19 -2
  6. package/dist/endpoints/Accounts/Client.js +13 -6
  7. package/dist/endpoints/Accounts/index.js +25 -2
  8. package/dist/endpoints/Accounts/types.js +1 -1
  9. package/dist/endpoints/Billing/Client.js +11 -4
  10. package/dist/endpoints/Billing/index.js +25 -2
  11. package/dist/endpoints/Billing/types.js +15 -6
  12. package/dist/endpoints/CampaignRecipients/Client.js +19 -12
  13. package/dist/endpoints/CampaignRecipients/index.js +37 -3
  14. package/dist/endpoints/CampaignRecipients/types.js +1 -1
  15. package/dist/endpoints/Campaigns/Client.js +25 -18
  16. package/dist/endpoints/Campaigns/index.js +25 -2
  17. package/dist/endpoints/Campaigns/types.js +1 -1
  18. package/dist/endpoints/ContactsExports/Client.js +15 -8
  19. package/dist/endpoints/ContactsExports/index.js +37 -3
  20. package/dist/endpoints/ContactsExports/types.js +1 -1
  21. package/dist/endpoints/Coverage/Client.js +19 -12
  22. package/dist/endpoints/Coverage/index.js +25 -2
  23. package/dist/endpoints/Coverage/types.js +1 -1
  24. package/dist/endpoints/Jobs/Client.js +11 -4
  25. package/dist/endpoints/Jobs/index.js +25 -2
  26. package/dist/endpoints/Jobs/types.js +1 -1
  27. package/dist/endpoints/Licenses/Client.js +11 -4
  28. package/dist/endpoints/Licenses/index.js +15 -1
  29. package/dist/endpoints/NewsroomCategories/Client.js +15 -8
  30. package/dist/endpoints/NewsroomCategories/index.js +25 -2
  31. package/dist/endpoints/NewsroomCategories/types.js +1 -1
  32. package/dist/endpoints/NewsroomContacts/Client.js +18 -11
  33. package/dist/endpoints/NewsroomContacts/index.js +25 -2
  34. package/dist/endpoints/NewsroomContacts/types.js +1 -1
  35. package/dist/endpoints/NewsroomDomains/Client.js +16 -9
  36. package/dist/endpoints/NewsroomDomains/index.js +25 -2
  37. package/dist/endpoints/NewsroomDomains/types.js +1 -1
  38. package/dist/endpoints/NewsroomGalleries/Client.js +20 -13
  39. package/dist/endpoints/NewsroomGalleries/index.js +25 -2
  40. package/dist/endpoints/NewsroomGalleries/types.js +1 -1
  41. package/dist/endpoints/NewsroomLanguages/Client.js +17 -10
  42. package/dist/endpoints/NewsroomLanguages/index.js +25 -2
  43. package/dist/endpoints/NewsroomLanguages/lib.js +7 -1
  44. package/dist/endpoints/NewsroomLanguages/types.js +1 -1
  45. package/dist/endpoints/NewsroomPrivacyRequests/Client.js +12 -5
  46. package/dist/endpoints/NewsroomPrivacyRequests/index.js +25 -2
  47. package/dist/endpoints/NewsroomPrivacyRequests/types.js +1 -1
  48. package/dist/endpoints/NewsroomSubscriptions/Client.js +11 -4
  49. package/dist/endpoints/NewsroomSubscriptions/index.js +25 -2
  50. package/dist/endpoints/NewsroomSubscriptions/types.js +1 -1
  51. package/dist/endpoints/NewsroomThemes/Client.js +14 -7
  52. package/dist/endpoints/NewsroomThemes/index.js +15 -1
  53. package/dist/endpoints/NewsroomWebhooks/Client.js +15 -8
  54. package/dist/endpoints/NewsroomWebhooks/index.js +25 -2
  55. package/dist/endpoints/NewsroomWebhooks/types.js +1 -1
  56. package/dist/endpoints/Newsrooms/Client.js +22 -15
  57. package/dist/endpoints/Newsrooms/index.js +25 -2
  58. package/dist/endpoints/Newsrooms/types.js +1 -1
  59. package/dist/endpoints/NotificationSubscriptions/Client.js +12 -5
  60. package/dist/endpoints/NotificationSubscriptions/index.js +25 -2
  61. package/dist/endpoints/NotificationSubscriptions/types.js +1 -1
  62. package/dist/endpoints/SenderAddresses/Client.js +15 -8
  63. package/dist/endpoints/SenderAddresses/index.js +25 -2
  64. package/dist/endpoints/SenderAddresses/types.js +1 -1
  65. package/dist/endpoints/Signup/Client.js +11 -4
  66. package/dist/endpoints/Signup/index.js +25 -2
  67. package/dist/endpoints/Signup/types.js +9 -2
  68. package/dist/endpoints/Snippets/Client.js +15 -8
  69. package/dist/endpoints/Snippets/index.js +25 -2
  70. package/dist/endpoints/Snippets/types.js +1 -1
  71. package/dist/endpoints/Stories/Client.js +30 -23
  72. package/dist/endpoints/Stories/index.js +35 -3
  73. package/dist/endpoints/Stories/scopes.js +11 -4
  74. package/dist/endpoints/Stories/types.js +10 -2
  75. package/dist/endpoints/Subscriptions/Client.js +15 -8
  76. package/dist/endpoints/Subscriptions/index.js +25 -2
  77. package/dist/endpoints/Subscriptions/types.js +9 -2
  78. package/dist/endpoints/index.js +56 -24
  79. package/dist/http/ApiError.js +9 -2
  80. package/dist/http/Http.js +21 -14
  81. package/dist/http/constants.js +12 -3
  82. package/dist/http/createRequest.js +20 -13
  83. package/dist/http/index.js +39 -4
  84. package/dist/http/lib.js +16 -6
  85. package/dist/http/types.js +12 -4
  86. package/dist/index.js +56 -5
  87. package/dist/routing.js +9 -2
  88. package/dist/types/Campaign.js +11 -4
  89. package/dist/types/Category.js +1 -1
  90. package/dist/types/Contact.js +9 -2
  91. package/dist/types/ContactDuplicateSuggestion.js +9 -2
  92. package/dist/types/ContactsExport.js +9 -2
  93. package/dist/types/ContactsScope.js +9 -2
  94. package/dist/types/Country.js +1 -1
  95. package/dist/types/CoverageEntry.js +9 -2
  96. package/dist/types/Culture.js +9 -2
  97. package/dist/types/Currency.js +9 -2
  98. package/dist/types/DnsConfigurationInstruction.js +1 -1
  99. package/dist/types/EmailRecipient.js +9 -2
  100. package/dist/types/EmailSubscription.js +1 -1
  101. package/dist/types/JobState.js +9 -2
  102. package/dist/types/License.js +9 -2
  103. package/dist/types/Newsroom.js +9 -2
  104. package/dist/types/NewsroomCompanyInformation.js +1 -1
  105. package/dist/types/NewsroomContact.js +1 -1
  106. package/dist/types/NewsroomDomain.js +9 -2
  107. package/dist/types/NewsroomGallery.js +9 -2
  108. package/dist/types/NewsroomLanguageSettings.js +1 -1
  109. package/dist/types/NewsroomTheme.js +12 -4
  110. package/dist/types/NewsroomWebhook.js +9 -2
  111. package/dist/types/NotificationSubscription.js +9 -2
  112. package/dist/types/Permissions.js +9 -2
  113. package/dist/types/Plan.js +9 -2
  114. package/dist/types/PrivacyRequest.js +9 -2
  115. package/dist/types/SEOSettings.js +1 -1
  116. package/dist/types/SenderAddress.js +9 -2
  117. package/dist/types/SenderDomain.js +9 -2
  118. package/dist/types/Snippet.js +1 -1
  119. package/dist/types/Story.js +9 -2
  120. package/dist/types/User.js +9 -2
  121. package/dist/types/UserAccount.js +1 -1
  122. package/dist/types/common/Notification.js +9 -2
  123. package/dist/types/common/OEmbedInfo.js +9 -2
  124. package/dist/types/common/Pagination.js +9 -4
  125. package/dist/types/common/Query.js +9 -3
  126. package/dist/types/common/Utm.js +1 -1
  127. package/dist/types/common/Warning.js +1 -1
  128. package/dist/types/common/index.js +65 -6
  129. package/dist/types/index.js +325 -33
  130. package/dist/utils.js +9 -2
  131. package/package.json +6 -5
package/dist/Client.js CHANGED
@@ -1,39 +1,45 @@
1
- import { ApiClient, DeferredJobsApiClient } from "./api/index.js";
2
- import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createClient = createClient;
7
+ var _index = require("./api/index.js");
8
+ var _index2 = require("./endpoints/index.js");
3
9
  const DEFAULT_BASE_URL = 'https://api.prezly.com';
4
- export function createClient({
10
+ function createClient({
5
11
  accessToken,
6
12
  baseUrl = DEFAULT_BASE_URL,
7
13
  headers = {}
8
14
  }) {
9
- const apiClient = new DeferredJobsApiClient(new ApiClient({
15
+ const apiClient = new _index.DeferredJobsApiClient(new _index.ApiClient({
10
16
  accessToken,
11
17
  baseUrl,
12
18
  headers
13
19
  }));
14
20
  return {
15
- accounts: new Accounts.Client(apiClient),
16
- billing: new Billing.Client(apiClient),
17
- campaigns: new Campaigns.Client(apiClient),
18
- campaignRecipients: new CampaignRecipients.Client(apiClient),
19
- contactsExports: new ContactsExports.Client(apiClient),
20
- coverage: new Coverage.Client(apiClient),
21
- jobs: new Jobs.Client(apiClient),
22
- licenses: new Licenses.Client(apiClient),
23
- newsrooms: new Newsrooms.Client(apiClient),
24
- newsroomCategories: new NewsroomCategories.Client(apiClient),
25
- newsroomContacts: new NewsroomContacts.Client(apiClient),
26
- newsroomLanguages: new NewsroomLanguages.Client(apiClient),
27
- newsroomThemes: new NewsroomThemes.Client(apiClient),
28
- newsroomWebhooks: new NewsroomWebhooks.Client(apiClient),
29
- newsroomPrivacyRequests: new NewsroomPrivacyRequests.Client(apiClient),
30
- newsroomDomains: new NewsroomDomains.Client(apiClient),
31
- newsroomGalleries: new NewsroomGalleries.Client(apiClient),
32
- senderAddresses: new SenderAddresses.Client(apiClient),
33
- signup: new Signup.Client(apiClient),
34
- stories: new Stories.Client(apiClient),
35
- snippets: new Snippets.Client(apiClient),
36
- subscriptions: new Subscriptions.Client(apiClient),
37
- notificationSubscriptions: new NotificationSubscriptions.Client(apiClient)
21
+ accounts: new _index2.Accounts.Client(apiClient),
22
+ billing: new _index2.Billing.Client(apiClient),
23
+ campaigns: new _index2.Campaigns.Client(apiClient),
24
+ campaignRecipients: new _index2.CampaignRecipients.Client(apiClient),
25
+ contactsExports: new _index2.ContactsExports.Client(apiClient),
26
+ coverage: new _index2.Coverage.Client(apiClient),
27
+ jobs: new _index2.Jobs.Client(apiClient),
28
+ licenses: new _index2.Licenses.Client(apiClient),
29
+ newsrooms: new _index2.Newsrooms.Client(apiClient),
30
+ newsroomCategories: new _index2.NewsroomCategories.Client(apiClient),
31
+ newsroomContacts: new _index2.NewsroomContacts.Client(apiClient),
32
+ newsroomLanguages: new _index2.NewsroomLanguages.Client(apiClient),
33
+ newsroomThemes: new _index2.NewsroomThemes.Client(apiClient),
34
+ newsroomWebhooks: new _index2.NewsroomWebhooks.Client(apiClient),
35
+ newsroomPrivacyRequests: new _index2.NewsroomPrivacyRequests.Client(apiClient),
36
+ newsroomDomains: new _index2.NewsroomDomains.Client(apiClient),
37
+ newsroomGalleries: new _index2.NewsroomGalleries.Client(apiClient),
38
+ senderAddresses: new _index2.SenderAddresses.Client(apiClient),
39
+ signup: new _index2.Signup.Client(apiClient),
40
+ stories: new _index2.Stories.Client(apiClient),
41
+ snippets: new _index2.Snippets.Client(apiClient),
42
+ subscriptions: new _index2.Subscriptions.Client(apiClient),
43
+ notificationSubscriptions: new _index2.NotificationSubscriptions.Client(apiClient)
38
44
  };
39
45
  }
@@ -1,7 +1,13 @@
1
- import { Http } from "../http/index.js";
2
- import { stripSlashes } from "../utils.js";
3
- import { DEFAULT_USER_AGENT } from "./constants.js";
4
- export class ApiClient {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ApiClient = void 0;
7
+ var _index = require("../http/index.js");
8
+ var _utils = require("../utils.js");
9
+ var _constants = require("./constants.js");
10
+ class ApiClient {
5
11
  constructor({
6
12
  accessToken,
7
13
  baseUrl,
@@ -10,7 +16,7 @@ export class ApiClient {
10
16
  this.baseUrl = baseUrl;
11
17
  this.headers = {
12
18
  authorization: `Bearer ${accessToken}`,
13
- 'User-Agent': DEFAULT_USER_AGENT,
19
+ 'User-Agent': _constants.DEFAULT_USER_AGENT,
14
20
  ...headers
15
21
  };
16
22
  }
@@ -18,7 +24,7 @@ export class ApiClient {
18
24
  headers,
19
25
  query
20
26
  } = {}) {
21
- return Http.get(this.buildEndpointUrl(endpointUri), {
27
+ return _index.Http.get(this.buildEndpointUrl(endpointUri), {
22
28
  headers: {
23
29
  ...this.headers,
24
30
  ...headers
@@ -31,7 +37,7 @@ export class ApiClient {
31
37
  payload,
32
38
  query
33
39
  } = {}) {
34
- return Http.post(this.buildEndpointUrl(endpointUri), {
40
+ return _index.Http.post(this.buildEndpointUrl(endpointUri), {
35
41
  headers: {
36
42
  ...this.headers,
37
43
  ...headers
@@ -45,7 +51,7 @@ export class ApiClient {
45
51
  payload,
46
52
  query
47
53
  } = {}) {
48
- return Http.put(this.buildEndpointUrl(endpointUri), {
54
+ return _index.Http.put(this.buildEndpointUrl(endpointUri), {
49
55
  headers: {
50
56
  ...this.headers,
51
57
  ...headers
@@ -59,7 +65,7 @@ export class ApiClient {
59
65
  payload,
60
66
  query
61
67
  } = {}) {
62
- return Http.patch(this.buildEndpointUrl(endpointUri), {
68
+ return _index.Http.patch(this.buildEndpointUrl(endpointUri), {
63
69
  headers: {
64
70
  ...this.headers,
65
71
  ...headers
@@ -73,7 +79,7 @@ export class ApiClient {
73
79
  payload,
74
80
  query
75
81
  } = {}) {
76
- return Http.delete(this.buildEndpointUrl(endpointUri), {
82
+ return _index.Http.delete(this.buildEndpointUrl(endpointUri), {
77
83
  headers: {
78
84
  ...this.headers,
79
85
  ...headers
@@ -83,6 +89,7 @@ export class ApiClient {
83
89
  });
84
90
  }
85
91
  buildEndpointUrl(endpointUri) {
86
- return `${stripSlashes(this.baseUrl)}/${stripSlashes(endpointUri)}`;
92
+ return `${(0, _utils.stripSlashes)(this.baseUrl)}/${(0, _utils.stripSlashes)(endpointUri)}`;
87
93
  }
88
- }
94
+ }
95
+ exports.ApiClient = ApiClient;
@@ -1,7 +1,13 @@
1
- import { ProgressPromise } from '@prezly/progress-promise';
2
- import { Http, HttpCodes, isDeferredJobResponse } from "../http/index.js";
3
- import { routing } from "../routing.js";
4
- import { JobStatus } from "../types/index.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DeferredJobsApiClient = void 0;
7
+ var _progressPromise = require("@prezly/progress-promise");
8
+ var _index = require("../http/index.js");
9
+ var _routing = require("../routing.js");
10
+ var _index2 = require("../types/index.js");
5
11
  const JOB_STATUS_POLLING_INTERVAL = 2000; // ms
6
12
 
7
13
  async function sleep(milliseconds) {
@@ -9,18 +15,18 @@ async function sleep(milliseconds) {
9
15
  }
10
16
  async function handleDeferredJob(request) {
11
17
  const response = await request;
12
- if (response.status === HttpCodes.ACCEPTED && isDeferredJobResponse(response.payload)) {
13
- return new ProgressPromise(async function (resolve, reject, progress) {
18
+ if (response.status === _index.HttpCodes.ACCEPTED && (0, _index.isDeferredJobResponse)(response.payload)) {
19
+ return new _progressPromise.ProgressPromise(async function (resolve, reject, progress) {
14
20
  do {
15
- const response = await Http.get(routing.jobsUrl);
21
+ const response = await _index.Http.get(_routing.routing.jobsUrl);
16
22
  const {
17
23
  job
18
24
  } = response.payload;
19
- if (job.status === JobStatus.RESOLVED) {
25
+ if (job.status === _index2.JobStatus.RESOLVED) {
20
26
  resolve(job.value);
21
27
  return;
22
28
  }
23
- if (job.status === JobStatus.REJECTED) {
29
+ if (job.status === _index2.JobStatus.REJECTED) {
24
30
  reject(job.value);
25
31
  return;
26
32
  }
@@ -30,9 +36,9 @@ async function handleDeferredJob(request) {
30
36
  });
31
37
  }
32
38
 
33
- return ProgressPromise.resolve(response.payload);
39
+ return _progressPromise.ProgressPromise.resolve(response.payload);
34
40
  }
35
- export class DeferredJobsApiClient {
41
+ class DeferredJobsApiClient {
36
42
  constructor(apiClient) {
37
43
  this.apiClient = apiClient;
38
44
  }
@@ -89,4 +95,5 @@ export class DeferredJobsApiClient {
89
95
  query
90
96
  }));
91
97
  }
92
- }
98
+ }
99
+ exports.DeferredJobsApiClient = DeferredJobsApiClient;
@@ -1,3 +1,10 @@
1
- const VERSION = "11.7.1";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_USER_AGENT = void 0;
7
+ const VERSION = "11.8.0";
2
8
  const URL = 'https://github.com/prezly/javascript-sdk';
3
- export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
9
+ const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
10
+ exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
package/dist/api/index.js CHANGED
@@ -1,2 +1,19 @@
1
- export { ApiClient } from "./ApiClient.js";
2
- export { DeferredJobsApiClient } from "./DeferredJobsApiClient.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ApiClient", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ApiClient.ApiClient;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "DeferredJobsApiClient", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _DeferredJobsApiClient.DeferredJobsApiClient;
16
+ }
17
+ });
18
+ var _ApiClient = require("./ApiClient.js");
19
+ var _DeferredJobsApiClient = require("./DeferredJobsApiClient.js");
@@ -1,22 +1,29 @@
1
- import { routing } from "../../routing.js";
2
- export class Client {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Client = void 0;
7
+ var _routing = require("../../routing.js");
8
+ class Client {
3
9
  constructor(apiClient) {
4
10
  this.apiClient = apiClient;
5
11
  }
6
12
  async list() {
7
- const url = routing.accounts;
13
+ const url = _routing.routing.accounts;
8
14
  return this.apiClient.get(url);
9
15
  }
10
16
  async create(payload) {
11
- const url = routing.accounts;
17
+ const url = _routing.routing.accounts;
12
18
  return this.apiClient.post(url, {
13
19
  payload
14
20
  });
15
21
  }
16
22
  async update(id, payload) {
17
- const url = `${routing.accounts}/${id}`;
23
+ const url = `${_routing.routing.accounts}/${id}`;
18
24
  return this.apiClient.patch(url, {
19
25
  payload
20
26
  });
21
27
  }
22
- }
28
+ }
29
+ exports.Client = Client;
@@ -1,2 +1,25 @@
1
- export * from "./Client.js";
2
- export * from "./types.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Client = require("./Client.js");
7
+ Object.keys(_Client).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ Object.defineProperty(exports, key, {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _Client[key];
13
+ }
14
+ });
15
+ });
16
+ var _types = require("./types.js");
17
+ Object.keys(_types).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _types[key];
23
+ }
24
+ });
25
+ });
@@ -1 +1 @@
1
- export {};
1
+ "use strict";
@@ -1,12 +1,19 @@
1
- import { routing } from "../../routing.js";
2
- export class Client {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Client = void 0;
7
+ var _routing = require("../../routing.js");
8
+ class Client {
3
9
  constructor(apiClient) {
4
10
  this.apiClient = apiClient;
5
11
  }
6
12
  async signup(payload) {
7
- const url = `${routing.billing}/signup`;
13
+ const url = `${_routing.routing.billing}/signup`;
8
14
  return this.apiClient.post(url, {
9
15
  payload
10
16
  });
11
17
  }
12
- }
18
+ }
19
+ exports.Client = Client;
@@ -1,2 +1,25 @@
1
- export * from "./Client.js";
2
- export * from "./types.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Client = require("./Client.js");
7
+ Object.keys(_Client).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ Object.defineProperty(exports, key, {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _Client[key];
13
+ }
14
+ });
15
+ });
16
+ var _types = require("./types.js");
17
+ Object.keys(_types).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _types[key];
23
+ }
24
+ });
25
+ });
@@ -1,16 +1,25 @@
1
- export let SignupPlan;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SignupBillingCycle = exports.SignupCurrency = exports.SignupPlan = void 0;
7
+ let SignupPlan;
8
+ exports.SignupPlan = SignupPlan;
2
9
  (function (SignupPlan) {
3
10
  SignupPlan["STARTER"] = "starter";
4
11
  SignupPlan["CORE"] = "core";
5
12
  SignupPlan["PREMIUM"] = "premium";
6
- })(SignupPlan || (SignupPlan = {}));
7
- export let SignupCurrency;
13
+ })(SignupPlan || (exports.SignupPlan = SignupPlan = {}));
14
+ let SignupCurrency;
15
+ exports.SignupCurrency = SignupCurrency;
8
16
  (function (SignupCurrency) {
9
17
  SignupCurrency["EUR"] = "eur";
10
18
  SignupCurrency["USD"] = "usd";
11
- })(SignupCurrency || (SignupCurrency = {}));
12
- export let SignupBillingCycle;
19
+ })(SignupCurrency || (exports.SignupCurrency = SignupCurrency = {}));
20
+ let SignupBillingCycle;
21
+ exports.SignupBillingCycle = SignupBillingCycle;
13
22
  (function (SignupBillingCycle) {
14
23
  SignupBillingCycle["YEAR"] = "year";
15
24
  SignupBillingCycle["MONTH"] = "month";
16
- })(SignupBillingCycle || (SignupBillingCycle = {}));
25
+ })(SignupBillingCycle || (exports.SignupBillingCycle = SignupBillingCycle = {}));
@@ -1,6 +1,12 @@
1
- import { routing } from "../../routing.js";
2
- import { Query } from "../../types/index.js";
3
- export class Client {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Client = void 0;
7
+ var _routing = require("../../routing.js");
8
+ var _index = require("../../types/index.js");
9
+ class Client {
4
10
  constructor(apiClient) {
5
11
  this.apiClient = apiClient;
6
12
  }
@@ -10,7 +16,7 @@ export class Client {
10
16
  offset,
11
17
  sortOrder
12
18
  } = options;
13
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
19
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
14
20
  return this.apiClient.get(url, {
15
21
  query: {
16
22
  limit,
@@ -26,11 +32,11 @@ export class Client {
26
32
  sortOrder,
27
33
  query
28
34
  } = options;
29
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
35
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
30
36
  // TODO: Introduce dedicated Search POST API
31
37
  return this.apiClient.get(url, {
32
38
  query: {
33
- query: Query.stringify(query),
39
+ query: _index.Query.stringify(query),
34
40
  sort: sortOrder,
35
41
  limit,
36
42
  offset
@@ -38,14 +44,14 @@ export class Client {
38
44
  });
39
45
  }
40
46
  async get(campaignId, recipientId) {
41
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
47
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
42
48
  const {
43
49
  recipient
44
50
  } = await this.apiClient.get(`${url}/${recipientId}`);
45
51
  return recipient;
46
52
  }
47
53
  async addContact(campaignId, contact) {
48
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
54
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
49
55
  return this.apiClient.post(url, {
50
56
  payload: {
51
57
  contact
@@ -53,7 +59,7 @@ export class Client {
53
59
  });
54
60
  }
55
61
  async addContacts(campaignId, contacts) {
56
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
62
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
57
63
  return this.apiClient.post(url, {
58
64
  payload: {
59
65
  contacts
@@ -61,18 +67,19 @@ export class Client {
61
67
  });
62
68
  }
63
69
  async removeRecipient(campaignId, recipientId) {
64
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
70
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
65
71
  return this.apiClient.delete(`${url}/${recipientId}`);
66
72
  }
67
73
  async removeRecipients(campaignId, params) {
68
74
  const {
69
75
  query
70
76
  } = params || {};
71
- const url = routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
77
+ const url = _routing.routing.campaignRecipientsUrl.replace(':campaign_id', String(campaignId));
72
78
  return this.apiClient.delete(url, {
73
79
  payload: {
74
80
  query
75
81
  }
76
82
  });
77
83
  }
78
- }
84
+ }
85
+ exports.Client = Client;
@@ -1,3 +1,37 @@
1
- export * from "./Client.js";
2
- export * from "./types.js";
3
- export { ContactsScope } from "../../types/index.js"; // convenience shortcut & BC
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ ContactsScope: true
8
+ };
9
+ Object.defineProperty(exports, "ContactsScope", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _index.ContactsScope;
13
+ }
14
+ });
15
+ var _Client = require("./Client.js");
16
+ Object.keys(_Client).forEach(function (key) {
17
+ if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _Client[key];
23
+ }
24
+ });
25
+ });
26
+ var _types = require("./types.js");
27
+ Object.keys(_types).forEach(function (key) {
28
+ if (key === "default" || key === "__esModule") return;
29
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
30
+ Object.defineProperty(exports, key, {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _types[key];
34
+ }
35
+ });
36
+ });
37
+ var _index = require("../../types/index.js");
@@ -1 +1 @@
1
- export {};
1
+ "use strict";
@@ -1,7 +1,13 @@
1
- import { routing } from "../../routing.js";
2
- import { Query } from "../../types/index.js";
3
- import { toIso8601 } from "../../utils.js";
4
- export class Client {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Client = void 0;
7
+ var _routing = require("../../routing.js");
8
+ var _index = require("../../types/index.js");
9
+ var _utils = require("../../utils.js");
10
+ class Client {
5
11
  constructor(apiClient) {
6
12
  this.apiClient = apiClient;
7
13
  }
@@ -12,11 +18,11 @@ export class Client {
12
18
  offset,
13
19
  sortOrder
14
20
  } = options;
15
- return this.apiClient.get(routing.campaignsUrl, {
21
+ return this.apiClient.get(_routing.routing.campaignsUrl, {
16
22
  query: {
17
23
  limit,
18
24
  offset,
19
- query: Query.stringify(query),
25
+ query: _index.Query.stringify(query),
20
26
  sort: sortOrder
21
27
  }
22
28
  });
@@ -28,7 +34,7 @@ export class Client {
28
34
  offset,
29
35
  sortOrder
30
36
  } = options;
31
- return this.apiClient.post(routing.campaignsUrl, {
37
+ return this.apiClient.post(_routing.routing.campaignsUrl, {
32
38
  payload: {
33
39
  limit,
34
40
  offset,
@@ -38,30 +44,30 @@ export class Client {
38
44
  });
39
45
  }
40
46
  async get(id) {
41
- return this.apiClient.get(`${routing.campaignsUrl}/${id}`);
47
+ return this.apiClient.get(`${_routing.routing.campaignsUrl}/${id}`);
42
48
  }
43
49
  async duplicate(id) {
44
- return this.apiClient.post(`${routing.campaignsUrl}/${id}/duplicate`);
50
+ return this.apiClient.post(`${_routing.routing.campaignsUrl}/${id}/duplicate`);
45
51
  }
46
52
  async delete(id) {
47
- return this.apiClient.delete(`${routing.campaignsUrl}/${id}`);
53
+ return this.apiClient.delete(`${_routing.routing.campaignsUrl}/${id}`);
48
54
  }
49
55
  async test(id, emails) {
50
- return this.apiClient.post(`${routing.campaignsUrl}/${id}/test`, {
56
+ return this.apiClient.post(`${_routing.routing.campaignsUrl}/${id}/test`, {
51
57
  payload: {
52
58
  emails
53
59
  }
54
60
  });
55
61
  }
56
62
  async send(id) {
57
- return this.apiClient.post(`${routing.campaignsUrl}/${id}/send`);
63
+ return this.apiClient.post(`${_routing.routing.campaignsUrl}/${id}/send`);
58
64
  }
59
65
  async schedule(id, sendAt) {
60
66
  const {
61
67
  campaign
62
- } = await this.apiClient.post(`${routing.campaignsUrl}/${id}/schedule`, {
68
+ } = await this.apiClient.post(`${_routing.routing.campaignsUrl}/${id}/schedule`, {
63
69
  payload: {
64
- schedule_at: toIso8601(sendAt)
70
+ schedule_at: (0, _utils.toIso8601)(sendAt)
65
71
  }
66
72
  });
67
73
  return campaign;
@@ -69,17 +75,18 @@ export class Client {
69
75
  async unschedule(id) {
70
76
  const {
71
77
  campaign
72
- } = await this.apiClient.post(`${routing.campaignsUrl}/${id}/unschedule`);
78
+ } = await this.apiClient.post(`${_routing.routing.campaignsUrl}/${id}/unschedule`);
73
79
  return campaign;
74
80
  }
75
81
  async create(payload) {
76
- return this.apiClient.post(routing.campaignsUrl, {
82
+ return this.apiClient.post(_routing.routing.campaignsUrl, {
77
83
  payload
78
84
  });
79
85
  }
80
86
  async update(id, payload) {
81
- return this.apiClient.patch(`${routing.campaignsUrl}/${id}`, {
87
+ return this.apiClient.patch(`${_routing.routing.campaignsUrl}/${id}`, {
82
88
  payload
83
89
  });
84
90
  }
85
- }
91
+ }
92
+ exports.Client = Client;
@@ -1,2 +1,25 @@
1
- export * from "./Client.js";
2
- export * from "./types.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Client = require("./Client.js");
7
+ Object.keys(_Client).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ Object.defineProperty(exports, key, {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _Client[key];
13
+ }
14
+ });
15
+ });
16
+ var _types = require("./types.js");
17
+ Object.keys(_types).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ Object.defineProperty(exports, key, {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _types[key];
23
+ }
24
+ });
25
+ });
@@ -1 +1 @@
1
- export {};
1
+ "use strict";