UNPKG

@beamimpact/web-sdk

Version:

The Beam SDK enables brands to connect with their customers over shared values, not transactional discounts, to build stronger loyalty. Our integration achieves this by allowing customers to (a) choose a nonprofit where the brand will donate part of their

39 lines (33 loc) 1.61 kB
/** If checkout and order page are on different subdomains, we can't access localStorage for nonprofitId/selectionId We can make post-transaction work by copying a "cartID"-style cookie to the expected localStorage key on the current domain, which will allow the post-transaction widgets to send that to the backend which can restore the selection from the cart. This will also work if we don't have a cart cookie for some other reason, although it is not directly integrated with the host site's concept of a cart (e.g., line items and expiration dates). Note: Use a module import rather than a self-executing script so that we can set cookies on the host domain rather than our 3rd party CDN domain, and customize the options via arguments. Usage: <script type="module"> import { createSession } from 'https://...'; createSession({domain: 'mystore.com'}) </script> */ declare function createSession({ cookieName, domain, // domain or subdomain to set cookie on apiKey, }?: { cookieName?: string | undefined; domain?: string | undefined; apiKey?: string | undefined; }): Promise<void>; declare function endSession({ cookieName, domain, // domain to remove cookie from apiKey, }?: { cookieName?: string | undefined; domain?: string | undefined; apiKey?: string | undefined; }): Promise<void>; declare const index_createSession: typeof createSession; declare const index_endSession: typeof endSession; declare namespace index { export { index_createSession as createSession, index_endSession as endSession }; } export { createSession as c, endSession as e, index as i };