UNPKG

@techsio/storefront-data

Version:

Medusa-first storefront data layer built on TanStack Query.

32 lines • 1.76 kB
import type { QueryResult, ReadResultBase, SuspenseQueryResult, SuspenseResultBase } from "../shared/hook-result-types"; import type { ReadQueryOptions } from "../shared/hook-types"; import type { QueryKey } from "../shared/query-keys"; export type AuthQueryKeys = { all: () => QueryKey; customer: () => QueryKey; session: () => QueryKey; }; export type AuthService<TCustomer, TLoginInput, TRegisterInput, TUpdateInput, TCreateCustomerInput = unknown, TLoginResult = unknown, TRegisterResult = unknown, TRequestAccountDeactivationResult = unknown, TConfirmAccountDeactivationInput = unknown, TConfirmAccountDeactivationResult = unknown> = { confirmAccountDeactivation?: (input: TConfirmAccountDeactivationInput) => Promise<TConfirmAccountDeactivationResult>; getCustomer: (signal?: AbortSignal) => Promise<TCustomer | null>; login: (input: TLoginInput) => Promise<TLoginResult>; logout: () => Promise<void>; register: (input: TRegisterInput) => Promise<TRegisterResult>; requestAccountDeactivation?: () => Promise<TRequestAccountDeactivationResult>; createCustomer?: (input: TCreateCustomerInput) => Promise<TCustomer>; updateCustomer?: (input: TUpdateInput) => Promise<TCustomer>; refresh?: () => Promise<unknown>; }; export type AuthQueryInput<TCustomer = unknown> = { enabled?: boolean; queryOptions?: ReadQueryOptions<TCustomer | null>; }; export type UseAuthResult<TCustomer> = ReadResultBase<QueryResult<TCustomer | null>> & { customer: TCustomer | null; isAuthenticated: boolean; }; export type UseSuspenseAuthResult<TCustomer> = SuspenseResultBase<SuspenseQueryResult<TCustomer | null>> & { customer: TCustomer | null; isAuthenticated: boolean; }; //# sourceMappingURL=types.d.ts.map