@prezly/sdk 14.1.0 → 14.2.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 = "14.0.0";
7
+ const VERSION = "14.1.1";
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 = "14.0.0";
1
+ const VERSION = "14.1.1";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -9,6 +9,10 @@ declare type Iso8601DateTime = string;
9
9
  * Raw HTML string.
10
10
  */
11
11
  declare type Html = string;
12
+ /**
13
+ * String-serialized JSON object.
14
+ */
15
+ declare type Json = string;
12
16
  /**
13
17
  * String containing Prezly Content Format JSON structure.
14
18
  */
@@ -104,10 +108,11 @@ export interface HtmlStoryCreateRequest extends GenericCreateRequest {
104
108
  format_version?: Story.FormatVersion.HTML;
105
109
  intro?: Html;
106
110
  content?: Html;
107
- /**
108
- * Attached gallery slate content.
109
- */
110
- attached_gallery_content?: string;
111
+ attached_attachments_content?: Json;
112
+ attached_bookmarks_content?: Json;
113
+ attached_contacts_content?: Json;
114
+ attached_gallery_content?: Json;
115
+ attached_videos_content?: Json;
111
116
  }
112
117
  export interface SlateStoryCreateRequest extends GenericCreateRequest {
113
118
  /**
@@ -123,10 +128,11 @@ export interface SlateStoryCreateRequest extends GenericCreateRequest {
123
128
  export interface HtmlStoryUpdateRequest extends GenericUpdateRequest {
124
129
  intro?: Html;
125
130
  content?: Html;
126
- /**
127
- * Attached gallery slate content.
128
- */
129
- attached_gallery_content?: string;
131
+ attached_attachments_content?: Json;
132
+ attached_bookmarks_content?: Json;
133
+ attached_contacts_content?: Json;
134
+ attached_gallery_content?: Json;
135
+ attached_videos_content?: Json;
130
136
  }
