UNPKG

react-native-lightspeedsdk

Version:
113 lines (105 loc) 3.13 kB
'use strict'; import Achievement from './Achievement'; type UserProfileMap = { panelistId:number, panelistInfoId:number, panelId:number, email:string, firstName:string, lastName:string, birthdate:string, gender:number, address1:string, address2:string, city:string, state:string, country:string, countryId:number, languageId:number, mobileAppJoinDate:string, fbLinked:bool, totalPoints:number, sociallyRegistered:bool, hitOrMissUrl:string, hitOrMissAvailable:number, zipCode:string, dailyQuiz:number, achievements:Array, mobileAppUserType:number, socialRegistration:bool, countryIsoCode:string, languageIsoCode:string, isNewUser:number }; /** * Represents an immutable user profile */ class UserProfile { panelistId:number; panelistInfoId:number; panelId:number; email:string; firstName:string; lastName:string; birthdate:string; gender:number; address1:string; address2:string; city:string; state:string; country:string; countryId:number; languageId:number; mobileAppJoinDate:string; fbLinked:bool; totalPoints:number; sociallyRegistered:bool; hitOrMissUrl:string; hitOrMissAvailable:number; zipCode:string; dailyQuiz:number; achievements:Array; mobileAppUserType:number; socialRegistration:bool; countryIsoCode:string; languageIsoCode:string; isNewUser:number; constructor(tokenMap: UserProfileMap) { this.panelistId = tokenMap.panelistId; this.panelistInfoId = tokenMap.panelistInfoId; this.panelId = tokenMap.panelId; this.email = tokenMap.email; this.firstName = tokenMap.firstName; this.lastName = tokenMap.lastName; this.birthdate = tokenMap.birthdate; this.gender = tokenMap.gender; this.address1 = tokenMap.address1; this.address2 = tokenMap.address2; this.city = tokenMap.city; this.state = tokenMap.state; this.country = tokenMap.country; this.countryId = tokenMap.countryId; this.languageId = tokenMap.languageId; this.mobileAppJoinDate = tokenMap.mobileAppJoinDate; this.fbLinked = tokenMap.fbLinked; this.totalPoints = tokenMap.totalPoints; this.sociallyRegistered = tokenMap.sociallyRegistered; this.hitOrMissUrl = tokenMap.hitOrMissUrl; this.hitOrMissAvailable = tokenMap.hitOrMissAvailable; this.zipCode = tokenMap.zipCode; this.dailyQuiz = tokenMap.dailyQuiz; this.mobileAppUserType = tokenMap.mobileAppUserType; this.socialRegistration = tokenMap.socialRegistration; if (tokenMap.achievements !== null) { var transformAchievements = function (achievementMap) { return new Achievement(achievementMap); } this.achievements=tokenMap.achievements.map(transformAchievements); } this.countryIsoCode = tokenMap.countryIsoCode; this.languageIsoCode = tokenMap.languageIsoCode; this.isNewUser = tokenMap.isNewUser; Object.freeze(this); } } module.exports = UserProfile;