# CustomerSegmentTemplate Extension API This API is available to all customer segment template extension types. ## CustomerSegmentTemplateApi ### CustomerSegmentTemplateApi ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### __enabledFeatures value: `"b2bEnabled"[]` ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### I18n ### formatNumber value: `(number: number | bigint, options?: { inExtensionLocale?: boolean; } & NumberFormatOptions) => string` Returns a localized number. This function behaves like the standard `Intl.NumberFormat()` with a style of `decimal` applied. It uses the buyer's locale by default. ### formatCurrency value: `(number: number | bigint, options?: { inExtensionLocale?: boolean; } & NumberFormatOptions) => string` Returns a localized currency value. This function behaves like the standard `Intl.NumberFormat()` with a style of `currency` applied. It uses the buyer's locale by default. ### formatDate value: `(date: Date, options?: { inExtensionLocale?: boolean; } & DateTimeFormatOptions) => string` Returns a localized date value. This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses the buyer's locale by default. Formatting options can be passed in as options. ### translate value: `I18nTranslate` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } - I18nTranslate: export interface I18nTranslate { /** * This returns a translated string matching a key in a locale file. * * @example translate("banner.title") */ ( key: string, options?: {[placeholderKey: string]: ReplacementType | string | number}, ): ReplacementType extends string | number ? string : (string | ReplacementType)[]; } Returns translated content in the buyer's locale, as supported by the extension. - `options.count` is a special numeric value used in pluralization. - The other option keys and values are treated as replacements for interpolation. - If the replacements are all primitives, then `translate()` returns a single string. - If replacements contain UI components, then `translate()` returns an array of elements. ### ExtensionTargets ### Playground value: `RenderExtension, AllComponents>` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - StandardApi: export interface StandardApi { /** * The identifier of the running extension target. */ extension: { target: ExtensionTarget; }; /** * Utilities for translating content according to the current localization of the admin. * More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions */ i18n: I18n; /** * Provides information to the receiver the of an intent. */ intents: Intents; /** * Provides methods to navigate to other features in the Admin. */ navigation: Navigation; /** * Used to query the Admin GraphQL API */ query: ( query: string, options?: {variables?: Variables; version?: Omit}, ) => Promise<{data?: Data; errors?: GraphQLError[]}>; } - AllComponents: AllComponents ### admin.customers.segmentation-templates.render value: `RenderExtension< CustomerSegmentTemplateApi<'admin.customers.segmentation-templates.render'>, CustomerSegmentTemplateComponent >` - CustomerSegmentTemplateApi: export interface CustomerSegmentTemplateApi< ExtensionTarget extends AnyExtensionTarget, > extends StandardApi { /* Utilities for translating content according to the current `localization` of the admin. */ i18n: I18n; /** @private */ __enabledFeatures: CustomerSegmentationFeature[]; } - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - CustomerSegmentTemplateComponent: CustomerSegmentTemplateComponent Renders a [`CustomerSegmentTemplate`](https://shopify.dev/docs/api/admin-extensions/components/customersegmenttemplate) in the [customer segment editor](https://help.shopify.com/en/manual/customers/customer-segmentation/customer-segments). ### admin.product-details.block.render value: `RenderExtension< BlockExtensionApi<'admin.product-details.block.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - BlockExtensionApi: export interface BlockExtensionApi extends StandardApi { /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Block in the product details page. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.order-details.block.render value: `RenderExtension< BlockExtensionApi<'admin.order-details.block.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - BlockExtensionApi: export interface BlockExtensionApi extends StandardApi { /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Block in the order details page. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.customer-details.block.render value: `RenderExtension< BlockExtensionApi<'admin.customer-details.block.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - BlockExtensionApi: export interface BlockExtensionApi extends StandardApi { /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Block in the customer details page. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.product-details.action.render value: `RenderExtension< ActionExtensionApi<'admin.product-details.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the product details page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.order-details.action.render value: `RenderExtension< ActionExtensionApi<'admin.order-details.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the order details page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.customer-details.action.render value: `RenderExtension< ActionExtensionApi<'admin.customer-details.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the customer details page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.customer-segment-details.action.render value: `RenderExtension< ActionExtensionApi<'admin.customer-segment-details.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the customer segment details page. Open this extension from the "Use segment" button. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.product-index.action.render value: `RenderExtension< ActionExtensionApi<'admin.product-index.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the product index page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.order-index.action.render value: `RenderExtension< ActionExtensionApi<'admin.order-index.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the order index page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.customer-index.action.render value: `RenderExtension< ActionExtensionApi<'admin.customer-index.action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the customer index page. Open this extension from the "More Actions" menu. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.product-index.selection-action.render value: `RenderExtension< ActionExtensionApi<'admin.product-index.selection-action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the product index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.order-index.selection-action.render value: `RenderExtension< ActionExtensionApi<'admin.order-index.selection-action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the order index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.customer-index.selection-action.render value: `RenderExtension< ActionExtensionApi<'admin.customer-index.selection-action.render'>, AllComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - AllComponents: AllComponents - ActionExtensionApi: export interface ActionExtensionApi extends StandardApi { /** * Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. */ close: () => void; /** * Information about the currently viewed or selected items. */ data: Data; } Renders an Admin Action in the customer index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime. See the [list of available components](https://shopify.dev/docs/api/admin-extensions/components). ### admin.product-details.configuration.render value: `RenderExtension< ProductDetailsConfigurationApi<'admin.product-details.configuration.render'>, ProductConfigurationComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - ProductDetailsConfigurationApi: export interface ProductDetailsConfigurationApi< ExtensionTarget extends AnyExtensionTarget, > extends StandardApi { data: { /* The product currently being viewed in the admin. */ product: Product; app: { launchUrl: string; applicationUrl: string; }; }; } - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } - ProductConfigurationComponents: ProductConfigurationComponents Renders Product Configuration on product details and product variant details ### admin.product-variant-details.configuration.render value: `RenderExtension< ProductVariantDetailsConfigurationApi<'admin.product-variant-details.configuration.render'>, ProductConfigurationComponents >` - RenderExtension: export interface RenderExtension< Api, AllowedComponents extends RemoteComponentType< string, any, any > = RemoteComponentType, > { ( connection: RenderExtensionConnection, api: Api, ): void | Promise; } - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } - ProductConfigurationComponents: ProductConfigurationComponents - ProductVariantDetailsConfigurationApi: export interface ProductVariantDetailsConfigurationApi< ExtensionTarget extends AnyExtensionTarget, > extends StandardApi { data: { /* The product variant currently being viewed in the admin. */ variant: ProductVariant; app: { launchUrl: string; applicationUrl: string; }; }; } - ProductVariant: interface ProductVariant { id: string; sku: string; barcode: string; title: string; displayName: string; price: string; compareAtPrice: string; taxable: boolean; taxCode: string; weight: number; selectedOptions: { name: string; value: string; }[]; productVariantComponents: ProductVariantComponent[]; } ### StandardApi The following APIs are provided to all extension targets. ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### Intents ### launchUrl value: `string | URL` The URL that was used to launch the intent. ### Navigation ### navigate value: `(url: string | URL) => void` A method to navigate to a specific route. ### Data ### selected value: `{ id: string; }[]` Information about the currently viewed or selected items. ### BlockExtensionApi ### data value: `Data` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } Information about the currently viewed or selected items. ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### ActionExtensionApi ### close value: `() => void` Closes the extension. Calling this method is equivalent to the merchant clicking the "x" in the corner of the overlay. ### data value: `Data` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } Information about the currently viewed or selected items. ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### ProductDetailsConfigurationApi ### data value: `{ product: Product; app: { launchUrl: string; applicationUrl: string; }; }` - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### Product ### id value: `string` ### title value: `string` ### handle value: `string` ### status value: `"ACTIVE" | "ARCHIVED" | "DRAFT"` ### totalVariants value: `number` ### totalInventory value: `number` ### hasOnlyDefaultVariant value: `boolean` ### onlineStoreUrl value: `string` ### options value: `{ id: string; name: string; position: number; values: string[]; }[]` ### productType value: `string` ### productCategory value: `string` ### productComponents value: `ProductComponent[]` - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } - ProductComponent: export interface ProductComponent { id: string; title: string; featuredImage?: { id?: string | null; url?: string | null; altText?: string | null; } | null; totalVariants: number; productUrl: string; componentVariantsCount: number; nonComponentVariantsCount: number; } ### ProductComponent ### id value: `string` ### title value: `string` ### featuredImage value: `{ id?: string; url?: string; altText?: string; }` ### totalVariants value: `number` ### productUrl value: `string` ### componentVariantsCount value: `number` ### nonComponentVariantsCount value: `number` ### ProductVariantDetailsConfigurationApi ### data value: `{ variant: ProductVariant; app: { launchUrl: string; applicationUrl: string; }; }` - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } - ProductVariant: interface ProductVariant { id: string; sku: string; barcode: string; title: string; displayName: string; price: string; compareAtPrice: string; taxable: boolean; taxCode: string; weight: number; selectedOptions: { name: string; value: string; }[]; productVariantComponents: ProductVariantComponent[]; } ### extension value: `{ target: ExtensionTarget; }` - ExtensionTarget: keyof ExtensionTargets The identifier of the running extension target. ### i18n value: `I18n` - I18n: export interface I18n { /** * Returns a localized number. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `decimal` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatNumber: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized currency value. * * This function behaves like the standard `Intl.NumberFormat()` * with a style of `currency` applied. It uses the buyer's locale by default. * * @param options.inExtensionLocale - if true, use the extension's locale */ formatCurrency: ( number: number | bigint, options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, ) => string; /** * Returns a localized date value. * * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses * the buyer's locale by default. Formatting options can be passed in as * options. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options * * @param options.inExtensionLocale - if true, use the extension's locale */ formatDate: ( date: Date, options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, ) => string; /** * Returns translated content in the buyer's locale, * as supported by the extension. * * - `options.count` is a special numeric value used in pluralization. * - The other option keys and values are treated as replacements for interpolation. * - If the replacements are all primitives, then `translate()` returns a single string. * - If replacements contain UI components, then `translate()` returns an array of elements. */ translate: I18nTranslate; } Utilities for translating content according to the current localization of the admin. More info - https://shopify.dev/docs/apps/checkout/best-practices/localizing-ui-extensions ### intents value: `Intents` - Intents: export interface Intents { /** * The URL that was used to launch the intent. */ launchUrl?: string | URL; } Provides information to the receiver the of an intent. ### navigation value: `Navigation` - Navigation: export interface Navigation { /** * A method to navigate to a specific route. */ navigate: (url: string | URL) => void; } Provides methods to navigate to other features in the Admin. ### query value: `(query: string, options?: { variables?: Variables; version?: Omit; }) => Promise<{ data?: Data; errors?: GraphQLError[]; }>` - Data: export interface Data { /** * Information about the currently viewed or selected items. */ selected: {id: string}[]; } - ApiVersion: '2023-04' | '2023-07' | '2023-10' | 'unstable' Used to query the Admin GraphQL API ### ProductVariant ### id value: `string` ### sku value: `string` ### barcode value: `string` ### title value: `string` ### displayName value: `string` ### price value: `string` ### compareAtPrice value: `string` ### taxable value: `boolean` ### taxCode value: `string` ### weight value: `number` ### selectedOptions value: `{ name: string; value: string; }[]` ### productVariantComponents value: `ProductVariantComponent[]` - Product: interface Product { id: string; title: string; handle: string; status: 'ACTIVE' | 'ARCHIVED' | 'DRAFT'; totalVariants: number; totalInventory: number; hasOnlyDefaultVariant: boolean; onlineStoreUrl?: string; options: { id: string; name: string; position: number; values: string[]; }[]; productType: string; productCategory?: string; productComponents: ProductComponent[]; } - ProductVariant: interface ProductVariant { id: string; sku: string; barcode: string; title: string; displayName: string; price: string; compareAtPrice: string; taxable: boolean; taxCode: string; weight: number; selectedOptions: { name: string; value: string; }[]; productVariantComponents: ProductVariantComponent[]; } - ProductVariantComponent: export interface ProductVariantComponent { id: string; displayName: string; title: string; sku?: string; image?: { id?: string | null; url?: string | null; altText?: string | null; } | null; productVariantUrl: string; selectedOptions: { name: string; value: string; }[]; } ### ProductVariantComponent ### id value: `string` ### displayName value: `string` ### title value: `string` ### sku value: `string` ### image value: `{ id?: string; url?: string; altText?: string; }` ### productVariantUrl value: `string` ### selectedOptions value: `{ name: string; value: string; }[]`