@prezly/sdk 11.7.1 → 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.
- package/dist/Client.js +33 -27
- package/dist/api/ApiClient.js +19 -12
- package/dist/api/DeferredJobsApiClient.js +19 -12
- package/dist/api/constants.js +9 -2
- package/dist/api/index.js +19 -2
- package/dist/endpoints/Accounts/Client.js +13 -6
- package/dist/endpoints/Accounts/index.js +25 -2
- package/dist/endpoints/Accounts/types.js +1 -1
- package/dist/endpoints/Billing/Client.js +11 -4
- package/dist/endpoints/Billing/index.js +25 -2
- package/dist/endpoints/Billing/types.js +15 -6
- package/dist/endpoints/CampaignRecipients/Client.js +19 -12
- package/dist/endpoints/CampaignRecipients/index.js +37 -3
- package/dist/endpoints/CampaignRecipients/types.js +1 -1
- package/dist/endpoints/Campaigns/Client.js +25 -18
- package/dist/endpoints/Campaigns/index.js +25 -2
- package/dist/endpoints/Campaigns/types.js +1 -1
- package/dist/endpoints/ContactsExports/Client.js +15 -8
- package/dist/endpoints/ContactsExports/index.js +37 -3
- package/dist/endpoints/ContactsExports/types.js +1 -1
- package/dist/endpoints/Coverage/Client.js +19 -12
- package/dist/endpoints/Coverage/index.js +25 -2
- package/dist/endpoints/Coverage/types.js +1 -1
- package/dist/endpoints/Jobs/Client.js +11 -4
- package/dist/endpoints/Jobs/index.js +25 -2
- package/dist/endpoints/Jobs/types.js +1 -1
- package/dist/endpoints/Licenses/Client.js +11 -4
- package/dist/endpoints/Licenses/index.js +15 -1
- package/dist/endpoints/NewsroomCategories/Client.js +15 -8
- package/dist/endpoints/NewsroomCategories/index.js +25 -2
- package/dist/endpoints/NewsroomCategories/types.js +1 -1
- package/dist/endpoints/NewsroomContacts/Client.js +18 -11
- package/dist/endpoints/NewsroomContacts/index.js +25 -2
- package/dist/endpoints/NewsroomContacts/types.js +1 -1
- package/dist/endpoints/NewsroomDomains/Client.js +16 -9
- package/dist/endpoints/NewsroomDomains/index.js +25 -2
- package/dist/endpoints/NewsroomDomains/types.js +1 -1
- package/dist/endpoints/NewsroomGalleries/Client.js +20 -13
- package/dist/endpoints/NewsroomGalleries/index.js +25 -2
- package/dist/endpoints/NewsroomGalleries/types.js +1 -1
- package/dist/endpoints/NewsroomLanguages/Client.js +17 -10
- package/dist/endpoints/NewsroomLanguages/index.js +25 -2
- package/dist/endpoints/NewsroomLanguages/lib.js +7 -1
- package/dist/endpoints/NewsroomLanguages/types.js +1 -1
- package/dist/endpoints/NewsroomPrivacyRequests/Client.js +12 -5
- package/dist/endpoints/NewsroomPrivacyRequests/index.js +25 -2
- package/dist/endpoints/NewsroomPrivacyRequests/types.js +1 -1
- package/dist/endpoints/NewsroomSubscriptions/Client.js +11 -4
- package/dist/endpoints/NewsroomSubscriptions/index.js +25 -2
- package/dist/endpoints/NewsroomSubscriptions/types.js +1 -1
- package/dist/endpoints/NewsroomThemes/Client.js +14 -7
- package/dist/endpoints/NewsroomThemes/index.js +15 -1
- package/dist/endpoints/NewsroomWebhooks/Client.js +15 -8
- package/dist/endpoints/NewsroomWebhooks/index.js +25 -2
- package/dist/endpoints/NewsroomWebhooks/types.js +1 -1
- package/dist/endpoints/Newsrooms/Client.js +22 -15
- package/dist/endpoints/Newsrooms/index.js +25 -2
- package/dist/endpoints/Newsrooms/types.js +1 -1
- package/dist/endpoints/NotificationSubscriptions/Client.js +12 -5
- package/dist/endpoints/NotificationSubscriptions/index.js +25 -2
- package/dist/endpoints/NotificationSubscriptions/types.js +1 -1
- package/dist/endpoints/SenderAddresses/Client.js +15 -8
- package/dist/endpoints/SenderAddresses/index.js +25 -2
- package/dist/endpoints/SenderAddresses/types.js +1 -1
- package/dist/endpoints/Signup/Client.js +11 -4
- package/dist/endpoints/Signup/index.js +25 -2
- package/dist/endpoints/Signup/types.js +9 -2
- package/dist/endpoints/Snippets/Client.js +15 -8
- package/dist/endpoints/Snippets/index.js +25 -2
- package/dist/endpoints/Snippets/types.js +1 -1
- package/dist/endpoints/Stories/Client.js +30 -23
- package/dist/endpoints/Stories/index.js +35 -3
- package/dist/endpoints/Stories/scopes.js +11 -4
- package/dist/endpoints/Stories/types.d.ts +5 -0
- package/dist/endpoints/Stories/types.js +10 -2
- package/dist/endpoints/Subscriptions/Client.js +15 -8
- package/dist/endpoints/Subscriptions/index.js +25 -2
- package/dist/endpoints/Subscriptions/types.js +9 -2
- package/dist/endpoints/index.js +56 -24
- package/dist/http/ApiError.js +9 -2
- package/dist/http/Http.js +21 -14
- package/dist/http/constants.js +12 -3
- package/dist/http/createRequest.js +20 -13
- package/dist/http/index.js +39 -4
- package/dist/http/lib.js +16 -6
- package/dist/http/types.js +12 -4
- package/dist/index.js +56 -5
- package/dist/routing.js +9 -2
- package/dist/types/Campaign.js +11 -4
- package/dist/types/Category.js +1 -1
- package/dist/types/Contact.js +9 -2
- package/dist/types/ContactDuplicateSuggestion.js +9 -2
- package/dist/types/ContactsExport.js +9 -2
- package/dist/types/ContactsScope.js +9 -2
- package/dist/types/Country.js +1 -1
- package/dist/types/CoverageEntry.js +9 -2
- package/dist/types/Culture.js +9 -2
- package/dist/types/Currency.js +9 -2
- package/dist/types/DnsConfigurationInstruction.js +1 -1
- package/dist/types/EmailRecipient.js +9 -2
- package/dist/types/EmailSubscription.js +1 -1
- package/dist/types/JobState.js +9 -2
- package/dist/types/License.js +9 -2
- package/dist/types/Newsroom.js +9 -2
- package/dist/types/NewsroomCompanyInformation.js +1 -1
- package/dist/types/NewsroomContact.js +1 -1
- package/dist/types/NewsroomDomain.js +9 -2
- package/dist/types/NewsroomGallery.js +9 -2
- package/dist/types/NewsroomLanguageSettings.js +1 -1
- package/dist/types/NewsroomTheme.js +12 -4
- package/dist/types/NewsroomWebhook.js +9 -2
- package/dist/types/NotificationSubscription.js +9 -2
- package/dist/types/Permissions.js +9 -2
- package/dist/types/Plan.js +9 -2
- package/dist/types/PrivacyRequest.js +9 -2
- package/dist/types/SEOSettings.d.ts +7 -0
- package/dist/types/SEOSettings.js +1 -0
- package/dist/types/SenderAddress.js +9 -2
- package/dist/types/SenderDomain.js +9 -2
- package/dist/types/Snippet.js +1 -1
- package/dist/types/Story.d.ts +2 -0
- package/dist/types/Story.js +9 -2
- package/dist/types/User.js +9 -2
- package/dist/types/UserAccount.js +1 -1
- package/dist/types/common/Notification.js +9 -2
- package/dist/types/common/OEmbedInfo.js +9 -2
- package/dist/types/common/Pagination.js +9 -4
- package/dist/types/common/Query.js +9 -3
- package/dist/types/common/Utm.js +1 -1
- package/dist/types/common/Warning.js +1 -1
- package/dist/types/common/index.js +65 -6
- package/dist/types/index.js +325 -33
- package/dist/utils.js +9 -2
- package/package.json +6 -5
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnsubscribeReason = void 0;
|
|
7
|
+
let UnsubscribeReason;
|
|
8
|
+
exports.UnsubscribeReason = UnsubscribeReason;
|
|
2
9
|
(function (UnsubscribeReason) {
|
|
3
10
|
UnsubscribeReason["UNKNOWN"] = "unknown";
|
|
4
11
|
UnsubscribeReason["UNWANTED"] = "unwanted";
|
|
5
12
|
UnsubscribeReason["SPAM"] = "spam";
|
|
6
13
|
UnsubscribeReason["NEVER_SIGNED_UP"] = "never_signed_up";
|
|
7
14
|
UnsubscribeReason["OTHER"] = "other";
|
|
8
|
-
})(UnsubscribeReason || (UnsubscribeReason = {}));
|
|
15
|
+
})(UnsubscribeReason || (exports.UnsubscribeReason = UnsubscribeReason = {}));
|
package/dist/endpoints/index.js
CHANGED
|
@@ -1,24 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotificationSubscriptions = exports.Subscriptions = exports.Stories = exports.Snippets = exports.Signup = exports.SenderAddresses = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.Newsrooms = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
|
|
7
|
+
var _Accounts = _interopRequireWildcard(require("./Accounts/index.js"));
|
|
8
|
+
exports.Accounts = _Accounts;
|
|
9
|
+
var _Billing = _interopRequireWildcard(require("./Billing/index.js"));
|
|
10
|
+
exports.Billing = _Billing;
|
|
11
|
+
var _CampaignRecipients = _interopRequireWildcard(require("./CampaignRecipients/index.js"));
|
|
12
|
+
exports.CampaignRecipients = _CampaignRecipients;
|
|
13
|
+
var _Campaigns = _interopRequireWildcard(require("./Campaigns/index.js"));
|
|
14
|
+
exports.Campaigns = _Campaigns;
|
|
15
|
+
var _ContactsExports = _interopRequireWildcard(require("./ContactsExports/index.js"));
|
|
16
|
+
exports.ContactsExports = _ContactsExports;
|
|
17
|
+
var _Coverage = _interopRequireWildcard(require("./Coverage/index.js"));
|
|
18
|
+
exports.Coverage = _Coverage;
|
|
19
|
+
var _Jobs = _interopRequireWildcard(require("./Jobs/index.js"));
|
|
20
|
+
exports.Jobs = _Jobs;
|
|
21
|
+
var _Licenses = _interopRequireWildcard(require("./Licenses/index.js"));
|
|
22
|
+
exports.Licenses = _Licenses;
|
|
23
|
+
var _NewsroomCategories = _interopRequireWildcard(require("./NewsroomCategories/index.js"));
|
|
24
|
+
exports.NewsroomCategories = _NewsroomCategories;
|
|
25
|
+
var _NewsroomContacts = _interopRequireWildcard(require("./NewsroomContacts/index.js"));
|
|
26
|
+
exports.NewsroomContacts = _NewsroomContacts;
|
|
27
|
+
var _NewsroomDomains = _interopRequireWildcard(require("./NewsroomDomains/index.js"));
|
|
28
|
+
exports.NewsroomDomains = _NewsroomDomains;
|
|
29
|
+
var _NewsroomGalleries = _interopRequireWildcard(require("./NewsroomGalleries/index.js"));
|
|
30
|
+
exports.NewsroomGalleries = _NewsroomGalleries;
|
|
31
|
+
var _NewsroomLanguages = _interopRequireWildcard(require("./NewsroomLanguages/index.js"));
|
|
32
|
+
exports.NewsroomLanguages = _NewsroomLanguages;
|
|
33
|
+
var _NewsroomPrivacyRequests = _interopRequireWildcard(require("./NewsroomPrivacyRequests/index.js"));
|
|
34
|
+
exports.NewsroomPrivacyRequests = _NewsroomPrivacyRequests;
|
|
35
|
+
var _Newsrooms = _interopRequireWildcard(require("./Newsrooms/index.js"));
|
|
36
|
+
exports.Newsrooms = _Newsrooms;
|
|
37
|
+
var _NewsroomSubscriptions = _interopRequireWildcard(require("./NewsroomSubscriptions/index.js"));
|
|
38
|
+
exports.NewsroomSubscriptions = _NewsroomSubscriptions;
|
|
39
|
+
var _NewsroomThemes = _interopRequireWildcard(require("./NewsroomThemes/index.js"));
|
|
40
|
+
exports.NewsroomThemes = _NewsroomThemes;
|
|
41
|
+
var _NewsroomWebhooks = _interopRequireWildcard(require("./NewsroomWebhooks/index.js"));
|
|
42
|
+
exports.NewsroomWebhooks = _NewsroomWebhooks;
|
|
43
|
+
var _SenderAddresses = _interopRequireWildcard(require("./SenderAddresses/index.js"));
|
|
44
|
+
exports.SenderAddresses = _SenderAddresses;
|
|
45
|
+
var _Signup = _interopRequireWildcard(require("./Signup/index.js"));
|
|
46
|
+
exports.Signup = _Signup;
|
|
47
|
+
var _Snippets = _interopRequireWildcard(require("./Snippets/index.js"));
|
|
48
|
+
exports.Snippets = _Snippets;
|
|
49
|
+
var _Stories = _interopRequireWildcard(require("./Stories/index.js"));
|
|
50
|
+
exports.Stories = _Stories;
|
|
51
|
+
var _Subscriptions = _interopRequireWildcard(require("./Subscriptions/index.js"));
|
|
52
|
+
exports.Subscriptions = _Subscriptions;
|
|
53
|
+
var _NotificationSubscriptions = _interopRequireWildcard(require("./NotificationSubscriptions/index.js"));
|
|
54
|
+
exports.NotificationSubscriptions = _NotificationSubscriptions;
|
|
55
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
56
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/dist/http/ApiError.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ApiError = void 0;
|
|
7
|
+
class ApiError extends Error {
|
|
2
8
|
constructor({
|
|
3
9
|
payload,
|
|
4
10
|
status = 0,
|
|
@@ -11,4 +17,5 @@ export class ApiError extends Error {
|
|
|
11
17
|
this.statusText = statusText;
|
|
12
18
|
this.headers = headers;
|
|
13
19
|
}
|
|
14
|
-
}
|
|
20
|
+
}
|
|
21
|
+
exports.ApiError = ApiError;
|
package/dist/http/Http.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Http = void 0;
|
|
7
|
+
var _createRequest = require("./createRequest.js");
|
|
8
|
+
var _types = require("./types.js");
|
|
9
|
+
const Http = {
|
|
4
10
|
get(url, {
|
|
5
11
|
headers,
|
|
6
12
|
query
|
|
7
13
|
} = {}) {
|
|
8
|
-
return createRequest(url, {
|
|
14
|
+
return (0, _createRequest.createRequest)(url, {
|
|
9
15
|
headers,
|
|
10
|
-
method: Method.GET,
|
|
16
|
+
method: _types.Method.GET,
|
|
11
17
|
query
|
|
12
18
|
});
|
|
13
19
|
},
|
|
@@ -16,9 +22,9 @@ export const Http = {
|
|
|
16
22
|
payload,
|
|
17
23
|
query
|
|
18
24
|
} = {}) {
|
|
19
|
-
return createRequest(url, {
|
|
25
|
+
return (0, _createRequest.createRequest)(url, {
|
|
20
26
|
headers,
|
|
21
|
-
method: Method.POST,
|
|
27
|
+
method: _types.Method.POST,
|
|
22
28
|
payload,
|
|
23
29
|
query
|
|
24
30
|
});
|
|
@@ -28,9 +34,9 @@ export const Http = {
|
|
|
28
34
|
payload,
|
|
29
35
|
query
|
|
30
36
|
} = {}) {
|
|
31
|
-
return createRequest(url, {
|
|
37
|
+
return (0, _createRequest.createRequest)(url, {
|
|
32
38
|
headers,
|
|
33
|
-
method: Method.PUT,
|
|
39
|
+
method: _types.Method.PUT,
|
|
34
40
|
payload,
|
|
35
41
|
query
|
|
36
42
|
});
|
|
@@ -40,9 +46,9 @@ export const Http = {
|
|
|
40
46
|
payload,
|
|
41
47
|
query
|
|
42
48
|
} = {}) {
|
|
43
|
-
return createRequest(url, {
|
|
49
|
+
return (0, _createRequest.createRequest)(url, {
|
|
44
50
|
headers,
|
|
45
|
-
method: Method.PATCH,
|
|
51
|
+
method: _types.Method.PATCH,
|
|
46
52
|
payload,
|
|
47
53
|
query
|
|
48
54
|
});
|
|
@@ -52,11 +58,12 @@ export const Http = {
|
|
|
52
58
|
payload,
|
|
53
59
|
query
|
|
54
60
|
} = {}) {
|
|
55
|
-
return createRequest(url, {
|
|
61
|
+
return (0, _createRequest.createRequest)(url, {
|
|
56
62
|
headers,
|
|
57
|
-
method: Method.DELETE,
|
|
63
|
+
method: _types.Method.DELETE,
|
|
58
64
|
payload,
|
|
59
65
|
query
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
|
-
};
|
|
68
|
+
};
|
|
69
|
+
exports.Http = Http;
|
package/dist/http/constants.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NETWORK_PROBLEM_ERROR_MESSAGE = exports.INVALID_URL_ERROR_MESSAGE = exports.CONTENT_TYPE = void 0;
|
|
7
|
+
const CONTENT_TYPE = 'application/json;charset=utf-8';
|
|
8
|
+
exports.CONTENT_TYPE = CONTENT_TYPE;
|
|
9
|
+
const INVALID_URL_ERROR_MESSAGE = 'Invalid URL provided';
|
|
10
|
+
exports.INVALID_URL_ERROR_MESSAGE = INVALID_URL_ERROR_MESSAGE;
|
|
11
|
+
const NETWORK_PROBLEM_ERROR_MESSAGE = 'Network problem';
|
|
12
|
+
exports.NETWORK_PROBLEM_ERROR_MESSAGE = NETWORK_PROBLEM_ERROR_MESSAGE;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createFakeErrorPayload = createFakeErrorPayload;
|
|
7
|
+
exports.createRequest = createRequest;
|
|
8
|
+
var _ApiError = require("./ApiError.js");
|
|
9
|
+
var _constants = require("./constants.js");
|
|
10
|
+
var _lib = require("./lib.js");
|
|
11
|
+
var _types = require("./types.js");
|
|
5
12
|
function extractHeaders(headers) {
|
|
6
13
|
const result = {};
|
|
7
14
|
headers.forEach((value, key) => {
|
|
@@ -16,7 +23,7 @@ function extractResponse(response) {
|
|
|
16
23
|
headers: extractHeaders(response.headers)
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
|
-
|
|
26
|
+
function createFakeErrorPayload({
|
|
20
27
|
status,
|
|
21
28
|
statusText
|
|
22
29
|
}) {
|
|
@@ -32,19 +39,19 @@ export function createFakeErrorPayload({
|
|
|
32
39
|
}
|
|
33
40
|
};
|
|
34
41
|
}
|
|
35
|
-
|
|
42
|
+
async function createRequest(url, {
|
|
36
43
|
headers,
|
|
37
44
|
method,
|
|
38
45
|
payload,
|
|
39
46
|
query
|
|
40
47
|
}) {
|
|
41
48
|
try {
|
|
42
|
-
const urlWithQuery = createUrlWithQuery(url, query);
|
|
49
|
+
const urlWithQuery = (0, _lib.createUrlWithQuery)(url, query);
|
|
43
50
|
const response = await fetch(urlWithQuery.href, {
|
|
44
51
|
method,
|
|
45
52
|
headers: {
|
|
46
53
|
Accept: 'application/json',
|
|
47
|
-
'Content-Type': CONTENT_TYPE,
|
|
54
|
+
'Content-Type': _constants.CONTENT_TYPE,
|
|
48
55
|
...headers
|
|
49
56
|
},
|
|
50
57
|
body: payload ? JSON.stringify(payload) : undefined
|
|
@@ -54,7 +61,7 @@ export async function createRequest(url, {
|
|
|
54
61
|
// but when running in test environment (Jest), it fails silently
|
|
55
62
|
// and 'response' becomes undefined, hence this extra condition.
|
|
56
63
|
if (!response) {
|
|
57
|
-
throw new Error(INVALID_URL_ERROR_MESSAGE);
|
|
64
|
+
throw new Error(_constants.INVALID_URL_ERROR_MESSAGE);
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
// Response code is not between 200 - 299
|
|
@@ -67,12 +74,12 @@ export async function createRequest(url, {
|
|
|
67
74
|
} catch (error) {
|
|
68
75
|
responsePayload = createFakeErrorPayload(response);
|
|
69
76
|
}
|
|
70
|
-
throw new ApiError({
|
|
77
|
+
throw new _ApiError.ApiError({
|
|
71
78
|
payload: responsePayload,
|
|
72
79
|
...extractResponse(response)
|
|
73
80
|
});
|
|
74
81
|
}
|
|
75
|
-
const responsePayload = response.status === HttpCodes.NO_CONTENT ? undefined : await response.json();
|
|
82
|
+
const responsePayload = response.status === _types.HttpCodes.NO_CONTENT ? undefined : await response.json();
|
|
76
83
|
return {
|
|
77
84
|
payload: responsePayload,
|
|
78
85
|
...extractResponse(response)
|
|
@@ -83,10 +90,10 @@ export async function createRequest(url, {
|
|
|
83
90
|
// Since we also throw when response is not ok, re-throw the response data if available.
|
|
84
91
|
const {
|
|
85
92
|
status,
|
|
86
|
-
statusText = error.message || NETWORK_PROBLEM_ERROR_MESSAGE,
|
|
93
|
+
statusText = error.message || _constants.NETWORK_PROBLEM_ERROR_MESSAGE,
|
|
87
94
|
payload: errorPayload
|
|
88
95
|
} = error;
|
|
89
|
-
throw new ApiError({
|
|
96
|
+
throw new _ApiError.ApiError({
|
|
90
97
|
payload: errorPayload || createFakeErrorPayload({
|
|
91
98
|
status,
|
|
92
99
|
statusText
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ApiError", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ApiError.ApiError;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Http", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Http.Http;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "isDeferredJobResponse", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _lib.isDeferredJobResponse;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "HttpCodes", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _types.HttpCodes;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "Method", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _types.Method;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _ApiError = require("./ApiError.js");
|
|
37
|
+
var _Http = require("./Http.js");
|
|
38
|
+
var _lib = require("./lib.js");
|
|
39
|
+
var _types = require("./types.js");
|
package/dist/http/lib.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createUrlWithQuery = createUrlWithQuery;
|
|
7
|
+
exports.isDeferredJobResponse = isDeferredJobResponse;
|
|
8
|
+
var _queryString = _interopRequireDefault(require("query-string"));
|
|
9
|
+
var nodeUrl = _interopRequireWildcard(require("url"));
|
|
10
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3
13
|
const URL = typeof window === 'undefined' ? nodeUrl.URL : window.URL;
|
|
4
14
|
function parseUrlParams(query) {
|
|
5
|
-
return
|
|
15
|
+
return _queryString.default.parse(query, {
|
|
6
16
|
arrayFormat: 'bracket'
|
|
7
17
|
});
|
|
8
18
|
}
|
|
9
19
|
function stringifyUrlParams(params) {
|
|
10
|
-
return
|
|
20
|
+
return _queryString.default.stringify(params, {
|
|
11
21
|
arrayFormat: 'bracket'
|
|
12
22
|
});
|
|
13
23
|
}
|
|
14
|
-
|
|
24
|
+
function createUrlWithQuery(url = '', query) {
|
|
15
25
|
const urlWithQuery = new URL(url);
|
|
16
26
|
if (typeof query === 'object' && query !== null) {
|
|
17
27
|
urlWithQuery.search = stringifyUrlParams({
|
|
@@ -24,6 +34,6 @@ export function createUrlWithQuery(url = '', query) {
|
|
|
24
34
|
function isObject(value) {
|
|
25
35
|
return value !== null && typeof value === 'object';
|
|
26
36
|
}
|
|
27
|
-
|
|
37
|
+
function isDeferredJobResponse(value) {
|
|
28
38
|
return isObject(value) && typeof value.status === 'string' && isObject(value.progress) && typeof value.progress.id === 'string' && Array.isArray(value.progress.links) && value.progress.links.every(link => typeof link === 'string');
|
|
29
39
|
}
|
package/dist/http/types.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Method = exports.HttpCodes = void 0;
|
|
7
|
+
let HttpCodes;
|
|
8
|
+
exports.HttpCodes = HttpCodes;
|
|
2
9
|
(function (HttpCodes) {
|
|
3
10
|
HttpCodes[HttpCodes["ACCEPTED"] = 202] = "ACCEPTED";
|
|
4
11
|
HttpCodes[HttpCodes["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
@@ -6,12 +13,13 @@ export let HttpCodes;
|
|
|
6
13
|
HttpCodes[HttpCodes["CONFLICT"] = 409] = "CONFLICT";
|
|
7
14
|
HttpCodes[HttpCodes["GONE"] = 410] = "GONE";
|
|
8
15
|
HttpCodes[HttpCodes["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
9
|
-
})(HttpCodes || (HttpCodes = {}));
|
|
10
|
-
|
|
16
|
+
})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
|
|
17
|
+
let Method;
|
|
18
|
+
exports.Method = Method;
|
|
11
19
|
(function (Method) {
|
|
12
20
|
Method["DELETE"] = "DELETE";
|
|
13
21
|
Method["GET"] = "GET";
|
|
14
22
|
Method["PATCH"] = "PATCH";
|
|
15
23
|
Method["POST"] = "POST";
|
|
16
24
|
Method["PUT"] = "PUT";
|
|
17
|
-
})(Method || (Method = {}));
|
|
25
|
+
})(Method || (exports.Method = Method = {}));
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
createPrezlyClient: true,
|
|
8
|
+
ApiError: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "createPrezlyClient", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Client.createClient;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "ApiError", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _index.ApiError;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _uploads = require("@prezly/uploads");
|
|
23
|
+
Object.keys(_uploads).forEach(function (key) {
|
|
24
|
+
if (key === "default" || key === "__esModule") return;
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
+
Object.defineProperty(exports, key, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _uploads[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var _Client = require("./Client.js");
|
|
34
|
+
var _index = require("./http/index.js");
|
|
35
|
+
var _index2 = require("./endpoints/index.js");
|
|
36
|
+
Object.keys(_index2).forEach(function (key) {
|
|
37
|
+
if (key === "default" || key === "__esModule") return;
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
|
+
Object.defineProperty(exports, key, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _index2[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
var _index3 = require("./types/index.js");
|
|
47
|
+
Object.keys(_index3).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
Object.defineProperty(exports, key, {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _index3[key];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
package/dist/routing.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.routing = void 0;
|
|
7
|
+
const routing = {
|
|
2
8
|
accounts: '/v2/accounts',
|
|
3
9
|
billing: 'v2/billing',
|
|
4
10
|
campaignsUrl: '/v2/campaigns',
|
|
@@ -28,4 +34,5 @@ export const routing = {
|
|
|
28
34
|
storiesSearchUrl: '/v2/stories/search',
|
|
29
35
|
storyCoverageUrl: '/v1/stories/:story_id/reports/coverage',
|
|
30
36
|
snippetsUrl: '/v2/snippets'
|
|
31
|
-
};
|
|
37
|
+
};
|
|
38
|
+
exports.routing = routing;
|
package/dist/types/Campaign.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Campaign = void 0;
|
|
7
|
+
var _SenderDomain = require("./SenderDomain.js");
|
|
8
|
+
let Campaign;
|
|
9
|
+
exports.Campaign = Campaign;
|
|
3
10
|
(function (_Campaign) {
|
|
4
|
-
const SenderDomainVerificationFlow = _Campaign.SenderDomainVerificationFlow = SenderDomain.VerificationFlowVersion;
|
|
11
|
+
const SenderDomainVerificationFlow = _Campaign.SenderDomainVerificationFlow = _SenderDomain.SenderDomain.VerificationFlowVersion;
|
|
5
12
|
let LifecycleStatus;
|
|
6
13
|
(function (LifecycleStatus) {
|
|
7
14
|
LifecycleStatus["DRAFT"] = "draft";
|
|
@@ -59,4 +66,4 @@ export let Campaign;
|
|
|
59
66
|
return arg === LifecycleStatus.SENT;
|
|
60
67
|
}
|
|
61
68
|
_Campaign.isSent = isSent;
|
|
62
|
-
})(Campaign || (Campaign = {}));
|
|
69
|
+
})(Campaign || (exports.Campaign = Campaign = {}));
|
package/dist/types/Category.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
package/dist/types/Contact.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Contact = void 0;
|
|
7
|
+
let Contact;
|
|
8
|
+
exports.Contact = Contact;
|
|
2
9
|
(function (_Contact) {
|
|
3
10
|
let Type;
|
|
4
11
|
(function (Type) {
|
|
@@ -72,4 +79,4 @@ export let Contact;
|
|
|
72
79
|
})(Type || (Type = {}));
|
|
73
80
|
_PhoneNumber.Type = Type;
|
|
74
81
|
})(PhoneNumber || (PhoneNumber = _Contact.PhoneNumber || (_Contact.PhoneNumber = {})));
|
|
75
|
-
})(Contact || (Contact = {}));
|
|
82
|
+
})(Contact || (exports.Contact = Contact = {}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContactDuplicateSuggestion = void 0;
|
|
7
|
+
let ContactDuplicateSuggestion;
|
|
8
|
+
exports.ContactDuplicateSuggestion = ContactDuplicateSuggestion;
|
|
2
9
|
(function (_ContactDuplicateSuggestion) {
|
|
3
10
|
let Status;
|
|
4
11
|
(function (Status) {
|
|
@@ -7,4 +14,4 @@ export let ContactDuplicateSuggestion;
|
|
|
7
14
|
Status["DECLINED"] = "declined";
|
|
8
15
|
})(Status || (Status = {}));
|
|
9
16
|
_ContactDuplicateSuggestion.Status = Status;
|
|
10
|
-
})(ContactDuplicateSuggestion || (ContactDuplicateSuggestion = {}));
|
|
17
|
+
})(ContactDuplicateSuggestion || (exports.ContactDuplicateSuggestion = ContactDuplicateSuggestion = {}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContactsExport = void 0;
|
|
7
|
+
let ContactsExport;
|
|
8
|
+
exports.ContactsExport = ContactsExport;
|
|
2
9
|
(function (_ContactsExport) {
|
|
3
10
|
let Status;
|
|
4
11
|
(function (Status) {
|
|
@@ -7,4 +14,4 @@ export let ContactsExport;
|
|
|
7
14
|
Status["FAILED"] = "failed";
|
|
8
15
|
})(Status || (Status = {}));
|
|
9
16
|
_ContactsExport.Status = Status;
|
|
10
|
-
})(ContactsExport || (ContactsExport = {}));
|
|
17
|
+
})(ContactsExport || (exports.ContactsExport = ContactsExport = {}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContactsScope = void 0;
|
|
7
|
+
let ContactsScope;
|
|
8
|
+
exports.ContactsScope = ContactsScope;
|
|
2
9
|
(function (_ContactsScope) {
|
|
3
10
|
let Type;
|
|
4
11
|
(function (Type) {
|
|
@@ -9,4 +16,4 @@ export let ContactsScope;
|
|
|
9
16
|
Type["CAMPAIGN_REPORT"] = "scope:campaign_report";
|
|
10
17
|
})(Type || (Type = {}));
|
|
11
18
|
_ContactsScope.Type = Type;
|
|
12
|
-
})(ContactsScope || (ContactsScope = {}));
|
|
19
|
+
})(ContactsScope || (exports.ContactsScope = ContactsScope = {}));
|
package/dist/types/Country.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CoverageEntry = void 0;
|
|
7
|
+
let CoverageEntry;
|
|
8
|
+
exports.CoverageEntry = CoverageEntry;
|
|
2
9
|
(function (_CoverageEntry) {
|
|
3
10
|
let Type;
|
|
4
11
|
(function (Type) {
|
|
@@ -22,4 +29,4 @@ export let CoverageEntry;
|
|
|
22
29
|
Provider["MANUAL"] = "manual";
|
|
23
30
|
})(Provider || (Provider = {}));
|
|
24
31
|
_CoverageEntry.Provider = Provider;
|
|
25
|
-
})(CoverageEntry || (CoverageEntry = {}));
|
|
32
|
+
})(CoverageEntry || (exports.CoverageEntry = CoverageEntry = {}));
|
package/dist/types/Culture.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Culture = void 0;
|
|
7
|
+
let Culture;
|
|
8
|
+
exports.Culture = Culture;
|
|
2
9
|
(function (_Culture) {
|
|
3
10
|
let TextDirection;
|
|
4
11
|
(function (TextDirection) {
|
|
@@ -6,4 +13,4 @@ export let Culture;
|
|
|
6
13
|
TextDirection["RTL"] = "rtl";
|
|
7
14
|
})(TextDirection || (TextDirection = {}));
|
|
8
15
|
_Culture.TextDirection = TextDirection;
|
|
9
|
-
})(Culture || (Culture = {}));
|
|
16
|
+
})(Culture || (exports.Culture = Culture = {}));
|