@prezly/sdk 23.2.0 → 23.4.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,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "23.1.0";
7
+ const VERSION = "23.3.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})`;
@@ -1,3 +1,3 @@
1
- const VERSION = "23.1.0";
1
+ const VERSION = "23.3.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -57,7 +57,7 @@ function createClient(api) {
57
57
  });
58
58
  return coverage;
59
59
  }
60
- async function getByExternalReferenceId(externalReferenceId) {
60
+ async function getByExternalReferenceId(externalReferenceId, options = {}) {
61
61
  const query = JSON.stringify({
62
62
  external_reference_id: {
63
63
  $in: [externalReferenceId]
@@ -66,8 +66,9 @@ function createClient(api) {
66
66
  const {
67
67
  coverage
68
68
  } = await search({
69
- includeDeleted: true,
70
- query
69
+ includeDeleted: options.includeDeleted ?? true,
70
+ query,
71
+ sortOrder: 'deleted_at' // Prefer non-deleted records first
71
72
  });
72
73
  return coverage[0] || null;
73
74
  }
@@ -8,7 +8,9 @@ export declare function createClient(api: DeferredJobsApiClient): {
8
8
  list: (options?: ListOptions, scope?: Scope) => Promise<ListResponse>;
9
9
  search: (options?: SearchOptions, scope?: Scope) => Promise<ListResponse>;
10
10
  get: (id: CoverageId, includeDeleted?: boolean) => Promise<CoverageEntry>;
11
- getByExternalReferenceId: (externalReferenceId: string) => Promise<CoverageEntry | null>;
11
+ getByExternalReferenceId: (externalReferenceId: string, options?: {
12
+ includeDeleted?: boolean;
13
+ }) => Promise<CoverageEntry | null>;
12
14
  create: (payload: CreateRequest, { enrich }?: CreateOptions) => Promise<CoverageEntry>;
13
15
  update: (id: CoverageId, payload: UpdateRequest) => Promise<CoverageEntry>;
14
16
  delete: (id: CoverageId) => Promise<void>;
@@ -51,7 +51,7 @@ export function createClient(api) {
51
51
  });
52
52
  return coverage;
53
53
  }
54
- async function getByExternalReferenceId(externalReferenceId) {
54
+ async function getByExternalReferenceId(externalReferenceId, options = {}) {
55
55
  const query = JSON.stringify({
56
56
  external_reference_id: {
57
57
  $in: [externalReferenceId]
@@ -60,8 +60,9 @@ export function createClient(api) {
60
60
  const {
61
61
  coverage
62
62
  } = await search({
63
- includeDeleted: true,
64
- query
63
+ includeDeleted: options.includeDeleted ?? true,
64
+ query,
65
+ sortOrder: 'deleted_at' // Prefer non-deleted records first
65
66
  });
66
67
  return coverage[0] || null;
67
68
  }
@@ -27,6 +27,14 @@ let License = exports.License = void 0;
27
27
  Status["UNPAID"] = "unpaid";
28
28
  })(Status || (Status = {}));
29
29
  _License.Status = Status;
30
+ let SubscriptionStatus;
31
+ (function (SubscriptionStatus) {
32
+ SubscriptionStatus["TRIALING"] = "trialing";
33
+ SubscriptionStatus["EXPIRED"] = "expired";
34
+ SubscriptionStatus["ACTIVE"] = "active";
35
+ SubscriptionStatus["CANCELED"] = "canceled";
36
+ })(SubscriptionStatus || (SubscriptionStatus = {}));
37
+ _License.SubscriptionStatus = SubscriptionStatus;
30
38
  let CompanyType;
31
39
  (function (CompanyType) {
32
40
  CompanyType["BRAND"] = "brand";
@@ -8,6 +8,7 @@ export interface LicenseRef {
8
8
  is_sso_required: boolean;
9
9
  avatar_url: string;
10
10
  status: License.Status;
11
+ subscription_status: License.SubscriptionStatus | null;
11
12
  }
12
13
  export interface License extends LicenseRef {
13
14
  company_type: License.CompanyType | null;
@@ -119,6 +120,12 @@ export declare namespace License {
119
120
  CANCELED = "canceled",
120
121
  UNPAID = "unpaid"
121
122
  }
123
+ enum SubscriptionStatus {
124
+ TRIALING = "trialing",
125
+ EXPIRED = "expired",
126
+ ACTIVE = "active",
127
+ CANCELED = "canceled"
128
+ }
122
129
  enum CompanyType {
123
130
  BRAND = "brand",
124
131
  AGENCY = "agency",
@@ -21,6 +21,14 @@ export let License;
21
21
  Status["UNPAID"] = "unpaid";
22
22
  })(Status || (Status = {}));
23
23
  _License.Status = Status;
24
+ let SubscriptionStatus;
25
+ (function (SubscriptionStatus) {
26
+ SubscriptionStatus["TRIALING"] = "trialing";
27
+ SubscriptionStatus["EXPIRED"] = "expired";
28
+ SubscriptionStatus["ACTIVE"] = "active";
29
+ SubscriptionStatus["CANCELED"] = "canceled";
30
+ })(SubscriptionStatus || (SubscriptionStatus = {}));
31
+ _License.SubscriptionStatus = SubscriptionStatus;
24
32
  let CompanyType;
25
33
  (function (CompanyType) {
26
34
  CompanyType["BRAND"] = "brand";
@@ -5,6 +5,7 @@ import type { BillingCycle } from './BillingCycle';
5
5
  import type { Currency } from './Currency';
6
6
  import type { TiersMode, BillingSchema, Tier } from './Price';
7
7
  export interface PlanReference {
8
+ id: string | null;
8
9
  display_name: string;
9
10
  description: string | null;
10
11
  is_legacy: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "23.2.0",
3
+ "version": "23.4.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",