@prezly/sdk 15.5.0 → 15.7.0

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.
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "15.4.0";
7
+ const VERSION = "15.6.0";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
10
10
  exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
@@ -1,3 +1,3 @@
1
- const VERSION = "15.4.0";
1
+ const VERSION = "15.6.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -9,11 +9,18 @@ class Client {
9
9
  constructor(apiClient) {
10
10
  this.apiClient = apiClient;
11
11
  }
12
+ async list() {
13
+ const url = _routing.routing.pricingTablesUrl;
14
+ const {
15
+ tables
16
+ } = await this.apiClient.get(url);
17
+ return tables;
18
+ }
12
19
  async get(tableId) {
13
- const url = _routing.routing.pricingTablesUrl.replace(':table_id', String(tableId));
20
+ const url = _routing.routing.pricingTablesUrl;
14
21
  const {
15
22
  table
16
- } = await this.apiClient.get(url);
23
+ } = await this.apiClient.get(`${url}/${tableId}`);
17
24
  return table;
18
25
  }
19
26
  }
@@ -1,7 +1,9 @@
1
1
  import type { DeferredJobsApiClient } from '../../api';
2
2
  import type { PricingTable } from './types';
3
+ import type { TableId } from './types';
3
4
  export declare class Client {
4
5
  private readonly apiClient;
5
6
  constructor(apiClient: DeferredJobsApiClient);
6
- get(tableId: 'standard'): Promise<PricingTable>;
7
+ list(): Promise<PricingTable[]>;
8
+ get(tableId: TableId.STANDARD): Promise<PricingTable>;
7
9
  }
@@ -3,11 +3,18 @@ export class Client {
3
3
  constructor(apiClient) {
4
4
  this.apiClient = apiClient;
5
5
  }
6
+ async list() {
7
+ const url = routing.pricingTablesUrl;
8
+ const {
9
+ tables
10
+ } = await this.apiClient.get(url);
11
+ return tables;
12
+ }
6
13
  async get(tableId) {
7
- const url = routing.pricingTablesUrl.replace(':table_id', String(tableId));
14
+ const url = routing.pricingTablesUrl;
8
15
  const {
9
16
  table
10
- } = await this.apiClient.get(url);
17
+ } = await this.apiClient.get(`${url}/${tableId}`);
11
18
  return table;
12
19
  }
13
20
  }
@@ -1 +1,39 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AddOnId = exports.LimitId = exports.OptionId = exports.TableId = void 0;
7
+ let TableId;
8
+ exports.TableId = TableId;
9
+ (function (TableId) {
10
+ TableId["STANDARD"] = "standard";
11
+ TableId["AGENCY"] = "agency";
12
+ })(TableId || (exports.TableId = TableId = {}));
13
+ let OptionId;
14
+ exports.OptionId = OptionId;
15
+ (function (OptionId) {
16
+ OptionId["STARTER"] = "starter";
17
+ OptionId["CORE"] = "core";
18
+ OptionId["PREMIUM"] = "premium";
19
+ OptionId["AGENCY_STARTER"] = "agency_starter";
20
+ OptionId["AGENCY_SMALL"] = "agency_small";
21
+ OptionId["AGENCY_MEDIUM"] = "agency_medium";
22
+ OptionId["AGENCY_LARGE"] = "agency_large";
23
+ OptionId["AGENCY_HUGE"] = "agency_huge";
24
+ })(OptionId || (exports.OptionId = OptionId = {}));
25
+ let LimitId;
26
+ exports.LimitId = LimitId;
27
+ (function (LimitId) {
28
+ LimitId["STORIES"] = "stories";
29
+ LimitId["USERS"] = "users";
30
+ LimitId["SITES"] = "sites";
31
+ LimitId["CONTACTS"] = "contacts";
32
+ LimitId["EMAIL_SENDS"] = "email_sends";
33
+ LimitId["CUSTOM_SENDER_ADDRESSES"] = "custom_sender_addresses";
34
+ })(LimitId || (exports.LimitId = LimitId = {}));
35
+ let AddOnId;
36
+ exports.AddOnId = AddOnId;
37
+ (function (AddOnId) {
38
+ AddOnId["SITE"] = "site";
39
+ })(AddOnId || (exports.AddOnId = AddOnId = {}));
@@ -1,9 +1,14 @@
1
1
  export interface PricingTable {
2
+ id: TableId;
2
3
  options: Option[];
3
4
  rows: Row[];
4
5
  }
