React v2.4.0 — @spwig/react 2.4.0

What’s new

  • Campaign Studio Revenue Attribution: A new useAdminAttribution hook allows you to query revenue data tied to specific marketing campaigns. It returns totals for attributed revenue, order counts, and average touches, broken down by individual campaigns and customer journeys based on your selected attribution model and time period.
  • Staff Wallet Adjustments: The useAdminAdjustWallet mutation hook provides a way to perform signed staff balance corrections. It handles the adjustment of a wallet’s balance with a specified amount, direction, and description, and automatically refreshes the relevant wallet details and transaction lists upon success.
  • Responsive Image Support: This release incorporates SDK 2.3.0 features, including responsive image srcset ladders. These are optional fields on existing payload types, meaning they flow through current hooks without requiring new API calls or code changes.

Why it matters

This release is purely additive, meaning there are no breaking changes to your existing React or SDK integrations. It bridges the gap between your frontend React applications and the Spwig 1.8.0 backend, specifically the Campaign Studio features. For merchants and agencies, this means you can now directly visualize the financial impact of your marketing efforts through the new attribution hook. Additionally, store administrators gain a programmatic method to correct staff wallet balances, ensuring accurate financial records with automatic UI updates. Because the changes are optional and additive, you can adopt these new capabilities at your own pace without disrupting your current store operations.


Release notes

Tracks @spwig/sdk 2.4.0 and the Spwig 1.8.0 release (Campaign Studio).
Requires @spwig/sdk ^2.4.0.

Purely additive — no breaking changes in the React layer or the SDK. This
version also subsumes SDK 2.3.0 (responsive image srcset ladders): those were
new optional fields on existing payload types, so they flow through the hooks
unchanged with no new API.

Added

  • useAdminAttribution(params?) — query hook for Campaign Studio revenue
    attribution (admin.analytics.getAttribution). Returns totals (attributed
    revenue, orders, average touches) for the window plus per-campaign and
    per-journey breakdowns, under the selected attribution model and period
    preset.
  • useAdminAdjustWallet() — mutation hook wrapping
    admin.wallets.adjust(walletId, { amount, direction, description, … }), a
    signed staff balance correction. Invalidates the affected wallet detail and
    the transactions list on success.

View the full release on GitHub