Skip to content

Commit 3c6c21b

Browse files
authored
Merge pull request #3082 from Shopify/vic/backfill-editable
Backfill editable changes to 2025-10
2 parents 2c91fe4 + 3be73c4 commit 3c6c21b

File tree

6 files changed

+132
-86
lines changed

6 files changed

+132
-86
lines changed

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/cart-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ The Cart API enables UI Extensions to manage and interact with POS cart contents
4545
'subscribable',
4646
),
4747
},
48+
{
49+
codeblock: generateCodeBlockForCartApi(
50+
'Check editable state of the cart',
51+
'check-cart-editable',
52+
),
53+
},
4854
{
4955
codeblock: generateCodeBlockForCartApi(
5056
'Apply a cart level discount',
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {Cart, Tile, extension} from '@shopify/ui-extensions/point-of-sale';
2+
3+
export default extension('pos.home.tile.render', (root, api) => {
4+
const tile = root.createComponent(Tile, {
5+
title: 'My App',
6+
enabled: api.cart.subscribable.initial.editable ?? true,
7+
});
8+
9+
api.cart.subscribable.subscribe((newCart: Cart) => {
10+
tile.updateProps({
11+
enabled: newCart.editable ?? true
12+
});
13+
});
14+
15+
root.append(tile);
16+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import {
3+
reactExtension,
4+
Tile,
5+
useApi,
6+
useCartEditable,
7+
} from '@shopify/ui-extensions-react/point-of-sale';
8+
9+
const SmartGridTile = () => {
10+
const editable = useCartEditable();
11+
12+
return <Tile title="My App" enabled={editable} />;
13+
};
14+
15+
export default reactExtension('pos.home.tile.render', () => <SmartGridTile />);

packages/ui-extensions/docs/surfaces/point-of-sale/staticPages/pages/versions.doc.ts

Lines changed: 74 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,80 @@ const data: LandingTemplateSchema = {
1515
sections: [
1616
{
1717
type: 'Generic',
18-
anchorLink: 'support-policy',
19-
title: 'Support Policy',
20-
sectionContent: '',
21-
sectionNotice: [
22-
{
23-
title: 'End of Support Plan',
24-
type: 'Warning',
25-
sectionContent: `
26-
To ensure the best possible ongoing POS UI Extension development experience, starting in April 2025, we will end support for versions on a one-year rolling basis. This table details the end of support schedule.
27-
28-
|released version|removed versions|
29-
|---:|---|
30-
|2025-04|1.0.0, 1.0.1, 1.1.2, 1.2.0, 1.3.0, 1.4.0, 1.5.1, 1.6.0, 1.7.0, 2024-04|
31-
|2025-07|2024-07|
32-
|2025-10|2024-10|
33-
|2026-01|2025-01|
34-
|2026-04|2025-04|
35-
36-
Refer to the [migration guide](/docs/api/pos-ui-extensions/migrating) for more information.`,
37-
},
38-
],
18+
anchorLink: '202507',
19+
title: '2025.07',
20+
sectionContent: `
21+
- Added in POS version: 10.6
22+
- Release day: 07/03/2025
23+
24+
## Breaking Changes
25+
26+
- Removed the deprecated \`FormattedTextField\` component. Use the [TextField](/docs/api/pos-ui-extensions/components/textfield) component instead. It will continue to work in POS 10.6.0, but will no longer function in POS 10.7.0.
27+
28+
## Deprecations
29+
30+
- Deprecated \`'minor'\`, \`'major'\`, \`'spot'\`, \`'caption'\`, \`'badge'\` as values for the \`size\` prop in the [Icon](/docs/api/pos-ui-extensions/components/icon) component. Use \`'s'\`, \`'m'\`, \`'l'\`, \`'xl'\` instead.
31+
- Deprecated \`'arrow'\`, \`'available-at-other-locations'\`, \`'collections'\`, \`'connectivity-warning'\`, \`'delivery'\`, \`'home'\`, \`'image-placeholder'\`, \`'internet'\`, \`'menu'\`, \`'orders'\`, \`'products'\`, \`'shipment'\` as values for the \`name\` prop in the [Icon](/docs/api/pos-ui-extensions/components/icon) component. See valid values for [\`IconName\`](/docs/api/pos-ui-extensions/latest/components/icon#icon-propertydetail-name).
32+
33+
## Important Fixes
34+
35+
- Updated [pos.draft-order-details.block.render](https://shopify.dev/docs/api/pos-ui-extensions/targets/draft-order-details/pos-draft-order-details-block-render) to allow the proper set of components, called \`BlockComponents\`. Previously, this target erroneously accepted \`ActionComponents\`, which are intended for targets like \`pos.draft-order-details.action.render\`.
36+
37+
### Features
38+
39+
- Added support for [Direct API access](/docs/api/pos-ui-extensions#direct-api-access), and [authenticated requests](/docs/api/pos-ui-extensions#app-authentication).
40+
- Added required \`posVersion\` property to [Session](/docs/api/pos-ui-extensions/apis/session-api) interface.
41+
- Added optional \`currency\` property to [Discount](/docs/api/pos-ui-extensions/apis/cart-line-item-api#cartlineitemapi-propertydetail-cartlineitem) interface.
42+
- Added \`executedAt\` property to [BaseTransactionComplete](/docs/api/pos-ui-extensions/targets/receipts/pos-receipt-footer-block-render#transactioncompletewithreprintdata-propertydetail-transaction) interface.
43+
- Added optional \`exchangeId\` and \`returnId\` property to [ReturnTransactionData](/docs/api/pos-ui-extensions/targets/receipts/pos-receipt-footer-block-render#transactioncompletewithreprintdata-propertydetail-transaction) interface.
44+
- Added required \`variantId\` property to [ProductApi](/docs/api/pos-ui-extensions/apis/product-api#productapi-propertydetail-variantid) interface.
45+
- Added optional \`taxLines\` property to [ShippingLine](/docs/api/pos-ui-extensions/targets/post-transaction/pos-transaction-complete-event-observe#transactioncompletedata-propertydetail-transaction) interface.
46+
- Added optional \`onBlur\` handler to [SearchBar](/docs/api/pos-ui-extensions/components/searchbar) component.
47+
- Added optional \`tone\` property to [Icon](/docs/api/pos-ui-extensions/components/icon) component and expanded \`name\` and \`size\` options.
48+
- Added optional \`editable\` property to \`Cart\` interface.
49+
- Added \`useCartEditable\` hook to access the cart's editable state.
50+
51+
### Developer Preview
52+
53+
- Introduced a [Storage API](/docs/api/pos-ui-extensions/apis/storage-api). The Storage API gives the UI Extension access to store data on the POS device that the extension is running on.
54+
- Added support for the ${TargetLink.PosExchangePostActionMenuItemRender}, ${TargetLink.PosExchangePostActionRender}, ${TargetLink.PosExchangePostBlockRender} targets.
55+
- Added support for the ${TargetLink.PosReturnPostActionMenuItemRender}, ${TargetLink.PosReturnPostActionRender}, ${TargetLink.PosReturnPostBlockRender} targets.
56+
`,
57+
},
58+
{
59+
type: 'Generic',
60+
anchorLink: '202504',
61+
title: '2025.04',
62+
sectionContent: `
63+
- Added in POS version: 9.31
64+
- Release day: 04/01/2025
65+
66+
## Important Fixes
67+
68+
- **POS 10.3.0**:
69+
70+
- Fixed an issue where the \`TextField\` component failed to apply the \`maxLength\` parameter.
71+
72+
- **POS 10.2.0**:
73+
74+
- Fixed a sizing issue with the \`Button\` component.
75+
- Fixed an issue where the \`Section\` component was displaying a divider between child components.
76+
77+
- **POS 10.0.0**:
78+
79+
- Removed \`email\`, \`firstName\`, \`lastName\`, and \`note\` from the [Customer](/docs/api/pos-ui-extensions/apis/cart-api#customer) object.
80+
- POS UI Extensions components automatically use our new POS visual design language.
81+
82+
### Features
83+
84+
**Developer Preview**:
85+
- Added support for the ${TargetLink.PosTransactionCompleteObserve} target.
86+
- Added support for cash tracking session. ${TargetLink.PosCashTrackingSessionStartObserve}, ${TargetLink.PosCashTrackingSessionCompleteObserve} targets.
87+
- Added support for the ${TargetLink.PosCartUpdateObserve} target.
88+
- Added support for the ${TargetLink.PosReceiptFooterBlockRender} target.
89+
- Introduced a [POSReceiptBlock component](/docs/api/pos-ui-extensions/components/posreceiptblock). It's the required parent component for ${TargetLink.PosReceiptFooterBlockRender} targets.
90+
- Introduced a [QRCode component](/docs/api/pos-ui-extensions/components/qrcode). It can be used to render a QR code in POS receipts but must be within a [POSReceiptBlock component](/docs/api/pos-ui-extensions/components/posreceiptblock).
91+
`,
3992
},
4093
{
4194
type: 'Generic',

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

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,17 @@ export interface CartApiContent {
3030
subscribable: RemoteSubscribable<Cart>;
3131

3232
/** Bulk update the cart
33+
*
3334
* @param cartState the cart state to set
3435
* @returns the updated cart
35-
*
36-
* @throws CartNotEditableError if the cart is not currently editable.
3736
*/
3837
bulkCartUpdate(cartState: CartUpdateInput): Promise<Cart>;
3938

4039
/** Apply a cart level discount
40+
*
4141
* @param type the type of discount applied (example: 'Percentage')
4242
* @param title the title attributed with the discount
4343
* @param amount the percentage or fixed monetary amount deducted with the discount. Pass in `undefined` if using discount codes.
44-
*
45-
* @throws CartNotEditableError if the cart is not currently editable.
4644
*/
4745
applyCartDiscount(
4846
type: CartDiscountType,
@@ -52,98 +50,83 @@ export interface CartApiContent {
5250

5351
/**
5452
* Add a code discount to the cart
55-
* @param code the code for the discount to add to the cart
5653
*
57-
* @throws CartNotEditableError if the cart is not currently editable.
54+
* @param code the code for the discount to add to the cart
5855
*/
5956
addCartCodeDiscount(code: string): Promise<void>;
6057

6158
/**
6259
* Remove the cart discount
63-
*
64-
* @throws CartNotEditableError if the cart is not currently editable.
6560
*/
6661
removeCartDiscount(): Promise<void>;
6762

6863
/**
6964
* Remove all cart and line item discounts
70-
* @param disableAutomaticDiscounts Whether or not automatic discounts should be enabled after removing the discounts.
7165
*
72-
* @throws CartNotEditableError if the cart is not currently editable.
66+
* @param disableAutomaticDiscounts Whether or not automatic discounts should be enabled after removing the discounts.
7367
*/
7468
removeAllDiscounts(disableAutomaticDiscounts: boolean): Promise<void>;
7569

7670
/**
7771
* Clear the cart
78-
*
79-
* @throws CartNotEditableError if the cart is not currently editable.
8072
*/
8173
clearCart(): Promise<void>;
8274

8375
/**
8476
* Set the customer in the cart
85-
* @param customer the customer object to add to the cart
8677
*
87-
* @throws CartNotEditableError if the cart is not currently editable.
78+
* @param customer the customer object to add to the cart
8879
*/
8980
setCustomer(customer: Customer): Promise<void>;
9081

9182
/**
9283
* Remove the current customer from the cart
93-
*
94-
* @throws CartNotEditableError if the cart is not currently editable.
9584
*/
9685
removeCustomer(): Promise<void>;
9786

9887
/**
9988
* Add a custom sale to the cart
89+
*
10090
* @param customSale the custom sale object to add to the cart
10191
* @returns {string} the uuid of the line item added
102-
*
103-
* @throws CartNotEditableError if the cart is not currently editable.
10492
*/
10593
addCustomSale(customSale: CustomSale): Promise<string>;
10694

10795
/**
10896
* Add a line item by variant ID to the cart
97+
*
10998
* @param variantId the product variant's numeric ID to add to the cart
11099
* @param quantity the number of this variant to add to the cart
111100
* @returns {string} the uuid of the line item added
112-
*
113-
* @throws CartNotEditableError if the cart is not currently editable.
114101
*/
115102
addLineItem(variantId: number, quantity: number): Promise<string>;
116103

117104
/**
118105
* Remove the line item at this uuid from the cart
119-
* @param uuid the uuid of the line item that should be removed
120106
*
121-
* @throws CartNotEditableError if the cart is not currently editable.
107+
* @param uuid the uuid of the line item that should be removed
122108
*/
123109
removeLineItem(uuid: string): Promise<void>;
124110

125111
/**
126112
* Adds custom properties to the cart
127-
* @param properties the custom key to value object to attribute to the cart
128113
*
129-
* @throws CartNotEditableError if the cart is not currently editable.
114+
* @param properties the custom key to value object to attribute to the cart
130115
*/
131116
addCartProperties(properties: Record<string, string>): Promise<void>;
132117

133118
/**
134119
* Removes the specified cart properties
135-
* @param keys the collection of keys to be removed from the cart properties
136120
*
137-
* @throws CartNotEditableError if the cart is not currently editable.
121+
* @param keys the collection of keys to be removed from the cart properties
138122
*/
139123
removeCartProperties(keys: string[]): Promise<void>;
140124

141125
/**
142126
* Adds custom properties to the specified line item
127+
*
143128
* @param uuid the uuid of the line item to which the properties should be stringd
144129
* @param properties the custom key to value object to attribute to the line item
145-
*
146-
* @throws CartNotEditableError if the cart is not currently editable.
147130
*/
148131
addLineItemProperties(
149132
uuid: string,
@@ -152,31 +135,28 @@ export interface CartApiContent {
152135

153136
/**
154137
* Adds custom properties to multiple line items at the same time.
155-
* @param lineItemProperties the collection of custom line item properties to apply to their respective line items.
156138
*
157-
* @throws CartNotEditableError if the cart is not currently editable.
139+
* @param lineItemProperties the collection of custom line item properties to apply to their respective line items.
158140
*/
159141
bulkAddLineItemProperties(
160142
lineItemProperties: SetLineItemPropertiesInput[],
161143
): Promise<void>;
162144

163145
/**
164146
* Removes the specified line item properties
147+
*
165148
* @param uuid the uuid of the line item to which the properties should be removed
166149
* @param keys the collection of keys to be removed from the line item properties
167-
*
168-
* @throws CartNotEditableError if the cart is not currently editable.
169150
*/
170151
removeLineItemProperties(uuid: string, keys: string[]): Promise<void>;
171152

172153
/**
173154
* Add a discount on a line item to the cart
155+
*
174156
* @param uuid the uuid of the line item that should receive a discount
175157
* @param type the type of discount applied (example: 'Percentage')
176158
* @param title the title attributed with the discount
177159
* @param amount the percentage or fixed monetary amount deducted with the discout
178-
*
179-
* @throws CartNotEditableError if the cart is not currently editable.
180160
*/
181161
setLineItemDiscount(
182162
uuid: string,
@@ -187,28 +167,25 @@ export interface CartApiContent {
187167

188168
/**
189169
* Set line item discounts to multiple line items at the same time.
190-
* @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.
191170
*
192-
* @throws CartNotEditableError if the cart is not currently editable.
171+
* @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.
193172
*/
194173
bulkSetLineItemDiscounts(
195174
lineItemDiscounts: SetLineItemDiscountInput[],
196175
): Promise<void>;
197176

198177
/**
199178
* Sets an attributed staff to all line items in the cart.
200-
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff from all line items.
201179
*
202-
* @throws CartNotEditableError if the cart is not currently editable.
180+
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff from all line items.
203181
*/
204182
setAttributedStaff(staffId: number | undefined): Promise<void>;
205183

206184
/**
207185
* Sets an attributed staff to a specific line items in the cart.
186+
*
208187
* @param staffId the ID of the staff. Providing undefined will clear the attributed staff on the line item.
209188
* @param lineItemUuid the UUID of the line item.
210-
*
211-
* @throws CartNotEditableError if the cart is not currently editable.
212189
*/
213190
setAttributedStaffToLineItem(
214191
staffId: number | undefined,
@@ -217,33 +194,29 @@ export interface CartApiContent {
217194

218195
/**
219196
* Remove all discounts from a line item
220-
* @param uuid the uuid of the line item whose discounts should be removed
221197
*
222-
* @throws CartNotEditableError if the cart is not currently editable.
198+
* @param uuid the uuid of the line item whose discounts should be removed
223199
*/
224200
removeLineItemDiscount(uuid: string): Promise<void>;
225201

226202
/**
227203
* Add an address to the customer (Customer must be present)
228-
* @param address the address object to add to the customer in cart
229204
*
230-
* @throws CartNotEditableError if the cart is not currently editable.
205+
* @param address the address object to add to the customer in cart
231206
*/
232207
addAddress(address: Address): Promise<void>;
233208

234209
/**
235210
* Delete an address from the customer (Customer must be present)
236-
* @param addressId the address ID to delete
237211
*
238-
* @throws CartNotEditableError if the cart is not currently editable.
212+
* @param addressId the address ID to delete
239213
*/
240214
deleteAddress(addressId: number): Promise<void>;
241215

242216
/**
243217
* Update the default address for the customer (Customer must be present)
244-
* @param addressId the address ID to set as the default address
245218
*
246-
* @throws CartNotEditableError if the cart is not currently editable.
219+
* @param addressId the address ID to set as the default address
247220
*/
248221
updateDefaultAddress(addressId: number): Promise<void>;
249222
}

0 commit comments

Comments
 (0)