@prezly/sdk 12.4.2 → 12.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 = "12.4.1";
7
+ const VERSION = "12.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 = "12.4.1";
1
+ const VERSION = "12.5.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -121,7 +121,10 @@ class Client {
121
121
  });
122
122
  return story;
123
123
  }
124
- async translate(id, payload, options) {
124
+ async translate(id, payload = {}, options) {
125
+ const {
126
+ culture
127
+ } = payload ?? {};
125
128
  const include = options?.include;
126
129
  const url = `${_routing.routing.storiesUrl}/${id}/translate`;
127
130
  const {
@@ -130,7 +133,9 @@ class Client {
130
133
  query: {
131
134
  include: include
132
135
  },
133
- payload
136
+ payload: {
137
+ culture
138
+ }
134
139
  });
135
140
  return story;
136
141
  }
@@ -287,5 +292,17 @@ class Client {
287
292
  const url = `${_routing.routing.storiesUrl}/${id}`;
288
293
  await this.apiClient.delete(url);
289
294
  }
295
+ async preview(id, options) {
296
+ const url = `${_routing.routing.storiesUrl}/${id}/preview`;
297
+ const {
298
+ preview
299
+ } = await this.apiClient.get(url, {
300
+ query: {
301
+ alignment: options?.alignment,
302
+ appearance: options?.appearance
303
+ }
304
+ });
305
+ return preview;
306
+ }
290
307
  }
291
308
  exports.Client = Client;
@@ -1,6 +1,6 @@
1
1
  import type { DeferredJobsApiClient } from '../../api';
2
2
  import type { ExtendedStory, Story } from '../../types';
3
- import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, TranslateRequest, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
3
+ import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, PreviewResponse, PreviewOptions, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, TranslateRequest, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
4
4
  /**
5
5
  * `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
6
6
  */
@@ -35,7 +35,7 @@ export declare class Client {
35
35
  get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['id'][], options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord[]>;
36
36
  create<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(payload: CreateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
37
37
  duplicate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
38
- translate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: TranslateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
38
+ translate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload?: TranslateRequest, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
39
39
  move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: MoveRequest, options?: Exactly<IncludeOptions<Include>, Options> & {
40
40
  force?: true;
41
41
  }): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
@@ -57,5 +57,6 @@ export declare class Client {
57
57
  }): Promise<StoryRecord>;
58
58
  unpin<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Exactly<IncludeOptions<Include>, Options>): Promise<StoryRecord>;
59
59
  delete(id: StoryId): Promise<void>;
60
+ preview(id: StoryId, options?: PreviewOptions): Promise<PreviewResponse>;
60
61
  }
61
62
  export {};
@@ -115,7 +115,10 @@ export class Client {
115
115
  });
116
116
  return story;
117
117
  }
118
- async translate(id, payload, options) {
118
+ async translate(id, payload = {}, options) {
119
+ const {
120
+ culture
121
+ } = payload ?? {};
119
122
  const include = options?.include;
120
123
  const url = `${routing.storiesUrl}/${id}/translate`;
121
124
  const {
@@ -124,7 +127,9 @@ export class Client {
124
127
  query: {
125
128
  include: include
126
129
  },
127
- payload
130
+ payload: {
131
+ culture
132
+ }
128
133
  });
129
134
  return story;
130
135
  }
@@ -281,4 +286,16 @@ export class Client {
281
286
  const url = `${routing.storiesUrl}/${id}`;
282
287
  await this.apiClient.delete(url);
283
288
  }
289
+ async preview(id, options) {
290
+ const url = `${routing.storiesUrl}/${id}/preview`;
291
+ const {
292
+ preview
293
+ } = await this.apiClient.get(url, {
294
+ query: {
295
+ alignment: options?.alignment,
296
+ appearance: options?.appearance
297
+ }
298
+ });
299
+ return preview;
300
+ }
284
301
  }
@@ -4,18 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.EXTENDED_STORY_INCLUDED_EXTRA_FIELDS = exports.ALL_EXTRA_FIELDS = void 0;
7
- /**
8
- * Uploadcare image JSON string.
9
- */
10
-
11
- /**
12
- * Raw HTML string.
13
- */
14
-
15
- /**
16
- * String containing Prezly Content Format JSON structure.
17
- */
18
-
7
+ var _index = require("../../types/index.cjs");
8
+ var Alignment = _index.Campaign.StoryAlignment;
9
+ var Appearance = _index.Campaign.StoryAppearance;
19
10
  const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE = {
20
11
  thumbnail_image: true,
21
12
  header_image: true,
@@ -1,4 +1,5 @@
1
1
  import type { Category, CategoryRef, CultureRef, ExtendedStory, Newsroom, NewsroomContactRef, Pagination, Query, SortOrder, Story } from '../../types';
2
+ import { Campaign } from '../../types';
2
3
  /**
3
4
  * Uploadcare image JSON string.
4
5
  */
@@ -136,6 +137,18 @@ export interface SlateStoryUpdateRequest extends GenericUpdateRequest {
136
137
  autosaved_content?: PrezlyContentFormat;
137
138
  content_version?: number;
138
139
  }
140
+ export interface PreviewResponse {
141
+ content: {
142
+ 'text/html': string;
143
+ 'text/plain': string;
144
+ };
145
+ }
146
+ export interface PreviewOptions {
147
+ alignment?: Alignment;
148
+ appearance?: Appearance;
149
+ }
150
+ export import Alignment = Campaign.StoryAlignment;
151
+ export import Appearance = Campaign.StoryAppearance;
139
152
  export declare type CreateRequest = HtmlStoryCreateRequest | SlateStoryCreateRequest;
140
153
  export declare type UpdateRequest = HtmlStoryUpdateRequest | SlateStoryUpdateRequest;
141
154
  export interface AutosaveRequest {
@@ -158,7 +171,7 @@ export interface ScheduleRequest {
158
171
  }
159
172
  export declare type UnscheduleRequest = UnpublishRequest;
160
173
  export interface TranslateRequest {
161
- culture: CultureRef['code'];
174
+ culture?: CultureRef['code'];
162
175
  }
163
176
  export interface MoveRequest {
164
177
  newsroom: Newsroom['uuid'] | Newsroom['id'];
@@ -1,15 +1,8 @@
1
- /**
2
- * Uploadcare image JSON string.
3
- */
4
-
5
- /**
6
- * Raw HTML string.
7
- */
8
-
9
- /**
10
- * String containing Prezly Content Format JSON structure.
11
- */
12
-
1
+ import { Campaign } from "../../types/index.js"; /**
2
+ * Uploadcare image JSON string.
3
+ */
4
+ var Alignment = Campaign.StoryAlignment;
5
+ var Appearance = Campaign.StoryAppearance;
13
6
  const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE = {
14
7
  thumbnail_image: true,
15
8
  header_image: true,
@@ -27,4 +27,25 @@ exports.Newsroom = Newsroom;
27
27
  TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
28
28
  })(TrackingPolicy || (TrackingPolicy = {}));
29
29
  _Newsroom.TrackingPolicy = TrackingPolicy;
30
+ function isActive(arg) {
31
+ if (typeof arg === 'string') {
32
+ return arg === Status.ACTIVE;
33
+ }
34
+ return isActive(arg.status);
35
+ }
36
+ _Newsroom.isActive = isActive;
37
+ function isInactive(arg) {
38
+ if (typeof arg === 'string') {
39
+ return arg === Status.INACTIVE;
40
+ }
41
+ return isInactive(arg.status);
42
+ }
43
+ _Newsroom.isInactive = isInactive;
44
+ function isArchived(arg) {
45
+ if (typeof arg === 'string') {
46
+ return arg === Status.ARCHIVED;
47
+ }
48
+ return isArchived(arg.status);
49
+ }
50
+ _Newsroom.isArchived = isArchived;
30
51
  })(Newsroom || (exports.Newsroom = Newsroom = {}));
@@ -133,4 +133,10 @@ export declare namespace Newsroom {
133
133
  DISABLED = "disabled",
134
134
  CONSENT_TO_IDENTIFY = "consent-to-identify"
135
135
  }
136
+ function isActive(newsroom: Newsroom['status']): boolean;
137
+ function isActive(newsroom: Pick<Newsroom, 'status'>): boolean;
138
+ function isInactive(newsroom: Newsroom['status']): boolean;
139
+ function isInactive(newsroom: Pick<Newsroom, 'status'>): boolean;
140
+ function isArchived(newsroom: Newsroom['status']): boolean;
141
+ function isArchived(newsroom: Pick<Newsroom, 'status'>): boolean;
136
142
  }
@@ -20,4 +20,25 @@ export let Newsroom;
20
20
  TrackingPolicy["CONSENT_TO_IDENTIFY"] = "consent-to-identify";
21
21
  })(TrackingPolicy || (TrackingPolicy = {}));
