UNPKG

@frank-auth/react

Version:

Flexible and customizable React UI components for Frank Authentication

163 lines 7.53 kB
import { XID } from '../types'; export interface ParsedURL { protocol: string; hostname: string; port?: string; pathname: string; search: string; hash: string; query: Record<string, string | string[]>; origin: string; href: string; } export declare const parseURL: (url: string) => ParsedURL | null; export declare const buildURL: (base: string, params?: Record<string, string | number | boolean | undefined | null>) => string; export declare const addQueryParams: (url: string, params: Record<string, string | number | boolean | undefined | null>) => string; export declare const parseQueryString: (queryString: string) => Record<string, string | string[]>; export declare const buildQueryString: (params: Record<string, any>) => string; export declare const removeQueryParams: (url: string, keys: string[]) => string; export declare const getQueryParam: (url: string, key: string) => string | null; export declare const hasQueryParam: (url: string, key: string) => boolean; export declare const buildAuthURL: (baseUrl: string, type: "signin" | "signup" | "reset" | "verify", params?: { organizationId?: XID; redirectUrl?: string; invitationToken?: string; emailAddress?: string; mode?: string; [key: string]: any; }) => string; export declare const buildOAuthURL: (provider: string, clientId: string, redirectUri: string, options?: { state?: string; scope?: string | string[]; responseType?: string; codeChallenge?: string; codeChallengeMethod?: string; organizationId?: XID; [key: string]: any; }) => string; export declare const parseOAuthCallback: (url: string) => { code?: string; state?: string; error?: string; errorDescription?: string; organizationId?: XID; }; export declare const buildMagicLinkURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; mode?: string; }) => string; export declare const buildVerificationURL: (baseUrl: string, token: string, type: "email" | "phone", options?: { redirectUrl?: string; organizationId?: XID; }) => string; export declare const buildPasswordResetURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; }) => string; export declare const buildInvitationURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; }) => string; export declare const isValidURL: (url: string) => boolean; export declare const isValidHttpURL: (url: string) => boolean; export declare const isValidHttpsURL: (url: string) => boolean; export declare const isDomainAllowed: (url: string, allowedDomains: string[]) => boolean; export declare const isSubdomain: (url: string, parentDomain: string) => boolean; export declare const extractDomain: (url: string) => string | null; export declare const extractRootDomain: (url: string) => string | null; export declare const normalizeURL: (url: string) => string; export declare const joinURL: (...parts: string[]) => string; export declare const getURLPath: (url: string) => string; export declare const getURLParams: (url: string) => Record<string, string | string[]>; export declare const isSafeRedirectURL: (url: string, allowedDomains: string[], allowRelative?: boolean) => boolean; export declare const sanitizeRedirectURL: (url: string, allowedDomains: string[], fallbackURL?: string) => string; export declare const getCurrentURL: () => string; export declare const getCurrentPath: () => string; export declare const getCurrentDomain: () => string; export declare const getCurrentOrigin: () => string; export declare const getCurrentParams: () => Record<string, string | string[]>; export declare const redirectTo: (url: string, replace?: boolean) => void; export declare const openInNewTab: (url: string) => void; export declare const getHash: () => string; export declare const setHash: (hash: string) => void; export declare const removeHash: () => void; export declare const encodeURIComponentSafe: (str: string) => string; export declare const decodeURIComponentSafe: (str: string) => string; export declare const URLUtils: { parseURL: (url: string) => ParsedURL | null; parseQueryString: (queryString: string) => Record<string, string | string[]>; parseOAuthCallback: (url: string) => { code?: string; state?: string; error?: string; errorDescription?: string; organizationId?: XID; }; buildURL: (base: string, params?: Record<string, string | number | boolean | undefined | null>) => string; buildQueryString: (params: Record<string, any>) => string; buildAuthURL: (baseUrl: string, type: "signin" | "signup" | "reset" | "verify", params?: { organizationId?: XID; redirectUrl?: string; invitationToken?: string; emailAddress?: string; mode?: string; [key: string]: any; }) => string; buildOAuthURL: (provider: string, clientId: string, redirectUri: string, options?: { state?: string; scope?: string | string[]; responseType?: string; codeChallenge?: string; codeChallengeMethod?: string; organizationId?: XID; [key: string]: any; }) => string; buildMagicLinkURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; mode?: string; }) => string; buildVerificationURL: (baseUrl: string, token: string, type: "email" | "phone", options?: { redirectUrl?: string; organizationId?: XID; }) => string; buildPasswordResetURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; }) => string; buildInvitationURL: (baseUrl: string, token: string, options?: { redirectUrl?: string; organizationId?: XID; }) => string; addQueryParams: (url: string, params: Record<string, string | number | boolean | undefined | null>) => string; removeQueryParams: (url: string, keys: string[]) => string; getQueryParam: (url: string, key: string) => string | null; hasQueryParam: (url: string, key: string) => boolean; joinURL: (...parts: string[]) => string; normalizeURL: (url: string) => string; isValidURL: (url: string) => boolean; isValidHttpURL: (url: string) => boolean; isValidHttpsURL: (url: string) => boolean; isDomainAllowed: (url: string, allowedDomains: string[]) => boolean; isSubdomain: (url: string, parentDomain: string) => boolean; isSafeRedirectURL: (url: string, allowedDomains: string[], allowRelative?: boolean) => boolean; extractDomain: (url: string) => string | null; extractRootDomain: (url: string) => string | null; getURLPath: (url: string) => string; getURLParams: (url: string) => Record<string, string | string[]>; getCurrentURL: () => string; getCurrentPath: () => string; getCurrentDomain: () => string; getCurrentOrigin: () => string; getCurrentParams: () => Record<string, string | string[]>; redirectTo: (url: string, replace?: boolean) => void; openInNewTab: (url: string) => void; getHash: () => string; setHash: (hash: string) => void; removeHash: () => void; encodeURIComponentSafe: (str: string) => string; decodeURIComponentSafe: (str: string) => string; sanitizeRedirectURL: (url: string, allowedDomains: string[], fallbackURL?: string) => string; }; //# sourceMappingURL=url.d.ts.map