6
+ export declare enum TableId {
7
+ STANDARD = "standard",
8
+ AGENCY = "agency"
9
+ }
5
10
  export interface Option {
6
- id: string;
11
+ id: OptionId;
7
12
  display_name: string;
8
13
  description: string | null;
9
14
  overview_features_list: PlanFeatureRef[];
@@ -11,16 +16,34 @@ export interface Option {
11
16
  prices: Price[];
12
17
  add_ons: AddOn[];
13
18
  }
19
+ export declare enum OptionId {
20
+ STARTER = "starter",
21
+ CORE = "core",
22
+ PREMIUM = "premium",
23
+ AGENCY_STARTER = "agency_starter",
24
+ AGENCY_SMALL = "agency_small",
25
+ AGENCY_MEDIUM = "agency_medium",
26
+ AGENCY_LARGE = "agency_large",
27
+ AGENCY_HUGE = "agency_huge"
28
+ }
14
29
  export interface PlanFeatureRef {
15
30
  name: string;
16
31
  details?: string;
17
32
  }
18
33
  export interface Limit {
19
- id: string;
34
+ id: LimitId;
20
35
  display_name: string;
21
36
  value: null | number;
22
37
  per: null | string;
23
38
  }
39
+ export declare enum LimitId {
40
+ STORIES = "stories",
41
+ USERS = "users",
42
+ SITES = "sites",
43
+ CONTACTS = "contacts",
44
+ EMAIL_SENDS = "email_sends",
45
+ CUSTOM_SENDER_ADDRESSES = "custom_sender_addresses"
46
+ }
24
47
  export interface Price {
25
48
  billing_cycle: string;
26
49
  currency: string;
@@ -28,10 +51,13 @@ export interface Price {
28
51
  unit: string | null;
29
52
  }
30
53
  export interface AddOn {
31
- id: string;
54
+ id: AddOnId;
32
55
  display_name: string;
33
56
  prices: Price[];
34
57
  }
58
+ export declare enum AddOnId {
59
+ SITE = "site"
60
+ }
35
61
  export interface Row {
36
62
  display_name: string;
37
63
  description: string | null;
@@ -1 +1,29 @@
1
- export {};
1
+ export let TableId;
2
+ (function (TableId) {
3
+ TableId["STANDARD"] = "standard";
4
+ TableId["AGENCY"] = "agency";
5
+ })(TableId || (TableId = {}));
6
+ export let OptionId;
7
+ (function (OptionId) {
8
+ OptionId["STARTER"] = "starter";
9
+ OptionId["CORE"] = "core";
10
+ OptionId["PREMIUM"] = "premium";
11
+ OptionId["AGENCY_STARTER"] = "agency_starter";
12
+ OptionId["AGENCY_SMALL"] = "agency_small";
13
+ OptionId["AGENCY_MEDIUM"] = "agency_medium";
14
+ OptionId["AGENCY_LARGE"] = "agency_large";
15
+ OptionId["AGENCY_HUGE"] = "agency_huge";
16
+ })(OptionId || (OptionId = {}));
17
+ export let LimitId;
18
+ (function (LimitId) {
19
+ LimitId["STORIES"] = "stories";
20
+ LimitId["USERS"] = "users";
21
+ LimitId["SITES"] = "sites";
22
+ LimitId["CONTACTS"] = "contacts";
23
+ LimitId["EMAIL_SENDS"] = "email_sends";
24
+ LimitId["CUSTOM_SENDER_ADDRESSES"] = "custom_sender_addresses";
25
+ })(LimitId || (LimitId = {}));
26
+ export let AddOnId;
27
+ (function (AddOnId) {
28
+ AddOnId["SITE"] = "site";
29
+ })(AddOnId || (AddOnId = {}));
package/dist/routing.cjs CHANGED
@@ -29,7 +29,7 @@ const routing = {
29
29
  newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
30
30
  newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
31
31
  notificationSubscriptionsUrl: '/v2/notification-subscriptions',
32
- pricingTablesUrl: '/v2/pricing-tables/:table_id',
32
+ pricingTablesUrl: '/v2/pricing-tables',
33
33
  senderAddressesUrl: '/v2/sender-addresses',
34
34
  signup: '/v2/signup',
35
35
  storiesUrl: '/v2/stories',
package/dist/routing.js CHANGED
@@ -23,7 +23,7 @@ export const routing = {
23
23
  newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
24
24
  newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
25
25
  notificationSubscriptionsUrl: '/v2/notification-subscriptions',
26
- pricingTablesUrl: '/v2/pricing-tables/:table_id',
26
+ pricingTablesUrl: '/v2/pricing-tables',
27
27
  senderAddressesUrl: '/v2/sender-addresses',
28
28
  signup: '/v2/signup',
29
29
  storiesUrl: '/v2/stories',
@@ -3,8 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PlanLevel = void 0;
7
- /** @deprecated Will be dropped in future */let PlanLevel;
6
+ exports.PlanLevel = exports.ChangeType = void 0;
7
+ let ChangeType; /** @deprecated Will be dropped in future */
8
+ exports.ChangeType = ChangeType;
9
+ (function (ChangeType) {
10
+ ChangeType["ACTIVATION"] = "activation";
11
+ ChangeType["UPGRADE"] = "upgrade";
12
+ ChangeType["DOWNGRADE"] = "downgrade";
13
+ })(ChangeType || (exports.ChangeType = ChangeType = {}));
14
+ let PlanLevel;
8
15
  exports.PlanLevel = PlanLevel;
9
16
  (function (PlanLevel) {
10
17
  PlanLevel["BASIC"] = "basic";
@@ -1,4 +1,5 @@
1
1
  import type { Limit } from '../endpoints/PricingTables';
2
+ import type { OptionId } from '../endpoints/PricingTables';
2
3
  import type { BillingCycle } from './BillingCycle';
3
4
  import type { Currency } from './Currency';
4
5
  export interface PlanReference {
@@ -9,7 +10,7 @@ export interface PlanReference {
9
10
  is_superior: boolean;
10
11
  is_trial: boolean;
11
12
  can_upgrade: boolean;
12
- pricing_table_option_id: string | null;
13
+ pricing_table_option_id: OptionId | null;
13
14
  }
14
15
  export interface Plan extends PlanReference {
15
16
  billing_cycle: BillingCycle;
@@ -18,11 +19,24 @@ export interface Plan extends PlanReference {
18
19
  total_before_discount: number;
19
20
  total_after_discount: number;
20
21
  usage: Usage[];
22
+ possible_changes: Change[];
23
+ ends_at: string | null;
24
+ ended_at: string | null;
21
25
  }
22
26
  export interface Usage {
23
27
  limit: Limit;
24
28
  used: number;
25
29
  }
30
+ export interface Change {
31
+ pricing_table_option_id: OptionId;
32
+ can_self_change: boolean;
33
+ type: ChangeType;
34
+ }
35
+ export declare enum ChangeType {
36
+ ACTIVATION = "activation",
37
+ UPGRADE = "upgrade",
38
+ DOWNGRADE = "downgrade"
39
+ }
26
40
  /** @deprecated Will be dropped in future */
27
41
  export declare enum PlanLevel {
28
42
  BASIC = "basic",
@@ -1,4 +1,11 @@
1
+ export let ChangeType;
2
+
1
3
  /** @deprecated Will be dropped in future */
4
+ (function (ChangeType) {
5
+ ChangeType["ACTIVATION"] = "activation";
6
+ ChangeType["UPGRADE"] = "upgrade";
7
+ ChangeType["DOWNGRADE"] = "downgrade";
8
+ })(ChangeType || (ChangeType = {}));
2
9
  export let PlanLevel;
3
10
  (function (PlanLevel) {
4
11
  PlanLevel["BASIC"] = "basic";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "15.5.0",
3
+ "version": "15.7.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",