Releases: Flagsmith/flagsmith-js-client
3.9.0 Fixed source maps
This release fixes source mapping for all clients, prior to this you could not inspect ts functions such as init and getFlags from flagsmith-core.ts.
3.8.1 - Preparations for realtime flags
This release includes working functionality for Serverside Events in the Flagsmith JavaScript client, React Native and SSR clients. A follow-up release will be published when this is released to production.
3.8.0 - Fix useFlags for React Native, prepare for realtime flags
Prior to this release, React Native was not receiving flag updates with useFlags(["flag_name"]), this is due to the event emitter not being compatible.
This release also prepares functionality for realtime flags.
3.7.2 - Inform user of undefined fetch
Similarly to version 3.7.1, this change caters for SSR technologies not supporting fetch. This version informs the user when fetch is undefined regardless of whether the user is opted into logging.
3.7.1 - Add fetch logging
With SSR clients especially where fetch implementations differ, it's important to be able to debug fetch requests. With this version you will be able to see fetch statuses and exceptions when you pass enableLogs:true within flagsmith.init
3.7.0 - Typed generics for flagsmith flags and traits
Given that we type our flags and traits
type FlagOptions = "font_size" | "hero"
type TraitOptions = "example_trait"
We can now enforce these types:
// enforces you passing the correct key to flagsmith.getValue(x), flagsmith.getTrait(x)
import flagsmith from "flagsmith"
const typedFlagsmith = flagsmith as IFlagsmith<FlagOptions,TraitOptions>
// Similarly for the useFlagsmith hook
const flagsmith = useFlagsmith<FlagOptions, TraitOptions>(); // enforces flagsmith.getValue()
// for useFlags this will ensure you only can pass correct keys also
const flags = useFlags<FlagOptions, TraitOptions>(["font_size"],["example_trait"]);
Thank you very much for this addition @PrettyWood
3.6.0 - Improve event-trigger code, fix up TypeScript issues
3.5.0 - allow custom fetch implementations
Some SSR technologies e.g. Nuxt do not provide a fetch polyfill, this means that sometimes we need to tell Flagsmith how to fetch data.
This is now possible with the following:
flagsmith.init({fetch:myCustomImplementation})
Here's an example of how this can be done with Nuxt https://github.com/Flagsmith/flagsmith-js-client/blob/main/examples/nuxt/plugins/flagsmith-plugin.ts#L10
3.4.0 - Remove deprecated IBulletTrainFeature type
IBulletTrainFeature had been deprecated many releases ago, this release removes it entirely. If your application imports it, just import IFlagsmithFeature instead. See https://github.com/Flagsmith/flagsmith-js-client/blob/main/types.d.ts