Skip to content

Conversation

@jonathanhamel4
Copy link
Contributor

@jonathanhamel4 jonathanhamel4 commented Dec 10, 2025

Background

Related to https://github.com/Shopify/ui-api-design/pull/1332

Adds a subscribable API for Discounts Functions Settings extension target.

  • PurchaseType
  • DiscountMethod (readonly)
  • DiscountClasses
  • RecurringCycleLimit

@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch 5 times, most recently from c5ef73a to bf5f2f0 Compare December 15, 2025 20:37
@jonathanhamel4 jonathanhamel4 changed the base branch from unstable to 2026-01-rc December 15, 2025 20:37
@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch 2 times, most recently from 5747eaa to 6546c68 Compare December 15, 2025 20:42
@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch 2 times, most recently from f3ec9c3 to 6506b29 Compare December 17, 2025 15:01
Order = 'ORDER',
Shipping = 'SHIPPING',
}
type DiscountClass = 'product' | 'order' | 'shipping';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to call this out in the changset as a breaking change. We will also need to ensure backwards compatibility so that only 2026-01 and up will receive the lowercased enum.

Copy link
Contributor Author

@jonathanhamel4 jonathanhamel4 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to document this as a breaking change? This type was defined but never used. Like the input never referenced that type 🤔 It wasn't flagged as unused in CI because it is exported I assume.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, we've never exposed this in the api, just added the enum so it's ok to not be a breaking change

@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch 2 times, most recently from 6ad4bcb to ea8483b Compare December 19, 2025 18:40
@jonathanhamel4 jonathanhamel4 marked this pull request as ready for review December 19, 2025 18:44
@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch from ea8483b to da8dfc7 Compare December 19, 2025 18:45
export interface SubscribableDiscountFields {
discountClasses: ReadonlySignalLike<DiscountClass[]>;
updateDiscountClasses: UpdateSignalFunction<DiscountClass[]>;
discountMethod: ReadonlySignalLike<DiscountMethod>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discountMethod is readonly.

* The object that exposes the validation with its settings.
*/
export interface DiscountFunctionSettingsData {
id: Discount;
Copy link
Contributor Author

@jonathanhamel4 jonathanhamel4 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually wrong in the past. We never sent the id as an object with a single id property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please patch the previous release too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been wrong for more than one release. I can patch all of them, do I just have to merge the branch to the non-rc one? Like 2025-10, etc. Anything else I need to do?

@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch from da8dfc7 to f353ff9 Compare December 19, 2025 19:14
@jonathanhamel4
Copy link
Contributor Author

@vividviolet ready for another review. Added a comment about the discountClasses type.

Order = 'ORDER',
Shipping = 'SHIPPING',
}
type DiscountClass = 'product' | 'order' | 'shipping';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, we've never exposed this in the api, just added the enum so it's ok to not be a breaking change

* The object that exposes the validation with its settings.
*/
export interface DiscountFunctionSettingsData {
id: Discount;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please patch the previous release too?

@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch from f353ff9 to 0d85224 Compare December 22, 2025 13:49
@jonathanhamel4 jonathanhamel4 force-pushed the jh_discount-function-settings-observables branch from 0d85224 to 9440bde Compare December 22, 2025 14:35
@jonathanhamel4 jonathanhamel4 changed the title Update API and add observables Update API and add observables for discount function settings Dec 22, 2025
@jonathanhamel4 jonathanhamel4 merged commit 9475b2d into 2026-01-rc Dec 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants