blast-client
Version:
blast client
52 lines (42 loc) • 1.84 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode } from 'react';
import { SubscribeFunctionType, DialogProps } from './types.js';
declare function BlastProvider({ children }: {
children: ReactNode;
}): react_jsx_runtime.JSX.Element;
declare class Sw {
private swPath;
private publicKey;
private scope;
private hasClickHandler;
constructor(swPath: string, publicKey: string, scope: string);
private getOrCreateUserId;
private requestNotificationPermission;
private registerServiceWorker;
private getOrCreateSubscription;
private urlBase64ToUint8Array;
init(subscribeUser: SubscribeFunctionType, onMessage?: (type: "subscribed" | "denied" | "error") => void, time?: number, repeatCount?: number): Promise<void>;
clickNotification(setClick: (notificationId: string, subscribeId: string) => Promise<{
data: any;
ok: boolean;
}>): Promise<void>;
}
declare class PluginBuilder {
private sw;
constructor(sw: Sw);
clickNotification(setClick: (notificationId: string, subscribeId: string) => Promise<{
data: any;
ok: boolean;
}>): Promise<void>;
}
declare class BlastClient {
private sw;
plugins: PluginBuilder;
constructor(swPath: string, publicKey: string, scope: string);
run(subscribeUser: SubscribeFunctionType, onMessage?: (type: "subscribed" | "denied" | "error") => void, time?: number, repeatCount?: number): Promise<Error | "Auto inject complete">;
}
declare const useUserId: () => string;
declare function usePushNotificationListener(): void;
declare function Dialog({ dialogs, addGets }: DialogProps): react_jsx_runtime.JSX.Element;
declare function Alert(): react_jsx_runtime.JSX.Element;
export { Alert, BlastClient, BlastProvider, Dialog, usePushNotificationListener, useUserId };