Skip to content

Commit

Permalink
Merge pull request #3 from contentstack/feat/CS-44223-Release-preview
Browse files Browse the repository at this point in the history
feat: ✨ release preview in stack config
  • Loading branch information
nadeem-cs authored Apr 23, 2024
2 parents 8dbda51 + f106610 commit baf1a81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export interface SyncResult {
total_count: number;
}

interface ReleasePreview {
release_id: string;
preview_timestamp: string;
}

// Contentstack Config
export interface Config {
api_key: string;
Expand All @@ -56,7 +61,8 @@ export interface Config {
live_preview?: LivePreview;
plugins?: ContentstackPlugin[];
fetchOptions?: FetchOptions;
early_access?: string[]
early_access?: string[];
release_preview?: ReleasePreview;
}
// Stack Config
export interface StackConfig {
Expand Down
6 changes: 5 additions & 1 deletion src/core/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class Stack {
}
};
this.config = JSON.parse(JSON.stringify(config));
this.plugins = []
this.plugins = [];

if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true && stack_arguments[0].live_preview.management_token !== null) {
if (stack_arguments[0].live_preview.management_token) {
Expand Down Expand Up @@ -118,6 +118,10 @@ export default class Stack {
if (typeof stack_arguments[0].early_access == "object" && Array.isArray(stack_arguments[0].early_access) && stack_arguments[0].early_access.length > 0) {
this.headers['x-header-ea'] = stack_arguments[0].early_access.join(',')
}
if (typeof stack_arguments[0].release_preview == "object" && stack_arguments[0].release_preview !== null && Object.keys(stack_arguments[0].release_preview).length > 0) {
this.headers['release_id'] = stack_arguments[0].release_preview.release_id;
this.headers['preview_timestamp'] = stack_arguments[0].release_preview.preview_timestamp;
}
this.environment = stack_arguments[0].environment;
return this;
} else {
Expand Down

0 comments on commit baf1a81

Please sign in to comment.