UNPKG

@fast-simon/storefront-kit

Version:

A comprehensive kit for developing storefronts with Fast Simon components, utilities, and React/Hydrogen support.

34 lines (33 loc) 1.4 kB
import type { HydrogenSession } from '@shopify/hydrogen'; import { type SessionStorage, type Session } from '@shopify/remix-oxygen'; export interface FastSimonSessionData { visitedProducts: string[]; sessionToken: string; userSession: string; customerAccount?: any; buyer?: any; } export interface FsSession extends HydrogenSession<FastSimonSessionData> { getVisitedProducts(): string[]; addVisitedProduct(productId: string): void; setSessionToken(token: string): void; setUserSession(session: string): void; getSessionToken(): string; getUserSession(): string; } export declare class FastSimonSession implements FsSession { #private; isPending: boolean; constructor(sessionStorage: SessionStorage, session: Session); static init(request: Request, secrets: string[]): Promise<FastSimonSession>; get<Key extends keyof FastSimonSessionData | string>(key: Key): (Key extends string | number ? any : undefined) | (Key extends string | number ? any : undefined) | undefined; set(key: keyof FastSimonSessionData, value: any): void; unset(key: keyof FastSimonSessionData): void; commit(): Promise<string>; getVisitedProducts(): string[]; addVisitedProduct(productId: string): void; setSessionToken(token: string): void; setUserSession(session: string): void; getSessionToken(): any; getUserSession(): any; }