cronapi-js 3.2.1-SP.2 → 3.2.1-SP.20
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 +7 -2
- package/dist/cronapi.min.js +1 -1
- package/package.json +1 -1
package/cronapi.js
CHANGED
|
@@ -7777,8 +7777,13 @@ function cronapi() {
|
|
|
7777
7777
|
let responseSignUp, json, httpCodeStatus, httpMessageStatus;
|
|
7778
7778
|
let isValidSignup = this.cronapi.authentication.isValidSignup;
|
|
7779
7779
|
// Client isValidSignup blockly location is different on WEB and MOBILE projects and may not exist.
|
|
7780
|
-
|
|
7781
|
-
|
|
7780
|
+
var webIsValidSignup = (this && this.blockly && this.blockly.js && this.blockly.js.blockly && this.blockly.js.blockly.UserControl)
|
|
7781
|
+
? this.blockly.js.blockly.UserControl.isValidSignup
|
|
7782
|
+
: undefined;
|
|
7783
|
+
|
|
7784
|
+
var mobileIsValidSignup = (this && this.blockly && this.blockly.js && this.blockly.js.blockly && this.blockly.js.blockly.auth && this.blockly.js.blockly.auth.UserControl)
|
|
7785
|
+
? this.blockly.js.blockly.auth.UserControl.isValidSignup
|
|
7786
|
+
: undefined;
|
|
7782
7787
|
if (angular.isFunction(webIsValidSignup)) {
|
|
7783
7788
|
isValidSignup = webIsValidSignup;
|
|
7784
7789
|
} else if (angular.isFunction(mobileIsValidSignup)) {
|
package/dist/cronapi.min.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
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=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.marker=function(){},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,console.log(r),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;"});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;var d=this&&this.blockly&&this.blockly.js&&this.blockly.js.blockly&&this.blockly.js.blockly.UserControl?this.blockly.js.blockly.UserControl.isValidSignup:void 0,u=this&&this.blockly&&this.blockly.js&&this.blockly.js.blockly&&this.blockly.js.blockly.auth&&this.blockly.js.blockly.auth.UserControl?this.blockly.js.blockly.auth.UserControl.isValidSignup:void 0;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.marker=function(){},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,console.log(r),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;"});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.
|