@slashid/react
Version:
React SDK for the /id platform
27 lines • 1.29 kB
TypeScript
import { BaseUser, GDPRConsent, GDPRConsentLevel } from "@slashid/slashid";
export declare const STORAGE_GDPR_CONSENT_KEY = "@slashid/GDPR_CONSENT";
interface GDPRConsentStorage {
getConsentLevels: () => Promise<GDPRConsent[]>;
setConsentLevels: (consentLevels: GDPRConsentLevel[]) => Promise<GDPRConsent[]>;
deleteConsentLevels: () => Promise<void>;
}
export declare const createLocalGDPRConsentStorage: () => GDPRConsentStorage;
export declare const createApiGDPRConsentStorage: (user: BaseUser) => GDPRConsentStorage;
type UseGDPRConsent = () => {
consents: GDPRConsent[];
isLoading: boolean;
updateGdprConsent: (consentLevels: GDPRConsentLevel[]) => Promise<GDPRConsent[]>;
deleteGdprConsent: () => Promise<void>;
};
/**
* A stateful hook providing access to the current user's GDPR consent levels.
* Use this hook to list the accepted levels and accept and reject additional levels.
*
* If there is no authenticated user, the consent levels will be stored in local storage.
* Otherwise, the consent levels will be stored using the SlashID API.
*
* @returns {UseGDPRConsent} an object with the current consent levels and methods to update it
*/
export declare const useGDPRConsent: UseGDPRConsent;
export {};
//# sourceMappingURL=use-gdpr-consent.d.ts.map