Add rebate offer type to the React SDK#7
Merged
Conversation
DefaultRebateOffer now renders the period charge, the rebate being credited (the accented line), and what's still due — as invoice lines on the surface rather than a filled panel. Quieter paid line, more room below the total. Also unifies the offer panels: discount and trial-extension move from colorPrimarySoft to colorSurfaceMuted so every offer panel reads the same, and colorPrimarySoft is left for selected-state highlights. The playground's all-offers scenario gains a rebate reason.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
rebateoffer type to the cancel flow, and tidies the offer panels so they share one surface treatment.Rebate offers
A rebate is a partial refund of the customer's most recent paid invoice while their subscription stays active. It's aimed at money-back-guarantee windows: a customer who would otherwise cancel to get their money back can take a partial refund and keep the subscription instead. In connected mode the refund is issued through Stripe.
RebateOfferjoins the offer union — the local config plus the shape resolved in token mode (amountMinor,currency,amountPaidMinor,netAfterRebateMinor) — wired through the state machine, the config transform, and the offer-type map.DefaultRebateOfferrenders the offer as an itemized invoice: the period charge, the rebate being credited (the accented line), and what's still due. Themed with the--ck-*tokens and overridable viacomponents.RebateOffer.handleRebate/onRebatecallbacks, consistent with the other offer types. In connected mode the SDK runs the rebate server-side; defininghandleRebateoverrides that to run the refund through your own billing system.The public surface stays minimal — one component, one type, two callbacks — mirroring the existing offer types. Connected-mode rebates are Stripe-only for now.
Offer panel styling
While building the rebate panel I unified how offer panels are filled. Discount and trial-extension were using
colorPrimarySoft(the indigo tint); they now usecolorSurfaceMuted(the neutral callout surface), matching pause and leavingcolorPrimarySoftfor selected-state highlights, as the theming docs describe. The rebate panel itself renders as plain invoice lines on the surface rather than a filled card.This is a visual change to two existing default components. Override the relevant
--ck-*properties to restore the previous tint.Versioning
Minor bump to
0.4.0, with a changelog entry (Added: rebate offer; Changed: offer panel surfaces).Testing
Typecheck, lint, and build pass. 156 unit tests pass, including coverage for the rebate config transform and the accept paths (handler override and connected-mode action).