131
137
  export interface SlateStoryUpdateRequest extends GenericUpdateRequest {
132
138
  /**
@@ -139,7 +145,7 @@ export interface SlateStoryUpdateRequest extends GenericUpdateRequest {
139
145
  }
140
146
  export interface PreviewResponse {
141
147
  content: {
142
- 'text/html': string;
148
+ 'text/html': Html;
143
149
  'text/plain': string;
144
150
  };
145
151
  }
@@ -28,24 +28,24 @@ exports.Newsroom = Newsroom;
28
28
  })(TrackingPolicy || (TrackingPolicy = {}));
29
29
  _Newsroom.TrackingPolicy = TrackingPolicy;
30
30
  function isActive(arg) {
31
- if (typeof arg === 'string') {
32
- return arg === Status.ACTIVE;
31
+ if (typeof arg === 'object' && arg !== null) {
32
+ return isActive(arg.status);
33
33
  }
34
- return isActive(arg.status);
34
+ return arg === Status.ACTIVE;
35
35
  }
36
36
  _Newsroom.isActive = isActive;
37
37
  function isInactive(arg) {
38
- if (typeof arg === 'string') {
39
- return arg === Status.INACTIVE;
38
+ if (typeof arg === 'object' && arg !== null) {
39
+ return isInactive(arg.status);
40
40
  }
41
- return isInactive(arg.status);
41
+ return arg === Status.INACTIVE;
42
42
  }
43
43
  _Newsroom.isInactive = isInactive;
44
44
  function isArchived(arg) {
45
- if (typeof arg === 'string') {
46
- return arg === Status.ARCHIVED;
45
+ if (typeof arg === 'object' && arg !== null) {
46
+ return isArchived(arg.status);
47
47
  }
48
- return isArchived(arg.status);
48
+ return arg === Status.ARCHIVED;
49
49
  }
50
50
  _Newsroom.isArchived = isArchived;
51
51
  })(Newsroom || (exports.Newsroom = Newsroom = {}));
@@ -21,24 +21,24 @@ export let Newsroom;
21
21
  })(TrackingPolicy || (TrackingPolicy = {}));
22
22
  _Newsroom.TrackingPolicy = TrackingPolicy;
23
23
  function isActive(arg) {
24
- if (typeof arg === 'string') {
25
- return arg === Status.ACTIVE;
24
+ if (typeof arg === 'object' && arg !== null) {
25
+ return isActive(arg.status);
26
26
  }
27
- return isActive(arg.status);
27
+ return arg === Status.ACTIVE;
28
28
  }
29
29
  _Newsroom.isActive = isActive;
30
30
  function isInactive(arg) {
31
- if (typeof arg === 'string') {
32
- return arg === Status.INACTIVE;
31
+ if (typeof arg === 'object' && arg !== null) {
32
+ return isInactive(arg.status);
33
33
  }
34
- return isInactive(arg.status);
34
+ return arg === Status.INACTIVE;
35
35
  }
36
36
  _Newsroom.isInactive = isInactive;
37
37
  function isArchived(arg) {
38
- if (typeof arg === 'string') {
39
- return arg === Status.ARCHIVED;
38
+ if (typeof arg === 'object' && arg !== null) {
39
+ return isArchived(arg.status);
40
40
  }
41
- return isArchived(arg.status);
41
+ return arg === Status.ARCHIVED;
42
42
  }
43
43
  _Newsroom.isArchived = isArchived;
44
44
  })(Newsroom || (Newsroom = {}));
@@ -58,49 +58,49 @@ exports.Story = Story;
58
58
  }
59
59
  _Story.isArchivedNewsroom = isArchivedNewsroom;
60
60
  function isUninitialized(arg) {
61
- if (typeof arg === 'object') {
61
+ if (typeof arg === 'object' && arg !== null) {
62
62
  return isUninitialized(arg.status);
63
63
  }
64
64
  return arg === Status.UNINITIALIZED;
65
65
  }
66
66
  _Story.isUninitialized = isUninitialized;
67
67
  function isDraft(arg) {
68
- if (typeof arg === 'object') {
68
+ if (typeof arg === 'object' && arg !== null) {
69
69
  return isDraft(arg.status);
70
70
  }
71
71
  return arg === Status.DRAFT;
72
72
  }
73
73
  _Story.isDraft = isDraft;
74
74
  function isScheduled(arg) {
75
- if (typeof arg === 'object') {
75
+ if (typeof arg === 'object' && arg !== null) {
76
76
  return isScheduled(arg.status);
77
77
  }
78
78
  return arg === Status.SCHEDULED;
79
79
  }
80
80
  _Story.isScheduled = isScheduled;
81
81
  function isScheduledEmbargo(arg) {
82
- if (typeof arg === 'object') {
82
+ if (typeof arg === 'object' && arg !== null) {
83
83
  return isScheduledEmbargo(arg.status);
84
84
  }
85
85
  return arg === Status.EMBARGO;
86
86
  }
87
87
  _Story.isScheduledEmbargo = isScheduledEmbargo;
88
88
  function isPublished(arg) {
89
- if (typeof arg === 'object') {
89
+ if (typeof arg === 'object' && arg !== null) {
90
90
  return isPublished(arg.status);
91
91
  }
92
92
  return arg === Status.PUBLISHED;
93
93
  }
94
94
  _Story.isPublished = isPublished;
95
95
  function isLegacyHtmlFormat(arg) {
96
- if (typeof arg === 'object') {
96
+ if (typeof arg === 'object' && arg !== null) {
97
97
  return isLegacyHtmlFormat(arg.format_version);
98
98
  }
99
99
  return arg === FormatVersion.HTML;
100
100
  }
101
101
  _Story.isLegacyHtmlFormat = isLegacyHtmlFormat;
102
102
  function isSlateFormat(arg) {
103
- if (typeof arg === 'object') {
103
+ if (typeof arg === 'object' && arg !== null) {
104
104
  return isSlateFormat(arg.format_version);
105
105
  }
106
106
  return arg === FormatVersion.SLATEJS;
@@ -4,6 +4,8 @@ import type { CultureRef } from './Culture';
4
4
  import { type NewsroomRef } from './Newsroom';
5
5
  import type { SEOSettings } from './SEOSettings';
6
6
  import type { UserRef } from './User';
7
+ declare type Html = string;
8
+ declare type Json = string;
7
9
  export interface StoryRef {
8
10
  uuid: string;
9
11
  /**
@@ -189,11 +191,11 @@ export declare namespace Story {
189
191
  * - HTML content for v1 stories (deprecated)
190
192
  * - JSON-encoded structured content for v3 stories (see Prezly Content Format).
191
193
  */
192
- content: string;
194
+ content: Html | Json;
193
195
  /**
194
196
  * Only supported on v3 stories with JSON-encoded structured content.
195
197
  */
196
- autosaved_content: string | null;
198
+ autosaved_content: Json | null;
197
199
  /**
198
200
  * Auto-incrementing version number updated on every update.
199
201
  * Used for detecting multiple users editing the same story simultaneously.
@@ -207,27 +209,27 @@ export declare namespace Story {
207
209
  * Contains attached gallery slate content.
208
210
  * Always `null` for v3 stories.
209
211
  */
210
- attached_gallery_content: string | null;
212
+ attached_gallery_content: Json | null;
211
213
  /**
212
214
  * Contains attached videos slate content.
213
215
  * Always `null` for v3 stories.
214
216
  */
215
- attached_videos_content: string | null;
217
+ attached_videos_content: Json | null;
216
218
  /**
217
219
  * Contains attached bookmarks slate content.
218
220
  * Always `null` for v3 stories.
219
221
  */
220
- attached_bookmarks_content: string | null;
222
+ attached_bookmarks_content: Json | null;
221
223
  /**
222
224
  * Contains attached files slate content.
223
225
  * Always `null` for v3 stories.
224
226
  */
225
- attached_attachments_content: string | null;
227
+ attached_attachments_content: Json | null;
226
228
  /**
227
229
  * Contains attached contacts slate content.
228
230
  * Always `null` for v3 stories.
229
231
  */
230
- attached_contacts_content: string | null;
232
+ attached_contacts_content: Json | null;
231
233
  referenced_entities: {
232
234
  stories: Record<string, OEmbedInfo>;
233
235
  };
@@ -264,3 +266,4 @@ export declare namespace Story {
264
266
  }
265
267
  export interface ExtendedStory extends Story, Pick<Story.ExtraFields, 'thumbnail_image' | 'header_image' | 'preview_image' | 'social_image' | 'social_text' | 'tag_names' | 'content' | 'attached_gallery_content' | 'referenced_entities'> {
266
268
  }
269
+ export {};
@@ -51,49 +51,49 @@ export let Story;
51
51
  }
