@causalfoundry/js-sdk
Version:
Causal Foundry WEB SDK (JS/TS)
288 lines (287 loc) • 7.22 kB
TypeScript
import { BloodMeta } from "./blood.typings";
import { CurrencyCode } from "../../core/commonTypes";
import { OxygenMeta } from "./oxygen.typings";
export declare enum ECommerceTypes {
CancelCheckout = "cancel_checkout",
Cart = "cart",
Checkout = "checkout",
Delivery = "delivery",
Item = "item",
ItemReport = "item_report",
ItemRequest = "item_request",
ItemVerification = "item_verification"
}
export declare enum ItemAction {
View = "view",
Detail = "detail",
Impression = "impression",
TopUp = "top_up",
Cancel = "cancel",
Update = "update",
Remove = "remove",
Add = "add",
Select = "select",
AddFavorite = "add_favorite",
RemoveFavorite = "remove_favorite",
AddReminder = "add_reminder",
RemoveReminder = "remove_reminder",
RemoveReminderAuto = "remove_reminder_auto",
Other = "other"
}
export declare enum ItemType {
Blood = "blood",
Book = "book",
Clothing = "clothing",
Drug = "drug",
Grocery = "grocery",
Subscription = "subscription",
Facility = "facility",
Electronics = "electronics",
MedicalEquipment = "medical_equipment",
Misc = "misc",
Oxygen = "oxygen",
ItemVerification = "item_verification",
ItemReport = "item_report",
Reward = "reward",
Survey = "survey",
Other = "other"
}
export declare enum StockStatus {
InStock = "in_stock",
LowStock = "low_stock",
OutOfStock = "out_of_stock"
}
export declare enum SubscriptionStatus {
Active = "active",
Inactive = "inactive",
Paused = "paused",
Other = "other"
}
export declare enum SubscriptionType {
PayAsYouSell = "pay_as_you_sell",
PayAsYouGo = "pay_as_you_go",
Other = "other"
}
export interface ItemMinObject {
id: string;
type: ItemType;
}
export interface ItemInfoObject {
"id": string;
"type": ItemType;
"batch_id"?: string;
"reward_id"?: string;
"survey_id"?: string;
"is_featured"?: boolean;
"expiry_date"?: number;
"production_date"?: number;
}
export declare type BaseItemDetail = {
id: string;
quantity: number;
price: number;
currency: CurrencyCode;
stock_status?: StockStatus;
promo_id?: string;
facility_id?: string;
discount?: number;
};
export declare type SubscriptionItemDetail = {
status: SubscriptionStatus;
type: SubscriptionType;
subscription_items: Array<ItemMinObject>;
};
export declare type MetaBloodItemDetail = BaseItemDetail & {
type: ItemType.Blood;
meta: BloodMeta;
};
export declare type MetaOxygenItemDetail = BaseItemDetail & {
type: ItemType.Oxygen;
meta: OxygenMeta;
};
export declare type DrugItemDetail = BaseItemDetail & {
type: ItemType.Drug;
};
export declare type GroceryItemDetail = BaseItemDetail & {
type: ItemType.Grocery;
};
export declare type BloodItemDetail = BaseItemDetail & {
type: ItemType.Blood;
};
export declare type OxygenItemDetail = BaseItemDetail & {
type: ItemType.Oxygen;
};
export declare type MedicalEquipmentDetail = BaseItemDetail & {
type: ItemType.MedicalEquipment;
};
export declare type SubscriptionDetail = BaseItemDetail & {
type: ItemType.Subscription;
subscription: SubscriptionItemDetail;
};
export declare type MetaItemObject = MetaBloodItemDetail | MetaOxygenItemDetail | DrugItemDetail | MedicalEquipmentDetail | GroceryItemDetail | SubscriptionDetail;
export declare type ItemObject = BloodItemDetail | OxygenItemDetail | DrugItemDetail | MedicalEquipmentDetail | GroceryItemDetail | SubscriptionDetail;
export interface ItemProperties {
action: ItemAction;
item: ItemObject;
search_id?: string;
meta?: any;
}
export interface ReportObject {
id: string;
remarks: string;
short_desc?: string;
}
export interface StoreObject {
id: string;
lat?: number;
lon?: number;
}
export declare enum CartAction {
AddItem = "add_item",
RemoveItem = "remove_item"
}
export interface CartProperties {
id: string;
action: CartAction;
item: ItemObject;
cart_price: number;
currency: CurrencyCode;
meta?: any;
}
export declare enum ScanChannel {
App = "app",
Ussd = "ussd"
}
export declare enum ScanType {
Pin = "pin",
QrCode = "qr_code"
}
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 declare enum ShopMode {
Delivery = "delivery",
Pickup = "pickup"
}
export interface CheckoutProperties {
id: string;
is_successful: boolean;
cart_price: number;
currency: CurrencyCode;
items: Array<MetaItemObject>;
cart_id: string;
shop_mode?: ShopMode;
meta?: any;
}
export declare enum DeliveryAction {
Schedule = "schedule",
Update = "update",
Dispatch = "dispatch",
Delivered = "delivered"
}
export interface DeliveryProperties {
id: string;
order_id: string;
is_urgent: boolean;
action: DeliveryAction;
est_delivery_ts?: Date | string;
delivery_coordinates?: CoordinatesObject;
dispatch_coordinates?: CoordinatesObject;
meta?: any;
}
export interface CoordinatesObject {
lat: number;
lon: number;
}
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 interface GroceryProperties {
name: string;
description?: string;
category?: string;
active_ingredients?: Array<string>;
market_id?: string;
packaging?: string;
packaging_size?: number;
packaging_units?: string;
producer?: string;
supplier_id?: string;
supplier_name?: string;
}
/**
* @internal
*/
export interface InternalGroceryProperties extends GroceryProperties {
id: string;
}
export interface FacilityProperties {
name: string;
type?: string;
country?: string;
region_state?: string;
city?: string;
is_active?: boolean;
has_delivery?: boolean;
is_sponsored?: boolean;
}
/**
* @internal
*/
export interface InternalFacilityProperties extends FacilityProperties {
id: string;
}
export declare enum CancelType {
Cart = "cart",
Order = "order"
}
export interface CancelCheckoutProperties {
id: string;
type: CancelType;
items: ItemMinObject[];
reason: string;
meta?: any;
}
export interface ItemReportProperties {
item: ItemMinObject;
report_info: ReportObject;
store_info: StoreObject;
}
export interface ItemRequestProperties {
id: string;
item_name: string;
manufacturer: string;
}
export interface ItemVerificationProperties {
scan_channel: ScanChannel;
scan_type: ScanType;
is_successful: boolean;
item_info: ItemInfoObject;
}