Interface utilisateur et interactions
Les API que Shopify range dans interface utilisateur et interactions, et les types qu'elles seules utilisent. Sur cette page : IntentsApi, LoadingApi, ModalApi, PickerApi, ResourcePickerApi, ReviewsApi, SaveBarApi, SidekickApi, SupportApi, ToastApi, Tools.
IntentsApi
register(callback: (intent: Intent) => void): () => void
Non décrit dans les types.
Utilisé dans : useAppBridge(), ShopifyGlobal
Intent
readonly action: string
Non décrit dans les types.
readonly type: string
Non décrit dans les types.
readonly data: { [key: string]: any; }
Non décrit dans les types.
finish: Finish
Non décrit dans les types.
Utilisé dans : IntentsApi
PublicIntentsApi
request: IntentRequestApi
The current intent request as a subscribable.
When the app isn't running inside an intent workflow, the current value is null.
invoke?(query: IntentQuery): Promise<IntentActivity>
Invoke an intent using the object syntax.
invoke?(intentURL: string, options?: IntentQueryOptions): Promise<IntentActivity>
Invoke an intent using the URL syntax.
URL format: action:type[,value][?params].
response?: IntentResponseApi
If in an intent workflow, provides mechanisms to resolve the intent with a given response.
Utilisé dans : IntentsApi
IntentActivity
complete?: Promise<IntentResponse>
A Promise that resolves when the intent workflow completes, returning the response.
Utilisé dans : PublicIntentsApi
IntentQuery
action: IntentAction
Non décrit dans les types.
type: IntentType
Non décrit dans les types.
Utilisé dans : PublicIntentsApi
IntentQueryOptions
value?: string
The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
data?: { [key: string]: unknown; }
Additional data required for certain intent types. For example:
- Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
- ProductVariant creation requires { productId: 'gid://shopify/Product/123' }
- Metaobject creation requires { type: 'shopify--color-pattern' }
Utilisé dans : IntentQuery, PublicIntentsApi
IntentRequestApi
readonly value: IntentRequest | null
Non décrit dans les types.
subscribe(callback: (value: IntentRequest | null) => void): () => void
Non décrit dans les types.
Utilisé dans : PublicIntentsApi
IntentResponseApi
ok: (data?: SuccessIntentResponse["data"]) => Promise<void>
If in an intent workflow, resolves the intent with a success response and the provided data, if any.
error: (message: string, issues?: StandardSchemaV1.Issue[]) => Promise<void>
If in an intent workflow, resolves the intent with an error response and the provided message and issues, if any.
closed: () => Promise<void>
If in an intent workflow, resolves the intent with a closed response.
Utilisé dans : PublicIntentsApi
IntentResponse
type IntentResponse = ClosedIntentResponse | SuccessIntentResponse | ErrorIntentResponse;Références : ClosedIntentResponse, ErrorIntentResponse, SuccessIntentResponseUtilisé dans : IntentActivity
IntentType
type IntentType = "settings/LocationDefault" | "settings/OrderIDFormat" | "settings/OrderProcessing" | "settings/StoreDefaults" | "settings/StoreDetails" | "shopify/Article" | "shopify/Catalog" | "shopify/Collection" | "shopify/Customer" | "shopify/Discount" | "shopify/File" | "shopify/Location" | "shopify/Market" | "shopify/Menu" | "shopify/MetafieldDefinition" | "shopify/Metaobject" | "shopify/MetaobjectDefinition" | "shopify/Page" | "shopify/Product" | "shopify/ProductVariant";Utilisé dans : IntentQuery
IntentRequest
action: string
Non décrit dans les types.
type: string
Non décrit dans les types.
value?: unknown
Non décrit dans les types.
data?: { [key: string]: unknown; }
Non décrit dans les types.
Utilisé dans : IntentRequestApi
SuccessIntentResponse
code?: "ok"
Non décrit dans les types.
data?: { [key: string]: unknown; }
Non décrit dans les types.
Utilisé dans : IntentResponse, IntentResponseApi
ClosedIntentResponse
code?: "closed"
Non décrit dans les types.
Utilisé dans : IntentResponse
ErrorIntentResponse
code?: "error"
Non décrit dans les types.
message?: string
Non décrit dans les types.
issues?: StandardSchemaV1.Issue[]
Non décrit dans les types.
Utilisé dans : IntentResponse
LoadingApi
type LoadingApi = (isLoading?: boolean) => void;Utilisé dans : useAppBridge(), ShopifyGlobal
ModalApi
Utilisé dans : useAppBridge(), Modal, ShopifyGlobal
_ModalApi
show?(id: string): Promise<void>
Shows the modal element. An alternative to the showOverlay instance method on the s-modal component.
hide?(id: string): Promise<void>
Hides the modal element. An alternative to the hideOverlay instance method on the s-modal component.
toggle?(id: string): Promise<void>
Toggles the modal element visibility. An alternative to the toggleOverlay instance method on the s-modal component.
Utilisé dans : ModalApi
PickerApi
type PickerApi = (options: PickerOptions) => Promise<{
selected: Promise<string[] | undefined>;
}>;Références : PickerOptionsUtilisé dans : useAppBridge(), ShopifyGlobal
PickerOptions
heading: string
The heading displayed at the top of the picker modal. Use a clear, descriptive title that tells merchants what they're selecting.
multiple?: boolean | number
The selection mode for the picker. Pass true to allow unlimited selections, false for single-item selection only, or a number to set a maximum selection limit (for example, 3 allows up to three items).
Par défaut : false
headers?: Header[]
The column headers for the picker table. Define headers to label and organize the data columns displayed for each item. The header order determines the column layout.
items: PickerItem[]
The list of items that merchants can select from. Each item appears as a row in the picker table.
Utilisé dans : PickerApi
Header
content?: string
The label text displayed at the top of the table column. Use clear, concise labels that describe the data in that column (for example, "Price", "Status", "Last Updated").
type?: "string" | "number"
The data type that controls column formatting and text alignment. Use 'number' for currency, prices, or numeric values (displays right-aligned), or 'string' for text content (displays left-aligned).
Par défaut : 'string'
Utilisé dans : PickerOptions
PickerItem
id: string
The unique identifier for this item. This ID is returned in the selection array when the merchant selects this item. Use an ID that helps you identify the item in your system (for example, template IDs, review IDs, or custom option keys).
heading: string
The primary text displayed in the first column. This is typically the item's name or title and is the most prominent text in the row.
data?: DataPoint[]
Additional data displayed in subsequent columns after the heading. Each value appears in its own column, and the order must match the headers array. For example, if headers are ["Price", "Status"], then data would be [19.99, "Active"].
disabled?: boolean
Whether the item can be selected. When true, the item is disabled and can't be selected. Disabled items appear grayed out. Use this for items that are unavailable or don't meet selection criteria.
Par défaut : false
selected?: boolean
Whether the item is preselected when the picker opens. When true, the item appears selected by default. Merchants can still deselect preselected items. Use this to show current selections or suggest default choices.
badges?: Badge[]
Status or context badges displayed next to the heading in the first column. Use badges to highlight item state, completion status, or other important attributes (for example, "Draft", "Published", "Incomplete").
thumbnail?: { url: string; }
A small preview image or icon displayed at the start of the row. Thumbnails help merchants visually identify items at a glance. Provide a URL to the image file.
Utilisé dans : PickerOptions
Badge
content: string
The text content of the badge. Keep this short and descriptive (for example, "Draft", "Active", "Incomplete").
tone?: Tone
The visual tone indicating status or importance. Choose a tone that matches the badge's meaning.
progress?: Progress
The progress indicator for the badge. Use this to show completion status for items that have progress states.
Utilisé dans : PickerItem
Progress
type Progress = "incomplete" | "partiallyComplete" | "complete";Utilisé dans : Badge
ResourcePickerApi
type ResourcePickerApi = <ResourceType extends keyof ResourceTypes = keyof ResourceTypes>(options: ResourcePickerOptions<ResourceType>) => Promise<SelectPayload<ResourceType> | undefined>;Références : ResourcePickerOptions, ResourceTypes, SelectPayloadUtilisé dans : useAppBridge(), ShopifyGlobal
ResourcePickerOptions
type: ResourceType
The type of Shopify resource to select: 'product' for products, 'variant' for specific product variants, or 'collection' for collections. This determines what appears in the picker and what data structure is returned.
action?: "add" | "select"
The action verb that appears in the title as the primary action of the resource picker. "Add" prompts merchants that they are appending to an existing list, while "select" they'll choose a resource for a specific purpose or replacing selections.
Par défaut : 'add'
filter?: Filters
Filtering options that control which resources appear in the resourcepicker. Use filters to restrict resources by publication status, include or exclude variants, or apply custom search criteria. This helps merchants find relevant items faster.
multiple?: boolean | number
Whether to allow selecting multiple items of a specific type. If a number is provided, limit selections to that maximum. When type is 'product', merchants can still select multiple variants from a single product even when multiple is false.
Par défaut : false
query?: string
Initial GraphQL search query for filtering resources available in the resource picker. See search syntax for more information. This is displayed in the search bar when the picker is opened and can be edited by users. For most use cases, you should use the filter.query option instead which doesn't show the query in the UI.
Par défaut : ''
selectionIds?: BaseResource[]
Resources that should be preselected when the picker is opened. Use this for edit workflows to show what products are already in a bundle, collection, or promotional set. Merchants can see current selections and modify them before confirming.
Par défaut : []
Utilisé dans : useAppBridge(), ResourcePickerApi
ResourceTypes
product: Product
Non décrit dans les types.
variant: ProductVariant
Non décrit dans les types.
collection: Collection
Non décrit dans les types.
Utilisé dans : ResourcePickerApi, ResourcePickerOptions, ResourceSelection, SelectPayload
SelectPayload
type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<ResourceSelection<Type>[]>;Références : ResourceSelection, ResourceTypes, WithSelectionUtilisé dans : ResourcePickerApi
BaseResource
variants?: Resource[]
Non décrit dans les types.
Utilisé dans : ResourcePickerOptions
Filters
hidden?: boolean
Whether to show hidden resources, referring to products that are not published on any sales channels.
Par défaut : true
variants?: boolean
Whether to show product variants. Only applies to the Product resource type picker.
Par défaut : true
draft?: boolean | undefined
Whether to show draft products. Only applies to the Product resource type picker. Setting this to undefined will show a badge on draft products.
Par défaut : true
archived?: boolean | undefined
Whether to show archived products. Only applies to the Product resource type picker. Setting this to undefined will show a badge on draft products.
Par défaut : true
query?: string
GraphQL initial search query for filtering resources available in the picker. See search syntax for more information. This query is not visible to merchants and runs server-side. Use it to programmatically restrict results (for example, vendor:Acme) without exposing the filter logic.
Utilisé dans : ResourcePickerOptions
Collection
availablePublicationCount: number
Non décrit dans les types.
description: string
Non décrit dans les types.
descriptionHtml: string
Non décrit dans les types.
handle: string
Non décrit dans les types.
id: string
Non décrit dans les types.
image?: Image | null
Non décrit dans les types.
productsAutomaticallySortedCount: number
Non décrit dans les types.
productsCount: number
Non décrit dans les types.
productsManuallySortedCount: number
Non décrit dans les types.
publicationCount: number
Non décrit dans les types.
ruleSet?: RuleSet | null
Non décrit dans les types.
seo: { description?: string | null; title?: string | null; }
Non décrit dans les types.
sortOrder: CollectionSortOrder
Non décrit dans les types.
storefrontId: string
Non décrit dans les types.
templateSuffix?: string | null
Non décrit dans les types.
title: string
Non décrit dans les types.
updatedAt: string
Non décrit dans les types.
Utilisé dans : ResourceTypes
Product
availablePublicationCount: number
Non décrit dans les types.
createdAt: string
Non décrit dans les types.
descriptionHtml: string
Non décrit dans les types.
handle: string
Non décrit dans les types.
hasOnlyDefaultVariant: boolean
Non décrit dans les types.
images: Image[]
Non décrit dans les types.
options: { id: string; name: string; position: number; values: string[]; }[]
Non décrit dans les types.
productType: string
Non décrit dans les types.
publishedAt?: string | null
Non décrit dans les types.
tags: string[]
Non décrit dans les types.
templateSuffix?: string | null
Non décrit dans les types.
title: string
Non décrit dans les types.
totalInventory: number
Non décrit dans les types.
totalVariants: number
Non décrit dans les types.
tracksInventory: boolean
Non décrit dans les types.
variants: Partial<ProductVariant>[]
Non décrit dans les types.
vendor: string
Non décrit dans les types.
updatedAt: string
Non décrit dans les types.
status: ProductStatus
Non décrit dans les types.
Utilisé dans : ProductVariant, ResourceTypes
ProductVariant
availableForSale: boolean
Non décrit dans les types.
barcode?: string | null
Non décrit dans les types.
compareAtPrice?: Money | null
Non décrit dans les types.
createdAt: string
Non décrit dans les types.
displayName: string
Non décrit dans les types.
fulfillmentService?: { id: string; inventoryManagement: boolean; productBased: boolean; serviceName: string; type: FulfillmentServiceType; }
Non décrit dans les types.
image?: Image | null
Non décrit dans les types.
inventoryItem: { id: string; }
Non décrit dans les types.
inventoryManagement: ProductVariantInventoryManagement
Non décrit dans les types.
inventoryPolicy: ProductVariantInventoryPolicy
Non décrit dans les types.
inventoryQuantity?: number | null
Non décrit dans les types.
position: number
Non décrit dans les types.
price: Money
Non décrit dans les types.
product: Partial<Product>
Non décrit dans les types.
requiresShipping: boolean
Non décrit dans les types.
selectedOptions: { value?: string | null; }[]
Non décrit dans les types.
sku?: string | null
Non décrit dans les types.
taxable: boolean
Non décrit dans les types.
title: string
Non décrit dans les types.
weight?: number | null
Non décrit dans les types.
weightUnit: WeightUnit
Non décrit dans les types.
updatedAt: string
Non décrit dans les types.
Utilisé dans : Product, ResourceTypes
ResourceSelection
type ResourceSelection<Type extends keyof ResourceTypes> = ResourceTypes[Type];Références : ResourceTypesUtilisé dans : SelectPayload
Resource
id: string
in GraphQL id format, ie 'gid://shopify/Product/1'
Utilisé dans : BaseResource, Collection, Product, ProductVariant
CollectionSortOrder
declare enum CollectionSortOrder {
Manual = "MANUAL",
BestSelling = "BEST_SELLING",
AlphaAsc = "ALPHA_ASC",
AlphaDesc = "ALPHA_DESC",
PriceDesc = "PRICE_DESC",
PriceAsc = "PRICE_ASC",
CreatedDesc = "CREATED_DESC",
Created = "CREATED",
MostRelevant = "MOST_RELEVANT"
}Utilisé dans : Collection
Image
id: string
Non décrit dans les types.
altText?: string
Non décrit dans les types.
originalSrc: string
Non décrit dans les types.
Utilisé dans : Collection, Product, ProductVariant
RuleSet
appliedDisjunctively: boolean
Non décrit dans les types.
rules: CollectionRule[]
Non décrit dans les types.
Utilisé dans : Collection
ProductStatus
declare enum ProductStatus {
Active = "ACTIVE",
Archived = "ARCHIVED",
Draft = "DRAFT"
}Utilisé dans : Product
FulfillmentServiceType
declare enum FulfillmentServiceType {
GiftCard = "GIFT_CARD",
Manual = "MANUAL",
ThirdParty = "THIRD_PARTY"
}Utilisé dans : ProductVariant
ProductVariantInventoryManagement
declare enum ProductVariantInventoryManagement {
Shopify = "SHOPIFY",
NotManaged = "NOT_MANAGED",
FulfillmentService = "FULFILLMENT_SERVICE"
}Utilisé dans : ProductVariant
ProductVariantInventoryPolicy
declare enum ProductVariantInventoryPolicy {
Deny = "DENY",
Continue = "CONTINUE"
}Utilisé dans : ProductVariant
WeightUnit
declare enum WeightUnit {
Kilograms = "KILOGRAMS",
Grams = "GRAMS",
Pounds = "POUNDS",
Ounces = "OUNCES"
}Utilisé dans : ProductVariant
CollectionRule
column: string
Non décrit dans les types.
condition: string
Non décrit dans les types.
relation: string
Non décrit dans les types.
Utilisé dans : RuleSet
ReviewsApi
request(): Promise<ReviewRequestResponse>
Requests an app review modal. The modal only displays if rate limits and eligibility conditions are met. Returns a Promise that resolves to a response object with success, code, and message properties indicating whether the modal was shown and, if not, the reason why.
Utilisé dans : useAppBridge(), ShopifyGlobal
ReviewRequestResponse
type ReviewRequestResponse = ReviewRequestSuccessResponse | ReviewRequestDeclinedResponse;Références : ReviewRequestDeclinedResponse, ReviewRequestSuccessResponseUtilisé dans : ReviewsApi
ReviewRequestDeclinedResponse
success: false
Indicates the review modal was not displayed.
code: ReviewRequestDeclinedCode
A code identifying why the modal was not displayed, such as rate limits or merchant eligibility.
message: string
A human-readable message explaining why the modal was not displayed.
Utilisé dans : ReviewRequestResponse
ReviewRequestSuccessResponse
success: true
Indicates the review modal was successfully displayed.
code: "success"
The response code. Always 'success' for a successful request.
message: "Review modal shown successfully"
A human-readable message confirming the modal was shown.
Utilisé dans : ReviewRequestResponse
ReviewRequestDeclinedCode
type ReviewRequestDeclinedCode = "mobile-app" | "already-reviewed" | "annual-limit-reached" | "cooldown-period" | "merchant-ineligible" | "recently-installed" | "already-open" | "open-in-progress" | "cancelled";Utilisé dans : ReviewRequestDeclinedResponse
SaveBarApi
Utilisé dans : useAppBridge(), ShopifyGlobal
_SaveBarApi
show?(id: string): Promise<void>
Displays the save bar to indicate unsaved changes. Call this when you want to prompt the merchant to save.
hide?(id: string): Promise<void>
Hides the save bar. Call this after the merchant saves or discards their changes.
toggle?(id: string): Promise<void>
Toggles save bar visibility between shown and hidden states.
leaveConfirmation?(): Promise<void>
Prompts the merchant to deal with unsaved changes before your app navigates. The promise resolves when no save bar is visible, or when the merchant chooses to leave. In the Shopify admin on the web, a visible save bar asks the merchant to save or discard their changes instead, and the promise stays pending, so the code after it doesn't run.
Call it before each navigation that App Bridge can't intercept: changes to window.location, and client-side router calls such as router.push() in the Next.js App Router, which renders the next page before it updates the URL. For example, call await shopify.saveBar.leaveConfirmation() before router.push(). If your app navigates without it, the page changes and the merchant's unsaved changes are lost. Link clicks, window.open(), and the browser's back and forward buttons are already guarded.
Utilisé dans : SaveBarApi
SidekickApi
isEnabled(): Promise<boolean>
Checks whether Sidekick is available to the app on this store. Call it before showing a launch entry point.
isOpen(): Promise<boolean>
Checks whether the Sidekick panel is open.
open(): Promise<void>
Opens the Sidekick panel without sending a prompt.
launch(request: SidekickLaunchRequest | string): Promise<SidekickConversation>
Opens Sidekick and sends message as the merchant's prompt. A string is shorthand for {message}. Call it from a merchant action, such as a button click. Shopify screens the prompt first and rejects with an error whose message starts with sidekick.launch: when it refuses to send it.
Utilisé dans : useAppBridge(), ShopifyGlobal
SidekickConversation
The conversation a launch started or continued.
id: string
The conversation ID.
Utilisé dans : SidekickApi
SidekickLaunchRequest
A request to start a Sidekick conversation from your app.
message: string
The prompt to send to Sidekick as the merchant's message. Required, and must be non-empty after trimming. Shopify trims surrounding whitespace and rejects a prompt longer than a merchant could type into Sidekick.
Utilisé dans : SidekickApi
SupportApi
registerHandler?: (callback: SupportCallback | null) => Promise<void>
Registers a callback function to run when the merchant clicks the support button. Pass null to unregister a previously registered handler.
Utilisé dans : useAppBridge(), ShopifyGlobal
SupportCallback
type SupportCallback = () => void | Promise<void>;Utilisé dans : SupportApi
ToastApi
show: ToastShow
Displays a Toast notification in the Shopify admin.
hide: ToastHide
Hides a Toast notification in the Shopify admin.
Utilisé dans : useAppBridge(), ShopifyGlobal
ToastShow
type ToastShow = (message: string, opts?: ToastOptions) => string;Références : ToastOptionsUtilisé dans : ToastApi
ToastOptions
duration?: number
The length of time in milliseconds the toast message should persist.
Par défaut : 5000
isError?: boolean
Display an error-styled toast.
Par défaut : false
action?: string
Content of an action button.
onAction?: () => void
Callback fired when the action button is clicked.
onDismiss?: () => void
Callback fired when the dismiss icon is clicked.
Utilisé dans : useAppBridge(), ToastShow
Tools
register: RegisterFunction
Non décrit dans les types.
unregister: UnregisterFunction
Non décrit dans les types.
clear: ClearFunction
Non décrit dans les types.
Utilisé dans : useAppBridge(), ShopifyGlobal
RegisterFunction
type RegisterFunction = (name: string, handler: ToolHandler) => () => void;Références : ToolHandlerUtilisé dans : Tools
ToolHandler
type ToolHandler = (input: Record<string, any>) => Record<string, any> | Promise<Record<string, any>>;Utilisé dans : RegisterFunction