UNPKG

react-native-lightspeedsdk

Version:
144 lines (136 loc) 3.98 kB
'use strict'; import ScheduleSetting from './ScheduleSetting'; import LocationCategory from './LocationCategory'; type LocationSurveyMap = { surveyId:number, gtmSurveyId:number, surveyName:string, surveyDescription:string, surveyLength:number, surveyUrl:string, resultType:string, awardMessage:string, screenAwardMessage:string, lmSampleId:number, lmQuotaId:number, isSamSample:bool, latitude:number, longitude:number, locationName:string, distance:number, radius:number, providerGeoLocationId:number, loiterTime:number, activityType:Array, locationId:number, locationDescription:string, surveyType:string, minSpeed:number, maxSpeed:number, startAtLocation:bool, quotaType:string, quota:number, expirationTime:number, address:string, city:string, countryCode:string, state:string, alertTrigger:string, scheduleSettings:Array, locationCategory:Object, surveyAppType:number }; /** * Represents an immutable Survey */ class LocationSurvey { surveyId:number; gtmSurveyId:number; surveyName:string; surveyDescription:string; surveyLength:number; surveyUrl:string; resultType:string; awardMessage:string; screenAwardMessage:string; lmSampleId:number; lmQuotaId:number; isSamSample:bool; latitude:number; longitude:number; locationName:string; distance:number; radius:number; providerGeoLocationId:number; loiterTime:number; activityType:Array; locationId:number; locationDescription:string; surveyType:string; minSpeed:number; maxSpeed:number; startAtLocation:bool; quotaType:string; quota:number; expirationTime:number; address:string; city:string; countryCode:string; state:string; alertTrigger:string; scheduleSettings:Array; locationCategory:LocationCategory; surveyAppType:number; constructor(map: LocationSurveyMap) { this.surveyId = map.surveyId; this.gtmSurveyId = map.gtmSurveyId; this.surveyName = map.surveyName; this.surveyDescription = map.surveyDescription; this.surveyLength = map.surveyLength; this.surveyUrl = map.surveyUrl; this.resultType = map.resultType; this.awardMessage = map.awardMessage; this.screenAwardMessage = map.screenAwardMessage; this.lmSampleId = map.lmSampleId; this.lmQuotaId = map.lmQuotaId; this.isSamSample = map.isSamSample; this.surveyAppType = map.surveyAppType; this.latitude = map.latitude; this.longitude = map.longitude; this.locationName = map.locationName; this.distance = map.distance; this.radius = map.radius; this.providerGeoLocationId = map.providerGeoLocationId; this.loiterTime = map.loiterTime; this.activityType = map.activityType; this.locationId = map.locationId; this.locationDescription = map.locationDescription; this.surveyType = map.surveyType; this.minSpeed = map.minSpeed; this.maxSpeed = map.maxSpeed; this.startAtLocation = map.startAtLocation; this.quotaType = map.quotaType; this.quota = map.quota; this.expirationTime = map.expirationTime; this.address = map.address; this.city = map.city; this.countryCode = map.countryCode; this.state = map.state; this.alertTrigger = map.alertTrigger; var transformSettings = function (settingMap) { return new ScheduleSetting(settingMap); } if (map.scheduleSettings !== null) { this.scheduleSettings = map.scheduleSettings.map(transformSettings); }else { this.scheduleSettings = null; } if (map.locationCategory !== null) { this.locationCategory = new LocationCategory(map.locationCategory); }else { this.locationCategory = null; } Object.freeze(this); } } module.exports = LocationSurvey;