Skip to content

Бета

Эти компоненты App Bridge новые, и их API может измениться в минорном релизе, пока они в бете. Их поведение проверяется в реальной админке Shopify локальным E2E-набором. Если что-то не работает, создайте issue.

Аутентификация и данные ​

API, которые Shopify относит к аутентификации и данным, и типы, которые использует только они. На этой странице: AppApi, AppBridgeConfig, EnvironmentApi, IdTokenApi, Scopes, UserApi.

AppApi ​

interface

extensions(): Promise<ExtensionInfo[]>

The list of extensions from the current app.

Используется в: useAppBridge(), ShopifyGlobal

ExtensionInfo ​

interface

Параметры типа: Type extends ExtensionType = ExtensionType

handle: string

The unique identifier for the extension.

activations: Type extends "ui_extension" ? UiExtensionActivation[] : Type extends "theme_app_extension" ? ThemeExtensionActivation[] : never

List of activation records for the extension. The shape depends on the extension type:

  • UI extensions have activations with only target
  • Theme app extensions have nested activations representing blocks/embeds

type: Type

The type of the extension.

Используется в: AppApi

ExtensionType ​

type
ts
type ExtensionType = "ui_extension" | "theme_app_extension";

Используется в: ExtensionInfo

ThemeExtensionActivation ​

interface

target: ThemeAppBlockTarget | ThemeAppEmbedTarget

The target location type for this block/embed.

  • section for blocks
  • head, body, or compliance_head for embeds

handle: string

The filename of the block/embed within the theme app extension (without extension). This is configured by the developer when creating the block file.

name: string

The developer-configured display name of this block/embed, defined in the block's schema.

См.: https://shopify.dev/docs/apps/build/online-store/theme-app-extensions/configuration#schema

status: ActivationStatus

The availability status of this block/embed.

activations: ThemeAppBlockActivation[]

List of theme-specific activations for this block/embed. Contains where the block is actually placed within themes.

Используется в: ExtensionInfo

UiExtensionActivation ​

interface

target: string

The target identifier for the extension activation. For example, purchase.thank-you.block.render.

Используется в: ExtensionInfo

ActivationStatus ​

type
ts
type ActivationStatus = "active" | "available" | "unavailable";

Используется в: ThemeExtensionActivation

ThemeAppBlockActivation ​

interface

target: string

The target identifier for the block/embed placement within the theme. For example, template--product.alternate/main/my_app_product_rating_GPzUYy.

themeId: string

The theme ID where this block/embed is activated. Format: gid://shopify/OnlineStoreTheme/{id}

Используется в: ThemeExtensionActivation

ThemeAppBlockTarget ​

type
ts
type ThemeAppBlockTarget = "section";

Используется в: ThemeExtensionActivation

ThemeAppEmbedTarget ​

type
ts
type ThemeAppEmbedTarget = "head" | "body" | "compliance_head";

Используется в: ThemeExtensionActivation

AppBridgeConfig ​

interface

apiKey: string

The client ID (also known as the API key) for your application, found in the Shopify Partner Dashboard under your app's settings.

You must provide this value using a <meta name="shopify-api-key"> tag.

appOrigins?: string[]

An allowlist of origins that your app can send authenticated fetch requests to.

Set this property if your app needs to make authenticated requests to a domain other than your app's origin. Requests to your app's own domain (and its subdomains) are automatically allowed.

Each value must be an origin in the format scheme://hostname or scheme://hostname:port (for example, 'https://example.com' or 'https://example.com:8443').

debug?: DebugOptions

Configuration for enabling Web Vitals performance logging.

Use this property during development for identifying performance issues.

disabledFeatures?: string[]

An array of App Bridge feature names to disable in your app.

Supported values:

  • 'fetch' — Disables App Bridge's automatic fetch interceptor, which adds authentication headers to requests to the Shopify Admin API.
  • 'auto-redirect' — Disables automatic redirection when the app is loaded outside of the Shopify Admin.

experimentalFeatures?: string[]

The experimental features to enable in your app.

This allows app developers to opt-in to experiement features.

host?: string

The base64-encoded host of the shop that's embedding your app. When decoded, the value has the format admin.shopify.com/store/{shop-name}.

This property is automatically set by the host environment.

locale?: string

The locale of the admin user viewing your app, as an IETF BCP 47 language tag (for example, 'en-US', 'fr-FR', 'ja-JP').

This reflects the language the merchant has chosen for the Shopify admin, not the shop's customer-facing locale.

