UNPKG

@widergy/web-utils

Version:
41 lines (40 loc) 1.18 kB
type SaveFunction = (key: string, value: string) => void; type DeleteFunction = (key: string) => void; type GetFunction = (key: string) => string; type SaveContextResponse = { ok: boolean; message: string; error?: unknown; }; type ContextData = { transactionDate: string; transactionName: string; transactionData: { [k: string]: unknown; }; }; type GetContextResponse = { ok: boolean; contextData?: ContextData; error?: unknown; }; declare class TransactionContextManager { private STORAGE_KEY; EXPIRED: string; NO_CONTEXT: string; private saveFunc; private deleteFunc; private getFunc; private expirationMinutes; initialize: (saveFunc: SaveFunction, deleteFunc: DeleteFunction, getFunc: GetFunction, expirationMinutes: number) => void; private save; private get; private delete; private isExpired; saveTransactionContext: (transactionName: string, transactionData: { [k: string]: unknown; }) => Promise<SaveContextResponse>; getTransactionContext: () => Promise<GetContextResponse>; } declare const _default: TransactionContextManager; export default _default;