@prezly/sdk 11.2.2 → 11.3.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/Client.d.ts +3 -1
- package/dist/Client.js +3 -1
- package/dist/api/constants.js +1 -1
- package/dist/endpoints/Billing/Client.d.ts +7 -0
- package/dist/endpoints/Billing/Client.js +12 -0
- package/dist/endpoints/Billing/index.d.ts +2 -0
- package/dist/endpoints/Billing/index.js +2 -0
- package/dist/endpoints/Billing/types.d.ts +30 -0
- package/dist/endpoints/Billing/types.js +16 -0
- package/dist/endpoints/Signup/Client.d.ts +7 -0
- package/dist/endpoints/Signup/Client.js +14 -0
- package/dist/endpoints/Signup/index.d.ts +2 -0
- package/dist/endpoints/Signup/index.js +2 -0
- package/dist/endpoints/Signup/types.d.ts +9 -0
- package/dist/endpoints/Signup/types.js +5 -0
- package/dist/endpoints/index.d.ts +2 -0
- package/dist/endpoints/index.js +2 -0
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +2 -0
- package/dist/types/Story.d.ts +8 -0
- package/dist/types/Story.js +14 -0
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
|
|
1
|
+
import { Accounts, Billing, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
|
|
2
2
|
import type { HeadersMap } from './http';
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
accessToken: string;
|
|
@@ -7,6 +7,7 @@ export interface ClientOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export interface Client {
|
|
9
9
|
accounts: Accounts.Client;
|
|
10
|
+
billing: Billing.Client;
|
|
10
11
|
campaigns: Campaigns.Client;
|
|
11
12
|
campaignRecipients: CampaignRecipients.Client;
|
|
12
13
|
coverage: Coverage.Client;
|
|
@@ -22,6 +23,7 @@ export interface Client {
|
|
|
22
23
|
newsroomDomains: NewsroomDomains.Client;
|
|
23
24
|
newsroomGalleries: NewsroomGalleries.Client;
|
|
24
25
|
senderAddresses: SenderAddresses.Client;
|
|
26
|
+
signup: Signup.Client;
|
|
25
27
|
stories: Stories.Client;
|
|
26
28
|
snippets: Snippets.Client;
|
|
27
29
|
subscriptions: Subscriptions.Client;
|
package/dist/Client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiClient, DeferredJobsApiClient } from "./api/index.js";
|
|
2
|
-
import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
|
|
2
|
+
import { Accounts, Billing, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
|
|
3
3
|
const DEFAULT_BASE_URL = 'https://api.prezly.com';
|
|
4
4
|
export function createClient({
|
|
5
5
|
accessToken,
|
|
@@ -13,6 +13,7 @@ export function createClient({
|
|
|
13
13
|
}));
|
|
14
14
|
return {
|
|
15
15
|
accounts: new Accounts.Client(apiClient),
|
|
16
|
+
billing: new Billing.Client(apiClient),
|
|
16
17
|
campaigns: new Campaigns.Client(apiClient),
|
|
17
18
|
campaignRecipients: new CampaignRecipients.Client(apiClient),
|
|
18
19
|
coverage: new Coverage.Client(apiClient),
|
|
@@ -28,6 +29,7 @@ export function createClient({
|
|
|
28
29
|
newsroomDomains: new NewsroomDomains.Client(apiClient),
|
|
29
30
|
newsroomGalleries: new NewsroomGalleries.Client(apiClient),
|
|
30
31
|
senderAddresses: new SenderAddresses.Client(apiClient),
|
|
32
|
+
signup: new Signup.Client(apiClient),
|
|
31
33
|
stories: new Stories.Client(apiClient),
|
|
32
34
|
snippets: new Snippets.Client(apiClient),
|
|
33
35
|
subscriptions: new Subscriptions.Client(apiClient),
|
package/dist/api/constants.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DeferredJobsApiClient } from '../../api';
|
|
2
|
+
import type { SignupRequest, SignupResponse } from './types';
|
|
3
|
+
export declare class Client {
|
|
4
|
+
private readonly apiClient;
|
|
5
|
+
constructor(apiClient: DeferredJobsApiClient);
|
|
6
|
+
signup(payload: SignupRequest): Promise<SignupResponse>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { routing } from "../../routing.js";
|
|
2
|
+
export class Client {
|
|
3
|
+
constructor(apiClient) {
|
|
4
|
+
this.apiClient = apiClient;
|
|
5
|
+
}
|
|
6
|
+
async signup(payload) {
|
|
7
|
+
const url = `${routing.billing}/signup`;
|
|
8
|
+
return this.apiClient.post(url, {
|
|
9
|
+
payload
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum SignupPlan {
|
|
2
|
+
STARTER = "starter",
|
|
3
|
+
CORE = "core",
|
|
4
|
+
PREMIUM = "premium"
|
|
5
|
+
}
|
|
6
|
+
export declare enum SignupCurrency {
|
|
7
|
+
EUR = "eur",
|
|
8
|
+
USD = "usd"
|
|
9
|
+
}
|
|
10
|
+
export declare enum SignupBillingCycle {
|
|
11
|
+
YEAR = "year",
|
|
12
|
+
MONTH = "month"
|
|
13
|
+
}
|
|
14
|
+
export interface SignupRequest {
|
|
15
|
+
email: string;
|
|
16
|
+
company_name: string;
|
|
17
|
+
first_name: string;
|
|
18
|
+
last_name: string;
|
|
19
|
+
quantity: number;
|
|
20
|
+
plan?: SignupPlan;
|
|
21
|
+
currency?: SignupCurrency;
|
|
22
|
+
billing_cycle?: SignupBillingCycle;
|
|
23
|
+
phone?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface SignupResponse {
|
|
26
|
+
license_id: string;
|
|
27
|
+
user_id: string;
|
|
28
|
+
activation_url: string;
|
|
29
|
+
activation_token: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export let SignupPlan;
|
|
2
|
+
(function (SignupPlan) {
|
|
3
|
+
SignupPlan["STARTER"] = "starter";
|
|
4
|
+
SignupPlan["CORE"] = "core";
|
|
5
|
+
SignupPlan["PREMIUM"] = "premium";
|
|
6
|
+
})(SignupPlan || (SignupPlan = {}));
|
|
7
|
+
export let SignupCurrency;
|
|
8
|
+
(function (SignupCurrency) {
|
|
9
|
+
SignupCurrency["EUR"] = "eur";
|
|
10
|
+
SignupCurrency["USD"] = "usd";
|
|
11
|
+
})(SignupCurrency || (SignupCurrency = {}));
|
|
12
|
+
export let SignupBillingCycle;
|
|
13
|
+
(function (SignupBillingCycle) {
|
|
14
|
+
SignupBillingCycle["YEAR"] = "year";
|
|
15
|
+
SignupBillingCycle["MONTH"] = "month";
|
|
16
|
+
})(SignupBillingCycle || (SignupBillingCycle = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DeferredJobsApiClient } from '../../api';
|
|
2
|
+
import type { CheckEmailAvailabilityResponse } from './types';
|
|
3
|
+
export declare class Client {
|
|
4
|
+
private readonly apiClient;
|
|
5
|
+
constructor(apiClient: DeferredJobsApiClient);
|
|
6
|
+
checkEmailAvailability(email: string): Promise<CheckEmailAvailabilityResponse>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { routing } from "../../routing.js";
|
|
2
|
+
export class Client {
|
|
3
|
+
constructor(apiClient) {
|
|
4
|
+
this.apiClient = apiClient;
|
|
5
|
+
}
|
|
6
|
+
async checkEmailAvailability(email) {
|
|
7
|
+
const url = `${routing.signup}/check-availability`;
|
|
8
|
+
return this.apiClient.post(url, {
|
|
9
|
+
payload: {
|
|
10
|
+
email
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Accounts from './Accounts';
|
|
2
|
+
export * as Billing from './Billing';
|
|
2
3
|
export * as CampaignRecipients from './CampaignRecipients';
|
|
3
4
|
export * as Campaigns from './Campaigns';
|
|
4
5
|
export * as Coverage from './Coverage';
|
|
@@ -15,6 +16,7 @@ export * as NewsroomSubscriptions from './NewsroomSubscriptions';
|
|
|
15
16
|
export * as NewsroomThemes from './NewsroomThemes';
|
|
16
17
|
export * as NewsroomWebhooks from './NewsroomWebhooks';
|
|
17
18
|
export * as SenderAddresses from './SenderAddresses';
|
|
19
|
+
export * as Signup from './Signup';
|
|
18
20
|
export * as Snippets from './Snippets';
|
|
19
21
|
export * as Stories from './Stories';
|
|
20
22
|
export * as Subscriptions from './Subscriptions';
|
package/dist/endpoints/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as Accounts from "./Accounts/index.js";
|
|
2
|
+
export * as Billing from "./Billing/index.js";
|
|
2
3
|
export * as CampaignRecipients from "./CampaignRecipients/index.js";
|
|
3
4
|
export * as Campaigns from "./Campaigns/index.js";
|
|
4
5
|
export * as Coverage from "./Coverage/index.js";
|
|
@@ -15,6 +16,7 @@ export * as NewsroomSubscriptions from "./NewsroomSubscriptions/index.js";
|
|
|
15
16
|
export * as NewsroomThemes from "./NewsroomThemes/index.js";
|
|
16
17
|
export * as NewsroomWebhooks from "./NewsroomWebhooks/index.js";
|
|
17
18
|
export * as SenderAddresses from "./SenderAddresses/index.js";
|
|
19
|
+
export * as Signup from "./Signup/index.js";
|
|
18
20
|
export * as Snippets from "./Snippets/index.js";
|
|
19
21
|
export * as Stories from "./Stories/index.js";
|
|
20
22
|
export * as Subscriptions from "./Subscriptions/index.js";
|
package/dist/http/index.d.ts
CHANGED
package/dist/http/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from '@prezly/uploads';
|
|
2
2
|
export { type Client as PrezlyClient, createClient as createPrezlyClient } from './Client';
|
|
3
|
-
export type
|
|
3
|
+
export { type HeadersMap, ApiError } from './http';
|
|
4
4
|
export * from './endpoints';
|
|
5
5
|
export * from './types';
|
package/dist/index.js
CHANGED
package/dist/routing.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const routing: {
|
|
2
2
|
accounts: string;
|
|
3
|
+
billing: string;
|
|
3
4
|
campaignsUrl: string;
|
|
4
5
|
campaignRecipientsUrl: string;
|
|
5
6
|
coverageUrl: string;
|
|
@@ -21,6 +22,7 @@ export declare const routing: {
|
|
|
21
22
|
newsroomGalleriesUrl: string;
|
|
22
23
|
notificationSubscriptionsUrl: string;
|
|
23
24
|
senderAddressesUrl: string;
|
|
25
|
+
signup: string;
|
|
24
26
|
storiesUrl: string;
|
|
25
27
|
storiesSearchUrl: string;
|
|
26
28
|
storyCoverageUrl: string;
|
package/dist/routing.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const routing = {
|
|
2
2
|
accounts: '/v2/accounts',
|
|
3
|
+
billing: 'v2/billing',
|
|
3
4
|
campaignsUrl: '/v2/campaigns',
|
|
4
5
|
campaignRecipientsUrl: '/v2/campaigns/:campaign_id/recipients',
|
|
5
6
|
coverageUrl: '/v2/coverage',
|
|
@@ -21,6 +22,7 @@ export const routing = {
|
|
|
21
22
|
newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
|
|
22
23
|
notificationSubscriptionsUrl: '/v2/notification-subscriptions',
|
|
23
24
|
senderAddressesUrl: '/v2/sender-addresses',
|
|
25
|
+
signup: '/v2/signup',
|
|
24
26
|
storiesUrl: '/v2/stories',
|
|
25
27
|
storiesSearchUrl: '/v2/stories/search',
|
|
26
28
|
storyCoverageUrl: '/v1/stories/:story_id/reports/coverage',
|
package/dist/types/Story.d.ts
CHANGED
|
@@ -223,6 +223,14 @@ export declare namespace Story {
|
|
|
223
223
|
function isScheduledEmbargo(story: Pick<Story, 'lifecycle_status'>): boolean;
|
|
224
224
|
function isPublished(status: LifecycleStatus): boolean;
|
|
225
225
|
function isPublished(story: Pick<Story, 'lifecycle_status'>): boolean;
|
|
226
|
+
function isLegacyHtmlFormat(format: FormatVersion): format is FormatVersion.HTML;
|
|
227
|
+
function isLegacyHtmlFormat<T extends Pick<Story, 'format_version'>>(story: T): story is T & {
|
|
228
|
+
format_version: FormatVersion.HTML;
|
|
229
|
+
};
|
|
230
|
+
function isSlateFormat(format: FormatVersion): format is FormatVersion.SLATEJS;
|
|
231
|
+
function isSlateFormat<T extends Pick<Story, 'format_version'>>(story: Pick<Story, 'format_version'>): story is T & {
|
|
232
|
+
format_version: FormatVersion.SLATEJS;
|
|
233
|
+
};
|
|
226
234
|
}
|
|
227
235
|
export interface ExtendedStory extends Story, Pick<Story.ExtraFields, 'thumbnail_image' | 'header_image' | 'preview_image' | 'social_image' | 'social_text' | 'tag_names' | 'content' | 'attached_gallery_content' | 'referenced_entities'> {
|
|
228
236
|
}
|
package/dist/types/Story.js
CHANGED
|
@@ -65,4 +65,18 @@ export let Story;
|
|
|
65
65
|
return arg === LifecycleStatus.PUBLISHED;
|
|
66
66
|
}
|
|
67
67
|
_Story.isPublished = isPublished;
|
|
68
|
+
function isLegacyHtmlFormat(arg) {
|
|
69
|
+
if (typeof arg === 'object') {
|
|
70
|
+
return isLegacyHtmlFormat(arg.format_version);
|
|
71
|
+
}
|
|
72
|
+
return arg === FormatVersion.HTML;
|
|
73
|
+
}
|
|
74
|
+
_Story.isLegacyHtmlFormat = isLegacyHtmlFormat;
|
|
75
|
+
function isSlateFormat(arg) {
|
|
76
|
+
if (typeof arg === 'object') {
|
|
77
|
+
return isSlateFormat(arg.format_version);
|
|
78
|
+
}
|
|
79
|
+
return arg === FormatVersion.SLATEJS;
|
|
80
|
+
}
|
|
81
|
+
_Story.isSlateFormat = isSlateFormat;
|
|
68
82
|
})(Story || (Story = {}));
|