@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
1,450 lines (1,275 loc) • 30.9 kB
TypeScript
/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */
// Auto-generated type definitions for MinisSDK
// Generated on: 2025-06-18T21:41:30.210Z
// Do not edit this file manually - run the generation script instead
// Source: useShopActionsImplementationV3.ts + shopActionsV3Definitions.ts + shopActionsV3Types.ts
// Generated using TypeScript compiler API for reliable AST parsing
//
// This file is self-contained and can be shipped independently
// ============================================================================
// Base Types (extracted using TypeScript AST parsing)
// ============================================================================
export interface ApiKeys {
refreshToken: string
accessToken: string
}
export interface ShopActionOk<T> {
ok: true
data: T
}
export interface ShopActionError {
ok: false
error: Error & {code?: string}
}
export type ShopActionResult<T = void> = ShopActionOk<T> | ShopActionError
export interface ShopActions {
getShopAppInformation: () => Promise<
ShopActionResult<GetShopAppInformationResponse>
>
productRecommendationImpression(
params: ProductRecommendationImpressionParams
): Promise<ShopActionResult>
productRecommendationClick(
params: ProductRecommendationClickParams
): Promise<ShopActionResult>
hideEntryPoint(): Promise<ShopActionResult>
closeMini(): Promise<ShopActionResult>
// account actions
followShop(params: FollowShopParams): Promise<ShopActionResult<boolean>>
unfollowShop(params: UnfollowShopParams): Promise<ShopActionResult<boolean>>
favorite(params: FavoriteParams): Promise<ShopActionResult>
unfavorite(params: UnfavoriteParams): Promise<ShopActionResult>
getAccountInformation: (
params: GetAccountInformationParams
) => Promise<ShopActionResult<GetAccountInformationResponse>>
// user actions
getCurrentUser(
params?: GetCurrentUserParams
): Promise<ShopActionResult<GetCurrentUserResponse>>
// product actions
createOrderAttribution(
params: CreateOrderAttributionParams
): Promise<ShopActionResult>
addToCart(params: AddToCartParams): Promise<ShopActionResult>
buyProduct(params: BuyProductParams): Promise<ShopActionResult>
buyProducts(params: BuyProductsParams): Promise<ShopActionResult>
// error actions
showErrorScreen: (params: ShowErrorScreenParams) => Promise<ShopActionResult>
showErrorToast: (message: ShowErrorToastParams) => Promise<ShopActionResult>
// deeplink actions
getDeeplinkPaths(): Promise<ShopActionResult<GetDeeplinkPathsResponse>>
navigateToDeeplink(
params: NavigateToDeeplinkParams
): Promise<ShopActionResult>
// navigation actions
navigateToShop(params: NavigateToShopParams): Promise<ShopActionResult>
navigateToProduct(params: NavigateToProductParams): Promise<ShopActionResult>
navigateToOrder(params: NavigateToOrderParams): Promise<ShopActionResult>
navigateToCheckout(
params: NavigateToCheckoutParams
): Promise<ShopActionResult>
// image upload actions
createImageUploadLink(
params: CreateImageUploadLinkParams
): Promise<ShopActionResult<CreateImageUploadLinkResponse>>
completeImageUpload(
params: CompleteImageUploadParams
): Promise<ShopActionResult<CompleteImageUploadResponse>>
// async storage actions
getPersistedItem(
params: GetAsyncStorageItemParams
): Promise<ShopActionResult<string | null>>
setPersistedItem(params: SetAsyncStorageItemParams): Promise<ShopActionResult>
removePersistedItem(
params: RemoveAsyncStorageItemParams
): Promise<ShopActionResult>
getAllPersistedKeys(): Promise<ShopActionResult<string[]>>
clearPersistedItems(): Promise<ShopActionResult>
getInternalPersistedItem(
params: GetAsyncStorageItemParams
): Promise<ShopActionResult<string | null>>
setInternalPersistedItem(
params: SetAsyncStorageItemParams
): Promise<ShopActionResult>
removeInternalPersistedItem(
params: RemoveAsyncStorageItemParams
): Promise<ShopActionResult>
getAllInternalPersistedKeys(): Promise<ShopActionResult<string[]>>
clearInternalPersistedItems(): Promise<ShopActionResult>
// secure storage actions
getSecret(): Promise<ShopActionResult<string | null>>
setSecret(params: SetSecretParams): Promise<ShopActionResult>
removeSecret(): Promise<ShopActionResult>
// event reporting actions
reportInteraction(params: ReportInteractionParams): Promise<ShopActionResult>
reportImpression(params: ReportImpressionParams): Promise<ShopActionResult>
reportContentImpression(
params: ReportContentImpressionParams
): Promise<ShopActionResult>
getProductLists(
params?: GetProductListsParams
): Promise<ShopActionResult<GetProductListsResponse>>
getProductList(
params?: GetProductListParams
): Promise<ShopActionResult<GetProductListResponse>>
// product list actions
addProductList(
params: AddProductListParams
): Promise<ShopActionResult<ProductList>>
removeProductList(params: RemoveProductListParams): Promise<ShopActionResult>
renameProductList: (
params: RenameProductListParams
) => Promise<ShopActionResult<ProductList>>
addProductListItem(
params: AddProductListItemParams
): Promise<ShopActionResult>
removeProductListItem(
params: RemoveProductListItemParams
): Promise<ShopActionResult>
// recommendations actions
getRecommendedProducts(
params?: GetRecommendedProductsParams
): Promise<ShopActionResult<GetRecommendedProductsResponse>>
getRecommendedShops(
params?: GetRecommendedShopsParams
): Promise<ShopActionResult<GetRecommendedShopsResponse>>
searchProductsByShop(
params?: SearchProductsByShopParams
): Promise<ShopActionResult<SearchProductsByShopResponse>>
// orders list actions
getOrders(
params?: GetOrdersParams
): Promise<ShopActionResult<GetOrdersResponse>>
getBuyerAttributes(): Promise<ShopActionResult<GetBuyerAttributesResponse>>
// content actions
showFeedbackSheet(params: ShowFeedbackSheetParams): Promise<ShopActionResult>
getPopularProducts(
params?: GetPopularProductsParams
): Promise<ShopActionResult<GetPopularProductsResponse>>
share(params: ShareParams): Promise<ShopActionResult>
getCuratedProducts(
params: GetCuratedProductsParams
): Promise<ShopActionResult<GetCuratedProductsResponse>>
getSavedProducts(
params?: GetSavedProductsParams
): Promise<ShopActionResult<GetSavedProductsResponse>>
getRecentProducts(
params?: GetRecentProductsParams
): Promise<ShopActionResult<GetRecentProductsResponse>>
getProductSearch(
params: GetProductSearchParams
): Promise<ShopActionResult<GetProductSearchResponse>>
getProducts(
params: GetProductsParams
): Promise<ShopActionResult<GetProductsResponse>>
getProduct(
params: GetProductParams
): Promise<ShopActionResult<GetProductResponse>>
getProductVariants(
params: GetProductVariantsParams
): Promise<ShopActionResult<GetProductVariantsResponse>>
getProductMedia(
params: GetProductMediaParams
): Promise<ShopActionResult<GetProductMediaResponse>>
getShop(params: GetShopParams): Promise<ShopActionResult<GetShopResponse>>
getRecentShops(
params?: GetRecentShopsParams
): Promise<ShopActionResult<GetRecentShopsResponse>>
getFollowedShops(
params?: GetFollowedShopsParams
): Promise<ShopActionResult<GetFollowedShopsResponse>>
}
export interface AuthShopActions {
refreshAccessToken(
params: RefreshAccessTokenParams
): Promise<ShopActionResult<ApiKeys>>
signOut(): Promise<ShopActionResult>
}
export type AllShopActions = ShopActions & AuthShopActions
export type ShopActionParams<T extends keyof AllShopActions> = Parameters<
AllShopActions[T]
>[0]
export interface FavoriteParams {
shopId: string
productId: string
productVariantId: string
}
export interface UnfavoriteParams {
shopId: string
productId: string
productVariantId: string
}
export interface LineItemAttribution {
sourceName: string
sourceIdentifier: string
}
export interface CreateOrderAttributionParams {
orderId: string
productVariantId: string
attribution?: LineItemAttribution
}
export interface AddToCartParams extends BuyProductLineItem {
/**
* The discount codes to apply to the cart.
*/
discountCodes?: string[]
/**
* Attribution data for the line item.
* @deprecated
*/
attribution?: LineItemAttribution
}
export interface BuyProductLineItem {
/**
* The GID of the product. E.g. `gid://shopify/Product/123`.
*/
productId: string
/**
* The GID of the product variant. E.g. `gid://shopify/ProductVariant/456`.
*/
productVariantId: string
/**
* The quantity of the product to add to the cart.
*/
quantity?: number
}
export interface BuyProductsParams {
items: [BuyProductLineItem, ...BuyProductLineItem[]] // at least one item
attribution?: LineItemAttribution
discountCode?: string
}
export interface BuyProductParams extends BuyProductLineItem {
/**
* Attribution data for the line item.
* @deprecated
*/
attribution?: LineItemAttribution
/**
* The discount code to apply to the product.
*/
discountCode?: string
}
export interface UpdateLineItemAttributesParams {
lineItemAttributes: {key: string; value: string}[]
attribution?: LineItemAttribution
}
export interface NavigateToShopParams {
shopId: string
}
export interface NavigateToOrderParams {
/**
* The GID of the order. E.g. `gid://shopify/Order/123`.
*/
orderId: string
}
export interface NavigateToCheckoutParams {
/**
* The GID of the shop. E.g. `gid://shopify/Shop/123`.
*/
shopId: string
}
export interface NavigateToProductParams {
/**
* The GID of the product. E.g. `gid://shopify/Product/123`.
*/
productId: string
/**
* If present, the GID of the variant that should be initially selected
*/
productVariantId?: string
/*
* Variants displayed in the product details screen will be limited to those
* whose ID is included in this list.
*/
includedProductVariantGIDs?: string[]
/**
* @deprecated use includedProductVariantGIDs instead
*/
includedProductVariantIds?: string[]
/**
* @deprecated do not use
*/
attribution?: LineItemAttribution
/**
* The discount code to apply to the product.
*/
discountCode?: string
}
export interface RefreshAccessTokenParams {
refreshToken: string
}
export interface ProductRecommendationImpressionParams {
// The product GID string
productId: string
// Optional section id, could be useful for tracking which UI sections get impressions
sectionId?: string
}
export interface ProductRecommendationClickParams {
productId: string
sectionId?: string
}
export interface ShowErrorScreenParams {
/**
* The message to display in the error screen.
*/
message?: string
/**
* The title of the error screen.
*/
title?: string
}
export interface ShowErrorToastParams {
message?: string
}
export interface GetAccountInformationParams {
/**
* To use user account information, a shopId must be given to track on
* which shop's behalf user information is being accessed
*/
shopId: string
type: 'email' | 'name' | 'phone'
}
export interface AccountInformationPhoneInfo {
phoneNumber: string
countryCode: string
prefix: string
}
export interface GetAccountInformationResponse {
status: 'available' | 'not-available'
value?: string | AccountInformationPhoneInfo
}
export interface GetShopAppInformationResponse {
appVersion: string
buildNumber: string
buildId: string
}
export interface FollowShopParams {
shopId: string
}
export interface UnfollowShopParams {
shopId: string
}
export interface NavigateToDeeplinkParams {
deeplink: string
}
export interface GetDeeplinkPathsResponse {
matchers: string[]
}
export interface ProductRecommendationClickParams {
productId: string
productVariantId?: string
variantGIDs?: string[]
discountCode?: string
attribution?: LineItemAttribution
sectionId?: string
}
export interface CreateImageUploadLinkParams {
input: {
mimeType: string
fileSize: number
}[]
}
export interface UploadTarget {
url: string
resourceUrl: string
parameters: {name: string; value: string}[]
}
export interface CreateImageUploadLinkResponse {
targets?: UploadTarget[]
error?: string
}
export interface CompleteImageUploadParams {
resourceUrls: string[]
}
export interface CompleteImageUploadResponse {
files?: {
id: string
fileStatus: 'FAILED' | 'PENDING' | 'PROCESSING' | 'READY'
image?: {
url: string
} | null
}[]
error?: string
}
export interface PaginationInfo {
hasNextPage: boolean
endCursor: string | null
}
export interface GetProductListsResponse {
data: ProductList[]
pageInfo: PaginationInfo
}
export interface GetProductListResponse {
data: ProductList | null
pageInfo: PaginationInfo
}
export interface GetRecommendedProductsResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetRecommendedShopsResponse {
data: Shop[]
pageInfo: PaginationInfo
}
export interface SearchProductsByShopResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetBuyerAttributesResponse {
data: {
genderAffinity?: Gender
categoryAffinities: TaxonomyCategory[]
}
}
export interface GetCurrentUserResponse {
data: UserProfile
}
export interface GetOrdersResponse {
data: Order[]
pageInfo: PaginationInfo
}
export interface SetSecretParams {
value: string
}
export interface SetAsyncStorageItemParams {
key: string
value: string
}
export interface GetAsyncStorageItemParams {
key: string
}
export interface RemoveAsyncStorageItemParams {
key: string
}
export interface ReportInteractionParams {
interactionType: string
interactionValue?: string
pageValue?: string
}
export interface ReportImpressionParams {
subjectType?: string
subjectId?: string
pageValue?: string
}
export interface ReportContentImpressionParams {
publicId: string
pageValue: string
}
export interface GetProductListsParams {
/**
* The number of lists to fetch.
*/
first?: number
/**
* The cursor to fetch the next page of lists.
*/
after?: string
/**
* The number of items per list to fetch.
*/
itemsFirst?: number
/**
* The fetch policy to use.
*/
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductListParams {
/**
* The GID of the product list. E.g. `gid://shopapp/ProductList/123`.
*/
id?: string
/**
* The public ID of the product list.
*/
publicId?: string
/**
* The number of items to fetch.
*/
first?: number
/**
* The cursor to fetch the next page of items.
*/
after?: string
/**
* The fetch policy to use.
*/
fetchPolicy?: DataHookFetchPolicy
}
export interface AddProductListParams {
/**
* The name of the product list.
*/
name: string
/**
* A description of the product list.
*/
description?: string
}
export interface RemoveProductListParams {
/**
* The GID of the product list. E.g. `gid://shopapp/ProductList/123`.
*/
id: string
}
export interface RenameProductListParams {
/**
* The GID of the product list. E.g. `gid://shopapp/ProductList/123`.
*/
id: string
/**
* The new name of the product list.
*/
name: string
}
export interface AddProductListItemParams {
/**
* The GID of the shop. E.g. `gid://shopify/Shop/42`.
*/
shopId: string
/**
* The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.
*/
productVariantId: string
/**
* The GID of the product. E.g. `gid://shopify/Product/123`.
*/
productId: string
/**
* The GID of the product list. E.g. `gid://shopapp/ProductList/123`.
* This will soon be deprecated in favor of just `publicListId`.
*/
listId: string
/**
* The public ID of the product list.
*/
publicListId: string
}
export interface RemoveProductListItemParams {
/**
* The GID of the shop. E.g. `gid://shopify/Shop/42`.
*/
shopId: string
/**
* The GID of the product variant. E.g. `gid://shopify/ProductVariant/101`.
*/
productVariantId: string
/**
* The GID of the product. E.g. `gid://shopify/Product/123`.
*/
productId: string
/**
* The GID of the product list. E.g. `gid://shopapp/ProductList/123`.
* This will soon be deprecated in favor of just `publicListId`.
*/
listId: string
/**
* The public ID of the product list.
*/
publicListId: string
}
export interface GetRecommendedProductsParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetRecommendedShopsParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface SearchProductsByShopParams {
shopId: string
query?: string
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetBuyerAttributesParams {
fetchPolicy?: DataHookFetchPolicy
}
export interface GetCurrentUserParams {
fetchPolicy?: DataHookFetchPolicy
}
export interface GetOrdersParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface ShowFeedbackSheetParams {
publicId: string
}
export interface GetPopularProductsParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetPopularProductsResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface PreviewProductInARParams {
id: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetCuratedProductsParams {
handle: string
requiredTags?: string[]
anyOfTags?: string[]
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetCuratedProductsResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetProductMediaParams {
id: string
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductMediaResponse {
data: ProductMedia[]
pageInfo: PaginationInfo
}
export interface GetShopParams {
id: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetShopResponse {
data: Shop
}
export interface GetRecentShopsParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetRecentShopsResponse {
data: Shop[]
pageInfo: PaginationInfo
}
export interface GetFollowedShopsParams {
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetFollowedShopsResponse {
data: Shop[]
pageInfo: PaginationInfo
}
export interface GetProductsParams {
ids: string[]
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductsResponse {
data: Product[]
}
export interface GetProductParams {
id: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductResponse {
data: Product
}
export interface ShareParams {
message?: string
title?: string
url?: string
urls?: string[]
type?: string
failOnCancel?: boolean
}
export interface GetSavedProductsParams {
includeSensitive?: boolean
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetSavedProductsResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetRecentProductsParams {
includeSensitive?: boolean
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetRecentProductsResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetProductSearchParams {
query: string
filters?: ProductFilters
sortBy?: ProductSearchSortBy
includeSensitive?: boolean
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductSearchResponse {
data: Product[]
pageInfo: PaginationInfo
}
export interface GetProductVariantsParams {
id: string
first?: number
after?: string
fetchPolicy?: DataHookFetchPolicy
}
export interface GetProductVariantsResponse {
data: ProductVariant[]
pageInfo: PaginationInfo
}
export interface MinisParams {
/** The handle/identifier of the Mini application */
handle: string
/** The initial URL that was used to load the Mini (optional) */
initialUrl?: string
}
export type FetchPolicy =
| 'cache-first'
| 'network-only'
| 'cache-only'
| 'no-cache'
| 'standby'
export type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network'
export enum CurrencyCode {
AED = 'AED',
AFN = 'AFN',
ALL = 'ALL',
AMD = 'AMD',
ANG = 'ANG',
AOA = 'AOA',
ARS = 'ARS',
AUD = 'AUD',
AWG = 'AWG',
AZN = 'AZN',
BAM = 'BAM',
BBD = 'BBD',
BDT = 'BDT',
BGN = 'BGN',
BHD = 'BHD',
BIF = 'BIF',
BMD = 'BMD',
BND = 'BND',
BOB = 'BOB',
BRL = 'BRL',
BSD = 'BSD',
BTN = 'BTN',
BWP = 'BWP',
BYN = 'BYN',
BYR = 'BYR',
BZD = 'BZD',
CAD = 'CAD',
CDF = 'CDF',
CHF = 'CHF',
CLP = 'CLP',
CNY = 'CNY',
COP = 'COP',
CRC = 'CRC',
CVE = 'CVE',
CZK = 'CZK',
DJF = 'DJF',
DKK = 'DKK',
DOP = 'DOP',
DZD = 'DZD',
EGP = 'EGP',
ERN = 'ERN',
ETB = 'ETB',
EUR = 'EUR',
FJD = 'FJD',
FKP = 'FKP',
GBP = 'GBP',
GEL = 'GEL',
GHS = 'GHS',
GIP = 'GIP',
GMD = 'GMD',
GNF = 'GNF',
GTQ = 'GTQ',
GYD = 'GYD',
HKD = 'HKD',
HNL = 'HNL',
HRK = 'HRK',
HTG = 'HTG',
HUF = 'HUF',
IDR = 'IDR',
ILS = 'ILS',
INR = 'INR',
IQD = 'IQD',
IRR = 'IRR',
ISK = 'ISK',
JEP = 'JEP',
JMD = 'JMD',
JOD = 'JOD',
JPY = 'JPY',
KES = 'KES',
KGS = 'KGS',
KHR = 'KHR',
KID = 'KID',
KMF = 'KMF',
KRW = 'KRW',
KWD = 'KWD',
KYD = 'KYD',
KZT = 'KZT',
LAK = 'LAK',
LBP = 'LBP',
LKR = 'LKR',
LRD = 'LRD',
LSL = 'LSL',
LTL = 'LTL',
LVL = 'LVL',
LYD = 'LYD',
MAD = 'MAD',
MDL = 'MDL',
MGA = 'MGA',
MKD = 'MKD',
MMK = 'MMK',
MNT = 'MNT',
MOP = 'MOP',
MRU = 'MRU',
MUR = 'MUR',
MVR = 'MVR',
MWK = 'MWK',
MXN = 'MXN',
MYR = 'MYR',
MZN = 'MZN',
NAD = 'NAD',
NGN = 'NGN',
NIO = 'NIO',
NOK = 'NOK',
NPR = 'NPR',
NZD = 'NZD',
OMR = 'OMR',
PAB = 'PAB',
PEN = 'PEN',
PGK = 'PGK',
PHP = 'PHP',
PKR = 'PKR',
PLN = 'PLN',
PYG = 'PYG',
QAR = 'QAR',
RON = 'RON',
RSD = 'RSD',
RUB = 'RUB',
RWF = 'RWF',
SAR = 'SAR',
SBD = 'SBD',
SCR = 'SCR',
SDG = 'SDG',
SEK = 'SEK',
SGD = 'SGD',
SHP = 'SHP',
SLL = 'SLL',
SOS = 'SOS',
SRD = 'SRD',
SSP = 'SSP',
STD = 'STD',
STN = 'STN',
SYP = 'SYP',
SZL = 'SZL',
THB = 'THB',
TJS = 'TJS',
TMT = 'TMT',
TND = 'TND',
TOP = 'TOP',
TRY = 'TRY',
TTD = 'TTD',
TWD = 'TWD',
TZS = 'TZS',
UAH = 'UAH',
UGX = 'UGX',
USD = 'USD',
UYU = 'UYU',
UZS = 'UZS',
VED = 'VED',
VEF = 'VEF',
VES = 'VES',
VND = 'VND',
VUV = 'VUV',
WST = 'WST',
XAF = 'XAF',
XCD = 'XCD',
XOF = 'XOF',
XPF = 'XPF',
XXX = 'XXX',
YER = 'YER',
ZAR = 'ZAR',
ZMW = 'ZMW',
}
export type Decimal = string
export type MiniAppParams = any
export interface MiniAppConfig<
_DeprecatedParams extends MiniAppParams = undefined,
> {
/**
* Root component of used inside the Minis Viewer
*/
ViewerRoot: () => JSX.Element | null
}
export interface MiniManifest {
trusted_domains?: string[]
permissions?: string[]
[key: string]: any
}
export type Permission = 'CAMERA' | 'GALLERY' | 'MICROPHONE'
export interface Money {
amount: Decimal
currencyCode: CurrencyCode
}
export interface ProductImage {
id?: string | null
altText?: string | null
url: string
sensitive?: boolean | null
}
export interface ProductVariant {
id: string
isFavorited: boolean
image?: ProductImage | null
price: Money
compareAtPrice?: Money | null
}
export interface ProductShop {
id: string
name: string
}
export type ProductMedia =
| {
id: string
image: ProductImage | null
mediaContentType: 'IMAGE'
alt: string | null
}
| {
id: string
mediaContentType: 'MODEL_3D'
previewImage: ProductImage | null
sources: {
filesize: number
format: string
mimeType: string
url: string
}[]
alt: string | null
}
| {
id: string
mediaContentType: 'VIDEO'
previewImage: ProductImage | null
sources: {
format: string
mimeType: string
url: string
width: number
height: number
}[]
alt: string | null
}
| {
id: string
mediaContentType: 'EXTERNAL_VIDEO'
previewImage: ProductImage | null
embedUrl: string
alt: string | null
}
export interface Product {
id: string
title: string
reviewAnalytics: {
averageRating?: number | null
reviewCount?: number | null
}
shop: ProductShop
selectedVariant?: ProductVariant
defaultVariantId: string
isFavorited: boolean
variants?: ProductVariant[]
featuredImage?: ProductImage | null
price: Money
compareAtPrice?: Money | null
}
export interface Shop {
id: string
name: string
isFollowing?: boolean | null
shareUrl?: string | null
primaryDomain: {
url: string
}
logoImage?: ProductImage | null
reviewAnalytics: {
averageRating?: number | null
reviewCount: number
}
}
export interface QueryOptions {
fetchPolicy?: WatchQueryFetchPolicy
skip?: boolean
}
export interface ProductList {
id: string
publicId: string | null
name: string | null
products: Product[]
}
export interface Order {
id: string
name: string
lineItems: {
productTitle: string
variantTitle: string | null
quantity: number
product: Product | null
}[]
shop: Shop | null
}
export interface BuyerAttributes {
genderAffinity?: Gender
categoryAffinities: TaxonomyCategory[]
}
export enum Gender {
Male = 'MALE',
Female = 'FEMALE',
Neutral = 'NEUTRAL',
}
export interface TaxonomyCategory {
id: string
name: string
ancestors?: TaxonomyCategory[]
}
/**
* A user profile.
*/
export interface UserProfile {
/**
* The display name of the user.
*/
displayName?: string | null
/**
* The avatar image of the user.
*/
avatarImage?: {
url: string
} | null
}
/**
* A user metafield.
*/
export interface UserMetafield {
/**
* The key of the user metafield.
*/
key: string
/**
* The value of the user metafield.
*/
value: string
}
export interface ContentImage {
id: string | null
url: string
width: number | null
height: number | null
}
export interface ContentProduct {
id: string
title: string
featuredImage: ContentImage | null
}
export type ContentVisibility = 'DISCOVERABLE' | 'LINKABLE'
export interface Content {
publicId: string
externalId: string | null
image: ContentImage
title: string
description: string | null
visibility: ContentVisibility[]
shareableUrl: string | null
products: ContentProduct[] | null
}
/**
* The fetch policy to use. `cache-first` will only fetch from the network if there is no
* cached data. `network-only` will fetch from the network regardless of whether there
* is cached data.
*/
export type DataHookFetchPolicy = 'cache-first' | 'network-only'
export interface DataHookOptionsBase {
/**
* When true, the data will not be fetched immediately.
*/
skip?: boolean
/**
* The fetch policy to use for the initial data load. Subsequent loads may use different policies.
*/
fetchPolicy?: DataHookFetchPolicy
}
export interface PaginatedDataHookOptionsBase extends DataHookOptionsBase {
/**
* The number of products to fetch.
* @default 20
*/
first?: number
}
export interface DataHookReturnsBase {
/**
* Whether data is loading. Represents the initial data load but not `refetch`/`fetchMore` calls.
*/
loading: boolean
/**
* The error that occurred while loading. Represents the initial data load and `refetch` calls but not `fetchMore`
*/
error: Error | null
/**
* Refetch the data. Data is updated in place. The `loading` state will not update but the `error` state will.
*/
refetch: () => Promise<void>
}
export interface PaginatedDataHookReturnsBase extends DataHookReturnsBase {
/**
* Whether there is a next page to fetch.
*/
hasNextPage: boolean
/**
* Fetch more data. Data is updated in place. The `loading` and `error` states will not update
*/
fetchMore: () => Promise<void>
}
export const Consent = {
MiniConsent: 'mini_consent',
CameraConsent: 'camera_consent',
PhotoLibraryConsent: 'photo_library_consent',
MicrophoneConsent: 'microphone_consent',
} as const
export const ConsentStatus = {
Granted: 'granted',
Dismissed: 'dismissed',
Idle: 'idle',
} as const
export type ConsentType = (typeof Consent)[keyof typeof Consent]
export type ConsentStatusType =
(typeof ConsentStatus)[keyof typeof ConsentStatus]
export interface PaginatedDataHookPageInfo {
/**
* Whether there is a next page to fetch.
*/
hasNextPage: boolean
/**
* The cursor to use for the next page of data.
*/
endCursor: string | null
}
export type ProductColorFilter =
| 'BEIGE'
| 'BLACK'
| 'BLUE'
| 'BROWN'
| 'GOLD'
| 'GREEN'
| 'GREY'
| 'NAVY'
| 'ORANGE'
| 'PINK'
| 'PURPLE'
| 'RED'
| 'SILVER'
| 'WHITE'
| 'YELLOW'
export type ProductApparelSizeFilter =
| 'SIZE_3XL'
| 'SIZE_4XL'
| 'SIZE_5XL'
| 'SIZE_L'
| 'SIZE_M'
| 'SIZE_S'
| 'SIZE_XL'
| 'SIZE_XS'
| 'SIZE_XXL'
| 'SIZE_XXS'
export interface ProductFilters {
/**
* The apparel sizes to filter by.
*/
apparelSize?: ProductApparelSizeFilter[]
/**
* Whether the product is in stock or not.
*/
available?: boolean
/**
* The category IDs to filter by.
*/
category?: string[]
/**
* The colors to filter by.
*/
color?: ProductColorFilter[]
/**
* The gender to filter by.
*/
gender?: 'MALE' | 'FEMALE' | 'NEUTRAL'
/**
* The shop IDs to include in the search.
*/
includeShopIds?: string[]
/**
* The minimum rating to filter by.
*/
minimumRating?: number
/**
* The price range to filter by.
*/
price?: {
min?: number
max?: number
}
/**
* The shoe sizes to filter by.
*/
shoeSize?: ProductShoeSizeFilter[]
}
export type ProductShoeSizeFilter =
| 'SIZE_4'
| 'SIZE_4_5'
| 'SIZE_5'
| 'SIZE_5_5'
| 'SIZE_6'
| 'SIZE_6_5'
| 'SIZE_7'
| 'SIZE_7_5'
| 'SIZE_8'
| 'SIZE_8_5'
| 'SIZE_9'
| 'SIZE_9_5'
| 'SIZE_10'
| 'SIZE_10_5'
| 'SIZE_11'
| 'SIZE_11_5'
| 'SIZE_12'
| 'SIZE_12_5'
| 'SIZE_13'
| 'SIZE_13_5'
| 'SIZE_14'
| 'SIZE_14_5'
| 'SIZE_15'
export type ProductSizeFilter =
| 'SIZE_XS'
| 'SIZE_S'
| 'SIZE_M'
| 'SIZE_L'
| 'SIZE_XL'
| 'SIZE_XXL'
| 'SIZE_XXS'
export type ProductSearchSortBy =
| 'MOST_RECENT'
| 'PRICE_HIGH_TO_LOW'
| 'PRICE_LOW_TO_HIGH'
| 'RELEVANCE'
declare global {
interface Window {
minisSDK: ShopActions
minisParams: MinisParams
}
}
export {}