@teamhanko/hanko-frontend-sdk
Version:
A package for simplifying UI integration with the Hanko API. It is meant for use in browsers only.
89 lines (88 loc) • 2.81 kB
TypeScript
import { Claims } from "../Dto";
import { AnyState } from "../flow-api/types/flow";
/**
* The type of the `hanko-session-created` event.
* @typedef {string} sessionCreatedType
* @memberOf Listener
*/
export declare const sessionCreatedType: "hanko-session-created";
/**
* The type of the `hanko-session-expired` event.
* @typedef {string} sessionExpiredType
* @memberOf Listener
*/
export declare const sessionExpiredType: "hanko-session-expired";
/**
* The type of the `hanko-user-logged-out` event.
* @typedef {string} userLoggedOutType
* @memberOf Listener
*/
export declare const userLoggedOutType: "hanko-user-logged-out";
/**
* The type of the `hanko-user-deleted` event.
* @typedef {string} userDeletedType
* @memberOf Listener
*/
export declare const userDeletedType: "hanko-user-deleted";
/**
* The type of the `hanko-user-logged-in` event.
* @typedef {string} userLoggedInType
* @memberOf Listener
*/
export declare const userLoggedInType: "hanko-user-logged-in";
/**
* The type of the `hanko-user-created` event.
* @typedef {string} userCreatedType
* @memberOf Listener
*/
export declare const userCreatedType: "hanko-user-created";
/**
* The type of the `hanko-after-state-change` event.
* @typedef {string} flowAfterStateChangeType
* @memberOf Listener
*/
export declare const flowAfterStateChangeType: "hanko-after-state-change";
/**
* The type of the `hanko-before-state-change` event.
* @typedef {string} flowBeforeStateChangeType
* @memberOf Listener
*/
export declare const flowBeforeStateChangeType: "hanko-before-state-change";
/**
* The type of the `hanko-flow-error` event.
* @typedef {string} flowErrorType
* @memberOf Listener
*/
export declare const flowErrorType: "hanko-flow-error";
/**
* The data passed in the `hanko-session-created` or `hanko-session-resumed` event.
*
* @interface
* @category SDK
* @subcategory Events
* @property {number} expirationSeconds - This property is deprecated. The number of seconds until the JWT expires.
* @property {Claims} claims - The JSON web token associated with the session. Only present when the Hanko-API allows the JWT to be accessible client-side.
*/
export interface SessionDetail {
claims: Claims;
expirationSeconds: number;
}
export interface FlowErrorDetail {
error: Error;
}
export interface FlowDetail {
state: AnyState;
}
/**
* A custom event that includes a detail object.
*
* @category SDK
* @subcategory Events
* @extends CustomEvent
* @ignore
* @param {string} type - The type of the event.
* @param {T} detail - The detail object to include in the event.
*/
export declare class CustomEventWithDetail<T> extends CustomEvent<T> {
constructor(type: string, detail: T);
}