Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IUiAPI

Hierarchy

  • IUiAPI

Index

Methods

get

  • get(code: string): unknown
  • Returns a registered component The component may not be fully ready.

    Parameters

    • code: string

    Returns unknown

has

  • has(code: string): boolean
  • Returns whether a component exists for the specified code

    Parameters

    • code: string

    Returns boolean

hide

  • hide(componentCode: string): Promise<void>
  • Hide a UI component once it is ready. For bundled components, this requires them to have been configured in batchSDK.setup()

    Parameters

    • componentCode: string

    Returns Promise<void>

register

  • register(code: string, init: (api: IPublicAPI, config: unknown, onDrawnCallback: (component: unknown) => void) => unknown): void
  • Register a new component for the specified code.

    Parameters

    • code: string

      Unique code for your UI component.

    • init: (api: IPublicAPI, config: unknown, onDrawnCallback: (component: unknown) => void) => unknown

      Init method of your component: Batch will call you back on it.

        • (api: IPublicAPI, config: unknown, onDrawnCallback: (component: unknown) => void): unknown
        • Parameters

          • api: IPublicAPI
          • config: unknown
          • onDrawnCallback: (component: unknown) => void
              • (component: unknown): void
              • Parameters

                • component: unknown

                Returns void

          Returns unknown

    Returns void

registerAfter

  • registerAfter(dependencies: string[], code: string, init: (api: unknown, config: unknown, onDrawnCallback: (component: unknown) => void) => unknown): void
  • Register a new component for the specified code, after waiting for other components to have been registered

    Parameters

    • dependencies: string[]

      Components to wait for before calling this one's init method.

    • code: string

      Unique code for your UI component.

    • init: (api: unknown, config: unknown, onDrawnCallback: (component: unknown) => void) => unknown

      Init method of your component: Batch will call you back on it.

        • (api: unknown, config: unknown, onDrawnCallback: (component: unknown) => void): unknown
        • Parameters

          • api: unknown
          • config: unknown
          • onDrawnCallback: (component: unknown) => void
              • (component: unknown): void
              • Parameters

                • component: unknown

                Returns void

          Returns unknown

    Returns void

show

  • show(componentCode: string, force: boolean): Promise<void>
  • Show a UI component once it is ready. For bundled components, this requires them to have been configured in batchSDK.setup()

    Some components will refuse to show even when calling this method because it might not make sense. For example, the banner will not honor the request if it has been dismissed recently (unless configured otherwise) or if the user is already subscribed to notifications.

    You can try to set the force parameter to true, asking it to display itself no matter what.

    If you call this method, you probably want to set "autoShow": false in your UI component configuration

    Parameters

    • componentCode: string
    • force: boolean

    Returns Promise<void>

showPublicIdentifiers

  • showPublicIdentifiers(): void
  • Shows the current user's identifiers inside of the current page

    Returns void

waitUntilDrawn

  • waitUntilDrawn(componentCode: string): Promise<unknown>
  • Returns a promise that is resolved when the specified UI component has been drawn, returning the wrapped component.

    Parameters

    • componentCode: string

    Returns Promise<unknown>

Generated using TypeDoc