JS SDK v1.134.0

➕

Added

Entry points: The ESM package is now split into entry points, so your bundler includes only the parts you import. Besides the root, you can import createSDK, each namespace, the enums and the models directly:

import { createSDK } from "fansunited-sdk-esm/createSDK";
import { football } from "fansunited-sdk-esm/namespaces/football";
import { profile } from "fansunited-sdk-esm/namespaces/profile";
import { MarketEnum } from "fansunited-sdk-esm/enums";
import { MatchFilters } from "fansunited-sdk-esm/models";

const sdk = createSDK(config, [football, profile]);
  • fansunited-sdk-esm/namespaces/<name> exists for every namespace that createSDK accepts: activity, bracketGame, challenges, discussions, eventGame, fantasy, football, idMapping, lists, loyalty, matchQuiz, miniGames, odds, predictor, privateLeagues, profile, sports, standingGame, topX and voting.

  • fansunited-sdk-esm/enums and fansunited-sdk-esm/models contain only enums and model classes, with no namespace code. Use them when you need a value such as MarketEnum without pulling in the whole SDK.

  • Importing from the root still works and gives the same result in bundlers that tree-shake side-effect-free packages (webpack, Vite, Turbopack, esbuild). FansUnitedSDK always includes every namespace.

🚧

Changed

Bundle contents: The package no longer contains CommonJS code. node-cache, together with the clone and events polyfills it brought along, is replaced by a small in-memory cache with the same behaviour, and the version is injected at build time instead of bundling package.json. The only dependency left in the bundle is jwt-decode, which is ESM.

Exports map: fansunited-sdk-esm/Core/* now resolves type declarations only. These paths were never published as JavaScript, so importing a value from them failed; importing a type keeps working.

Fixed

Signed-out users: The SDK no longer tries to decode a JWT when there is none. Calls made while signed out, for example sdk.profile.getOwn().getInfo(), previously logged Invalid token specified: Cannot read properties of undefined (reading 'replace') to the console. They now fail with the usual unauthorized error, without the log line.