Skip to content

Class: EcomApi

EcomApi.EcomApi

Frontend API for Connect for Commerce.

Export

Constructors

constructor

• new EcomApi(baseUrl)

Creates an instance of EcomApi.

Parameters

Name Type Description
baseUrl string URL of the backend service.

Properties

defaultLocale

• defaultLocale: string = 'en_GB'

Methods

createPage

▸ createPage(payload): Promise<any>

Creates a FirstSpirit page according to shop identifiers.

Parameters

Name Type Description
payload CreatePagePayload Payload to use when creating the page.

Returns

Promise<any>

Whether the page was created.


createSection

▸ createSection(payload): Promise<any>

Creates a section within a given FirstSpirit page.

Parameters

Name Type Description
payload CreateSectionPayload Payload to use when creating a section.

Returns

Promise<any>

Whether the section was created.


fetchNavigation

▸ fetchNavigation(params): Promise<FetchNavigationResponse>

Fetches the navigation service.

Parameters

Name Type Description
params FetchNavigationParams Parameters to use when fetching the navigation.

Returns

Promise<FetchNavigationResponse>

Details about the navigation.


findPage

▸ findPage(params): Promise<FindPageResponse>

Finds a CaaS page.

Parameters

Name Type Description
params FindPageParams Parameters to use to find the page.

Returns

Promise<FindPageResponse>

Details about the page.


init

▸ init(): Promise<boolean>

Initialize the API by loading TPP.

Returns

Promise<boolean>

Whether the initialization was successful.


setDefaultLocale

▸ setDefaultLocale(locale): void

Setting the default locale.

Parameters

Name Type Description
locale string FirstSpirit compatible Language code of the locale to set.

Returns

void