@btsd/aitu-bridge 0.3.47 → 0.3.49

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/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).aituBridge={})}(this,function(e){function n(e){var n=function(e){return void 0===e&&(e="m:"),{current:0,next:function(){return e+ ++this.current}}}(e),o={};return{add:function(e,t){void 0===t&&(t="");var i=t+n.next();return o[i]=e,i},resolve:function(e,n,t,i){var r=o[e];r&&(t(i)?r.resolve(n):r.reject(i),o[e]=null)}}}function o(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function t(e,t,i){var r=n(t+":");return o(i,r),function(){var n=arguments;return new Promise(function(o,t){var i=r.add({resolve:o,reject:t});e.apply(void 0,[i].concat([].slice.call(n)))})}}var i=new URLSearchParams(window.location.search).get("__aitu-domain");i?localStorage.setItem("mini-app-domain",i):i=localStorage.getItem("mini-app-domain");var r=null;i&&(r={origin:i,execute:function(e,n){window.top.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},r.origin)}},window.addEventListener("message",function(e){if(e.origin===i&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&window.onAituBridgeHeaderMenuItemClick(n.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var a,s,c=r;!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(a||(a={})),(s=e.HeaderMenuIcon||(e.HeaderMenuIcon={})).Search="Search",s.ShoppingCart="ShoppingCart",s.Menu="Menu",s.Share="Share",s.Notifications="Notifications",s.Help="Help",s.Error="Error",s.Person="Person",s.Sort="Sort",s.Filter="Filter",s.Close="Close";var d="undefined"!=typeof window&&window.AndroidBridge,l="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,u="undefined"!=typeof window&&window.top!==window&&c,p=function(){var e=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",function(n){[].concat(e).map(function(e){return e.call(null,n)})});var i,r=function(n){e.push(n)},s=(o(r,i=n("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,t){!function(e,n,o){void 0===o&&(o={});var t=l&&l.invoke;d&&d.invoke?d.invoke(e,n,JSON.stringify(o)):t?l.invoke.postMessage({reqId:e,method:n,data:o}):u?u.execute("invoke",e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(i.add({resolve:o,reject:t},e+":"),e,n)})}),c=function(e,t){var i=n("storage:");return o(t,i),{setItem:function(n,o){return new Promise(function(t,r){var a=i.add({resolve:t,reject:r});e(a,"setItem",{keyName:n,keyValue:o})})},getItem:function(n){return new Promise(function(o,t){var r=i.add({resolve:o,reject:t});e(r,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,o){var t=i.add({resolve:n,reject:o});e(t,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=l&&l.storage;d&&d.storage?d.storage(e,n,JSON.stringify(o)):t?l.storage.postMessage({reqId:e,method:n,data:o}):u?u.execute("storage",e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},r),p=t(function(e){var n=l&&l.getGeo;d&&d.getGeo?d.getGeo(e):n?l.getGeo.postMessage({reqId:e}):u?u.execute("getGeo",e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},"getGeo",r),w=t(function(e){var n=l&&l.getQr;d&&d.getQr?d.getQr(e):n?l.getQr.postMessage({reqId:e}):u?u.execute("getQr",e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},"getQr",r),f=t(function(e){var n=l&&l.getSMSCode;d&&d.getSMSCode?d.getSMSCode(e):n?l.getSMSCode.postMessage({reqId:e}):u?u.execute("getSMSCode",e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},"getSMSCode",r),g=t(function(e){var n=l&&l.selectContact;d&&d.selectContact?d.selectContact(e):n?l.selectContact.postMessage({reqId:e}):u?u.execute("selectContact",e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},"selectContact",r),k=t(function(e){var n=l&&l.openSettings;d&&d.openSettings?d.openSettings(e):n?l.openSettings.postMessage({reqId:e}):u?u.execute("openSettings",e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},"openSettings",r),m=t(function(e){var n=l&&l.closeApplication;d&&d.closeApplication?d.closeApplication(e):n?l.closeApplication.postMessage({reqId:e}):u?u.execute("closeApplication",e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},"closeApplication",r),v=t(function(e,n){var o=l&&l.share;d&&d.share?d.share(e,n):o?l.share.postMessage({reqId:e,text:n}):u?u.execute("share",e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},"share",r),C=t(function(e,n){var o=l&&l.setTitle;d&&d.setTitle?d.setTitle(e,n):o?l.setTitle.postMessage({reqId:e,text:n}):u?u.execute("setTitle",e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},"setTitle",r),b=t(function(e,n){var o=l&&l.copyToClipboard;d&&d.copyToClipboard?d.copyToClipboard(e,n):o?l.copyToClipboard.postMessage({reqId:e,text:n}):u?u.execute("copyToClipboard",e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},"copyToClipboard",r),M=t(function(e,n,o){var t=d&&d.shareFile,i=l&&l.shareFile,r="image."+o.split(";")[0].split("/")[1],a=o.substr(o.indexOf(",")+1);t?d.shareFile(e,n,r,a):i?l.shareFile.postMessage({reqId:e,text:n,filename:r,base64Data:a}):u?u.execute("shareFile",e,{text:n,filename:r,base64Data:a}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",r),S=t(function(e,n,o,t){var i=l&&l.shareFile;d&&d.shareFile?d.shareFile(e,n,o,t):i?l.shareFile.postMessage({reqId:e,text:n,filename:o,base64Data:t}):u?u.execute("shareFile",e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareFile",r),y=t(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=l&&l.vibrate;d&&d.vibrate?d.vibrate(e,JSON.stringify(n)):o?l.vibrate.postMessage({reqId:e,pattern:n}):u?u.execute("vibrate",e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},"vibrate",r),h=t(function(e){var n=l&&l.enableScreenCapture;d&&d.enableScreenCapture?d.enableScreenCapture(e):n?l.enableScreenCapture.postMessage({reqId:e}):u?u.execute("enableScreenCapture",e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},"enableScreenCapture",r),B=t(function(e){var n=l&&l.disableScreenCapture;d&&d.disableScreenCapture?d.disableScreenCapture(e):n?l.disableScreenCapture.postMessage({reqId:e}):u?u.execute("disableScreenCapture",e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},"disableScreenCapture",r),I=t(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=d&&d.setHeaderMenuItems,t=l&&l.setHeaderMenuItems,i=JSON.stringify(n);o?d.setHeaderMenuItems(e,i):t?l.setHeaderMenuItems.postMessage({reqId:e,itemsJsonArray:i}):u?u.execute("setHeaderMenuItems",e,i):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},"setHeaderMenuItems",r),A=t(function(e,n){var o=l&&l.setCustomBackArrowMode;d&&d.setCustomBackArrowMode?d.setCustomBackArrowMode(e,n):o?l.setCustomBackArrowMode.postMessage({reqId:e,enabled:n}):u?u.execute("setCustomBackArrowMode",e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},"setCustomBackArrowMode",r),x=t(function(e){var n=l&&l.getCustomBackArrowMode;d&&d.getCustomBackArrowMode?d.getCustomBackArrowMode(e):n?l.getCustomBackArrowMode.postMessage({reqId:e}):u?u.execute("getCustomBackArrowMode",e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},"getCustomBackArrowMode",r),U=t(function(e,n){var o=l&&l.setCustomBackArrowVisible;d&&d.setCustomBackArrowVisible?d.setCustomBackArrowVisible(e,n):o?l.setCustomBackArrowVisible.postMessage({reqId:e,visible:n}):u?u.execute("setCustomBackArrowVisible",e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},"setCustomBackArrowVisible",r),H=t(function(e,n){var o=l&&l.openPayment;d&&d.openPayment?d.openPayment(e,n):o?l.openPayment.postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},"openPayment",r),P=t(function(e){var n=l&&l.checkBiometry;d&&d.checkBiometry?d.checkBiometry(e):n?l.checkBiometry.postMessage({reqId:e}):u?u.execute("checkBiometry",e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},"checkBiometry",r),q=t(function(e,n){var o=l&&l.openExternalUrl;d&&d.openExternalUrl?d.openExternalUrl(e,n):o?l.openExternalUrl.postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},"openExternalUrl",r),T=t(function(e){var n=l&&l.enableSwipeBack;d&&d.enableSwipeBack?d.enableSwipeBack(e):n?l.enableSwipeBack.postMessage({reqId:e}):u?u.execute("enableSwipeBack",e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},"enableSwipeBack",r),E=t(function(e){var n=l&&l.disableSwipeBack;d&&d.disableSwipeBack?d.disableSwipeBack(e):n?l.disableSwipeBack.postMessage({reqId:e}):u?u.execute("disableSwipeBack",e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},"disableSwipeBack",r);return{version:String("0.3.47"),copyToClipboard:b,invoke:s,storage:c,getMe:function(){return s(a.getMe)},getPhone:function(){return s(a.getPhone)},getContacts:function(){return s(a.getContacts)},getGeo:p,getQr:w,getSMSCode:f,getUserProfile:function(e){return s(a.getUserProfile,{id:e})},selectContact:g,enableNotifications:function(){return s(a.enableNotifications)},disableNotifications:function(){return s(a.disableNotifications)},enablePrivateMessaging:function(e){return s(a.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return s(a.disablePrivateMessaging,{appId:e})},openSettings:k,closeApplication:m,setTitle:C,share:v,shareImage:M,shareFile:S,setShakeHandler:function(e){d&&d.setShakeHandler||l&&l.setShakeHandler||u?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){d&&d.setTabActiveHandler||l&&l.setTabActiveHandler||u?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:y,isSupported:function(){var e=l&&window.webkit.messageHandlers.invoke;return Boolean(d||e||u)},supports:function(e){return d&&"function"==typeof d[e]||l&&l[e]&&"function"==typeof l[e].postMessage||u&&"function"==typeof u[e]},sub:r,enableScreenCapture:h,disableScreenCapture:B,setHeaderMenuItems:I,setHeaderMenuItemClickHandler:function(e){d&&d.setHeaderMenuItemClickHandler||l&&l.setHeaderMenuItemClickHandler||u?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:A,getCustomBackArrowMode:x,setCustomBackArrowVisible:U,openPayment:H,setCustomBackArrowOnClickHandler:function(e){d&&d.setCustomBackArrowOnClickHandler||l&&l.setCustomBackArrowOnClickHandler||u?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:P,openExternalUrl:q,enableSwipeBack:T,disableSwipeBack:E}}();e.default=p});
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).aituBridge={})}(this,function(e){function n(e){var n=function(e){return void 0===e&&(e="m:"),{current:0,next:function(){return e+ ++this.current}}}(e),o={};return{add:function(e,t){void 0===t&&(t="");var i=t+n.next();return o[i]=e,i},resolve:function(e,n,t,i){var a=o[e];a&&(t(i)?a.resolve(n):a.reject(i),o[e]=null)}}}function o(e,n){e(function(e){if(e.detail&&"reqId"in e.detail){var o=e.detail,t=o.reqId;t&&n.resolve(t,o.data,function(e){return!e},o.error)}})}function t(e,t,i){var a=n(t+":");return o(i,a),function(){var n=arguments;return new Promise(function(o,t){var i=a.add({resolve:o,reject:t});e.apply(void 0,[i].concat([].slice.call(n)))})}}var i=new URLSearchParams(window.location.search).get("__aitu-domain");i?localStorage.setItem("mini-app-domain",i):i=localStorage.getItem("mini-app-domain");var a=null;i&&(a={origin:i,execute:function(e,n){window.top.postMessage({source:"aitu-bridge",method:e,reqId:n,payload:[].concat([].slice.call(arguments,2))},a.origin)}},window.addEventListener("message",function(e){if(e.origin===i&&e.data){if(window.dispatchEvent(new CustomEvent("aituEvents",{detail:e.data})),"string"!=typeof e.data||""===e.data)return;try{var n=JSON.parse(e.data);n&&n.method&&("setCustomBackArrowOnClickHandler"===n.method?window.onAituBridgeBackArrowClick():"setHeaderMenuItemClickHandler"===n.method&&window.onAituBridgeHeaderMenuItemClick(n.param))}catch(e){console.log("Error parsing message data: "+e)}}}));var r,s,c,d=a;!function(e){e.getMe="GetMe",e.getPhone="GetPhone",e.getContacts="GetContacts",e.getUserProfile="GetUserProfile",e.enableNotifications="AllowNotifications",e.disableNotifications="DisableNotifications",e.enablePrivateMessaging="EnablePrivateMessaging",e.disablePrivateMessaging="DisablePrivateMessaging"}(r||(r={})),(s=e.HeaderMenuIcon||(e.HeaderMenuIcon={})).Search="Search",s.ShoppingCart="ShoppingCart",s.Menu="Menu",s.Share="Share",s.Notifications="Notifications",s.Help="Help",s.Error="Error",s.Person="Person",s.Sort="Sort",s.Filter="Filter",s.Close="Close",function(e){e.SystemBackArrow="SystemBackArrow",e.CustomBackArrow="CustomBackArrow",e.NoItem="NoItem",e.UserProfile="UserProfile"}(c||(c={}));var l="undefined"!=typeof window&&window.AndroidBridge,u="undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers,g="undefined"!=typeof window&&window.top!==window&&d,w=function(){var e=[];"undefined"!=typeof window&&window.addEventListener("aituEvents",function(n){[].concat(e).map(function(e){return e.call(null,n)})});var i,a=function(n){e.push(n)},s=(o(a,i=n("invoke:")),function(e,n){return void 0===n&&(n={}),new Promise(function(o,t){!function(e,n,o){void 0===o&&(o={});var t=u&&u.invoke;l&&l.invoke?l.invoke(e,n,JSON.stringify(o)):t?u.invoke.postMessage({reqId:e,method:n,data:o}):g?g.execute("invoke",e,n,o):"undefined"!=typeof window&&console.log("--invoke-isUnknown")}(i.add({resolve:o,reject:t},e+":"),e,n)})}),c=function(e,t){var i=n("storage:");return o(t,i),{setItem:function(n,o){return new Promise(function(t,a){var r=i.add({resolve:t,reject:a});e(r,"setItem",{keyName:n,keyValue:o})})},getItem:function(n){return new Promise(function(o,t){var a=i.add({resolve:o,reject:t});e(a,"getItem",{keyName:n})})},clear:function(){return new Promise(function(n,o){var t=i.add({resolve:n,reject:o});e(t,"clear",{})})}}}(function(e,n,o){void 0===o&&(o={});var t=u&&u.storage;l&&l.storage?l.storage(e,n,JSON.stringify(o)):t?u.storage.postMessage({reqId:e,method:n,data:o}):g?g.execute("storage",e,n,o):"undefined"!=typeof window&&console.log("--storage-isUnknown")},a),d=t(function(e){var n=u&&u.getGeo;l&&l.getGeo?l.getGeo(e):n?u.getGeo.postMessage({reqId:e}):g?g.execute("getGeo",e):"undefined"!=typeof window&&console.log("--getGeo-isUnknown")},"getGeo",a),w=t(function(e){var n=u&&u.getQr;l&&l.getQr?l.getQr(e):n?u.getQr.postMessage({reqId:e}):g?g.execute("getQr",e):"undefined"!=typeof window&&console.log("--getQr-isUnknown")},"getQr",a),p=t(function(e){var n=u&&u.getSMSCode;l&&l.getSMSCode?l.getSMSCode(e):n?u.getSMSCode.postMessage({reqId:e}):g?g.execute("getSMSCode",e):"undefined"!=typeof window&&console.log("--getSMSCode-isUnknown")},"getSMSCode",a),f=t(function(e){var n=u&&u.selectContact;l&&l.selectContact?l.selectContact(e):n?u.selectContact.postMessage({reqId:e}):g?g.execute("selectContact",e):"undefined"!=typeof window&&console.log("--selectContact-isUnknown")},"selectContact",a),m=t(function(e){var n=u&&u.openSettings;l&&l.openSettings?l.openSettings(e):n?u.openSettings.postMessage({reqId:e}):g?g.execute("openSettings",e):"undefined"!=typeof window&&console.log("--openSettings-isUnknown")},"openSettings",a),k=t(function(e){var n=u&&u.closeApplication;l&&l.closeApplication?l.closeApplication(e):n?u.closeApplication.postMessage({reqId:e}):g?g.execute("closeApplication",e):"undefined"!=typeof window&&console.log("--closeApplication-isUnknown")},"closeApplication",a),v=t(function(e,n){var o=u&&u.share;l&&l.share?l.share(e,n):o?u.share.postMessage({reqId:e,text:n}):g?g.execute("share",e,n):"undefined"!=typeof window&&console.log("--share-isUnknown")},"share",a),M=t(function(e,n){var o=u&&u.setTitle;l&&l.setTitle?l.setTitle(e,n):o?u.setTitle.postMessage({reqId:e,text:n}):g?g.execute("setTitle",e,n):"undefined"!=typeof window&&console.log("--setTitle-isUnknown")},"setTitle",a),C=t(function(e,n){var o=u&&u.copyToClipboard;l&&l.copyToClipboard?l.copyToClipboard(e,n):o?u.copyToClipboard.postMessage({reqId:e,text:n}):g?g.execute("copyToClipboard",e,n):"undefined"!=typeof window&&console.log("--copyToClipboard-isUnknown")},"copyToClipboard",a),b=t(function(e,n,o){var t=l&&l.shareFile,i=u&&u.shareFile,a="image."+o.split(";")[0].split("/")[1],r=o.substr(o.indexOf(",")+1);t?l.shareFile(e,n,a,r):i?u.shareFile.postMessage({reqId:e,text:n,filename:a,base64Data:r}):g?g.execute("shareFile",e,{text:n,filename:a,base64Data:r}):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareImage",a),S=t(function(e,n,o,t){var i=u&&u.shareFile;l&&l.shareFile?l.shareFile(e,n,o,t):i?u.shareFile.postMessage({reqId:e,text:n,filename:o,base64Data:t}):g?g.execute("shareFile",e,n,o,t):"undefined"!=typeof window&&console.log("--shareFile-isUnknown")},"shareFile",a),y=t(function(e,n){if(!Array.isArray(n)||n.some(function(e){return e<1||e!==Math.floor(e)})||n.reduce(function(e,n){return e+n})>1e4)console.error("Pattern should be an array of positive integers no longer than 10000ms total");else{var o=u&&u.vibrate;l&&l.vibrate?l.vibrate(e,JSON.stringify(n)):o?u.vibrate.postMessage({reqId:e,pattern:n}):g?g.execute("vibrate",e,n):"undefined"!=typeof window&&console.log("--vibrate-isUnknown")}},"vibrate",a),I=t(function(e){var n=u&&u.enableScreenCapture;l&&l.enableScreenCapture?l.enableScreenCapture(e):n?u.enableScreenCapture.postMessage({reqId:e}):g?g.execute("enableScreenCapture",e):"undefined"!=typeof window&&console.log("--enableScreenCapture-isUnknown")},"enableScreenCapture",a),B=t(function(e){var n=u&&u.disableScreenCapture;l&&l.disableScreenCapture?l.disableScreenCapture(e):n?u.disableScreenCapture.postMessage({reqId:e}):g?g.execute("disableScreenCapture",e):"undefined"!=typeof window&&console.log("--disableScreenCapture-isUnknown")},"disableScreenCapture",a),h=t(function(e,n){if(n.length>3)console.error("SetHeaderMenuItems: items count should not be more than 3");else{var o=l&&l.setHeaderMenuItems,t=u&&u.setHeaderMenuItems,i=JSON.stringify(n);o?l.setHeaderMenuItems(e,i):t?u.setHeaderMenuItems.postMessage({reqId:e,itemsJsonArray:i}):g?g.execute("setHeaderMenuItems",e,i):"undefined"!=typeof window&&console.log("--setHeaderMenuItems-isUnknown")}},"setHeaderMenuItems",a),A=t(function(e,n){var o=u&&u.setCustomBackArrowMode;l&&l.setCustomBackArrowMode?l.setCustomBackArrowMode(e,n):o?u.setCustomBackArrowMode.postMessage({reqId:e,enabled:n}):g?g.execute("setCustomBackArrowMode",e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowMode-isUnknown")},"setCustomBackArrowMode",a),x=t(function(e){var n=u&&u.getCustomBackArrowMode;l&&l.getCustomBackArrowMode?l.getCustomBackArrowMode(e):n?u.getCustomBackArrowMode.postMessage({reqId:e}):g?g.execute("getCustomBackArrowMode",e):"undefined"!=typeof window&&console.log("--getCustomBackArrowMode-isUnknown")},"getCustomBackArrowMode",a),U=t(function(e,n){var o=u&&u.setCustomBackArrowVisible;l&&l.setCustomBackArrowVisible?l.setCustomBackArrowVisible(e,n):o?u.setCustomBackArrowVisible.postMessage({reqId:e,visible:n}):g?g.execute("setCustomBackArrowVisible",e,n):"undefined"!=typeof window&&console.log("--setCustomBackArrowVisible-isUnknown")},"setCustomBackArrowVisible",a),H=t(function(e,n){var o=u&&u.openPayment;l&&l.openPayment?l.openPayment(e,n):o?u.openPayment.postMessage({reqId:e,transactionId:n}):console.log("--openPayment-isUnknown")},"openPayment",a),N=t(function(e){var n=u&&u.checkBiometry;l&&l.checkBiometry?l.checkBiometry(e):n?u.checkBiometry.postMessage({reqId:e}):g?g.execute("checkBiometry",e):"undefined"!=typeof window&&console.log("--checkBiometry-isUnknown")},"checkBiometry",a),P=t(function(e,n){var o=u&&u.openExternalUrl;l&&l.openExternalUrl?l.openExternalUrl(e,n):o?u.openExternalUrl.postMessage({reqId:e,url:n}):console.log("--openExternalUrlMethod-isUnknown")},"openExternalUrl",a),q=t(function(e){var n=u&&u.enableSwipeBack;l&&l.enableSwipeBack?l.enableSwipeBack(e):n?u.enableSwipeBack.postMessage({reqId:e}):g?g.execute("enableSwipeBack",e):"undefined"!=typeof window&&console.log("--enableSwipeBack-isUnknown")},"enableSwipeBack",a),T=t(function(e){var n=u&&u.disableSwipeBack;l&&l.disableSwipeBack?l.disableSwipeBack(e):n?u.disableSwipeBack.postMessage({reqId:e}):g?g.execute("disableSwipeBack",e):"undefined"!=typeof window&&console.log("--disableSwipeBack-isUnknown")},"disableSwipeBack",a),E=t(function(e,n){var o=u&&u.setNavigationItemMode;l&&l.setNavigationItemMode?l.setNavigationItemMode(e,n):o?u.setNavigationItemMode.postMessage({reqId:e,mode:n}):g?g.execute("setNavigationItemMode",e,n):"undefined"!=typeof window&&console.log("--setNavigationItemMode-isUnknown")},"setNavigationItemMode",a),F=t(function(e){var n=u&&u.getNavigationItemMode;l&&l.getNavigationItemMode?l.getNavigationItemMode(e):n?u.getNavigationItemMode.postMessage({reqId:e}):g?g.execute("getNavigationItemMode",e):"undefined"!=typeof window&&console.log("--getNavigationItemMode-isUnknown")},"getNavigationItemMode",a);return{version:String("0.3.49"),copyToClipboard:C,invoke:s,storage:c,getMe:function(){return s(r.getMe)},getPhone:function(){return s(r.getPhone)},getContacts:function(){return s(r.getContacts)},getGeo:d,getQr:w,getSMSCode:p,getUserProfile:function(e){return s(r.getUserProfile,{id:e})},selectContact:f,enableNotifications:function(){return s(r.enableNotifications)},disableNotifications:function(){return s(r.disableNotifications)},enablePrivateMessaging:function(e){return s(r.enablePrivateMessaging,{appId:e})},disablePrivateMessaging:function(e){return s(r.disablePrivateMessaging,{appId:e})},openSettings:m,closeApplication:k,setTitle:M,share:v,shareImage:b,shareFile:S,setShakeHandler:function(e){l&&l.setShakeHandler||u&&u.setShakeHandler||g?window.onAituBridgeShake=e:"undefined"!=typeof window&&console.log("--setShakeHandler-isUnknown")},setTabActiveHandler:function(e){l&&l.setTabActiveHandler||u&&u.setTabActiveHandler||g?window.onAituBridgeTabActive=e:"undefined"!=typeof window&&console.log("--setTabActiveHandler-isUnknown")},vibrate:y,isSupported:function(){var e=u&&window.webkit.messageHandlers.invoke;return Boolean(l||e||g)},supports:function(e){return l&&"function"==typeof l[e]||u&&u[e]&&"function"==typeof u[e].postMessage||g&&"function"==typeof g[e]},sub:a,enableScreenCapture:I,disableScreenCapture:B,setHeaderMenuItems:h,setHeaderMenuItemClickHandler:function(e){l&&l.setHeaderMenuItemClickHandler||u&&u.setHeaderMenuItemClickHandler||g?window.onAituBridgeHeaderMenuItemClick=e:"undefined"!=typeof window&&console.log("--setHeaderMenuItemClickHandler-isUnknown")},setCustomBackArrowMode:A,getCustomBackArrowMode:x,setCustomBackArrowVisible:U,openPayment:H,setCustomBackArrowOnClickHandler:function(e){l&&l.setCustomBackArrowOnClickHandler||u&&u.setCustomBackArrowOnClickHandler||g?window.onAituBridgeBackArrowClick=e:"undefined"!=typeof window&&console.log("--setCustomBackArrowOnClickHandler-isUnknown")},checkBiometry:N,openExternalUrl:P,enableSwipeBack:q,disableSwipeBack:T,setNavigationItemMode:E,getNavigationItemMode:F}}();e.default=w});
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/utils.ts","../src/webBridge.ts","../src/index.ts","../src/version.ts"],"sourcesContent":["function createCounter(prefix = 'm:') {\n return {\n current: 0,\n next() {\n return prefix + ++this.current;\n },\n };\n}\n\nfunction createRequestResolver(prefix: string) {\n type PromiseController = {\n resolve: (value: any) => any;\n reject: (reason: any) => any;\n };\n\n const counter = createCounter(prefix);\n const promiseControllers: Record<string, PromiseController | null> = {};\n\n return {\n add(controller: PromiseController, customId = ''): number | string {\n const id = customId + counter.next()\n promiseControllers[id] = controller;\n return id;\n },\n\n resolve<T>(reqId: number | string, data: T, isSuccess: (data: T) => boolean, error: any) {\n const requestPromise = promiseControllers[reqId];\n\n if (requestPromise) {\n if (isSuccess(error)) {\n requestPromise.resolve(data);\n } else {\n requestPromise.reject(error);\n }\n\n promiseControllers[reqId] = null;\n }\n },\n };\n}\n\nfunction handleSubscribe(subscribe: (handler: (event: any) => void) => void, requestResolver: ReturnType<typeof createRequestResolver>) {\n subscribe(event => {\n if (!event.detail) {\n return;\n }\n\n if ('reqId' in event.detail) {\n const { reqId, data, error } = event.detail;\n\n if (reqId) {\n requestResolver.resolve(reqId, data, (error) => !(error), error);\n }\n }\n })\n}\n\nexport function promisifyStorage(storage, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('storage:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return {\n setItem: (keyName: string, keyValue: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'setItem', { keyName, keyValue });\n });\n },\n getItem: (keyName: string): Promise<string | null> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'getItem', { keyName });\n });\n },\n clear: (): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'clear', {});\n });\n },\n }\n}\n\nexport function promisifyInvoke(invoke, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('invoke:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(invokeMethodName: string, props: any = {}): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject }, invokeMethodName + ':');\n\n invoke(reqId, invokeMethodName, props);\n });\n };\n}\n\nexport function promisifyMethod(method: Function, methodName: string, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver(methodName + ':');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(...args: any[]): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n method(reqId, ...args);\n });\n };\n}\n\n\n\n","import type { AituBridge } from './index';\n\nconst AITU_DOMAIN_PARAM = '__aitu-domain'\n\nconst searchParams = new URLSearchParams(window.location.search)\n\nlet aituOrigin = searchParams.get(AITU_DOMAIN_PARAM)\n\nif(aituOrigin){\n localStorage.setItem('mini-app-domain', aituOrigin)\n}else{\n aituOrigin = localStorage.getItem('mini-app-domain')\n}\ninterface WebBridge {\n execute(method: keyof AituBridge, reqId: string, ...payload: any[] ): void\n origin: string\n}\n\nlet WebBridge: WebBridge | null = null\n\nif (aituOrigin) {\n WebBridge = {\n origin: aituOrigin,\n execute: (method, reqId, ...payload) => {\n window.top.postMessage({\n source: 'aitu-bridge',\n method,\n reqId,\n payload: [...payload],\n },\n WebBridge.origin\n )\n }\n\n }\n window.addEventListener('message', event => {\n if (event.origin === aituOrigin && event.data) {\n\n // dispatch aitu events\n window.dispatchEvent(new CustomEvent('aituEvents', { detail: event.data }));\n\n // try to detect handler call\n if (typeof event.data !== 'string' || event.data === '') {\n return;\n }\n\n try {\n const message = JSON.parse(event.data)\n\n if (message && message['method']) {\n if (message.method === 'setCustomBackArrowOnClickHandler') {\n (window as any).onAituBridgeBackArrowClick()\n } else if (message.method === 'setHeaderMenuItemClickHandler') {\n (window as any).onAituBridgeHeaderMenuItemClick(message.param)\n }\n }\n } catch (e) {\n console.log('Error parsing message data: ' + e);\n }\n }\n })\n}\n\nexport default WebBridge\n","import { LIB_VERSION } from './version';\n\nimport {\n promisifyMethod,\n promisifyStorage,\n promisifyInvoke,\n} from './utils'\n\nimport WebBridge from './webBridge';\n\nenum EInvokeRequest {\n getMe = 'GetMe',\n getPhone = 'GetPhone',\n getContacts = 'GetContacts',\n getUserProfile = 'GetUserProfile',\n enableNotifications = 'AllowNotifications',\n disableNotifications = 'DisableNotifications',\n enablePrivateMessaging = 'EnablePrivateMessaging',\n disablePrivateMessaging = 'DisablePrivateMessaging',\n}\n\ntype SetItemType = (keyName: string, keyValue: string) => Promise<void>;\ntype GetItemType = (keyName: string) => Promise<string | null>;\ntype ClearType = () => Promise<void>;\n\ntype HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;\ntype BackArrowClickHandlerType = () => Promise<void>;\n\ninterface GetPhoneResponse {\n phone: string;\n sign: string;\n}\n\ninterface GetMeResponse {\n name: string;\n lastname: string;\n id: string;\n avatar?: string;\n avatarThumb?: string;\n notifications_allowed: boolean;\n private_messaging_enabled: boolean;\n sign: string;\n}\n\ninterface ResponseObject {\n phone?: string;\n name?: string;\n lastname?: string;\n}\n\ninterface GetGeoResponse {\n latitude: number;\n longitude: number;\n}\n\ninterface GetContactsResponse {\n contacts: Array<{\n first_name: string;\n last_name: string;\n phone: string;\n }>;\n sign: string;\n}\n\ninterface SelectContactResponse {\n phone: string;\n name: string;\n lastname: string;\n}\n\ninterface GetUserProfileResponse {\n name: string;\n lastname?: string;\n phone?: string;\n avatar?: string;\n avatarThumb?: string;\n}\n\nconst MAX_HEADER_MENU_ITEMS_COUNT = 3;\n\nexport enum HeaderMenuIcon {\n Search = \"Search\",\n ShoppingCart = \"ShoppingCart\",\n Menu = \"Menu\",\n Share = \"Share\",\n Notifications = \"Notifications\",\n Help = \"Help\",\n Error = \"Error\",\n Person = \"Person\",\n Sort = \"Sort\",\n Filter = \"Filter\",\n Close = \"Close\"\n}\n\ninterface HeaderMenuItem {\n id: string;\n icon: HeaderMenuIcon;\n badge?: string;\n}\n\ntype OpenSettingsResponse = 'success' | 'failed';\ntype ShareResponse = 'success' | 'failed';\ntype CopyToClipboardResponse = 'success' | 'failed';\ntype VibrateResponse = 'success' | 'failed';\n// todo: remove duplicates\ntype ResponseType = 'success' | 'failed';\n\ntype BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;\n\ninterface BridgeStorage {\n setItem: SetItemType,\n getItem: GetItemType,\n clear: ClearType\n}\n\nexport interface AituBridge {\n version: string;\n invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;\n storage: BridgeStorage;\n getMe: () => Promise<GetMeResponse>;\n getPhone: () => Promise<GetPhoneResponse>;\n getContacts: () => Promise<GetContactsResponse>;\n getGeo: () => Promise<GetGeoResponse>;\n selectContact: () => Promise<SelectContactResponse>;\n getQr: () => Promise<string>;\n getSMSCode: () => Promise<string>;\n getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;\n share: (text: string) => Promise<ShareResponse>;\n setTitle: (text: string) => Promise<ResponseType>;\n copyToClipboard: (text: string) => Promise<CopyToClipboardResponse>;\n shareImage: (text: string, image: string) => Promise<ShareResponse>;\n shareFile: (text: string, filename: string, base64Data: string) => Promise<ShareResponse>;\n enableNotifications: () => Promise<{}>;\n disableNotifications: () => Promise<{}>;\n enablePrivateMessaging: (appId: string) => Promise<string>;\n disablePrivateMessaging: (appId: string) => Promise<string>;\n openSettings: () => Promise<OpenSettingsResponse>;\n closeApplication: () => Promise<ResponseType>;\n setShakeHandler: (handler: any) => void;\n setTabActiveHandler: (handler: (tabname: string) => void) => void;\n vibrate: (pattern: number[]) => Promise<VibratePattern>;\n isSupported: () => boolean;\n supports: (method: string) => boolean;\n sub: any;\n enableScreenCapture: () => Promise<{}>;\n disableScreenCapture: () => Promise<{}>;\n setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<ResponseType>;\n setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;\n setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;\n getCustomBackArrowMode: () => Promise<boolean>;\n setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;\n openPayment: (transactionId: string) => Promise<ResponseType>;\n setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;\n checkBiometry: () => Promise<ResponseType>;\n openExternalUrl: (url: string) => Promise<ResponseType>;\n enableSwipeBack: () => Promise<ResponseType>;\n disableSwipeBack: () => Promise<ResponseType>;\n}\n\nconst invokeMethod = 'invoke';\nconst storageMethod = 'storage';\nconst getGeoMethod = 'getGeo';\nconst getQrMethod = 'getQr';\nconst getSMSCodeMethod = 'getSMSCode';\nconst selectContactMethod = 'selectContact';\nconst openSettingsMethod = 'openSettings';\nconst closeApplicationMethod = 'closeApplication';\nconst shareMethod = 'share';\nconst setTitleMethod = 'setTitle';\nconst copyToClipboardMethod = 'copyToClipboard';\nconst shareImageMethod = 'shareImage';\nconst shareFileMethod = 'shareFile';\nconst setShakeHandlerMethod = 'setShakeHandler';\nconst vibrateMethod = 'vibrate';\nconst enableScreenCaptureMethod = 'enableScreenCapture';\nconst disableScreenCaptureMethod = 'disableScreenCapture';\nconst setTabActiveHandlerMethod = 'setTabActiveHandler';\nconst setHeaderMenuItemsMethod = 'setHeaderMenuItems';\nconst setHeaderMenuItemClickHandlerMethod = 'setHeaderMenuItemClickHandler';\nconst setCustomBackArrowModeMethod = 'setCustomBackArrowMode';\nconst getCustomBackArrowModeMethod = 'getCustomBackArrowMode';\nconst setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';\nconst openPaymentMethod = 'openPayment'\nconst setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';\nconst checkBiometryMethod = 'checkBiometry';\nconst openExternalUrlMethod = 'openExternalUrl';\nconst enableSwipeBackMethod = 'enableSwipeBack'\nconst disableSwipeBackMethod = 'disableSwipeBack'\n\nconst android = typeof window !== 'undefined' && (window as any).AndroidBridge;\nconst ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;\nconst web = typeof window !== 'undefined' && (window.top !== window) && WebBridge;\n\nconst buildBridge = (): AituBridge => {\n const subs = [];\n\n if (typeof window !== 'undefined') {\n window.addEventListener('aituEvents', (e: any) => {\n [...subs].map((fn) => fn.call(null, e));\n })\n }\n\n const invoke = (reqId, method, data = {}) => {\n const isAndroid = android && android[invokeMethod];\n const isIos = ios && ios[invokeMethod];\n\n if (isAndroid) {\n android[invokeMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[invokeMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(invokeMethod, reqId, method, data)\n } else if (typeof window !== 'undefined') {\n console.log('--invoke-isUnknown');\n }\n };\n\n const storage = (reqId, method, data = {}) => {\n const isAndroid = android && android[storageMethod];\n const isIos = ios && ios[storageMethod];\n\n if (isAndroid) {\n android[storageMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[storageMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(storageMethod, reqId, method, data);\n } else if (typeof window !== 'undefined') {\n console.log('--storage-isUnknown');\n }\n }\n\n const getGeo = (reqId) => {\n const isAndroid = android && android[getGeoMethod];\n const isIos = ios && ios[getGeoMethod];\n\n if (isAndroid) {\n android[getGeoMethod](reqId);\n } else if (isIos) {\n ios[getGeoMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getGeoMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getGeo-isUnknown');\n }\n }\n\n const getQr = (reqId) => {\n const isAndroid = android && android[getQrMethod];\n const isIos = ios && ios[getQrMethod];\n\n if (isAndroid) {\n android[getQrMethod](reqId);\n } else if (isIos) {\n ios[getQrMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getQrMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getQr-isUnknown');\n }\n }\n\n const getSMSCode = (reqId) => {\n const isAndroid = android && android[getSMSCodeMethod];\n const isIos = ios && ios[getSMSCodeMethod];\n\n if (isAndroid) {\n android[getSMSCodeMethod](reqId);\n } else if (isIos) {\n ios[getSMSCodeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getSMSCodeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getSMSCode-isUnknown');\n }\n }\n\n const selectContact = (reqId) => {\n const isAndroid = android && android[selectContactMethod];\n const isIos = ios && ios[selectContactMethod];\n\n if (isAndroid) {\n android[selectContactMethod](reqId);\n } else if (isIos) {\n ios[selectContactMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(selectContactMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--selectContact-isUnknown');\n }\n }\n\n const openSettings = (reqId) => {\n const isAndroid = android && android[openSettingsMethod];\n const isIos = ios && ios[openSettingsMethod];\n\n if (isAndroid) {\n android[openSettingsMethod](reqId);\n } else if (isIos) {\n ios[openSettingsMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(openSettingsMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--openSettings-isUnknown');\n }\n }\n\n const closeApplication = (reqId) => {\n const isAndroid = android && android[closeApplicationMethod];\n const isIos = ios && ios[closeApplicationMethod];\n\n if (isAndroid) {\n android[closeApplicationMethod](reqId);\n } else if (isIos) {\n ios[closeApplicationMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(closeApplicationMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--closeApplication-isUnknown');\n }\n }\n\n const share = (reqId, text) => {\n const isAndroid = android && android[shareMethod];\n const isIos = ios && ios[shareMethod];\n\n if (isAndroid) {\n android[shareMethod](reqId, text);\n } else if (isIos) {\n ios[shareMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(shareMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--share-isUnknown');\n }\n }\n\n const setTitle = (reqId, text) => {\n const isAndroid = android && android[setTitleMethod];\n const isIos = ios && ios[setTitleMethod];\n\n if (isAndroid) {\n android[setTitleMethod](reqId, text);\n } else if (isIos) {\n ios[setTitleMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(setTitleMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--setTitle-isUnknown');\n }\n }\n\n const copyToClipboard = (reqId, text) => {\n const isAndroid = android && android[copyToClipboardMethod];\n const isIos = ios && ios[copyToClipboardMethod];\n\n if (isAndroid) {\n android[copyToClipboardMethod](reqId, text);\n } else if (isIos) {\n ios[copyToClipboardMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(copyToClipboardMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--copyToClipboard-isUnknown');\n }\n }\n\n const enableScreenCapture = (reqId) => {\n const isAndroid = android && android[enableScreenCaptureMethod];\n const isIos = ios && ios[enableScreenCaptureMethod];\n\n if (isAndroid) {\n android[enableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[enableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableScreenCapture-isUnknown');\n }\n }\n\n const disableScreenCapture = (reqId) => {\n const isAndroid = android && android[disableScreenCaptureMethod];\n const isIos = ios && ios[disableScreenCaptureMethod];\n\n if (isAndroid) {\n android[disableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[disableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableScreenCapture-isUnknown');\n }\n }\n\n const shareImage = (reqId, text, image) => {\n // !!!======================!!!\n // !!!===== Deprecated =====!!!\n // !!!======================!!!\n\n // const isAndroid = android && android[shareImageMethod];\n // const isIos = ios && ios[shareImageMethod];\n\n // if (isAndroid) {\n // android[shareImageMethod](reqId, text, image);\n // } else if (isIos) {\n // ios[shareImageMethod].postMessage({ reqId, text, image });\n // } else if (typeof window !== 'undefined') {\n // console.log('--shareImage-isWeb');\n // }\n\n // new one - fallback to shareFile\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n // get extension from base64 mime type and merge with name\n const ext = image.split(';')[0].split('/')[1];\n const filename = 'image.' + ext;\n // remove mime type\n const base64Data = image.substr(image.indexOf(',') + 1);\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, { text, filename, base64Data });\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const shareFile = (reqId, text, filename, base64Data) => {\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, text, filename, base64Data);\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const enableNotifications = () => invokePromise(EInvokeRequest.enableNotifications);\n\n const disableNotifications = () => invokePromise(EInvokeRequest.disableNotifications);\n\n const setShakeHandler = (handler) => {\n const isAndroid = android && android[setShakeHandlerMethod];\n const isIos = ios && ios[setShakeHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeShake = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setShakeHandler-isUnknown');\n }\n };\n\n const setTabActiveHandler = (handler: (tabname: string) => void) => {\n const isAndroid = android && android[setTabActiveHandlerMethod];\n const isIos = ios && ios[setTabActiveHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeTabActive = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setTabActiveHandler-isUnknown');\n }\n };\n\n const vibrate = (reqId, pattern) => {\n if (\n !Array.isArray(pattern) ||\n pattern.some((timing) => timing < 1 || timing !== Math.floor(timing)) ||\n pattern.reduce((total, timing) => total + timing) > 10000\n ) {\n console.error('Pattern should be an array of positive integers no longer than 10000ms total');\n return;\n }\n\n const isAndroid = android && android[vibrateMethod];\n const isIos = ios && ios[vibrateMethod];\n\n if (isAndroid) {\n android[vibrateMethod](reqId, JSON.stringify(pattern));\n } else if (isIos) {\n ios[vibrateMethod].postMessage({ reqId, pattern });\n } else if (web) {\n web.execute(vibrateMethod, reqId, pattern);\n } else if (typeof window !== 'undefined') {\n console.log('--vibrate-isUnknown');\n }\n }\n\n const isSupported = () => {\n const iosSup = ios && (window as any).webkit.messageHandlers.invoke;\n return Boolean(android || iosSup || web);\n }\n\n // TODO: implement web support\n const supports = (method) =>\n (android && typeof android[method] === 'function') ||\n (ios && ios[method] && typeof ios[method].postMessage === 'function') ||\n (web && typeof web[method] === 'function');\n\n const sub = (listener: any) => {\n subs.push(listener);\n }\n\n const setHeaderMenuItems = (reqId, items: Array<HeaderMenuItem>) => {\n if (items.length > MAX_HEADER_MENU_ITEMS_COUNT) {\n console.error('SetHeaderMenuItems: items count should not be more than ' + MAX_HEADER_MENU_ITEMS_COUNT);\n return;\n }\n\n const isAndroid = android && android[setHeaderMenuItemsMethod];\n const isIos = ios && ios[setHeaderMenuItemsMethod];\n\n const itemsJsonArray = JSON.stringify(items);\n\n if (isAndroid) {\n android[setHeaderMenuItemsMethod](reqId, itemsJsonArray);\n } else if (isIos) {\n ios[setHeaderMenuItemsMethod].postMessage({ reqId, itemsJsonArray });\n } else if (web) {\n web.execute(setHeaderMenuItemsMethod, reqId, itemsJsonArray);\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItems-isUnknown');\n }\n }\n\n const setHeaderMenuItemClickHandler = (handler: HeaderMenuItemClickHandlerType) => {\n const isAndroid = android && android[setHeaderMenuItemClickHandlerMethod];\n const isIos = ios && ios[setHeaderMenuItemClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeHeaderMenuItemClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItemClickHandler-isUnknown');\n }\n }\n\n const setCustomBackArrowMode = (reqId, enabled: boolean) => {\n const isAndroid = android && android[setCustomBackArrowModeMethod];\n const isIos = ios && ios[setCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowModeMethod](reqId, enabled);\n } else if (isIos) {\n ios[setCustomBackArrowModeMethod].postMessage({ reqId, enabled });\n } else if (web) {\n web.execute(setCustomBackArrowModeMethod, reqId, enabled);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowMode-isUnknown');\n }\n }\n\n const getCustomBackArrowMode = (reqId) => {\n const isAndroid = android && android[getCustomBackArrowModeMethod];\n const isIos = ios && ios[getCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[getCustomBackArrowModeMethod](reqId);\n } else if (isIos) {\n ios[getCustomBackArrowModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getCustomBackArrowModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getCustomBackArrowMode-isUnknown');\n }\n }\n\n const setCustomBackArrowVisible = (reqId, visible: boolean) => {\n const isAndroid = android && android[setCustomBackArrowVisibleMethod];\n const isIos = ios && ios[setCustomBackArrowVisibleMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowVisibleMethod](reqId, visible);\n } else if (isIos) {\n ios[setCustomBackArrowVisibleMethod].postMessage({ reqId, visible });\n } else if (web) {\n web.execute(setCustomBackArrowVisibleMethod, reqId, visible);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowVisible-isUnknown');\n }\n }\n\n const setCustomBackArrowOnClickHandler = (handler: BackArrowClickHandlerType) => {\n const isAndroid = android && android[setCustomBackArrowOnClickHandlerMethod];\n const isIos = ios && ios[setCustomBackArrowOnClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeBackArrowClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowOnClickHandler-isUnknown');\n }\n }\n\n const openPayment = (reqId, transactionId: string) => {\n const isAndroid = android && android[openPaymentMethod];\n const isIos = ios && ios[openPaymentMethod];\n\n if (isAndroid) {\n android[openPaymentMethod](reqId, transactionId);\n } else if (isIos) {\n ios[openPaymentMethod].postMessage({ reqId, transactionId });\n } else {\n console.log('--openPayment-isUnknown');\n }\n }\n\n const checkBiometry = (reqId) => {\n const isAndroid = android && android[checkBiometryMethod];\n const isIos = ios && ios[checkBiometryMethod];\n\n if (isAndroid) {\n android[checkBiometryMethod](reqId);\n } else if (isIos) {\n ios[checkBiometryMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(checkBiometryMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--checkBiometry-isUnknown');\n }\n }\n\n const openExternalUrl = (reqId, url: string) => {\n const isAndroid = android && android[openExternalUrlMethod];\n const isIos = ios && ios[openExternalUrlMethod];\n\n if (isAndroid) {\n android[openExternalUrlMethod](reqId, url);\n } else if (isIos) {\n ios[openExternalUrlMethod].postMessage({ reqId, url });\n } else {\n console.log(\"--openExternalUrlMethod-isUnknown\");\n }\n };\n\n const enableSwipeBack = (reqId) => {\n const isAndroid = android && android[enableSwipeBackMethod];\n const isIos = ios && ios[enableSwipeBackMethod];\n\n if (isAndroid) {\n android[enableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[enableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableSwipeBack-isUnknown');\n }\n }\n\n const disableSwipeBack = (reqId) => {\n const isAndroid = android && android[disableSwipeBackMethod];\n const isIos = ios && ios[disableSwipeBackMethod];\n\n if (isAndroid) {\n android[disableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[disableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableSwipeBack-isUnknown');\n }\n }\n\n const invokePromise = promisifyInvoke(invoke, sub);\n const storagePromise = promisifyStorage(storage, sub);\n const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);\n const getQrPromise = promisifyMethod(getQr, getQrMethod, sub);\n const getSMSCodePromise = promisifyMethod(getSMSCode, getSMSCodeMethod, sub);\n const selectContactPromise = promisifyMethod(selectContact, selectContactMethod, sub);\n const openSettingsPromise = promisifyMethod(openSettings, openSettingsMethod, sub);\n const closeApplicationPromise = promisifyMethod(closeApplication, closeApplicationMethod, sub);\n const sharePromise = promisifyMethod(share, shareMethod, sub);\n const setTitlePromise = promisifyMethod(setTitle, setTitleMethod, sub);\n const copyToClipboardPromise = promisifyMethod(copyToClipboard, copyToClipboardMethod, sub);\n const shareImagePromise = promisifyMethod(shareImage, shareImageMethod, sub);\n const shareFilePromise = promisifyMethod(shareFile, shareFileMethod, sub);\n const vibratePromise = promisifyMethod(vibrate, vibrateMethod, sub);\n const enableScreenCapturePromise = promisifyMethod(enableScreenCapture, enableScreenCaptureMethod, sub);\n const disableScreenCapturePromise = promisifyMethod(disableScreenCapture, disableScreenCaptureMethod, sub);\n const setHeaderMenuItemsPromise = promisifyMethod(setHeaderMenuItems, setHeaderMenuItemsMethod, sub);\n const setCustomBackArrowModePromise = promisifyMethod(setCustomBackArrowMode, setCustomBackArrowModeMethod, sub);\n const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);\n const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);\n const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);\n const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);\n const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);\n const enableSwipeBackPromise = promisifyMethod(enableSwipeBack, enableSwipeBackMethod, sub);\n const disableSwipeBackPromise = promisifyMethod(disableSwipeBack, disableSwipeBackMethod, sub);\n\n return {\n version: String(LIB_VERSION),\n copyToClipboard: copyToClipboardPromise,\n invoke: invokePromise,\n storage: storagePromise,\n getMe: () => invokePromise(EInvokeRequest.getMe),\n getPhone: () => invokePromise(EInvokeRequest.getPhone),\n getContacts: () => invokePromise(EInvokeRequest.getContacts),\n getGeo: getGeoPromise,\n getQr: getQrPromise,\n getSMSCode: getSMSCodePromise,\n getUserProfile: (id: string) =>\n invokePromise(EInvokeRequest.getUserProfile, { id }),\n selectContact: selectContactPromise,\n enableNotifications,\n disableNotifications,\n enablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),\n disablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),\n openSettings: openSettingsPromise,\n closeApplication: closeApplicationPromise,\n setTitle: setTitlePromise,\n share: sharePromise,\n shareImage: shareImagePromise,\n shareFile: shareFilePromise,\n setShakeHandler,\n setTabActiveHandler,\n vibrate: vibratePromise,\n isSupported,\n supports,\n sub,\n enableScreenCapture: enableScreenCapturePromise,\n disableScreenCapture: disableScreenCapturePromise,\n setHeaderMenuItems: setHeaderMenuItemsPromise,\n setHeaderMenuItemClickHandler,\n setCustomBackArrowMode: setCustomBackArrowModePromise,\n getCustomBackArrowMode: getCustomBackArrowModePromise,\n setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,\n openPayment: openPaymentPromise,\n setCustomBackArrowOnClickHandler,\n checkBiometry: checkBiometryPromise,\n openExternalUrl: openExternalUrlPromise,\n enableSwipeBack: enableSwipeBackPromise,\n disableSwipeBack: disableSwipeBackPromise,\n };\n}\n\nconst bridge = buildBridge();\n\nexport default bridge;\n","export const LIB_VERSION = \"0.3.47\";\n"],"names":["createRequestResolver","prefix","counter","current","next","this","createCounter","promiseControllers","add","controller","customId","id","resolve","reqId","data","isSuccess","error","requestPromise","reject","handleSubscribe","subscribe","requestResolver","event","detail","promisifyMethod","method","methodName","Promise","aituOrigin","URLSearchParams","window","location","search","get","localStorage","setItem","getItem","WebBridge","origin","execute","top","postMessage","source","payload","addEventListener","dispatchEvent","CustomEvent","message","JSON","parse","onAituBridgeBackArrowClick","onAituBridgeHeaderMenuItemClick","param","e","console","log","EInvokeRequest","HeaderMenuIcon","android","AndroidBridge","ios","webkit","messageHandlers","web","bridge","subs","map","fn","call","sub","listener","push","invokePromise","invokeMethodName","props","isIos","stringify","invoke","storagePromise","storage","keyName","keyValue","clear","promisifyStorage","getGeoPromise","getQrPromise","getSMSCodePromise","selectContactPromise","openSettingsPromise","closeApplicationPromise","sharePromise","text","setTitlePromise","copyToClipboardPromise","shareImagePromise","image","isAndroid","filename","split","base64Data","substr","indexOf","shareFilePromise","vibratePromise","pattern","Array","isArray","some","timing","Math","floor","reduce","total","enableScreenCapturePromise","disableScreenCapturePromise","setHeaderMenuItemsPromise","items","length","itemsJsonArray","setCustomBackArrowModePromise","enabled","getCustomBackArrowModePromise","setCustomBackArrowVisiblePromise","visible","openPaymentPromise","transactionId","checkBiometryPromise","openExternalUrlPromise","url","enableSwipeBackPromise","disableSwipeBackPromise","version","String","copyToClipboard","getMe","getPhone","getContacts","getGeo","getQr","getSMSCode","getUserProfile","selectContact","enableNotifications","disableNotifications","enablePrivateMessaging","appId","disablePrivateMessaging","openSettings","closeApplication","setTitle","share","shareImage","shareFile","setShakeHandler","handler","onAituBridgeShake","setTabActiveHandler","onAituBridgeTabActive","vibrate","isSupported","iosSup","Boolean","supports","enableScreenCapture","disableScreenCapture","setHeaderMenuItems","setHeaderMenuItemClickHandler","setCustomBackArrowMode","getCustomBackArrowMode","setCustomBackArrowVisible","openPayment","setCustomBackArrowOnClickHandler","checkBiometry","openExternalUrl","enableSwipeBack","disableSwipeBack","buildBridge"],"mappings":"0LASA,SAASA,EAAsBC,GAM3B,IAAMC,EAfV,SAAuBD,GACnB,gBADmBA,IAAAA,EAAS,MACrB,CACHE,QAAS,EACTC,gBACI,OAAOH,KAAWI,KAAKF,UAWfG,CAAcL,GACxBM,EAA+D,GAErE,MAAO,CACHC,aAAIC,EAA+BC,YAAAA,IAAAA,EAAW,IAC1C,IAAMC,EAAKD,EAAWR,EAAQE,OAE9B,OADAG,EAAmBI,GAAMF,EAClBE,GAGXC,iBAAWC,EAAwBC,EAASC,EAAiCC,GACzE,IAAMC,EAAiBV,EAAmBM,GAEtCI,IACIF,EAAUC,GACVC,EAAeL,QAAQE,GAEvBG,EAAeC,OAAOF,GAG1BT,EAAmBM,GAAS,QAM5C,SAASM,EAAgBC,EAAoDC,GACzED,EAAU,SAAAE,GACN,GAAKA,EAAMC,QAIP,UAAWD,EAAMC,OAAQ,OACMD,EAAMC,OAA7BV,IAAAA,MAEJA,GACAQ,EAAgBT,QAAQC,IAHbC,KAG0B,SAACE,UAAYA,KAHjCA,mBAkDjBQ,EAAgBC,EAAkBC,EAAoBN,GAClE,IAAMC,EAAkBrB,EAAsB0B,EAAa,KAI3D,OAFAP,EAAgBC,EAAWC,8BAGvB,WAAWM,QAAQ,SAACf,EAASM,GACzB,IAAML,EAAQQ,EAAgBb,IAAI,CAAEI,QAAAA,EAASM,OAAAA,IAC7CO,gBAAOZ,gCCxGnB,IAIIe,EAFiB,IAAIC,gBAAgBC,OAAOC,SAASC,QAE3BC,IAJJ,iBAMvBL,EACCM,aAAaC,QAA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BAAwBhD,EACxBiD,uBAAwB/C,EACxBgD,0BAA2B/C,EAC3BgD,YAAa9C,EACb+C,iCApJuC,SAACjB,GACtBhG,GAAWA,EAAO,kCACtBE,GAAOA,EAAG,kCAEEG,EACvBjC,OAAeoB,2BAA6BwG,EAClB,oBAAX5H,QAChBwB,QAAQC,IAAI,iDA8IdqH,cAAe9C,EACf+C,gBAAiB9C,EACjB+C,gBAAiB7C,EACjB8C,iBAAkB7C,GAIP8C"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/utils.ts","../src/webBridge.ts","../src/index.ts","../src/version.ts"],"sourcesContent":["function createCounter(prefix = 'm:') {\n return {\n current: 0,\n next() {\n return prefix + ++this.current;\n },\n };\n}\n\nfunction createRequestResolver(prefix: string) {\n type PromiseController = {\n resolve: (value: any) => any;\n reject: (reason: any) => any;\n };\n\n const counter = createCounter(prefix);\n const promiseControllers: Record<string, PromiseController | null> = {};\n\n return {\n add(controller: PromiseController, customId = ''): number | string {\n const id = customId + counter.next()\n promiseControllers[id] = controller;\n return id;\n },\n\n resolve<T>(reqId: number | string, data: T, isSuccess: (data: T) => boolean, error: any) {\n const requestPromise = promiseControllers[reqId];\n\n if (requestPromise) {\n if (isSuccess(error)) {\n requestPromise.resolve(data);\n } else {\n requestPromise.reject(error);\n }\n\n promiseControllers[reqId] = null;\n }\n },\n };\n}\n\nfunction handleSubscribe(subscribe: (handler: (event: any) => void) => void, requestResolver: ReturnType<typeof createRequestResolver>) {\n subscribe(event => {\n if (!event.detail) {\n return;\n }\n\n if ('reqId' in event.detail) {\n const { reqId, data, error } = event.detail;\n\n if (reqId) {\n requestResolver.resolve(reqId, data, (error) => !(error), error);\n }\n }\n })\n}\n\nexport function promisifyStorage(storage, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('storage:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return {\n setItem: (keyName: string, keyValue: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'setItem', { keyName, keyValue });\n });\n },\n getItem: (keyName: string): Promise<string | null> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'getItem', { keyName });\n });\n },\n clear: (): Promise<void> => {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n storage(reqId, 'clear', {});\n });\n },\n }\n}\n\nexport function promisifyInvoke(invoke, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver('invoke:');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(invokeMethodName: string, props: any = {}): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject }, invokeMethodName + ':');\n\n invoke(reqId, invokeMethodName, props);\n });\n };\n}\n\nexport function promisifyMethod(method: Function, methodName: string, subscribe: (fn: any) => void) {\n const requestResolver = createRequestResolver(methodName + ':');\n\n handleSubscribe(subscribe, requestResolver)\n\n return function promisifiedFunc(...args: any[]): Promise<any | void> {\n return new Promise((resolve, reject) => {\n const reqId = requestResolver.add({ resolve, reject });\n method(reqId, ...args);\n });\n };\n}\n\n\n\n","import type { AituBridge } from './index';\n\nconst AITU_DOMAIN_PARAM = '__aitu-domain'\n\nconst searchParams = new URLSearchParams(window.location.search)\n\nlet aituOrigin = searchParams.get(AITU_DOMAIN_PARAM)\n\nif(aituOrigin){\n localStorage.setItem('mini-app-domain', aituOrigin)\n}else{\n aituOrigin = localStorage.getItem('mini-app-domain')\n}\ninterface WebBridge {\n execute(method: keyof AituBridge, reqId: string, ...payload: any[] ): void\n origin: string\n}\n\nlet WebBridge: WebBridge | null = null\n\nif (aituOrigin) {\n WebBridge = {\n origin: aituOrigin,\n execute: (method, reqId, ...payload) => {\n window.top.postMessage({\n source: 'aitu-bridge',\n method,\n reqId,\n payload: [...payload],\n },\n WebBridge.origin\n )\n }\n\n }\n window.addEventListener('message', event => {\n if (event.origin === aituOrigin && event.data) {\n\n // dispatch aitu events\n window.dispatchEvent(new CustomEvent('aituEvents', { detail: event.data }));\n\n // try to detect handler call\n if (typeof event.data !== 'string' || event.data === '') {\n return;\n }\n\n try {\n const message = JSON.parse(event.data)\n\n if (message && message['method']) {\n if (message.method === 'setCustomBackArrowOnClickHandler') {\n (window as any).onAituBridgeBackArrowClick()\n } else if (message.method === 'setHeaderMenuItemClickHandler') {\n (window as any).onAituBridgeHeaderMenuItemClick(message.param)\n }\n }\n } catch (e) {\n console.log('Error parsing message data: ' + e);\n }\n }\n })\n}\n\nexport default WebBridge\n","import { LIB_VERSION } from './version';\n\nimport {\n promisifyMethod,\n promisifyStorage,\n promisifyInvoke,\n} from './utils'\n\nimport WebBridge from './webBridge';\n\nenum EInvokeRequest {\n getMe = 'GetMe',\n getPhone = 'GetPhone',\n getContacts = 'GetContacts',\n getUserProfile = 'GetUserProfile',\n enableNotifications = 'AllowNotifications',\n disableNotifications = 'DisableNotifications',\n enablePrivateMessaging = 'EnablePrivateMessaging',\n disablePrivateMessaging = 'DisablePrivateMessaging',\n}\n\ntype SetItemType = (keyName: string, keyValue: string) => Promise<void>;\ntype GetItemType = (keyName: string) => Promise<string | null>;\ntype ClearType = () => Promise<void>;\n\ntype HeaderMenuItemClickHandlerType = (id: string) => Promise<void>;\ntype BackArrowClickHandlerType = () => Promise<void>;\n\ninterface GetPhoneResponse {\n phone: string;\n sign: string;\n}\n\ninterface GetMeResponse {\n name: string;\n lastname: string;\n id: string;\n avatar?: string;\n avatarThumb?: string;\n notifications_allowed: boolean;\n private_messaging_enabled: boolean;\n sign: string;\n}\n\ninterface ResponseObject {\n phone?: string;\n name?: string;\n lastname?: string;\n}\n\ninterface GetGeoResponse {\n latitude: number;\n longitude: number;\n}\n\ninterface GetContactsResponse {\n contacts: Array<{\n first_name: string;\n last_name: string;\n phone: string;\n }>;\n sign: string;\n}\n\ninterface SelectContactResponse {\n phone: string;\n name: string;\n lastname: string;\n}\n\ninterface GetUserProfileResponse {\n name: string;\n lastname?: string;\n phone?: string;\n avatar?: string;\n avatarThumb?: string;\n}\n\nconst MAX_HEADER_MENU_ITEMS_COUNT = 3;\n\nexport enum HeaderMenuIcon {\n Search = \"Search\",\n ShoppingCart = \"ShoppingCart\",\n Menu = \"Menu\",\n Share = \"Share\",\n Notifications = \"Notifications\",\n Help = \"Help\",\n Error = \"Error\",\n Person = \"Person\",\n Sort = \"Sort\",\n Filter = \"Filter\",\n Close = \"Close\"\n}\n\nenum NavigationItemMode {\n SystemBackArrow = \"SystemBackArrow\",\n CustomBackArrow = \"CustomBackArrow\",\n NoItem = \"NoItem\",\n UserProfile = \"UserProfile\",\n}\n\ninterface HeaderMenuItem {\n id: string;\n icon: HeaderMenuIcon;\n badge?: string;\n}\n\ntype OpenSettingsResponse = 'success' | 'failed';\ntype ShareResponse = 'success' | 'failed';\ntype CopyToClipboardResponse = 'success' | 'failed';\ntype VibrateResponse = 'success' | 'failed';\n// todo: remove duplicates\ntype ResponseType = 'success' | 'failed';\n\ntype BridgeInvoke<T extends EInvokeRequest, R> = (method: T, data?: {}) => Promise<R>;\n\ninterface BridgeStorage {\n setItem: SetItemType,\n getItem: GetItemType,\n clear: ClearType\n}\n\nexport interface AituBridge {\n version: string;\n invoke: BridgeInvoke<EInvokeRequest, ResponseObject>;\n storage: BridgeStorage;\n getMe: () => Promise<GetMeResponse>;\n getPhone: () => Promise<GetPhoneResponse>;\n getContacts: () => Promise<GetContactsResponse>;\n getGeo: () => Promise<GetGeoResponse>;\n selectContact: () => Promise<SelectContactResponse>;\n getQr: () => Promise<string>;\n getSMSCode: () => Promise<string>;\n getUserProfile: (userId: string) => Promise<GetUserProfileResponse>;\n share: (text: string) => Promise<ShareResponse>;\n setTitle: (text: string) => Promise<ResponseType>;\n copyToClipboard: (text: string) => Promise<CopyToClipboardResponse>;\n shareImage: (text: string, image: string) => Promise<ShareResponse>;\n shareFile: (text: string, filename: string, base64Data: string) => Promise<ShareResponse>;\n enableNotifications: () => Promise<{}>;\n disableNotifications: () => Promise<{}>;\n enablePrivateMessaging: (appId: string) => Promise<string>;\n disablePrivateMessaging: (appId: string) => Promise<string>;\n openSettings: () => Promise<OpenSettingsResponse>;\n closeApplication: () => Promise<ResponseType>;\n setShakeHandler: (handler: any) => void;\n setTabActiveHandler: (handler: (tabname: string) => void) => void;\n vibrate: (pattern: number[]) => Promise<VibratePattern>;\n isSupported: () => boolean;\n supports: (method: string) => boolean;\n sub: any;\n enableScreenCapture: () => Promise<{}>;\n disableScreenCapture: () => Promise<{}>;\n setHeaderMenuItems: (items: Array<HeaderMenuItem>) => Promise<ResponseType>;\n setHeaderMenuItemClickHandler: (handler: HeaderMenuItemClickHandlerType) => void;\n setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;\n getCustomBackArrowMode: () => Promise<boolean>;\n setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;\n openPayment: (transactionId: string) => Promise<ResponseType>;\n setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;\n checkBiometry: () => Promise<void>;\n openExternalUrl: (url: string) => Promise<ResponseType>;\n enableSwipeBack: () => Promise<ResponseType>;\n disableSwipeBack: () => Promise<ResponseType>;\n setNavigationItemMode: () => Promise<ResponseType>;\n getNavigationItemMode: () => Promise<NavigationItemMode>;\n}\n\nconst invokeMethod = 'invoke';\nconst storageMethod = 'storage';\nconst getGeoMethod = 'getGeo';\nconst getQrMethod = 'getQr';\nconst getSMSCodeMethod = 'getSMSCode';\nconst selectContactMethod = 'selectContact';\nconst openSettingsMethod = 'openSettings';\nconst closeApplicationMethod = 'closeApplication';\nconst shareMethod = 'share';\nconst setTitleMethod = 'setTitle';\nconst copyToClipboardMethod = 'copyToClipboard';\nconst shareImageMethod = 'shareImage';\nconst shareFileMethod = 'shareFile';\nconst setShakeHandlerMethod = 'setShakeHandler';\nconst vibrateMethod = 'vibrate';\nconst enableScreenCaptureMethod = 'enableScreenCapture';\nconst disableScreenCaptureMethod = 'disableScreenCapture';\nconst setTabActiveHandlerMethod = 'setTabActiveHandler';\nconst setHeaderMenuItemsMethod = 'setHeaderMenuItems';\nconst setHeaderMenuItemClickHandlerMethod = 'setHeaderMenuItemClickHandler';\nconst setCustomBackArrowModeMethod = 'setCustomBackArrowMode';\nconst getCustomBackArrowModeMethod = 'getCustomBackArrowMode';\nconst setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';\nconst openPaymentMethod = 'openPayment'\nconst setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';\nconst checkBiometryMethod = 'checkBiometry';\nconst openExternalUrlMethod = 'openExternalUrl';\nconst enableSwipeBackMethod = 'enableSwipeBack';\nconst disableSwipeBackMethod = 'disableSwipeBack';\nconst setNavigationItemModeMethod = 'setNavigationItemMode';\nconst getNavigationItemModeMethod = 'getNavigationItemMode';\n\nconst android = typeof window !== 'undefined' && (window as any).AndroidBridge;\nconst ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;\nconst web = typeof window !== 'undefined' && (window.top !== window) && WebBridge;\n\nconst buildBridge = (): AituBridge => {\n const subs = [];\n\n if (typeof window !== 'undefined') {\n window.addEventListener('aituEvents', (e: any) => {\n [...subs].map((fn) => fn.call(null, e));\n })\n }\n\n const invoke = (reqId, method, data = {}) => {\n const isAndroid = android && android[invokeMethod];\n const isIos = ios && ios[invokeMethod];\n\n if (isAndroid) {\n android[invokeMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[invokeMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(invokeMethod, reqId, method, data)\n } else if (typeof window !== 'undefined') {\n console.log('--invoke-isUnknown');\n }\n };\n\n const storage = (reqId, method, data = {}) => {\n const isAndroid = android && android[storageMethod];\n const isIos = ios && ios[storageMethod];\n\n if (isAndroid) {\n android[storageMethod](reqId, method, JSON.stringify(data));\n } else if (isIos) {\n ios[storageMethod].postMessage({ reqId, method, data });\n } else if (web) {\n web.execute(storageMethod, reqId, method, data);\n } else if (typeof window !== 'undefined') {\n console.log('--storage-isUnknown');\n }\n }\n\n const getGeo = (reqId) => {\n const isAndroid = android && android[getGeoMethod];\n const isIos = ios && ios[getGeoMethod];\n\n if (isAndroid) {\n android[getGeoMethod](reqId);\n } else if (isIos) {\n ios[getGeoMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getGeoMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getGeo-isUnknown');\n }\n }\n\n const getQr = (reqId) => {\n const isAndroid = android && android[getQrMethod];\n const isIos = ios && ios[getQrMethod];\n\n if (isAndroid) {\n android[getQrMethod](reqId);\n } else if (isIos) {\n ios[getQrMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getQrMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getQr-isUnknown');\n }\n }\n\n const getSMSCode = (reqId) => {\n const isAndroid = android && android[getSMSCodeMethod];\n const isIos = ios && ios[getSMSCodeMethod];\n\n if (isAndroid) {\n android[getSMSCodeMethod](reqId);\n } else if (isIos) {\n ios[getSMSCodeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getSMSCodeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getSMSCode-isUnknown');\n }\n }\n\n const selectContact = (reqId) => {\n const isAndroid = android && android[selectContactMethod];\n const isIos = ios && ios[selectContactMethod];\n\n if (isAndroid) {\n android[selectContactMethod](reqId);\n } else if (isIos) {\n ios[selectContactMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(selectContactMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--selectContact-isUnknown');\n }\n }\n\n const openSettings = (reqId) => {\n const isAndroid = android && android[openSettingsMethod];\n const isIos = ios && ios[openSettingsMethod];\n\n if (isAndroid) {\n android[openSettingsMethod](reqId);\n } else if (isIos) {\n ios[openSettingsMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(openSettingsMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--openSettings-isUnknown');\n }\n }\n\n const closeApplication = (reqId) => {\n const isAndroid = android && android[closeApplicationMethod];\n const isIos = ios && ios[closeApplicationMethod];\n\n if (isAndroid) {\n android[closeApplicationMethod](reqId);\n } else if (isIos) {\n ios[closeApplicationMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(closeApplicationMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--closeApplication-isUnknown');\n }\n }\n\n const share = (reqId, text) => {\n const isAndroid = android && android[shareMethod];\n const isIos = ios && ios[shareMethod];\n\n if (isAndroid) {\n android[shareMethod](reqId, text);\n } else if (isIos) {\n ios[shareMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(shareMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--share-isUnknown');\n }\n }\n\n const setTitle = (reqId, text) => {\n const isAndroid = android && android[setTitleMethod];\n const isIos = ios && ios[setTitleMethod];\n\n if (isAndroid) {\n android[setTitleMethod](reqId, text);\n } else if (isIos) {\n ios[setTitleMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(setTitleMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--setTitle-isUnknown');\n }\n }\n\n const copyToClipboard = (reqId, text) => {\n const isAndroid = android && android[copyToClipboardMethod];\n const isIos = ios && ios[copyToClipboardMethod];\n\n if (isAndroid) {\n android[copyToClipboardMethod](reqId, text);\n } else if (isIos) {\n ios[copyToClipboardMethod].postMessage({ reqId, text });\n } else if (web) {\n web.execute(copyToClipboardMethod, reqId, text);\n } else if (typeof window !== 'undefined') {\n console.log('--copyToClipboard-isUnknown');\n }\n }\n\n const enableScreenCapture = (reqId) => {\n const isAndroid = android && android[enableScreenCaptureMethod];\n const isIos = ios && ios[enableScreenCaptureMethod];\n\n if (isAndroid) {\n android[enableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[enableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableScreenCapture-isUnknown');\n }\n }\n\n const disableScreenCapture = (reqId) => {\n const isAndroid = android && android[disableScreenCaptureMethod];\n const isIos = ios && ios[disableScreenCaptureMethod];\n\n if (isAndroid) {\n android[disableScreenCaptureMethod](reqId);\n } else if (isIos) {\n ios[disableScreenCaptureMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableScreenCaptureMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableScreenCapture-isUnknown');\n }\n }\n\n const shareImage = (reqId, text, image) => {\n // !!!======================!!!\n // !!!===== Deprecated =====!!!\n // !!!======================!!!\n\n // const isAndroid = android && android[shareImageMethod];\n // const isIos = ios && ios[shareImageMethod];\n\n // if (isAndroid) {\n // android[shareImageMethod](reqId, text, image);\n // } else if (isIos) {\n // ios[shareImageMethod].postMessage({ reqId, text, image });\n // } else if (typeof window !== 'undefined') {\n // console.log('--shareImage-isWeb');\n // }\n\n // new one - fallback to shareFile\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n // get extension from base64 mime type and merge with name\n const ext = image.split(';')[0].split('/')[1];\n const filename = 'image.' + ext;\n // remove mime type\n const base64Data = image.substr(image.indexOf(',') + 1);\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, { text, filename, base64Data });\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const shareFile = (reqId, text, filename, base64Data) => {\n const isAndroid = android && android[shareFileMethod];\n const isIos = ios && ios[shareFileMethod];\n\n if (isAndroid) {\n android[shareFileMethod](reqId, text, filename, base64Data);\n } else if (isIos) {\n ios[shareFileMethod].postMessage({ reqId, text, filename, base64Data });\n } else if (web) {\n web.execute(shareFileMethod, reqId, text, filename, base64Data);\n } else if (typeof window !== 'undefined') {\n console.log('--shareFile-isUnknown');\n }\n }\n\n const enableNotifications = () => invokePromise(EInvokeRequest.enableNotifications);\n\n const disableNotifications = () => invokePromise(EInvokeRequest.disableNotifications);\n\n const setShakeHandler = (handler) => {\n const isAndroid = android && android[setShakeHandlerMethod];\n const isIos = ios && ios[setShakeHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeShake = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setShakeHandler-isUnknown');\n }\n };\n\n const setTabActiveHandler = (handler: (tabname: string) => void) => {\n const isAndroid = android && android[setTabActiveHandlerMethod];\n const isIos = ios && ios[setTabActiveHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeTabActive = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setTabActiveHandler-isUnknown');\n }\n };\n\n const vibrate = (reqId, pattern) => {\n if (\n !Array.isArray(pattern) ||\n pattern.some((timing) => timing < 1 || timing !== Math.floor(timing)) ||\n pattern.reduce((total, timing) => total + timing) > 10000\n ) {\n console.error('Pattern should be an array of positive integers no longer than 10000ms total');\n return;\n }\n\n const isAndroid = android && android[vibrateMethod];\n const isIos = ios && ios[vibrateMethod];\n\n if (isAndroid) {\n android[vibrateMethod](reqId, JSON.stringify(pattern));\n } else if (isIos) {\n ios[vibrateMethod].postMessage({ reqId, pattern });\n } else if (web) {\n web.execute(vibrateMethod, reqId, pattern);\n } else if (typeof window !== 'undefined') {\n console.log('--vibrate-isUnknown');\n }\n }\n\n const isSupported = () => {\n const iosSup = ios && (window as any).webkit.messageHandlers.invoke;\n return Boolean(android || iosSup || web);\n }\n\n // TODO: implement web support\n const supports = (method) =>\n (android && typeof android[method] === 'function') ||\n (ios && ios[method] && typeof ios[method].postMessage === 'function') ||\n (web && typeof web[method] === 'function');\n\n const sub = (listener: any) => {\n subs.push(listener);\n }\n\n const setHeaderMenuItems = (reqId, items: Array<HeaderMenuItem>) => {\n if (items.length > MAX_HEADER_MENU_ITEMS_COUNT) {\n console.error('SetHeaderMenuItems: items count should not be more than ' + MAX_HEADER_MENU_ITEMS_COUNT);\n return;\n }\n\n const isAndroid = android && android[setHeaderMenuItemsMethod];\n const isIos = ios && ios[setHeaderMenuItemsMethod];\n\n const itemsJsonArray = JSON.stringify(items);\n\n if (isAndroid) {\n android[setHeaderMenuItemsMethod](reqId, itemsJsonArray);\n } else if (isIos) {\n ios[setHeaderMenuItemsMethod].postMessage({ reqId, itemsJsonArray });\n } else if (web) {\n web.execute(setHeaderMenuItemsMethod, reqId, itemsJsonArray);\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItems-isUnknown');\n }\n }\n\n const setHeaderMenuItemClickHandler = (handler: HeaderMenuItemClickHandlerType) => {\n const isAndroid = android && android[setHeaderMenuItemClickHandlerMethod];\n const isIos = ios && ios[setHeaderMenuItemClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeHeaderMenuItemClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setHeaderMenuItemClickHandler-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowMode = (reqId, enabled: boolean) => {\n const isAndroid = android && android[setCustomBackArrowModeMethod];\n const isIos = ios && ios[setCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowModeMethod](reqId, enabled);\n } else if (isIos) {\n ios[setCustomBackArrowModeMethod].postMessage({ reqId, enabled });\n } else if (web) {\n web.execute(setCustomBackArrowModeMethod, reqId, enabled);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте getNavigationItemMode\n */\n const getCustomBackArrowMode = (reqId) => {\n const isAndroid = android && android[getCustomBackArrowModeMethod];\n const isIos = ios && ios[getCustomBackArrowModeMethod];\n\n if (isAndroid) {\n android[getCustomBackArrowModeMethod](reqId);\n } else if (isIos) {\n ios[getCustomBackArrowModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getCustomBackArrowModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getCustomBackArrowMode-isUnknown');\n }\n }\n\n /**\n * @deprecated данный метод не рекомендуется использовать\n * вместо него используйте setNavigationItemMode\n */\n const setCustomBackArrowVisible = (reqId, visible: boolean) => {\n const isAndroid = android && android[setCustomBackArrowVisibleMethod];\n const isIos = ios && ios[setCustomBackArrowVisibleMethod];\n\n if (isAndroid) {\n android[setCustomBackArrowVisibleMethod](reqId, visible);\n } else if (isIos) {\n ios[setCustomBackArrowVisibleMethod].postMessage({ reqId, visible });\n } else if (web) {\n web.execute(setCustomBackArrowVisibleMethod, reqId, visible);\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowVisible-isUnknown');\n }\n }\n\n const setCustomBackArrowOnClickHandler = (handler: BackArrowClickHandlerType) => {\n const isAndroid = android && android[setCustomBackArrowOnClickHandlerMethod];\n const isIos = ios && ios[setCustomBackArrowOnClickHandlerMethod];\n\n if (isAndroid || isIos || web) {\n (window as any).onAituBridgeBackArrowClick = handler;\n } else if (typeof window !== 'undefined') {\n console.log('--setCustomBackArrowOnClickHandler-isUnknown');\n }\n }\n\n const openPayment = (reqId, transactionId: string) => {\n const isAndroid = android && android[openPaymentMethod];\n const isIos = ios && ios[openPaymentMethod];\n\n if (isAndroid) {\n android[openPaymentMethod](reqId, transactionId);\n } else if (isIos) {\n ios[openPaymentMethod].postMessage({ reqId, transactionId });\n } else {\n console.log('--openPayment-isUnknown');\n }\n }\n\n const checkBiometry = (reqId) => {\n const isAndroid = android && android[checkBiometryMethod];\n const isIos = ios && ios[checkBiometryMethod];\n\n if (isAndroid) {\n android[checkBiometryMethod](reqId);\n } else if (isIos) {\n ios[checkBiometryMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(checkBiometryMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--checkBiometry-isUnknown');\n }\n }\n\n const openExternalUrl = (reqId, url: string) => {\n const isAndroid = android && android[openExternalUrlMethod];\n const isIos = ios && ios[openExternalUrlMethod];\n\n if (isAndroid) {\n android[openExternalUrlMethod](reqId, url);\n } else if (isIos) {\n ios[openExternalUrlMethod].postMessage({ reqId, url });\n } else {\n console.log(\"--openExternalUrlMethod-isUnknown\");\n }\n };\n\n const enableSwipeBack = (reqId) => {\n const isAndroid = android && android[enableSwipeBackMethod];\n const isIos = ios && ios[enableSwipeBackMethod];\n\n if (isAndroid) {\n android[enableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[enableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(enableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--enableSwipeBack-isUnknown');\n }\n }\n\n const disableSwipeBack = (reqId) => {\n const isAndroid = android && android[disableSwipeBackMethod];\n const isIos = ios && ios[disableSwipeBackMethod];\n\n if (isAndroid) {\n android[disableSwipeBackMethod](reqId);\n } else if (isIos) {\n ios[disableSwipeBackMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(disableSwipeBackMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--disableSwipeBack-isUnknown');\n }\n }\n\n const setNavigationItemMode = (reqId, mode: NavigationItemMode) => {\n const isAndroid = android && android[setNavigationItemModeMethod];\n const isIos = ios && ios[setNavigationItemModeMethod];\n\n if (isAndroid) {\n android[setNavigationItemModeMethod](reqId, mode);\n } else if (isIos) {\n ios[setNavigationItemModeMethod].postMessage({ reqId, mode });\n } else if (web) {\n web.execute(setNavigationItemModeMethod, reqId, mode);\n } else if (typeof window !== 'undefined') {\n console.log('--setNavigationItemMode-isUnknown');\n }\n }\n\n const getNavigationItemMode = (reqId) => {\n const isAndroid = android && android[getNavigationItemModeMethod];\n const isIos = ios && ios[getNavigationItemModeMethod];\n\n if (isAndroid) {\n android[getNavigationItemModeMethod](reqId);\n } else if (isIos) {\n ios[getNavigationItemModeMethod].postMessage({ reqId });\n } else if (web) {\n web.execute(getNavigationItemModeMethod, reqId);\n } else if (typeof window !== 'undefined') {\n console.log('--getNavigationItemMode-isUnknown');\n }\n }\n\n\n const invokePromise = promisifyInvoke(invoke, sub);\n const storagePromise = promisifyStorage(storage, sub);\n const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);\n const getQrPromise = promisifyMethod(getQr, getQrMethod, sub);\n const getSMSCodePromise = promisifyMethod(getSMSCode, getSMSCodeMethod, sub);\n const selectContactPromise = promisifyMethod(selectContact, selectContactMethod, sub);\n const openSettingsPromise = promisifyMethod(openSettings, openSettingsMethod, sub);\n const closeApplicationPromise = promisifyMethod(closeApplication, closeApplicationMethod, sub);\n const sharePromise = promisifyMethod(share, shareMethod, sub);\n const setTitlePromise = promisifyMethod(setTitle, setTitleMethod, sub);\n const copyToClipboardPromise = promisifyMethod(copyToClipboard, copyToClipboardMethod, sub);\n const shareImagePromise = promisifyMethod(shareImage, shareImageMethod, sub);\n const shareFilePromise = promisifyMethod(shareFile, shareFileMethod, sub);\n const vibratePromise = promisifyMethod(vibrate, vibrateMethod, sub);\n const enableScreenCapturePromise = promisifyMethod(enableScreenCapture, enableScreenCaptureMethod, sub);\n const disableScreenCapturePromise = promisifyMethod(disableScreenCapture, disableScreenCaptureMethod, sub);\n const setHeaderMenuItemsPromise = promisifyMethod(setHeaderMenuItems, setHeaderMenuItemsMethod, sub);\n const setCustomBackArrowModePromise = promisifyMethod(setCustomBackArrowMode, setCustomBackArrowModeMethod, sub);\n const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);\n const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);\n const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);\n const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);\n const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);\n const enableSwipeBackPromise = promisifyMethod(enableSwipeBack, enableSwipeBackMethod, sub);\n const disableSwipeBackPromise = promisifyMethod(disableSwipeBack, disableSwipeBackMethod, sub);\n const setNavigationItemModePromise = promisifyMethod(setNavigationItemMode, setNavigationItemModeMethod, sub);\n const getNavigationItemModePromise = promisifyMethod(getNavigationItemMode, getNavigationItemModeMethod, sub);\n\n return {\n version: String(LIB_VERSION),\n copyToClipboard: copyToClipboardPromise,\n invoke: invokePromise,\n storage: storagePromise,\n getMe: () => invokePromise(EInvokeRequest.getMe),\n getPhone: () => invokePromise(EInvokeRequest.getPhone),\n getContacts: () => invokePromise(EInvokeRequest.getContacts),\n getGeo: getGeoPromise,\n getQr: getQrPromise,\n getSMSCode: getSMSCodePromise,\n getUserProfile: (id: string) =>\n invokePromise(EInvokeRequest.getUserProfile, { id }),\n selectContact: selectContactPromise,\n enableNotifications,\n disableNotifications,\n enablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),\n disablePrivateMessaging: (appId: string) =>\n invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),\n openSettings: openSettingsPromise,\n closeApplication: closeApplicationPromise,\n setTitle: setTitlePromise,\n share: sharePromise,\n shareImage: shareImagePromise,\n shareFile: shareFilePromise,\n setShakeHandler,\n setTabActiveHandler,\n vibrate: vibratePromise,\n isSupported,\n supports,\n sub,\n enableScreenCapture: enableScreenCapturePromise,\n disableScreenCapture: disableScreenCapturePromise,\n setHeaderMenuItems: setHeaderMenuItemsPromise,\n setHeaderMenuItemClickHandler,\n setCustomBackArrowMode: setCustomBackArrowModePromise,\n getCustomBackArrowMode: getCustomBackArrowModePromise,\n setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,\n openPayment: openPaymentPromise,\n setCustomBackArrowOnClickHandler,\n checkBiometry: checkBiometryPromise,\n openExternalUrl: openExternalUrlPromise,\n enableSwipeBack: enableSwipeBackPromise,\n disableSwipeBack: disableSwipeBackPromise,\n setNavigationItemMode: setNavigationItemModePromise,\n getNavigationItemMode: getNavigationItemModePromise,\n };\n}\n\nconst bridge = buildBridge();\n\nexport default bridge;\n","export const LIB_VERSION = \"0.3.49\";\n"],"names":["createRequestResolver","prefix","counter","current","next","this","createCounter","promiseControllers","add","controller","customId","id","resolve","reqId","data","isSuccess","error","requestPromise","reject","handleSubscribe","subscribe","requestResolver","event","detail","promisifyMethod","method","methodName","Promise","aituOrigin","URLSearchParams","window","location","search","get","localStorage","setItem","getItem","WebBridge","origin","execute","top","postMessage","source","payload","addEventListener","dispatchEvent","CustomEvent","message","JSON","parse","onAituBridgeBackArrowClick","onAituBridgeHeaderMenuItemClick","param","e","console","log","EInvokeRequest","HeaderMenuIcon","NavigationItemMode","android","AndroidBridge","ios","webkit","messageHandlers","web","bridge","subs","map","fn","call","sub","listener","push","invokePromise","invokeMethodName","props","isIos","stringify","invoke","storagePromise","storage","keyName","keyValue","clear","promisifyStorage","getGeoPromise","getQrPromise","getSMSCodePromise","selectContactPromise","openSettingsPromise","closeApplicationPromise","sharePromise","text","setTitlePromise","copyToClipboardPromise","shareImagePromise","image","isAndroid","filename","split","base64Data","substr","indexOf","shareFilePromise","vibratePromise","pattern","Array","isArray","some","timing","Math","floor","reduce","total","enableScreenCapturePromise","disableScreenCapturePromise","setHeaderMenuItemsPromise","items","length","itemsJsonArray","setCustomBackArrowModePromise","enabled","getCustomBackArrowModePromise","setCustomBackArrowVisiblePromise","visible","openPaymentPromise","transactionId","checkBiometryPromise","openExternalUrlPromise","url","enableSwipeBackPromise","disableSwipeBackPromise","setNavigationItemModePromise","mode","getNavigationItemModePromise","version","String","copyToClipboard","getMe","getPhone","getContacts","getGeo","getQr","getSMSCode","getUserProfile","selectContact","enableNotifications","disableNotifications","enablePrivateMessaging","appId","disablePrivateMessaging","openSettings","closeApplication","setTitle","share","shareImage","shareFile","setShakeHandler","handler","onAituBridgeShake","setTabActiveHandler","onAituBridgeTabActive","vibrate","isSupported","iosSup","Boolean","supports","enableScreenCapture","disableScreenCapture","setHeaderMenuItems","setHeaderMenuItemClickHandler","setCustomBackArrowMode","getCustomBackArrowMode","setCustomBackArrowVisible","openPayment","setCustomBackArrowOnClickHandler","checkBiometry","openExternalUrl","enableSwipeBack","disableSwipeBack","setNavigationItemMode","getNavigationItemMode","buildBridge"],"mappings":"0LASA,SAASA,EAAsBC,GAM3B,IAAMC,EAfV,SAAuBD,GACnB,gBADmBA,IAAAA,EAAS,MACrB,CACHE,QAAS,EACTC,gBACI,OAAOH,KAAWI,KAAKF,UAWfG,CAAcL,GACxBM,EAA+D,GAErE,MAAO,CACHC,aAAIC,EAA+BC,YAAAA,IAAAA,EAAW,IAC1C,IAAMC,EAAKD,EAAWR,EAAQE,OAE9B,OADAG,EAAmBI,GAAMF,EAClBE,GAGXC,iBAAWC,EAAwBC,EAASC,EAAiCC,GACzE,IAAMC,EAAiBV,EAAmBM,GAEtCI,IACIF,EAAUC,GACVC,EAAeL,QAAQE,GAEvBG,EAAeC,OAAOF,GAG1BT,EAAmBM,GAAS,QAM5C,SAASM,EAAgBC,EAAoDC,GACzED,EAAU,SAAAE,GACN,GAAKA,EAAMC,QAIP,UAAWD,EAAMC,OAAQ,OACMD,EAAMC,OAA7BV,IAAAA,MAEJA,GACAQ,EAAgBT,QAAQC,IAHbC,KAG0B,SAACE,UAAYA,KAHjCA,mBAkDjBQ,EAAgBC,EAAkBC,EAAoBN,GAClE,IAAMC,EAAkBrB,EAAsB0B,EAAa,KAI3D,OAFAP,EAAgBC,EAAWC,8BAGvB,WAAWM,QAAQ,SAACf,EAASM,GACzB,IAAML,EAAQQ,EAAgBb,IAAI,CAAEI,QAAAA,EAASM,OAAAA,IAC7CO,gBAAOZ,gCCxGnB,IAIIe,EAFiB,IAAIC,gBAAgBC,OAAOC,SAASC,QAE3BC,IAJJ,iBAMvBL,EACCM,aAAaC,QAAQ,kBAAmBP,GAExCA,EAAaM,aAAaE,QAAQ,mBAOtC,IAAIC,EAA8B,KAE9BT,IACAS,EAAY,CACRC,OAAQV,EACRW,QAAS,SAACd,EAAQZ,GACdiB,OAAOU,IAAIC,YAAY,CACfC,OAAQ,cACRjB,OAAAA,EACAZ,MAAAA,EACA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OAAegC,OAAOC,gBAAgBe,OAC7D,OAAOuF,QAAQ1G,GAAWyG,GAAUpG,IAkRpCsG,SA9Qe,SAAC7I,UACfkC,GAAsC,mBAApBA,EAAQlC,IAC1BoC,GAAOA,EAAIpC,IAA8C,mBAA5BoC,EAAIpC,GAAQgB,aACzCuB,GAA8B,mBAAhBA,EAAIvC,IA4QnB6C,IAAAA,EACAiG,oBAAqBrD,EACrBsD,qBAAsBrD,EACtBsD,mBAAoBrD,EACpBsD,8BApPoC,SAACZ,GACnBnG,GAAWA,EAAO,+BACtBE,GAAOA,EAAG,+BAEEG,EACvBlC,OAAeqB,gCAAkC2G,EACvB,oBAAXhI,QAChBwB,QAAQC,IAAI,8CA8OdoH,uBAAwBnD,EACxBoD,uBAAwBlD,EACxBmD,0BAA2BlD,EAC3BmD,YAAajD,EACbkD,iCArLuC,SAACjB,GACtBnG,GAAWA,EAAO,kCACtBE,GAAOA,EAAG,kCAEEG,EACvBlC,OAAeoB,2BAA6B4G,EAClB,oBAAXhI,QAChBwB,QAAQC,IAAI,iDA+KdyH,cAAejD,EACfkD,gBAAiBjD,EACjBkD,gBAAiBhD,EACjBiD,iBAAkBhD,EAClBiD,sBAAuBhD,EACvBiD,sBAAuB/C,GAIZgD"}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.3.47";
1
+ export declare const LIB_VERSION = "0.3.49";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btsd/aitu-bridge",
3
- "version": "0.3.47",
3
+ "version": "0.3.49",
4
4
  "description": "",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -92,6 +92,13 @@ export enum HeaderMenuIcon {
92
92
  Close = "Close"
93
93
  }
94
94
 
95
+ enum NavigationItemMode {
96
+ SystemBackArrow = "SystemBackArrow",
97
+ CustomBackArrow = "CustomBackArrow",
98
+ NoItem = "NoItem",
99
+ UserProfile = "UserProfile",
100
+ }
101
+
95
102
  interface HeaderMenuItem {
96
103
  id: string;
97
104
  icon: HeaderMenuIcon;
@@ -151,10 +158,12 @@ export interface AituBridge {
151
158
  setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;
152
159
  openPayment: (transactionId: string) => Promise<ResponseType>;
153
160
  setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
154
- checkBiometry: () => Promise<ResponseType>;
161
+ checkBiometry: () => Promise<void>;
155
162
  openExternalUrl: (url: string) => Promise<ResponseType>;
156
163
  enableSwipeBack: () => Promise<ResponseType>;
157
164
  disableSwipeBack: () => Promise<ResponseType>;
165
+ setNavigationItemMode: () => Promise<ResponseType>;
166
+ getNavigationItemMode: () => Promise<NavigationItemMode>;
158
167
  }
159
168
 
160
169
  const invokeMethod = 'invoke';
@@ -184,8 +193,10 @@ const openPaymentMethod = 'openPayment'
184
193
  const setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';
185
194
  const checkBiometryMethod = 'checkBiometry';
186
195
  const openExternalUrlMethod = 'openExternalUrl';
187
- const enableSwipeBackMethod = 'enableSwipeBack'
188
- const disableSwipeBackMethod = 'disableSwipeBack'
196
+ const enableSwipeBackMethod = 'enableSwipeBack';
197
+ const disableSwipeBackMethod = 'disableSwipeBack';
198
+ const setNavigationItemModeMethod = 'setNavigationItemMode';
199
+ const getNavigationItemModeMethod = 'getNavigationItemMode';
189
200
 
190
201
  const android = typeof window !== 'undefined' && (window as any).AndroidBridge;
191
202
  const ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;
@@ -545,6 +556,10 @@ const buildBridge = (): AituBridge => {
545
556
  }
546
557
  }
547
558
 
559
+ /**
560
+ * @deprecated данный метод не рекомендуется использовать
561
+ * вместо него используйте setNavigationItemMode
562
+ */
548
563
  const setCustomBackArrowMode = (reqId, enabled: boolean) => {
549
564
  const isAndroid = android && android[setCustomBackArrowModeMethod];
550
565
  const isIos = ios && ios[setCustomBackArrowModeMethod];
@@ -560,6 +575,10 @@ const buildBridge = (): AituBridge => {
560
575
  }
561
576
  }
562
577
 
578
+ /**
579
+ * @deprecated данный метод не рекомендуется использовать
580
+ * вместо него используйте getNavigationItemMode
581
+ */
563
582
  const getCustomBackArrowMode = (reqId) => {
564
583
  const isAndroid = android && android[getCustomBackArrowModeMethod];
565
584
  const isIos = ios && ios[getCustomBackArrowModeMethod];
@@ -575,6 +594,10 @@ const buildBridge = (): AituBridge => {
575
594
  }
576
595
  }
577
596
 
597
+ /**
598
+ * @deprecated данный метод не рекомендуется использовать
599
+ * вместо него используйте setNavigationItemMode
600
+ */
578
601
  const setCustomBackArrowVisible = (reqId, visible: boolean) => {
579
602
  const isAndroid = android && android[setCustomBackArrowVisibleMethod];
580
603
  const isIos = ios && ios[setCustomBackArrowVisibleMethod];
@@ -672,6 +695,37 @@ const buildBridge = (): AituBridge => {
672
695
  }
673
696
  }
674
697
 
698
+ const setNavigationItemMode = (reqId, mode: NavigationItemMode) => {
699
+ const isAndroid = android && android[setNavigationItemModeMethod];
700
+ const isIos = ios && ios[setNavigationItemModeMethod];
701
+
702
+ if (isAndroid) {
703
+ android[setNavigationItemModeMethod](reqId, mode);
704
+ } else if (isIos) {
705
+ ios[setNavigationItemModeMethod].postMessage({ reqId, mode });
706
+ } else if (web) {
707
+ web.execute(setNavigationItemModeMethod, reqId, mode);
708
+ } else if (typeof window !== 'undefined') {
709
+ console.log('--setNavigationItemMode-isUnknown');
710
+ }
711
+ }
712
+
713
+ const getNavigationItemMode = (reqId) => {
714
+ const isAndroid = android && android[getNavigationItemModeMethod];
715
+ const isIos = ios && ios[getNavigationItemModeMethod];
716
+
717
+ if (isAndroid) {
718
+ android[getNavigationItemModeMethod](reqId);
719
+ } else if (isIos) {
720
+ ios[getNavigationItemModeMethod].postMessage({ reqId });
721
+ } else if (web) {
722
+ web.execute(getNavigationItemModeMethod, reqId);
723
+ } else if (typeof window !== 'undefined') {
724
+ console.log('--getNavigationItemMode-isUnknown');
725
+ }
726
+ }
727
+
728
+
675
729
  const invokePromise = promisifyInvoke(invoke, sub);
676
730
  const storagePromise = promisifyStorage(storage, sub);
677
731
  const getGeoPromise = promisifyMethod(getGeo, getGeoMethod, sub);
@@ -697,6 +751,8 @@ const buildBridge = (): AituBridge => {
697
751
  const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);
698
752
  const enableSwipeBackPromise = promisifyMethod(enableSwipeBack, enableSwipeBackMethod, sub);
699
753
  const disableSwipeBackPromise = promisifyMethod(disableSwipeBack, disableSwipeBackMethod, sub);
754
+ const setNavigationItemModePromise = promisifyMethod(setNavigationItemMode, setNavigationItemModeMethod, sub);
755
+ const getNavigationItemModePromise = promisifyMethod(getNavigationItemMode, getNavigationItemModeMethod, sub);
700
756
 
701
757
  return {
702
758
  version: String(LIB_VERSION),
@@ -743,6 +799,8 @@ const buildBridge = (): AituBridge => {
743
799
  openExternalUrl: openExternalUrlPromise,
744
800
  enableSwipeBack: enableSwipeBackPromise,
745
801
  disableSwipeBack: disableSwipeBackPromise,
802
+ setNavigationItemMode: setNavigationItemModePromise,
803
+ getNavigationItemMode: getNavigationItemModePromise,
746
804
  };
747
805
  }
748
806
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.3.47";
1
+ export const LIB_VERSION = "0.3.49";