import { StateTree as StateTree$1, PiniaPluginContext } from 'pinia'; import { Ref } from 'vue'; interface CookieOptions { decode?(value: string): T; encode?(value: T): string; domain?: string; expires?: Date; httpOnly?: boolean; maxAge?: number; sameSite?: boolean | 'lax' | 'strict' | 'none'; secure?: boolean; default?: () => T | Ref; } declare type UseCookie = (name: string, opts?: CookieOptions) => { value: T; }; declare type Storage = { getItem(key: string): Promise | string | null; setItem(key: string, value: string): Promise | void; }; declare type StorageLike = Pick; interface Serializer { /** * Serializes state into string before storing * @default JSON.stringify */ serialize: (value: StateTree$1) => string; /** * Deserializes string into state before hydrating * @default JSON.parse */ deserialize: (value: string) => StateTree$1; } interface PersistedStateOptions { /** * Storage key to use. * @default $store.id */ key?: string; /** * Where to store persisted state. * @default localStorage */ storage?: StorageLike; /** * Dot-notation paths to partially save state. * @default undefined */ paths?: Array; /** * Serializer to use */ serializer?: Serializer; /** * Hook called before state is hydrated from storage. * @default undefined */ beforeRestore?: (context: PiniaPluginContext) => void; /** * Hook called after state is hydrated from storage. * @default undefined */ afterRestore?: (context: PiniaPluginContext) => void; } declare type PersistedStateFactoryOptions = Pick; declare type PersistedStateNuxtFactoryOptions = Omit & { cookieOptions?: CookieOptions; }; declare function createPersistedState(factoryOptions?: PersistedStateFactoryOptions): (context: PiniaPluginContext) => void; declare function createNuxtPersistedState(useCookie: UseCookie, factoryOptions?: PersistedStateNuxtFactoryOptions): (context: PiniaPluginContext) => void; declare const persistedState: (context: PiniaPluginContext) => void; declare module 'pinia' { interface DefineStoreOptionsBase { /** * Persist store in storage. * @docs https://github.com/prazdevs/pinia-plugin-persistedstate. */ persist?: boolean | PersistedStateOptions; } } export { PersistedStateFactoryOptions, PersistedStateNuxtFactoryOptions, PersistedStateOptions, Serializer, StorageLike, createNuxtPersistedState, createPersistedState, persistedState as default };