Commerce helpers SDK reference
Shared helpers used by more than one storefront commerce feature.
Import these public values from @upstorr/theme-sdk/v1. Do not import their internal source files.
createThemeArticleInfoView
createThemeArticleInfoView(input: { author?: unknown; publishedAt?: unknown; showAuthor?: boolean; showDate?: boolean; }): { readonly author: string; readonly date: string; readonly details: string[]; readonly combinedLabel: string; }
createThemeArticleResourceView
createThemeArticleResourceView<TArticle extends { id?: string | null; handle?: string | null; slug?: string | null; articleHandle?: string | null; blogHandle?: string | null; imageUrl?: string | null; }>(article: TArticle | null | undefined): (TArticle & { url: string; image: string | null; }) | null
createThemeBlogPostContentView
createThemeBlogPostContentView(input: { configuredText?: unknown; article?: ThemeContentArticle | null; onboardingText?: unknown; showReadMore: boolean; shouldTruncate: boolean; readMoreLabel?: unknown; }): { readonly visible: boolean; readonly html: string; readonly href: string; readonly wordLimit: 30 | 90; readonly isPlaceholder: boolean; }
createThemeCartResourceView
createThemeCartResourceView(cart: ThemeCart | null | undefined): { item_count: number; 'empty?': boolean; id?: string; items: Array<{ id: string; lineId?: string; productId?: string | null; variantId?: string | null; quantity: number; lineTotal: number; product: { id: string; title?: string | null; name?: string | null; handle?: string | null; slug?: string | null; thumbnail?: string | null; images?: string[] | null; metadata?: Record<string, unknown> | null; options?: Array<{ name?: string | null; values?: string[] | null; }>; variants?: Array<Record<string, unknown>>; productVariants?: Array<Record<string, unknown>>; }; variant?: (Record<string, unknown> & { id?: string | null; name?: string | null; title?: string | null; featuredImage?: string | null; featured_image?: string | null; image?: string | null; thumbnail?: string | null; images?: string[] | null; option1?: string | null; option2?: string | null; option3?: string | null; options?: Record<string, string> | Array<{ name?: string; value?: string; }>; }) | null; metadata?: import("@upstorr/theme-sdk/v1").ThemeCartLineMetadata | null; booking?: import("@upstorr/theme-sdk/v1").ThemeCartBooking | null; [key: string]: unknown; }>; subtotal: number; securityDepositTotal: number; amountPayable: number; itemCount: number; currency: string; ui?: { checkout?: { canCheckout?: boolean; disabledReason?: { message?: string; } | null; }; lines?: Array<{ lineId?: string; quantity?: { minimum?: number; maximum?: number | null; step?: number; canIncrease?: boolean; canDecrease?: boolean; }; }>; }; } | null
createThemeCollectionImageView
createThemeCollectionImageView(collection: unknown): { readonly title: string; readonly image: string; readonly hideWhenMissing: boolean; }
createThemeCollectionLinkView
createThemeCollectionLinkView(collection: unknown, configuredLink?: unknown): { readonly href: string; readonly imageHref: string; readonly title: string; readonly isPlaceholder: boolean; }
createThemeCollectionResourceView
createThemeCollectionResourceView<TCollection extends { id?: string | null; handle?: string | null; products?: unknown[] | null; products_count?: number | null; all_products_count?: number | null; imageUrl?: string | null; }>(collection: TCollection | null | undefined): (TCollection & { url: string; products_count: number; all_products_count: number; featured_image: string | null; }) | null
createThemeFeaturedBlogArticleLocals
createThemeFeaturedBlogArticleLocals(article: ThemeContentArticle, options: { truncateDescription: boolean; }): { readonly display_title: string | null | undefined; readonly display_author: string | null | undefined; readonly display_date: string | null | undefined; readonly display_description: "Blog post description" | null; readonly truncate_description: boolean; }
createThemeFeaturedBlogPostCardView
createThemeFeaturedBlogPostCardView(article: ThemeContentArticle | null | undefined): { readonly isPlaceholder: boolean; readonly title: string; readonly href: string; }
createThemeFeaturedBlogPostImageView
createThemeFeaturedBlogPostImageView(input: { article?: ThemeContentArticle | null; configuredImage?: unknown; }): { readonly image: string; readonly alt: string; readonly isPlaceholder: boolean; readonly visible: boolean; }
createThemeFeaturedBlogPostsView
createThemeFeaturedBlogPostsView<TArticle extends ThemeContentArticle, TBlog extends { handle?: string | null; title?: string | null; articles?: Array<TArticle | null> | null; }>(input: { blog?: TBlog | null; maxItems?: unknown; }): { readonly blog: TBlog; readonly articles: TArticle[]; readonly maxItems: number; readonly usesPlaceholderArticles: boolean; }
createThemePolicyLinks
createThemePolicyLinks<TPage extends { path?: unknown; title?: unknown; }>(contentPages: TPage[] | null | undefined): { title: string; href: string; }[]
createThemeProductResourceView
createThemeProductResourceView<TProduct extends { id: string; handle?: string | null; slug?: string | null; title?: string | null; name?: string | null; thumbnail?: string | null; images?: string[] | null; }>(product: TProduct | null | undefined): (TProduct & { title: string; url: string; featured_image: string | null; }) | null
createThemeResourceImageView
createThemeResourceImageView(input: { blockType: string; articleImageCondition: boolean; article: unknown; collection: unknown; product: unknown; }): { readonly image: string; readonly alt: string; }
createThemeSocialLinksView
createThemeSocialLinksView(settings: Record<string, unknown>, options?: { includeUnprofiled?: boolean; renderMode?: unknown; }): { key: "facebook_url" | "instagram_url" | "youtube_url" | "tiktok_url" | "twitter_url" | "threads_url" | "linkedin_url" | "bluesky_url" | "snapchat_url" | "pinterest_url" | "tumblr_url" | "vimeo_url" | "custom_url"; url: string; platform: string; displayLabel: string; icon: string | null; hasProfile: boolean; visible: boolean; }[]
createThemeSocialLinkView
createThemeSocialLinkView(value: unknown, configuredPlatform?: string, options?: { includeUnprofiled?: boolean; renderMode?: unknown; label?: unknown; }): Omit<ThemeSocialLinkView, "key">
formatThemeArticleDate
formatThemeArticleDate(value: unknown): string
readThemeArticleRouteData
readThemeArticleRouteData<TArticle>(data: unknown): TArticle | null
readThemeBlogRouteData
readThemeBlogRouteData<TBlog>(data: unknown): TBlog | null
readThemeBookingDetailRouteData
readThemeBookingDetailRouteData<TOffer, TAvailabilityRule, TSlot>(data: unknown): { offer: TOffer | null; availabilityRules: TAvailabilityRule[]; slots: TSlot[]; }
readThemeBookingListRouteData
readThemeBookingListRouteData<TOffer>(data: unknown): { offers: TOffer[]; }
readThemeCollectionRouteData
readThemeCollectionRouteData<TCollection>(data: unknown): TCollection | null
readThemeCollectionsRouteData
readThemeCollectionsRouteData<TCollection>(data: unknown): { collections: TCollection[]; }
readThemeContentPageRouteData
readThemeContentPageRouteData<TPage>(data: unknown): TPage | null
readThemeProductReviewsRouteData
readThemeProductReviewsRouteData<TReviews>(data: unknown): TReviews | null
readThemeProductRouteData
readThemeProductRouteData<TProduct>(data: unknown): TProduct | null
readThemeProductsRouteData
readThemeProductsRouteData<TProduct>(data: unknown): TProduct[]
readThemeRecordMapRouteData
readThemeRecordMapRouteData<TMap extends Record<string, unknown>>(data: unknown, field: string): TMap
readThemeRecordRouteData
readThemeRecordRouteData<TValue>(data: unknown, field: string): TValue | null
readThemeResourceArray
readThemeResourceArray<TValue>(value: unknown): TValue[]
readThemeWishlistRouteData
readThemeWishlistRouteData<TWishlist>(data: unknown): TWishlist | null
resolveThemeContentPageResource
resolveThemeContentPageResource<TPage extends { id?: string | null; path?: string | null; }>(value: unknown, pages: TPage[], closestPage: TPage | null | undefined): TPage | null
resolveThemeContentPageTitle
resolveThemeContentPageTitle(title: unknown, path: string): string
resolveThemeLiquidText
resolveThemeLiquidText(value: unknown, resources: ThemeRuntimeResourceContext, translate?: (key: string, fallback: string) => string): unknown
resolveThemeRenderCondition
resolveThemeRenderCondition(condition: string, resources: ThemeRuntimeResourceContext): boolean
resolveThemeRuntimeValue
resolveThemeRuntimeValue(value: unknown, resources: ThemeRuntimeResourceContext): unknown
resolveThemeSectionResourceId
resolveThemeSectionResourceId(locals: Record<string, unknown> | undefined, fallback: string): string
sanitizeThemeRichTextHtml
sanitizeThemeRichTextHtml(value: unknown): string
submitThemeContactForm
submitThemeContactForm(input: ThemeContactFormInput): Promise<ThemeLeadFormResponse>
submitThemeEmailSignup
submitThemeEmailSignup(input: ThemeEmailSignupInput): Promise<ThemeLeadFormResponse>
ThemeAccountAction
type ThemeAccountAction = 'send-code' | 'verify-code' | 'resend-code' | 'logout';
ThemeAccountAddress
type ThemeAccountAddress = {
id?: string;
name?: string | null;
country?: string | null;
countryCode?: string | null;
firstName?: string | null;
lastName?: string | null;
addressLine1?: string | null;
addressLine2?: string | null;
city?: string | null;
state?: string | null;
postalCode?: string | null;
isDefault?: boolean;
[key: string]: unknown;
};
ThemeAccountAddressInput
type ThemeAccountAddressInput = {
countryCode: string;
firstName: string;
lastName?: string;
addressLine1: string;
addressLine2?: string;
city: string;
state: string;
postalCode: string;
isDefault?: boolean;
};
ThemeAccountAddressResponse
type ThemeAccountAddressResponse = {
success: boolean;
message?: string;
error?: string;
address?: ThemeAccountAddress | null;
addresses: ThemeAccountAddress[];
};
ThemeAccountAuthResponse
type ThemeAccountAuthResponse = {
success: boolean;
message?: string;
error?: string;
customer?: ThemeAccountCustomer | null;
user?: ThemeAccountCustomer | null;
addresses?: ThemeAccountAddress[];
};
ThemeAccountCustomer
type ThemeAccountCustomer = {
id?: string;
email?: string | null;
name?: string | null;
phone?: string | null;
addresses?: ThemeAccountAddress[];
[key: string]: unknown;
};
ThemeAccountFieldPurpose
type ThemeAccountFieldPurpose = 'email' | 'name' | 'otp';
ThemeAccountSendCodeInput
type ThemeAccountSendCodeInput = {
email: string;
name?: string;
};
ThemeAccountStep
type ThemeAccountStep = 'email' | 'code' | 'signed-in';
ThemeAccountVerifyCodeInput
type ThemeAccountVerifyCodeInput = ThemeAccountSendCodeInput & {
code: string;
};
ThemeBookingCancellationRequest
type ThemeBookingCancellationRequest = {
status?: 'REQUESTED' | 'RESOLVED' | 'DISMISSED' | string | null;
requestedAt?: string | null;
requestedByCustomerId?: string | null;
reason?: string | null;
resolvedAt?: string | null;
};
ThemeBookingHold
type ThemeBookingHold = {
id: string;
offerId: string;
offerHandle: string;
productId: string;
variantId: string;
inventoryLocationId: string | null;
startsAt: string;
endsAt: string;
timezone: string;
quantity: number;
expiresAt: string;
displayLabel: string;
};
ThemeBookingHoldApiResponse
type ThemeBookingHoldApiResponse = {
success: boolean;
hold: ThemeBookingHold;
error?: string;
};
ThemeBookingSecurityDeposit
type ThemeBookingSecurityDeposit = {
amount: number;
unitAmount: number;
calculation: 'PER_BOOKING' | 'PER_UNIT';
terms: string | null;
};
ThemeCancelBookingResponse
type ThemeCancelBookingResponse = {
success: boolean;
action?: 'CANCELLED' | 'REQUESTED';
booking?: ThemeOrderBooking | null;
error?: string;
};
ThemeCart
type ThemeCart = {
id?: string;
items: Array<{
id: string;
lineId?: string;
productId?: string | null;
variantId?: string | null;
quantity: number;
lineTotal: number;
product: {
id: string;
title?: string | null;
name?: string | null;
handle?: string | null;
slug?: string | null;
thumbnail?: string | null;
images?: string[] | null;
metadata?: Record<string, unknown> | null;
options?: Array<{ name?: string | null; values?: string[] | null }>;
variants?: Array<Record<string, unknown>>;
productVariants?: Array<Record<string, unknown>>;
};
variant?: (Record<string, unknown> & {
id?: string | null;
name?: string | null;
title?: string | null;
featuredImage?: string | null;
featured_image?: string | null;
image?: string | null;
thumbnail?: string | null;
images?: string[] | null;
option1?: string | null;
option2?: string | null;
option3?: string | null;
options?: Record<string, string> | Array<{ name?: string; value?: string }>;
}) | null;
metadata?: ThemeCartLineMetadata | null;
booking?: ThemeCartBooking | null;
[key: string]: unknown;
}>;
subtotal: number;
securityDepositTotal: number;
amountPayable: number;
itemCount: number;
currency: string;
ui?: {
checkout?: {
canCheckout?: boolean;
disabledReason?: { message?: string } | null;
};
lines?: Array<{
lineId?: string;
quantity?: {
minimum?: number;
maximum?: number | null;
step?: number;
canIncrease?: boolean;
canDecrease?: boolean;
};
}>;
};
[key: string]: unknown;
};
ThemeCartApiResponse
type ThemeCartApiResponse = {
success: boolean;
cart: ThemeCart;
message?: string;
error?: string;
};
ThemeCartBooking
type ThemeCartBooking = {
offerHandle: string;
maxSelectableQuantity: number;
holdId: string;
offerId: string;
variantId: string | null;
inventoryLocationId: string | null;
startsAt: string;
endsAt: string;
timezone: string | null;
displayLabel: string | null;
securityDeposit?: ThemeBookingSecurityDeposit | null;
};
ThemeCartLineMetadata
type ThemeCartLineMetadata = {
booking?: {
holdId: string;
offerId: string;
offerHandle?: string | null;
variantId?: string | null;
inventoryLocationId?: string | null;
startsAt: string;
endsAt: string;
timezone?: string | null;
displayLabel?: string | null;
} | null;
giftCardPurchase?: {
deliveryType?: 'SELF' | 'RECIPIENT';
recipientEmail?: string | null;
recipientName?: string | null;
recipientMessage?: string | null;
sendAt?: string | null;
} | null;
customProperties?: Record<string, string> | null;
};
ThemeCheckoutApiResponse
type ThemeCheckoutApiResponse = {
success: boolean;
checkout: ThemeCheckoutSnapshot;
error?: string;
};
ThemeCheckoutCheckboxView
type ThemeCheckoutCheckboxView = {
id: string;
label: string;
checked: boolean;
persist?: boolean;
patchForChecked: (checked: boolean) => ThemeCheckoutDraft;
};
ThemeCheckoutChoiceView
type ThemeCheckoutChoiceView = {
id: string;
label: string;
description?: string;
details?: string[];
detailRows?: Array<{
id: string;
label: string;
title: string;
subtitle?: string;
price: number;
formattedPrice: string;
items: Array<{
label: string;
image: string;
raw: unknown;
}>;
}>;
selected: boolean;
disabled?: boolean;
error?: string;
price?: number;
formattedPrice?: string;
patch?: ThemeCheckoutDraft;
persist?: boolean;
};
ThemeCheckoutDeliveryPresentationSection
type ThemeCheckoutDeliveryPresentationSection =
| {
id: string;
kind: 'notice';
visible: boolean;
title: string;
message: string;
}
| {
id: string;
kind: 'shipment-cards';
visible: boolean;
groups: Array<{ id: string; title: string; label: string; items: string[] }>;
}
| {
id: string;
kind: 'shipping-options';
visible: boolean;
title: string;
options: ThemeCheckoutChoiceView[];
}
| {
id: string;
kind: 'detailed-shipping-options';
visible: boolean;
title: string;
groups: ThemeCheckoutShipmentGroupView[];
expandLabel: string;
collapseLabel: string;
initiallyExpanded: boolean;
};
ThemeCheckoutDeliveryPresentationView
type ThemeCheckoutDeliveryPresentationView = {
sections: ThemeCheckoutDeliveryPresentationSection[];
};
ThemeCheckoutDraft
type ThemeCheckoutDraft = Record<string, unknown> & {
customerName?: string;
customerEmail?: string;
customerPhone?: string;
customerPhoneCountryCode?: string;
whatsappDocumentOptIn?: boolean;
billingSameAsShipping?: boolean;
shippingAddress?: string;
shippingAddress2?: string;
shippingCity?: string;
shippingState?: string;
shippingPostal?: string;
shippingCountry?: string;
shippingLatitude?: number;
shippingLongitude?: number;
shippingPlaceId?: string;
shippingLocationProvider?: string;
billingAddress?: string;
billingCity?: string;
billingState?: string;
billingPostal?: string;
billingCountry?: string;
deliveryMethodType?: string;
pickupLocationId?: string;
localDeliveryQuoteId?: string;
localDeliveryQuoteValidatedAt?: string;
shippingOptionId?: string;
shippingMethodLabel?: string;
paymentMethod?: string;
redemptionCode?: string;
couponCode?: string;
giftCardCode?: string;
customerNote?: string;
purchaseAsBusiness?: boolean;
buyerGstin?: string;
draftVersion?: number;
taxCollectionEnabled?: boolean;
};
ThemeCheckoutFieldView
type ThemeCheckoutFieldView = {
id: string;
label: string;
value: unknown;
type?: string;
autoComplete?: string;
required?: boolean;
persistOnCommit?: boolean;
patchForValue: (value: string) => ThemeCheckoutDraft;
};
ThemeCheckoutLineItemSnapshot
type ThemeCheckoutLineItemSnapshot = Record<string, unknown> & {
lineTotal: number;
displayLineTotal?: number;
booking?: (Record<string, unknown> & {
startsAt: string;
endsAt: string;
timezone?: string | null;
securityDeposit?: ThemeBookingSecurityDeposit | null;
}) | null;
};
ThemeCheckoutLineItemView
type ThemeCheckoutLineItemView = {
key: string;
title: string;
quantity: number;
quantityLabel: string;
properties: Array<{ name: string; value: string }>;
bookingSlot: {
dateLabel: string;
timeLabel: string;
} | null;
image: string;
lineTotal: number;
formattedLineTotal: string;
securityDeposit: (ThemeBookingSecurityDeposit & {
label: string;
amountLabel: string;
formattedAmount: string;
formattedUnitAmount: string;
expandable: boolean;
}) | null;
raw: unknown;
};
ThemeCheckoutLocalDeliveryOffer
type ThemeCheckoutLocalDeliveryOffer = {
deliveryInformation?: string | null;
price?: number;
dispatchTrigger?: 'IMMEDIATE' | 'WHEN_READY' | 'SCHEDULED';
quote?: ThemeCheckoutLocalDeliveryQuote | null;
};
ThemeCheckoutLocalDeliveryQuote
type ThemeCheckoutLocalDeliveryQuote = {
id: string;
customerCharge: number;
etaMinMinutes: number;
etaMaxMinutes: number;
expiresAt: string;
validatedAt?: string | null;
};
ThemeCheckoutRuntimeSnapshot
type ThemeCheckoutRuntimeSnapshot = ThemeCheckoutSnapshot & {
sessionId: string;
currency: string;
items: ThemeCheckoutLineItemSnapshot[];
channel?: string;
pricingContext?: string;
orderSubmission?: string;
taxCollectionEnabled?: boolean;
checkoutRules?: Record<string, unknown> | null;
checkoutMarketingConsent?: {
email?: { enabled?: boolean; label?: string };
phone?: {
whatsapp?: { enabled?: boolean; label?: string };
};
} | null;
orderDocumentDelivery?: {
whatsappAutoSendOnline?: boolean;
} | null;
uiState: {
sections?: Record<string, ThemeCheckoutSectionState | undefined>;
submission: {
canSubmit: boolean;
submitLabel: string;
blockers?: Array<{ code?: string; message?: string }>;
};
delivery?: {
error?: { code?: string; message?: string } | null;
warning?: { code?: string; message?: string } | null;
};
payment?: {
error?: { code?: string; message?: string } | null;
warning?: { code?: string; message?: string } | null;
};
};
meta?: Record<string, unknown> | null;
deliveryGroups?: unknown[];
deliverySelection?: ThemeCheckoutSnapshot['deliverySelection'] & {
selectedLocationId?: string | null;
localDelivery?: {
available?: boolean;
addressLookupEnabled?: boolean;
phoneRequired?: boolean;
offer?: ThemeCheckoutLocalDeliveryOffer | null;
unavailable?: { code?: string; message?: string } | null;
};
pickup?: {
available?: boolean;
selectedLocationId?: string | null;
options?: Array<{ locationId?: string; name?: string; address?: string; expectedTime?: string }>;
};
};
shippingQuote?: ThemeCheckoutSnapshot['shippingQuote'] & {
warning?: string | null;
shipmentOptionGroups?: unknown[];
destinationCountryType?: string | null;
unshippableItems?: unknown[];
};
paymentMethods?: Array<NonNullable<ThemeCheckoutSnapshot['paymentMethods']>[number] & {
visible?: boolean;
provider?: string | null;
processor?: string | null;
unavailableReason?: string | { message?: string } | null;
}>;
};
ThemeCheckoutSavedAddressView
type ThemeCheckoutSavedAddressView = {
id: 'selectedShippingAddressId' | 'selectedBillingAddressId';
visible: boolean;
label: string;
value: string;
manualValue: string;
manualLabel: string;
patchForValue: (value: string) => ThemeCheckoutDraft | null;
options: Array<{
id: string;
label: string;
patch: ThemeCheckoutDraft;
}>;
};
ThemeCheckoutSectionState
type ThemeCheckoutSectionState = {
visible?: boolean;
enabled?: boolean;
required?: boolean;
reason?: { code?: string; message?: string } | null;
};
ThemeCheckoutShipmentGroupView
type ThemeCheckoutShipmentGroupView = {
id: string;
title: string;
items: string[];
options: ThemeCheckoutChoiceView[];
};
ThemeCheckoutSnapshot
type ThemeCheckoutSnapshot = Record<string, unknown> & {
sessionId?: string;
currency?: string;
items?: ThemeCheckoutLineItemSnapshot[];
customer?: Record<string, unknown> | null;
totals?: {
subtotal?: number;
shipping?: number;
tax?: number;
discount?: number;
giftCard?: number;
total?: number;
securityDepositTotal?: number;
amountPayable?: number;
};
displayTotals?: {
subtotal?: number;
shipping?: number;
tax?: number;
discount?: number;
giftCard?: number;
total?: number;
rounding?: number;
};
paymentMethod?: string | null;
paymentMethods?: Array<{
code: string;
label?: string;
description?: string | null;
kind?: string;
gatewayMethod?: string;
available?: boolean;
unavailableReason?: { message?: string } | null;
requiresOnlinePayment?: boolean;
}>;
paymentSummary?: {
selectedCode?: string | null;
selectedGatewayMethod?: string | null;
selectedKind?: string | null;
requiresOnlineCapture?: boolean;
handlingFeeAmount?: number | null;
handlingFeeLabel?: string | null;
depositAmount?: number | null;
depositLabel?: string | null;
payableNow?: number;
amountDueOnDelivery?: number;
total?: number;
} | null;
shippingQuote?: {
options?: Array<{
id?: string;
optionId?: string;
label?: string;
methodLabel?: string;
amount?: number;
shipping?: number;
selections?: Array<{
pricingGroupId?: string;
rateId?: string;
rateName?: string;
transitTime?: string | null;
deliveryDetails?: string | null;
deliveryEstimate?: string | null;
charge?: number;
}>;
}>;
selectedOptionId?: string | null;
selectedMethodLabel?: string | null;
error?: string | null;
};
deliverySelection?: {
selectedMethodType?: string | null;
availableMethodTypes?: string[];
ship?: { visible?: boolean; selectable?: boolean };
pickup?: { options?: Array<{ locationId?: string; name?: string }> };
localDelivery?: {
offer?: ThemeCheckoutLocalDeliveryOffer | null;
unavailable?: { code?: string; message?: string } | null;
};
};
submitBlockers?: Array<{ code?: string; message?: string }>;
meta?: Record<string, unknown>;
};
ThemeCheckoutSubmitResponse
type ThemeCheckoutSubmitResponse = {
success: boolean;
submittedAs?: 'ORDER' | 'DRAFT';
order?: unknown;
draftOrder?: unknown;
cart: ThemeCart;
error?: string;
};
ThemeCheckoutView
type ThemeCheckoutView = {
items: ThemeCheckoutLineItemView[];
isEmpty: boolean;
panels: Record<string, boolean>;
contact: {
name: ThemeCheckoutFieldView;
phoneCountryCode: string;
phone: ThemeCheckoutFieldView;
email: ThemeCheckoutFieldView;
};
marketingConsent: {
visible: boolean;
options: ThemeCheckoutCheckboxView[];
};
businessPurchase: {
visible: boolean;
purchaseAsBusiness: ThemeCheckoutCheckboxView;
gstinVisible: boolean;
gstin: ThemeCheckoutFieldView;
validationMessage: string;
validationTone: 'neutral' | 'success' | 'error';
};
delivery: {
visible: boolean;
selectedMethod: string;
shippingVisible: boolean;
shippingOptionsVisible: boolean;
hasPhysicalDelivery: boolean;
hasGiftCardItems: boolean;
giftCardNotice: { title: string; lines: string[] } | null;
digitalOnlyState: { title: string; message: string } | null;
methodChoices: ThemeCheckoutChoiceView[];
unavailableMethodMessage: string;
showUnavailableMethodMessage: boolean;
pickupOptions: ThemeCheckoutChoiceView[];
selectedPickupOption: ThemeCheckoutChoiceView | null;
localDeliveryModeChoices: ThemeCheckoutChoiceView[];
localDeliveryAddress: {
visible: boolean;
manualFieldsVisible: boolean;
autocompleteEnabled: boolean;
requiresMapConfirmation: boolean;
confirmed: boolean;
searchLabel: string;
searchValue: string;
useCurrentLocationLabel: string;
confirmedAddress: string;
quoteSummary: string;
quoteExpiresAt: string | null;
};
localDeliveryPhoneNotice: string | null;
localDeliveryPhoneCountryCode: string | null;
localDeliveryPhoneField: ThemeCheckoutFieldView | null;
savedShippingAddress: ThemeCheckoutSavedAddressView;
shippingOptions: ThemeCheckoutChoiceView[];
shippingAddressFields: {
address: ThemeCheckoutFieldView;
apartment: ThemeCheckoutFieldView;
city: ThemeCheckoutFieldView;
state: ThemeCheckoutFieldView;
postal: ThemeCheckoutFieldView;
country: ThemeCheckoutFieldView;
};
saveShippingAsDefault: ThemeCheckoutCheckboxView;
shipmentGroups: ThemeCheckoutShipmentGroupView[];
shipmentNotice: { title: string; message: string };
deliveryGroups: Array<{ id: string; title: string; label: string; items: string[] }>;
deliveryGroupsNoticeTitle: string;
shippingSpeedTitle: string;
moreShippingOptionsLabel: string;
hideShippingOptionsLabel: string;
showDetailedShippingOptions: boolean;
shippingPresentation: ThemeCheckoutDeliveryPresentationView;
showFreeShippingMessage: boolean;
freeShippingMessage: string;
shippingError: string;
shippingWarning: string;
unavailableItemsTitle: string;
unavailableItems: Array<{ key: string; title: string; quantity: number; quantityLabel: string; lineItemId: string }>;
unavailableItemRemoveLabel: string;
};
billing: {
requiresStandaloneBilling: boolean;
billingSameAsShipping: boolean;
sameAsDelivery: ThemeCheckoutCheckboxView;
showSameAsDelivery: boolean;
showFields: boolean;
savedBillingAddress: ThemeCheckoutSavedAddressView;
fields: {
address: ThemeCheckoutFieldView;
city: ThemeCheckoutFieldView;
state: ThemeCheckoutFieldView;
postal: ThemeCheckoutFieldView;
country: ThemeCheckoutFieldView;
};
saveBillingAsDefault: ThemeCheckoutCheckboxView;
};
discount: {
visible: boolean;
code: ThemeCheckoutFieldView;
applyLabel: string;
message: string;
};
giftCard: {
visible: boolean;
code: ThemeCheckoutFieldView;
applyLabel: string;
appliedMessage: string;
error: string;
};
redemption: {
visible: boolean;
code: ThemeCheckoutFieldView;
applyLabel: string;
message: string;
tone: 'neutral' | 'success' | 'error';
};
orderNote: {
note: ThemeCheckoutFieldView;
};
payment: {
visible: boolean;
options: ThemeCheckoutChoiceView[];
emptyMessage: string;
codRestrictionMessage: string;
warning: string;
error: string;
};
status: {
messages: string[];
successMessage: string;
};
submission: {
canSubmit: boolean;
label: string;
loadingLabel: string;
};
totals: {
lines: Array<{ id: string; label: string; value: number; formattedValue: string }>;
totalLabel: string;
total: string;
payableNowLabel: string;
payableNow: string | null;
dueLaterLabel: string;
dueLater: string | null;
notices: string[];
};
};
ThemeContactFormInput
type ThemeContactFormInput = {
name?: string;
email: string;
phone?: string;
message: string;
source?: string;
};
ThemeContentArticle
type ThemeContentArticle = {
handle?: string | null;
blogHandle?: string | null;
title?: string | null;
excerpt?: string | null;
content?: string | null;
imageUrl?: string | null;
publishedAt?: string | null;
author?: string | null;
};
ThemeEmailSignupInput
type ThemeEmailSignupInput = {
email: string;
source?: string;
};
ThemeLeadFormResponse
type ThemeLeadFormResponse = {
success?: boolean;
message?: string;
error?: string;
customer?: {
id?: string;
email?: string;
emailOptIn?: boolean;
};
};
ThemeLocalDeliveryJourney
type ThemeLocalDeliveryJourney = {
id: string;
kind: 'FORWARD' | 'CUSTOMER_RETURN' | 'RENTAL_RETURN' | 'RTO';
status: string;
statusDisplayLabel: string;
statusTone: string;
scheduledFor?: string | null;
readyAt?: string | null;
bookedAt?: string | null;
pickedUpAt?: string | null;
deliveredAt?: string | null;
cancelledAt?: string | null;
rider?: { name?: string | null; phone?: string | null } | null;
trackingUrl?: string | null;
events?: Array<{
id: string;
status: string;
label: string;
message?: string | null;
occurredAt?: string | null;
}>;
};
ThemeMapAddressSuggestion
type ThemeMapAddressSuggestion = {
placeId: string;
label: string;
secondaryLabel?: string;
addressHint?: Pick<ThemeMapPlace, 'address' | 'city' | 'state' | 'postalCode' | 'country'>;
};
ThemeMapPlace
type ThemeMapPlace = {
placeId: string;
label: string;
address: string;
city: string;
state: string;
postalCode: string;
country: string;
latitude: number;
longitude: number;
provider: 'OLA_MAPS';
verificationToken: string;
};
ThemeOrderBooking
type ThemeOrderBooking = {
id: string;
offerId?: string | null;
offerHandle?: string | null;
offerTitle?: string | null;
orderId?: string | null;
orderItemId?: string | null;
startsAt?: string | null;
endsAt?: string | null;
timezone?: string | null;
quantity?: number | null;
status?: string | null;
statusDisplayLabel?: string | null;
statusTone?: string | null;
displayLabel?: string | null;
cancellationRequest?: ThemeBookingCancellationRequest | null;
cancellation?: {
available: boolean;
mode: 'REQUEST' | 'DIRECT' | null;
};
cancellationReason?: string | null;
cancelledAt?: string | null;
completedAt?: string | null;
};
ThemeOrderDetail
type ThemeOrderDetail = ThemeOrderListItem & {
customerPhone?: string | null;
shippingAddress?: string | null;
shippingCity?: string | null;
shippingState?: string | null;
shippingPostal?: string | null;
shippingCountry?: string | null;
company?: { id?: string; name?: string | null } | null;
companyLocation?: { id?: string; name?: string | null } | null;
items?: Array<{
id: string;
name?: string | null;
quantity?: number | null;
price?: number | null;
unitPrice?: number | null;
lineTotal?: number | null;
securityDepositAmount?: number | null;
securityDepositUnitAmount?: number | null;
securityDepositCalculation?: 'PER_BOOKING' | 'PER_UNIT' | null;
securityDepositTerms?: string | null;
securityDepositSummary?: ThemeSecurityDepositSummary | null;
shippingAmount?: number | null;
shippingTaxAmount?: number | null;
image?: string | null;
thumbnail?: string | null;
variant?: { image?: string | null; thumbnail?: string | null } | null;
product?: { image?: string | null; thumbnail?: string | null; images?: string[] | null; metadata?: Record<string, unknown> | null } | null;
bookings?: ThemeOrderBooking[];
fulfillmentKind?: 'PHYSICAL' | 'SERVICE' | 'DIGITAL' | null;
digitalDownloads?: Array<{
id: string;
filename?: string | null;
status?: string | null;
available?: boolean;
expiresAt?: string | null;
downloadLimit?: number | null;
downloadCount?: number | null;
remainingDownloads?: number | null;
downloadUrl?: string | null;
}>;
}>;
bookings?: ThemeOrderBooking[];
fulfillmentOrders?: Array<{
id: string;
type?: string | null;
status?: string | null;
assignedLocation?: { id?: string; name?: string | null } | null;
pickupScheduledAt?: string | null;
deliveredAt?: string | null;
lineItems?: Array<{
id?: string;
orderItemId?: string | null;
quantity?: number | null;
}>;
}>;
events?: Array<{
id?: string;
eventType?: string | null;
message?: string | null;
displayMessage?: string | null;
createdAt?: string | null;
}>;
returns?: Array<{
id: string;
status: string;
statusDisplayLabel?: string | null;
reason?: string | null;
createdAt?: string | null;
lineItems?: Array<{ orderItemId: string; quantity: number }>;
}>;
returnRequest?: {
available: boolean;
items: Array<{ id: string; name: string; remainingQuantity: number }>;
};
};
ThemeOrderDetailResponse
type ThemeOrderDetailResponse = {
success: boolean;
source: ThemeOrdersSource;
order: ThemeOrderDetail;
error?: string;
};
ThemeOrderListItem
type ThemeOrderListItem = {
id: string;
source: ThemeOrdersSource;
isDraftOrder?: boolean;
orderNumber?: string | number | null;
draftOrderStatus?: string | null;
fulfillmentStatus?: string | null;
fulfillmentStatusDisplayLabel?: string | null;
fulfillmentStatusTone?: string | null;
paymentStatus?: string | null;
total?: number | null;
securityDepositTotal?: number | null;
amountPayable?: number | null;
securityDepositSummary?: ThemeSecurityDepositSummary | null;
marketCurrency?: string | null;
paymentMethod?: string | null;
shippingMethod?: string | null;
deliveryMethodType?: string | null;
deliveryMethodLabel?: string | null;
fulfillmentMethodLabels?: string[];
trackingNumber?: string | null;
customerName?: string | null;
customerEmail?: string | null;
itemCount?: number | null;
createdAt?: string | null;
shipment?: ThemeOrderShipmentSummary | null;
shipments?: ThemeOrderShipmentSummary[];
shipmentCount?: number | null;
inventoryLocationNames?: string[];
localDelivery?: ThemeLocalDeliveryJourney | {
current?: ThemeLocalDeliveryJourney | null;
journeys?: ThemeLocalDeliveryJourney[];
} | null;
[key: string]: unknown;
};
ThemeOrderShipmentSummary
type ThemeOrderShipmentSummary = {
id: string;
fulfillmentOrderId?: string | null;
waybillNumber?: string | null;
status?: string | null;
statusDisplayLabel?: string | null;
statusTone?: string | null;
carrier?: string | null;
currentLocation?: string | null;
estimatedDelivery?: string | null;
deliveredAt?: string | null;
pickupScheduledAt?: string | null;
trackingEvents?: Array<{
status?: string | null;
location?: string | null;
timestamp?: string | null;
description?: string | null;
}>;
};
ThemeOrdersListResponse
type ThemeOrdersListResponse = ThemeOrdersPayload & {
success: boolean;
};
ThemeOrdersPagination
type ThemeOrdersPagination = {
page?: number | null;
limit?: number | null;
total?: number | null;
totalPages?: number | null;
};
ThemeOrdersPayload
type ThemeOrdersPayload = {
success?: boolean;
source?: ThemeOrdersSource;
orders?: ThemeOrderListItem[];
pagination?: ThemeOrdersPagination | null;
};
ThemeOrdersSource
type ThemeOrdersSource = 'ORDER' | 'DRAFT';
ThemePaymentAction
type ThemePaymentAction = {
type: 'browser-sdk';
provider: string;
intentId: string;
scriptUrl: string;
globalName: string;
successCallbackKey: string;
successFieldMap: Record<string, string>;
requiredSuccessFields: string[];
failureEventName?: string;
failureMessagePaths: string[];
cancelCallbackPath: string[];
theme?: Record<string, unknown>;
options: Record<string, unknown>;
};
ThemePaymentConfirmation
type ThemePaymentConfirmation = {
provider: string;
intentId: string;
fields: Record<string, string>;
};
ThemePaymentLabels
type ThemePaymentLabels = {
paymentDescription: string;
paymentLoading: string;
paymentLoadError: string;
paymentFailed: string;
paymentCancelled: string;
paymentTimedOut?: string;
};
ThemePaymentPrefill
type ThemePaymentPrefill = {
name?: string;
email?: string;
contact?: string;
};
ThemeRequestLocalReturnResponse
type ThemeRequestLocalReturnResponse = {
success: boolean;
returnId?: string;
journeyId?: string;
error?: string;
};
ThemeRuntimeResourceContext
type ThemeRuntimeResourceContext = {
product?: unknown;
collection?: unknown;
blog?: unknown;
article?: unknown;
page?: unknown;
search?: unknown;
cart?: unknown;
sectionSettings?: Record<string, unknown>;
locals?: Record<string, unknown>;
};
ThemeSecurityDepositSummary
type ThemeSecurityDepositSummary = {
currency: string;
status: 'NOT_REQUIRED' | 'PENDING_COLLECTION' | 'VOIDED' | 'COLLECTED' | 'REFUND_PENDING' | 'PARTIALLY_SETTLED' | 'SETTLED' | 'REFUND_FAILED' | 'MIXED';
originalAmount: number;
collectedAmount: number;
heldAmount: number;
appliedAmount: number;
refundedAmount: number;
pendingCollectionAmount: number;
pendingRefundAmount: number;
failedRefundAmount: number;
};
ThemeSocialLinkView
type ThemeSocialLinkView = {
key: string;
platform: string;
displayLabel: string;
icon: string | null;
url: string;
hasProfile: boolean;
visible: boolean;
};
ThemeWishlist
type ThemeWishlist<TProduct = unknown> = {
id?: string | null;
wishlistItems?: ThemeWishlistItem<TProduct>[];
items?: ThemeWishlistItem<TProduct>[];
itemCount?: number | null;
currency?: string | null;
[key: string]: unknown;
};
ThemeWishlistApiResponse
type ThemeWishlistApiResponse<TProduct = unknown> = {
success?: boolean;
wishlist?: ThemeWishlist<TProduct>;
message?: string;
error?: string;
};
ThemeWishlistItem
type ThemeWishlistItem<TProduct = unknown> = {
id: string;
productId: string;
product: TProduct;
};
useThemeContactForm
useThemeContactForm(source: string): { message: string; messageState: "" | "error" | "success"; isSubmitting: boolean; submit: (form: HTMLFormElement) => Promise<void>; }
useThemeEmailSignup
useThemeEmailSignup(source: string): { message: string; messageState: "" | "error" | "success"; isSubmitting: boolean; submit: (form: HTMLFormElement) => Promise<void>; }