@causalfoundry/js-sdk
Version:
Causal Foundry WEB SDK (JS/TS)
444 lines (394 loc) • 10.5 kB
text/typescript
import {Country, GenericMeta, Language, SearchFilter} from "../../core/commonTypes";
import {ItemType} from "../ECommerce/typings";
export enum NavigationTypes {
App = "app",
Identify = "identify",
Media = "media",
ActionResponse = "action_response",
Page = "page",
Rate = "rate",
Search = "search",
ModuleSelection = "module_selection",
Track = "track",
}
export enum CoreCatalogType {
User = "user",
Site = "site",
Media = "media",
Other = "other",
}
export enum ContentBlock {
Core = "core",
ELearning = "e-learning",
ECommerce = "e-commerce",
Payment = "payment",
Loyalty = "loyalty",
PatientMgmt = "patient_mgmt",
CallCenter = "call_center",
EmergencyMgmt = "emergency_mgmt",
}
export enum ModuleType {
Core = "core",
ECommerce = "e_commerce",
ELearning = "e_learning",
Screening = "screening",
Assessment = "assessment",
Enrolment = "enrolment",
MedicalReview = "medical_review",
MyPatients = "my_patients",
Appointments = "appointments",
Prescription = "prescription",
LifestyleMgmt = "lifestyle_mgmt",
PsychologicalMgmt = "psychological_mgmt",
CounselingMgmt = "counseling_mgmt",
Investigation = "investigation",
TreatmentPlan = "treatment_plan",
Transfers = "transfers",
HCWMgmt = "hcw_mgmt",
Break = "break",
CallerHistory = "caller_history",
AttendCall = "attend_call",
Single = "single",
Dashboard = "dashboard",
Map = "map",
Other = "other",
}
export enum SearchModuleType {
Core = "core",
ECommerce = "e_commerce",
ELearning = "e_learning",
Other = "other",
}
export enum AppAction {
Background = "background",
Close = "close",
Open = "open",
Resume = "resume",
}
export enum IdentityAction {
Login = "login",
Logout = "logout",
Register = "register",
Blocked = "blocked",
UnBlocked = "unblocked",
}
export enum MediaAction {
View = "view",
Impression = "impression",
Play = "play",
Pause = "pause",
Seek = "seek",
Finish = "finish",
}
export enum MembersCount {
None = "none",
One = "1",
Two = "2",
Three = "3",
Four = "4",
FiveOrMore = "5_or_more",
Undisclosed = "undisclosed",
}
export enum UserGender {
Male = "male",
Female = "female",
Other = "other",
UnDisclosed = "undisclosed",
}
export enum SearchItemType {
PatientRecord = "patient_record",
LifestylePlanItem = "lifestyle_plan_item",
TreatmentPlanItem = "treatment_plan_item",
PsychologicalPlanItem = "psychological_plan_item",
CounselingPlanItem = "counseling_plan_item",
InvestigationTestItem = "investigation_test_item",
Blood = "blood",
Oxygen = "oxygen",
Drug = "drug",
Grocery = "grocery",
Facility = "facility",
MedicalEquipment = "medical_equipment",
Subscription = "subscription",
Electronics = "electronics",
Clothing = "clothing",
Book = "book",
ItemVerification = "item_verification",
ItemReport = "item_report",
Reward = "reward",
Survey = "survey",
Incident = "incident",
Address = "address",
Ambulance = "ambulance",
OtherVehicle = "other_vehicle",
Contact = "contact",
Call = "call",
Email = "email",
SMS = "sms",
Other = "other",
}
export enum MaritalStatus {
Single = "single",
Married = "married",
Widowed = "widowed",
Divorced = "divorced",
Separated = "separated",
Other = "other",
UnDisclosed = "undisclosed",
}
export interface AppProperties {
action: AppAction;
start_time: number;
}
export interface IdentifyProperties {
action: IdentityAction;
referral_code?: string;
blocked?: IdentifyBlockObject;
}
export interface IdentifyBlockObject {
reason: string;
remarks?: string;
}
export interface UserInfo extends IdentifyProperties {
user_props: UserCatalog;
}
export type ImageProperties = {
/**
* The block or module where the media is embedded. For example,
* 'e-learning' if the media is included as an activity
* of the course
*
*/
contentBlock?: ContentBlock;
type: MediaType;
id: string;
action: MediaAction;
seek_time? : number;
meta?: GenericMeta;
};
export enum MediaType {
Audio = "audio",
Video = "video",
Image = "image",
}
export type AudioVideoProperties = {
/**
* The block or module where the media is embedded. For example,
* 'e-learning' if the video or audio is included as an activity
* of the course
*
*/
contentBlock?: ContentBlock;
type: MediaType;
id: string;
action: MediaAction;
seek_time: number;
meta?: GenericMeta;
};
export type MediaProperties = ImageProperties | AudioVideoProperties;
export type MediaCatalog = {
id: string; //(type)_(id_source) == video_testMediaId
type: MediaType; // <video, audio>
name?: string;
length: string; // video length in milliseconds //uint32
description?: string;
resolution?: string;
language?: Language;
};
export interface PageProperties {
path: string;
title?: string;
duration?: number;
render_time: number;
meta?: GenericMeta;
}
export enum SiteCatalogType {
Pharmacy = "pharmacy",
Clinic = "clinic",
Community = "community",
}
/**
* This interface represents the information related to
* a search
*/
export interface SearchProperties {
/**
* Free text introduced by the user to search
*/
query: string;
module: ModuleType;
/**
* 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_list: string[]; // list of result ids
/**
* 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;
/**
* If the search results are shown paginated, or with infinite scroll,
* this field represent the number of page/subset the current result_ids
* belongs to
*/
page: number;
/**
* Any other additional information to be available in the logs
*/
meta?: GenericMeta;
}
export enum EducationalLevel {
Primary = "primary",
LowerSecondary = "lower_secondary",
UpperSecondary = "upper_secondary",
NonTertiary = "non_tertiary",
Tertiary = "tertiary",
Bachelors = "bachelors",
Masters = "masters",
Doctorate = "doctorate",
}
export enum UserAccountType {
Basic = "basic",
Classic = "classic",
Advanced = "advanced",
Other = "other",
}
export interface UserCatalog {
name?: string;
organization_id?: string;
organization_name?: 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?: EducationalLevel;
account_type?: UserAccountType;
birth_year?: number;
gender?: UserGender;
marital_status?: MaritalStatus;
family_members?: MembersCount;
children_under_five?: MembersCount;
referral_code?: string;
}
export interface SiteCatalog {
name: string;
type: SiteCatalogType;
country?: Country;
region_state?: string;
city?: string;
street_address?: string;
zipcode?: string;
level?: string;
is_active?: boolean;
latitude?: number;
longitude?: number;
culture?: string;
parent_id?: string;
service_list?: string[];
sub_type?: string;
priority?: string;
is_private?: boolean;
district?: string;
sub_district?: string;
landmark?: string;
attributes?: SiteAttributes;
}
export interface SiteAttributes {
bed_number?: number;
insurance_plan_lst?: string[];
}
export enum RateType {
App = "app",
Exam = "exam",
Question = "question",
Module = "module",
Process = "process",
Form = "form",
Section = "section",
Media = "media",
Order = "order",
Item = "item",
HCW = "hcw",
HcwSite = "hcw_site",
Facility = "facility",
Assessment = "assessment",
Customer = "customer",
Other = "other",
}
export interface RateProperties {
rate_value: number;
type: RateType;
subject_id: string;
meta?: GenericMeta;
}
export interface ModuleSelectionProperties {
type: ModuleType;
meta?: GenericMeta;
}
export interface TrackProperties {
name: string;
property?: string;
meta?: GenericMeta;
}
export interface LegacySearchProperties {
/**
* The block or module where the search was performed. For example,
* 'e-commerce' if the user made a search in the marketplace section,
* or 'e-learning' is the search was performed in the courses/classes
* section
*/
contentBlock?: ContentBlock;
module: SearchModuleType;
/**
* Free text introduced by the user to search
*/
query: string;
/**
* If the search results are shown paginated, 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_list?: Array<ItemMinObject>; // list of result ids
/**
* 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;
}
export interface ItemMinObject {
id: string,
type: SearchItemType | ItemType
}