@causalfoundry/js-sdk
Version:
Causal Foundry WEB SDK (JS/TS)
179 lines (153 loc) • 3.3 kB
text/typescript
import { CurrencyCode } from "../../core/commonTypes"
export enum LoyaltyTypes {
Survey = "survey",
Reward = "reward",
Level = "level",
Milestone = "milestone",
Promo = "promo"
}
export enum PromoAction {
Apply = "apply",
View = "view",
Other = "other",
}
export enum PromoType {
AddToCart = "add_to_cart",
Coupon = "coupon",
Other = "other",
}
export enum PromoItemType {
Blood = "blood",
Book = "book",
Clothing = "clothing",
Drug = "drug",
Grocery = "grocery",
Electronics = "electronics",
Misc = "misc",
Oxygen = "oxygen",
Subscription = "subscription",
Facility = "facility",
Other = "other",
}
export enum SurveyType {
OpenEnded = "open_ended",
ClosedEnded = "closed_ended",
Nominal = "nominal",
LikertScale = "likert_scale",
RatingScale = "rating_scale",
YesNo = "yes_no",
Interview = "interview",
Other = "other"
}
export enum SurveyAction {
View = "view",
Impression = "impression",
Start = "start",
Submit = "submit",
Other = "other"
}
export enum RewardAction {
View = "view",
Add = "add",
Redeem = "redeem",
Other = "other",
}
export enum RedeemType {
Cash = "cash",
Airtime = "airtime",
Other = "other"
}
export interface PromoItem {
id: string,
type: PromoItemType
}
export interface SurveyObject {
id: string,
type: SurveyType,
is_completed: boolean,
reward_id?: string
}
export interface ResponseObject {
id: string,
type: SurveyType,
question: string,
response?: string
}
export interface RedeemObject {
type: RedeemType,
is_successful: boolean,
points_withdrawn: number,
converted_value: number,
currency?: CurrencyCode
}
export interface PromoProperties {
id: string,
action: PromoAction,
items: PromoItem[],
title: string,
type: PromoType,
meta?:any
}
export interface LevelProperties {
prev_level: number,
new_level: number,
module_id?: string,
meta?:any
}
export enum MilestoneAction {
Achieved = "achieved",
Other = "other",
}
export interface MilestoneProperties {
id: string,
action: MilestoneAction,
meta?:any
}
export interface SurveyProperties {
action: SurveyAction,
survey: SurveyObject,
response: Array<ResponseObject>,
meta?:any
}
export interface RewardProperties {
id: string,
action: RewardAction,
acc_points?: number,
total_points: number,
redeem?: RedeemObject
meta?:any
}
export interface SurveyCatalog {
name: string,
description?: string,
type: string,
duration?: number,
organization_id?: string,
organization_name?: string,
questions_list: Array<string>,
reward_id: string,
creation_date?: string,
expiry_date?: string
}
/**
* @internal
*/
export interface InternalSurveyCatalog extends SurveyCatalog {
id: string
}
export interface RewardCatalog {
name: string,
description?: string,
type: string,
required_points: number,
creation_date?: string,
expiry_date?: string,
organization_id?: string,
organization_name?: string
}
/**
* @internal
*/
export interface InternalRewardCatalog extends RewardCatalog {
id: string
}