tkhq / sdk

Turnkey TypeScript SDK
Apache License 2.0
48 stars 12 forks source link

Polyfill Window object on Browser SDK #267

Closed AlwaysBCoding closed 3 months ago

AlwaysBCoding commented 4 months ago

This PR adds a polyfill to reference the window object through in the browser-sdk. The polyfill will render a mock object if the browser-sdk happens to be rendered in a server environment.

The browser-sdk usually should not be rendered in a server environment, but there are apparently next.js flows that make this possible, so this enables those flows to function correctly.

codesandbox-ci[bot] commented 4 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.