Skip to content

Commit 1251b99

Browse files
authored
Merge pull request #3 from contentstack/feat/CS-44223-Release-preview
feat: ✨ release preview in stack config
2 parents 733f6ea + d9b5a68 commit 1251b99

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export interface SyncResult {
4646
total_count: number;
4747
}
4848

49+
interface ReleasePreview {
50+
release_id: string;
51+
preview_timestamp: string;
52+
}
53+
4954
// Contentstack Config
5055
export interface Config {
5156
api_key: string;
@@ -56,7 +61,8 @@ export interface Config {
5661
live_preview?: LivePreview;
5762
plugins?: ContentstackPlugin[];
5863
fetchOptions?: FetchOptions;
59-
early_access?: string[]
64+
early_access?: string[];
65+
release_preview?: ReleasePreview;
6066
}
6167
// Stack Config
6268
export interface StackConfig {

src/core/stack.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default class Stack {
6969
}
7070
};
7171
this.config = JSON.parse(JSON.stringify(config));
72-
this.plugins = []
72+
this.plugins = [];
7373

7474
if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true && stack_arguments[0].live_preview.management_token !== null) {
7575
if (stack_arguments[0].live_preview.management_token) {
@@ -118,6 +118,10 @@ export default class Stack {
118118
if (typeof stack_arguments[0].early_access == "object" && Array.isArray(stack_arguments[0].early_access) && stack_arguments[0].early_access.length > 0) {
119119
this.headers['x-header-ea'] = stack_arguments[0].early_access.join(',')
120120
}
121+
if (typeof stack_arguments[0].release_preview == "object" && stack_arguments[0].release_preview !== null && Object.keys(stack_arguments[0].release_preview).length > 0) {
122+
this.headers['release_id'] = stack_arguments[0].release_preview.release_id;
123+
this.headers['preview_timestamp'] = stack_arguments[0].release_preview.preview_timestamp;
124+
}
121125
this.environment = stack_arguments[0].environment;
122126
return this;
123127
} else {

0 commit comments

Comments
 (0)