Skip to content

Commit 9193e43

Browse files
feat: add home location [EXT-3684] (#1388)
Co-authored-by: Andi Pätzold <[email protected]> Co-authored-by: Martin Walker <[email protected]>
1 parent 0236338 commit 9193e43

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

lib/api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const LOCATION_TO_API_PRODUCERS: { [location: string]: ProducerFunc[] } = {
3939
[locations.LOCATION_ENTRY_EDITOR]: [makeSharedAPI, makeEntryAPI, makeEditorAPI],
4040
[locations.LOCATION_DIALOG]: [makeSharedAPI, makeDialogAPI, makeWindowAPI],
4141
[locations.LOCATION_PAGE]: [makeSharedAPI],
42+
[locations.LOCATION_HOME]: [makeSharedAPI],
4243
[locations.LOCATION_APP_CONFIG]: [makeSharedAPI, makeAppAPI],
4344
}
4445

lib/locations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const locations: Locations = {
88
LOCATION_ENTRY_EDITOR: 'entry-editor',
99
LOCATION_PAGE: 'page',
1010
LOCATION_APP_CONFIG: 'app-config',
11+
LOCATION_HOME: 'home',
1112
}
1213

1314
export default locations

lib/types/api.types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ export type PageExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
232232
ids: Omit<IdsAPI, EntryScopedIds>
233233
}
234234

235+
export type HomeExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
236+
ids: Omit<IdsAPI, EntryScopedIds>
237+
}
238+
235239
export type AppExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
236240
/** A set of IDs actual for the app */
237241
ids: Omit<IdsAPI, EntryScopedIds | 'extension' | 'app'> & { app: string }
@@ -245,6 +249,7 @@ export type KnownSDK =
245249
| EditorExtensionSDK
246250
| PageExtensionSDK
247251
| AppExtensionSDK
252+
| HomeExtensionSDK
248253

249254
export interface Locations {
250255
LOCATION_ENTRY_FIELD: 'entry-field'
@@ -253,6 +258,7 @@ export interface Locations {
253258
LOCATION_DIALOG: 'dialog'
254259
LOCATION_ENTRY_EDITOR: 'entry-editor'
255260
LOCATION_PAGE: 'page'
261+
LOCATION_HOME: 'home'
256262
LOCATION_APP_CONFIG: 'app-config'
257263
}
258264

lib/types/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type {
1010
EditorExtensionSDK,
1111
EditorLocaleSettings,
1212
FieldExtensionSDK,
13+
HomeExtensionSDK,
1314
IdsAPI,
1415
KnownSDK,
1516
LocalesAPI,

test/unit/api.spec.ts

+12
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ describe('createAPI()', () => {
110110
test(expected, locations.LOCATION_DIALOG)
111111
})
112112

113+
it('returns correct shape of the home API (home)', () => {
114+
const expected = []
115+
116+
test(expected, locations.LOCATION_HOME)
117+
})
118+
119+
it('returns correct shape of the page API (page)', () => {
120+
const expected = []
121+
122+
test(expected, locations.LOCATION_PAGE)
123+
})
124+
113125
it('returns correct shape of the app API (app)', () => {
114126
const expected = ['app']
115127

0 commit comments

Comments
 (0)