Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ChildApi

Hierarchy

  • ChildApi

Index

Properties

Optional beforeLogout

beforeLogout: function

Fired before nav-app initiates a logout broadcast, this event allows applications to clean up location-specific state (such as dirty forms) if necessary. The callback is responsible to resolve the Promise before nav-app can continue. When the application is good to “logout”, it resolves the Promise. In order to prevent the logout process, the application should reject the Promise.

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

Optional beforeNavigation

beforeNavigation: function

Fired before nav-app initiates a navigation action which will leave the current location, this event allows applications to clean up location-specific state (such as dirty forms) if necessary. The callback is responsible to resolve the Promise before nav-app can continue. When the application is good to “leave”, it resolves the Promise with "true". In order to prevent leaving the current location, the application should resolve the Promise with "false".

Type declaration

    • (): false | true | Promise<boolean>
    • Returns false | true | Promise<boolean>

Optional getConfig

getConfig: function

Get the current ChildConfig.

Type declaration

Optional getNavItems

getNavItems: function

Requests navigation items from the iframe application. Applications which register. If an application doesn’t have navigation items to register, it returns an empty array.

Type declaration

Optional getSelectedSite

getSelectedSite: function

Requests the currently selected site saved on the brSM side (as a cookie value).

Type declaration

Optional getSites

getSites: function

Requests an array of sites to be used in the nested site selection drop-down of the nav-app’s toolbar. The sites are expected to be provided (only) by the SM Navigation Provider app. Other apps that do not have sites to provide should return an empty array.

Type declaration

Optional logout

logout: function

Called to let the child app initiate their logout process.

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

Optional navigate

navigate: function

Is a command which tells the application to navigate to the specified location. If a user triggers a navigation (for example by clicking a button) but the url is absolutely the same it doesn’t lead to any transitions. It’s an application’s responsibility to make a decision on how to handle this navigational call.

param

the NavLocation to navigate to

param

The source of the navigate call so the client app is able to react appropriately on a specific source

Type declaration

Optional onUserActivity

onUserActivity: function

Called to notify the child app that the user is still active to prevent logging out the user in one app while the user is active in another app.

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

Optional updateSelectedSite

updateSelectedSite: function

Sets the accountId (merchantId) and siteId (siteGroupId) to work with. Site selection is intentionally separated from navigation since it represents an additional dimension in the navigation process to cover brSM needs. When a user selects a site, nav-app will call this callback for the active app first, which can update the site and the corresponding cookie and then resolves the promise, then the nav-app broadcast to all apps to update the site. Nav-app will only wait for the Promise of the currently active app to resolve before updating the UI to display the newly selected site. The selectSite should update the site state in the child UI based on whether the selectSite is passed a site object. If a site object is passed the child UI is updated to that site object and the cookie is updated to reflect the new site, if no site object is passed, the site is updated from the cookie. This way the active app will first update its UI and cookie, and the consequent broadcast will cause all other brSM apps to update their site state from the cookie that was just updated.

param

the selected SiteId

Type declaration

    • (siteId?: SiteId): void | Promise<void>
    • Parameters

      Returns void | Promise<void>