UNPKG

@daml/hub-react

Version:

Daml React functions for Daml Hub

55 lines (54 loc) 1.76 kB
import React from 'react'; import { PartyToken } from '../party-token/PartyToken'; interface LoginMethod<RenderFn> { text?: React.ReactChild; render?: RenderFn; } interface LoginOptions { method: { button?: LoginMethod<() => React.ReactElement>; token?: LoginMethod<(onSubmit: () => void) => React.ReactElement>; file?: LoginMethod<() => React.ReactElement>; }; } export declare const damlHubLogout: () => void; type DamlHubLoginProps = { options?: LoginOptions; withButton?: boolean; withToken?: boolean; withFile: boolean; partiesJson?: string; onLogin?: (credentials?: PartyToken, err?: string) => void; onPartiesLoad: (parties?: PartyToken[], err?: string) => void; } | { options: { method: { button?: LoginMethod<() => React.ReactElement>; token?: LoginMethod<(onSubmit: () => void) => React.ReactElement>; file: LoginMethod<() => React.ReactElement>; }; }; withButton?: boolean; withToken?: boolean; withFile?: boolean; partiesJson?: string; onLogin?: (credentials?: PartyToken, err?: string) => void; onPartiesLoad: (parties?: PartyToken[], err?: string) => void; } | { options?: LoginOptions; withButton?: boolean; withToken?: boolean; withFile?: boolean; partiesJson?: string; onLogin: (credentials?: PartyToken, err?: string) => void; onPartiesLoad?: (parties?: PartyToken[], err?: string) => void; }; /** * * DamlHubLogin component. Provides three different * login method props: `withButton`, `withToken`, or `withParties`. * * Provides a callback with credentials after a login. */ export declare const DamlHubLogin: React.FC<DamlHubLoginProps>; export {};