Skip to content

Commit eec3979

Browse files
authored
feat(timeline): move Timeline Preview out of alpha (#2605)
1 parent 9afb8c7 commit eec3979

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ JavaScript library for the Contentful [Content Delivery API](https://www.content
7070
- [Authentication](#authentication)
7171
- [Documentation \& References](#documentation--references)
7272
- [Configuration](#configuration)
73-
- [Request configuration options](#request-configuration-options)
74-
- [Response configuration options](#response-configuration-options)
73+
- [Request configuration options](#request-configuration-options)
74+
- [Response configuration options](#response-configuration-options)
75+
- [Timeline Preview](#timeline-preview)
76+
- [Example](#example)
7577
- [Client chain modifiers](#client-chain-modifiers)
7678
- [Entries](#entries)
77-
- [Example](#example)
78-
- [Assets](#assets)
7979
- [Example](#example-1)
80-
- [Sync](#sync)
80+
- [Assets](#assets)
8181
- [Example](#example-2)
82+
- [Sync](#sync)
83+
- [Example](#example-3)
8284
- [Reference documentation](#reference-documentation)
8385
- [Tutorials \& other resources](#tutorials--other-resources)
8486
- [Troubleshooting](#troubleshooting)
@@ -292,11 +294,9 @@ const client = contentful.createClient({
292294
accessToken: 'preview_0b7f6x59a0',
293295
host: 'preview.contentful.com',
294296
// either release or timestamp or both can be passed as a valid config
295-
alphaFeatures: {
296-
timelinePreview: {
297-
release: { lte: 'black-friday' },
298-
timestamp: { lte: '2025-11-29T08:46:15Z' },
299-
},
297+
timelinePreview: {
298+
release: { lte: 'black-friday' },
299+
timestamp: { lte: '2025-11-29T08:46:15Z' },
300300
},
301301
})
302302
```

lib/contentful.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ export interface CreateClientParams {
121121
*/
122122
includeContentSourceMaps?: boolean
123123

124+
/**
125+
* Enable Timeline Preview.
126+
*
127+
* @remarks
128+
* This feature is only available when using the Content Preview API.
129+
*/
130+
timelinePreview?: TimelinePreview
131+
124132
/**
125133
* Enable alpha features.
126134
*/
@@ -132,8 +140,11 @@ export interface CreateClientParams {
132140

133141
/**
134142
* Enable Timeline Preview.
143+
*
135144
* @remarks
136-
* This feature is only available in private beta when using the Content Preview API.
145+
* This feature is only available when using the Content Preview API.
146+
*
147+
* @deprecated Use the `timelinePreview` option directly instead.
137148
*/
138149
timelinePreview?: TimelinePreview
139150
}

lib/utils/timeline-preview-helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export const isValidTimelinePreviewConfig = (timelinePreview: TimelinePreview) =
4242

4343
export const getTimelinePreviewParams = (params: CreateClientParams) => {
4444
const host = params?.host as string
45-
const timelinePreview = params?.alphaFeatures?.timelinePreview as TimelinePreview
45+
const timelinePreview =
46+
params?.timelinePreview ?? (params?.alphaFeatures?.timelinePreview as TimelinePreview)
4647
const enabled = checkEnableTimelinePreviewIsAllowed(host, timelinePreview)
4748
return { enabled, timelinePreview }
4849
}

test/integration/getEntry.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,8 @@ test('Gets entry with attached metadata and field called "metadata" on preview',
357357
test('can make calls to TimelinePreview API on preview', async () => {
358358
const timelinePreviewClient = contentful.createClient({
359359
...previewParamsWithCSM,
360-
alphaFeatures: {
361-
timelinePreview: { release: { lte: 'black-friday' } },
362-
},
360+
361+
timelinePreview: { release: { lte: 'black-friday' } },
363362
})
364363

365364
const entryWithMetadataFieldAndMetadata = '1NnAC4eF9IRMpHtFB1NleW'

test/unit/timeline-preview.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ describe('Timeline Preview path and query', () => {
99
get: mockGet,
1010
httpClientParams: {
1111
host: 'preview.contentful.com',
12-
alphaFeatures: {
13-
timelinePreview: {
14-
release: { lte: 'black-friday' },
15-
timestamp: { lte: '2023-11-30T23:59:59Z' },
16-
},
12+
13+
timelinePreview: {
14+
release: { lte: 'black-friday' },
15+
timestamp: { lte: '2023-11-30T23:59:59Z' },
1716
},
1817
},
1918
} as unknown as AxiosInstance

0 commit comments

Comments
 (0)