@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
20 lines (18 loc) • 709 B
TypeScript
/**
* Creates an object that has the same API as normal localStorage, but adds a beam_ prefix and apiKey postfix to keys
* Also adds helper methods for JSON (de-)serialization
*/
declare const createScopedLocalStorage: (config: {
apiKey: string;
}) => {
readonly prefix: string;
readonly postfix: string;
getItem(key: string): string | null;
setItem(key: string, value: unknown): void;
removeItem(key: string): void;
/** Safely parses value as JSON and return JS object */
getItemJson<T = Record<string, unknown>>(key: string): T | null;
/** Safely stringifies value as JSON */
setItemJson(key: string, value: object): void;
};
export { createScopedLocalStorage };