Skip to content

Beta

Diese App-Bridge-Komponenten sind neu, und ihre API kann sich während der Beta in einem Minor-Release ändern. Ihr Verhalten wird von einer lokalen E2E-Suite in einem echten Shopify-Adminbereich geprüft. Wenn etwas nicht funktioniert, eröffnen Sie bitte ein Issue.

Geräte- und Plattformintegration ​

Die APIs, die Shopify unter Geräte- und Plattformintegration führt, und die Typen, die nur sie verwenden. Auf dieser Seite: PosApi, ScannerApi, WebVitalsApi.

PosApi ​

interface

cart: PosCart

Provides methods to read and modify the current POS cart, including line items, discounts, customers, and properties.

close: PosClose

Closes the app and returns to the POS screen.

device: PosDevice

Returns information about the POS device, including its name and serial number. Rejects when the host does not answer, or answers without a device.

location: PosLocation

Returns information about the current POS location, including its ID, name, address, and status. Rejects when the host does not answer, or answers without a location.

PosCart ​

type
ts
type PosCart = Required<_PosCart>;

Verweist auf: _PosCartVerwendet in: PosApi

PosClose ​

function
ts
type PosClose = () => Promise<void>;

Verwendet in: PosApi

PosDevice ​

function
ts
type PosDevice = () => Promise<Device>;

Verweist auf: DeviceVerwendet in: PosApi

PosLocation ​

function
ts
type PosLocation = () => Promise<Location>;

Verweist auf: LocationVerwendet in: PosApi

_PosCart ​

interface

fetch?(): Promise<Cart>

Fetch the current cart.

subscribe?(onSubscribe: CartSubscriber): Unsubscribe

Subscribe the cart changes.

setCustomer?(customer: Customer): Promise<void>

Add a new or existing customer to the cart.

removeCustomer?(): Promise<void>

Remove the current customer from the cart.

addAddress?(address: Address): Promise<void>

Add a new address to a customer.

updateAddress?(index: number, address: Address): Promise<void>

Update an address for a customer.

applyCartDiscount?(type: DiscountType, discountDescription: string, amount: string): Promise<void>

Apply a percentage or fixed amount discount to the whole cart.

applyCartCodeDiscount?(code: string): Promise<void>

Apply a code discount to the whole cart.

removeCartDiscount?(): Promise<void>

Remove the discount applied to the whole cart.

removeAllDiscounts?(disableAutomaticDiscounts: boolean): Promise<void>

Clears all applied discounts from the cart and optionally disables automatic discounts.

addCartProperties?(properties: Record<string, string>): Promise<void>

Add properties for the cart.

removeCartProperties?(keys: string[]): Promise<void>

Remove properties from the cart.

addCustomSale?(customSale: CustomSale): Promise<void>

Add custom sale for the cart.

clear?(): Promise<void>

Clear all contents from the cart.

addLineItem?(variantId: number, quantity: number): Promise<void>

Add a product to the cart.

updateLineItem?(uuid: string, quantity: number): Promise<void>

Make changes to a line item in the cart.

removeLineItem?(uuid: string): Promise<void>

Remove a line item in the cart.

setLineItemDiscount?(uuid: string, type: DiscountType, discountDescription: string, amount: string): Promise<void>

Apply a discount to a line item.

removeLineItemDiscount?(uuid: string): Promise<void>

Remove a discount from a line item.

addLineItemProperties?(uuid: string, properties: Record<string, string>): Promise<void>

Add properties to a line item.

removeLineItemProperties?(uuid: string, properties: string[]): Promise<void>

Remove properties from a line item.

Verwendet in: PosCart

Device ​

interface

name: string

The name of the device.

serialNumber: string

The unique ID associated device ID and app ID..

Verwendet in: PosDevice

Location ​

interface

id: number

The ID of current location.

active: boolean

The status of current location.

name: string

The name of current location.

locationType?: string

The type of current location.

address1?: string

The primary address of current location.

address2?: string

