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

3 lines (2 loc) 670 B
import{L as o}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{logger as s}from"./logger.js";const i=r=>({get prefix(){return"beam_"},get postfix(){return`_key_${r.apiKey}`},getItem(e){return localStorage.getItem(this.prefix+e+this.postfix)},setItem(e,t){return localStorage.setItem(this.prefix+e+this.postfix,`${t}`)},removeItem(e){return localStorage.removeItem(this.prefix+e+this.postfix)},getItemJson(e){try{const t=this.getItem(e);if(t)return JSON.parse(t)}catch{s.error(new o(`Could not parse JSON: ${e}`))}return null},setItemJson(e,t){return this.setItem(e,JSON.stringify(t))}});export{i as createScopedLocalStorage}; //# sourceMappingURL=local-storage.js.map