braze-web-sdk
braze-web-sdk copied to clipboard
[Feature]: Support SSR frameworks as an ES6 module
What problem are you facing?
I would like to import the Braze web-sdk as an ES6 module. The current client-side only implementation requires workarounds to work with SSR frameworks, as documented in #103, #110, and #117.
Using these workarounds just to import Braze increases code complexity and increases maintenance time and effort.
SSR frameworks are some of the most popular web frameworks. Please support them!
Workarounds
Documented in #103, #110, and #117.
Ideal Solution
import { initialize, openSession, changeUser, [...etc] } from '@braze/web-sdk';
...
initialize(key);
openSession();
chaangeUser(userId);
Other Information
No response
Hi @bscaspar thanks for raising this - definitely great feedback and something we'll consider for a future major version. Right now the SDK is tightly coupled with browser APIs but we're exploring ways to make the SDK work in a server environment like SSR. We don't have a timeline we can share, but will keep this updated once we make any notable progress.