@prezly/sdk 19.5.0 → 19.6.1
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/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/endpoints/NewsroomSubscriptions/Client.cjs +17 -0
- package/dist/endpoints/NewsroomSubscriptions/Client.d.ts +2 -1
- package/dist/endpoints/NewsroomSubscriptions/Client.js +17 -0
- package/dist/endpoints/NewsroomSubscriptions/types.d.ts +15 -1
- package/dist/endpoints/Newsrooms/types.d.ts +1 -0
- package/dist/routing.cjs +0 -1
- package/dist/routing.d.ts +0 -1
- package/dist/routing.js +0 -1
- package/dist/types/EmailSubscription.d.ts +1 -0
- package/dist/types/Newsroom.d.ts +1 -0
- package/dist/types/NewsroomSubscription.cjs +1 -0
- package/dist/types/NewsroomSubscription.d.ts +8 -0
- package/dist/types/NewsroomSubscription.js +1 -0
- package/dist/types/index.cjs +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +7 -7
package/dist/api/constants.cjs
CHANGED
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_USER_AGENT = void 0;
|
|
7
|
-
const VERSION = "19.
|
|
7
|
+
const VERSION = "19.6.0";
|
|
8
8
|
const URL = 'https://github.com/prezly/javascript-sdk';
|
|
9
9
|
const DEFAULT_USER_AGENT = exports.DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
|
package/dist/api/constants.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Client = void 0;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
+
var _index = require("../../types/index.cjs");
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated Use Subscriptions instead
|
|
10
11
|
*/
|
|
@@ -18,5 +19,21 @@ class Client {
|
|
|
18
19
|
payload
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
async list(newsroomId, {
|
|
23
|
+
limit,
|
|
24
|
+
offset,
|
|
25
|
+
search,
|
|
26
|
+
sortOrder
|
|
27
|
+
} = {}) {
|
|
28
|
+
const url = _routing.routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
|
|
29
|
+
return this.apiClient.get(url, {
|
|
30
|
+
query: {
|
|
31
|
+
limit,
|
|
32
|
+
offset,
|
|
33
|
+
search,
|
|
34
|
+
sort: _index.SortOrder.stringify(sortOrder)
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
21
38
|
}
|
|
22
39
|
exports.Client = Client;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DeferredJobsApiClient } from '../../api';
|
|
2
2
|
import type { Newsroom } from '../../types';
|
|
3
|
-
import type { CreateRequest } from './types';
|
|
3
|
+
import type { CreateRequest, ListOptions, ListResponse } from './types';
|
|
4
4
|
type NewsroomId = Newsroom['uuid'] | Newsroom['id'];
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use Subscriptions instead
|
|
@@ -9,5 +9,6 @@ export declare class Client {
|
|
|
9
9
|
private readonly apiClient;
|
|
10
10
|
constructor(apiClient: DeferredJobsApiClient);
|
|
11
11
|
subscribe(newsroomId: NewsroomId, payload: CreateRequest): Promise<void>;
|
|
12
|
+
list(newsroomId: NewsroomId, { limit, offset, search, sortOrder }?: ListOptions): Promise<ListResponse>;
|
|
12
13
|
}
|
|
13
14
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
+
import { SortOrder } from "../../types/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* @deprecated Use Subscriptions instead
|
|
4
5
|
*/
|
|
@@ -12,4 +13,20 @@ export class Client {
|
|
|
12
13
|
payload
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
async list(newsroomId, {
|
|
17
|
+
limit,
|
|
18
|
+
offset,
|
|
19
|
+
search,
|
|
20
|
+
sortOrder
|
|
21
|
+
} = {}) {
|
|
22
|
+
const url = routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
|
|
23
|
+
return this.apiClient.get(url, {
|
|
24
|
+
query: {
|
|
25
|
+
limit,
|
|
26
|
+
offset,
|
|
27
|
+
search,
|
|
28
|
+
sort: SortOrder.stringify(sortOrder)
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
15
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UploadedImage } from '@prezly/uploads';
|
|
2
|
-
import type { Contact } from '../../types';
|
|
2
|
+
import type { Contact, NewsroomSubscription, Pagination, SortOrder } from '../../types';
|
|
3
3
|
export interface CreateRequest {
|
|
4
4
|
email_address: string;
|
|
5
5
|
locale?: string;
|
|
@@ -54,3 +54,17 @@ export interface CreateRequest {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
export interface ListOptions {
|
|
58
|
+
limit?: number;
|
|
59
|
+
offset?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Text search keyword.
|
|
62
|
+
*/
|
|
63
|
+
search?: string;
|
|
64
|
+
sortOrder?: SortOrder | string;
|
|
65
|
+
}
|
|
66
|
+
export interface ListResponse {
|
|
67
|
+
subscriptions: NewsroomSubscription[];
|
|
68
|
+
pagination: Pagination;
|
|
69
|
+
sort: string;
|
|
70
|
+
}
|
|
@@ -102,6 +102,7 @@ export interface UpdateRequest {
|
|
|
102
102
|
* "subscription_form" feature flag
|
|
103
103
|
*/
|
|
104
104
|
is_subscription_form_enabled?: boolean;
|
|
105
|
+
auto_create_contacts_from_subscribers?: boolean;
|
|
105
106
|
status?: Newsroom.Status.ACTIVE | Newsroom.Status.INACTIVE;
|
|
106
107
|
is_plausible_enabled?: boolean;
|
|
107
108
|
is_white_labeled?: boolean;
|
package/dist/routing.cjs
CHANGED
|
@@ -19,7 +19,6 @@ const routing = exports.routing = {
|
|
|
19
19
|
newsroomCategoriesUrl: '/v2/newsrooms/:newsroom_id/categories',
|
|
20
20
|
newsroomContactsUrl: '/v2/newsrooms/:newsroom_id/contacts',
|
|
21
21
|
newsroomLanguagesUrl: '/v2/newsrooms/:newsroom_id/languages',
|
|
22
|
-
/** @deprecated Please use newsroomSubscribeUrl instead */
|
|
23
22
|
newsroomSubscriptionsUrl: '/v2/newsrooms/:newsroom_id/subscriptions',
|
|
24
23
|
newsroomSubscribeUrl: '/v2/newsrooms/:newsroom_id/subscribe',
|
|
25
24
|
newsroomUnsubscribeUrl: '/v2/newsrooms/:newsroom_id/unsubscribe',
|
package/dist/routing.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare const routing: {
|
|
|
13
13
|
newsroomCategoriesUrl: string;
|
|
14
14
|
newsroomContactsUrl: string;
|
|
15
15
|
newsroomLanguagesUrl: string;
|
|
16
|
-
/** @deprecated Please use newsroomSubscribeUrl instead */
|
|
17
16
|
newsroomSubscriptionsUrl: string;
|
|
18
17
|
newsroomSubscribeUrl: string;
|
|
19
18
|
newsroomUnsubscribeUrl: string;
|
package/dist/routing.js
CHANGED
|
@@ -13,7 +13,6 @@ export const routing = {
|
|
|
13
13
|
newsroomCategoriesUrl: '/v2/newsrooms/:newsroom_id/categories',
|
|
14
14
|
newsroomContactsUrl: '/v2/newsrooms/:newsroom_id/contacts',
|
|
15
15
|
newsroomLanguagesUrl: '/v2/newsrooms/:newsroom_id/languages',
|
|
16
|
-
/** @deprecated Please use newsroomSubscribeUrl instead */
|
|
17
16
|
newsroomSubscriptionsUrl: '/v2/newsrooms/:newsroom_id/subscriptions',
|
|
18
17
|
newsroomSubscribeUrl: '/v2/newsrooms/:newsroom_id/subscribe',
|
|
19
18
|
newsroomUnsubscribeUrl: '/v2/newsrooms/:newsroom_id/unsubscribe',
|
package/dist/types/Newsroom.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export interface Newsroom extends NewsroomRef {
|
|
|
98
98
|
google_search_console_key: string | null;
|
|
99
99
|
segment_analytics_id: string | null;
|
|
100
100
|
is_subscription_form_enabled: boolean;
|
|
101
|
+
auto_create_contacts_from_subscribers: boolean;
|
|
101
102
|
is_white_labeled: boolean;
|
|
102
103
|
is_plausible_enabled: boolean;
|
|
103
104
|
plausible_site_id: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.cjs
CHANGED
|
@@ -267,6 +267,17 @@ Object.keys(_NewsroomLanguageSettings).forEach(function (key) {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
|
+
var _NewsroomSubscription = require("./NewsroomSubscription.cjs");
|
|
271
|
+
Object.keys(_NewsroomSubscription).forEach(function (key) {
|
|
272
|
+
if (key === "default" || key === "__esModule") return;
|
|
273
|
+
if (key in exports && exports[key] === _NewsroomSubscription[key]) return;
|
|
274
|
+
Object.defineProperty(exports, key, {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function () {
|
|
277
|
+
return _NewsroomSubscription[key];
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
});
|
|
270
281
|
var _NewsroomTheme = require("./NewsroomTheme.cjs");
|
|
271
282
|
Object.keys(_NewsroomTheme).forEach(function (key) {
|
|
272
283
|
if (key === "default" || key === "__esModule") return;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './NewsroomContact';
|
|
|
22
22
|
export * from './NewsroomDomain';
|
|
23
23
|
export * from './NewsroomGallery';
|
|
24
24
|
export * from './NewsroomLanguageSettings';
|
|
25
|
+
export * from './NewsroomSubscription';
|
|
25
26
|
export * from './NewsroomTheme';
|
|
26
27
|
export * from './NewsroomWebhook';
|
|
27
28
|
export * from './Plan';
|
package/dist/types/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./NewsroomContact.js";
|
|
|
23
23
|
export * from "./NewsroomDomain.js";
|
|
24
24
|
export * from "./NewsroomGallery.js";
|
|
25
25
|
export * from "./NewsroomLanguageSettings.js";
|
|
26
|
+
export * from "./NewsroomSubscription.js";
|
|
26
27
|
export * from "./NewsroomTheme.js";
|
|
27
28
|
export * from "./NewsroomWebhook.js";
|
|
28
29
|
export * from "./Plan.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/sdk",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.6.1",
|
|
4
4
|
"description": "Prezly API SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@prezly/progress-promise": "^2.0.1",
|
|
30
30
|
"@prezly/uploads": "^0.2.1",
|
|
31
|
-
"query-string": "^
|
|
31
|
+
"query-string": "^8.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/cli": "^7.19.3",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
43
43
|
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
44
44
|
"cross-env": "^7.0.3",
|
|
45
|
-
"eslint": "^8.
|
|
46
|
-
"eslint-config-prettier": "^8.
|
|
47
|
-
"eslint-plugin-import": "^2.
|
|
45
|
+
"eslint": "^8.56.0",
|
|
46
|
+
"eslint-config-prettier": "^8.10.0",
|
|
47
|
+
"eslint-plugin-import": "^2.29.1",
|
|
48
48
|
"np": "^9.2.0",
|
|
49
|
-
"prettier": "^2.
|
|
49
|
+
"prettier": "^2.8.8",
|
|
50
50
|
"rimraf": "^3.0.0",
|
|
51
51
|
"typescript": "^5.3.3",
|
|
52
|
-
"vitest": "^1.
|
|
52
|
+
"vitest": "^1.2.2",
|
|
53
53
|
"vitest-fetch-mock": "^0.2.2"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|