Type Alias KlarnaIdentityButton

KlarnaIdentityButton: {
    attach(customButtonId: string): void;
    attach(customButtonElement: HTMLElement): void;
    detach(): void;
    mount(containerId: string): void;
    mount(container: HTMLElement): void;
    on(event: "ready", callback: () => Promise<void>): void;
    on(event: "click", callback: () => Promise<void>): void;
    unmount(): void;
}

Interface to the Identity Button interface.

Type declaration

  • attach:function
    • Programmatically attach the Identity Button behavior to a merchant's custom button element.

      Timings

      • When using attach method the ready event is triggered after the button event handlers were attached to the custom button and openid configuration was fetched.

      Parameters

      • customButtonId: string

      Returns void

    • Parameters

      • customButtonElement: HTMLElement

      Returns void

  • detach:function
    • Programmatically detaches the Identity Button behavior from merchant's custom button element

      Returns void

  • mount:function
    • Programmatically adds a button to the DOM tree, inside the given container element.

      Timings

      • When using mount method the ready event is triggered after the button was added to DOM and openid configuration was fetched.

      Parameters

      • containerId: string

      Returns void

    • Parameters

      • container: HTMLElement

      Returns void

  • on:function
    • The ready event can be used to load in data asynchronously, it is triggered when the button was mounted or attached and openid configuration was fetched successfully.

      Parameters

      • event: "ready"
      • callback: () => Promise<void>

      Returns void

    • Button click event handler, triggered when the consumer clicks on an Identity Button.

      Parameters

      • event: "click"
      • callback: () => Promise<void>

      Returns void

  • unmount:function
    • Programmatically removes the button from the DOM tree

      Returns void