Skip to content

@spwig/react 2.2.0

Latest

Choose a tag to compare

@dayyanj dayyanj released this 06 Aug 00:18

2.2.0 (2026-08-06)

Tracks @spwig/sdk 2.2.0 and the Spwig 1.7.1 release. Requires
@spwig/sdk ^2.2.0.

⚠️ This minor carries breaking changes inherited from @spwig/sdk 2.2.0
(sale-pricing, region availability, subscription tokens). It ships as a minor
deliberately. There are no breaking changes in the React layer itself: every hook re-uses the SDK's payload types, so the breaks surface as SDK type changes, not renamed or
removed hooks. See the @spwig/sdk 2.2.0 changelog for the field-level detail
and migration steps.

Added

  • useSetRegion() — mutation wrapping store.setRegion(country). Sets the
    shopper's ship-to region and invalidates catalog (product ships_to_region /
    regional stock), cart (regional pricing), and currency.
  • useBeginSubscriptionTokenSetup() — mutation wrapping
    subscriptions.beginTokenSetup(). Begins provider-agnostic setup for a
    reusable subscription payment method; the returned bundle mints a token you
    then bind with useAttachSubscriptionToken().
  • useAttachSubscriptionToken() — mutation wrapping
    cart.attachSubscriptionToken(). Binds a PaymentToken to a subscription cart
    line and invalidates the cart. Requires an authenticated shopper.

Changed

  • Inherited breaking type changes from @spwig/sdk 2.2.0 (no hook renamed or
    removed): Product.compare_at_price_amount is now null-off-sale (use the new
    effective_price_amount + is_on_sale); Product.is_in_stock includes
    pre-order/backorder; CreatePaymentIntentInput.checkout_session_id is a
    number; the admin attribute-assign payload, branding update, and bulk
    price/sale bounds changed. Consumers of useCatalog/useProduct,
    useCreatePaymentIntent, and the affected admin hooks should re-typecheck and
    follow the SDK migration notes.
  • CartItem now carries sale + subscription fields (is_on_sale,
    regular_total, pricing_tier_details, subscription_billing_display,
    subscription_unit_price); the useAddToCart optimistic placeholder was
    updated to populate them.