UNPKG

@benshi.ai/js-sdk

Version:

Benshi SDK

927 lines 33.4 kB
{ "properties": { "ol": { "type": "boolean", "examples": [ false ], "description": "connectivity status of the device when event was triggered." }, "ts": { "type": "string", "examples": [ "2022-04-27T08:30:06.239Z" ], "description": "timestamp when the event is triggered, RFC 3339 format." }, "block": { "type": "string", "enum": [ "core", "e-commerce", "e-learning", "loyalty", "payment" ], "examples": [ "core" ], "description": "content block for the event being logged. default is core." } }, "required": [ "ol", "ts", "block", "props"], "$defs": { "d_info": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "23892738971" ], "description": "id for the device." }, "brand": { "type": "string", "examples": [ "samsung" ], "description": "brand for the device." }, "model": { "type": "string", "examples": [ "galaxy" ], "description": "model for the device." }, "os": { "type": "string", "examples": [ "android" ], "description": "os for the device." }, "os_ver": { "type": "string", "examples": [ "21" ], "description": "os_ver for the device." } }, "description": "To log device related events. [Auto Tracked]." }, "app": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "open", "close", "background", "resume" ], "examples": [ "open" ], "description": "logs the operation on the app, if app is opened, closed or moved the background." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log App usage related events. [Auto Triggered]." }, "page": { "type": "object", "properties": { "path": { "type": "string", "examples": [ "ai.causalfoundry.package OR causalfoundry.ai/package" ], "description": "the path for page currently being shown to the user." }, "title": { "type": "string", "examples": [ "HomePage" ], "description": "page or class name for the screen currently being shown." }, "duration": { "type": "number", "examples": [ 3.4 ], "description": "the time user spent on the screen in seconds." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log page viewings related events. [Auto Triggered]." }, "identify": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "register", "login", "logout" ], "examples": [ "login" ], "description": "identify action being logged." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log user auth related events. signUp, signIn and signOut." }, "search": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "testSearchId" ], "description": "special id associated with that search." }, "query": { "type": "string", "examples": [ "Hello" ], "description": "query the user is searching." }, "results_list": { "type": "array", "description": "list of ids and types for the elements shown in the search results." }, "filter": { "type": "object", "examples": [ "maxPrice:100" ], "description": "hashmap object of filters applied to that search." }, "page": { "type": "integer", "examples": [ 1 ], "description": "page number for search on which user is currently at." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log search related events." }, "media": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "video_testMediaId" ], "description": "id associated with that media concatenated with media type." }, "id_source": { "type": "string", "examples": [ "testMediaId" ], "description": "id associated with that media." }, "type": { "type": "string", "enum": [ "video", "audio", "image" ], "examples": [ "video" ], "description": "type of media in question." }, "action": { "type": "string", "enum": [ "impression", "finish", "pause", "play", "seek" ], "examples": [ "play" ], "description": "actions associated to the media. For image, default is play which refers to app open." }, "time": { "type": "number", "examples": [ 1354000 ], "description": "time in milliseconds for the media when action is performed." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log media related events." }, "rate": { "type": "object", "properties": { "rate_value": { "type": "number", "examples": [ 4.5 ], "description": "rate value for the element, range is 0 to 5 (both inclusive)." }, "type": { "type": "string", "enum": [ "app", "blood", "drug", "exam", "media", "medical_equipment", "order", "oxygen" ], "examples": [ "order" ], "description": "type of the element the rate is asked for." }, "subject_id": { "type": "string", "examples": [ "elementId" ], "description": "id of the element being rated." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "to log events related to providing rate experience for the elements in the app." }, "track": { "type": "object", "properties": { "type": { "type": "string", "examples": [ "reference_guide" ], "description": "defaulted to reference_guide." }, "action": { "type": "string", "enum": [ "view_list", "view_item", "external_link" ], "examples": [ "view_list" ], "description": "type of event performed." }, "item_id": { "type": "string", "examples": [ "elementId" ], "description": "id of the element being viewed." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events associated to in-app dictionary." }, "nudge_response": { "type": "object", "properties": { "nudge_id": { "type": "integer", "examples": [ "nudgeId" ], "description": "id associated with that nudge" }, "type": { "type": "string", "examples": [ "push_notification" ], "description": "type of nudge the response is for. Should be same as provided by type in the request nudge API." }, "response": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "open", "discard", "block" ], "examples": [ "open" ], "description": "type of action performed on the push notification" } }, "description": "response object containing actions for the nudge shown. This can vary based on the type of the nudge shown to the user." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log user response to nudges i.e. push notifications, in-app messages. [Auto Triggered]." }, "item": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "add_favorite", "add_reminder", "detail", "impression", "remove_favorite", "remove_reminder", "remove_reminder_auto", "view" ], "examples": [ "view" ], "description": "action performed on the item." }, "item": { "$ref": "#/$defs/itemObject", "description": "details for the item in log." }, "search_id": { "type": "string", "examples": [ "testSearchId" ], "description": "helps with logging search if if the item is showed based on search." }, "usd_rate": { "type": "number", "examples": [ 0.05 ], "description": "conversion value to USD for the currency provided in the item." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to item view, impressions or if user opened the details." }, "cart": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "cartId" ], "description": "id of the Cart on which events are being performed." }, "action": { "type": "string", "enum": [ "add_item", "remove_item" ], "examples": [ "add_item" ], "description": "action performed on the item in cart." }, "item": { "$ref": "#/$defs/itemObject", "description": "details for the item in log." }, "cart_price": { "type": "number", "examples": [ 12 ], "description": "total price of the cart." }, "currency": { "type": "string", "examples": [ "USD" ], "description": "currency code for the price of the whole cart. Currency in itemObject and here should be same." }, "usd_rate": { "type": "number", "examples": [ 0.05 ], "description": "conversion value to USD for the currency provided in the item." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to cart in the app." }, "checkout": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "orderId" ], "description": "id of the order is checkout is successful else cart id if the checkout is not successful." }, "cart_id": { "type": "string", "examples": [ "cartId" ], "description": "id of the Cart on which events are being performed." }, "is_successful": { "type": "boolean", "examples": [ true ], "description": "reflect if the checkout is successful or not." }, "items": { "type": "array", "description": "list of items in the checkout." }, "cart_price": { "type": "number", "examples": [ 12 ], "description": "total price of the checkout." }, "currency": { "type": "string", "examples": [ "USD" ], "description": "currency code for the price of the checkout. Currency in all itemObject and here should be same." }, "usd_rate": { "type": "number", "examples": [ 0.05 ], "description": "conversion value to USD for the currency provided in the item." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to checkout in the app." }, "delivery": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "deliveredId" ], "description": "Id for the delivery." }, "action": { "type": "string", "enum": [ "delivered" ], "examples": [ "delivered" ], "description": "action on the delivery of the element." }, "order_id": { "type": "string", "examples": [ "orderId" ], "description": "id of the order being delivered." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to delivery of the order." }, "schedule_delivery": { "type": "object", "properties": { "order_id": { "type": "string", "examples": [ "testOrderId" ], "description": "Id for the order for which the delivery is set to be scheduled." }, "is_urgent": { "type": "boolean", "examples": [ false ], "description": "to set if the delivery is urgent or not." }, "action": { "type": "string", "enum": [ "schedule", "update" ], "examples": [ "schedule" ], "description": "action on the schedule delivery log, new schedule or updating an existing." }, "delivery_ts": { "type": "string", "examples": [ "2022-04-27T08:30:06.239Z" ], "description": "(RFC 3339) //currentTime for urgent, else pass the one provided to schedule." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "to log the time for which the delivery is set to be schedule." }, "cancel_checkout": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "testId" ], "description": "Id for the order or cart being discarded or cancelled." }, "type": { "type": "string", "enum": [ "cart", "order" ], "examples": [ "cart" ], "description": "type of the checkout that is being cancelled either cart or order." }, "items": { "type": "array", "description": "list of items in the checkout." }, "reason": { "type": "string", "examples": [ "Process Too Long" ], "description": "reason for which the order/cart is being cancelled/discarded." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "is used to log the event when the order/cart is canceled." }, "module": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "moduleId" ], "description": "id of the module." }, "action": { "type": "string", "enum": [ "view" ], "examples": [ "view" ], "description": "action performed on the module." }, "progress": { "type": "integer", "examples": [ 75 ], "description": "completion progress percentage." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to module of e-learning section." }, "exam": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "examId" ], "description": "id of the exam." }, "action": { "type": "string", "enum": [ "start", "submit", "result" ], "examples": [ "start" ], "description": "action performed on the exam." }, "duration": { "type": "integer", "examples": [ 75 ], "description": "time spent on the exam, in seconds." }, "score": { "type": "number", "examples": [ 90.5 ], "description": "score achieved for the exam." }, "is_passed": { "type": "boolean", "examples": [ true ], "description": "if user passed the exam?" }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to exam of e-learning section." }, "question": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "questionId" ], "description": "id of the question." }, "exam_id": { "type": "string", "examples": [ "examId" ], "description": "id of the exam from which the question is asked." }, "action": { "type": "string", "enum": [ "answer", "skip" ], "examples": [ "answer" ], "description": "action performed on the question." }, "answer_id": { "type": "string", "examples": [ "answerId" ], "description": "Id for the answer to the question." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to question of e-learning section." }, "level": { "type": "object", "properties": { "prev_level": { "type": "integer", "examples": [ 65 ], "description": "previous/old level score of the user." }, "new_level": { "type": "integer", "examples": [ 100 ], "description": "new level score of the user." }, "module_id": { "type": "string", "examples": [ "moduleId" ], "description": "Id for the module if level update is related to e-learning." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to updating user level in app." }, "milestone": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "milestoneId" ], "description": "id for the milestone." }, "action": { "type": "string", "enum": [ "achieved" ], "examples": [ "achieved" ], "description": "action regarding user milestone." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to updating user milestone in app." }, "promo": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "promoId" ], "description": "id for the Promo." }, "action": { "type": "string", "enum": [ "view", "apply" ], "examples": [ "apply" ], "description": "action regarding promo event, if the event is triggered for viewing promo or applying promo on the item." }, "title": { "type": "string", "examples": [ "buy 3 and get 10% off" ], "description": "promotional title for the promo." }, "type": { "type": "string", "enum": [ "add_to_cart", "coupon" ], "examples": [ "add_to_cart" ], "description": "type of the promo that if it is related to add the product in cart or for coupon." }, "items": { "type": "array", "description": "list of items in the promo." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "is to log the events associated of the promo lists and promo items and when they are clicked on." }, "deferred_payment": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "paymentId" ], "description": "id for the payment." }, "order_id": { "type": "string", "examples": [ "orderId" ], "description": "id for the order payment is made for." }, "action": { "type": "string", "enum": [ "payment_processed" ], "examples": [ "payment_processed" ], "description": "action regarding payment." }, "type": { "type": "string", "enum": [ "bank_transfer", "cheque", "cod", "credit", "pos", "bank_card", "other" ], "examples": [ "bank_transfer" ], "description": "method of payment being selected for the payment." }, "payment_amount": { "type": "number", "examples": [ 15 ], "description": "amount for which the payment is made." }, "account_balance": { "type": "number", "examples": [ 130 ], "description": "current account balance for user after payment amount is added." }, "currency": { "type": "string", "examples": [ "USD" ], "description": "currency of the payment being made (ISO 4217)." }, "usd_rate": { "type": "number", "examples": [ 0.05 ], "description": "conversion value to USD for the currency provided in the payment." }, "is_successful": { "type": "boolean", "examples": [ true ], "description": "boolean to represent if the payment is successful or not." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "To log events related to payments in uses cases where Buy Now Pay Later is implemented." }, "payment_method": { "type": "object", "properties": { "order_id": { "type": "string", "examples": [ "orderId" ], "description": "id for the order payment is made for." }, "type": { "type": "string", "enum": [ "bank_transfer", "cheque", "cod", "credit", "pos", "bank_card", "other" ], "examples": [ "bank_transfer" ], "description": "method of payment being selected for the payment." }, "payment_amount": { "type": "number", "examples": [ 15 ], "description": "amount for which the payment is made." }, "currency": { "type": "string", "examples": [ "USD" ], "description": "currency of the payment being made (ISO 4217)." }, "usd_rate": { "type": "number", "examples": [ 0.05 ], "description": "conversion value to USD for the currency provided in the payment." }, "meta": { "type": "object", "examples": [ "appName:causalfoundry" ], "description": "can use this to log extra data related to the event. This will only show on the platform and will not be processed." } }, "description": "is to log events for payments. Which method of the payment is selected for the order." }, "itemObject": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "itemId" ], "description": "Id for the item." }, "type": { "type": "string", "enum": [ "drug", "blood", "oxygen", "medical_equipment", "electronics", "clothing", "book", "misc" ], "examples": [ "drug" ], "description": "type of the item in the log." }, "quantity": { "type": "integer", "examples": [ 1 ], "description": "quantity of the item, default is 1." }, "price": { "type": "number", "examples": [ 12.3 ], "description": "total price for the item in log (unit_price * quantity)." }, "currency": { "type": "string", "examples": [ "USD" ], "description": "currency of the item (ISO 4217)." }, "stock_status": { "type": "string", "enum": [ "in_stock", "low_stock", "out_of_stock" ], "examples": [ "in_stock" ], "description": "to reflect the stock status of the item." }, "promo_id": { "type": "string", "examples": [ "testPromoId" ], "description": "id for the promo if any applied on the item." }, "meta": { "type": "object", "examples": [ "cross_matching:false" ], "description": "additional properties required for item with types as blood and oxygen. Also when the event type is checkout." } }, "required": [ "id", "type", "quantity", "price", "currency" ] }, "itemTypeObject": { "type": "object", "properties": { "id": { "type": "string", "examples": [ "itemId" ], "description": "Id for the item." }, "type": { "type": "string", "enum": [ "drug", "blood", "oxygen", "medical_equipment", "electronics", "clothing", "book", "misc" ], "examples": [ "drug" ], "description": "type of the item in the log." }, "meta": { "type": "object", "examples": [ "cross_matching:false" ], "description": "additional properties required for item with types as blood and oxygen. Also when the event type is checkout." } }, "required": [ "id", "type" ] }, "bloodMetaObject": { "type": "object", "properties": { "cross_matching": { "type": "boolean", "examples": [ false ], "description": "if the blood order also have a cross matching add-on enabled." }, "temperature_strips": { "type": "boolean", "examples": [ false ], "description": "if the blood order have temperature strip add-on enabled." }, "extra_tests": { "type": "boolean", "examples": [ false ], "description": "if the blood order have extra tests add-on enabled." }, "reason": { "type": "string", "examples": [ "General Surgery" ], "description": "reason for which blood is being purchased." } }, "required": [ "cross_matching", "temperature_strips", "extra_tests", "reason" ] }, "oxygenMetaObject": { "type": "object", "properties": { "order_type": { "type": "string", "examples": [ "refill" ], "description": "type of the order for oxygen, refill, exchange or new cylinder." }, "reason": { "type": "string", "examples": [ "General Surgery" ], "description": "reason for which the oxygen is being purchased." } }, "required": [ "order_type", "reason" ] } }, "oneOf": [ { "properties": { "type": { "const": "app" }, "props": { "type": "object", "$ref": "#/$defs/app" } } }, { "properties": { "type": { "const": "cart" }, "props": { "type": "object", "$ref": "#/$defs/cart" } } }, { "properties": { "type": { "const": "cancel_checkout" }, "props": { "type": "object", "$ref": "#/$defs/cancel_checkout" } } }, { "properties": { "type": { "const": "checkout" }, "props": { "type": "object", "$ref": "#/$defs/checkout" } } }, { "properties": { "type": { "const": "deferred_payment" }, "props": { "type": "object", "$ref": "#/$defs/deferred_payment" } } }, { "properties": { "type": { "const": "delivery" }, "props": { "type": "object", "$ref": "#/$defs/delivery" } } }, { "properties": { "type": { "const": "exam" }, "props": { "type": "object", "$ref": "#/$defs/exam" } } }, { "properties": { "type": { "const": "identify" }, "props": { "type": "object", "$ref": "#/$defs/identify" } } }, { "properties": { "type": { "const": "item" }, "props": { "type": "object", "$ref": "#/$defs/item" } } }, { "properties": { "type": { "const": "level" }, "props": { "type": "object", "$ref": "#/$defs/level" } } }, { "properties": { "type": { "const": "media" }, "props": { "type": "object", "$ref": "#/$defs/media" } } }, { "properties": { "type": { "const": "milestone" }, "props": { "type": "object", "$ref": "#/$defs/milestone" } } }, { "properties": { "type": { "const": "module" }, "props": { "type": "object", "$ref": "#/$defs/module" } } }, { "properties": { "type": { "const": "nudge_response" }, "props": { "type": "object", "$ref": "#/$defs/nudge_response" } } }, { "properties": { "type": { "const": "page" }, "props": { "type": "object", "$ref": "#/$defs/page" } } }, { "properties": { "type": { "const": "payment_method" }, "props": { "type": "object", "$ref": "#/$defs/payment_method" } } }, { "properties": { "type": { "const": "promo" }, "props": { "type": "object", "$ref": "#/$defs/promo" } } }, { "properties": { "type": { "const": "question" }, "props": { "type": "object", "$ref": "#/$defs/question" } } }, { "properties": { "type": { "const": "rate" }, "props": { "type": "object", "$ref": "#/$defs/rate" } } }, { "properties": { "type": { "const": "schedule_delivery" }, "props": { "type": "object", "$ref": "#/$defs/schedule_delivery" } } }, { "properties": { "type": { "const": "search" }, "props": { "type": "object", "$ref": "#/$defs/search" } } }, { "properties": { "type": { "const": "track" }, "props": { "type": "object", "$ref": "#/$defs/track" } } } ] }