Skip to content

Commit 81b1119

Browse files
committed
Improved API and prop descriptions fo 2025-10
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
1 parent 78318cc commit 81b1119

File tree

107 files changed

+4188
-3068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+4188
-3068
lines changed

packages/ui-extensions/src/shared.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,25 @@ export interface GraphQLError {
940940
}
941941

942942
/**
943-
* 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.
949944
*
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.
950946
*/
951947
export interface ReadonlySignalLike<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+
*/
952955
readonly value: 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.
962+
*/
953963
subscribe(fn: (value: T) => void): () => void;
954964
}

packages/ui-extensions/src/surfaces/point-of-sale/api/action-api/action-api.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
export interface ActionApiContent {
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.
34
*
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.
68
*/
79
presentModal(): void;
810
}
911

1012
/**
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.
1214
*/
1315
export interface ActionApi {
1416
action: ActionApiContent;

packages/ui-extensions/src/surfaces/point-of-sale/api/cart-api/cart-api.ts

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,38 @@ import type {
1111
} from '../../types/cart';
1212

1313
/**
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.
1515
*/
1616
export interface CartApi {
1717
cart: CartApiContent;
1818
}
1919

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.
22+
*/
2023
export type CartDiscountType = 'Percentage' | 'FixedAmount' | 'Code';
2124

25+
/**
26+
* Defines the type of discount applied to individual line items. Specifies whether the discount is percentage-based or a fixed amount reduction.
27+
*/
2228
export type LineItemDiscountType = 'Percentage' | 'FixedAmount';
2329

2430
export interface CartApiContent {
2531
/**
26-
* 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.
2833
*/
2934
current: ReadonlySignalLike<Cart>;
3035

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.
3238
*
3339
* @param cartState the cart state to set
3440
* @returns the updated cart
3541
*/
3642
bulkCartUpdate(cartState: CartUpdateInput): Promise<Cart>;
3743

38-
/** Apply a cart level discount
44+
/**
45+
* 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.
3946
*
4047
* @param type the type of discount applied (example: 'Percentage')
4148
* @param title the title attributed with the discount
@@ -48,84 +55,82 @@ export interface CartApiContent {
4855
): Promise<void>;
4956

5057
/**
51-
* Add a code discount to the cart
58+
* 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.
5259
*
5360
* @param code the code for the discount to add to the cart
5461
*/
5562
addCartCodeDiscount(code: string): Promise<void>;
5663

5764
/**
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.
5966
*/
6067
removeCartDiscount(): Promise<void>;
6168

6269
/**
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.
6471
*
6572
* @param disableAutomaticDiscounts Whether or not automatic discounts should be enabled after removing the discounts.
6673
*/
6774
removeAllDiscounts(disableAutomaticDiscounts: boolean): Promise<void>;
6875

6976
/**
70-
* Clear the cart
77+
* 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.
7178
*/
7279
clearCart(): Promise<void>;
7380

7481
/**
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.
7683
*
7784
* @param customer the customer object to add to the cart
7885
*/
7986
setCustomer(customer: Customer): Promise<void>;
8087

8188
/**
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.
8390
*/
8491
removeCustomer(): Promise<void>;
8592

8693
/**
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.
8895
*
8996
* @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
9198
*/
9299
addCustomSale(customSale: CustomSale): Promise<string>;
93100

94101
/**
95-
* Add a line item by variant ID to the cart.
96-
* 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.
98103
*
99104
* @param variantId the product variant's numeric ID to add to the cart
100105
* @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
102107
* @throws {Error} if POS fails to add the line item
103108
*/
104109
addLineItem(variantId: number, quantity: number): Promise<string>;
105110

106111
/**
107-
* Remove the line item at this uuid from the cart
112+
* 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.
108113
*
109114
* @param uuid the uuid of the line item that should be removed
110115
*/
111116
removeLineItem(uuid: string): Promise<void>;
112117

113118
/**
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.
115120
*
116121
* @param properties the custom key to value object to attribute to the cart
117122
*/
118123
addCartProperties(properties: Record<string, string>): Promise<void>;
119124

120125
/**
121-
* Removes the specified cart properties
126+
* Remove specific cart properties by their keys. Only the specified property keys will be removed while other properties remain intact.
122127
*
123128
* @param keys the collection of keys to be removed from the cart properties
124129
*/
125130
removeCartProperties(keys: string[]): Promise<void>;
126131

127132
/**
128-
* 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.
129134
*
130135
* @param uuid the uuid of the line item to which the properties should be stringd
131136
* @param properties the custom key to value object to attribute to the line item
@@ -136,7 +141,7 @@ export interface CartApiContent {
136141
): Promise<void>;
137142

138143
/**
139-
* 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.
140145
*
141146
* @param lineItemProperties the collection of custom line item properties to apply to their respective line items.
142147
*/
@@ -145,15 +150,15 @@ export interface CartApiContent {
145150
): Promise<void>;
146151

147152
/**
148-
* Removes the specified line item properties
153+
* Remove specific properties from a line item by `UUID` and property keys. Only the specified keys will be removed while other properties remain intact.
149154
*
150155
* @param uuid the uuid of the line item to which the properties should be removed
151156
* @param keys the collection of keys to be removed from the line item properties
152157
*/
153158
removeLineItemProperties(uuid: string, keys: string[]): Promise<void>;
154159

155160
/**
156-
* Add a discount on a line item to the cart
161+
* 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.
157162
*
158163
* @param uuid the uuid of the line item that should receive a discount
159164
* @param type the type of discount applied (example: 'Percentage')
@@ -168,7 +173,7 @@ export interface CartApiContent {
168173
): Promise<void>;
169174

170175
/**
171-
* 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.
172177
*
173178
* @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.
174179
*/
@@ -177,14 +182,14 @@ export interface CartApiContent {
177182
): Promise<void>;
178183

179184
/**
180-
* 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.
181186
*
182187
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff from all line items.
183188
*/
184189
setAttributedStaff(staffId: number | undefined): Promise<void>;
185190

186191
/**
187-
* 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.
188193
*
189194
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff on the line item.
190195
* @param lineItemUuid the UUID of the line item.
@@ -195,43 +200,43 @@ export interface CartApiContent {
195200
): Promise<void>;
196201

197202
/**
198-
* Remove all discounts from a line item
203+
* 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.
199204
*
200205
* @param uuid the uuid of the line item whose discounts should be removed
201206
*/
202207
removeLineItemDiscount(uuid: string): Promise<void>;
203208

204209
/**
205-
* 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.
206211
*
207212
* @param address the address object to add to the customer in cart
208213
*/
209214
addAddress(address: Address): Promise<void>;
210215

211216
/**
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.
213218
*
214219
* @param addressId the address ID to delete
215220
*/
216221
deleteAddress(addressId: number): Promise<void>;
217222

218223
/**
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.
220225
*
221226
* @param addressId the address ID to set as the default address
222227
*/
223228
updateDefaultAddress(addressId: number): Promise<void>;
224229

225230
/**
226-
* Add a selling plan to a line item in the cart.
231+
* 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.
227232
*
228233
* @param uuid the uuid of the line item that should receive the selling plan
229234
* @param sellingPlanId the ID of the selling plan to add to the line item
230235
*/
231236
addLineItemSellingPlan(input: SetLineItemSellingPlanInput): Promise<void>;
232237

233238
/**
234-
* 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.
235240
*
236241
* @param uuid the uuid of the line item whose selling plan should be removed
237242
*/
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import type {LineItem} from '../../types/cart';
22

33
/**
4-
* 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.
55
*/
66
export interface CartLineItemApi {
77
/**
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.
913
*/
1014
cartLineItem: LineItem;
1115
}

0 commit comments

Comments
 (0)