UNPKG

@benshi.ai/js-sdk

Version:

Benshi SDK

188 lines (187 loc) 4.51 kB
import { BloodMeta } from "./blood.typings"; import { CurrencyCode } from "../../core/commonTypes"; import { OxygenMeta } from "./oxygen.typings"; export declare enum ECommerceTypes { Cancel = "cancel_checkout", Cart = "cart", Checkout = "checkout", Delivery = "delivery", Item = "item", List = "list", Rate = "rate", ScheduleDelivery = "schedule_delivery" } export declare enum ItemAction { View = "view", Detail = "detail", Impression = "impression", AddFavorite = "add_favorite", RemoveFavorite = "remove_favorite", AddReminder = "add_reminder", RemoveReminder = "remove_reminder", RemoveReminderAuto = "remove_reminder_auto" } export declare enum ItemType { Blood = "blood", Book = "book", Clothing = "clothing", Drug = "drug", Electronics = "electronics", MedicalEquipment = "medical_equipment", Misc = "misc", Oxygen = "oxygen" } export declare enum StockStatus { InStock = "in_stock", LowStock = "low_stock", OutOfStock = "out_of_stock" } export interface TypedItem { id: string; type: ItemType; } export type BaseItemDetail = { id: string; quantity: number; price: number; currency: CurrencyCode; stock_status?: StockStatus; promo_id?: string; }; export type MetaBloodItemDetail = BaseItemDetail & { type: ItemType.Blood; meta: BloodMeta; }; export type MetaOxygenItemDetail = BaseItemDetail & { type: ItemType.Oxygen; meta: OxygenMeta; }; export type DrugItemDetail = BaseItemDetail & { type: ItemType.Drug; }; export type BloodItemDetail = BaseItemDetail & { type: ItemType.Blood; }; export type OxygenItemDetail = BaseItemDetail & { type: ItemType.Oxygen; }; export type MedicalEquipmentDetail = BaseItemDetail & { type: ItemType.MedicalEquipment; }; export type MetaItemDetail = MetaBloodItemDetail | MetaOxygenItemDetail | DrugItemDetail | MedicalEquipmentDetail; export type ItemDetail = BloodItemDetail | OxygenItemDetail | DrugItemDetail | MedicalEquipmentDetail; export interface ItemProperties { action: ItemAction; item: ItemDetail; search_id?: string; meta?: any; } /** * @internal */ export interface InternalItemProperties extends ItemProperties { usd_rate: number; } export declare enum CartAction { AddItem = "add_item", RemoveItem = "remove_item" } export interface CartProperties { id: string; action: CartAction; item: ItemDetail; cart_price: number; currency: CurrencyCode; meta?: any; } /** * @internal */ export interface InternalCartProperties extends CartProperties { usd_rate: number; } export declare enum ListAction { Add = "add_item", Discard = "discard", Edit = "edit_item", Remove = "remove_item", View = "view" } export declare enum ListType { Cart = "cart", Favourite = "favourite", Order = "order", Reminder = "reminder" } export interface CheckoutProperties { id: string; is_successful: boolean; cart_price: number; currency: CurrencyCode; items: Array<MetaItemDetail>; cart_id: string; meta?: any; } /** * @internal */ export interface InternalCheckoutProperties extends CheckoutProperties { usd_rate: number; } export declare enum DeliveryAction { Delivered = "delivered" } export interface DeliveryProperties { id: string; action: DeliveryAction; order_id: string; meta?: any; } export interface DrugProperties { market_id: string; name: string; description?: string; supplier_id: string; supplier_name: string; producer?: string; packaging?: string; active_ingredients: Array<string>; drug_form?: string; drug_strength?: string; atc_anatomical_group?: string; otc_or_ethical?: string; } /** * @internal */ export interface InternalDrugProperties extends DrugProperties { id: string; } export declare enum CancelType { Cart = "cart", Order = "order" } export interface CancelCheckoutProperties { id: string; type: CancelType; items: TypedItem[]; reason: string; meta?: any; } export declare enum ScheduleDeliveryAction { Schedule = "schedule", Update = "update" } export interface ScheduleDeliveryProperties { order_id: string; is_urgent: boolean; action: ScheduleDeliveryAction; ts?: string; meta?: any; } /** * @internal */ export interface InternalScheduleDeliveryProperties extends ScheduleDeliveryProperties { ts: string; }