UNPKG

@open-condo/miniapp-utils

Version:

A set of helper functions / components / hooks used to build new condo apps fast

38 lines (36 loc) 1.36 kB
type SenderInfo = { dv: number; fingerprint: string; }; /** Name of the cookie in which the fingerprint will be stored */ declare const FINGERPRINT_ID_COOKIE_NAME = "fingerprint"; /** Default fingerprint length */ declare const FINGERPRINT_ID_LENGTH = 32; declare function generateFingerprint(): string; /** * Creates a device fingerprint in the browser environment * that can be used to send mutations in open-condo applications, * uses cookies for storage between sessions. * Mostly used to generate the sender field in getClientSideSenderInfo. * So consider using it instead */ declare function getClientSideFingerprint(): string; /** * Creates a device fingerprint in the browser environment * that can be used to send mutations in open-condo applications. * Uses cookies for storage between sessions * @example * submitReadingsMutation({ * variables: { * data: { * ...values, * dv: 1, * sender: getClientSideSenderInfo(), * meter: { connect: { id: meter.id } }, * source: { connect: { id: METER_READING_MOBILE_APP_SOURCE_ID } }, * }, * }, * }) */ declare function getClientSideSenderInfo(): SenderInfo; export { FINGERPRINT_ID_COOKIE_NAME, FINGERPRINT_ID_LENGTH, generateFingerprint, getClientSideFingerprint, getClientSideSenderInfo };