This property is automatically set by the host environment.

По умолчанию: 'en-US'

shop?: string

The permanent .myshopify.com domain of the shop that's embedding your app (for example, 'my-store.myshopify.com'). This is always the Shopify-assigned domain, not a custom domain.

This property is automatically set by the host environment.

Используется в: useAppBridge(), ShopifyGlobal

DebugOptions ​

interface

webVitals?: boolean

Enables or disables the logging of web performance metrics (Web Vitals) in the browser's console.

When set to true, the app will log Core Web Vitals (such as LCP, INP, and CLS) and other relevant performance metrics to help developers understand the real-world performance of their app. This can be useful for debugging performance issues during development or in a staging environment.

This field is optional and defaults to false, meaning that web vitals logging is disabled by default to avoid performance overhead and unnecessary console output in production environments.

По умолчанию: false

Используется в: AppBridgeConfig

EnvironmentApi ​

interface

Расширяет: Required<_EnvironmentApi>

Используется в: useAppBridge(), ShopifyGlobal

_EnvironmentApi ​

interface

mobile?: boolean

Whether the app is running inside the Shopify Mobile app.

embedded?: boolean

Whether the app is embedded in the Shopify admin.

pos?: boolean

Whether the app is running inside the Shopify POS app.

intent?: boolean

Whether the app is running as an intent.

Используется в: EnvironmentApi

IdTokenApi ​

function
ts
type IdTokenApi = () => Promise<string>;

Используется в: useAppBridge(), ShopifyGlobal

Scopes ​

interface

query: () => Promise<ScopesDetail>

Returns the current access scopes for this app on this shop, including which are granted, required, and optional.

request: (scopes: Scope[]) => Promise<ScopesRequestResponse>

Opens a permission grant modal asking the merchant to grant the specified scopes.

The scopes must be access scope handles (for example, 'read_products' or 'write_orders') that are declared as optional in your app configuration.

See the permission grant modal documentation for more details.

revoke: (scopes: Scope[]) => Promise<ScopesRevokeResponse>

Revokes the specified optional scopes from this app on this shop.

The scopes must be access scope handles (for example, 'read_products' or 'write_orders') that are currently granted and declared as optional. Required scopes cannot be revoked.

Используется в: useAppBridge(), ShopifyGlobal

Scope ​

type
ts
type Scope = string;

Используется в: Scopes, ScopesDetail

ScopesDetail ​

interface

granted: Scope[]

The scopes currently granted to this app on this shop. This includes both required and optional scopes.

required: Scope[]

The scopes declared as required in your app configuration. These are always granted at install time and cannot be revoked by the app.

optional: Scope[]

The scopes declared as optional in your app configuration. These may or may not be currently granted — check granted to see which are active.

Используется в: Scopes, ScopesRequestResponse, ScopesRevokeResponse

ScopesRequestResponse ​

interface

result: UserResult

The merchant's response: 'granted-all' if they accepted all requested scopes, or 'declined-all' if they declined.

detail: ScopesDetail

The updated scopes for this app on this shop after the merchant's response.

Используется в: Scopes

ScopesRevokeResponse ​

interface

detail: ScopesDetail

The updated scopes for this app on this shop after the revocation.

Используется в: Scopes

UserResult ​

type
ts
type UserResult = "granted-all" | "declined-all";

Используется в: ScopesRequestResponse

UserApi ​

function
ts
type UserApi = () => Promise<User>;

Ссылки на: UserИспользуется в: useAppBridge(), ShopifyGlobal

User ​

interface

Расширяет: PrivilegedAdminUser, AdminUser, POSUser

Используется в: UserApi

AdminUser ​

interface

accountAccess?: string

The account access level of the logged-in user.

locale?: string

Host regional format. Copied onto shopify.config.locale.

Используется в: PrivilegedAdminUser, User

POSUser ​

interface

id?: number

The staff member's numeric ID.

firstName?: string

The user's first name.

lastName?: string

The user's last name.

email?: string

The user's email address.

accountAccess?: string

The account access level of the logged-in user.

accountType?: string

The user's account type.

Используется в: User

PrivilegedAdminUser ​

interface

Расширяет: AdminUser

id?: number

The staff member's numeric ID.

name?: string

The staff member's full name.

email?: string

The staff member's email address.

Используется в: User

Распространяется по лицензии MIT. Логотип Vue — Evan You, CC BY-NC-SA 4.0.