22
22
  _Newsroom.TrackingPolicy = TrackingPolicy;
23
+ function isActive(arg) {
24
+ if (typeof arg === 'string') {
25
+ return arg === Status.ACTIVE;
26
+ }
27
+ return isActive(arg.status);
28
+ }
29
+ _Newsroom.isActive = isActive;
30
+ function isInactive(arg) {
31
+ if (typeof arg === 'string') {
32
+ return arg === Status.INACTIVE;
33
+ }
34
+ return isInactive(arg.status);
35
+ }
36
+ _Newsroom.isInactive = isInactive;
37
+ function isArchived(arg) {
38
+ if (typeof arg === 'string') {
39
+ return arg === Status.ARCHIVED;
40
+ }
41
+ return isArchived(arg.status);
42
+ }
43
+ _Newsroom.isArchived = isArchived;
23
44
  })(Newsroom || (Newsroom = {}));
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Story = void 0;
7
+ var _Newsroom = require("./Newsroom.cjs");
7
8
  let Story;
8
9
  exports.Story = Story;
9
10
  (function (_Story) {
@@ -13,15 +14,22 @@ exports.Story = Story;
13
14
  FormatVersion[FormatVersion["SLATEJS"] = 3] = "SLATEJS";
14
15
  })(FormatVersion || (FormatVersion = {}));
15
16
  _Story.FormatVersion = FormatVersion;
16
- let LifecycleStatus;
17
- (function (LifecycleStatus) {
18
- LifecycleStatus["UNINITIALIZED"] = "uninitialized";
19
- LifecycleStatus["DRAFT"] = "draft";
20
- LifecycleStatus["SCHEDULED"] = "scheduled";
21
- LifecycleStatus["EMBARGO"] = "embargo";
22
- LifecycleStatus["PUBLISHED"] = "published";
23
- })(LifecycleStatus || (LifecycleStatus = {}));
24
- _Story.LifecycleStatus = LifecycleStatus;
17
+ let Status;
18
+ (function (Status) {
19
+ Status["UNINITIALIZED"] = "uninitialized";
20
+ Status["DRAFT"] = "draft";
21
+ Status["SCHEDULED"] = "scheduled";
22
+ Status["EMBARGO"] = "embargo";
23
+ Status["PUBLISHED"] = "published";
24
+ })(Status || (Status = {}));
25
+ _Story.Status = Status;
26
+ /**
27
+ * @deprecated Please use `Status` instead.
28
+ * @see Status
29
+ */var LifecycleStatus = Status; /**
30
+ * @deprecated Please use `Status` instead.
31
+ * @see Status
32
+ */
25
33
  let PublicationStatus;
26
34
  (function (PublicationStatus) {
27
35
  PublicationStatus["NEW"] = "new";
@@ -37,39 +45,51 @@ exports.Story = Story;
37
45
  Visibility["CONFIDENTIAL"] = "confidential";
38
46
  })(Visibility || (Visibility = {}));
39
47
  _Story.Visibility = Visibility;
48
+ function isActiveNewsroom(story) {
49
+ return _Newsroom.Newsroom.isActive(story.newsroom);
50
+ }
51
+ _Story.isActiveNewsroom = isActiveNewsroom;
52
+ function isInactiveNewsroom(story) {
53
+ return _Newsroom.Newsroom.isInactive(story.newsroom);
54
+ }
55
+ _Story.isInactiveNewsroom = isInactiveNewsroom;
56
+ function isArchivedNewsroom(story) {
57
+ return _Newsroom.Newsroom.isArchived(story.newsroom);
58
+ }
59
+ _Story.isArchivedNewsroom = isArchivedNewsroom;
40
60
  function isUninitialized(arg) {
41
61
  if (typeof arg === 'object') {
42
- return isUninitialized(arg.lifecycle_status);
62
+ return isUninitialized(arg.status);
43
63
  }
44
- return arg === LifecycleStatus.UNINITIALIZED;
64
+ return arg === Status.UNINITIALIZED;
45
65
  }
46
66
  _Story.isUninitialized = isUninitialized;
47
67
  function isDraft(arg) {
48
68
  if (typeof arg === 'object') {
49
- return isDraft(arg.lifecycle_status);
69
+ return isDraft(arg.status);
50
70
  }
51
- return arg === LifecycleStatus.DRAFT;
71
+ return arg === Status.DRAFT;
52
72
  }
53
73
  _Story.isDraft = isDraft;
