@prezly/sdk 15.5.0 → 15.6.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.5.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.5.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
  }
@@ -3,5 +3,6 @@ import type { PricingTable } from './types';
3
3
  export declare class Client {
4
4
  private readonly apiClient;
5
5
  constructor(apiClient: DeferredJobsApiClient);
6
+ list(): Promise<PricingTable[]>;
6
7
  get(tableId: 'standard'): Promise<PricingTable>;
7
8
  }
@@ -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,18 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OptionId = void 0;
7
+ let OptionId;
8
+ exports.OptionId = OptionId;
9
+ (function (OptionId) {
10
+ OptionId["STARTER"] = "starter";
11
+ OptionId["CORE"] = "core";
12
+ OptionId["PREMIUM"] = "premium";
13
+ OptionId["AGENCY_STARTER"] = "agency_starter";
14
+ OptionId["AGENCY_SMALL"] = "agency_small";
15
+ OptionId["AGENCY_MEDIUM"] = "agency_medium";
16
+ OptionId["AGENCY_LARGE"] = "agency_large";
17
+ OptionId["AGENCY_HUGE"] = "agency_huge";
18
+ })(OptionId || (exports.OptionId = OptionId = {}));
@@ -3,7 +3,7 @@ export interface PricingTable {
3
3
  rows: Row[];
4
4
  }
5
5
  export interface Option {
6
- id: string;
6
+ id: OptionId;
7
7
  display_name: string;
8
8
  description: string | null;
9
9
  overview_features_list: PlanFeatureRef[];
@@ -11,6 +11,16 @@ export interface Option {
11
11
  prices: Price[];
12
12
  add_ons: AddOn[];
13
13
  }
14
+ export declare enum OptionId {
15
+ STARTER = "starter",
16
+ CORE = "core",
17
+ PREMIUM = "premium",
18
+ AGENCY_STARTER = "agency_starter",
19
+ AGENCY_SMALL = "agency_small",
20
+ AGENCY_MEDIUM = "agency_medium",
21
+ AGENCY_LARGE = "agency_large",
22
+ AGENCY_HUGE = "agency_huge"
23
+ }
14
24
  export interface PlanFeatureRef {
15
25
  name: string;
16
26
  details?: string;
@@ -1 +1,11 @@
1
- export {};
1
+ export let OptionId;
2
+ (function (OptionId) {
3
+ OptionId["STARTER"] = "starter";
4
+ OptionId["CORE"] = "core";
5
+ OptionId["PREMIUM"] = "premium";
6
+ OptionId["AGENCY_STARTER"] = "agency_starter";
7
+ OptionId["AGENCY_SMALL"] = "agency_small";
8
+ OptionId["AGENCY_MEDIUM"] = "agency_medium";
9
+ OptionId["AGENCY_LARGE"] = "agency_large";
10
+ OptionId["AGENCY_HUGE"] = "agency_huge";
11
+ })(OptionId || (OptionId = {}));
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.6.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",