Skip to content

Commit 1710846

Browse files
committed
updates for live_preview plugin
1 parent bdb8e4c commit 1710846

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

index.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface Config {
5353
branch?: string;
5454
live_preview?: LivePreview;
5555
fetchOptions?: FetchOptions;
56+
plugins?: ContentstackPlugin[];
5657
}
5758
// Stack Config
5859
export interface StackConfig {
@@ -94,13 +95,19 @@ export interface FetchOptions {
9495
retryDelayOptions?: RetryDelayOption
9596
}
9697

98+
//Plugins
99+
export interface ContentstackPlugin {
100+
onRequest(stack: Stack, request:any): void;
101+
onResponse(stack: Stack, request: {url:string, headers: object}, response: any, data: any): any;
102+
}
103+
97104
// Stack
98105
export class Stack {
99106
constructor(config: Config);
100107
/**
101108
* @deprecated since version 3.15.0
102109
*/
103-
constructor(api_key: string, delivery_token: string, environment_name: string, region?: Region, fetchOptions?: FetchOptions, live_preview?: LivePreview, plugins?: Plugins[]);
110+
constructor(api_key: string, delivery_token: string, environment_name: string, region?: Region, fetchOptions?: FetchOptions, live_preview?: LivePreview);
104111

105112
environment: string;
106113
cachePolicy: CachePolicy;

src/core/lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ function generateReferenceMap (references) {
480480
};
481481

482482
async function updateLivePreviewReferenceEntry(referenceMap, entry, stack, options, handlerOptions) {
483-
const {livePreview, requestParams} = stack;
483+
const {live_preview:livePreview, requestParams} = stack;
484484
const { content_type_uid: livePreviewContentTypeUid, management_token } = livePreview;
485485

486486

0 commit comments

Comments
 (0)