Klarna Web SDK v1
    Preparing search index...

    Type Alias KlarnaIdentityButton

    Interface to the Identity Button interface.

    type 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;
    }
    Index

    Methods

    • 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

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

      Returns void

    • 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

    • 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

    • Programmatically removes the button from the DOM tree

      Returns void