"),showDismissButton:!1,forceShow:!0,action:{title:e.dismissBtn||"OK",handler:function(){}}}))}),authAPI.logout(),o(null,null)):1309===e.error.code?authAPI.logout():(console.error(e.error),o(e.error,null)):o(null,e.result):o(null,null)}).error(function(e,t,n,s){console.error(e),o(e,null)})},login:function(e,n){var t=this.getCurrentUser();t?(n&&n(null,t),authAPI.triggerOnLogin(t)):(t=function(){authAPI.authCtrlScope.loginOptions=e,authAPI.authCtrlScope.showLogin(function(e,t){!e&&t&&(authAPI._setCurrentUser(t),authAPI.session.start(),authAPI.triggerOnLogin(t),authAPI._checkGDPR(t),authAPI.checkForceUpdate({user:t}),authAPI.authCtrlScope.hideLogin(),authAPI.authCtrlScope.$$phase||authAPI.authCtrlScope.$apply()),n&&n(e,t)}),authAPI.authCtrlScope.$$phase||authAPI.authCtrlScope.$apply()},authAPI.authCtrlScope?t():setTimeout(t,250))},_setCurrentUser:function(e){window.appContext&&window.appContext.currentApp&&window.appContext.currentApp.appId&&(e?localStorage.setItem(window.appContext.currentApp.appId+"-AUTH_CURRENT_USER",JSON.stringify(e)):localStorage.removeItem(window.appContext.currentApp.appId+"-AUTH_CURRENT_USER"))},secondaryUserLookup:function(){return null},getCurrentUser:function(e,t){"function"==typeof e&&(t=e);e=this.secondaryUserLookup();if(e||window.appContext&&window.appContext.currentApp&&window.appContext.currentApp.appId&&(e=localStorage.getItem(window.appContext.currentApp.appId+"-AUTH_CURRENT_USER"),e=JSON.parse(e)),e&&e.userToken||(e=null),!t)return e;t(null,e)},_checkGDPR:function(t){t&&termsAPI.getKeys(function(e,n){if(e)return console.error(e);e=siteConfig.endPoints.crmHost+"/documents/"+n.join(",")+"/check?userKey="+encodeURIComponent(t.email||t.username);(bfUtils.isAppHtml5Version||bfUtils.isMobileDevice||bfUtils.isPwaAndroid||bfUtils.isHtml5iOS)&&window.appContext&&1==window.appContext.liveMode&&bfUtils.http.get(e).success(function(e){if(e)for(var t=0;t00:10",showDismissButton:!1,forceShow:!0,action:{title:e.continueBtn||"CONTINUE",handler:function(){}}}),setTimeout(function(){var t=10,n=setInterval(function(){var e;document.getElementById("alertDialog")?(e=10".concat(t,""),showDismissButton:!1,forceShow:!0,action:{title:e.dismissBtn||"OK",handler:function(){}}}))},fakeKickedOutDialog:function(e){var t=document.getElementById("kickedOutDialog");richModal.isVisible()&&!t&&richModal.clearAll(),t?(document.getElementById("modalTitle").innerText=e.title,document.getElementsByClassName("action-button")[0].innerText=e.dismissBtn,t.innerText=e.content):(t=e.content||"Please login again to continue",richModal.display({title:e.title||"You've been kicked out of your session",richContent:"
".concat(t,"
"),showDismissButton:!1,forceShow:!0,action:{title:e.dismissBtn||"OK",handler:function(){}}}))},session:{sessionExpires:!1,idleTimeSeconds:null,lastIdleTimeUpdateOn:null,stopWatchInterval:null,updateIdleTimeInterval:null,init:function(){authAPI.getAuthSettings(null,function(e,t){var n,s;function o(){s||(s=!0,setTimeout(function(){s=!1},1e3),setTimeout(n))}!e&&t&&!bfUtils.isEmulatorCP&&bfUtils.isApp&&t.data&&t.data.sessionSettings&&(t.data.sessionSettings.expireWhenIdleFor&&t.data.sessionSettings.expireWhenIdleFor.isActive||t.data.sessionSettings.expireWhenAppClose)&&(authAPI.getCurrentUser()&&authAPI.logout(),authAPI.session.sessionExpires=t.data.sessionSettings.expireWhenIdleFor&&t.data.sessionSettings.expireWhenIdleFor.isActive,n=function(){null===authAPI.session.stopWatchInterval&&authAPI.session._resetIdleTime()},document.addEventListener("sessionActivity",n,!1),s=!1,document.addEventListener("click",o),document.addEventListener("touchstart",o))})},start:function(){authAPI.getAuthSettings(null,function(e,t){var n,s,o,r,i,a;e?console.error(e):!bfUtils.isEmulatorCP&&bfUtils.isApp&&t&&t.data&&t.data.sessionSettings&&t.data.sessionSettings.expireWhenIdleFor&&t.data.sessionSettings.expireWhenIdleFor.isActive&&(n=60*t.data.sessionSettings.expireWhenIdleFor.timeInMinutes,s=t.data.sessionSettings.expireWhenIdleFor.showTimeoutDialog,o=t.data.sessionSettings.expireWhenIdleFor.alertDialogOptions||{},r=t.data.sessionSettings.expireWhenIdleFor.expiredDialogOptions||{},i=!1,authAPI.session.lastIdleTimeUpdateOn=new Date,authAPI.session.idleTimeSeconds=0,a=function(){var e=r.content||"Please login again to continue";richModal.display({title:r.title||"Your session is expired due to inactivity",richContent:"
".concat(e,"
"),showDismissButton:!1,action:{title:r.dismissBtn||"OK",handler:function(){}}})},authAPI.session.updateIdleTimeInterval=setInterval(function(){var e,t=new Date;authAPI.session.idleTimeSeconds+=(t.getTime()-authAPI.session.lastIdleTimeUpdateOn.getTime())/1e3,authAPI.session.lastIdleTimeUpdateOn=t,authAPI.session.idleTimeSeconds>5+n&&(console.error("abnormally forced logout"),authAPI.session._clean(),authAPI.logout()),s&&!i&&authAPI.session.idleTimeSeconds>n-60?(i=!0,e=0,richModal.isVisible()&&(e=1e3,richModal.clearAll()),richModal.display({title:o.title||"Your session is about to expire",richContent:"
'.concat(e["coverPhoto"===n?"coverImageTypeInvalid":"profileImageTypeInvalid"]||("coverPhoto"===n?"Cover":"Profile")+" photo does not support this file type.","
"),dismissButtonText:"OK"};richModal.display(e)}),!1;return!(t.size&&1e7'.concat(e["coverPhoto"===n?"coverPhotoLess10mb":"profilePhotoLess10mb"]||("coverPhoto"===n?"Cover":"Profile")+" photo must be less than 10mb.",""),dismissButtonText:"OK"};richModal.display(e)}),!1)},uploadProfileImage:function(e,o){var t,n=authAPI.getCurrentUser();n?(t=window.siteConfig.endPoints.authHost+"/src/server.js?method=users/uploadImage",e.file?e.uploader.upload({url:t,data:{file:e.file,userToken:n.userToken,externalAppId:window.currentAppId}}).progress(function(e){e=parseInt(100*e.loaded/e.total);console.log("progress: "+e+"%")}).success(function(e,t,n,s){console.log("file "+s.data.file.name+" uploaded."),o&&o(null,e)}).error(function(e){o&&o(e,null)}):o&&o(null,null)):o&&o("Invalid user",null)},checkForceUpdate:function(n,e){var s;!bfUtils.isEmulatorCP&&bfUtils.isApp&&(s=!1,AppearanceAPI.prototype.getAppearance(null,function(e,t){return e?console.error(e):void(t&&t.customRegistration&&t.customRegistration.active&&t.customRegistration.singlePage&&t.customRegistration.singlePage.formControls&&(t.customRegistration.singlePage.formControls.forEach(function(t){var e;if(t.active&&t.settings.required&&"registrationOnly"!==t.settings.displayOn&&!1!==t.settings.allowEditingInProfile)if("custom"!==t.type)switch(t.id){case"fullName":(t.settings.displayNameEnabled&&!n.user.displayName||t.settings.firstNameEnabled&&!n.user.firstName||t.settings.lastNameEnabled&&!n.user.lastName)&&(s=!0);break;case"address":(!t.settings.showFullAddress||n.user.userProfile&&n.user.userProfile.address&&n.user.userProfile.address.fullAddress)&&(!t.settings.showFullAddress||!t.settings.showAptNo||n.user.userProfile&&n.user.userProfile.address&&n.user.userProfile.address.customFields&&n.user.userProfile.address.customFields.aptNo)&&(!t.settings.showZipCode||n.user.userProfile&&n.user.userProfile.address&&n.user.userProfile.address.customFields&&n.user.userProfile.address.customFields.zipCode)||(s=!0);break;case"bio":n.user.userProfile&&n.user.userProfile.bio||(s=!0);break;case"telephone":n.user.userProfile&&n.user.userProfile.tel||(s=!0);break;case"birthDate":n.user.userProfile&&n.user.userProfile.birthDate||(s=!0);break;case"profilePicture":n.user.imageUrl||(s=!0)}else"custom"===t.type&&(n.user.userProfile&&n.user.userProfile.customTypeFields&&((e=n.user.userProfile.customTypeFields.find(function(e){return e.id===t.id}))&&e.value||e&&e.values&&0Always in the in the Location Services ".concat(BackgroundGeolocation.ignoreMotionAndFitnessAuthorization?"":"and Motion & Fitness permission"," in settings?"),isMessageHTML:!0,showCancelButton:!1,forceAction:!0,actionButtons:[{text:"Later",type:"primary"},{text:"Open Settings",type:"primary"},{text:"Yes",type:"primary"}]},function(e,s){e&&console.warn("error showing dialog: ",e),s&&s.selectedButton&&("Open Settings"==s.selectedButton.text&&bridge.capabilities.diagnostic.switchToSettings(),s&&"Yes"==s.selectedButton.text&&localStorage.removeItem("showFitnessPermissionDialogFlag"),s&&"Later"==s.selectedButton.text&&(geoAPI._fitnessPermissionLaterFlag=!0))})}(!geoAPI._alwaysPermissionShownTimestamp||1e4<=Date.now()-geoAPI._alwaysPermissionShownTimestamp)&&(bfUtils.isIOS||bfUtils.isAndroid&&10<=bfUtils.osVersion)&&(geoAPI._alwaysPermissionShownTimestamp=Date.now(),bridge.capabilities&&bridge.capabilities.diagnostic?bridge.capabilities.diagnostic.getLocationAuthorizationStatus(function(e){var s,n;console.log("[INFO] BackgroundGeolocation authorization diagnostic status: ".concat(e)),e==bridge.capabilities.diagnostic.permissionStatus.NOT_REQUESTED||e==bridge.capabilities.diagnostic.permissionStatus.NOT_DETERMINED?setTimeout(function(){o()},15e3):e==bridge.capabilities.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE?(s=new DialogAPI,n="To use background location, you must enable Always in the in the Location Services settings.",bfUtils.isIOS&&!BackgroundGeolocation.ignoreMotionAndFitnessAuthorization&&(n="To use background location, you must enable Always in the in the Location Services settings. Also, ensure that the Motion & Fitness permission is enabled."),s.show({title:"Location Permission",message:n,isMessageHTML:!0,showCancelButton:!0,forceAction:!0,actionButtons:[{text:"Open Settings",type:"primary"}]},function(e,s){e&&console.warn("error showing dialog: ",e),s&&s.selectedButton&&"Open Settings"==s.selectedButton.text&&(bfUtils.isIOS&&(localStorage.setItem("showFitnessPermissionDialogFlag",!0),setTimeout(function(){i()},1e3)),bridge.capabilities.diagnostic.switchToSettings())})):e==bridge.capabilities.diagnostic.permissionStatus.GRANTED&&(geoAPI._isAlwaysGranted=!0,bfUtils.isIOS&&(!geoAPI._fitnessPermissionShownTimestamp||15e3<=Date.now()-geoAPI._fitnessPermissionShownTimestamp)&&(geoAPI._fitnessPermissionShownTimestamp=Date.now(),setTimeout(function(){geoAPI._gotPositionWhileAlwaysGranted||localStorage.getItem("showFitnessPermissionDialogFlag")&&!geoAPI._fitnessPermissionLaterFlag&&i()},1e4)))},function(e){console.warn("diagnostic location authorization status error",e)}):console.warn("Diagnostic plugin not available"))},setTimeout(function(){e()},1e3),BackgroundGeolocation.on("location",a),BackgroundGeolocation.on("error",r),BackgroundGeolocation.on("authorization",function(e){console.log("[INFO] BackgroundGeolocation authorization status: "+e)}),BackgroundGeolocation.checkStatus(function(e){console.log("[INFO] BackgroundGeolocation service is running",e.isRunning),console.log("[INFO] BackgroundGeolocation services enabled",e.locationServicesEnabled),console.log("[INFO] BackgroundGeolocation auth status: "+e.authorization),e.authorization?e.isRunning||bfUtils.isAndroid&&13<=bfUtils.osVersion||(BackgroundGeolocation.start(),c()):n()})):(i="backgroundLocation",backgroundGeolocation.configure(a,r,{desiredAccuracy:0,stationaryRadius:1,distanceFilter:1,interval:1e3,locationProvider:backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER}),backgroundGeolocation.start(),c())):n()})):n()):(console.log("HTML5 position"),i=setInterval(function(){geoAPI.getCurrentPosition(s,function(e,s){e?l(e):u(s,"HTML5")})},s&&s.timeout?s.timeout:5e3)),o())},_log:function(s){setTimeout(function(){var e;"undefined"!=typeof loggerAPI&&(e={level:s.error?"error":"info",message:s.message,context:s.data,tags:["app","tracker"],exception:s.error},loggerAPI.log(e),console.log("logging "+s.message,{data:s.data,error:s.error})),bfUtils.traceDevice({message:s.message+JSON.stringify(s.data)})})},clearWatch:function(e,s){"BackgroundLocation"===e?BackgroundGeolocation.stop():"backgroundLocation"===e?backgroundGeolocation.stop():navigator.geolocation&&navigator.geolocation.watchPosition?navigator.geolocation.clearWatch(e):clearInterval(e),s&&s()},isEnabled:function(e,s){BackgroundGeolocation.checkStatus(function(e){return s(null,e.locationServicesEnabled)})},_updateLastKnownLocation:function(t,a){authAPI.getCurrentUser(function(e,s){var n;if(e)return a("error getting user",null);if(!s)return a("user not logged in",null);geoAPI.session._lastTracked=geoAPI.session._lastTracked||{},geoAPI.session._lastTracked[s.accessToken]=geoAPI.session._lastTracked[s.accessToken]||{};var o=null,o=null!==(e=t.position.coords)&&void 0!==e&&e.longitude&&null!==(n=t.position.coords)&&void 0!==n&&n.latitude?[t.position.coords.longitude,t.position.coords.latitude]:[null,null];if(geoAPI.session._lastTracked[s.accessToken][t.source]&&geoAPI.session._lastTracked[s.accessToken][t.source][0]===o[0]&&geoAPI.session._lastTracked[s.accessToken][t.source][1]===o[1])return bfUtils.traceDevice({message:"ignoring same position"+JSON.stringify(t.position)}),void a(null,{isSuccessful:!0});var i={data:{source:t.source,position:{type:"Point",coordinates:o},metadata:t.position.coords},isSecureAPI:!0};geoAPI.session._apiClient("users/updateLocation",i).then(function(e){geoAPI.session._lastTracked[s.accessToken][t.source]=o,"ipInfo"===t.source||"registration"===t.source?authAPI.refreshAndTriggerUpdate():bfUtils.traceDevice({message:"Updated GPS Location: "+JSON.stringify(i.data)}),a(null,{isSuccessful:e})}).catch(function(e){console.error("error updating last known location",e),a(e,null),geoAPI._log({message:"update location API failed",data:{coordinates:o},error:e})})})},_currentTrackingOperation:{trackingWatchIds:{},trackingTimeoutReference:null,trackingStartTime:null,trackingMaxDuration:null},startTracking:function(o,e){if(geoAPI._currentTrackingOperation.trackingWatchIds[o.instanceId])return geoAPI.session._lastPosition&&geoAPI._updateLastKnownLocation({position:geoAPI.session._lastPosition,source:"tracker"},function(){}),e("tracker already running",null);if(!o.maximumDuration||isNaN(o.maximumDuration))o.maximumDuration=60;else if(1440geoAPI._currentTrackingOperation.trackingMaxDuration-(Date.now()-geoAPI._currentTrackingOperation.trackingStartTime))&&(clearTimeout(geoAPI._currentTrackingOperation.trackingTimeoutReference),geoAPI._currentTrackingOperation.trackingStartTime=Date.now(),geoAPI._currentTrackingOperation.trackingMaxDuration=o.maximumDuration,geoAPI._currentTrackingOperation.trackingTimeoutReference=setTimeout(function(){geoAPI.stopTracking({instanceId:o.instanceId},function(){})},geoAPI._currentTrackingOperation.trackingMaxDuration)),e(null,{isSuccessful:!0}),geoAPI.session._lastGeneratedPositionSequence=geoAPI.session._lastGeneratedPositionSequence||0,permissionRequestsAPI.queueRequest(geoAPI.getPermissionType(),geoAPI,function(){var n=!1;geoAPI._watchPosition({_preferHighFrequencyProvider:!0,enableHighAccuracy:!1},function(e,s){e?(e.watchId&&(geoAPI._currentTrackingOperation.trackingWatchIds[o.instanceId]=e.watchId),console.log("tracking position",e,s),0===geoAPI.session._lastGeneratedPositionSequence&&geoAPI._log({message:"first tracker session position captured",data:{instanceId:o.instanceId,position:e}}),e.sequence=geoAPI.session._lastGeneratedPositionSequence++,e&&e.coords&&(geoAPI.session._lastPosition=e,geoAPI.session._lastPositionFetchDate=e,s=geoAPI.session._lastPositionUpdate?(new Date).getTime()-geoAPI.session._lastPositionUpdate:0,n&&s<2e3?setTimeout(function(){e.sequence>geoAPI.session._lastProcessedPositionSequence&&2e3<(new Date).getTime()-geoAPI.session._lastPositionUpdate&&(geoAPI.session._lastPositionUpdate=(new Date).getTime(),geoAPI.session._lastProcessedPositionSequence=e.sequence,geoAPI._updateLastKnownLocation({position:e,source:"tracker"},function(){}))},2e3):(geoAPI.session._lastPositionUpdate=(new Date).getTime(),geoAPI.session._lastProcessedPositionSequence=e.sequence,geoAPI._updateLastKnownLocation({position:e,source:"tracker"},function(){}),n=!0))):setTimeout(function(){!n&&geoAPI.session._lastPosition&&((new Date).getTime()-geoAPI.session._lastPositionFetchDate)/1e3<300&&geoAPI._updateLastKnownLocation({position:geoAPI.session._lastPosition,source:"tracker"},function(){})},1e3)},function(e){geoAPI._currentTrackingOperation.trackingWatchIds[o.instanceId]=e}),geoAPI._log({message:"tracker session started",data:{instanceId:o.instanceId}})})},isTracking:function(e,s){return e&&e.level&&"app"!=e.level?"plugin"==e.level?geoAPI._currentTrackingOperation.trackingWatchIds[e.instanceId]?s(null,{isTracking:!0}):s(null,{isTracking:!1}):void s("please provide a valid level",null):Object.keys(geoAPI._currentTrackingOperation.trackingWatchIds).length?s(null,{isTracking:!0}):s(null,{isTracking:!1})},stopTracking:function(e,s){geoAPI._currentTrackingOperation.trackingWatchIds[e.instanceId]?geoAPI.clearWatch(geoAPI._currentTrackingOperation.trackingWatchIds[e.instanceId],function(){delete geoAPI._currentTrackingOperation.trackingWatchIds[e.instanceId],Object.keys(geoAPI._currentTrackingOperation.trackingWatchIds).length||(clearTimeout(geoAPI._currentTrackingOperation.trackingTimeoutReference),geoAPI._currentTrackingOperation={trackingWatchIds:{},trackingTimeoutReference:null,trackingStartTime:null,trackingMaxDuration:null}),s(null,{isSuccessful:!0})}):s("no active trackers found",null)},syncUserLocation:function(){setTimeout(function(){function n(t,a){authAPI.getAuthSettings(null,function(e,s){var n,o,i;s&&s.data&&s.data.enableUserLocationTracking&&(o=n=null,t.userProfile&&t.userProfile.address&&t.userProfile.address.geoLocation&&(n={type:"Point",coords:{longitude:t.userProfile.address.geoLocation.lng,latitude:t.userProfile.address.geoLocation.lat}}),(i=JSON.parse(localStorage.getItem("analyticsUserIpInfo")))&&i.data&&i.data.lat&&i.data.lon&&(o={type:"Point",coords:{longitude:Number(i.data.lon),latitude:Number(i.data.lat)}}),s=function(e,s){return!(!e&&!s)&&(!(!(e=e.coordinates?{coords:{longitude:e.coordinates[0],latitude:e.coordinates[1]}}:e)||!s)&&!(e&&e.coords&&e.coords.longitude.toString()===s.coords.longitude.toString()&&e.coords.latitude.toString()===s.coords.latitude.toString()))},t.locationTracking&&t.locationTracking.homeLocation?(i=t.locationTracking.homeLocation,(a||864e5<(new Date).getTime()-new Date(i.lastUpdatedOn))&&(n?s(i.position,n)&&(geoAPI._updateLastKnownLocation({position:n,source:"registration"},function(){}),geoAPI._log({message:"updated home address for tracker",data:{position:n,userToken:t.userToken,accessToken:t.accessToken,source:"registration"}})):o&&s(i.position,o)&&(geoAPI._updateLastKnownLocation({position:o,source:"ipInfo"},function(){}),geoAPI._log({message:"updated home address for tracker",data:{position:o,userToken:t.userToken,accessToken:t.accessToken,source:"ipInfo"}})))):n?(geoAPI._updateLastKnownLocation({position:n,source:"registration"},function(){}),geoAPI._log({message:"new home address for tracker",data:{position:n,userToken:t.userToken,accessToken:t.accessToken,source:"registration"}})):o&&(geoAPI._updateLastKnownLocation({position:o,source:"ipInfo"},function(){}),geoAPI._log({message:"new home address for tracker",data:{position:o,userToken:t.userToken,accessToken:t.accessToken,source:"ipInfo"}})))})}authAPI.getCurrentUser(function(e,s){s?n(s):authAPI.onLogin(function(){authAPI.getCurrentUser(function(e,s){s&&n(s)})})}),authAPI.onUpdate(function(e){e&&e.detail&&e.detail.user&&n(e.detail.user,!0)})},6e3)},session:{sessionId:null,_sessions:[],_isFakeClient:!1,init:function(){geoAPI.session._isFakeClient?(geoAPI.session._apiClient=geoAPI.session._fakeClient.fakeClientHandler,geoAPI.session._sessions=[{sessionId:"session-1",expiresOn:new Date,createdBy:"adimes",createdOn:new Date("2023-11-01"),externalAppId:"app-id-a2",instanceId:"",users:[{userToken:"Daniel",lastLocation:[20,-2],metadata:{}},{userToken:"Ayman",lastLocation:[10,-1],metadata:{}},{userToken:"Mahmoud"}]},{sessionId:"session-2",expiresOn:new Date,createdBy:"adimes",createdOn:new Date("2023-06-06"),externalAppId:"app-id-a1",users:[{userToken:"Salem",lastLocation:[12,24],metadata:{}},{userToken:"Mike",lastLocation:[12,25],metadata:{}}]}]):geoAPI.session._apiClient=authAPI.getAuthResponse},onUserLocationChange:{intervals:{},activeSessions:{},subscribe:function(e){var n=this,o=e.sessionId,i=e.watchId,t=e.instanceId;o&&i&&t&&geoAPI.session.get({sessionId:o},function(e,s){n.activeSessions[o]&&n.activeSessions[o].subscriptions.some(function(e){return e.instanceId==t&&e.watchIds.some(function(e){return e==i})})||(n.activeSessions[o]?n.activeSessions[o].subscriptions.some(function(e){return e.instanceId==t})?n.activeSessions[o].subscriptions=n.activeSessions[o].subscriptions.map(function(e){return e.instanceId==t&&e.watchIds.push(i),e}):n.activeSessions[o].subscriptions.push({watchIds:[i],instanceId:t}):(n.activeSessions[o]={subscriptions:[],sessionSnapshot:JSON.parse(JSON.stringify(_objectSpread({},s)))},n.activeSessions[o].subscriptions.push({watchIds:[i],instanceId:t})),n.publish(o),n.intervals[o]||(n.intervals[o]=setInterval(function(){geoAPI.session.get({sessionId:o},function(e,s){e&&(clearInterval(n.intervals[o]),delete n.intervals[o]),JSON.stringify(n.activeSessions[o].sessionSnapshot)!=JSON.stringify(s)&&(n.activeSessions[o].sessionSnapshot=JSON.parse(JSON.stringify(_objectSpread({},s))),n.publish(o))})},2e3)))})},publish:function(n){var o=this;this._isActive()&&this.activeSessions[n]&&geoAPI.session._isAlive(this.activeSessions[n].sessionSnapshot)&&this.activeSessions[n].subscriptions.forEach(function(e){var s=e.instanceId,e=e.watchIds;postMaster.isInstanceAlive(s)?e.forEach(function(e){e=new Packet(null,"geo.session._triggerOnSessionWatchChange",{watchId:e,session:o.activeSessions[n].sessionSnapshot});postMaster.broadcast(e)}):(clearInterval(o.intervals[n]),delete o.intervals[n])})},unsubscribe:function(o,e){var i,s=this;Object.keys(this.activeSessions)?(Object.keys(this.activeSessions).forEach(function(n){s.activeSessions[n].subscriptions.map(function(e){var s=e.watchIds.findIndex(function(e){return e==o});return-1(new Date).getTime()},_apiClient:{},_fakeClient:{fakeClientHandler:function(e,s){return new Promise(function(n,o){switch(s=JSON.stringify(s),e){case"users/updateLocation":geoAPI.session._fakeClient.user.updateLocation(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/create":geoAPI.session._fakeClient.geoSession.create(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/get":geoAPI.session._fakeClient.geoSession.get(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/removeUsers":geoAPI.session._fakeClient.geoSession.removeUsers(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/addUsers":geoAPI.session._fakeClient.geoSession.addUsers(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/updateInfo":geoAPI.session._fakeClient.geoSession.updateInfo(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/delete":geoAPI.session._fakeClient.geoSession.delete(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/getCurrentUserSessions":geoAPI.session._fakeClient.user.getCurrentUserSessions(s,function(e,s){e&&o(e),n(s)});break;case"geoSessions/updateUser":s.isTrackable?geoAPI.session._fakeClient.geoSession.enableTrackability(s,function(e,s){e&&o(e),n(s)}):geoAPI.session._fakeClient.geoSession.disableTrackability(s,function(e,s){e&&o(e),n(s)});break;default:return}})},geoSession:{create:function(n,o){setTimeout(function(){var e;if(null!==(e=(n=JSON.parse(n)).mockBehavior)&&void 0!==e&&e.error)return o(null===(s=n.mockBehavior)||void 0===s?void 0:s.error,null);var s=geoAPI.session._sessions.findIndex(function(e){return e.sessionId==n.session.sessionId});if(-1",this.position={type:n||"POINT",coordinates:s||[null,null]}},Session=function e(s){var n=s.sessionId,o=s.expiresOn,i=s.createdBy,s=s.users;_classCallCheck(this,e),this.sessionId=n||"session-".concat(Date.now()),this.expiresOn=new Date(o||Date.now()+9999999999),this.createdBy=i||"simulation-user",this.createdOn=new Date,this.externalAppId=window.currentAppId,s&&s.length&&s.map(function(e){e.isTrackable=!1}),this.users=s||[]};
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var inputAPI={initialized:!1,timer:null,currentStepData:null,currentStepOptions:null,init:function(){var e=this;this.inputDialog?this.inputDialog.innerHTML="":(this.inputDialog=document.createElement("div"),this.inputDialog.style.display="none"),this.listDialog?this.listDialog.innerHTML="":(this.listDialog=document.createElement("div"),this.listDialog.style.display="none"),this.backdrop?this.backdrop.className="":(this.backdrop=document.createElement("div"),this.backdrop.id="input-backdrop"),0<=window.location.pathname.indexOf("pluginTester")?(this.inputDialog.style.height=document.getElementById("app").offsetHeight+"px",this.inputDialog.style.position="absolute",this.listDialog.style.height=document.getElementById("app").offsetHeight+"px",this.listDialog.style.position="absolute"):(this.inputDialog.style.height="var(--full-app-height, 100vh)",this.inputDialog.style.maxHeight="var(--full-app-height, 100vh)",this.listDialog.style.height="var(--full-app-height, 100vh)",this.listDialog.style.maxHeight="var(--full-app-height, 100vh)");var t=localStorage.getItem("footerMenu");this.inputDialog.id="inputDialog",this.inputDialog.className=t?"has-footer-menu":"";var i=document.createElement("div");i.className="input-dialog-container backgroundColorTheme",this.inputDialog.appendChild(i),this.dialogNav=document.createElement("div"),this.dialogNav.className="inputapi-nav titleBarBackgroundTheme",i.appendChild(this.dialogNav),this.dialogNavFlex=document.createElement("div"),this.dialogNavFlex.className="inputapi-nav-flex",this.dialogNav.appendChild(this.dialogNavFlex),this.dialogNavSecondary=document.createElement("div"),this.dialogNavSecondary.className="inputapi-nav secondary titleBarBackgroundTheme",i.appendChild(this.dialogNavSecondary),this.dialogNavFlexSecondary=document.createElement("div"),this.dialogNavFlexSecondary.className="inputapi-nav-flex secondary",this.dialogNavSecondary.appendChild(this.dialogNavFlexSecondary),this.currentUserContainer=document.createElement("div"),this.currentUserContainer.className="inputapi-user-container",i.appendChild(this.currentUserContainer),this.textarea=document.createElement("textarea"),this.textarea.className="inputapi-textarea needsfocus bodyTextTheme",this.textarea.id="inputapi-textarea",this.textarea.onclick=window.keyboardResize,this.textarea.addEventListener("touchend",function(t){t.target.click()}),this.textarea.addEventListener("focus",function(t){var e=t.target;e.style.webkitTransform="translate3d(0px,-10000px,0)",requestAnimationFrame(function(){return e.style.webkitTransform=""})}),this.textarea.addEventListener("input",function(t){e.currentStepData.textValue=t.target.value,e.currentStepData.textValue.length>e.currentStepOptions.maxLength&&(e.currentStepData.textValue=e.currentStepData.textValue.substring(0,e.currentStepOptions.maxLength),t.target.value=e.currentStepData.textValue),e.doneButton.disabled=!e.validate()}),i.appendChild(this.textarea),this.imageGallery=document.createElement("div"),this.imageGallery.id="imageGallery",this.geoContainer=document.createElement("div"),this.geoContainer.id="geo-container",this.geoContainer.classList="img-gallery-container",this.geoContainer.style.display="none",this.geoImage=document.createElement("img"),this.geoImage.id="geo-img",this.geoContainer.appendChild(this.geoImage),this.geoDeleteBtn=document.createElement("span"),this.geoDeleteBtn.className="galery-delete glyphicon glyphicon-minus-sign",this.geoDeleteBtn.onclick=function(){return e.setLocation()},this.geoContainer.appendChild(this.geoDeleteBtn),this.imageGallery.appendChild(this.geoContainer),i.appendChild(this.imageGallery),this.cancelButton=document.createElement("button"),this.cancelButton.className="inputapi-cancel titleBarTextAndIcons",this.dialogNavFlex.appendChild(this.cancelButton),this.title=document.createElement("h1"),this.title.className="inputapi-nav-title primary titleBarTextAndIcons ellipsis",this.title.style.whiteSpace="nowrap",this.dialogNavFlex.appendChild(this.title),this.titleSecondary=document.createElement("h1"),this.titleSecondary.className="inputapi-nav-title secondary titleBarTextAndIcons ellipsis",this.titleSecondary.style.whiteSpace="nowrap",this.dialogNavFlexSecondary.appendChild(this.titleSecondary),this.doneButton=document.createElement("button"),this.doneButton.className="inputapi-done titleBarTextAndIcons",this.dialogNavFlex.appendChild(this.doneButton),this.actionFooter=document.createElement("div"),this.actionFooter.className="inputapi-footer",i.appendChild(this.actionFooter),this.cameraBtn=document.createElement("span"),this.cameraBtn.className="icon icon-camera2 needsclick",this.cameraBtn.onclick=function(t){return e.showFileDialog()},this.actionFooter.appendChild(this.cameraBtn),this.geoPin=document.createElement("span"),this.geoPin.id="goc-pin",this.geoPin.className="icon icon-map-marker",this.geoPin.onclick=function(t){return e.showLocationModal()},this.actionFooter.appendChild(this.geoPin),this.gifBtn=document.createElement("span"),this.gifBtn.className="icon icon-gif",this.gifBtn.id="gif-btn",this.gifBtn.onclick=function(t){return e.showGifDialog()},this.actionFooter.appendChild(this.gifBtn),this.listDialog.id="listDialog";t=document.createElement("div");t.className="body backgroundColorTheme",this.listDialog.appendChild(t),this.listDialogHeader=document.createElement("h1"),this.listDialogHeader.className="list-header",t.appendChild(this.listDialogHeader),this.listDialogItems=document.createElement("form"),this.listDialogItems.className="input-list",t.appendChild(this.listDialogItems);i=document.createElement("div");i.className="button-container",t.appendChild(i),this.listDialogCancelBtn=document.createElement("button"),this.listDialogCancelBtn.className="cancel primaryTheme",i.appendChild(this.listDialogCancelBtn),this.listDialogConfirmBtn=document.createElement("button"),this.listDialogConfirmBtn.className="confirm primaryTheme",i.appendChild(this.listDialogConfirmBtn),0<=window.location.pathname.indexOf("pluginTester")?(document.getElementById("app").appendChild(this.inputDialog),document.getElementById("app").appendChild(this.listDialog),document.getElementById("app").appendChild(this.backdrop)):(document.body.appendChild(this.inputDialog),document.body.appendChild(this.listDialog),document.body.appendChild(this.backdrop)),this.initialized=!0},showLocationModal:function(){var d=this;window.spinner&&window.spinner.show(),this.getLocation(function(t,e){try{if(t)throw t;var i=e.coords,n=i.latitude,a=i.longitude,o=d.getMapUrl(e),l=o.mapUrl,r=o.thumbnail;if(d.currentStepOptions.attachments.location.required)return window.spinner&&window.spinner.hide(),d.geoDeleteBtn.style.display="none",d.setLocation({latitude:n,longitude:a},r);var s={title:"Send My Current Location",richContent:'\n \n '),action:{title:"Confirm",handler:function(){return d.setLocation({latitude:n,longitude:a},r)}}};window.spinner&&window.spinner.hide(),richModal.display(s)}catch(t){console.error("inputAPI location error",t);var c="Failed to determine location. Please try again later.";if(t.code)switch(t.code){case 1:c="App does not have location access.";break;case 2:c="Location information is not availible to this device.";break;case 3:c="Location request timed out. Try again.";break;case 4:c="Failed to determine location. Please try again later (code 4)";break;case 5:c="This app does not have access to this feature."}richModal.display({title:"Could not determine location",richContent:c}),window.spinner&&window.spinner.hide()}})},getLocation:function(i){var n,a=null;appApiKeys.get(function(t,e){(n=e.googleMapKey)||((a=new Error("no google API key")).code=5),a||"object"==("undefined"==typeof geoAPI?"undefined":_typeof(geoAPI))||((a=new Error("geoAPI not defined")).code=4),a?i(a,null):geoAPI.getCurrentPosition({timeout:1e4},function(t,e){e&&(e.googleMapKey=n),i(t,e)})})},setLocation:function(t,e){t&&e?"undefined"!=typeof tinymce&&tinymce.activeEditor?(tinymce.activeEditor.insertContent('')),this.currentStepData.location=t):(this.currentStepData.location=t,this.geoContainer.style.display="block",this.geoImage.src=e):(this.currentStepData.location={},this.geoContainer.style.display="none",this.geoImage.removeAttribute("src")),this.doneButton.disabled=!this.validate()},getMapUrl:function(t){var e=t.coords,i=e.latitude,n=e.longitude,e=t.googleMapKey,t="size=".concat(window.innerWidth,"x").concat(window.innerWidth),t="zoom=15&".concat(t,"&maptype=roadmap&key=").concat(e),e="center=".concat(i,",").concat(n),n="markers=color:blue|size:large|".concat(i,",").concat(n),n="".concat("https://maps.googleapis.com/maps/api/staticmap","?").concat(e,"&").concat(n,"&").concat(t),t=n.replace(/size:large/g,"size:mid").replace(/size=\d{1,4}x\d{1,4}/g,"size=100x100").replace(/zoom=15/g,"zoom=12");return{mapUrl:n,thumbnail:t}},showGifDialog:function(){var n,t,a,o=this,i=0inputAPI.currentStepOptions.maxLength&&(inputAPI.currentStepData.textValue=inputAPI.currentStepData.textValue.substring(0,inputAPI.currentStepOptions.maxLength),t.target.value=inputAPI.currentStepData.textValue),inputAPI.doneButton.disabled=!inputAPI.validate()})}}},fullWidthIcon:' ',halfWidthIcon:' ',thirdWidthIcon:' ',quarterWidthIcon:' ',_showTinyMceDialog:function(a,t){var e="image"===t?"Image":"Gif",i="Insert ".concat(e),t={title:"Save",handler:function(){var e;["fullWidth","halfWidth","thirdWidth","quarterWidth"].some(function(t){if(document.querySelector('input[value="'.concat(t,'"]')).checked)return e=t,!0});var t,i=tinyMCE.activeEditor.getContainer().clientWidth;switch(e){case"fullWidth":i="calc(".concat(i,"px - 2rem)"),t="full_width";break;case"halfWidth":i="calc(".concat(i/2,"px - 1rem)"),t="half_width";break;case"thirdWidth":i="calc((".concat(i,"px - 2rem) / 3)"),t="third_width";break;case"quarterWidth":i="calc(".concat(i/4,"px - .5rem)"),t="quarter_width"}var n=imageTools.resizeImage(a,{size:t,aspect:"1:1"});tinymce.activeEditor.insertContent('')),richModal.close()}},e='\n
"),showDismissButton:!0,forceShow:!0,action:{title:"OK",handler:function(){var o,e;o=authAPI.getCurrentUser(),e={id:1,method:"users/forgotPassword",params:{email:o.email,sendSecretCode:!0,externalAppId:window.currentAppId}},e=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify(e)),window.bfUtils.http.jsonp(e,{bypassInterceptorForStatus:404}).success(function(e){e&&e.result&&(new ComponentUIAPI).showToastMessage({text:"A secret code has been sent to ".concat(o.email),hideDismiss:!0})}).error(function(e,o,t,n){richModal.display({title:"Secret Code",richContent:"
\n\t\t\t\t\t\t\n\t\t\t\t\t");(c.deleteAccountObj.overlay=a).openTrustedDrawer({header:e.deleteAccount||o,content:i,onContentRender:function(){var e=angular.element(document.querySelector(".delete-account-overlay"));d(e)(c)},allowSelectAll:!1,enableFilter:!1,triggerCallbackOnUIDismiss:!0},function(e){return e?console.error(e):void c.closeDeleteAccountOverlay()})})},c.deleteAccountValOnChange=function(){t.getData().then(function(e){e.confirmDeleting||(e.confirmDeleting="CONFIRM");var o=e.confirmDeleting,e=c.deleteAccountObj.value;c.deleteAccountObj.error=e&&o!==e&&o.toUpperCase()===e.toUpperCase(),c.deleteAccountObj.disabled=!(o===e)})},c.closeDeleteAccountOverlay=function(){c.deleteAccountObj.overlay&&(c.deleteAccountObj.value="",c.deleteAccountObj.disabled=!0,c.deleteAccountObj.error=!1,c.deleteAccountObj.overlay.closeDrawer())},c.deleteProfile=function(){var i=0 Unknown, an event was received and we do not know what it is")}},successHandler:function(e){},errorHandler:function(e){console.error("error:"+e)}},pushiOSNotificationHandler.prototype={onRegistered:function(e){push.deviceId=e},register:function(){if(navigator.onLine)try{this.pushNotification.register(this.onRegistered,this.errorHandler,{badge:"true",sound:"true",alert:"true",ecb:"_oldPush.notificationHandler.onNotification"})}catch(e){console.error("There was an error on this page.\n\nError description: "+e.message+"\n\n")}else console.warn("offline: not attempting to register push notifications")},onNotification:function(e){var i=new CustomEvent("pushNotificationsOnReceived",{detail:e});document.dispatchEvent(i),e?(i={},"social"==e.messageType?i.buttons=["Dismiss"]:i.buttons=["Dismiss","Show Details"],e.alert&&(push.decrementBadge(),push.displayMessage(e,i))):window.location.hash="/pushHistory",e.sound},tokenHandler:function(e){push.deviceId=e},successHandler:function(e){this.onRegistered(e)},errorHandler:function(e){console.error("ios error:"+e)}},bfUtils.isMobileDevice&&appState.subscribe({state:appState.RUNNING},function(){window.capabilities&&window.capabilities.pushNotification?(console.log("running old plugin for push notification"),_oldPush.init()):(console.log("running new plugin phonegap-plugin-push"),push.init())}),window.testNotification=function(){push.displayMessage({message:"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti officiis perferendis expedita rerum delectus dolor neque veniam necessitatibus fuga cum voluptatibus placeat, totam voluptate, nisi reprehenderit odio porro cumque ipsa.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti officiis perferendis expedita rerum delectus dolor neque veniam necessitatibus fuga cum voluptatibus placeat, totam voluptate, nisi reprehenderit odio porro cumque ipsa.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti officiis perferendis expedita rerum delectus dolor neque veniam necessitatibus fuga cum voluptatibus placeat, totam voluptate, nisi reprehenderit odio porro cumque ipsa.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti officiis perferendis expedita rerum delectus dolor neque veniam necessitatibus fuga cum voluptatibus placeat, totam voluptate, nisi reprehenderit odio porro cumque ipsa.
",title:"Notification Title",alert:"This is the alert, not sure what it means",messageType:null,additionalData:{notificationId:"5b5f9bbe39003904daa4f093",coldstart:!0,foreground:!0}},{buttons:["Dismiss","Show Details"]})};
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,n){for(var t=0;t
").concat(a?''+a+"":""),showCancelButton:!0,actionButtons:[{text:"Generate",type:"success"}]},function(t,e){var n;return t?o(t):void("success"===(null==e||null===(n=e.selectedButton)||void 0===n?void 0:n.type)&&(n=document.querySelector("#aiDataRequest"),o(null,{userMessage:n.value})))})})},AiAPI.prototype.showSeederCSVPrompt=function(t,o){var e=t.sampleCSV,n=t.showResetAndSaveButton,a=t.hintText;if("string"!=typeof e)return o("Invalid parameter 'sampleCSV'. It must be a valid string.");var i=new DialogAPI(this.context),t=[{text:"Save",type:"success"}];n&&t.unshift({type:"warning",text:"Reset And Save"}),i._show({isMessageHTML:!0,title:"AI Import Data",message:'
I have the following comma separated records:
").concat(a?''+a+"":""),showCancelButton:!0,actionButtons:t},function(t,e){var n;return t?o(t):void(["warning","success"].includes(null==e||null===(n=e.selectedButton)||void 0===n?void 0:n.type)&&(n=e.selectedButton.type,e=document.querySelector("#aiDataRequest"),o(null,{sampleCSV:e.value,reset:"warning"===n})))})},AiAPI.prototype.getAppRecipe=function(t,n){var e,o,a;"function"==typeof n&&(e=window.appContext.currentApp.appId,o=window.appContext.liveMode,a=window.appContext.currentApp.keys.datastoreKey,new DatastoreAPI({appId:e,pluginId:"$$appRecipe",instanceId:"$$appRecipe",liveMode:o,writeKey:a}).get("$$appRecipe",function(t,e){t?n(t):n(null,e)}))};
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(o,e){var n,r=Object.keys(o);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(o),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(o){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(i)throw o}}}}function _unsupportedIterableToArray(e,n){if(e){if("string"==typeof e)return _arrayLikeToArray(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){r=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(r)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z\-0-9]{2,}))$/.test(e)},t.validate=function(){var e=!0;return t.errors.title="",t.errors.email="",t.errors.subject="",t.errors.body="",!t.options||t.options.hideActionText||null!=t.actionItem.title&&""!=t.actionItem.title||(e=!1,t.errors.title="Required"),null==t.actionItem.email||""==t.actionItem.email?(e=!1,t.errors.email="Required"):t.isValidEmail(t.actionItem.email)||(e=!1,t.errors.email="Invalid Email"),null!=t.actionItem.subject&&""!=t.actionItem.subject||(e=!1,t.errors.subject="Required"),null!=t.actionItem.body&&""!=t.actionItem.body||(e=!1,t.errors.body="Required"),e}}]),$app.controller("linkToSocialMediaCtrl",["$scope","$analytics",function(t,e){t.cancel=function(){t.$dialog.close(null)},t.save=function(){t.validate()&&(e.eventTrack("cp/linkToSocialMediaActionItemAdded"),t.$dialog.close(t.actionItem))},t.validate=function(){var e=!0;return t.errors.title="",t.errors.urlError="",!t.options||t.options.hideActionText||null!=t.actionItem.title&&""!=t.actionItem.title||(e=!1,t.errors.title="Required"),null==t.actionItem.url||""==t.actionItem.url?(e=!1,t.errors.urlError="Required"):t.validUrl(t.actionItem.url)||(e=!1,t.errors.urlError="Invalid URL format. Example: http://www.google.com"),e}}]),$app.controller("linkToAppContentCtrl",["$scope","addPluginService","$analytics",function(s,l,e){s.contextOptions={title:"Select Feature"};var c=new DatastoreAPI(appContext.currentApp.appId,"pluginInstances",1,appContext.currentApp.liveMode,appContext.currentApp.keys.datastoreKey);s.getPluginInstances=function(e,t,n){function i(e){c.search({obj:{filter:e,page:n-1,pageSize:t,withDynamicData:!0,recordCount:!0},tag:""},function(e,t){e?console.error(e):(e=t.result||[],s.totalItems=t.totalRecord,s.pluginInstances=s.pluginInstances.concat(e),0===e.length&&(s.notEmptyData=!1),s.notscrolly=!0,s.loading=!1)})}s.loading=!0;var o={$or:[{"$json.title":{$regex:null!=e?e:"",$options:"-i"}}]};if(!e)return i(o);var a,r=[];a={pluginTypeName:e,appId:appContext.currentApp.appId,whitelabelId:window.whitelabelContext.whitelabelId,reload:!l.miniSearchLoaded,fuzzy:.2,fields:["pluginTypeName"]},new Promise(function(n,i){l.searchAppPluginTypes(a,function(e,t){return e?i(e):void n(t)})}).then(function(e){e.plugins.forEach(function(e){r.push({"$json.pluginTypeId":e.pluginTypeId})}),r&&0=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,s=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==a.return||a.return()}finally{if(s)throw n}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(a="Object"===a&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==e.return||e.return()}finally{if(o)throw r}}}}function _unsupportedIterableToArray(t,n){if(t){if("string"==typeof t)return _arrayLikeToArray(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,n):void 0}}function _arrayLikeToArray(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=new Array(n);e=s?e(i+1,r+s,a):a(null,u))})}(0,0,function(t,n){t?e&&e(t,null):o.bulkDelete({tag:"events",ids:u.map(function(t){return t.id})},function(t,n){t?e&&e(t,null):e(null,u)})})):e&&e("Missing event key",null):e&&e("invalid params",null)},AnalyticsAPI.prototype.showReports=function(t,n){var e="";window.siteConfig&&window.siteConfig.endPoints&&window.siteConfig.endPoints.appHost&&"sdk"==window.siteConfig.scope&&(e=window.siteConfig.endPoints.appHost);var i=this.pluginId,r=this.instanceId,a=t||{},t=a.eventKey,a=a.aggregates;if(Array.isArray(a)){var o,s=["avg","sum","min","max"],l=_createForOfIteratorHelper(a);try{for(l.s();!(o=l.n()).done;){var u=o.value;if(!s.includes(u.toLowerCase()))return n('"'.concat(u,'" is not a valid aggregation option. Supported options are: ').concat(s.join(", ")))}}catch(t){l.e(t)}finally{l.f()}}window.openDialog({templateUrl:e+"/pages/plugins/pluginControl/analytics/pluginAnalyticsPopup.html",controller:"pluginAnalyticsPopupCtrl",size:"lg",data:{pluginId:i,instanceId:r,series:a,activeEvent:t}},function(t){}),n(null,!0)};var t=AnalyticsAPI.prototype.trackAction,n=AnalyticsAPI.prototype.trackView;AnalyticsAPI.prototype.trackAction=function(){t.apply(this,arguments),"undefined"!=typeof dataLayer&&dataLayer.push&&arguments&&arguments[0]&&window.dataLayer.push({event:"custom_page_view",custom_title:arguments[0],app_id:this.appId})},AnalyticsAPI.prototype.trackView=function(){n.apply(this,arguments),"undefined"!=typeof dataLayer&&dataLayer.push&&arguments&&arguments[0]&&window.dataLayer.push({event:"custom_page_view",custom_title:arguments[0],app_id:this.appId})},AnalyticsAPI.prototype._prepareEvent=function(t){t._titleLowerCase=t.title.toLowerCase()},AnalyticsAPI.prototype._dispatchEvent=function(t,n){n=new CustomEvent("pluginAnalyticsRegisterEvent",{detail:{data:t,options:n}});document.dispatchEvent(n)}}();
-"use strict";function UsersLibAPI(e){this.context={},angular.copy(e,this.context),this.init()}UsersLibAPI.prototype={init:function(){},showSearchDialog:function(e,i){var s="",s={templateUrl:(s=window.siteConfig&&window.siteConfig.endPoints&&window.siteConfig.endPoints.appHost&&"sdk"==window.siteConfig.scope?window.siteConfig.endPoints.appHost:s)+"/pages/common/userSearch.html",controller:"userSearchDialogCtrl",size:"lg",data:{appId:this.context.appId,source:"sdk",responseType:"users"}};window.openDialog(s,function(e){if(e){if(e,e.users&&0()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z\-0-9]{2,}))$/.test(s))||r)?n.push({email:e.toLowerCase()}):e&&(t=/[\!\@\#\$\%\^\&\*\)\(\+\=\.\<\>\{\}\[\]\:\;\'\"\|\~\`\_\-]/g,e=e.split("").map(function(e){return t.test(e)?"\\".concat(e):e}).join(""),n.push({displayName:{$regex:e,$options:"-i"}},{email:{$regex:e,$options:"-i"}}))}),t.push({$or:n})),-1!=i.currentUserStatusFilter&&(e.isActive=1==i.currentUserStatusFilter),i.showAdvancedSearch){i.searchFromDate&&(e.signupDateFrom=i.searchFromDate),i.searchToDate&&(e.signupDateTo=i.searchToDate);var s=[];if(i.searchTags&&i.searchTags.length){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,n=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw n}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z\-0-9]{2,}))$/.test(s))||r)?n.push({email:e.toLowerCase()}):e&&(t=/[\!\@\#\$\%\^\&\*\)\(\+\=\.\<\>\{\}\[\]\:\;\'\"\|\~\`\_\-]/g,e=e.split("").map(function(e){return t.test(e)?"\\".concat(e):e}).join(""),n.push({displayName:{$regex:e,$options:"-i"}},{email:{$regex:e,$options:"-i"}}))}),t.push({$or:n})),-1!=i.currentUserStatusFilter&&(e.isActive=1==i.currentUserStatusFilter),i.showAdvancedSearch){i.searchFromDate&&(e.signupDateFrom=i.searchFromDate),i.searchToDate&&(e.signupDateTo=i.searchToDate);var s=[];if(i.searchTags&&i.searchTags.length){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,n=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return n=e.done,e},e:function(e){o=!0,s=e},f:function(){try{n||null==r.return||r.return()}finally{if(o)throw s}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);rt.threshold&&(t.missedKeyword=!0)}else t.missedKeyword=!0;f._trackAction("cp/marketplace/search",null,null,{result:t})},f.searchAppPluginTypes=function(n,t){var i=n.pluginTypeName,e=n.appId,r=n.whitelabelId;function a(a){f.getMarketPlacePlugins("",e,r).then(function(e){var n=e.data[0];f.formatPluginLicenses(n),f.logToCrm(n,i,1);var t,e={plugins:n};n=e.plugins,t=new Set(["and","or","to","in","a","the","you","is","are"]),f.miniSearch=new MiniSearch({fields:["pluginTypeName","keywords","description"],storeFields:["pluginTypeId","description","author","awsAPIPublicKey","createdOn","folderName","lastUpdatedOn","license","marketplacepluginTypeId","pluginTypeId","pluginTypeName","price","publishableKey","stripePlan","supportEmail","supportLink","useCount","keywords","token"],boost:{pluginTypeName:3,keywords:2},idField:"pluginTypeId",prefix:!0,processTerm:function(e,n){return t.has(e)?null:e.toLowerCase()},searchOptions:{fuzzy:.3}}),f.miniSearch.addAll(n),f.miniSearchLoaded=!0,a(null,e)})}function l(){var e={prefix:!0};n.fields&&(e.fields=n.fields),void 0!==n.fuzzy&&(e.fuzzy=n.fuzzy),void 0!==n.prefix&&(e.prefix=n.prefix),void 0!==n.filter&&(e.filter=n.filter);e=f.miniSearch.search(i,e);f.checkAndSaveMissedKeywords(i,e),t(null,{plugins:e})}i&&f.miniSearchLoaded?n.reload?a(function(){l()}):l():a(i?function(){l()}:t)},f.instanceExists=function(t,a){var e=window.siteConfig.endPoints.pluginHost+"/"+t.folderName+"/plugin.json?v="+(t.lastUpdatedOn||""),i={isInUse:!1};r.get(e).success(function(e){e.singleton?l.getPluginInstances(t,function(e,n){e?a(e):(0<(n=n.filter(function(e){return e.data.pluginTypeId==t.pluginTypeId})).length&&(i.isInUse=!0,i.matches=n),a(null,i))}):a(null,i)}).error(function(e){a(e)})},f.getPlanType=function(e){var n=null;if(e.stripePlan)try{n=JSON.parse(e.stripePlan)}catch(e){}switch(n.type){case"subscriptions":return"subscriptions";case"onetime":case e.price&&0