diff --git a/pluginTester/scripts/framework/app.min.js b/pluginTester/scripts/framework/app.min.js index f6e7445b..f960a92d 100755 --- a/pluginTester/scripts/framework/app.min.js +++ b/pluginTester/scripts/framework/app.min.js @@ -5,33 +5,33 @@ "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)}!function(l){function u(t,e){if(e=e||{},(t=t||"")instanceof u)return t;if(!(this instanceof u))return new u(t,e);var r,n,i,a,o,s,f,h,i=(n={r:0,g:0,b:0},s=o=a=null,h=f=!(i=1),"object"==_typeof(r="string"==typeof(r=t)?function(t){t=t.replace(F,"").replace(C,"").toLowerCase();var e,r=!1;if(j[t])t=j[t],r=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=P.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=P.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=P.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=P.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=P.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=P.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=P.hex8.exec(t))?{r:x(e[1]),g:x(e[2]),b:x(e[3]),a:H(e[4]),format:r?"name":"hex8"}:(e=P.hex6.exec(t))?{r:x(e[1]),g:x(e[2]),b:x(e[3]),format:r?"name":"hex"}:(e=P.hex4.exec(t))?{r:x(e[1]+""+e[1]),g:x(e[2]+""+e[2]),b:x(e[3]+""+e[3]),a:H(e[4]+""+e[4]),format:r?"name":"hex8"}:!!(e=P.hex3.exec(t))&&{r:x(e[1]+""+e[1]),g:x(e[2]+""+e[2]),b:x(e[3]+""+e[3]),format:r?"name":"hex"}}(r):r)&&(R(r.r)&&R(r.g)&&R(r.b)?(n=function(t,e,r){return{r:255*v(t,255),g:255*v(e,255),b:255*v(r,255)}}(r.r,r.g,r.b),f=!0,h="%"===String(r.r).substr(-1)?"prgb":"rgb"):R(r.h)&&R(r.s)&&R(r.v)?(a=w(r.s),o=w(r.v),n=function(t,e,r){t=6*v(t,360),e=v(e,100),r=v(r,100);var n=l.floor(t),i=t-n,a=r*(1-e),t=r*(1-i*e),e=r*(1-(1-i)*e),n=n%6;return{r:255*[r,t,a,a,e,r][n],g:255*[e,r,r,t,a,a][n],b:255*[a,a,e,r,r,t][n]}}(r.h,a,o),f=!0,h="hsv"):R(r.h)&&R(r.s)&&R(r.l)&&(a=w(r.s),s=w(r.l),n=function(t,e,r){function n(t,e,r){return r<0&&(r+=1),1>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(u(n));return a}function m(t,e){e=e||6;for(var t=u(t).toHsv(),r=t.h,n=t.s,i=t.v,a=[],o=1/e;e--;)a.push(u({h:r,s:n,v:i})),i=(i+o)%1;return a}function y(t){return t=parseFloat(t),t=isNaN(t)||t<0||1e.length)&&(t=e.length);for(var n=0,i=new Array(t);nr.length)&&(t=r.length);for(var a=0,e=new Array(t);al.settings.maxAgeRequired?this.error=l.options.errorMessages.maxAge+" "+l.settings.maxAgeRequired:l.settings.minAgeIsRequired&&l.settings.minAgeRequired&&ef.settings.maxNumRequired&&f.settings.maxNumEnabled?this.error=f.options.errorMessages.maxNum+" "+f.settings.maxNumRequired:ee.maxLength&&(e.value=e.value.substring(0,e.maxLength))},editVisibilityOptions:function(e,s){var t=new ComponentUIAPI;t.openDrawer({header:e.field.label,listItems:[{text:"Public"},{text:"Private"}],enableFilter:!1},function(e,i){return e?console.error(e):(i&&s(null,i),void t.closeDrawer())})}};function gm_authFailure(){customRegistration.googleMapServices.checkMapsApiKeyErrors&&(customRegistration.googleMapServices.mapsApiKeyError="There seems to be an issue with google maps key")} -"use strict";function _readOnlyError(e){throw new TypeError('"'+e+'" is read-only')}function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e=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 s,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}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=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 s,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw s}}}}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=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 o,p=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return p=e.done,e},e:function(e){r=!0,o=e},f:function(){try{p||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,a=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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 i,o=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){n=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(n)throw i}}}}function _unsupportedIterableToArray(e,a){if(e){if("string"==typeof e)return _arrayLikeToArray(e,a);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,a):void 0}}function _arrayLikeToArray(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,r=new Array(a);tthis.audio.duration?this.audio.currentTime=this.audio.duration:this.audio.currentTime+=e,this.triggerOnEvent("skip",e))},pause:function(e){(this._isPlaying()||e&&e.forcePause)&&(audioPlayer.audio.pause(),audioPlayer._allowPlay=!0)},isPaused:function(e,a){a&&a(null,audioPlayer.audio.paused)},_isAwaitingPlay:function(){return!this.audio.paused&&0===this.audio.readyState&&!this.audio.error},_isPlaying:function(){return this.audio&&0=audioPlayer.playlist.tracks.length){if(!audioPlayer.settings.loopPlaylist||!audioPlayer.playlist.tracks.length)return audioPlayer.playlist.lastIndex=audioPlayer.playlist.tracks.length-1,null;audioPlayer.playlist.lastIndex=0}return e=audioPlayer.playlist.tracks[audioPlayer.playlist.lastIndex],audioPlayer.save(),audioPlayer.triggerOnEvent("next",{index:audioPlayer.playlist.lastIndex,track:e}),e&&audioPlayer.play(e),e},previous:function(){var e;if(audioPlayer.settings.shufflePlaylist?audioPlayer.playlist.lastIndex=Math.round((audioPlayer.playlist.tracks.length-1)*Math.random()):audioPlayer.playlist.lastIndex--,audioPlayer.playlist.lastIndex<0){if(!audioPlayer.settings.loopPlaylist||!audioPlayer.playlist.tracks.length)return audioPlayer.playlist.lastIndex=0,null;audioPlayer.playlist.lastIndex=audioPlayer.playlist.tracks.length-1}return e=audioPlayer.playlist.tracks[audioPlayer.playlist.lastIndex],audioPlayer.save(),audioPlayer.triggerOnEvent("previous",{index:audioPlayer.playlist.lastIndex,track:e}),e&&audioPlayer.play(e),e},removeFromPlaylist:function(e){var a;e<0||e>=audioPlayer.playlist.tracks.length||(a=audioPlayer.playlist.tracks.splice(e,1),e==audioPlayer.playlist.lastIndex?audioPlayer.playlist.lastIndex=-1:e=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 o,p=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return p=e.done,e},e:function(e){r=!0,o=e},f:function(){try{p||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,a=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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 i,o=!0,n=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){n=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(n)throw i}}}}function _unsupportedIterableToArray(e,a){if(e){if("string"==typeof e)return _arrayLikeToArray(e,a);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,a):void 0}}function _arrayLikeToArray(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,r=new Array(a);tthis.audio.duration?this.audio.currentTime=this.audio.duration:this.audio.currentTime+=e,this.triggerOnEvent("skip",e))},pause:function(e){(this._isPlaying()||e&&e.forcePause)&&(audioPlayer.audio.pause(),audioPlayer._allowPlay=!0)},isPaused:function(e,a){a&&a(null,audioPlayer.audio.paused)},_isAwaitingPlay:function(){return!this.audio.paused&&0===this.audio.readyState&&!this.audio.error},_isPlaying:function(){return this.audio&&0=audioPlayer.playlist.tracks.length){if(!audioPlayer.settings.loopPlaylist||!audioPlayer.playlist.tracks.length)return audioPlayer.playlist.lastIndex=audioPlayer.playlist.tracks.length-1,null;audioPlayer.playlist.lastIndex=0}return e=audioPlayer.playlist.tracks[audioPlayer.playlist.lastIndex],audioPlayer.save(),audioPlayer.triggerOnEvent("next",{index:audioPlayer.playlist.lastIndex,track:e}),e&&audioPlayer.play(e),e},previous:function(){var e;if(audioPlayer.settings.shufflePlaylist?audioPlayer.playlist.lastIndex=Math.round((audioPlayer.playlist.tracks.length-1)*Math.random()):audioPlayer.playlist.lastIndex--,audioPlayer.playlist.lastIndex<0){if(!audioPlayer.settings.loopPlaylist||!audioPlayer.playlist.tracks.length)return audioPlayer.playlist.lastIndex=0,null;audioPlayer.playlist.lastIndex=audioPlayer.playlist.tracks.length-1}return e=audioPlayer.playlist.tracks[audioPlayer.playlist.lastIndex],audioPlayer.save(),audioPlayer.triggerOnEvent("previous",{index:audioPlayer.playlist.lastIndex,track:e}),e&&audioPlayer.play(e),e},removeFromPlaylist:function(e){var a;e<0||e>=audioPlayer.playlist.tracks.length||(a=audioPlayer.playlist.tracks.splice(e,1),e==audioPlayer.playlist.lastIndex?audioPlayer.playlist.lastIndex=-1:e".concat(e.value,"")}),e.emails&&e.emails.forEach(function(e){a.secondaryText+="
".concat(e.value,"
")}),a.text&&(i.push(a),a={})});o.openDrawer({header:n.header||" ",content:n.content||"",listItems:i,multiSelection:!0,multiSelectionActionButton:{text:n.drawerButtonText||"Import",type:n.drawerButtonType||"success"},enableFilter:!0},function(e,n){n&&n.forEach(function(e){delete e.text,delete e.secondaryText,delete e.imageUrl}),t(e,n)})},function(e){t(e,null)},e)):t("Contacts plugin is not integrated or not working properly",null)},showDialog:function(e,n){var t=this;permissionRequestsAPI.queueRequest("contacts",this,function(){t._showDialog(e,n)})},_showDialog:function(e,t){navigator.contacts&&navigator.contacts.pickContact?navigator.contacts.pickContact(function(e){var n={};n.name=e.displayName||e.name.formatted||e.nickname||"".concat(e.name.givenName||""," ").concat(e.name.familyName||""),n.emails=e.emails||[],n.photos=e.photos||[],n.phoneNumbers=e.phoneNumbers||[],t(null,n)},function(e){t(e,null)}):t("Contacts plugin is not integrated or not working properly",null)}}};document.addEventListener("deviceready",function(){window.open=function(e,n,t){var o,i="_blank"===n,n=bridge.InAppBrowser.open(e,n,t),t=n&&n.channels&&n.channels.close;return i&&t&&((o=document.getElementById("webviewBackdrop"))&&(o.querySelector("#removeBackdropBtn").addEventListener("click",function(){a()}),o.classList.remove("hide")),n&&n.addEventListener("close",function(){a()}),n&&n.addEventListener("exit",function(){a()})),n;function a(){var e=document.getElementById("webviewBackdrop");e&&!e.classList.contains("hide")&&(e.classList.add("closing"),setTimeout(function(){e.classList.replace("closing","hide")},250))}},"undefined"!=typeof bridge&&bridge.capabilities&&bridge.capabilities.backgroundMode&&bridge.capabilities.backgroundMode.enable&&bridge.capabilities.backgroundMode.setDefaults({title:"App is running in background",text:""}),"undefined"!=typeof CdvPurchase&&(window.store=CdvPurchase.store)}); -"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)}function HistoryAPI(t,s,e,i){var n;"object"==_typeof(t)?(this.appId=(n=t).appId,this.pluginId=n.pluginId,this.instanceId=n.instanceId,this.liveMode=n.liveMode):(this.appId=t,this.pluginId=s,this.instanceId=e,this.liveMode=i)}HistoryAPI.prototype={historyItems:[],push:function(t,s){if("undefined"==typeof emulatorSync){if("plugin"!=t.source){var e=-1;if(1=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 a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}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=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,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)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".concat(t,"

"),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:"

01:00

",showDismissButton:!1,action:{title:o.continueBtn||"CONTINUE",handler:function(){i=!1,authAPI.session._resetIdleTime(),console.log("login session extended - continue")}}}),setTimeout(function(){var n=(new Date).getTime()/1e3+60;authAPI.session.stopWatchInterval=setInterval(function(){var e,t;document.getElementById("logout-timer")?(t=9<(e=Math.round(n-(new Date).getTime()/1e3))?e:"0".concat(e),document.getElementById("logout-timer").innerText="00:".concat(t),e<=0&&(i=!1,authAPI.session._clean(),richModal.close(),setTimeout(function(){a(),authAPI.logout()},1e3),console.log("login session terminated - continue"))):(i=!1,authAPI.session._resetIdleTime(),console.log("login session extended - closed"))},1e3)},e)):!s&&authAPI.session.idleTimeSeconds>n&&(a(),console.log("login session terminated without warning"),authAPI.session._clean(),authAPI.logout())},3e3))})},end:function(){authAPI.session._clean()},_clean:function(){authAPI.session.stopWatchInterval&&(clearInterval(authAPI.session.stopWatchInterval),authAPI.session.stopWatchInterval=null),authAPI.session.updateIdleTimeInterval&&(clearInterval(authAPI.session.updateIdleTimeInterval),authAPI.session.updateIdleTimeInterval=null),authAPI.session.idleTimeSeconds=0},_resetIdleTime:function(){authAPI.session.idleTimeSeconds=0,authAPI.session.stopWatchInterval&&(clearInterval(authAPI.session.stopWatchInterval),authAPI.session.stopWatchInterval=null)}},changePassword:function(e,o){var t={},n=authAPI.getCurrentUser();if(!(window.appContext&&window.appContext.currentApp&&window.appContext.currentApp.appId&&n))return console.error("Error",{code:"MissedData",message:"Missed context's data"}),o({code:"MissedData",message:"Missed context's data"},null);t={appId:window.appContext.currentApp.appId,accessToken:n.accessToken,currentPassword:e.oldPassword,newPassword:e.newPassword,passwordStrength:e.passwordStrength},window.bfUtils.http.post(window.siteConfig.endPoints.appHost+"/api/auth/user/changePassword",t,{headers:{"Content-Type":"application/json"}}).success(function(e){n.accessToken=e.accessToken,authAPI._setCurrentUser(n),o(null,null)}).error(function(e,t,n,s){o(e,null),console.error("Error",e,t)})},validateProfileImage:function(e){var t=e.file,n=e.type;if(!t)return!1;if(t.type&&["image/jpeg","image/png","image/jpg"].indexOf(t.type)<0)return e.stringResource.getData().then(function(e){e={forceShow:!0,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:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e full_width Created with Sketch. ',halfWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e half_width Created with Sketch. ',thirdWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e third_width Created with Sketch. ',quarterWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e quarter_width Created with Sketch. ',_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
\n

'.concat(e,' size

\n
\n \n \n ').concat(this.fullWidthIcon,'\n
\n
\n \n \n ').concat(this.halfWidthIcon,'\n
\n
\n \n \n ').concat(this.thirdWidthIcon,'\n
\n
\n \n \n ').concat(this.quarterWidthIcon,"\n
\n
\n ");richModal.display({title:i,richContent:e,action:t})},renderStep:function(e,i,n){var a=this;this.currentStepData={wysiwygValue:e.defaultValue||"",textValue:e.defaultValue||"",images:[],location:{},gifs:[]},e.maxLength=e.maxLength||2e3,this.currentStepOptions=e,this.title.innerHTML=e.title||"",this.titleSecondary.innerHTML=e.title||"";var t=this.currentStepOptions.attachments,o=t.location,l=t.images,r=t.gifs,s=!1;["images","gifs","location"].forEach(function(t){e.attachments[t]&&e.attachments[t].enable&&(e.attachments[t].required||(s=!0))}),this.actionFooter.style.display=s?"flex":"none",this.cameraBtn.style.display=l.enable&&this.currentStepData.images.length<6?"block":"none",this.geoPin.style.display=o.enable&&!o.required?"block":"none",this.gifBtn.style.display=r.enable?"block":"none",this.imageGallery.style.display=e.wysiwyg?"none":"flex",this.currentUserContainer.innerHTML="";var c=authAPI.getCurrentUser();this.userImage=document.createElement("img"),c&&c.imageUrl?"undefined"!=typeof imageTools?this.userImage.src=imageTools.cropImage(c.imageUrl,{size:"xs",aspect:"1:1",compression:70}):this.userImage.src=c.imageUrl:this.userImage.src="https://pluginserver.buildfire.com/styles/media/avatar-placeholder.png",this.userImage.className="inputapi-user-image",this.currentUserContainer.appendChild(this.userImage),this.userTitle=document.createElement("h1"),this.userTitle.className="inputapi-user-title ellipsis",c&&(this.userTitle.innerHTML=c.displayName||(c.firstName?c.firstName+" ":"")+(c.lastName||"")||""),this.currentUserContainer.appendChild(this.userTitle),e.wysiwyg?(document.getElementById("tinymce-styles")||document.head.appendChild(inputAPI.getTinyMceStyles()),"undefined"!=typeof Keyboard&&Keyboard.shrinkView&&Keyboard.shrinkView(!0),this.textarea.innerHTML=this.textarea.value=e.defaultValue||"",tinymce.init(this.getTinyMceOptions(e,this)),this.cameraBtn.onclick=function(t){return a.showFileDialog(!0)},this.gifBtn.onclick=function(t){return a.showGifDialog(!0)}):(this.textarea.placeholder=e.placeholder||"Type something...",this.textarea.maxLength=e.maxLength||2e3,this.textarea.value=e.defaultValue?e.defaultValue.substring(0,this.textarea.maxLength):"");t=document.createElement("div");t.className="btn-txt primary",t.innerHTML=e.saveText||(e._buffer.length?"Next":"Done");l=document.createElement("div");l.className="btn-txt secondary iconsTheme",l.innerHTML=e.saveText||(e._buffer.length?"Next":"Done");r=document.createElement("div");r.className="btn-txt primary",r.innerHTML=e.cancelText||"Cancel";c=document.createElement("div");for(c.className="btn-txt secondary iconsTheme",c.innerHTML=e.cancelText||"Cancel",this.doneButton.innerHTML="",this.cancelButton.innerHTML="",this.doneButton.appendChild(t),this.doneButton.appendChild(l),this.cancelButton.appendChild(r),this.cancelButton.appendChild(c),this.doneButton.onclick=function(t){a.doneButton.disabled||n(a.currentStepData)},this.cancelButton.onclick=function(t){return i()},this.backdrop.onclick=function(t){return i()},e.prefill&&(this.textarea.value=e.prefill),this.doneButton.disabled=!this.validate();this.imageGallery.childNodes[1];)this.imageGallery.removeChild(this.imageGallery.childNodes[1]);"object"==_typeof(e.defaultAttachments)&&(r=(l=e.defaultAttachments).images,c=l.gifs,l=l.location,r&&r.length&&(this.currentStepData.images=r).forEach(function(t){a.addToGallery(t,"images")}),c&&c.length&&(this.currentStepData.gifs=c).forEach(function(t){return a.addToGallery(t,"gifs")}),this.currentStepData.gifs=c,this.currentStepData.location=l),o.required?this.showLocationModal():this.setLocation()},showTextDialog:function(t,e){var i,n=this;t&&e&&("undefined"==typeof tinymce&&("function"==typeof t.some?t.some(function(t){return t.wysiwyg}):t.wysiwyg)?((i=document.createElement("script")).src=window._appRoot+"scripts/lib/tinymce/js/tinymce/tinymce.min.js",i.type="text/javascript",i.onload=function(){n._showTextDialog(t,e)},document.getElementsByTagName("head")[0].appendChild(i)):this._showTextDialog(t,e))},_showTextDialog:function(t,e){var n=this;if(t&&e){if(this.currentStepOptions&&this.currentStepOptions._buffer)return e({message:"inputDialog is already active"});this.initialized||this.init();var a=new PublicFilesAPI(window.appContext.currentApp),o=Array.isArray(t)?t:[t],l=[],i=!1,r=!1;if(o.forEach(function(t){t.cancelText&&9t*-Math.abs(1.25)&&e<1.25*t},processLazyImages:function(){var t=this;document.querySelectorAll(".lazy-img").forEach(function(e){return t.process(e)})}}};setTimeout(function(){gifAPI.initialized||gifAPI.init()},5e3); -"use strict";var bookmarkAPI={add:function(n,t){var e=(window.appContext&&window.appContext.currentPlugin?window.appContext.currentPlugin:window.postMaster.launcherPluginAPI.context).instanceId,a=authAPI.getCurrentUser(),r=a?a._id:"guest",a="".concat(r,".bookmarks"),r=localStorage.getItem(a)?JSON.parse(localStorage.getItem(a)):[];n.id=n.id||n.title,n.pluginInstanceId=e;e=r.findIndex(function(t){var e=t.id===n.id,t=t.pluginInstanceId===n.pluginInstanceId;return e&&t});0<=e?r[e]=n:r.push(n),localStorage.setItem(a,JSON.stringify(r)),t(null,n)},delete:function(e,t){var n=authAPI.getCurrentUser(),a=n?n._id:"guest",r="".concat(a,".bookmarks"),n=localStorage.getItem(r)?JSON.parse(localStorage.getItem(r)):[],a=n.findIndex(function(t){return t.id===e.id&&t.pluginInstanceId==e.pluginInstanceId});0<=a&&n.splice(a,1),localStorage.setItem(r,JSON.stringify(n)),t&&t(null,n)},deleteFromPlugin:function(e,t){var n=window.appContext.currentPlugin.instanceId,a=authAPI.getCurrentUser(),r=a?a._id:"guest",o="".concat(r,".bookmarks"),a=localStorage.getItem(o)?JSON.parse(localStorage.getItem(o)):[],r=a.findIndex(function(t){return t.id===e&&n===t.pluginInstanceId});0<=r&&a.splice(r,1),localStorage.setItem(o,JSON.stringify(a)),t(null,null)},getAll:function(t){var e=authAPI.getCurrentUser(),e=e?e._id:"guest",e="".concat(e,".bookmarks");t(null,localStorage.getItem(e)?JSON.parse(localStorage.getItem(e)):[])},getAllFromPlugin:function(t,e){var n=authAPI.getCurrentUser(),n=n?n._id:"guest",a=(window.appContext&&window.appContext.currentPlugin?window.appContext.currentPlugin:window.postMaster.launcherPluginAPI.context).instanceId,n="".concat(n,".bookmarks");e(null,(localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):[]).filter(function(t){return t.pluginInstanceId===a}))}}; +"use strict";var bookmarkAPI={GUEST_KEY:"guest",add:function(n,t){var e=(window.appContext&&window.appContext.currentPlugin?window.appContext.currentPlugin:window.postMaster.launcherPluginAPI.context).instanceId,o=authAPI.getCurrentUser(),a=o?o._id:bookmarkAPI.GUEST_KEY,o="".concat(a,".bookmarks"),a=localStorage.getItem(o)?JSON.parse(localStorage.getItem(o)):[];n.id=n.id||n.title,n.pluginInstanceId=e;e=a.findIndex(function(t){var e=t.id===n.id,t=t.pluginInstanceId===n.pluginInstanceId;return e&&t});0<=e?a[e]=n:a.push(n),localStorage.setItem(o,JSON.stringify(a)),t(null,n)},delete:function(e,t){var n=authAPI.getCurrentUser(),o=n?n._id:bookmarkAPI.GUEST_KEY,a="".concat(o,".bookmarks"),n=localStorage.getItem(a)?JSON.parse(localStorage.getItem(a)):[],o=n.findIndex(function(t){return t.id===e.id&&t.pluginInstanceId==e.pluginInstanceId});0<=o&&n.splice(o,1),localStorage.setItem(a,JSON.stringify(n)),t&&t(null,n)},deleteFromPlugin:function(e,t){var n=window.appContext.currentPlugin.instanceId,o=authAPI.getCurrentUser(),a=o?o._id:bookmarkAPI.GUEST_KEY,r="".concat(a,".bookmarks"),o=localStorage.getItem(r)?JSON.parse(localStorage.getItem(r)):[],a=o.findIndex(function(t){return t.id===e&&n===t.pluginInstanceId});0<=a&&o.splice(a,1),localStorage.setItem(r,JSON.stringify(o)),t(null,null)},getAll:function(t){var e=authAPI.getCurrentUser(),n=e?e._id:bookmarkAPI.GUEST_KEY,o="".concat(n,".bookmarks"),a=[],e=localStorage.getItem(o);n===bookmarkAPI.GUEST_KEY||e?a=e:(a=localStorage.getItem("".concat(bookmarkAPI.GUEST_KEY,".bookmarks")))&&localStorage.setItem(o,a),t(null,a=(a=a?JSON.parse(a):[])?a.sort(function(t,e){t=t.title.toLowerCase(),e=e.title.toLowerCase();return tt.ssoExpiresAt&&(a.allowCancel=!1,a.showMenu=!1,c.showLogin(function(e,o){o&&authAPI._setCurrentUser(o),authAPI.triggerOnLogin(o),a.allowCancel=!0,a.showMenu=!0,c.hideLogin(),c.$$phase||c.$apply()})),o=i,"multipart/form-data"==S||"application/x-www-form-urlencoded"==S?e={headers:{Authorization:"Bearer "+t.ssoUserToken,"Content-Type":"application/json"}}:(e={headers:{"Content-Type":"application/x-www-form-urlencoded"}},o=i+"?access_token="+t.ssoUserToken),window.bfUtils.http.get(o,e).success(function(e){console.log(e)}).error(function(e,o,t,n){a.allowCancel=!1,a.showMenu=!1,c.showLogin(function(e,o){authAPI._setCurrentUser(o),authAPI.triggerOnLogin(o),a.allowCancel=!0,a.showMenu=!0,c.hideLogin(),c.$$phase||c.$apply()})}))}c.updateLoginCss=function(){o()},c.updateSSORegistrationFormStatus=function(e){/htt(p|ps):\/\//g.test(U.src)&&(window.spinner&&window.spinner.hide(),c.ssoRegistrationFormStatus=e,c.$$phase||c.$apply())},o(),c.SSOLogin=!1,authAPI.getAuthSettings(null,A),c.closeLogin=function(){c.loginCallback&&c.loginCallback(),a.allowCancel?c.hideLogin():T()},c.reset=function(){c.errors={},c.showProgressMessage=!1,c.allowToRegister=!1,c.uploadFile=null,c.changePassword.oldPassword=null,c.changePassword.newPassword=null,c.changePassword.reTypedPassword=null,c.changePassword.secretCode=null,c.userObj.email=null,c.userObj.username=null,c.password=null,c.secretCode=null,c.newPassword=null,c.confirmPassword=null,c.msgSuccess=null,c.firstName=null,c.lastName=null,c.secretCodeProvider=null,c.refWindow=null,c.registrationGdprLinks&&c.registrationGdprLinks.forEach(function(e){e.value=void 0,e.error=void 0}),c.customRegistrationFields&&c.customRegistrationFields.forEach(function(e){e.value=void 0,e.error=void 0,"date"===e.type&&tinycolor(PluginAPI.appTheme.colors.backgroundColor).isDark()?e.class="inverted-input":e.class=e.class?e.class.replace("inverted-input",""):""})};var O=function(){c.successShown=!1,c.registrationShown=!1,c.loginShown=!1,c.forgetPasswordShown=!1,c.resetPasswordShown=!1,c.changePasswordShown=!1,(U=U||document.getElementById("frmExternalRegistrationForm")).src="",c.externalRegister=!1,c.ssoRegistrationFormStatus=null};O(),c.openTermsAndConditions=function(){return window.open("https://learn.appdocumentation.com/en/collections/1618556-terms-conditions-and-privacy-policy","_system"),!1},c.hideLogin=function(){c.reset(),O(),a.authShown=!1,c.loginCallback=null};var U=document.getElementById("frmExternalRegistrationForm");function T(){c.reset(),O(),a.allowCancel=!c.loginOptions||!1!==c.loginOptions.allowCancel,a.showMenuOnAuth=!c.loginOptions||!1!==c.loginOptions.showMenu,c.loginShown=!0,c.showAuth(),c.$$phase||c.$apply()}function L(){var o={};if(c.customRegistrationFields&&c.customRegistrationFields.forEach(function(e){"password"===e.type&&(o=e.messages)}),c.customRegistrationRules&&"simple"===c.customRegistrationRules.passwordStrength){if(!window.validator.validatePassword(c.changePassword.newPassword,{simplePasswordValidation:!0}))return c.errors.newPassword=!0,void(c.newPasswordError=o.invalidPasswordSimpleRules)}else if(!window.validator.validatePassword(c.changePassword.newPassword))return c.errors.newPassword=!0,void(c.newPasswordError=o.invalidPasswordRules||c.changePasswordAtLeast8ComplexChars);return 1}function x(e,r){var o=(o=JSON.parse(window.localStorage.getItem("SSO_USER")))||{};if("string"==typeof e)try{e=JSON.parse(e)}catch(e){console.warn("Unexpected parsing issue",e)}e&&e.access_token?o.ssoUserToken=e.access_token:o.ssoUserToken=e.replace(/["]+/g,""),e&&e.expires_in&&e.issued_at?o.ssoExpiresAt=e.issued_at+e.expires_in:o.ssoExpiresAt=1902608081e3,window.localStorage.setItem("SSO_USER",JSON.stringify(o));var t=null,t="undefined"==typeof push?{}:push,e=i.replace(window.siteConfig.endPoints.hopHost+"?url=",""),t={accessToken:o.ssoUserToken,accessTokenAPI:e,deviceId:t.deviceId,osType:t.platform?t.platform.toLowerCase():"web",externalAppId:window.appContext.currentApp.appId,loginProviderType:"SSO",email:c.userObj.username,contentType:S},t=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify({id:1,method:"users/loginSSO",params:t}));window.bfUtils.http.jsonp(t,{bypassInterceptorForStatus:404}).success(function(e){var o;e&&e.result?(authAPI._setCurrentUser(e.result),a.$broadcast("loginSuccessfully",e.result),r(null,e.result),bfUtils.isEmulatorCP&&cpSync.SSO.log("Succeed...")):(o=null,e&&e.error?(console.error(e.error),o=e.error,bfUtils.isEmulatorCP&&cpSync.SSO.log(e.error)):(e=o="Could not retrieve profile data",console.error(e),bfUtils.isEmulatorCP&&cpSync.SSO.log(e)),r&&r(o,null))}).error(function(e,o,t,n){console.error(e),r&&r(e,null),bfUtils.isEmulatorCP&&cpSync.SSO.log("Error while testing SSO Login..")})}c.showRegistration=function(e,n){var o;c.scrolling=bfUtils.isIOS?"no":"auto","SSOLogin"==y&&C?(o=function e(o){if(o&&-1".concat(t,"

"),showDismissButton:!1,forceShow:!0,action:{title:"OK",handler:function(){}}})}else c.changePasswordShown=!1,a.authShown=!1,c.reset(),(new ComponentUIAPI).showToastMessage({text:c.changedPasswordSuccessfully,hideDismiss:!0})}))},c.showSecretCodeModal=function(){richModal.display({title:"Secret Code",richContent:"

".concat(c.secretCodeInformModal,"

"),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:"

".concat(secretCodeError,"

"),showDismissButton:!1,forceShow:!0,action:{title:"OK",handler:function(){}}}),console.error(e)}),c.passwordChangeForm.showCurrentPasswordField=!1}}})},c.changePasswordBySecretCode=function(){var e;L()&&(e={email:authAPI.getCurrentUser().email,secretCode:c.changePassword.secretCode,password:c.changePassword.newPassword,passwordStrength:c.customRegistrationRules?c.customRegistrationRules.passwordStrength:null,externalAppId:window.currentAppId},e=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify({id:1,method:"users/changePassword",params:e})),window.bfUtils.http.jsonp(e,{bypassInterceptorForStatus:404}).success(function(e){e&&e.result?(c.changePasswordShown=!1,a.authShown=!1,c.reset(),authAPI.logout(),(new ComponentUIAPI).showToastMessage({text:c.changedPasswordSuccessfully,hideDismiss:!0})):e&&e.error&&(c.errors.secretCode=!0,console.error(e.error))}).error(function(e,o,t,n){richModal.display({title:"Change Password",richContent:"

".concat(c.changePasswordError,"

"),showDismissButton:!1,forceShow:!0,action:{title:"OK",handler:function(){}}}),console.error(e)}))},c.showBackLogin=function(){authAPI.login(null,function(){a.$broadcast("displayNav")})},c.login=function(e,n){var r,o,t,s,i;window.spinner&&window.spinner.show&&window.spinner.show(!0),"SSOLogin"!=y?(t=e,s=function(e,o){var t;e||!o?(t=null,t=e?1303===e.code?e.message:"Invalid Login":"To log in, please make sure you have a valid connection.",window.openDialog({data:{title:" ",body:t,disableCancel:!0}},function(){}),console.error(e),n&&n(e,null)):(n=n||c.loginCallback)&&n(null,o),window.spinner&&window.spinner.hide&&window.spinner.hide(!0)},window.appContext&&window.appContext.currentApp?(s=s||c.loginCallback,i=null,i="undefined"==typeof push?{}:push,e=(e=c.userObj.email)||t.email,c.password||(c.password=t.password),"enabled"==g&&p&&!e.includes("@")&&(e+=p),console.warn("email",e),i={email:e,password:c.password,deviceId:i.deviceId,osType:i.platform?i.platform.toLowerCase():"web",externalAppId:window.appContext.currentApp.appId},t&&(i.email=t.email,i.password=t.password),i=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify({id:1,method:"users/login",params:i})),window.bfUtils.http.jsonp(i,{bypassInterceptorForStatus:404}).success(function(e){var o;e&&e.result&&e.result.userToken?(authAPI._setCurrentUser(e.result),a.$broadcast("loginSuccessfully",e.result),s&&s(null,e.result)):(o=null,e&&e.error&&(console.warn("login error: ",e.error),o=e.error),s&&s(o,null))}).error(function(e,o,t,n){console.error(e),s&&s(e,null)})):console.error("invalid appContext")):(r=function(e,o){if(e){console.error(e);var t=null;if(e)switch(e.code){case 1303:case 1301:case 1312:t=e.message;break;default:t="Invalid Login"}else t="To log in, please make sure you have a valid connection.";window.openDialog({data:{title:" ",body:t,disableCancel:!0}},function(){}),n&&n(e,null)}else(n=n||c.loginCallback)(null,o);window.spinner&&window.spinner.hide&&window.spinner.hide(!0)},t={headers:{"Content-Type":"application/x-www-form-urlencoded"}},i=c.userObj.username,"enabled"==g&&p&&!i.includes("@")&&(i+=p),"application/x-www-form-urlencoded"==S?o=encodeURIComponent("grant_type")+"="+encodeURIComponent("password")+"&"+encodeURIComponent("username")+"="+encodeURIComponent(i)+"&"+encodeURIComponent("password")+"="+encodeURIComponent(c.password)+"&"+encodeURIComponent("client_id")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("client_secret")+"="+encodeURIComponent(P):"multipart/form-data"==S?(t={transformRequest:angular.identity,headers:{"Content-Type":void 0}},(o=new FormData).append("username",i),o.append("password",c.password)):o={grant_type:"password",username:i,password:c.password,client_id:b},window.bfUtils.http.post(h,o,t).success(function(e){x(e,r)}).error(function(e,o,t,n){e&&e.error_description&&console.error(e),r&&r("Login Failed",null),bfUtils.isEmulatorCP&&(e||"0"!=o?(o&&cpSync.SSO.log("Error status:"+o),e&&cpSync.SSO.log("Error details:"+JSON.stringify(e))):cpSync.SSO.log("Error while testing SSO Login , CORS policy .."))}))};c.getGDPR=function(t,n){var e=c.userObj.email,e=siteConfig.endPoints.crmHost+"/documents/"+t.key+"/check?userKey="+encodeURIComponent(e)+"&withDetails=true";bfUtils.http.get(e).success(function(e){var o={};o.title=r.trustAsHtml(e[t.key].title),o.subtitle=r.trustAsHtml(e[t.key].subtitle),o.details=r.trustAsHtml(e[t.key].details),n(null,o)}).error(function(e){console.error(e),n(e,null)})},c.loadGDPR=function(e){c.getGDPR({key:e},function(e,o){o&&(c.GDPR_content=o,c.showGDPR=!0,a.$broadcast("hideNav"),c.$$phase||c.$apply())})},c.hideGDPR=function(){a.$broadcast("displayNav"),c.showGDPR=!1,c.GDPR_content=null},c.saveGDPR=function(s,i){var o;o=function(e,o){var t=o?o:{};t.appId=appContext.currentApp.appId;var n,r,o=["bf_terms_and_conditions","bf_privacy_policy"];s.customTermsAndConditionsKey&&o.push(s.customTermsAndConditionsKey),s.customPrivacyPolicyKey&&o.push(s.customPrivacyPolicyKey),n=o.join(","),r=function(){i&&i()},n?(n=siteConfig.endPoints.crmHost+"/documents/"+n+"/accept",bfUtils.http.post(n,{userKey:(s||c.userObj).email.toLowerCase(),info:t,source:"app"}).success(function(e){r(null,e)}).error(function(e){r(e),console.error(e)})):r(null,null)},window.$http.get("https://ipapi.co/json/").success(function(e){e?(e={ipInfo:{city:e.city,country:e.country_name,countryCode:e.country,lat:e.latitude,lon:e.longitude,regionName:e.region,timezone:e.timezone,zip:e.postal,ip:e.ip}},o(null,e)):o(null,null)}).error(function(e){o(null,null)})},c.register=function(t,n){var r,e;window.appContext&&window.appContext.currentApp?(n=n||c.loginCallback,e=null,e="undefined"==typeof push?{}:push,(r=(t?t.user:void 0)||{firstName:c.firstName||"",lastName:c.lastName||"",email:c.userObj.email,password:c.password}).deviceId=e.deviceId,r.osType=e.platform?e.platform.toLowerCase():"web",r.passwordStrength=c.customRegistrationRules?c.customRegistrationRules.passwordStrength:null,r.checkUniqueName=!!c.customRegistrationRules&&c.customRegistrationRules.checkUniqueName,r.externalAppId=window.appContext.currentApp.appId,e=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(angular.toJson({id:1,method:"users/register",params:r})),c.isRegistering=!0,window.bfUtils.http.jsonp(e,{bypassInterceptorForStatus:404}).success(function(e){var o;e&&e.result?(o={email:r.email},t&&(o.customTermsAndConditionsKey=t.customTermsAndConditionsKey,o.customPrivacyPolicyKey=t.customPrivacyPolicyKey),c.saveGDPR(o,function(){c.login({email:r.email,password:r.password},function(e,o){r.userProfile&&userTags.setRegistrationTags(r,!0,function(e,o){e&&console.log(e)}),o&&o.userToken?(authAPI.uploadProfileImage({file:c.uploadFile,uploader:s},function(e,o){var t,r;e?(c.isRegistering=!1,n&&n(e,null)):(e=authAPI.getCurrentUser(),o?(userTags.setRegistrationTags({imageUrl:o.result},!0,function(e,o){e&&console.log(e)}),o={userToken:e.userToken,imageUrl:o.result,externalAppId:window.currentAppId},t=o,r=function(e,o){c.isRegistering=!1,n&&n(e,o)},o=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify({id:1,method:"users/update",params:t})),window.bfUtils.http.jsonp(o,{bypassInterceptorForStatus:404}).success(function(e){var o;e.error?(o=null,e&&e.error&&(console.error(e.error),o=e.error),r&&r(o,null)):(null!=(o=authAPI.getCurrentUser())&&(o.imageUrl=t.imageUrl,authAPI._setCurrentUser(o)),r&&r(null,o))}).error(function(e,o,t,n){console.error(e),r&&r(e,null)})):(c.isRegistering=!1,n&&n(null,e)))}),authAPI.trackRegister(o)):c.isRegistering=!1})})):(c.isRegistering=!1,e&&e.error&&(o=e.error.message,1301===e.error.code&&t&&t.messages&&t.messages.emailAlreadyInUse?o=t.messages.emailAlreadyInUse:1313===e.error.code&&t&&t.messages&&t.messages.fullNameAlreadyInUse&&(o=t.messages.fullNameAlreadyInUse,c.customRegistrationFields.forEach(function(e){"fullName"===e.id&&(e.error=t.messages.fullNameAlreadyInUse)})),window.openDialog({data:{title:" ",body:o,disableCancel:!0}},function(){}),console.warn(e.error),e.error))}).error(function(e,o,t,n){console.error(e),c.isRegistering=!1})):console.error("invalid appContext")},c.requestLoginProvider=function(r,s){var e={id:1,method:"secretCode/request",params:{externalAppId:window.currentAppId}},e=window.siteConfig.endPoints.authHost+"/src/server.js?callback=JSON_CALLBACK&data="+encodeURIComponent(JSON.stringify(e));c.refWindow&&!c.refWindow.closed||window.bfUtils.http.jsonp(e,{bypassInterceptorForStatus:404}).success(function(e){var o,t,n;null!=e&&null!=e.result&&e.result.code&&(c.secretCodeProvider=e.result.code,"social"===r&&"apple"===s?c.refWindow=window.open(window.siteConfig.endPoints.authHost+"/website/appleLogin.html?code="+encodeURIComponent(c.secretCodeProvider)+"&externalAppId="+encodeURIComponent(window.currentAppId),"_blank","location=no,enableViewportScale=yes"):"oauth2"==r?c.refWindow=window.open(window.siteConfig.endPoints.authHost+"/app/".concat(encodeURIComponent(window.currentAppId),"/oauth2/login")+"?code="+encodeURIComponent(c.secretCodeProvider)+"&providerId="+encodeURIComponent(s),"_blank","location=no,enableViewportScale=yes"):(n="",t="_blank",("facebook"===s&&bfUtils.isAndroid||"google"===s&&bfUtils.isMobileDevice)&&(o=deviceAPI.getAppSchema(),t="_system",e=imageTools.cropImage(window.appContext.currentApp.iconUrl,{width:65,height:65}),n="&appSchema="+encodeURIComponent(o||"")+"&isExternalWindow=true&appName="+encodeURIComponent(window.appContext.currentApp.appName||"")+"&appIcon="+encodeURIComponent(e||"")),n=window.open(window.siteConfig.endPoints.authHost+"/website/index.html?v=2.0&code="+encodeURIComponent(c.secretCodeProvider)+"&loginProviderType="+s+"&externalAppId="+encodeURIComponent(window.currentAppId)+n,t,"location=no,enableViewportScale=yes"),c.refWindow="_blank"===t?n:null),c.refWindow&&c.refWindow.addEventListener&&(c.refWindow.addEventListener("exit",function(){c.refWindow=null}),c.refWindow.addEventListener("close",function(){c.refWindow=null})),setTimeout(D,1e3,480,s))},function(e){console.log(JSON.stringify(e))})};var D=function t(n,r){var e;window.appContext&&window.appContext.currentApp?0=o.getTime()&&userTags.setRegistrationTags(null,!0,function(e,o){e&&console.log(e)}),null!=c.refWindow&&(c.refWindow.close(),c.refWindow=null),c.loginCallback&&c.loginCallback(null,authAPI.getCurrentUser())):null!=c.refWindow&&c.refWindow.closed&&"twitter"!=r?(c.refWindow.close(),c.secretCodeProvider=null,c.refWindow=null):setTimeout(t,1e3,n-1,r)},function(e){console.log(JSON.stringify(e))})):((c.secretCodeProvider=null)!=c.refWindow&&(c.refWindow.close(),c.refWindow=null),c.loginCallback&&c.loginCallback(null,null)):console.error("invalid appContext")};c.setThemeType=function(e){var o,t,n=null;(e=e||{}).customLoginUI&&e.customLoginUI.background&&e.customLoginUI.background.active&&e.customLoginUI.background.activeColor?e.customLoginUI.background.color&&"solid"===e.customLoginUI.background.color.colorType&&(n=e.customLoginUI.background.color.solid.colorHex):e.colors&&e.colors.backgroundColor&&(n=e.colors.backgroundColor),n&&(n=n.match(/^rgb/)?(o=(n=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/))[1],t=n[2],n[3]):(o=(n=+("0x"+n.slice(1).replace(n.length<5&&/./g,"$&$&")))>>16,t=n>>8&255,255&n),n=Math.sqrt(o*o*.299+t*t*.587+n*n*.114),c.themeType=127.5\n\t\t\t\t\t\t

').concat(e.typeToFinishDeleting||r).concat(e.confirmDeleting||t).concat(e.belowToProceed||s,'

\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

').concat(e.thisFieldIsCaseSensitive||i,'

\n\t\t\t\t\t\t
\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
';var y=t.querySelector(".bottom-drawer");t.querySelector(".bottom-drawer-backdrop").onclick=function(){e.closeDrawer(),l.triggerCallbackOnUIDismiss&&c(null,null)},l.height&&(y.style.height=l.height),"undefined"!=typeof globalEvents&&(window.addEventListener(globalEvents.TABCHANGE.CONTENT,function(){e.closeDrawer()}),window.addEventListener(globalEvents.TABCHANGE.PURCHASE,function(){e.closeDrawer()}));var n,i,s,v,f,S,g,T,k=function(e){return a?-1]+>|[\s-_():,/\\|]+/g);return t.forEach(function(t){t&&(n.forEach(function(e){e.startsWith(t)&&(s=!0)}),i=!(!s||!i),s=!1)}),i}),p.innerHTML="",p.scrollTop=0,I(e,p),R(e)):(p.innerHTML="",p.scrollTop=0,I(o,p),R(o)))};function x(e){var t=y.querySelector("#drawerButton");y.querySelector("#buttonBadge").innerHTML=e||"",l.requireSelection&&(e?(t.classList.remove("disabled-drawer-button"),t.disabled=!1):(t.classList.add("disabled-drawer-button"),t.disabled=!0))}function I(i,e){var s={};e?s=e:((s=document.createElement("ul")).classList.add("action-list"),s.onclick=function(e){for(var t,n=e.target;"LI"!==n.nodeName;){if("UL"===n.nodeName)return void console.log("Wrong Click");n=n.parentElement}l.multiSelection?(t=n.querySelector("input[type=checkbox]"),"checkbox"!=e.target.type&&(t.checked=!t.checked),function(e,t){{var n;t?(a?u.push(e):(n=m.indexOf(e),m.splice(n,1)),x(Number(y.querySelector("#buttonBadge").innerHTML)+1)):(a?(n=u.indexOf(e),u.splice(n,1)):m.push(e),x(Number(y.querySelector("#buttonBadge").innerHTML)-1))}}(n.item,t.checked)):c(null,n.item)});var o=0;function t(){for(var e,t,n=o;n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
'),l.isHTML?(r.sanitize(i[n].text,e.children[1].children[0]),r.sanitize(i[n].secondaryText,e.children[1].children[1])):(e.children[1].children[0].innerText=i[n].text,e.children[1].children[1].innerText=i[n].secondaryText||""),l.multiSelection&&(e.querySelector("input[type=checkbox]").checked=k(i[n])||!1),e.item=i[n],s.appendChild(e));o+=50,console.log("Load Other Items")}if(b&&s.removeEventListener("scroll",b),b=function(){s.scrollTop+s.clientHeight+1e3>=s.scrollHeight&&t()},s.addEventListener("scroll",b),t(),!e){for(var n=0;n'),l.isHTML?this.sanitize(l.multiSelectionActionButton.text,A.children[0]):A.children[0].innerText=l.multiSelectionActionButton.text,w.appendChild(A),y.appendChild(w),y.querySelector("#drawerButton").onclick=function(){e.closeDrawer(),c(null,(a||m.forEach(function(e){e=u.indexOf(e);u.splice(e,1)}),u))},x(u.length)),this.closeDrawer({force:!0}),(document.querySelector("#emulatorContainer #app")||document.body).appendChild(t),!l.tabs||l.multiSelection||l.listItems||setTimeout(function(){e.scrollBooster=new ScrollBooster({viewport:t.querySelector(".md-tabs-scroll"),content:t.querySelector(".md-tabs"),scrollMode:"native",direction:"horizontal"}),setTimeout(function(){e.scrollBooster&&e.scrollBooster.updateMetrics()},1e3),setTimeout(function(){e.scrollBooster&&e.scrollBooster.updateMetrics()},3e3)},0)},showToastMessage:function(e,t){var n=this;e=e||{};var i=document.getElementById(this.SNACKBAR_UI_ID);i.querySelector(".snackbar-message").innerText=e.text;var s=i.querySelector(".snackbar");e.type||(e.type="info"),s.className="snackbar ".concat(e.type+"BackgroundTheme");var o=i.querySelector(".snackbar-actions"),s=o.querySelector(".snackbar-action");e.action&&e.action.title?(s.querySelector("span").innerText=e.action.title,s.classList.remove("hide"),s.onclick=function(){t&&t(null,e.action)}):s.classList.add("hide"),e.hideDismiss?o.querySelector(".dismiss").classList.add("hide"):(o.querySelector(".dismiss").classList.remove("hide"),o.querySelector(".dismiss").onclick=function(){n.closeToastMessage({force:!0})}),i.classList.remove("hide"),i.querySelector(".snackbar").classList.add("open"),this.closeToastMessage(e)},closeToastMessage:function(e,t){(e=e||{}).duration||(e.duration=8e3);var n=document.getElementById(this.SNACKBAR_UI_ID);e.force?(n.querySelector(".snackbar").classList.remove("closing"),n.querySelector(".snackbar").classList.remove("open"),setTimeout(function(){n.classList.add("hide")},250)):(n.querySelector(".snackbar").classList.add("closing"),this.timeOutId&&clearTimeout(this.timeOutId),this.timeOutId=setTimeout(function(){n.querySelector(".snackbar").classList.remove("closing"),n.querySelector(".snackbar").classList.remove("open"),setTimeout(function(){n.classList.add("hide")},250),this.timeOutId=null},e.duration))}}; +"use strict";function ComponentUIAPI(e){this.context=e,this.DRAWER_UI_ID="bottomDrawerContainer",this.SNACKBAR_UI_ID="snackbarhero",this.init()}ComponentUIAPI.prototype={init:function(){},sanitize:function(e,n,i){window.bfUtils.sanitize({data:e},function(e,t){return e?(i&&i(e,null),console.error(e)):(n.innerHTML+=t,void(i&&i(null,null)))})},closeDrawer:function(e,t){e=e||{};var n=document.getElementById(this.DRAWER_UI_ID);n&&(this.scrollBooster&&(this.scrollBooster.destroy(),this.scrollBooster=null),e.force?n.remove():(n.classList.add("closing"),setTimeout(function(){n.remove()},300)))},openTrustedDrawer:function(e,t){e.isTrusted=!0,this._openDrawer(e,t)},openDrawer:function(e,t){delete e.isTrusted,this._openDrawer(e,t)},_openDrawer:function(){var e=this,s=0
';var y=t.querySelector(".bottom-drawer");t.querySelector(".bottom-drawer-backdrop").onclick=function(){e.closeDrawer(),s.triggerCallbackOnUIDismiss&&c(null,null)},s.height&&(y.style.height=s.height),"undefined"!=typeof globalEvents&&(window.addEventListener(globalEvents.TABCHANGE.CONTENT,function(){e.closeDrawer()}),window.addEventListener(globalEvents.TABCHANGE.PURCHASE,function(){e.closeDrawer()}));var n,i,o,v,f,g,S,T,I=function(e){return a?-1]+>|[\s-_():,/\\|]+/g);return t.forEach(function(t){t&&(n.forEach(function(e){e.startsWith(t)&&(o=!0)}),i=!(!o||!i),o=!1)}),i}),p.innerHTML="",p.scrollTop=0,x(e,p),z(e)):(p.innerHTML="",p.scrollTop=0,x(l,p),z(l)))};function L(e){var t=y.querySelector("#drawerButton");y.querySelector("#buttonBadge").innerHTML=e||"",s.requireSelection&&(e?(t.classList.remove("disabled-drawer-button"),t.disabled=!1):(t.classList.add("disabled-drawer-button"),t.disabled=!0))}function x(i,e){var o={};e?o=e:((o=document.createElement("ul")).classList.add("action-list"),o.onclick=function(e){for(var t,n=e.target;"LI"!==n.nodeName;){if("UL"===n.nodeName)return void console.log("Wrong Click");n=n.parentElement}s.multiSelection?(t=n.querySelector("input[type=checkbox]"),"checkbox"!=e.target.type&&(t.checked=!t.checked),function(e,t){{var n;t?(a?u.push(e):(n=m.indexOf(e),m.splice(n,1)),L(Number(y.querySelector("#buttonBadge").innerHTML)+1)):(a?(n=u.indexOf(e),u.splice(n,1)):m.push(e),L(Number(y.querySelector("#buttonBadge").innerHTML)-1))}}(n.item,t.checked)):c(null,n.item)});var l=0;function t(){for(var e,t,n=l;n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
'),s.isHTML?(r.sanitize(i[n].text,e.children[1].children[0]),r.sanitize(i[n].secondaryText,e.children[1].children[1])):(e.children[1].children[0].innerText=i[n].text,e.children[1].children[1].innerText=i[n].secondaryText||""),s.multiSelection&&(e.querySelector("input[type=checkbox]").checked=I(i[n])||!1),e.item=i[n],o.appendChild(e));l+=50,console.log("Load Other Items")}if(b&&o.removeEventListener("scroll",b),b=function(){o.scrollTop+o.clientHeight+1e3>=o.scrollHeight&&t()},o.addEventListener("scroll",b),t(),!e){for(var n=0;n'),s.isHTML?this.sanitize(s.multiSelectionActionButton.text,A.children[0]):A.children[0].innerText=s.multiSelectionActionButton.text,k.appendChild(A),y.appendChild(k),y.querySelector("#drawerButton").onclick=function(){e.closeDrawer(),c(null,(a||m.forEach(function(e){e=u.indexOf(e);u.splice(e,1)}),u))},L(u.length)),this.closeDrawer({force:!0}),(document.querySelector("#emulatorContainer #app")||document.body).appendChild(t),!s.tabs||s.multiSelection||s.listItems||setTimeout(function(){e.scrollBooster=new ScrollBooster({viewport:t.querySelector(".md-tabs-scroll"),content:t.querySelector(".md-tabs"),scrollMode:"native",direction:"horizontal"}),setTimeout(function(){e.scrollBooster&&e.scrollBooster.updateMetrics()},1e3),setTimeout(function(){e.scrollBooster&&e.scrollBooster.updateMetrics()},3e3)},0)},showToastMessage:function(e,t){var n=this;e=e||{};var i=document.getElementById(this.SNACKBAR_UI_ID);i.querySelector(".snackbar-message").innerText=e.text;var o=i.querySelector(".snackbar");e.type||(e.type="info"),o.className="snackbar ".concat(e.type+"BackgroundTheme");var l=i.querySelector(".snackbar-actions"),o=l.querySelector(".snackbar-action");e.action&&e.action.title?(o.querySelector("span").innerText=e.action.title,o.classList.remove("hide"),o.onclick=function(){t&&t(null,e.action)}):o.classList.add("hide"),e.hideDismiss?l.querySelector(".dismiss").classList.add("hide"):(l.querySelector(".dismiss").classList.remove("hide"),l.querySelector(".dismiss").onclick=function(){n.closeToastMessage({force:!0})}),i.classList.remove("hide"),i.querySelector(".snackbar").classList.add("open"),this.closeToastMessage(e)},closeToastMessage:function(e,t){(e=e||{}).duration||(e.duration=8e3);var n=document.getElementById(this.SNACKBAR_UI_ID);e.force?(n.querySelector(".snackbar").classList.remove("closing"),n.querySelector(".snackbar").classList.remove("open"),setTimeout(function(){n.classList.add("hide")},250)):(n.querySelector(".snackbar").classList.add("closing"),ComponentUIAPI._startClosingTimeoutId&&clearTimeout(ComponentUIAPI._startClosingTimeoutId),ComponentUIAPI._finalizeClosingTimeoutId&&clearTimeout(ComponentUIAPI._finalizeClosingTimeoutId),ComponentUIAPI._startClosingTimeoutId=setTimeout(function(){n.querySelector(".snackbar").classList.remove("closing"),n.querySelector(".snackbar").classList.remove("open"),console.log("set snackbar timeout"),ComponentUIAPI._finalizeClosingTimeoutId=setTimeout(function(){n.classList.add("hide"),ComponentUIAPI._finalizeClosingTimeoutId=null},250),ComponentUIAPI._startClosingTimeoutId=null},e.duration))}}; "use strict";function _typeof(i){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i})(i)}var imageTools={get ENUMS(){return{SIZES:{xxs:32,xs:64,s:128,m:200,l:304,xl:416,xxl:600,720:720,1080:1080,1440:1440,1920:1920,2560:2560,3840:3840,get full_width(){return this.findNearest(1)},get half_width(){return this.findNearest(2)},get third_width(){return this.findNearest(3)},get fourth_width(){return this.findNearest(4)},get fifth_width(){return this.findNearest(5)},get sixth_width(){return this.findNearest(6)},findNearest:function(i){for(var t=null,e=0;eWarning: Existing data will be overwritten

':"",'

You can customize the following AI request.

").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