@prezly/sdk 12.4.2 → 12.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,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.4.2";
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.4.2";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -287,5 +287,17 @@ class Client {
287
287
  const url = `${_routing.routing.storiesUrl}/${id}`;
288
288
  await this.apiClient.delete(url);
289
289
  }
290
+ async preview(id, options) {
291
+ const url = `${_routing.routing.storiesUrl}/${id}/preview`;
292
+ const {
293
+ preview
294
+ } = await this.apiClient.get(url, {
295
+ query: {
296
+ alignment: options?.alignment,
297
+ appearance: options?.appearance
298
+ }
299
+ });
300
+ return preview;
301
+ }
290
302
  }
291
303
  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
  */
@@ -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 {};
@@ -281,4 +281,16 @@ export class Client {
281
281
  const url = `${routing.storiesUrl}/${id}`;
282
282
  await this.apiClient.delete(url);
283
283
  }
284
+ async preview(id, options) {
285
+ const url = `${routing.storiesUrl}/${id}/preview`;
286
+ const {
287
+ preview
288
+ } = await this.apiClient.get(url, {
289
+ query: {
290
+ alignment: options?.alignment,
291
+ appearance: options?.appearance
292
+ }
293
+ });
294
+ return preview;
295
+ }
284
296
  }
@@ -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 {
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "12.4.2",
3
+ "version": "12.5.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",