import type { SdkConfigResponse } from '@stackfront/react-native-shopify';
SDK Config
interface SdkConfigResponse {
storefrontToken: string;
shopDomain: string;
homeLayout: SdkHomeLayout;
banners: SdkBanner[];
activePopups: SdkPopup[];
activeAnnouncements: SdkAnnouncement[];
featureFlags: SdkFeatureFlags;
oneSignalAppId: string;
integrations: Record<string, SdkIntegrationSource>;
billing: SdkBillingInfo;
}
Home Layout
interface SdkHomeLayoutSection {
id: string;
type: string;
enabled: boolean;
order: number;
config: Record<string, unknown> | null;
}
interface SdkHomeLayout {
sections: SdkHomeLayoutSection[];
}
UI Elements
interface SdkBanner {
id: string;
title: string | null;
subtitle: string | null;
imageUrl: string;
mobileImageUrl: string | null;
actionPayload: Record<string, unknown> | null;
order: number;
}
interface SdkPopup {
id: string;
type: string;
title: string;
body: string;
imageUrl: string | null;
ctaLabel: string | null;
ctaActionPayload: Record<string, unknown> | null;
dismissLabel: string;
discountCode: string | null;
triggerType: string;
triggerDelaySeconds: number;
showFrequency: string;
}
interface SdkAnnouncement {
id: string;
message: string;
backgroundColor: string | null;
textColor: string | null;
actionPayload: Record<string, unknown> | null;
order: number;
}
Feature Flags
interface SdkFeatureFlags {
storiesEnabled: boolean;
wishlistEnabled: boolean;
announcementsEnabled: boolean;
popupsEnabled: boolean;
abandonedCartEnabled: boolean;
liveVisitorCountEnabled: boolean;
recentPurchasePopupEnabled: boolean;
subscriptionsEnabled: boolean;
socialProofEnabled: boolean;
pushNotificationsEnabled: boolean;
integrationsEnabled: boolean;
recurringCampaignsEnabled: boolean;
csvExportEnabled: boolean;
analyticsEnabled: boolean;
}
Billing
interface SdkBillingInfo {
planName: string;
planRank: number;
subscriptionStatus: string;
isInTrial: boolean;
trialEndsAt?: string | null;
upgradeUrl?: string;
}
Push Notifications
interface RegisterDeviceRequest {
oneSignalPlayerId: string;
platform: 'iOS' | 'Android';
customerId?: string;
customerEmail?: string;
appVersion?: string;
deviceModel?: string;
osVersion?: string;
}
interface UnsubscribeDeviceRequest {
oneSignalPlayerId: string;
}
interface LinkCustomerRequest {
oneSignalPlayerId: string;
customerId: string;
}
interface NotificationPreference {
id: string;
merchantId: string;
customerId: string;
marketingEnabled: boolean;
transactionalEnabled: boolean;
abandonedCartEnabled: boolean;
orderUpdatesEnabled: boolean;
promotionsEnabled: boolean;
updatedAt: string;
}
interface UpdatePreferencesRequest {
marketingEnabled: boolean;
transactionalEnabled: boolean;
abandonedCartEnabled: boolean;
orderUpdatesEnabled: boolean;
promotionsEnabled: boolean;
}
Events
interface SdkEvent {
eventType: string;
customerId?: string;
oneSignalPlayerId?: string;
platform: 'iOS' | 'Android';
appVersion?: string;
sessionId?: string;
properties?: Record<string, unknown>;
occurredAt: string;
}
interface SdkEventsBatchRequest {
events: SdkEvent[];
}
interface SdkEventsBatchResponse {
acceptedCount: number;
}
Products
// Product types correspond to Shopify Storefront API Product type.
// See graphql/index.ts for the exact query shapes.
Stories
interface SdkStoryDto {
id: string;
type: string;
mediaUrl: string;
description: string | null;
productHandle: string | null;
durationSeconds: number;
order: number;
backgroundColor: string | null;
elements: StoryElement[];
actionPayload: Record<string, unknown> | null;
}
interface SdkStoryGroupDto {
id: string;
title: string;
coverImageUrl: string | null;
order: number;
stories: SdkStoryDto[];
}
interface SdkStoriesResponse {
storyGroups: SdkStoryGroupDto[];
}
interface StoryElement {
id: string;
type: string;
positionX: number;
positionY: number;
config: Record<string, unknown>;
actionPayload?: Record<string, unknown> | null;
}
interface StoryViewedRequest {
storyId: string;
storyGroupId: string;
watchedFullDuration: boolean;
customerId?: string;
oneSignalPlayerId?: string;
}
interface StoryTappedRequest {
storyId: string;
elementId: string;
actionTaken: boolean;
customerId?: string;
oneSignalPlayerId?: string;
}
interface StoryPollVoteRequest {
storyId: string;
elementId: string;
optionId: string;
customerId?: string;
oneSignalPlayerId?: string;
}
interface PollOptionResult {
optionId: string;
label: string;
voteCount: number;
percentage: number;
}
interface StoryPollVoteResponse {
elementId: string;
options: PollOptionResult[];
}
Social Proof
interface ProductViewEventRequest {
productId: string;
oneSignalPlayerId?: string;
}
interface SocialProofSignalsResponse {
liveViewerCount: number | null;
recentPurchase: RecentPurchaseSignal | null;
lowStockBadge: LowStockSignal | null;
}
interface RecentPurchaseSignal {
customerName: string;
customerLocation: string;
productTitle: string;
timeAgo: string;
}
interface LowStockSignal {
show: boolean;
label: string;
}
Integrations
interface IntegrationDataResponse {
integrationSlug: string;
dataType: string;
entityId: string;
data: string;
syncedAt: string;
}
interface SdkIntegrationSource {
source: string;
connected: boolean;
}
Reviews
interface ProductReviews {
source: string;
productId: string;
reviews: ProductReview[];
aggregates: ProductReviewAggregates;
}
interface ProductReview {
externalId: string;
rating: number;
title: string | null;
body: string | null;
authorName: string;
isVerifiedPurchase: boolean;
mediaUrls: string[];
createdAt: string;
}
interface ProductReviewAggregates {
averageRating: number;
totalCount: number;
distribution: Record<string, number>; // keys "1"–"5"
}
useProductReviews.
Orders
The Storefront API returns the order node as-is; the SDK derives status, tracking and a timeline with pure helpers fromorders/*
(see Orders).
type SdkOrderStatus =
| 'cancelled' | 'fulfilled' | 'in-progress' | 'partial' | 'unfulfilled'
| 'pending' | 'scheduled' | 'on-hold' | 'restocked';
interface SdkOrderNode {
id: string;
name?: string | null;
orderNumber?: number | null;
processedAt?: string | null;
financialStatus?: string | null;
fulfillmentStatus?: string | null;
canceledAt?: string | null;
statusUrl?: string | null;
totalPrice?: { amount: string; currencyCode: string } | null;
lineItems?: { edges?: { node: SdkOrderLineItem }[] };
successfulFulfillments?: {
trackingCompany?: string | null;
trackingInfo?: { number?: string | null; url?: string | null }[] | null;
}[] | null;
}
interface SdkTrackingInfo {
company: string;
numbers: string[];
urls: string[];
}
interface SdkTimelineEvent {
kind: 'ordered' | 'cancelled' | 'shipped';
at?: string | null;
detail?: string | null;
}
type SdkOrderSortBy = 'newest' | 'oldest' | 'highest-value' | 'lowest-value';
Addresses
interface CustomerAddress {
id: string; // base GID + rotating access-token suffix
firstName: string;
lastName: string;
company?: string;
address1: string;
address2?: string;
city: string;
province: string;
provinceCode?: string;
country: string;
countryCode: string;
zip: string;
phone?: string;
isDefault: boolean;
}
interface AddressInput {
firstName?: string;
lastName?: string;
company?: string;
address1?: string;
address2?: string;
city?: string;
province?: string;
country?: string;
zip?: string;
phone?: string;
}
interface ValidationResult {
isValid: boolean;
errors: Record<string, string>;
}
sameAddressId(a, b) (never ===). See
Addresses.
Menus
interface SdkMenu {
id: string;
title: string;
handle: string;
itemsCount: number;
items: SdkMenuItem[];
}
interface SdkMenuItem {
id: string;
title: string;
type: SdkMenuItemType;
url?: string | null;
resourceId?: string | null;
resource?: SdkMenuResource | null;
children: SdkMenuItem[];
}
interface NavigationNode {
id: string;
title: string;
/** App route path such as `/products/tee`, or the original URL. */
url: string;
route: string;
type: 'PRODUCT' | 'COLLECTION' | 'COLLECTIONS' | 'CATALOG' | 'FRONTPAGE'
| 'PAGE' | 'BLOG' | 'ARTICLE' | 'SEARCH' | 'SHOP_POLICY'
| 'METAOBJECT' | 'CUSTOMER_ACCOUNT_PAGE' | 'EXTERNAL' | 'LINK';
isExternal: boolean;
handle?: string;
children: NavigationNode[];
}
interface NavigationTree {
id: string;
title: string;
handle: string;
nodes: NavigationNode[];
}
Search
interface SearchFilters {
query: string;
availableForSale?: boolean;
productType?: string;
vendor?: string;
tag?: string;
priceMin?: number;
priceMax?: number;
sortKey?: string;
reverse?: boolean;
}
interface SuggestionSources {
titles?: string[];
vendors?: string[];
tags?: string[];
}
function buildSearchQuery(filters: SearchFilters): string;
function generateSuggestions(
history: string[],
sources: SuggestionSources,
limit?: number,
): string[];
Wishlist
interface WishlistItem {
id: string; // `productId` or `productId::variantId`
productId: string;
variantId?: string;
selectedOptions?: { name: string; value: string }[];
title?: string;
image?: { url: string; altText?: string };
createdAt: string;
updatedAt: string;
/** @deprecated mirror of `createdAt`. */
addedAt: string;
}
interface WishlistItemInput {
productId: string;
variantId?: string;
selectedOptions?: { name: string; value: string }[];
title?: string;
image?: { url: string; altText?: string } | string;
}
Checkout
interface CheckoutSession {
id: string; // the cart id
webUrl: string | null; // cart.checkoutUrl
createdAt: string | null;
updatedAt: string | null;
totalQuantity: number;
lineItems: CheckoutLineItem[];
totalPrice: { amount: string; currencyCode: string } | null;
/** Client-observed via markCompleted(); Storefront has no completedAt. */
completedAt: string | null;
}
type CheckoutStatus =
| 'idle' | 'creating' | 'ready' | 'completed'
| 'cancelled' | 'expired' | 'failed';
interface CheckoutLineItemInput {
merchandiseId: string;
quantity: number;
}
Customer Auth
interface CreateAccountInput {
email: string;
password: string;
firstName?: string;
lastName?: string;
phone?: string;
acceptsMarketing?: boolean;
}
interface UpdateCustomerInput {
firstName?: string;
lastName?: string;
email?: string;
phone?: string;
password?: string;
acceptsMarketing?: boolean;
}
interface CustomerUserErrorEntry {
field?: string[] | null;
message?: string | null;
code?: string | null;
}
type CustomerSessionInvalidReason = 'invalid' | 'expired';
// The session was already cleared when these are thrown.
class CustomerSessionError extends Error {
reason: CustomerSessionInvalidReason;
}
class CustomerCreateError extends Error {
userErrors: CustomerUserErrorEntry[];
}
class RegistrationError extends Error {
accountCreated: true; // account exists; only the session failed
}
useCustomer() exposes hasSession / isAuthenticated, isRestoring,
isRefreshing, login, logout, createAccount, register,
recoverPassword, updateCustomer and refetch. See
Authentication.
