cronapi-js 2.9.2-SP.27 → 2.9.2-SP.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cronapi.js CHANGED
@@ -6434,7 +6434,7 @@ function cronapi() {
6434
6434
  // This will be used to identify the Dialog custom type to add custom styles
6435
6435
  wrapper.attr('data-dialog-type', icon);
6436
6436
  let nextZIndex = cronapi.internal.getMaxZIndex() + 1;
6437
- wrapper.css('z-index', nextZIndex);
6437
+ wrapper.css('z-index', nextZIndex).css('pointer-events', 'all');
6438
6438
 
6439
6439
  function setButton(buttonConfirmDialogAlert){
6440
6440
  let buttons = (Array.isArray(buttonConfirmDialogAlert) ? buttonConfirmDialogAlert : [buttonConfirmDialogAlert]);
@@ -7311,7 +7311,17 @@ function cronapi() {
7311
7311
  this.cronapi.authentication.signup = async function (signupUsername, signupEmail, signupPassword, signupConfirmPassword) {
7312
7312
  // The following code was copied from the auto generated Blockly logic for signup
7313
7313
  let responseSignUp, json, httpCodeStatus, httpMessageStatus;
7314
- if ((await this.blockly.js.blockly.UserControl.isValidSignup(signupUsername, signupEmail, signupPassword, signupConfirmPassword))) {
7314
+ let isValidSignup = this.cronapi.authentication.isValidSignup;
7315
+ // Client isValidSignup blockly location is different on WEB and MOBILE projects and may not exist.
7316
+ const webIsValidSignup = this?.blockly?.js?.blockly?.UserControl?.isValidSignup;
7317
+ const mobileIsValidSignup = this?.blockly?.js?.blockly?.auth?.UserControl?.isValidSignup;
7318
+ if (angular.isFunction(webIsValidSignup)) {
7319
+ isValidSignup = webIsValidSignup;
7320
+ } else if (angular.isFunction(mobileIsValidSignup)) {
7321
+ isValidSignup = mobileIsValidSignup;
7322
+ }
7323
+
7324
+ if ((await isValidSignup(signupUsername, signupEmail, signupPassword, signupConfirmPassword))) {
7315
7325
  this.cronapi.util.callServerBlocklyAsynchronous('blockly.UserControl:signUp', async (sender_responseSignUp) => {
7316
7326
  responseSignUp = sender_responseSignUp;
7317
7327
  json = this.cronapi.json.createObjectFromString(responseSignUp);
@@ -12,14 +12,14 @@
12
12
  <div class="cronapp-icon cronapp-${n}">${p()}</div>
13
13
  </div>
14
14
  <h2 class="title">${t}</h2> <h3 class="subtitle">${a}</h3>
15
- </div>`;let u={width:"450px",minWidth:300,maxWidth:()=>window.innerWidth-40,title:!!l&&(t||!1),closable:!1,modal:!0,content:l?a:d,buttonLayout:l?"stretched":"normal",actions:[],close:()=>setTimeout(()=>s.data("kendoDialog").destroy())};r(o),s.kendoDialog(u);const m=s.data("kendoDialog"),g=m.wrapper;g.attr("data-dialog-type",n);let h=cronapi.internal.getMaxZIndex()+1;g.css("z-index",h),m.open()},this.cronapi.notification.buttonConfirmDialogAlert=function(n,t,a){return{title:t,value:function(){return a&&a(),!0},primaryValue:n}},this.cronapi.regex={},this.cronapi.regex.extractTextByRegex=function(n,t,a){if(this.cronapi.logic.isNull(n)||this.cronapi.logic.isNull(t))return[];let o=null;o=null!=a&&"-"!==a?new RegExp(t,a):new RegExp(t);let r=[],c=null,s;for(;(s=o.exec(n))&&!(null!=c&&c==s.index);){let n=[];for(i=1;i<s.length;i++)n.push(s[i]);c=s.index,r.push(n)}return r},this.cronapi.regex.validateTextWithRegex=function(n,t,a){return!(this.cronapi.logic.isNull(n)||this.cronapi.logic.isNull(t))&&(null!=a&&"-"!==a?new RegExp(t,a).test(n):new RegExp(t).test(n))},this.cronapi.calendar={},this.cronapi.calendar.getCalendarValue=async function(n){const t=await getCalendar(n);return t?t.value():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarValue=async function(n,t){const a=await getCalendar(n);a?a.value(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarMin=async function(n){const t=await getCalendar(n);return t?t.min():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarMin=async function(n,t){const a=await getCalendar(n);a?a.min(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarMax=async function(n){const t=await getCalendar(n);return t?t.max():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarMax=async function(n,t){const a=await getCalendar(n);a?a.max(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarSelectDates=async function(n){const t=await getCalendar(n);return t?t.selectDates():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarSelectDates=async function(n,t){const a=await getCalendar(n);a?a.selectDates(Array.isArray(t)?t:[t]):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.navigateCalendarTo=async function(n,t,a){const o=await getCalendar(n);o?o.navigate(t,a):showErrorNotification("calendarElementNotPresent")},this.cronapi.chat={},this.cronapi.chat.chatUserObj=function(n,t,a){return{id:n,name:t,iconUrl:a}},this.cronapi.chat.chatAttachmentObj=function(n,t,a,o,r,c){return{contentType:"heroCard",content:{title:n,subtitle:t,text:a,images:[{url:o,alt:r}],buttons:Array.isArray(c)?c:[c]}}},this.cronapi.chat.chatSuggestedActionObj=function(n,t){return{title:n,value:t}},this.cronapi.chat.getChatUser=async function(n,t,a){getChat(n).then(n=>{if(n)t(n.getUser());else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),a(n)}})},this.cronapi.chat.postChatMessage=function(n,t,a,o){getChat(n).then(n=>{if(n)n.postMessage(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.renderChatMessage=function(n,t,a,o,r){getChat(n).then(n=>{if(n)n.renderMessage({type:"text",text:t},a),o();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),r(n)}})},this.cronapi.chat.renderChatAttachments=function(n,t,a,o,r,c){getChat(n).then(n=>{if(n)n.renderAttachments({attachments:Array.isArray(a)?a:[a],attachmentLayout:o},t),r();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),c(n)}})},this.cronapi.chat.renderChatHtml=function(n,t,a,o,r,c){const s=function(n){let t=document.createElement("div");t.innerHTML=n;let a=t.getElementsByTagName("script"),o=a.length;for(;o--;)a[o].parentNode.removeChild(a[o]);return t.innerHTML},l=kendo.template(`
15
+ </div>`;let u={width:"450px",minWidth:300,maxWidth:()=>window.innerWidth-40,title:!!l&&(t||!1),closable:!1,modal:!0,content:l?a:d,buttonLayout:l?"stretched":"normal",actions:[],close:()=>setTimeout(()=>s.data("kendoDialog").destroy())};r(o),s.kendoDialog(u);const m=s.data("kendoDialog"),g=m.wrapper;g.attr("data-dialog-type",n);let h=cronapi.internal.getMaxZIndex()+1;g.css("z-index",h).css("pointer-events","all"),m.open()},this.cronapi.notification.buttonConfirmDialogAlert=function(n,t,a){return{title:t,value:function(){return a&&a(),!0},primaryValue:n}},this.cronapi.regex={},this.cronapi.regex.extractTextByRegex=function(n,t,a){if(this.cronapi.logic.isNull(n)||this.cronapi.logic.isNull(t))return[];let o=null;o=null!=a&&"-"!==a?new RegExp(t,a):new RegExp(t);let r=[],c=null,s;for(;(s=o.exec(n))&&!(null!=c&&c==s.index);){let n=[];for(i=1;i<s.length;i++)n.push(s[i]);c=s.index,r.push(n)}return r},this.cronapi.regex.validateTextWithRegex=function(n,t,a){return!(this.cronapi.logic.isNull(n)||this.cronapi.logic.isNull(t))&&(null!=a&&"-"!==a?new RegExp(t,a).test(n):new RegExp(t).test(n))},this.cronapi.calendar={},this.cronapi.calendar.getCalendarValue=async function(n){const t=await getCalendar(n);return t?t.value():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarValue=async function(n,t){const a=await getCalendar(n);a?a.value(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarMin=async function(n){const t=await getCalendar(n);return t?t.min():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarMin=async function(n,t){const a=await getCalendar(n);a?a.min(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarMax=async function(n){const t=await getCalendar(n);return t?t.max():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarMax=async function(n,t){const a=await getCalendar(n);a?a.max(t):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.getCalendarSelectDates=async function(n){const t=await getCalendar(n);return t?t.selectDates():(showErrorNotification("calendarElementNotPresent"),null)},this.cronapi.calendar.setCalendarSelectDates=async function(n,t){const a=await getCalendar(n);a?a.selectDates(Array.isArray(t)?t:[t]):showErrorNotification("calendarElementNotPresent")},this.cronapi.calendar.navigateCalendarTo=async function(n,t,a){const o=await getCalendar(n);o?o.navigate(t,a):showErrorNotification("calendarElementNotPresent")},this.cronapi.chat={},this.cronapi.chat.chatUserObj=function(n,t,a){return{id:n,name:t,iconUrl:a}},this.cronapi.chat.chatAttachmentObj=function(n,t,a,o,r,c){return{contentType:"heroCard",content:{title:n,subtitle:t,text:a,images:[{url:o,alt:r}],buttons:Array.isArray(c)?c:[c]}}},this.cronapi.chat.chatSuggestedActionObj=function(n,t){return{title:n,value:t}},this.cronapi.chat.getChatUser=async function(n,t,a){getChat(n).then(n=>{if(n)t(n.getUser());else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),a(n)}})},this.cronapi.chat.postChatMessage=function(n,t,a,o){getChat(n).then(n=>{if(n)n.postMessage(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.renderChatMessage=function(n,t,a,o,r){getChat(n).then(n=>{if(n)n.renderMessage({type:"text",text:t},a),o();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),r(n)}})},this.cronapi.chat.renderChatAttachments=function(n,t,a,o,r,c){getChat(n).then(n=>{if(n)n.renderAttachments({attachments:Array.isArray(a)?a:[a],attachmentLayout:o},t),r();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),c(n)}})},this.cronapi.chat.renderChatHtml=function(n,t,a,o,r,c){const s=function(n){let t=document.createElement("div");t.innerHTML=n;let a=t.getElementsByTagName("script"),o=a.length;for(;o--;)a[o].parentNode.removeChild(a[o]);return t.innerHTML},l=kendo.template(`
16
16
  <div class="#=styles.card# #=styles.cardRich#">
17
17
  <div class="#=styles.cardBody#">
18
18
  <div>
19
19
  #=text#
20
20
  </div>
21
21
  </div>
22
- </div>`);kendo.chat.Templates.kendoChatHtmlTemplate||kendo.chat.registerTemplate("kendoChatHtmlTemplate",l);let p=[];if(Array.isArray(a))for(let n in a){let t={contentType:"kendoChatHtmlTemplate",content:{text:s(a[n])}};p.push(t)}else{let n={contentType:"kendoChatHtmlTemplate",content:{text:s(a)}};p.push(n)}getChat(n).then(n=>{if(n)n.renderAttachments({attachments:p,attachmentLayout:o},t),r();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),c(n)}})},this.cronapi.chat.renderChatSuggestedActions=function(n,t,a,o){getChat(n).then(n=>{if(n)n.renderSuggestedActions(Array.isArray(t)?t:[t]),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.renderChatUserTypingIndicator=function(n,t,a,o){getChat(n).then(n=>{if(n)n.renderUserTypingIndicator(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.clearChatUserTypingIndicator=function(n,t,a,o){getChat(n).then(n=>{if(n)n.clearUserTypingIndicator(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.removeChatTypingIndicator=function(n,t,a){getChat(n).then(n=>{if(n)n.removeTypingIndicator(),t();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),a(n)}})},this.cronapi.util.setCookie=function(n,t,a,o){function r(n){return"seconds"===n?l=1e3:"minutes"===n?l=6e4:"hours"===n?l=36e5:"days"==n&&(l=864e5),l}let c=new Date,s=new Date,l=0;const p=86400000;this.cronapi.logic.isNullOrEmpty(o)||0==o?s.setTime(c.getTime()+86400000):s.setTime(c.getTime()+parseInt(o*r(a))),document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(t)+"; expires="+s.toGMTString()},this.cronapi.util.getCookie=function(n){function t(){return document.cookie.split("; ")}function a(n,t){return n.find(n=>n.startsWith(t+"="))}function o(n){return"undefined"==typeof n?null:n.split("=").pop()}const r=t(),c=a(r,n);return o(c)},this.cronapi.util.checkSavedCookies=function(n){var t=document.cookie.split(";");return t.forEach(function(n){let[a,o]=n.split("=");t[a.trim()]=o}),t.cookieEssencial},this.cronapi.authentication={},this.cronapi.authentication.login=function(n,t,a){this.cronapi.social.login(n,t,a)},this.cronapi.authentication.changePassword=function(){let n,t,a;this.cronapi.screen.getValueOfField("vars.newPassword")===this.cronapi.screen.getValueOfField("vars.confirmationPassword")?(a=this.cronapi.screen.getValueOfField("vars.oldPassword"),n=this.cronapi.screen.getValueOfField("vars.newPassword"),t=this.cronapi.screen.getValueOfField("vars.confirmationPassword"),this.cronapi.screen.showLoading(),this.cronapi.logic.isNullOrEmpty(this.cronapi.screen.getHostapp())?(this.cronapi.screen.hide(),this.cronapi.screen.notify("error","HostApp is Required")):this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.screen.getHostapp()+""+"changePassword",this.cronapi.object.createObjectFromString(["{ \"oldPassword\": \"",a,"\" , \"newPassword\": \"",n,"\" , \"newPasswordConfirmation\": \"",t,"\" } "].join("")),this.cronapi.object.createObjectFromString(["{ \"X-AUTH-TOKEN\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),async n=>{this.cronapi.screen.hide(),this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.passwordChanged",[]));try{await this.cronapi.client("blockly.js.blockly.auth.ChangePassword.closeModal").run()}catch(n){this.cronapi.screen.hideIonicModal("changePassword")}finally{this.cronapi.screen.changeValueOfField("vars.oldPassword",""),this.cronapi.screen.changeValueOfField("vars.newPassword",""),this.cronapi.screen.changeValueOfField("vars.confirmationPassword","")}},n=>{"403"==this.cronapi.object.getProperty(n,"status")||"401"==this.cronapi.object.getProperty(n,"status")?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("Login.view.invalidPassword",[])):this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message")),this.cronapi.screen.hide()})):this.cronapi.screen.notify("error",this.cronapi.i18n.translate("Login.view.invalidPassword",[]))},this.cronapi.authentication.signup=async function(n,t,a,o){let r,c,s,l;(await this.blockly.js.blockly.UserControl.isValidSignup(n,t,a,o))&&this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:signUp",async n=>{r=n,c=this.cronapi.json.createObjectFromString(r),s=this.cronapi.json.getProperty(c,"code"),l=this.cronapi.json.getProperty(c,"message"),"201"==s?(window.cordova&&window.ionic?this.cronapi.screen.changeView("#/app/login",[]):this.cronapi.screen.changeView("#/login",[]),this.cronapi.screen.notify("success",this.cronapi.i18n.translate("UserSuccessfullyRegistered",[]))):this.cronapi.logic.isNullOrEmpty(l)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("General.ErrorNotSpecified",[])):this.cronapi.screen.notify("warning",l)},n,t,a)},this.cronapi.authentication.mutualSignup=async function(){let n;this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.util.getBaseUrl()+""+"/mutual/register",this.cronapi.object.createObjectFromString(["{ \"token\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),null,async t=>{n=t,this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.tokenRegistered",[]))},async t=>{n=t,this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message"))})},this.cronapi.authentication.mutualLogin=async function(){let n;this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.util.getBaseUrl()+""+"/mutual/register",this.cronapi.object.createObjectFromString(["{ \"token\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),null,async t=>{n=t,this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.tokenRegistered",[]))},async t=>{n=t,this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message"))})},this.cronapi.authentication.isValidSignup=function(n,t,a,o){let r=!0;return this.cronapi.logic.isNullOrEmpty(n)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("UsernameCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(t)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(a)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(o)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordConfirmationCanNotBeEmpty",[])),r=!1),a!==o&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordDoesNotMatch",[])),r=!1),r},this.cronapi.authentication.resetPassword=function(n){this.cronapi.logic.isNullOrEmpty(n)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])):this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:resetPassword",n=>{this.cronapi.screen.notify("success",this.cronapi.i18n.translate("ForgotPasswordSent",[])),this.cronapi.screen.hideModal("forgotPasswordModal")},n,!1)},this.cronapi.authentication.resetPasswordWithOTP=function(n){this.cronapi.logic.isNullOrEmpty(n)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])):(localStorage.removeItem("otpToken"),this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:resetPassword",n=>{localStorage.setItem("otpToken",n),this.cronapi.screen.changeView("#/app/login",[])},n,!0),this.cronapi.screen.notify("success",this.cronapi.i18n.translate("ForgotPasswordSent",[])))},this.cronapi.organizers={},this.cronapi.organizers.comment=function(){},this.cronapi.organizers.group=function(){},this.cronapi.map={},this.cronapi.map.createMap=function(n){return n},this.cronapi.map.setMapValueByKey=function(n,t,a){const o={[t]:a};n.push(o)},this.cronapi.map.setMapValueByPath=function(n,t,a){const o={},r=t.split("."),c=r.pop(),s=r.reduce((n,t)=>n[t]=n[t]||{},o);s[c]=a,n.push(o)},this.cronapi.map.getMapValueByPath=function(n,t){let a=null;return n.forEach(n=>{a=n;for(const o=t.split(".");o.length;){const n=o.shift();if(!a.hasOwnProperty(n))break;a=a[n]}}),a},this.cronapi.map.getMapValueByKey=function(n,t){let a=null;return n.forEach(n=>{n.hasOwnProperty(t)&&(a=n[t])}),a},this.cronapi.breadcrumb={},this.cronapi.breadcrumb.jsonBreadcrumb=function(n){let t=[];return n=Array.isArray(n)?n:[n],n.forEach(function(n){t.push(n)}),t},this.cronapi.breadcrumb.listBreadcrumb=function(n,t,a,o){let r={};return r.type="true"===n||!0===n?"rootitem":"item",r.text=t,r.showText=!0,r.href="javascript:void(0);",o&&(r.action=o),a?(r.icon=a,r.showIcon=!0):r.showIcon=!1,r},this.cronapi.websocket={},this.cronapi.websocket.connect=function(n,t,a,o){function r(){c.ws=new WebSocket(n),c.ws.onopen=()=>{t&&t(c.ws)},c.ws.onmessage=n=>{a&&a(n.data)},c.ws.onclose=n=>{c.__closed||(console.log("Socket is closed. Reconnect will be attempted in 1 second.",n.reason),setTimeout(()=>{r()},1e3))},c.ws.onerror=n=>{console.error("Socket encountered error: ",n.message),o&&o(n)}}let c={};return r(),c},this.cronapi.websocket.send=function(n,t){n&&!n.__closed&&n.ws.send(t)},this.cronapi.websocket.close=function(n){n&&!n.__closed&&(n.__closed=!0,n.ws.close())},this.cronapi.multimedia=this.cronapi.multimedia||{},this.cronapi.multimedia.recordAudio=async function(){let n={audio:!0};try{const t=await navigator.mediaDevices.getUserMedia(n),a=document.createElement("audio");a.srcObject=t,document.body.appendChild(a);const o=new MediaRecorder(t);return o.start(),o}catch(n){alert(n)}},this.cronapi.multimedia.pauseRecord=async function(n){"recording"===n.state?n.pause():n.resume()},this.cronapi.multimedia.stopRecord=async function(n){const t=new Promise(function(t,a){let o=[];n.ondataavailable=function(n){o.push(n.data)},n.onstop=function(){let n=new Blob(o,{type:"audio/mp3;"}),a=window.URL.createObjectURL(n);window.open(a),t(n)},n.stop()}),a=await t;return a}}cronapi.bind(window)();try{module&&(module.exports={window})}catch(n){}
22
+ </div>`);kendo.chat.Templates.kendoChatHtmlTemplate||kendo.chat.registerTemplate("kendoChatHtmlTemplate",l);let p=[];if(Array.isArray(a))for(let n in a){let t={contentType:"kendoChatHtmlTemplate",content:{text:s(a[n])}};p.push(t)}else{let n={contentType:"kendoChatHtmlTemplate",content:{text:s(a)}};p.push(n)}getChat(n).then(n=>{if(n)n.renderAttachments({attachments:p,attachmentLayout:o},t),r();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),c(n)}})},this.cronapi.chat.renderChatSuggestedActions=function(n,t,a,o){getChat(n).then(n=>{if(n)n.renderSuggestedActions(Array.isArray(t)?t:[t]),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.renderChatUserTypingIndicator=function(n,t,a,o){getChat(n).then(n=>{if(n)n.renderUserTypingIndicator(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.clearChatUserTypingIndicator=function(n,t,a,o){getChat(n).then(n=>{if(n)n.clearUserTypingIndicator(t),a();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),o(n)}})},this.cronapi.chat.removeChatTypingIndicator=function(n,t,a){getChat(n).then(n=>{if(n)n.removeTypingIndicator(),t();else{let n=this.cronapi.$translate.instant("chatElementNotPresent");this.cronapi.$scope.Notification.error(n),a(n)}})},this.cronapi.util.setCookie=function(n,t,a,o){function r(n){return"seconds"===n?l=1e3:"minutes"===n?l=6e4:"hours"===n?l=36e5:"days"==n&&(l=864e5),l}let c=new Date,s=new Date,l=0;const p=86400000;this.cronapi.logic.isNullOrEmpty(o)||0==o?s.setTime(c.getTime()+86400000):s.setTime(c.getTime()+parseInt(o*r(a))),document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(t)+"; expires="+s.toGMTString()},this.cronapi.util.getCookie=function(n){function t(){return document.cookie.split("; ")}function a(n,t){return n.find(n=>n.startsWith(t+"="))}function o(n){return"undefined"==typeof n?null:n.split("=").pop()}const r=t(),c=a(r,n);return o(c)},this.cronapi.util.checkSavedCookies=function(n){var t=document.cookie.split(";");return t.forEach(function(n){let[a,o]=n.split("=");t[a.trim()]=o}),t.cookieEssencial},this.cronapi.authentication={},this.cronapi.authentication.login=function(n,t,a){this.cronapi.social.login(n,t,a)},this.cronapi.authentication.changePassword=function(){let n,t,a;this.cronapi.screen.getValueOfField("vars.newPassword")===this.cronapi.screen.getValueOfField("vars.confirmationPassword")?(a=this.cronapi.screen.getValueOfField("vars.oldPassword"),n=this.cronapi.screen.getValueOfField("vars.newPassword"),t=this.cronapi.screen.getValueOfField("vars.confirmationPassword"),this.cronapi.screen.showLoading(),this.cronapi.logic.isNullOrEmpty(this.cronapi.screen.getHostapp())?(this.cronapi.screen.hide(),this.cronapi.screen.notify("error","HostApp is Required")):this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.screen.getHostapp()+""+"changePassword",this.cronapi.object.createObjectFromString(["{ \"oldPassword\": \"",a,"\" , \"newPassword\": \"",n,"\" , \"newPasswordConfirmation\": \"",t,"\" } "].join("")),this.cronapi.object.createObjectFromString(["{ \"X-AUTH-TOKEN\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),async n=>{this.cronapi.screen.hide(),this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.passwordChanged",[]));try{await this.cronapi.client("blockly.js.blockly.auth.ChangePassword.closeModal").run()}catch(n){this.cronapi.screen.hideIonicModal("changePassword")}finally{this.cronapi.screen.changeValueOfField("vars.oldPassword",""),this.cronapi.screen.changeValueOfField("vars.newPassword",""),this.cronapi.screen.changeValueOfField("vars.confirmationPassword","")}},n=>{"403"==this.cronapi.object.getProperty(n,"status")||"401"==this.cronapi.object.getProperty(n,"status")?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("Login.view.invalidPassword",[])):this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message")),this.cronapi.screen.hide()})):this.cronapi.screen.notify("error",this.cronapi.i18n.translate("Login.view.invalidPassword",[]))},this.cronapi.authentication.signup=async function(n,t,a,o){let r=this.cronapi.authentication.isValidSignup,c,s,l,p;const d=this?.blockly?.js?.blockly?.UserControl?.isValidSignup,u=this?.blockly?.js?.blockly?.auth?.UserControl?.isValidSignup;angular.isFunction(d)?r=d:angular.isFunction(u)&&(r=u),(await r(n,t,a,o))&&this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:signUp",async n=>{c=n,s=this.cronapi.json.createObjectFromString(c),l=this.cronapi.json.getProperty(s,"code"),p=this.cronapi.json.getProperty(s,"message"),"201"==l?(window.cordova&&window.ionic?this.cronapi.screen.changeView("#/app/login",[]):this.cronapi.screen.changeView("#/login",[]),this.cronapi.screen.notify("success",this.cronapi.i18n.translate("UserSuccessfullyRegistered",[]))):this.cronapi.logic.isNullOrEmpty(p)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("General.ErrorNotSpecified",[])):this.cronapi.screen.notify("warning",p)},n,t,a)},this.cronapi.authentication.mutualSignup=async function(){let n;this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.util.getBaseUrl()+""+"/mutual/register",this.cronapi.object.createObjectFromString(["{ \"token\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),null,async t=>{n=t,this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.tokenRegistered",[]))},async t=>{n=t,this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message"))})},this.cronapi.authentication.mutualLogin=async function(){let n;this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.util.getBaseUrl()+""+"/mutual/register",this.cronapi.object.createObjectFromString(["{ \"token\": \"",this.cronapi.util.getUserToken(),"\" } "].join("")),null,async t=>{n=t,this.cronapi.screen.notify("info",this.cronapi.i18n.translate("Home.view.tokenRegistered",[]))},async t=>{n=t,this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message"))})},this.cronapi.authentication.isValidSignup=function(n,t,a,o){let r=!0;return this.cronapi.logic.isNullOrEmpty(n)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("UsernameCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(t)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(a)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordCanNotBeEmpty",[])),r=!1),this.cronapi.logic.isNullOrEmpty(o)&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordConfirmationCanNotBeEmpty",[])),r=!1),a!==o&&(this.cronapi.screen.notify("error",this.cronapi.i18n.translate("PasswordDoesNotMatch",[])),r=!1),r},this.cronapi.authentication.resetPassword=function(n){this.cronapi.logic.isNullOrEmpty(n)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])):this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:resetPassword",n=>{this.cronapi.screen.notify("success",this.cronapi.i18n.translate("ForgotPasswordSent",[])),this.cronapi.screen.hideModal("forgotPasswordModal")},n,!1)},this.cronapi.authentication.resetPasswordWithOTP=function(n){this.cronapi.logic.isNullOrEmpty(n)?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("EmailCanNotBeEmpty",[])):(localStorage.removeItem("otpToken"),this.cronapi.util.callServerBlocklyAsynchronous("blockly.UserControl:resetPassword",n=>{localStorage.setItem("otpToken",n),this.cronapi.screen.changeView("#/app/login",[])},n,!0),this.cronapi.screen.notify("success",this.cronapi.i18n.translate("ForgotPasswordSent",[])))},this.cronapi.organizers={},this.cronapi.organizers.comment=function(){},this.cronapi.organizers.group=function(){},this.cronapi.map={},this.cronapi.map.createMap=function(n){return n},this.cronapi.map.setMapValueByKey=function(n,t,a){const o={[t]:a};n.push(o)},this.cronapi.map.setMapValueByPath=function(n,t,a){const o={},r=t.split("."),c=r.pop(),s=r.reduce((n,t)=>n[t]=n[t]||{},o);s[c]=a,n.push(o)},this.cronapi.map.getMapValueByPath=function(n,t){let a=null;return n.forEach(n=>{a=n;for(const o=t.split(".");o.length;){const n=o.shift();if(!a.hasOwnProperty(n))break;a=a[n]}}),a},this.cronapi.map.getMapValueByKey=function(n,t){let a=null;return n.forEach(n=>{n.hasOwnProperty(t)&&(a=n[t])}),a},this.cronapi.breadcrumb={},this.cronapi.breadcrumb.jsonBreadcrumb=function(n){let t=[];return n=Array.isArray(n)?n:[n],n.forEach(function(n){t.push(n)}),t},this.cronapi.breadcrumb.listBreadcrumb=function(n,t,a,o){let r={};return r.type="true"===n||!0===n?"rootitem":"item",r.text=t,r.showText=!0,r.href="javascript:void(0);",o&&(r.action=o),a?(r.icon=a,r.showIcon=!0):r.showIcon=!1,r},this.cronapi.websocket={},this.cronapi.websocket.connect=function(n,t,a,o){function r(){c.ws=new WebSocket(n),c.ws.onopen=()=>{t&&t(c.ws)},c.ws.onmessage=n=>{a&&a(n.data)},c.ws.onclose=n=>{c.__closed||(console.log("Socket is closed. Reconnect will be attempted in 1 second.",n.reason),setTimeout(()=>{r()},1e3))},c.ws.onerror=n=>{console.error("Socket encountered error: ",n.message),o&&o(n)}}let c={};return r(),c},this.cronapi.websocket.send=function(n,t){n&&!n.__closed&&n.ws.send(t)},this.cronapi.websocket.close=function(n){n&&!n.__closed&&(n.__closed=!0,n.ws.close())},this.cronapi.multimedia=this.cronapi.multimedia||{},this.cronapi.multimedia.recordAudio=async function(){let n={audio:!0};try{const t=await navigator.mediaDevices.getUserMedia(n),a=document.createElement("audio");a.srcObject=t,document.body.appendChild(a);const o=new MediaRecorder(t);return o.start(),o}catch(n){alert(n)}},this.cronapi.multimedia.pauseRecord=async function(n){"recording"===n.state?n.pause():n.resume()},this.cronapi.multimedia.stopRecord=async function(n){const t=new Promise(function(t,a){let o=[];n.ondataavailable=function(n){o.push(n.data)},n.onstop=function(){let n=new Blob(o,{type:"audio/mp3;"}),a=window.URL.createObjectURL(n);window.open(a),t(n)},n.stop()}),a=await t;return a}}cronapi.bind(window)();try{module&&(module.exports={window})}catch(n){}
23
23
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ZXing={})}(this,(function(t){"use strict";
24
24
  /*! *****************************************************************************
25
25
  Copyright (c) Microsoft Corporation. All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapi-js",
3
- "version": "2.9.2-SP.27",
3
+ "version": "2.9.2-SP.29",
4
4
  "description": "Public library for CronApp's users",
5
5
  "main": "cronapi.js",
6
6
  "scripts": {