@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
55 lines (53 loc) • 1.68 kB
TypeScript
import * as react4 from "react";
import "@tanstack/react-start";
//#region src/pwa.d.ts
/**
* The tags that make the app installable: its manifest, its home screen icon,
* and, while the app is installable, the name and launch screens iOS shows.
* Render it once, in `<head>` in the root route's `RootDocument`.
*
* @example
* function RootDocument({ children }: { children: React.ReactNode }) {
* return (
* <html lang="en">
* <head>
* <HeadContent />
* <SoftrPwaHead />
* </head>
* <body>
* {children}
* <Scripts />
* </body>
* </html>
* )
* }
*/
declare function SoftrPwaHead(): react4.FunctionComponentElement<react4.FragmentProps>;
type PwaPlatform = "ios" | "android" | "desktop";
type PwaInstall = {
available: false;
} | {
available: true;
/** Which steps install the app on this device. */
platform: PwaPlatform;
/** The name the home screen will show. */
name: string;
/** The icon the home screen will show. */
iconUrl: string;
};
/**
* Whether to offer installing the app, and on which platform. Render an
* install button only while this says `available`: it is unavailable while
* loading, when the builder has not turned the PWA on, when Softr has switched
* it off, and when the app already runs installed.
*
* @example
* function InstallButton() {
* const install = usePwaInstall()
* if (!install.available) return null
* return <button onClick={() => openSteps(install.platform)}>Install {install.name}</button>
* }
*/
declare function usePwaInstall(): PwaInstall;
//#endregion
export { PwaInstall, PwaPlatform, SoftrPwaHead, usePwaInstall };