Services Reference
All services are accessible viauseStackfront() and can be used imperatively outside React components.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
useStackfront() and can be used imperatively outside React components.
class ApiClient {
get<T>(path: string): Promise<T>;
post<T>(path: string, body?: unknown): Promise<T>;
put<T>(path: string, body?: unknown): Promise<T>;
delete<T>(path: string): Promise<T>;
setCustomerId(id: string | undefined): void;
getConfig(): Promise<SdkConfigResponse>;
}
class StorefrontClient {
init(shopDomain: string, storefrontToken: string, apiVersion?: string): void;
get isReady(): boolean;
request<TData>(query: string, options?: { variables?: Record<string, unknown> }): Promise<TData>;
}
class StorageService {
getItem(key: string): Promise<string | null>;
setItem(key: string, value: string): Promise<void>;
removeItem(key: string): Promise<void>;
getObject<T>(key: string): Promise<T | null>;
setObject(key: string, value: unknown): Promise<void>;
}
class EventService {
init(): Promise<void>;
destroy(): void;
track(eventType: string, properties?: Record<string, unknown>): void;
flush(): Promise<void>;
}
class DeviceService {
init(oneSignalAppId: string): Promise<void>;
registerDevice(): Promise<void>;
linkCustomer(customerId: string): Promise<void>;
unsubscribe(): Promise<void>;
getPreferences(customerId: string): Promise<NotificationPreference>;
updatePreferences(customerId: string, request: UpdatePreferencesRequest): Promise<NotificationPreference>;
getPlayerId(): string | null;
requestPermission(): Promise<boolean>;
}
class ConfigService {
fetchConfig(): Promise<SdkConfigResponse>;
}
class ProductService {
getProducts(first?: number, after?: string): Promise<unknown>;
getProduct(handle: string): Promise<unknown>;
getProductById(id: string): Promise<unknown>;
getCollections(first?: number, after?: string): Promise<unknown>;
getCollection(handle: string): Promise<unknown>;
searchProducts(query: string, first?: number): Promise<unknown>;
}
class CartService {
create(lines: CartLineInput[]): Promise<unknown>;
get(): Promise<unknown | null>;
addLines(lines: CartLineInput[]): Promise<unknown>;
updateLines(lines: { id: string; quantity: number }[]): Promise<unknown>;
removeLines(lineIds: string[]): Promise<unknown>;
updateBuyerIdentity(identity: CartBuyerIdentityInput): Promise<unknown>;
getCheckoutUrl(): Promise<string | null>;
clear(): Promise<void>;
}
class CustomerService {
setAccessToken(token: string | null): void;
getAccessToken(): string | null;
create(input: CustomerCreateInput): Promise<unknown>;
login(input: CustomerAccessTokenCreateInput): Promise<CustomerAccessToken>;
logout(): Promise<void>;
getCustomer(): Promise<unknown>;
getOrders(): Promise<unknown[]>;
recoverPassword(email: string): Promise<unknown>;
}
class LoyaltyService {
getAccount(customerId: string, customerEmail?: string): Promise<LoyaltyAccountSdkResponse>;
getTransactions(customerId: string, page?: number, pageSize?: number): Promise<LoyaltyTransactionResponse[]>;
redeem(request: RedeemPointsRequest): Promise<RedeemPointsResponse>;
getReferral(customerId: string): Promise<ReferralSdkResponse>;
trackReferral(request: TrackReferralRequest): Promise<void>;
}
class ReviewService {
getProductReviews(productId: string, page?: number, pageSize?: number): Promise<ProductReviewsSdkResponse>;
submitReview(request: CreateProductReviewRequest): Promise<ProductReview>;
markHelpful(reviewId: string, request: ReviewHelpfulRequest): Promise<void>;
}
class StoryService {
getStories(): Promise<SdkStoriesResponse>;
recordView(request: StoryViewedRequest): Promise<void>;
recordTap(request: StoryTappedRequest): Promise<void>;
recordPollVote(request: StoryPollVoteRequest): Promise<StoryPollVoteResponse>;
}
class SocialProofService {
trackProductView(request: ProductViewEventRequest): Promise<void>;
getSignals(productId: string): Promise<SocialProofSignalsResponse>;
}
class IntegrationService {
getData(slug: string, dataType: string, entityId?: string): Promise<IntegrationDataResponse>;
}
class WishlistService {
init(): Promise<void>;
add(productId: string): Promise<void>;
remove(productId: string): Promise<void>;
toggle(productId: string): Promise<void>;
isInWishlist(productId: string): boolean;
getItems(): WishlistItem[];
}
// BillingService is instantiated in StackfrontProvider via:
// const billing = useMemo(() => new BillingService(api), [api]);
// See BillingService.ts for full method signatures.