@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
26 lines (25 loc) • 1.23 kB
TypeScript
import { Dict, Environment } from "../utils/types.js";
import "../utils/index.js";
import { Dispatch, SetStateAction } from "react";
//#region src/core/links.d.ts
type LinksDict = Dict<string>;
type LinksContextType = [LinksDict, Dispatch<SetStateAction<LinksDict>>];
/**
* Adds loggedIn=1 parameter to the URL if 'isLoggedIn' flag is true, which means the user is logged in.
* If 'isLoggedIn' is falsy, loggedin param will be removed.
* This is supposed to aid login flow when navigating between Veracity applications.
*/
declare function getLoggedInLink(link: string, isLoggedIn?: boolean): string;
declare function LinksProvider(props: {
children: React.ReactNode;
}): import("react").JSX.Element;
/** Returns links and setLinks from LinksContext. */
declare function useLinks(): LinksContextType;
/**
* Retrieves the links from CDN for the given environment and appends them with loggedin=1 parameter
* if user is logged in. Links will be reloaded when 'env' changes or updated when 'isLoggedIn' changes.
*/
declare function useLoadLinks(env?: Environment, isLoggedIn?: boolean): void;
//#endregion
export { LinksDict, LinksProvider, getLoggedInLink, useLinks, useLoadLinks };
//# sourceMappingURL=links.d.ts.map