54
74
  function isScheduled(arg) {
55
75
  if (typeof arg === 'object') {
56
- return isScheduled(arg.lifecycle_status);
76
+ return isScheduled(arg.status);
57
77
  }
58
- return arg === LifecycleStatus.SCHEDULED;
78
+ return arg === Status.SCHEDULED;
59
79
  }
60
80
  _Story.isScheduled = isScheduled;
61
81
  function isScheduledEmbargo(arg) {
62
82
  if (typeof arg === 'object') {
63
- return isScheduledEmbargo(arg.lifecycle_status);
83
+ return isScheduledEmbargo(arg.status);
64
84
  }
65
- return arg === LifecycleStatus.EMBARGO;
85
+ return arg === Status.EMBARGO;
66
86
  }
67
87
  _Story.isScheduledEmbargo = isScheduledEmbargo;
68
88
  function isPublished(arg) {
69
89
  if (typeof arg === 'object') {
70
- return isPublished(arg.lifecycle_status);
90
+ return isPublished(arg.status);
71
91
  }
72
- return arg === LifecycleStatus.PUBLISHED;
92
+ return arg === Status.PUBLISHED;
73
93
  }
74
94
  _Story.isPublished = isPublished;
75
95
  function isLegacyHtmlFormat(arg) {
@@ -1,7 +1,7 @@
1
1
  import type { Category } from './Category';
2
2
  import type { OEmbedInfo } from './common';
3
3
  import type { CultureRef } from './Culture';
4
- import type { NewsroomRef } from './Newsroom';
4
+ import { type NewsroomRef } from './Newsroom';
5
5
  import type { SEOSettings } from './SEOSettings';
6
6
  import type { UserRef } from './User';
7
7
  export interface StoryRef {
@@ -13,13 +13,19 @@ export interface StoryRef {
13
13
  id: number;
14
14
  title: string;
15
15
  slug: string;
16
+ status: Story.Status;
16
17
  /**
17
- * @deprecated Please use `lifecycle_status` instead.
18
- * @see lifecycle_status
19
- * @see Story.LifecycleStatus
18
+ * @deprecated Please use `status` instead.
19
+ * @see status
20
+ * @see Story.Status
20
21
  */
21
- publication_status: Story.PublicationStatus;
22
22
  lifecycle_status: Story.LifecycleStatus;
23
+ /**
24
+ * @deprecated Please use `status` instead.
25
+ * @see status
26
+ * @see Story.Status
27
+ */
28
+ publication_status: Story.PublicationStatus;
23
29
  visibility: Story.Visibility;
24
30
  thumbnail_url: string;
25
31
  created_at: string;
@@ -78,7 +84,11 @@ export interface Story {
78
84
  updated_at: string;
79
85
  published_at: string | null;
80
86
  scheduled_at: string | null;
81
- lifecycle_status: Story.LifecycleStatus;
87
+ status: Story.Status;
88
+ /**
89
+ * @deprecated Please use `status` instead.
90
+ */
91
+ lifecycle_status: Story.Status;
82
92
  /**
83
93
  * @deprecated Please use `newsroom.status` instead.
84
94
  * @see newsroom
@@ -86,27 +96,27 @@ export interface Story {
86
96
  */
87
97
  is_archived: boolean;
88
98
  /**
89
- * @deprecated Please use `lifecycle_status` instead.
90
- * @see lifecycle_status
91
- * @see Story.LifecycleStatus
99
+ * @deprecated Please use `status` instead.
100
+ * @see status
101
+ * @see Story.Status
92
102
  */
93
103
  is_finalized: boolean;
94
104
  /**
95
- * @deprecated Please use `lifecycle_status` instead.
96
- * @see lifecycle_status
97
- * @see Story.LifecycleStatus
105
+ * @deprecated Please use `status` instead.
106
+ * @see status
107
+ * @see Story.Status
98
108
  */
99
109
  is_published: boolean;
100
110
  /**
101
- * @deprecated Please use `lifecycle_status` instead.
102
- * @see lifecycle_status
103
- * @see Story.LifecycleStatus
111
+ * @deprecated Please use `status` instead.
112
+ * @see status
113
+ * @see Story.Status
104
114
  */
105
115
  is_draft: boolean;
106
116
  /**
107
- * @deprecated Please use `lifecycle_status` instead.
108
- * @see lifecycle_status
109
- * @see Story.LifecycleStatus
117
+ * @deprecated Please use `status` instead.
118
+ * @see status
119
+ * @see Story.Status
110
120
  */
111
121
  is_embargo: boolean;
112
122
  /**
@@ -116,18 +126,18 @@ export interface Story {
116
126
  */
117
127
  is_private: boolean;
118
128
  /**
119
- * @deprecated Please use `lifecycle_status` instead.
120
- * @see lifecycle_status
121
- * @see Story.LifecycleStatus
129
+ * @deprecated Please use `status` instead.
130
+ * @see status
131
+ * @see Story.Status
122
132
  */
123
133
  is_scheduled: boolean;
124
134
  is_sharable: boolean;
125
135
  is_analytics_available: boolean;
126
136
  is_shared_to_prpro: boolean;
127
137
  /**
128
- * @deprecated Please use `lifecycle_status` instead.
129
- * @see lifecycle_status
130
- * @see Story.LifecycleStatus
138
+ * @deprecated Please use `status` instead.
139
+ * @see status
140
+ * @see Story.Status
131
141
  */
132
142
  publication_status: Story.PublicationStatus;
133
143
  visibility: Story.Visibility;
@@ -140,7 +150,7 @@ export declare namespace Story {
140
150
  HTML = 1,
141
151
  SLATEJS = 3
142
152
  }
143
- enum LifecycleStatus {
153
+ enum Status {
144
154
  UNINITIALIZED = "uninitialized",
145
155
  DRAFT = "draft",
146
156
  SCHEDULED = "scheduled",
@@ -148,8 +158,13 @@ export declare namespace Story {
148
158
  PUBLISHED = "published"
149
159
  }
150
160
  /**
151
- * Please use `LifecycleStatus` instead.
152
- * @see LifecycleStatus
161
+ * @deprecated Please use `Status` instead.
162
+ * @see Status
163
+ */
164
+ export import LifecycleStatus = Status;
165
+ /**
166
+ * @deprecated Please use `Status` instead.
167
+ * @see Status
153
168
  */
154
169
  enum PublicationStatus {
155
170
  NEW = "new",
@@ -237,16 +252,19 @@ export declare namespace Story {
237
252
  */
238
253
  'pitches.count': number;
239
254
  }
240
- function isUninitialized(status: LifecycleStatus): boolean;
241
- function isUninitialized(story: Pick<Story, 'lifecycle_status'>): boolean;
242
- function isDraft(status: LifecycleStatus): boolean;
243
- function isDraft(story: Pick<Story, 'lifecycle_status'>): boolean;
244
- function isScheduled(status: LifecycleStatus): boolean;
245
- function isScheduled(story: Pick<Story, 'lifecycle_status'>): boolean;
246
- function isScheduledEmbargo(status: LifecycleStatus): boolean;
247
- function isScheduledEmbargo(story: Pick<Story, 'lifecycle_status'>): boolean;
248
- function isPublished(status: LifecycleStatus): boolean;
249
- function isPublished(story: Pick<Story, 'lifecycle_status'>): boolean;
255
+ function isActiveNewsroom(story: Pick<Story, 'newsroom'>): boolean;
256
+ function isInactiveNewsroom(story: Pick<Story, 'newsroom'>): boolean;
257
+ function isArchivedNewsroom(story: Pick<Story, 'newsroom'>): boolean;
258
+ function isUninitialized(status: Status): boolean;
259
+ function isUninitialized(story: Pick<Story, 'status'>): boolean;
260
+ function isDraft(status: Status): boolean;
261
+ function isDraft(story: Pick<Story, 'status'>): boolean;
262
+ function isScheduled(status: Status): boolean;
263
+ function isScheduled(story: Pick<Story, 'status'>): boolean;
264
+ function isScheduledEmbargo(status: Status): boolean;
265
+ function isScheduledEmbargo(story: Pick<Story, 'status'>): boolean;
266
+ function isPublished(status: Status): boolean;
267
+ function isPublished(story: Pick<Story, 'status'>): boolean;
250
268
  function isLegacyHtmlFormat(format: FormatVersion): format is FormatVersion.HTML;
251
269
  function isLegacyHtmlFormat<T extends Pick<Story, 'format_version'>>(story: T): story is T & {
252
270
  format_version: FormatVersion.HTML;
@@ -1,3 +1,4 @@
1
+ import { Newsroom } from "./Newsroom.js";
1
2
  export let Story;
2
3
  (function (_Story) {
3
4
  let FormatVersion;
@@ -6,15 +7,22 @@ export let Story;
6
7
  FormatVersion[FormatVersion["SLATEJS"] = 3] = "SLATEJS";
7
8
  })(FormatVersion || (FormatVersion = {}));
8
9
  _Story.FormatVersion = FormatVersion;
9
- let LifecycleStatus;
10
- (function (LifecycleStatus) {
11
- LifecycleStatus["UNINITIALIZED"] = "uninitialized";
12
- LifecycleStatus["DRAFT"] = "draft";
13
- LifecycleStatus["SCHEDULED"] = "scheduled";
14
- LifecycleStatus["EMBARGO"] = "embargo";
15
- LifecycleStatus["PUBLISHED"] = "published";
16
- })(LifecycleStatus || (LifecycleStatus = {}));
17
- _Story.LifecycleStatus = LifecycleStatus;
10
+ let Status;
11
+ (function (Status) {
12
+ Status["UNINITIALIZED"] = "uninitialized";
13
+ Status["DRAFT"] = "draft";
14
+ Status["SCHEDULED"] = "scheduled";
15
+ Status["EMBARGO"] = "embargo";
16
+ Status["PUBLISHED"] = "published";
17
+ })(Status || (Status = {}));
18
+ _Story.Status = Status;
19
+ /**
20
+ * @deprecated Please use `Status` instead.
21
+ * @see Status
22
+ */var LifecycleStatus = Status; /**
23
+ * @deprecated Please use `Status` instead.
24
+ * @see Status
25
+ */
18
26
  let PublicationStatus;
19
27
  (function (PublicationStatus) {
20
28
  PublicationStatus["NEW"] = "new";
@@ -30,39 +38,51 @@ export let Story;
30
38
  Visibility["CONFIDENTIAL"] = "confidential";
31
39
  })(Visibility || (Visibility = {}));
32
40
  _Story.Visibility = Visibility;
41
+ function isActiveNewsroom(story) {
42
+ return Newsroom.isActive(story.newsroom);
43
+ }
44
+ _Story.isActiveNewsroom = isActiveNewsroom;
45
+ function isInactiveNewsroom(story) {
46
+ return Newsroom.isInactive(story.newsroom);
47
+ }
48
+ _Story.isInactiveNewsroom = isInactiveNewsroom;
49
+ function isArchivedNewsroom(story) {
50
+ return Newsroom.isArchived(story.newsroom);
51
+ }
52
+ _Story.isArchivedNewsroom = isArchivedNewsroom;
33
53
  function isUninitialized(arg) {
34
54
  if (typeof arg === 'object') {
35
- return isUninitialized(arg.lifecycle_status);
55
+ return isUninitialized(arg.status);
36
56
  }
37
- return arg === LifecycleStatus.UNINITIALIZED;
57
+ return arg === Status.UNINITIALIZED;
38
58
  }
39
59
  _Story.isUninitialized = isUninitialized;
40
60
  function isDraft(arg) {
41
61
  if (typeof arg === 'object') {
42
- return isDraft(arg.lifecycle_status);
62
+ return isDraft(arg.status);
43
63
  }
44
- return arg === LifecycleStatus.DRAFT;
64
+ return arg === Status.DRAFT;
45
65
  }
46
66
  _Story.isDraft = isDraft;
47
67
  function isScheduled(arg) {
48
68
  if (typeof arg === 'object') {
49
- return isScheduled(arg.lifecycle_status);
69
+ return isScheduled(arg.status);
50
70
  }
51
- return arg === LifecycleStatus.SCHEDULED;
71
+ return arg === Status.SCHEDULED;
52
72
  }
53
73
  _Story.isScheduled = isScheduled;
54
74
  function isScheduledEmbargo(arg) {
55
75
  if (typeof arg === 'object') {
56
- return isScheduledEmbargo(arg.lifecycle_status);
76
+ return isScheduledEmbargo(arg.status);
57
77
  }
58
- return arg === LifecycleStatus.EMBARGO;
78
+ return arg === Status.EMBARGO;
59
79
  }
60
80
  _Story.isScheduledEmbargo = isScheduledEmbargo;
61
81
  function isPublished(arg) {
62
82
  if (typeof arg === 'object') {
63
- return isPublished(arg.lifecycle_status);
83
+ return isPublished(arg.status);
64
84
  }
65
- return arg === LifecycleStatus.PUBLISHED;
85
+ return arg === Status.PUBLISHED;
66
86
  }
67
87
  _Story.isPublished = isPublished;
68
88
  function isLegacyHtmlFormat(arg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "12.4.2",
3
+ "version": "12.6.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",