You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Component prop descriptions
Component descriptions in index page cards
Event data descriptions
Type descriptions
component descriptions
lint
Prop description fixes
Additional context in descriptions
contractions
break up longer descs
remove enhanced / improved language
* Represents a read-only value managed on the main thread that an extension can subscribe to.
944
-
*
945
-
* Example: Checkout uses this to manage the state of an object and
946
-
* communicate state changes to extensions running in a sandboxed web worker.
947
-
*
948
-
* This interface is compatible with [Preact's ReadonlySignal](https://github.com/preactjs/signals/blob/a023a132a81bd4ba4a0bebb8cbbeffbd8c8bbafc/packages/core/src/index.ts#L700-L709).
943
+
* Represents a reactive signal interface that provides both immediate value access and subscription-based updates. Enables real-time synchronization with changing data through the observer pattern.
949
944
*
945
+
* This interface is compatible with [Preact's `ReadonlySignal`](https://github.com/preactjs/signals/blob/a023a132a81bd4ba4a0bebb8cbbeffbd8c8bbafc/packages/core/src/index.ts#L700-L709), allowing integration with Preact's reactive primitives.
950
946
*/
951
947
exportinterfaceReadonlySignalLike<T>{
948
+
/**
949
+
* The current value of the signal at this moment in time. This property provides immediate, synchronous access to the current state without requiring subscription setup or callbacks.
950
+
*
951
+
* The value is read-only—it cannot be modified directly and changes only through the underlying data source (for example, when locale changes, connectivity state toggles, or cart updates occur). Reading this property does not trigger any side effects or subscriptions—it simply returns the current value.
952
+
*
953
+
* Commonly accessed for one-time value checks, initial setup, synchronous conditional logic, or when subscriptions aren't needed (for example, reading current locale once during initialization, checking connectivity status before an operation, or displaying current cart total in a snapshot).
954
+
*/
952
955
readonlyvalue: T;
956
+
/**
957
+
* Subscribes to value changes and executes the provided callback function whenever the underlying value updates. The callback receives the new value as its parameter and is invoked immediately with the current value upon subscription, then again each time the value changes thereafter.
958
+
*
959
+
* Returns a cleanup function that, when called, unsubscribes from further updates and prevents memory leaks. The cleanup function should be called when the component unmounts, the subscription is no longer needed, or when setting up a new subscription to replace the old one.
960
+
*
961
+
* Subscriptions are passive—they don't trigger changes, only react to them. Multiple subscriptions can exist simultaneously, each receiving updates independently. Commonly used to automatically update UI when data changes (reactive rendering), implement event-driven logic, keep multiple parts of the extension synchronized, or respond to external state changes without polling.
Copy file name to clipboardExpand all lines: packages/ui-extensions/src/surfaces/point-of-sale/api/action-api/action-api.ts
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
exportinterfaceActionApiContent{
2
-
/** Presents the `action-overlay.render` extension target on top of present view.
2
+
/**
3
+
* Presents the corresponding action (modal) target extension target as a full-screen modal overlay on top of the current view. The modal target is automatically determined based on the current extension point—for example, calling this from `pos.purchase.post.action.menu-item.render` presents the `pos.purchase.post.action.render` modal target.
3
4
*
4
-
* For example: if we are calling presentModal() from pos.purchase.post.action.menu-item.render,
5
-
* it should present pos.purchase.post.action.render.
5
+
* The modal appears with a standard header (typically including a close button and title), occupies the full screen with proper backdrop/overlay, and blocks interaction with the underlying content until dismissed. The modal can be closed programmatically using `window.close()` or by the user dismissing it through UI controls. The method returns immediately without waiting for modal dismissal.
6
+
*
7
+
* Commonly used to launch detailed workflows requiring full screen space (multi-step wizards, complex forms, detailed product configuration), display rich content (product galleries, reports, charts), or present flows that need user focus without distractions from the main POS interface.
6
8
*/
7
9
presentModal(): void;
8
10
}
9
11
10
12
/**
11
-
* Access the Action API to present your app in a full screen modal.
13
+
* The `ActionApi` object provides methods for presenting modal interfaces. Access these methods through `shopify.action` to launch full-screen modal experiences.
Copy file name to clipboardExpand all lines: packages/ui-extensions/src/surfaces/point-of-sale/api/cart-api/cart-api.ts
+38-33Lines changed: 38 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -11,31 +11,38 @@ import type {
11
11
}from'../../types/cart';
12
12
13
13
/**
14
-
* Access and modify the merchant’s current cart.
14
+
* The `CartApi` object provides access to cart management functionality and real-time cart state monitoring. Access these properties through `shopify.cart` to interact with the current POS cart.
15
15
*/
16
16
exportinterfaceCartApi{
17
17
cart: CartApiContent;
18
18
}
19
19
20
+
/**
21
+
* Defines the type of discount applied at the cart level. Specifies whether the discount is percentage-based, fixed amount, or discount code redemption.
* Provides read-only access to the current cart state and allows subscribing to cart changes.
27
-
* The `value` property provides the current cart state, and `subscribe` allows listening to changes.
32
+
* Provides read-only access to the current cart state and allows subscribing to cart changes. The `value` property provides the current cart state, and `subscribe` allows listening to changes.
28
33
*/
29
34
current: ReadonlySignalLike<Cart>;
30
35
31
-
/** Bulk update the cart
36
+
/**
37
+
* Perform a bulk update of the entire cart state including note, discounts, customer, line items, and properties. Returns the updated cart object after the operation completes.
* Apply a cart-level discount with the specified type (`'Percentage'`, `'FixedAmount'`, or `'Code'`), title, and optional amount. For discount codes, omit the `amount` parameter. Enhanced validation ensures proper discount application.
39
46
*
40
47
* @param type the type of discount applied (example: 'Percentage')
41
48
* @param title the title attributed with the discount
* Apply a discount code to the cart. The system will validate the code and apply the appropriate discount if the code is valid and applicable to the current cart contents.
52
59
*
53
60
* @param code the code for the discount to add to the cart
54
61
*/
55
62
addCartCodeDiscount(code: string): Promise<void>;
56
63
57
64
/**
58
-
* Remove the cart discount
65
+
* Remove the current cart-level discount. This only affects cart-level discounts and doesn't impact line item discounts or automatic discount eligibility.
59
66
*/
60
67
removeCartDiscount(): Promise<void>;
61
68
62
69
/**
63
-
* Remove all cart and line item discounts
70
+
* Remove all discounts from both the cart and individual line items. Set `disableAutomaticDiscounts` to `true` to prevent automatic discounts from being reapplied after removal.
64
71
*
65
72
* @param disableAutomaticDiscounts Whether or not automatic discounts should be enabled after removing the discounts.
* Remove all line items and reset the cart to an empty state. This action can't be undone and will clear all cart contents including line items, discounts, properties, and selling plans.
71
78
*/
72
79
clearCart(): Promise<void>;
73
80
74
81
/**
75
-
* Set the customer in the cart
82
+
* Associate a customer with the current cart using the customer object containing the customer `ID`. This enables customer-specific pricing, discounts, and checkout features with customer data validation.
76
83
*
77
84
* @param customer the customer object to add to the cart
78
85
*/
79
86
setCustomer(customer: Customer): Promise<void>;
80
87
81
88
/**
82
-
* Remove the current customer from the cart
89
+
* Remove the currently associated customer from the cart, converting it back to a guest cart without customer-specific benefits or information while preserving cart contents.
83
90
*/
84
91
removeCustomer(): Promise<void>;
85
92
86
93
/**
87
-
* Add a custom sale to the cart
94
+
* Add a custom sale item to the cart with specified quantity, title, price, and taxable status. Returns the [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) of the created line item for future operations and property management.
88
95
*
89
96
* @param customSale the custom sale object to add to the cart
90
-
* @returns {string} the uuid of the line item added
97
+
* @returns {string} the UUID of the line item added
* Returns the uuid of the line item added, or the empty string if the user dismissed an oversell guard modal without adding anything.
97
-
* Throws if POS fails to add the line item. Throws if POS fails to add the line item.
102
+
* Add a product variant to the cart by its numeric `ID` with the specified quantity. Returns the [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) of the newly added line item, or an empty string if the user dismissed an oversell guard modal. Throws an error if POS fails to add the line item due to validation or system errors.
98
103
*
99
104
* @param variantId the product variant's numeric ID to add to the cart
100
105
* @param quantity the number of this variant to add to the cart
101
-
* @returns {string} the uuid of the line item added, or the empty string if the user dismissed an oversell guard modal
106
+
* @returns {string} the UUID of the line item added, or the empty string if the user dismissed an oversell guard modal
102
107
* @throws {Error} if POS fails to add the line item
* Remove a specific line item from the cart using its [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). The line item will be completely removed from the cart along with any associated discounts, properties, or selling plans.
108
113
*
109
114
* @param uuid the uuid of the line item that should be removed
110
115
*/
111
116
removeLineItem(uuid: string): Promise<void>;
112
117
113
118
/**
114
-
* Adds custom properties to the cart
119
+
* Add custom key-value properties to the cart for storing metadata, tracking information, or integration data. Properties are merged with existing cart properties.
115
120
*
116
121
* @param properties the custom key to value object to attribute to the cart
* Adds custom properties to the specified line item
133
+
* Add custom properties to a specific line item using its [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). Properties are merged with existing line item properties for metadata storage and tracking.
129
134
*
130
135
* @param uuid the uuid of the line item to which the properties should be stringd
131
136
* @param properties the custom key to value object to attribute to the line item
* Adds custom properties to multiple line items at the same time.
144
+
* Add properties to multiple line items simultaneously using an array of inputs containing line item [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) and their respective properties for efficient bulk operations.
140
145
*
141
146
* @param lineItemProperties the collection of custom line item properties to apply to their respective line items.
* Remove specific properties from a line item by `UUID` and property keys. Only the specified keys will be removed while other properties remain intact.
149
154
*
150
155
* @param uuid the uuid of the line item to which the properties should be removed
151
156
* @param keys the collection of keys to be removed from the line item properties
* Apply a discount to a specific line item using its [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). Specify the discount type (`'Percentage'` or `'FixedAmount'`), title, and amount value.
157
162
*
158
163
* @param uuid the uuid of the line item that should receive a discount
159
164
* @param type the type of discount applied (example: 'Percentage')
* Set line item discounts to multiple line items at the same time.
176
+
* Apply discounts to multiple line items simultaneously. Each input specifies the line item `UUID` and discount details for efficient bulk discount operations.
172
177
*
173
178
* @param lineItemDiscounts a map of discounts to add. They key is the uuid of the line item you want to add the discount to. The value is the discount input.
* Sets an attributed staff to all line items in the cart.
185
+
* Set the attributed staff member for all line items in the cart using the staff `ID`. Pass `undefined` to clear staff attribution from all line items.
181
186
*
182
187
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff from all line items.
* Sets an attributed staff to a specific line items in the cart.
192
+
* Set the attributed staff member for a specific line item using the staff `ID` and line item `UUID`. Pass `undefined` as `staffId` to clear attribution from the line item.
188
193
*
189
194
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff on the line item.
* Remove all discounts from a specific line item identified by its `UUID`. This will clear any custom discounts applied to the line item while preserving discount allocation history.
199
204
*
200
205
* @param uuid the uuid of the line item whose discounts should be removed
* Add an address to the customer (Customer must be present)
210
+
* Add a new address to the customer associated with the cart. The customer must be present in the cart before adding addresses.
206
211
*
207
212
* @param address the address object to add to the customer in cart
208
213
*/
209
214
addAddress(address: Address): Promise<void>;
210
215
211
216
/**
212
-
* Delete an address from the customer (Customer must be present)
217
+
* Delete an existing address from the customer using the address `ID`. The customer must be present in the cart to perform this operation.
213
218
*
214
219
* @param addressId the address ID to delete
215
220
*/
216
221
deleteAddress(addressId: number): Promise<void>;
217
222
218
223
/**
219
-
* Update the default address for the customer (Customer must be present)
224
+
* Set a specific address as the default address for the customer using the address `ID`. The customer must be present in the cart to update the default address.
220
225
*
221
226
* @param addressId the address ID to set as the default address
* Add a selling plan to a line item in the cart using the line item `UUID` and selling plan `ID`. Optionally provide the selling plan name, otherwise POS will fetch it after syncing the cart.
227
232
*
228
233
* @param uuid the uuid of the line item that should receive the selling plan
229
234
* @param sellingPlanId the ID of the selling plan to add to the line item
* Remove the selling plan from a line item in the cart.
239
+
* Remove the selling plan from a line item in the cart using the line item `UUID`. This will clear any subscription or recurring purchase configuration from the line item.
235
240
*
236
241
* @param uuid the uuid of the line item whose selling plan should be removed
* Access to the selected line item in the merchant’s current cart.
4
+
* The `CartLineItemApi` object provides access to the current cart line item in line item-specific extension contexts. Access this property through `shopify.cartLineItem` to retrieve detailed information about the specific cart line item currently being viewed or interacted with.
5
5
*/
6
6
exportinterfaceCartLineItemApi{
7
7
/**
8
-
* The selected line item in the merchant’s current cart.
8
+
* The complete line item object representing the selected item in the merchant's current cart. Contains all line item data including product identification (`productId`, `variantId`), display information (`title`, `vendor`, `sku`), pricing details (`price`), quantity, tax information (`taxable`, `taxLines`), applied discounts (`discounts`, `discountAllocations`), custom properties (`properties`), selling plan configuration (`sellingPlan`), and unique identifier (`uuid`).
9
+
*
10
+
* This represents the line item's current state at the moment the extension is triggered, reflecting all modifications, discounts, and properties. The line item object is read-only in this context—modifications should be made through the Cart API methods using the line item's `uuid`.
11
+
*
12
+
* Commonly used for displaying detailed item information, implementing item-specific business logic (restrictions, validations, special handling), showing custom line item properties, calculating item-level totals with discounts, or building line item configuration interfaces.
0 commit comments