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

125 lines (121 loc) 5.03 kB
import { a as TCartApi } from './cart-contents-CMm57qu0.esm.js'; import { W as WidgetName, a as TId } from './types-zbTZ8-KP.esm.js'; type NetworkEventDetail = { url: string; method: string; type: "fetch"; response: Response; } | { url: string; method: string; type: "xhr"; xhr: XMLHttpRequest; }; /** * beamnetworkcall * Emitted by the Beam network listener whenever any API calls are made on the page */ declare class BeamNetworkCallEvent extends CustomEvent<NetworkEventDetail> { static eventName: "beamnetworkcall"; constructor(detail: NetworkEventDetail); } type NonprofitSelectDetail = { selectionId?: string; selectedNonprofitId?: number | null; nonprofitName?: string | null; source?: WidgetName | null; }; /** * beamnonprofitselect * Emitted when the end user selects a nonprofit in the Beam widget, and when the previous selection was restored * automatically */ declare class BeamNonprofitSelectEvent extends CustomEvent<NonprofitSelectDetail> { static eventName: "beamnonprofitselect"; constructor(detail: NonprofitSelectDetail); } type CartChangeDetail = TCartApi & { cartId?: string; subtotal?: number; itemCount?: number; currencyCode?: string; }; /** * beamcartchange * Emitted when Beam detects that cart contents have changed, and when items are added to the cart for the first time */ declare class BeamCartChangeEvent extends CustomEvent<CartChangeDetail> { static eventName: "beamcartchange"; constructor(detail: CartChangeDetail); } type CartCreatedDetail = CartChangeDetail; /** * beamcartcreated * Emitted when a cart is created in Beam for the first time, but NOT when the cart is updated * Beam's cart expiration rules are used to determine when a returning visit counts as the same cart */ declare class BeamCartCreatedEvent extends CustomEvent<CartCreatedDetail> { static eventName: "beamcartcreated"; constructor(detail: CartCreatedDetail); } type OrderCreatedDetail = { orderId: TId; transactionId: TId; cartTotal: number; currencyCode: string; }; /** * beamordercreated * Emitted when an order is registered with Beam for the first time, but NOT on repeat visits, page refreshes, etc. */ declare class BeamOrderCreatedEvent extends CustomEvent<OrderCreatedDetail> { static eventName: "beamordercreated"; constructor(detail: OrderCreatedDetail); } /** * beamstatuschange * Emitted when the Beam config object has finished initializing along with all plugins */ type BeamStatusChangeEventDetail = { status: "pending"; } | { status: "error"; error: Error; } | { status: "ready"; }; declare class BeamStatusChangeEvent extends CustomEvent<BeamStatusChangeEventDetail> { static eventName: "beamstatuschange"; constructor(detail: BeamStatusChangeEventDetail); } type NonprofitSelectionRemovedDetail = { previousNonprofitId?: number | null; newNonprofitId?: number | null; selectionId?: string; }; /** * beamnonprofitselectionremoved * Emitted when the nonprofit selection is removed from deselection or due to nonprofit cohort change */ declare class BeamNonprofitSelectionRemovedEvent extends CustomEvent<NonprofitSelectionRemovedDetail> { static eventName: "beamnonprofitselectionremoved"; constructor(detail: NonprofitSelectionRemovedDetail); } type events_BeamCartChangeEvent = BeamCartChangeEvent; declare const events_BeamCartChangeEvent: typeof BeamCartChangeEvent; type events_BeamCartCreatedEvent = BeamCartCreatedEvent; declare const events_BeamCartCreatedEvent: typeof BeamCartCreatedEvent; type events_BeamNetworkCallEvent = BeamNetworkCallEvent; declare const events_BeamNetworkCallEvent: typeof BeamNetworkCallEvent; type events_BeamNonprofitSelectEvent = BeamNonprofitSelectEvent; declare const events_BeamNonprofitSelectEvent: typeof BeamNonprofitSelectEvent; type events_BeamNonprofitSelectionRemovedEvent = BeamNonprofitSelectionRemovedEvent; declare const events_BeamNonprofitSelectionRemovedEvent: typeof BeamNonprofitSelectionRemovedEvent; type events_BeamOrderCreatedEvent = BeamOrderCreatedEvent; declare const events_BeamOrderCreatedEvent: typeof BeamOrderCreatedEvent; type events_BeamStatusChangeEvent = BeamStatusChangeEvent; declare const events_BeamStatusChangeEvent: typeof BeamStatusChangeEvent; declare namespace events { export { events_BeamCartChangeEvent as BeamCartChangeEvent, events_BeamCartCreatedEvent as BeamCartCreatedEvent, events_BeamNetworkCallEvent as BeamNetworkCallEvent, events_BeamNonprofitSelectEvent as BeamNonprofitSelectEvent, events_BeamNonprofitSelectionRemovedEvent as BeamNonprofitSelectionRemovedEvent, events_BeamOrderCreatedEvent as BeamOrderCreatedEvent, events_BeamStatusChangeEvent as BeamStatusChangeEvent }; } export { BeamNonprofitSelectEvent as B, BeamNetworkCallEvent as a, BeamCartChangeEvent as b, BeamCartCreatedEvent as c, BeamOrderCreatedEvent as d, events as e, BeamStatusChangeEvent as f, BeamNonprofitSelectionRemovedEvent as g };