@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
59 lines (57 loc) • 1.68 kB
TypeScript
declare const getCookieMap: (cookieString?: string) => Map<string, string>;
declare const getCookieValue: (name: string) => string | undefined;
declare const setCookieValue: (options: CookieInit) => undefined;
declare const deleteCookieValue: (options: {
name: string;
domain?: string;
path?: string;
}) => undefined;
interface CookieListItem {
name: string;
value: string;
path: string;
domain: string | null;
expires: number | null;
secure: boolean;
sameSite: "strict" | "lax" | "none";
}
interface CookieInit {
name: string;
value: string;
path?: string;
domain?: string;
expires?: number;
sameSite?: "strict" | "lax" | "none";
}
interface CookieChangeEvent extends Event {
readonly changed: CookieListItem[];
readonly deleted: CookieListItem[];
type: "deleted" | "changed";
}
type SetCookie = {
(options: CookieInit): Promise<undefined>;
(name: string, value: string): Promise<undefined>;
};
interface CookieStore extends EventTarget {
get: (name: string | {
name: string;
url: string;
}) => Promise<CookieListItem | undefined>;
getAll: (name: string | {
name: string;
url: string;
}) => Promise<CookieListItem[]>;
set: SetCookie;
delete: (name: string | {
name: string;
domain?: string | null;
path?: string;
}) => Promise<undefined>;
onchange: (event: CookieChangeEvent) => boolean | void | Promise<boolean | void>;
}
declare global {
interface Window {
cookieStore: CookieStore;
}
}
export { type CookieChangeEvent, deleteCookieValue, getCookieMap, getCookieValue, setCookieValue };