@prezly/sdk 23.3.0 → 23.5.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.2.0";
7
+ const VERSION = "23.4.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.2.0";
1
+ const VERSION = "23.4.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
  }
@@ -95,6 +95,21 @@ export interface UpdateRequest {
95
95
  * "custom_privacy_policy_link" feature flag
96
96
  */
97
97
  custom_privacy_policy_link?: string | null;
98
+ /**
99
+ * Available only when license has
100
+ * "custom_privacy_policy_link" feature flag
101
+ */
102
+ custom_privacy_policy_content?: string | null;
103
+ /**
104
+ * Available only when license has
105
+ * "custom_privacy_policy_link" feature flag
106
+ */
107
+ custom_privacy_cookie_link?: string | null;
108
+ /**
109
+ * Available only when license has
110
+ * "custom_privacy_policy_link" feature flag
111
+ */
112
+ custom_privacy_cookie_content?: string | null;
98
113
  /**
99
114
  * Available only when license has
100
115
  * "custom_data_request_link" feature flag
@@ -14,7 +14,7 @@ type Exactly<Concrete, Abstract> = Concrete & Record<Exclude<keyof Concrete, key
14
14
  type InferExtraFields<T> = T extends Required<IncludeOptions<infer I>> ? Pick<Story.ExtraFields, I> : unknown;
15
15
  export type Client = ReturnType<typeof createClient>;
16
16
  export declare function createClient(api: DeferredJobsApiClient): {
17
- list: <Options extends ListOptions<keyof Story.ExtraFields>>(options?: Exactly<Options, ListOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options>>>;
17
+ list: <Options extends ListOptions<keyof Story.ExtraFields>>(options?: Exactly<Options, ListOptions>) => Promise<ListResponse<Story & InferExtraFields<Options>>>;
18
18
  search: <Options_1 extends SearchOptions<keyof Story.ExtraFields>>(options?: Exactly<Options_1, SearchOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options_1>>>;
19
19
  get: {
20
20
  <Options_2 extends IncludeOptions<keyof Story.ExtraFields> & {
@@ -23,6 +23,9 @@ let Newsroom = exports.Newsroom = void 0;
23
23
  TrackingPolicy["DEFAULT"] = "default";
24
24
  TrackingPolicy["DISABLED"] = "disabled";
25
25
  TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
26
+ TrackingPolicy["STRICT"] = "strict";
27
+ TrackingPolicy["NORMAL"] = "normal";
28
+ TrackingPolicy["LENIENT"] = "lenient";
26
29
  return TrackingPolicy;
27
30
  }({});
28
31
  _Newsroom.TrackingPolicy = TrackingPolicy;
@@ -84,8 +84,25 @@ export interface Newsroom extends NewsroomRef {
84
84
  email_branding_mode: Newsroom.EmailBrandingMode;
85
85
  email_branding: Newsroom.EmailBranding;
86
86
  is_privacy_portal_enabled: boolean;
87
+ /**
88
+ * @deprecated Please use `policies.privacy_policy.link` instead.
89
+ */
87
90
  custom_privacy_policy_link: string | null;
88
91
  custom_data_request_link: string | null;
92
+ policies: {
93
+ privacy_policy: {
94
+ link: string;
95
+ } | {
96
+ content: string;
97
+ origin: 'default' | 'custom';
98
+ };
99
+ cookie_policy: {
100
+ link: string;
101
+ } | {
102
+ content: string;
103
+ origin: 'default' | 'custom';
104
+ };
105
+ };
89
106
  tracking_policy: Newsroom.TrackingPolicy;
90
107
  onetrust_cookie_consent: {
91
108
  is_enabled: boolean;
@@ -136,9 +153,18 @@ export declare namespace Newsroom {
136
153
  CUSTOM = "custom"
137
154
  }
138
155
  enum TrackingPolicy {
156
+ /**
157
+ * @deprecated Please use `NORMAL` instead.
158
+ */
139
159
  DEFAULT = "default",
140
160
  DISABLED = "disabled",
141
- CONSENT_TO_IDENTIFY = "consent-to-identify"
161
+ /**
162
+ * @deprecated Please use `STRICT` instead.
163
+ */
164
+ CONSENT_TO_IDENTIFY = "consent-to-identify",
165
+ STRICT = "strict",
166
+ NORMAL = "normal",
167
+ LENIENT = "lenient"
142
168
  }
143
169
  enum EmailLogoAlignment {
144
170
  LEFT = "left",
@@ -17,6 +17,9 @@ export let Newsroom;
17
17
  TrackingPolicy["DEFAULT"] = "default";
18
18
  TrackingPolicy["DISABLED"] = "disabled";
19
19
  TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
20
+ TrackingPolicy["STRICT"] = "strict";
21
+ TrackingPolicy["NORMAL"] = "normal";
22
+ TrackingPolicy["LENIENT"] = "lenient";
20
23
  return TrackingPolicy;
21
24
  }({});
22
25
  _Newsroom.TrackingPolicy = TrackingPolicy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "23.3.0",
3
+ "version": "23.5.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",