UNPKG

@causalfoundry/js-sdk

Version:

Causal Foundry WEB SDK (JS/TS)

51 lines (43 loc) 1.03 kB
interface PromoItem { id: string; type: PromoItemType; } enum PromoType { AddToCart = "add_to_cart", Coupon = "coupon", Other = "other", } enum PromoItemType { Blood = "blood", Book = "book", Clothing = "clothing", Drug = "drug", Grocery = "grocery", Electronics = "electronics", Misc = "misc", Oxygen = "oxygen", Subscription = "subscription", Facility = "facility", Other = "other", } enum PromoAction { Apply = "apply", View = "view", Other = "other", } export interface LegacyPromoProperties { id: string; action: PromoAction; items: PromoItem[]; title: string; type: PromoType; meta?: any; } import { promoPropertiesMapper } from "./mappers"; import { LoyaltyTypes } from "./typings"; import { logIngestEvent } from "./logIngestEvent"; const logPromoEvent = (properties: LegacyPromoProperties, sendNow = false) => { const newProperties = promoPropertiesMapper(properties); logIngestEvent(LoyaltyTypes.Promo, newProperties, sendNow); }; export { logPromoEvent };