Skip to content

Beta

Estos componentes de App Bridge son nuevos, y su API puede cambiar en una versión menor durante la beta. Su comportamiento se comprueba en un admin de Shopify real con una suite E2E local. Si algo no funciona, abre un issue.

Autenticación y datos ​

Las API que Shopify agrupa en autenticación y datos, y los tipos que solo usan ellas. En esta página: AppApi, AppBridgeConfig, EnvironmentApi, IdTokenApi, Scopes, UserApi.

AppApi ​

interface

extensions(): Promise<ExtensionInfo[]>

The list of extensions from the current app.

ExtensionInfo ​

interface

Parámetros de tipo: 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.

Se usa en: AppApi

ExtensionType ​

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

Se usa en: 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.

Ver: 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.

Se usa en: ExtensionInfo

UiExtensionActivation ​

interface

target: string

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

Se usa en: ExtensionInfo

ActivationStatus ​

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

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}

ThemeAppBlockTarget ​

type
ts
type ThemeAppBlockTarget = "section";

ThemeAppEmbedTarget ​

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

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.

Por defecto: '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.

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.

Por defecto: false

Se usa en: AppBridgeConfig

EnvironmentApi ​

interface

Extiende: Required<_EnvironmentApi>

_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.

Se usa en: EnvironmentApi

IdTokenApi ​

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

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.

Scope ​

type
ts
type Scope = string;

Se usa en: 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.

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.

Se usa en: Scopes

ScopesRevokeResponse ​

interface

detail: ScopesDetail

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

Se usa en: Scopes

UserResult ​

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

UserApi ​

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

Referencias: UserSe usa en: useAppBridge(), ShopifyGlobal

User ​

interface

Se usa en: UserApi

AdminUser ​

interface

accountAccess?: string

The account access level of the logged-in user.

locale?: string

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

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.

Se usa en: User

PrivilegedAdminUser ​

interface

Extiende: 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.

Se usa en: User

Publicado bajo la licencia MIT. Logo de Vue por Evan You, CC BY-NC-SA 4.0.