braze-web-sdk icon indicating copy to clipboard operation
braze-web-sdk copied to clipboard

[Feature]: Support SSR frameworks as an ES6 module

Open bscaspar opened this issue 1 year ago • 1 comments

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

bscaspar avatar Nov 14 '23 19:11 bscaspar

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.

davidbielik avatar Nov 14 '23 20:11 davidbielik