52
52
  _Story.isArchivedNewsroom = isArchivedNewsroom;
53
53
  function isUninitialized(arg) {
54
- if (typeof arg === 'object') {
54
+ if (typeof arg === 'object' && arg !== null) {
55
55
  return isUninitialized(arg.status);
56
56
  }
57
57
  return arg === Status.UNINITIALIZED;
58
58
  }
59
59
  _Story.isUninitialized = isUninitialized;
60
60
  function isDraft(arg) {
61
- if (typeof arg === 'object') {
61
+ if (typeof arg === 'object' && arg !== null) {
62
62
  return isDraft(arg.status);
63
63
  }
64
64
  return arg === Status.DRAFT;
65
65
  }
66
66
  _Story.isDraft = isDraft;
67
67
  function isScheduled(arg) {
68
- if (typeof arg === 'object') {
68
+ if (typeof arg === 'object' && arg !== null) {
69
69
  return isScheduled(arg.status);
70
70
  }
71
71
  return arg === Status.SCHEDULED;
72
72
  }
73
73
  _Story.isScheduled = isScheduled;
74
74
  function isScheduledEmbargo(arg) {
75
- if (typeof arg === 'object') {
75
+ if (typeof arg === 'object' && arg !== null) {
76
76
  return isScheduledEmbargo(arg.status);
77
77
  }
78
78
  return arg === Status.EMBARGO;
79
79
  }
80
80
  _Story.isScheduledEmbargo = isScheduledEmbargo;
81
81
  function isPublished(arg) {
82
- if (typeof arg === 'object') {
82
+ if (typeof arg === 'object' && arg !== null) {
83
83
  return isPublished(arg.status);
84
84
  }
85
85
  return arg === Status.PUBLISHED;
86
86
  }
87
87
  _Story.isPublished = isPublished;
88
88
  function isLegacyHtmlFormat(arg) {
89
- if (typeof arg === 'object') {
89
+ if (typeof arg === 'object' && arg !== null) {
90
90
  return isLegacyHtmlFormat(arg.format_version);
91
91
  }
92
92
  return arg === FormatVersion.HTML;
93
93
  }
94
94
  _Story.isLegacyHtmlFormat = isLegacyHtmlFormat;
95
95
  function isSlateFormat(arg) {
96
- if (typeof arg === 'object') {
96
+ if (typeof arg === 'object' && arg !== null) {
97
97
  return isSlateFormat(arg.format_version);
98
98
  }
99
99
  return arg === FormatVersion.SLATEJS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",