UNPKG

@benshi.ai/js-sdk

Version:

Benshi SDK

1,737 lines (1,735 loc) 46.3 kB
declare module "modules/ECommerce/blood.typings" { export interface BloodMeta { cross_matching: boolean; temperature_strips: boolean; extra_tests: boolean; reason: string; } export enum BloodComponent { Platelets = "Platelets", Cryoprecipitate = "Cryoprecipitate", WholeBlood = "Whole blood", FreshFrozenPlasma = "Fresh frozen plasma", PackedRedBloodCells = "Packed red blood cells", Other = "Other" } export enum BloodGroup { A_plus = "A+", A_minus = "A-", B_plus = "B+", B_minus = "B-", AB_plus = "AB+", AB_minus = "AB-", O_plus = "O+", O_minus = "O-", Unsure = "Unsure" } export interface BloodProperties { market_id: string; blood_component: BloodComponent | string; blood_group: BloodGroup | string; packaging: string; packaging_size: number; packaging_units: string; supplier_id?: string; supplier_name?: string; } /** * @internal */ export interface InternalBloodProperties extends BloodProperties { id: string; } } declare module "core/commonTypes" { export interface SearchFilter { [key: string]: any; } export enum CurrencyCode { AED = "AED", AFN = "AFN", ALL = "ALL", AMD = "AMD", ANG = "ANG", AOA = "AOA", ARS = "ARS", AUD = "AUD", AWG = "AWG", AZN = "AZN", BAM = "BAM", BBD = "BBD", BDT = "BDT", BGN = "BGN", BHD = "BHD", BIF = "BIF", BMD = "BMD", BND = "BND", BOB = "BOB", BRL = "BRL", BSD = "BSD", BTN = "BTN", BWP = "BWP", BYR = "BYR", BZD = "BZD", CAD = "CAD", CDF = "CDF", CHF = "CHF", CLP = "CLP", CNY = "CNY", COP = "COP", CRC = "CRC", CUC = "CUC", CUP = "CUP", CVE = "CVE", CZK = "CZK", DJF = "DJF", DKK = "DKK", DOP = "DOP", DZD = "DZD", EGP = "EGP", ERN = "ERN", ETB = "ETB", EUR = "EUR", FJD = "FJD", FKP = "FKP", GBP = "GBP", GEL = "GEL", GGP = "GGP", GHS = "GHS", GIP = "GIP", GMD = "GMD", GNF = "GNF", GTQ = "GTQ", GYD = "GYD", HKD = "HKD", HNL = "HNL", HRK = "HRK", HTG = "HTG", HUF = "HUF", IDR = "IDR", ILS = "ILS", IMP = "IMP", INR = "INR", IQD = "IQD", IRR = "IRR", ISK = "ISK", JEP = "JEP", JMD = "JMD", JOD = "JOD", JPY = "JPY", KES = "KES", KGS = "KGS", KHR = "KHR", KMF = "KMF", KPW = "KPW", KRW = "KRW", KWD = "KWD", KYD = "KYD", KZT = "KZT", LAK = "LAK", LBP = "LBP", LKR = "LKR", LRD = "LRD", LSL = "LSL", LYD = "LYD", MAD = "MAD", MDL = "MDL", MGA = "MGA", MKD = "MKD", MMK = "MMK", MNT = "MNT", MOP = "MOP", MRO = "MRO", MUR = "MUR", MVR = "MVR", MWK = "MWK", MXN = "MXN", MYR = "MYR", MZN = "MZN", NAD = "NAD", NGN = "NGN", NIO = "NIO", NOK = "NOK", NPR = "NPR", NZD = "NZD", OMR = "OMR", PAB = "PAB", PEN = "PEN", PGK = "PGK", PHP = "PHP", PKR = "PKR", PLN = "PLN", PYG = "PYG", QAR = "QAR", RON = "RON", RSD = "RSD", RUB = "RUB", RWF = "RWF", SAR = "SAR", SBD = "SBD", SCR = "SCR", SDG = "SDG", SEK = "SEK", SGD = "SGD", SHP = "SHP", SLL = "SLL", SOS = "SOS", SPL = "SPL", SRD = "SRD", STD = "STD", SVC = "SVC", SYP = "SYP", SZL = "SZL", THB = "THB", TJS = "TJS", TMT = "TMT", TND = "TND", TOP = "TOP", TRY = "TRY", TTD = "TTD", TVD = "TVD", TWD = "TWD", TZS = "TZS", UAH = "UAH", UGX = "UGX", USD = "USD", UYU = "UYU", UZS = "UZS", VEF = "VEF", VND = "VND", VUV = "VUV", WST = "WST", XAF = "XAF", XCD = "XCD", XDR = "XDR", XOF = "XOF", XPF = "XPF", YER = "YER", ZAR = "ZAR", ZMW = "ZMW", ZWD = "ZWD" } export enum Country { UnitedStates = "US", Afghanistan = "AF", AlandIslands = "AX", Albania = "AL", Algeria = "DZ", AmericanSamoa = "AS", Andorra = "AD", Angola = "AO", Anguilla = "AI", Antarctica = "AQ", AntiguaAndBarbuda = "AG", Argentina = "AR", Armenia = "AM", Aruba = "AW", Australia = "AU", Austria = "AT", Azerbaijan = "AZ", Bahamas = "BS", Bahrain = "BH", Bangladesh = "BD", Barbados = "BB", Belarus = "BY", Belgium = "BE", Belize = "BZ", Benin = "BJ", Bermuda = "BM", Bhutan = "BT", Bolivia = "BO", BonaireSintEustatiusSaba = "BQ", BosniaAndHerzegovina = "BA", Botswana = "BW", BouvetIsland = "BV", Brazil = "BR", BritishIndianOceanTerritory = "IO", BruneiDarussalam = "BN", Bulgaria = "BG", BurkinaFaso = "BF", Burundi = "BI", Cambodia = "KH", Cameroon = "CM", Canada = "CA", CapeVerde = "CV", CaymanIslands = "KY", CentralAfricanRepublic = "CF", Chad = "TD", Chile = "CL", China = "CN", ChristmasIsland = "CX", CocosKeelingIslands = "CC", Colombia = "CO", Comoros = "KM", Congo = "CG", CongoDemocraticRepublic = "CD", CookIslands = "CK", CostaRica = "CR", CoteDIvoire = "CI", Croatia = "HR", Cuba = "CU", Curaçao = "CW", Cyprus = "CY", CzechRepublic = "CZ", Denmark = "DK", Djibouti = "DJ", Dominica = "DM", DominicanRepublic = "DO", Ecuador = "EC", Egypt = "EG", ElSalvador = "SV", EquatorialGuinea = "GQ", Eritrea = "ER", Estonia = "EE", Ethiopia = "ET", FalklandIslands = "FK", FaroeIslands = "FO", Fiji = "FJ", Finland = "FI", France = "FR", FrenchGuiana = "GF", FrenchPolynesia = "PF", FrenchSouthernTerritories = "TF", Gabon = "GA", Gambia = "GM", Georgia = "GE", Germany = "DE", Ghana = "GH", Gibraltar = "GI", Greece = "GR", Greenland = "GL", Grenada = "GD", Guadeloupe = "GP", Guam = "GU", Guatemala = "GT", Guernsey = "GG", Guinea = "GN", GuineaBissau = "GW", Guyana = "GY", Haiti = "HT", HeardIslandMcdonaldIslands = "HM", HolySeeVaticanCityState = "VA", Honduras = "HN", HongKong = "HK", Hungary = "HU", Iceland = "IS", India = "IN", Indonesia = "ID", Iran = "IR", Iraq = "IQ", Ireland = "IE", IsleOfMan = "IM", Israel = "IL", Italy = "IT", Jamaica = "JM", Japan = "JP", Jersey = "JE", Jordan = "JO", Kazakhstan = "KZ", Kenya = "KE", Kiribati = "KI", Korea = "KR", KoreaDemocraticPeoplesRepublic = "KP", Kuwait = "KW", Kyrgyzstan = "KG", LaoPeoplesDemocraticRepublic = "LA", Latvia = "LV", Lebanon = "LB", Lesotho = "LS", Liberia = "LR", LibyanArabJamahiriya = "LY", Liechtenstein = "LI", Lithuania = "LT", Luxembourg = "LU", Macao = "MO", Macedonia = "MK", Madagascar = "MG", Malawi = "MW", Malaysia = "MY", Maldives = "MV", Mali = "ML", Malta = "MT", MarshallIslands = "MH", Martinique = "MQ", Mauritania = "MR", Mauritius = "MU", Mayotte = "YT", Mexico = "MX", Micronesia = "FM", Moldova = "MD", Monaco = "MC", Mongolia = "MN", Montenegro = "ME", Montserrat = "MS", Morocco = "MA", Mozambique = "MZ", Myanmar = "MM", Namibia = "NA", Nauru = "NR", Nepal = "NP", Netherlands = "NL", NewCaledonia = "NC", NewZealand = "NZ", Nicaragua = "NI", Niger = "NE", Nigeria = "NG", Niue = "NU", NorfolkIsland = "NF", NorthernMarianaIslands = "MP", Norway = "NO", Oman = "OM", Pakistan = "PK", Palau = "PW", PalestinianTerritory = "PS", Panama = "PA", PapuaNewGuinea = "PG", Paraguay = "PY", Peru = "PE", Philippines = "PH", Pitcairn = "PN", Poland = "PL", Portugal = "PT", PuertoRico = "PR", Qatar = "QA", Reunion = "RE", Romania = "RO", RussianFederation = "RU", Rwanda = "RW", SaintBarthelemy = "BL", SaintHelena = "SH", SaintKittsAndNevis = "KN", SaintLucia = "LC", SaintMartin = "MF", SaintPierreAndMiquelon = "PM", SaintVincentAndGrenadines = "VC", Samoa = "WS", SanMarino = "SM", SaoTomeAndPrincipe = "ST", SaudiArabia = "SA", Senegal = "SN", Serbia = "RS", Seychelles = "SC", SierraLeone = "SL", Singapore = "SG", SintMaarten = "SX", Slovakia = "SK", Slovenia = "SI", SolomonIslands = "SB", Somalia = "SO", SouthAfrica = "ZA", SouthGeorgiaAndSandwichIsl = "GS", SouthSudan = "SS", Spain = "ES", SriLanka = "LK", Sudan = "SD", Suriname = "SR", SvalbardAndJanMayen = "SJ", Swaziland = "SZ", Sweden = "SE", Switzerland = "CH", SyrianArabRepublic = "SY", Taiwan = "TW", Tajikistan = "TJ", Tanzania = "TZ", Thailand = "TH", TimorLeste = "TL", Togo = "TG", Tokelau = "TK", Tonga = "TO", TrinidadAndTobago = "TT", Tunisia = "TN", Turkey = "TR", Turkmenistan = "TM", TurksAndCaicosIslands = "TC", Tuvalu = "TV", Uganda = "UG", Ukraine = "UA", UnitedArabEmirates = "AE", UnitedKingdom = "GB", UnitedStatesOutlyingIslands = "UM", Uruguay = "UY", Uzbekistan = "UZ", Vanuatu = "VU", Venezuela = "VE", VietNam = "VN", VirginIslandsBritish = "VG", VirginIslandsUS = "VI", WallisAndFutuna = "WF", WesternSahara = "EH", Yemen = "YE", Zambia = "ZM", Zimbabwe = "ZW" } export enum Language { Hebrew = "HE", Greek = "EL", Slavonic = "CU", Slavic = "CU", Tonga = "TO", Polabian = "PO", Abkhazian = "AB", Afar = "AA", Afrikaans = "AF", Akan = "AK", Albanian = "SQ", Amharic = "AM", Arabic = "AR", Aragonese = "AN", Armenian = "HY", Assamese = "AS", Avaric = "AV", Avestan = "AE", Aymara = "AY", Azerbaijani = "AZ", Bambara = "BM", Bashkir = "BA", Basque = "EU", Belarusian = "BE", Bengali = "BN", Bislama = "BI", Bosnian = "BS", Breton = "BR", Bulgarian = "BG", Burmese = "MY", Chamorro = "CH", Chechen = "CE", Chinese = "ZH", Chuvash = "CV", Cornish = "KW", Corsican = "CO", Cree = "CR", Croatian = "HR", Czech = "CS", Danish = "DA", Dzongkha = "DZ", English = "EN", Esperanto = "EO", Estonian = "ET", Ewe = "EE", Faroese = "FO", Fijian = "FJ", Finnish = "FI", French = "FR", Fulah = "FF", Galician = "GL", Georgian = "KA", German = "DE", 'Guaraní' = "GN", Gujarati = "GU", Hausa = "HA", Herero = "HZ", Hindi = "HI", Hungarian = "HU", Interlingua = "IA", Indonesian = "ID", Interlingue = "IE", Irish = "GA", Igbo = "IG", Inupiaq = "IK", Ido = "IO", Icelandic = "IS", Italian = "IT", Inuktitut = "IU", Japanese = "JA", Javanese = "JV", Kannada = "KN", Kanuri = "KR", Kashmiri = "KS", Kazakh = "KK", Kinyarwanda = "RW", Komi = "KV", Kongo = "KG", Korean = "KO", Kurdish = "KU", Latin = "LA", Ganda = "LG", Lingala = "LN", Lao = "LO", Lithuanian = "LT", 'Luba-Katanga' = "LU", Latvian = "LV", Manx = "GV", Macedonian = "MK", Malagasy = "MG", Malay = "MS", Malayalam = "ML", Maltese = "MT", Maori = "MI", Marathi = "MR", Marshallese = "MH", Mongolian = "MN", Nauru = "NA", Nepali = "NE", Ndonga = "NG", Norwegian = "NO", Occitan = "OC", Ojibwa = "OJ", Oromo = "OM", Oriya = "OR", Pali = "PI", Persian = "FA", Polish = "PL", Portuguese = "PT", Quechua = "QU", Romansh = "RM", Rundi = "RN", Russian = "RU", Sanskrit = "SA", Sardinian = "SC", Sindhi = "SD", Samoan = "SM", Sango = "SG", Serbian = "SR", Shona = "SN", Slovak = "SK", Slovenian = "SL", Somali = "SO", Sundanese = "SU", Swahili = "SW", Swati = "SS", Swedish = "SV", Tamil = "TA", Telugu = "TE", Tajik = "TG", Thai = "TH", Tigrinya = "TI", Tibetan = "BO", Turkmen = "TK", Tagalog = "TL", Tswana = "TN", Turkish = "TR", Tsonga = "TS", Tatar = "TT", Twi = "TW", Tahitian = "TY", Ukrainian = "UK", Urdu = "UR", Uzbek = "UZ", Venda = "VE", Vietnamese = "VI", 'Volapük' = "VO", Walloon = "WA", Welsh = "CY", Wolof = "WO", Xhosa = "XH", Yiddish = "YI", Yoruba = "YO", Zulu = "ZU", Catalan = "CA", Valencian = "CA", Chichewa = "NY", Chewa = "NY", Nyanja = "NY", Divehi = "DV", Dhivehi = "DV", Maldivian = "DV", Dutch = "NL", Flemish = "NL", Haitian = "HT", HaitianCreole = "HT", Kalaallisut = "KL", Greenlandic = "KL", Kikuyu = "KI", Gikuyu = "KI", Kirghiz = "KY", Kyrgyz = "KY", Kuanyama = "KJ", Kwanyama = "KJ", Luxembourgish = "LB", Letzeburgesch = "LB", Limburgan = "LI", Limburger = "LI", Limburgish = "LI", Navajo = "NV", Navaho = "NV", SichuanYi = "II", Nuosu = "II", Ossetian = "OS", Ossetic = "OS", Panjabi = "PA", Punjabi = "PA", Pashto = "PS", Pushto = "PS", Romanian = "RO", Moldavian = "RO", Moldovan = "RO", Gaelic = "GD", ScottishGaelic = "GD", Sinhala = "SI", Sinhalese = "SI", Spanish = "ES", Castilian = "ES", Uighur = "UG", Uyghur = "UG", Zhuang = "ZA", Chuang = "ZA" } export enum BsLogEvents { NudgeAction = "nudge-action" } export enum BsLogEventType { Redirect = "redirect", AddToCart = "add_to_cart" } } declare module "modules/ECommerce/oxygen.typings" { export interface OxygenMeta { order_type: string; reason: string; } export interface OxygenProperties { market_id: string; packaging: string; packaging_size: number; packaging_units: string; supplier_id?: string; supplier_name?: string; } /** * @internal */ export interface InternalOxygenProperties extends OxygenProperties { id: string; } } declare module "modules/ECommerce/typings" { import { BloodMeta } from "modules/ECommerce/blood.typings"; import { CurrencyCode } from "core/commonTypes"; import { OxygenMeta } from "modules/ECommerce/oxygen.typings"; export enum ECommerceTypes { Cancel = "cancel_checkout", Cart = "cart", Checkout = "checkout", Delivery = "delivery", Item = "item", List = "list", Rate = "rate", ScheduleDelivery = "schedule_delivery" } export 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 enum ItemType { Blood = "blood", Book = "book", Clothing = "clothing", Drug = "drug", Electronics = "electronics", MedicalEquipment = "medical_equipment", Misc = "misc", Oxygen = "oxygen" } export 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 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 enum ListAction { Add = "add_item", Discard = "discard", Edit = "edit_item", Remove = "remove_item", View = "view" } export 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 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 enum CancelType { Cart = "cart", Order = "order" } export interface CancelCheckoutProperties { id: string; type: CancelType; items: TypedItem[]; reason: string; meta?: any; } export 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; } } declare module "modules/Loyalty/typings" { export enum LoyaltyTypes { Level = "level", Milestone = "milestone", Promo = "promo" } export enum PromoAction { Apply = "apply", View = "view" } export enum PromoType { AddToCart = "add_to_cart", Coupon = "coupon" } export enum PromoItemType { Blood = "blood", Book = "book", Clothing = "clothing", Drug = "drug", Electronics = "electronics", Misc = "misc", Oxygen = "oxygen" } export interface PromoItem { id: string; type: PromoItemType; } export interface PromoProperties { id: string; action: PromoAction; items: PromoItem[]; title: string; type: PromoType; } export interface LevelProperties { prev_level: number; new_level: number; module_id?: string; meta?: any; } export enum MilestoneAction { Achieved = "achieved" } export interface MilestoneProperties { id: string; action: MilestoneAction; } } declare module "modules/ELearning/typings" { export enum ELearningTypes { Module = "module", Question = "question", Exam = "exam" } export enum ExamAction { Start = "start", Submit = "submit", Result = "result" } export type ExamProperties = { id: string; action: "submit"; duration: number; meta?: any; } | { id: string; action: "result"; score: number; is_passed: boolean; meta?: any; } | { id: string; action: "start"; meta?: any; }; export enum ModuleAction { View = "view" } export interface ModuleProperties { id: string; progress: number; action: ModuleAction; meta?: any; } export enum QuestionAction { Answer = "answer", Skip = "skip" } export interface QuestionProperties { id: string; exam_id: string; action: QuestionAction; answer_id: string; meta?: any; } } declare module "modules/Navigation/typings" { import { Country, Language, SearchFilter } from "core/commonTypes"; import { TypedItem } from "modules/ECommerce/typings"; export enum NavigationTypes { App = "app", Identify = "identify", Media = "media", NudgeResponse = "nudge_response", Page = "page", Promo = "promo", Rate = "rate", Scroll = "scroll", Search = "search", Track = "track" } export enum ContentBlock { Core = "core", ELearning = "e-learning", ECommerce = "e-commerce", Social = "social", Payment = "payment", Loyalty = "loyalty" } export enum AppAction { Background = "background", Close = "close", Open = "open", Resume = "resume" } export enum IdentifyAction { Login = "login", Logout = "logout", Register = "register" } export enum MediaActionForVideo { Play = "play", Pause = "pause", Seek = "seek", Finish = "finish" } export enum MediaActionForImage { Play = "play" } export interface AppProperties { action: AppAction; start_time: number; } export interface IdentifyProperties { action: IdentifyAction; } export interface UserInfo extends IdentifyProperties { user_props: UserProperties; } export type ImageProperties = { /** * The block or module where the media is embedded. For example, * 'e-elearning' if the media is included as an activity * of the course * */ contentBlock?: ContentBlock; type: ImageType; id: string; action: MediaActionForImage; time: number; meta?: any; }; export enum ImageType { Image = "image" } export enum AudioVideoType { Audio = "audio", Video = "video" } export type AudioVideoProperties = { /** * The block or module where the media is embedded. For example, * 'e-elearning' if the the video or audio is included as an activity * of the course * */ contentBlock?: ContentBlock; type: AudioVideoType; id: string; action: MediaActionForVideo; time: number; meta?: any; }; export type MediaProperties = ImageProperties | AudioVideoProperties; /** * @internal */ export type InternalMediaProperties = MediaProperties & { id_source: string; }; export type MediaData = { name?: string; length: string; description?: string; resolution?: string; language?: Language; }; /** * @internal */ export type InternalMediaData = MediaData & { id_source: string; id: string; type: AudioVideoType; }; export enum PageType { View = "view", Completed = "completed" } export interface PageProperties { path: string; title?: string; duration?: number; meta?: any; } export enum NudgeAction { Block = "block", Discard = "discard", Open = "open" } export enum NudgeResponseType { Push = "push_notification", InApp = "in_app_message" } export interface NudgeResponseProperties { nudge_id: number; type: NudgeResponseType; response: { action: NudgeAction; }; resolved_action: any; } /** * This interface represents the information related to * a search */ export interface SearchProperties { /** * The block or module where the search was peformed. For example, * 'e-commerce' if the user made a serch in the marketplace section, * or 'e-elearning' is the search was performed in the courses/classes * section */ contentBlock?: ContentBlock; /** * Free text introduced by the user to search */ query: string; /** * If the search results are shown paginaged, or with infinite scroll, * this field represent the number of page/subset the current result_ids * belongs to */ page: number; /** * Current list of items IDs obtained for this search and page. * If the user have pressed in a new page number, of scroll down * and the web automatically retrieved new item, include here only * the new ones */ results_ids?: Array<string | TypedItem>; /** * If the search engine allow to select specific value to search * in a selectable list, include here an object whose keys are the * attributes to search, and the values the actual values that must * match */ filter?: SearchFilter; /** * Any other additional information to be available in the logs */ meta?: any; } /** * @internal * * checkers do not support Omit, which will be usefull here to remove the result_ids list */ export interface InternalSearchProperties { id: string; results_list: Array<TypedItem>; contentBlock?: ContentBlock; query: string; page: number; filter?: SearchFilter; meta?: any; } export enum EducationLevel { Primary = "primary", LowerSecondary = "lower_secondary", UpperSecondary = "upper_secondary", NonTertiary = "non_tertiary", Tertiary = "tertiary", Bachelors = "bachelors", Masters = "masters", Doctorate = "doctorate" } export interface UserProperties { name?: string; organization?: string; experience?: string; region_state?: string; city?: string; workplace?: string; profession?: string; zipcode?: string; /** * ISO 8601 string (ie.: +0200) * Generated automatically by the SDK */ timezone?: string; /** * country which the user is, represented as * two characters in ISO 3166 */ country?: Country; /** * iSO 639-1 */ language?: Language; education_level?: EducationLevel; } /** * @internal */ export interface InternalUserProperties extends UserProperties { id: string; organization_id?: string; organization_name?: string; } export enum TrackTypes { ReferenceGuide = "reference_guide" } export enum TrackActions { ViewList = "view_list", ViewItem = "view_item", ExternalLink = "external_link" } export type TrackProperties = { action: TrackActions.ViewList | TrackActions.ExternalLink; meta?: any; } | { action: TrackActions.ViewItem; item_id: string; meta?: any; }; /** * @internal */ export type TrackPropertiesInternal = TrackProperties & { type: TrackTypes; }; export enum RateType { App = "app", Exam = "exam", Media = "media", Order = "order" } export interface RateProperties { rate_value: number; type: RateType; subject_id: string; } } declare module "modules/Payments/typings" { import { CurrencyCode } from "core/commonTypes"; export enum PaymentsTypes { DeferredPayment = "deferred_payment", PaymentMethod = "payment_method" } export enum PaymentsMethodType { BankCard = "bank_card", BankTransfer = "bank_transfer", CashOnDelivery = "cash_on_delivery", Cheque = "cheque", Credit = "credit", PointOfSale = "point_of_sale", Other = "other" } export enum DeferredPaymentType { PaymentProcessed = "payment_processed" } export interface DeferredPaymentProperties { id: string; /** * this `order_id` will map with the IDs * within both `Checkout` and `Delivery` events */ order_id: string; action: DeferredPaymentType; account_balance: number; payment_amount: number; currency: CurrencyCode; is_successful: boolean; type?: PaymentsMethodType; meta?: any; } /** * @internal */ export interface InternalDeferredPaymentProperties { usd_rate: number; } export interface PaymentMethodProperties { order_id: string; type: PaymentsMethodType; payment_amount: number; currency: CurrencyCode; meta?: any; } /** * @internal */ export interface InternalPaymentMethodProperties { usd_rate: number; } } declare module "modules/ReferenceGuide/typings" { export enum ReferenceGuideTypes { Interact = "interact" } export enum InteractTypes { ViewList = "view_list", ViewItem = "view_item", ExternalLink = "external_link" } export interface InteractProperties { type: InteractTypes; item_id: string; meta?: any; } } declare module "modules/Feed/typings" { import { SearchFilter } from "core/commonTypes"; export enum FeedTypes { Publication = "publication", Feed = "feed" } export enum PublicationAction { /** * User has added a new publication to the feed. * It must be of type "Post", since it is not a * reply to an existing one */ Create = "create", /** * The publication have been deleted */ Delete = "delete", /** * The publication have been edited. This action log * must be created when the edition ends and the user * publish it */ Edit = "edit", /** * The publication has been marked as Liked. Depending on the * application, the user interface may show another word * (Like, Recommend, Kudos, etc). Just just this action for any of them */ Like = "like", /** * User removes the Like from this publication */ Unlike = "unlike", /** * User have subscribed to updates on this publication */ Subscribe = "subscribe", /** * User shares this publication. It may be an `in_app` share or * use an external service like Whatsapp, Facebook, etc */ Share = "share", /** * This publication have been flagged by the user */ Report = "report", /** * User has reply to either a comment or a post */ Reply = "reply", /** * The user requires the direct link to this publication */ CopyLink = "copy_link" } export enum PublicationType { Comment = "comment", Post = "post" } export interface PublicationProperties { action: PublicationAction; share_via?: string; id: string; type: PublicationType; meta?: any; } export enum FeedType { News = "news", Qa = "qa", Jobs = "jobs" } export interface FeedProperties { type: FeedType; filter?: SearchFilter; meta?: any; } } declare module "core/typings" { import { CartProperties, CheckoutProperties, DeliveryProperties, ECommerceTypes, ItemProperties } from "modules/ECommerce/typings"; import { LevelProperties, MilestoneProperties } from "modules/Loyalty/typings"; import { ELearningTypes } from "modules/ELearning/typings"; import { LoyaltyTypes } from "modules/Loyalty/typings"; import { AppProperties, ContentBlock, IdentifyProperties, InternalSearchProperties, MediaProperties, NavigationTypes, PageProperties, NudgeResponseProperties } from "modules/Navigation/typings"; import { DeferredPaymentProperties, PaymentsTypes } from "modules/Payments/typings"; import { InteractProperties, ReferenceGuideTypes } from "modules/ReferenceGuide/typings"; import { FeedProperties, FeedTypes, PublicationProperties } from "modules/Feed/typings"; export enum GlobalTypes { NavigationTypes = 0, ECommerceTypes = 1 } export interface BsBrowserOptions { logScroll: boolean; logPage: boolean; logUrlChanges: boolean; flushOnLeave: boolean; } export interface LogIngestorOptions { flushInterval: number; flushMaxRetries: number; ingestPath: string; cacheEventsInLocalstorage: boolean; cacheEventsKey: string; } export interface BsLogOptions { cdnUrl: string; baseUrl: string; nudgeFetchPath: string; currencyPath: string; catalogPath: string; activateNudgeMechanism: boolean; defaultBlock: ContentBlock; debug: boolean; skipDynamicLoading?: boolean; } export interface BatteryStatus { charging: boolean; chargingTime: number; dischargingTime: number; level: number; } export interface EventContext { browser?: { user_agent: string; languages: string[]; online: boolean; battery?: BatteryStatus; }; } export type AnyKnownType = NavigationTypes | ECommerceTypes | ELearningTypes | ReferenceGuideTypes | PaymentsTypes | LoyaltyTypes | FeedTypes; export type EventTeaser = { name?: string; type: NavigationTypes; props: PageProperties | AppProperties | IdentifyProperties | MediaProperties | InternalSearchProperties | NudgeResponseProperties; } | { name?: string; type: ECommerceTypes; props: CartProperties | DeliveryProperties | CheckoutProperties | ItemProperties; } | { name?: string; type: ReferenceGuideTypes; props: InteractProperties; } | { name?: string; type: PaymentsTypes; props: DeferredPaymentProperties; } | { name?: string; type: LoyaltyTypes; props: LevelProperties | MilestoneProperties; } | { name?: string; type: FeedTypes; props: PublicationProperties | FeedProperties; }; export type EventCommon = { block: ContentBlock; ol: boolean; ts: string; }; export type Event = EventTeaser & EventCommon; export type DeviceInfoObject = { id: string; brand: string; model: string; os: string; os_ver: string; }; export type AppInfoObject = { id: string; min_sdk_version: number; target_sdk_version: number; version_code: number; version_name: string; version: string; }; export type EventMainObject = { s_id: string; u_id: string; app_info: AppInfoObject; d_info: DeviceInfoObject; sdk: string; up?: number; dn?: number; data?: Event[]; }; export interface QueueItem { uuid: string; event: Event; time: number; retries: number; lastRetry?: number; } export interface TypedRows { header: string[]; data_type: string[]; rows: any[][]; } } declare module "core/impressions/typings" { export interface Dataset { [key: string]: string; } export interface IImpression { time_in: number; data: Dataset; } export interface ViewableImpressionOptions { triggerInterval: number; keepVisibleTimeout: number; intersectionThreshold: number; } export interface IImpressionManager { start(containerClassname: string, itemClassname: string, appData: Dataset): any; stop(): any; } export enum ImpressionEventType { Impression = "impression" } } declare module "core/repositories/nudges/typings" { export enum CTAType { None = "", Redirect = "redirect", AddToCart = "add_to_cart" } export interface CTA { type: CTAType; cta_resource: CTAResource; } export interface CTADefinition { title: string; body: string; } export interface CTAAction { id: number; org_proj: string; name: string; description: string; tags: string[]; type: string; uses: number; target_cohort_ids: number[]; created_by: string; created_at: string; resolve_detail: any; call_to_action: CTA; definition: CTADefinition; } export interface CTAResource { type: string; id: string; } export interface Nudge { id: number; dispatched_at: string; expire_at: string; action: CTAAction; ref_type: string; ref_id: number; } export interface INudgesRepository { getNudges(userId: string): Promise<Nudge[]>; markNudgeAsShown(nudgeId: string): void; haveBeenAlreadyShown(nudgeId: string): boolean; } } declare module "drivers/network/typings" { export interface NetworkProxy { get(url: string): Promise<Object>; send(url: string, payload: any): any; } } declare module "drivers/notifications/typings" { export interface NotificationDispatcher { on<U extends keyof BsNotificationEvents>(event: U, listener: BsNotificationEvents[U]): this; emit<U extends keyof BsNotificationEvents>(event: U, ...args: Parameters<BsNotificationEvents[U]>): boolean; } export enum NotificationAction { Block = "block", Discard = "discard", Open = "open" } export interface BsNotificationEvents { [NotificationAction.Block]: (id: number) => void; [NotificationAction.Discard]: (id: number) => void; [NotificationAction.Open]: (id: number) => void; } export interface NotificationDispatcher { show(title: string, body: string, id: number): any; } } declare module "drivers/storage/typings" { export interface IStorage { save(key: string, value: string): any; get(key: string): any; } } declare module "modules/typings" { export enum EventType { Identify = "identify", Page = "page", Level = "level", Purchase = "purchase", View = "view", Scroll = "scroll", PushNotification = "push_notification", Video = "video", Audio = "audio", Track = "track", Click = "click" } export enum DebugLevel { Debug = 0, Info = 1, Log = 2, Warn = 3, Error = 4, None = 5 } export interface BsBrowserOptions { logScroll: boolean; logPage: boolean; logUrlChanges: boolean; flushOnLeave: boolean; } export interface BsLogOptions { flushInterval: number; flushMaxRetries: number; endpoint: string; cacheEventsInLocalstorage: boolean; cacheEventsKey: string; debugLevel: DebugLevel; } export interface BatteryStatus { charging: boolean; chargingTime: number; dischargingTime: number; level: number; } export interface EventContext { browser?: { user_agent: string; languages: string[]; online: boolean; battery?: BatteryStatus; }; } export interface EventTeaser { user_id: string; type: EventType; name?: string; properties: Record<string, any>; } export interface Event extends EventTeaser { uuid: string; device_time: number; context: EventContext; } export interface QueueItem { uuid: string; event: Event; time: number; retries: number; lastRetry?: number; } } declare module "modules/Social/typings" { export enum SocialTypes { Profile = "profile", ProfileList = "profile_list" } export enum ProfileType { User = "user", Organization = "organization" } export enum ProfileAction { View = "view", Follow = "follow", Unfollow = "unfollow", Peek = "peek", Share = "share" } export interface ProfileProperties { type: ProfileType; action: ProfileAction; profile_id: string; share_via?: string; meta?: any; } export enum ProfileListType { Followers = "followers", Followings = "followings" } export interface ProfileListProperties { type: ProfileListType; meta?: any; } } declare module "BsLog"; declare module "ECommerce"; declare module "Loyalty"; declare module "Navigation"; declare module "ELearning"; declare module "Payments"; declare module "@benshi.ai/js-sdk" { export * from "modules/ECommerce/typings" export * from "modules/ELearning/typings" export * from "modules/Loyalty/typings" export * from "modules/Navigation/typings" export * from "modules/Payments/typings" export * from "core/commonTypes" export * from "core/typings" export { BsLog } from "BsLog" export { ECommerce } from "ECommerce" export { ELearning } from "ELearning" export { Loyalty } from "Loyalty" export { Navigation } from "Navigation" export { Payments } from "Payments" }