Any extra information associated with the address (Apartment #, Suite #, Unit #, etc.).

zip?: string

The ZIP or postal code of the address.

city?: string

The name of the city.

province?: string

TThe province or state of the address.

countryCode?: string

The Country Code in ISO 3166-1 (alpha-2) format.

countryName?: string

The country of the address.

phone?: string

The phone number of the location.

Verwendet in: PosLocation

Address ​

interface

address1?: string

The customer's primary address.

address2?: string

Any extra information associated with the address (Apartment #, Suite #, Unit #, etc.).

city?: string

The name of the customer's city.

company?: string

The company name associated with address.

firstName?: string

The first name of the customer.

lastName?: string

The last name of the customer.

phone?: string

The phone number of the customer.

province?: string

The province or state of the address.

country?: string

The country of the address.

zip?: string

The ZIP or postal code of the address.

name?: string

The name of the address.

provinceCode?: string

The acronym of the province or state.

countryCode?: string

The Country Code in ISO 3166-1 (alpha-2) format.

Verwendet in: _PosCart

Cart ​

interface

subTotal: string

The total cost of the current cart including discounts, but before taxes and shipping. Value is based on the shop's existing currency settings.

taxTotal: string

The sum of taxes for the current cart. Value is based on the shop's existing currency settings.

grandTotal: string

The total cost of the current cart, after taxes and discounts have been applied. Value is based on the shop's existing currency settings.

cartDiscount?: Discount

The current discount applied to the entire cart.

cartDiscounts?: Discount[]

All current discounts applied to the entire cart and line items.

customer?: Customer

The customer associated to the current cart.

lineItems: LineItem[]

A list of lineItem objects.

properties: Record<string, string>

A list of objects containing cart properties.

Verwendet in: CartSubscriber, _PosCart

CartSubscriber ​

function
ts
type CartSubscriber = (cart: Cart) => void;

Verweist auf: CartVerwendet in: _PosCart

Customer ​

interface

id: number

The ID of existing customer.

email?: string

The email for a new customer.

firstName?: string

The first name for new customer.

lastName?: string

The last name for new customer.

note?: string

The note for new customer.

Verwendet in: Cart, _PosCart

CustomSale ​

interface

price: number

Price of line item

quantity: number

Quantity of line item.

title: string

Title of line item.

taxable: boolean

If line item charges tax.

Verwendet in: _PosCart

DiscountType ​

type
ts
type DiscountType = "Percentage" | "FixedAmount";

Verwendet in: Discount, _PosCart

Unsubscribe ​

function
ts
type Unsubscribe = () => void;

Verwendet in: _PosCart

Discount ​

interface

amount: number

Amount of discount. Only for fixed or percentage discounts.

discountDescription?: string

Description of discount.

type: DiscountType

Type of discount.

Verwendet in: Cart, LineItem

LineItem ​

interface

uuid: string

Unique id of line item

price?: number

Price of line item

quantity: number

Quantity of line item.

title?: string

Title of line item.

variantId?: number

Variant identifier for line item.

productId?: number

Product identifier for line item.

discounts: Discount[]

Discount applied to line item.

taxable: boolean

If line item charges tax.

sku?: string

Stock keeping unit of the line item.

vendor?: string

Vendor of line item.

properties: { [key: string]: string; }

Properties of the line item.

isGiftCard: boolean

If the line item is a gift card.

Verwendet in: Cart

ScannerApi ​

interface

capture(): Promise<ScannerPayload>

Opens the device camera to scan a barcode. Returns a Promise that resolves to a ScannerPayload containing the scanned data. A new call to capture rejects a pending call with an AbortError.

ScannerPayload ​

interface

data: string

The scanned barcode data as a string.

Verwendet in: useAppBridge(), ScannerApi

WebVitalsApi ​

interface

onReport?: (callback: WebVitalsCallback | null) => Promise<void>

Registers a callback to receive Web Vitals performance data. Pass null to unregister a previously registered callback.

WebVitalsCallback ​

function
ts
type WebVitalsCallback = (payload: WebVitalsReport) => void | Promise<void>;

Verweist auf: WebVitalsReportVerwendet in: WebVitalsApi

WebVitalsReport ​

interface

metrics: WebVitalsMetric[]

The array of Web Vitals metric measurements included in this report.

Verwendet in: WebVitalsCallback

WebVitalsMetric ​

interface

id: string

A unique identifier for this metric measurement instance.

name: string

The name of the metric, such as LCP, FCP, CLS, INP, or TTFB.

value: number

The measured value of the metric. Units depend on the metric name (milliseconds for timing metrics, unitless for CLS).

country?: string

The country code where the metric was collected, if available.

version?: string

The App Bridge build version that produced the metric, in the form <package-version> or <package-version>+<short-commit-sha>. Used to attribute reports to a specific deploy.

Verwendet in: WebVitalsReport

Veröffentlicht unter der MIT-Lizenz. Vue-Logo von Evan You, CC BY-NC-SA 4.0.