Headless-sdk v2.4.0 — @spwig/sdk 2.4.0

What’s new

  • Campaign Studio Attribution: The SDK now includes admin.analytics.getAttribution, allowing you to query revenue attribution data. You can filter results by specific attribution models and time periods (ranging from the last 7 days to custom date ranges). The response provides total attributed revenue, order counts, and average touches, alongside detailed breakdowns per campaign, journey, and model.
  • Wallet Balance Adjustments: A new admin.wallets.adjust binding lets staff post signed balance corrections. By specifying an amount and direction (increase or decrease), you can record a distinct ledger entry. This method returns the resulting transaction record, providing a clear audit trail for manual balance changes.
  • Updated API Schema: The underlying schema has been regenerated to match the Spwig 1.8.0 API contract. This ensures type safety for the new features without altering existing storefront logic.

Why it matters

This release brings the SDK in line with Spwig 1.8.0, specifically focusing on the new Campaign Studio and admin capabilities. Since these additions are purely additive, your existing storefront code will continue to work without changes.

For merchants and agencies, this means you can now build headless admin interfaces that display accurate marketing performance metrics and manage customer wallet balances directly through the SDK. You get the data needed to understand which campaigns drive revenue and the tools to correct balance errors, all while maintaining compatibility with your current setup. The release deliberately excludes agent-facing endpoints and the currently inert multi-market visibility engine, keeping the SDK focused on active, usable functionality.


Release notes

Catches the SDK up to Spwig 1.8.0 (Campaign Studio — the built-in
email-marketing suite).

Purely additive — no breaking changes. 1.8.0’s new surface is admin/agentic and
did not change any storefront contract, so existing code keeps compiling and
working unchanged. Two new admin bindings expose the parts a headless admin app
would want; the rest of 1.8.0’s new endpoints are agent-facing or the inert
multi-market visibility engine and are deliberately not wrapped.

Added

  • admin.analytics.getAttribution(params?) — Campaign Studio revenue
    attribution. Returns totals (attributed revenue, orders, average touches)
    for the window, plus per-campaign and per-journey breakdowns and per-model
    figures under the selected attribution model. Params: model and a period
    preset (last_7_days … last_90_days, month_to_date, or custom with
    start_date/end_date). New types: AttributionData, AttributionTotals,
    AttributionPeriod, AttributionPeriodInfo, AttributionParams.
  • admin.wallets.adjust(walletId, { amount, direction, description, … }) —
    post a signed staff balance correction. direction ('increase' |
    'decrease') decides whether the always-positive amount raises or lowers
    the balance; recorded as a distinct adjustment ledger row. Returns the
    resulting AdminWalletTransaction. New type: WalletAdjustInput.

Notes

  • Regenerated src/generated/schema.ts from the 1.8.0 API contract.
  • Deliberately not wrapped (declined in the coverage allowlist): the
    agent-facing POST /api/agentic/ucp/checkout-sessions/{}/cancel/, and the
    admin multi-market VisibilityRule engine (/api/visibility/*), which is
    currently an inert presentation engine.

View the full release on GitHub