@vkontakte/vk-bridge
Advanced tools
Comparing version 2.5.1 to 2.5.2-alpha-supported-RN-postMessage
@@ -1,2 +0,2 @@ | ||
!function(){"use strict";var a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var p in t=arguments[n])Object.prototype.hasOwnProperty.call(t,p)&&(e[p]=t[p]);return e}).apply(this,arguments)};function d(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),p=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,p++)o[p]=r[i];return o}function s(r,e){var o,p,i=(o={current:0,next:function(){return++this.current}},p={},{add:function(e,t){var n=null!=t?t:o.next();return p[n]=e,n},resolve:function(e,t,n){var o=p[e];o&&(n(t)?o.resolve(t):o.reject(t),p[e]=null)}});return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var t=e.detail.data,n=t.request_id,o=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var p=0;for(o=Object.getOwnPropertySymbols(e);p<o.length;p++)t.indexOf(o[p])<0&&Object.prototype.propertyIsEnumerable.call(e,o[p])&&(n[o[p]]=e[o[p]])}return n}(t,["request_id"]);n&&i.resolve(n,o,function(e){return!("error_type"in e)})}}),function(o,p){return void 0===p&&(p={}),new Promise(function(e,t){var n=i.add({resolve:e,reject:t},p.request_id);r(o,a(a({},p),{request_id:n}))})}}var e="undefined"!=typeof window,b=Boolean(e&&window.AndroidBridge),u=Boolean(e&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),l=e&&!b&&!u,t=l&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),A=l?"message":"VKWebAppEvent",c=d(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],l&&!t?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),f=e?window.AndroidBridge:void 0,w=u?window.webkit.messageHandlers:void 0;var n,o,p,r,i,W,K,V;function m(e,t){var n=t||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent");return o.initCustomEvent(e,!!n.bubbles,!!n.cancelable,n.detail),o}(o=n=n||{}).CAMERA="camera",o.LOCATION="location",o.PHOTO="photo",(r=p=p||{}).RU="ru",r.UK="uk",r.UA="ua",r.EN="en",r.BE="be",r.KZ="kz",r.PT="pt",r.ES="es",(W=i=i||{}).ADMIN="admin",W.EDITOR="editor",W.MEMBER="member",W.MODER="moder",W.NONE="none",(V=K=K||{}).DESKTOP_WEB="desktop_web",V.MOBILE_WEB="mobile_web",V.MOBILE_ANDROID="mobile_android",V.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",V.MOBILE_IPHONE="mobile_iphone",V.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",V.MOBILE_IPAD="mobile_ipad","undefined"==typeof window||window.CustomEvent||(window.CustomEvent=(m.prototype=Event.prototype,m));var v=function(n){var r=void 0,i=[];function e(e){i.push(e)}function t(){return u||b}function o(){return l&&window.parent!==window}function p(){return t()||o()}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(A,function(t){if(u||b)return d(i).map(function(e){return e.call(null,t)});if(l&&t&&t.data){var e=t.data,n=e.type,o=e.data,p=e.frameId;n&&"SetSupportedHandlers"===n?o.supportedHandlers:n&&"VKWebAppSettings"===n?r=p:d(i).map(function(e){return e({detail:{type:n,data:o}})})}});var a=s(function(e,t){f&&f[e]?f[e](JSON.stringify(t)):w&&w[e]&&"function"==typeof w[e].postMessage?w[e].postMessage(t):l&&parent.postMessage({handler:e,params:t,type:"vk-connect",webFrameId:r,connectVersion:n},"*")},e);return{send:a,sendPromise:a,subscribe:e,unsubscribe:function(e){var t=i.indexOf(e);-1<t&&i.splice(t,1)},supports:function(e){return b?!(!f||"function"!=typeof f[e]):u?!(!w||!w[e]||"function"!=typeof w[e].postMessage):l&&-1<c.indexOf(e)},isWebView:t,isIframe:o,isEmbedded:p,isStandalone:function(){return!p()}}}("2.5.1");window.vkBridge=window.vkConnect=v}(); | ||
!function(){"use strict";var a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var p in t=arguments[n])Object.prototype.hasOwnProperty.call(t,p)&&(e[p]=t[p]);return e}).apply(this,arguments)};function d(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),p=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,p++)o[p]=r[i];return o}function b(r,e){var o,p,i=(o={current:0,next:function(){return++this.current}},p={},{add:function(e,t){var n=null!=t?t:o.next();return p[n]=e,n},resolve:function(e,t,n){var o=p[e];o&&(n(t)?o.resolve(t):o.reject(t),p[e]=null)}});return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var t=e.detail.data,n=t.request_id,o=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var p=0;for(o=Object.getOwnPropertySymbols(e);p<o.length;p++)t.indexOf(o[p])<0&&Object.prototype.propertyIsEnumerable.call(e,o[p])&&(n[o[p]]=e[o[p]])}return n}(t,["request_id"]);n&&i.resolve(n,o,function(e){return!("error_type"in e)})}}),function(o,p){return void 0===p&&(p={}),new Promise(function(e,t){var n=i.add({resolve:e,reject:t},p.request_id);r(o,a(a({},p),{request_id:n}))})}}var e="undefined"!=typeof window,u=Boolean(e&&window.AndroidBridge),l=Boolean(e&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),A=Boolean(window.ReactNativeWebView&&"function"==typeof window.ReactNativeWebView.postMessage),c=e&&!u&&!l,t=c&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),w=c?"message":"VKWebAppEvent",f=d(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],c&&!t?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),W=e?window.AndroidBridge:void 0,V=l?window.webkit.messageHandlers:void 0;var n,o,p,r,i,s,K,v;function m(e,t){var n=t||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent");return o.initCustomEvent(e,!!n.bubbles,!!n.cancelable,n.detail),o}(o=n=n||{}).CAMERA="camera",o.LOCATION="location",o.PHOTO="photo",(r=p=p||{}).RU="ru",r.UK="uk",r.UA="ua",r.EN="en",r.BE="be",r.KZ="kz",r.PT="pt",r.ES="es",(s=i=i||{}).ADMIN="admin",s.EDITOR="editor",s.MEMBER="member",s.MODER="moder",s.NONE="none",(v=K=K||{}).DESKTOP_WEB="desktop_web",v.MOBILE_WEB="mobile_web",v.MOBILE_ANDROID="mobile_android",v.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",v.MOBILE_IPHONE="mobile_iphone",v.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",v.MOBILE_IPAD="mobile_ipad","undefined"==typeof window||window.CustomEvent||(window.CustomEvent=(m.prototype=Event.prototype,m));var y=function(n){var r=void 0,i=[];function e(e){i.push(e)}function t(){return l||u}function o(){return c&&window.parent!==window}function p(){return t()||o()}function a(t){if(l||u)return d(i).map(function(e){return e.call(null,t)});var e=null==t?void 0:t.data;if(c&&e){if(A&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}var n=e.type,o=e.data,p=e.frameId;n&&(n&&"SetSupportedHandlers"===n?o.supportedHandlers:n&&"VKWebAppSettings"===n?r=p:d(i).map(function(e){return e({detail:{type:n,data:o}})}))}}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(w,a),A&&/(android)/i.test(navigator.userAgent)&&document.addEventListener(w,a);var s=b(function(e,t){W&&W[e]?W[e](JSON.stringify(t)):V&&V[e]&&"function"==typeof V[e].postMessage?V[e].postMessage(t):A?window.ReactNativeWebView.postMessage(JSON.stringify({handler:e,params:t})):c&&parent.postMessage({handler:e,params:t,type:"vk-connect",webFrameId:r,connectVersion:n},"*")},e);return{send:s,sendPromise:s,subscribe:e,unsubscribe:function(e){var t=i.indexOf(e);-1<t&&i.splice(t,1)},supports:function(e){return u?!(!W||"function"!=typeof W[e]):l?!(!V||!V[e]||"function"!=typeof V[e].postMessage):c&&-1<f.indexOf(e)},isWebView:t,isIframe:o,isEmbedded:p,isStandalone:function(){return!p()}}}("2.5.2-alpha-supported-RN-postMessage");window.vkBridge=window.vkConnect=y}(); | ||
//# sourceMappingURL=browser.min.js.map |
@@ -139,2 +139,4 @@ /*! ***************************************************************************** | ||
window.webkit.messageHandlers.VKWebAppClose); | ||
var IS_REACT_NATIVE_WEBVIEW = Boolean(window.ReactNativeWebView && | ||
typeof window.ReactNativeWebView.postMessage === 'function'); | ||
/** Is the runtime environment a browser */ | ||
@@ -236,2 +238,9 @@ var IS_WEB = IS_CLIENT_SIDE && !IS_ANDROID_WEBVIEW && !IS_IOS_WEBVIEW; | ||
} | ||
// Sending data through React Native bridge | ||
else if (IS_REACT_NATIVE_WEBVIEW) { | ||
window.ReactNativeWebView.postMessage(JSON.stringify({ | ||
handler: method, | ||
params: props, | ||
})); | ||
} | ||
// Sending data through web bridge | ||
@@ -325,25 +334,39 @@ else if (IS_WEB) { | ||
} | ||
function handleEvent(event) { | ||
if (IS_IOS_WEBVIEW || IS_ANDROID_WEBVIEW) { | ||
// If it's webview | ||
return __spreadArrays(subscribers).map(function (fn) { return fn.call(null, event); }); | ||
} | ||
var bridgeEventData = event === null || event === void 0 ? void 0 : event.data; | ||
if (!IS_WEB || !bridgeEventData) { | ||
return; | ||
} | ||
if (IS_REACT_NATIVE_WEBVIEW && typeof bridgeEventData === 'string') { | ||
try { | ||
bridgeEventData = JSON.parse(bridgeEventData); | ||
} | ||
catch (_a) { } | ||
} | ||
var type = bridgeEventData.type, data = bridgeEventData.data, frameId = bridgeEventData.frameId; | ||
if (!type) { | ||
return; | ||
} | ||
if (type && type === 'SetSupportedHandlers') { | ||
webSdkHandlers = data.supportedHandlers; | ||
return; | ||
} | ||
if (type && type === 'VKWebAppSettings') { | ||
webFrameId = frameId; | ||
return; | ||
} | ||
__spreadArrays(subscribers).map(function (fn) { return fn({ detail: { type: type, data: data } }); }); | ||
} | ||
// Subscribes to listening messages from a runtime for calling each | ||
// subscribed event listener. | ||
if (typeof window !== 'undefined' && 'addEventListener' in window) { | ||
window.addEventListener(EVENT_TYPE, function (event) { | ||
if (IS_IOS_WEBVIEW || IS_ANDROID_WEBVIEW) { | ||
// If it's webview | ||
return __spreadArrays(subscribers).map(function (fn) { return fn.call(null, event); }); | ||
} | ||
else if (IS_WEB && event && event.data) { | ||
// If it's web | ||
var _a = event.data, type_1 = _a.type, data_1 = _a.data, frameId = _a.frameId; | ||
if (type_1 && type_1 === 'SetSupportedHandlers') { | ||
webSdkHandlers = data_1.supportedHandlers; | ||
} | ||
else if (type_1 && type_1 === 'VKWebAppSettings') { | ||
webFrameId = frameId; | ||
} | ||
else { | ||
__spreadArrays(subscribers).map(function (fn) { return fn({ detail: { type: type_1, data: data_1 } }); }); | ||
} | ||
} | ||
}); | ||
window.addEventListener(EVENT_TYPE, handleEvent); | ||
} | ||
if (IS_REACT_NATIVE_WEBVIEW && /(android)/i.test(navigator.userAgent)) { | ||
document.addEventListener(EVENT_TYPE, handleEvent); | ||
} | ||
/** | ||
@@ -382,3 +405,3 @@ * Enhanced send functions for the ability to receive response data in | ||
var version = "2.5.1"; | ||
var version = "2.5.2-alpha-supported-RN-postMessage"; | ||
@@ -385,0 +408,0 @@ var EGrantedPermission; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __rest(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function __spreadArrays(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],p=0,a=i.length;p<a;p++,o++)r[o]=i[p];return r}function createCounter(){return{current:0,next:function(){return++this.current}}}function createRequestResolver(){var r=createCounter(),o={};return{add:function(e,n){var t=null!=n?n:r.next();return o[t]=e,t},resolve:function(e,n,t){var r=o[e];r&&(t(n)?r.resolve(n):r.reject(n),o[e]=null)}}}function promisifySend(i,e){var p=createRequestResolver();return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var n=e.detail.data,t=n.request_id,r=__rest(n,["request_id"]);t&&p.resolve(t,r,function(e){return!("error_type"in e)})}}),function(r,o){return void 0===o&&(o={}),new Promise(function(e,n){var t=p.add({resolve:e,reject:n},o.request_id);i(r,__assign(__assign({},o),{request_id:t}))})}}var webSdkHandlers,IS_CLIENT_SIDE="undefined"!=typeof window,IS_ANDROID_WEBVIEW=Boolean(IS_CLIENT_SIDE&&window.AndroidBridge),IS_IOS_WEBVIEW=Boolean(IS_CLIENT_SIDE&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),IS_WEB=IS_CLIENT_SIDE&&!IS_ANDROID_WEBVIEW&&!IS_IOS_WEBVIEW,IS_MVK=IS_WEB&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),IS_DESKTOP_VK=IS_WEB&&!IS_MVK,EVENT_TYPE=IS_WEB?"message":"VKWebAppEvent",DESKTOP_METHODS=__spreadArrays(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],IS_DESKTOP_VK?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),androidBridge=IS_CLIENT_SIDE?window.AndroidBridge:void 0,iosBridge=IS_IOS_WEBVIEW?window.webkit.messageHandlers:void 0;function createVKBridge(t){var i=void 0,p=[];function e(e){p.push(e)}function n(){return IS_IOS_WEBVIEW||IS_ANDROID_WEBVIEW}function r(){return IS_WEB&&window.parent!==window}function o(){return n()||r()}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(EVENT_TYPE,function(n){if(IS_IOS_WEBVIEW||IS_ANDROID_WEBVIEW)return __spreadArrays(p).map(function(e){return e.call(null,n)});if(IS_WEB&&n&&n.data){var e=n.data,t=e.type,r=e.data,o=e.frameId;t&&"SetSupportedHandlers"===t?webSdkHandlers=r.supportedHandlers:t&&"VKWebAppSettings"===t?i=o:__spreadArrays(p).map(function(e){return e({detail:{type:t,data:r}})})}});var a=promisifySend(function(e,n){androidBridge&&androidBridge[e]?androidBridge[e](JSON.stringify(n)):iosBridge&&iosBridge[e]&&"function"==typeof iosBridge[e].postMessage?iosBridge[e].postMessage(n):IS_WEB&&parent.postMessage({handler:e,params:n,type:"vk-connect",webFrameId:i,connectVersion:t},"*")},e);return{send:a,sendPromise:a,subscribe:e,unsubscribe:function(e){var n=p.indexOf(e);-1<n&&p.splice(n,1)},supports:function(e){return IS_ANDROID_WEBVIEW?!(!androidBridge||"function"!=typeof androidBridge[e]):IS_IOS_WEBVIEW?!(!iosBridge||!iosBridge[e]||"function"!=typeof iosBridge[e].postMessage):!!IS_WEB&&-1<DESKTOP_METHODS.indexOf(e)},isWebView:n,isIframe:r,isEmbedded:o,isStandalone:function(){return!o()}}}function createCustomEventPolyfill(){function e(e,n){var t=n||{bubbles:!1,cancelable:!1,detail:void 0},r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),r}return e.prototype=Event.prototype,e}var version="2.5.1";function applyMiddleware(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r.includes(void 0)||r.includes(null)?applyMiddleware.apply(void 0,r.filter(function(e){return"function"==typeof e})):function(t){if(0===r.length)return t;var e,n={subscribe:t.subscribe,send:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.send.apply(t,e)}};return e=r.filter(function(e){return"function"==typeof e}).map(function(e){return e(n)}).reduce(function(n,t){return function(e){return n(t(e))}})(t.send),__assign(__assign({},t),{send:e})}}!function(e){e.CAMERA="camera",e.LOCATION="location",e.PHOTO="photo"}(exports.EGrantedPermission||(exports.EGrantedPermission={})),function(e){e.RU="ru",e.UK="uk",e.UA="ua",e.EN="en",e.BE="be",e.KZ="kz",e.PT="pt",e.ES="es"}(exports.EGetLaunchParamsResponseLanguages||(exports.EGetLaunchParamsResponseLanguages={})),function(e){e.ADMIN="admin",e.EDITOR="editor",e.MEMBER="member",e.MODER="moder",e.NONE="none"}(exports.EGetLaunchParamsResponseGroupRole||(exports.EGetLaunchParamsResponseGroupRole={})),function(e){e.DESKTOP_WEB="desktop_web",e.MOBILE_WEB="mobile_web",e.MOBILE_ANDROID="mobile_android",e.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",e.MOBILE_IPHONE="mobile_iphone",e.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",e.MOBILE_IPAD="mobile_ipad"}(exports.EGetLaunchParamsResponsePlatforms||(exports.EGetLaunchParamsResponsePlatforms={})),"undefined"==typeof window||window.CustomEvent||(window.CustomEvent=createCustomEventPolyfill());var bridge=createVKBridge(version);exports.applyMiddleware=applyMiddleware,exports.default=bridge; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __rest(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function __spreadArrays(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],p=0,a=i.length;p<a;p++,o++)r[o]=i[p];return r}function createCounter(){return{current:0,next:function(){return++this.current}}}function createRequestResolver(){var r=createCounter(),o={};return{add:function(e,n){var t=null!=n?n:r.next();return o[t]=e,t},resolve:function(e,n,t){var r=o[e];r&&(t(n)?r.resolve(n):r.reject(n),o[e]=null)}}}function promisifySend(i,e){var p=createRequestResolver();return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var n=e.detail.data,t=n.request_id,r=__rest(n,["request_id"]);t&&p.resolve(t,r,function(e){return!("error_type"in e)})}}),function(r,o){return void 0===o&&(o={}),new Promise(function(e,n){var t=p.add({resolve:e,reject:n},o.request_id);i(r,__assign(__assign({},o),{request_id:t}))})}}var webSdkHandlers,IS_CLIENT_SIDE="undefined"!=typeof window,IS_ANDROID_WEBVIEW=Boolean(IS_CLIENT_SIDE&&window.AndroidBridge),IS_IOS_WEBVIEW=Boolean(IS_CLIENT_SIDE&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),IS_REACT_NATIVE_WEBVIEW=Boolean(window.ReactNativeWebView&&"function"==typeof window.ReactNativeWebView.postMessage),IS_WEB=IS_CLIENT_SIDE&&!IS_ANDROID_WEBVIEW&&!IS_IOS_WEBVIEW,IS_MVK=IS_WEB&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),IS_DESKTOP_VK=IS_WEB&&!IS_MVK,EVENT_TYPE=IS_WEB?"message":"VKWebAppEvent",DESKTOP_METHODS=__spreadArrays(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],IS_DESKTOP_VK?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),androidBridge=IS_CLIENT_SIDE?window.AndroidBridge:void 0,iosBridge=IS_IOS_WEBVIEW?window.webkit.messageHandlers:void 0;function createVKBridge(t){var i=void 0,p=[];function e(e){p.push(e)}function n(){return IS_IOS_WEBVIEW||IS_ANDROID_WEBVIEW}function r(){return IS_WEB&&window.parent!==window}function o(){return n()||r()}function a(n){if(IS_IOS_WEBVIEW||IS_ANDROID_WEBVIEW)return __spreadArrays(p).map(function(e){return e.call(null,n)});var e=null==n?void 0:n.data;if(IS_WEB&&e){if(IS_REACT_NATIVE_WEBVIEW&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}var t=e.type,r=e.data,o=e.frameId;t&&(t&&"SetSupportedHandlers"===t?webSdkHandlers=r.supportedHandlers:t&&"VKWebAppSettings"===t?i=o:__spreadArrays(p).map(function(e){return e({detail:{type:t,data:r}})}))}}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(EVENT_TYPE,a),IS_REACT_NATIVE_WEBVIEW&&/(android)/i.test(navigator.userAgent)&&document.addEventListener(EVENT_TYPE,a);var s=promisifySend(function(e,n){androidBridge&&androidBridge[e]?androidBridge[e](JSON.stringify(n)):iosBridge&&iosBridge[e]&&"function"==typeof iosBridge[e].postMessage?iosBridge[e].postMessage(n):IS_REACT_NATIVE_WEBVIEW?window.ReactNativeWebView.postMessage(JSON.stringify({handler:e,params:n})):IS_WEB&&parent.postMessage({handler:e,params:n,type:"vk-connect",webFrameId:i,connectVersion:t},"*")},e);return{send:s,sendPromise:s,subscribe:e,unsubscribe:function(e){var n=p.indexOf(e);-1<n&&p.splice(n,1)},supports:function(e){return IS_ANDROID_WEBVIEW?!(!androidBridge||"function"!=typeof androidBridge[e]):IS_IOS_WEBVIEW?!(!iosBridge||!iosBridge[e]||"function"!=typeof iosBridge[e].postMessage):!!IS_WEB&&-1<DESKTOP_METHODS.indexOf(e)},isWebView:n,isIframe:r,isEmbedded:o,isStandalone:function(){return!o()}}}function createCustomEventPolyfill(){function e(e,n){var t=n||{bubbles:!1,cancelable:!1,detail:void 0},r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),r}return e.prototype=Event.prototype,e}var version="2.5.2-alpha-supported-RN-postMessage";function applyMiddleware(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r.includes(void 0)||r.includes(null)?applyMiddleware.apply(void 0,r.filter(function(e){return"function"==typeof e})):function(t){if(0===r.length)return t;var e,n={subscribe:t.subscribe,send:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.send.apply(t,e)}};return e=r.filter(function(e){return"function"==typeof e}).map(function(e){return e(n)}).reduce(function(n,t){return function(e){return n(t(e))}})(t.send),__assign(__assign({},t),{send:e})}}!function(e){e.CAMERA="camera",e.LOCATION="location",e.PHOTO="photo"}(exports.EGrantedPermission||(exports.EGrantedPermission={})),function(e){e.RU="ru",e.UK="uk",e.UA="ua",e.EN="en",e.BE="be",e.KZ="kz",e.PT="pt",e.ES="es"}(exports.EGetLaunchParamsResponseLanguages||(exports.EGetLaunchParamsResponseLanguages={})),function(e){e.ADMIN="admin",e.EDITOR="editor",e.MEMBER="member",e.MODER="moder",e.NONE="none"}(exports.EGetLaunchParamsResponseGroupRole||(exports.EGetLaunchParamsResponseGroupRole={})),function(e){e.DESKTOP_WEB="desktop_web",e.MOBILE_WEB="mobile_web",e.MOBILE_ANDROID="mobile_android",e.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",e.MOBILE_IPHONE="mobile_iphone",e.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",e.MOBILE_IPAD="mobile_ipad"}(exports.EGetLaunchParamsResponsePlatforms||(exports.EGetLaunchParamsResponsePlatforms={})),"undefined"==typeof window||window.CustomEvent||(window.CustomEvent=createCustomEventPolyfill());var bridge=createVKBridge(version);exports.applyMiddleware=applyMiddleware,exports.default=bridge; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).vkBridge={})}(this,function(e){"use strict";var a=function(){return(a=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function s(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var o=Array(e),r=0;for(n=0;n<t;n++)for(var p=arguments[n],i=0,a=p.length;i<a;i++,r++)o[r]=p[i];return o}function u(p,e){var o,r,i=(o={current:0,next:function(){return++this.current}},r={},{add:function(e,n){var t=null!=n?n:o.next();return r[t]=e,t},resolve:function(e,n,t){var o=r[e];o&&(t(n)?o.resolve(n):o.reject(n),r[e]=null)}});return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var n=e.detail.data,t=n.request_id,o=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}(n,["request_id"]);t&&i.resolve(t,o,function(e){return!("error_type"in e)})}}),function(o,r){return void 0===r&&(r={}),new Promise(function(e,n){var t=i.add({resolve:e,reject:n},r.request_id);p(o,a(a({},r),{request_id:t}))})}}var n="undefined"!=typeof window,d=Boolean(n&&window.AndroidBridge),l=Boolean(n&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),b=n&&!d&&!l,t=b&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),c=b?"message":"VKWebAppEvent",f=s(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],b&&!t?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),A=n?window.AndroidBridge:void 0,m=l?window.webkit.messageHandlers:void 0;var o,r,p,i;function W(e,n){var t=n||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent");return o.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),o}(o=e.EGrantedPermission||(e.EGrantedPermission={})).CAMERA="camera",o.LOCATION="location",o.PHOTO="photo",(r=e.EGetLaunchParamsResponseLanguages||(e.EGetLaunchParamsResponseLanguages={})).RU="ru",r.UK="uk",r.UA="ua",r.EN="en",r.BE="be",r.KZ="kz",r.PT="pt",r.ES="es",(p=e.EGetLaunchParamsResponseGroupRole||(e.EGetLaunchParamsResponseGroupRole={})).ADMIN="admin",p.EDITOR="editor",p.MEMBER="member",p.MODER="moder",p.NONE="none",(i=e.EGetLaunchParamsResponsePlatforms||(e.EGetLaunchParamsResponsePlatforms={})).DESKTOP_WEB="desktop_web",i.MOBILE_WEB="mobile_web",i.MOBILE_ANDROID="mobile_android",i.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",i.MOBILE_IPHONE="mobile_iphone",i.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",i.MOBILE_IPAD="mobile_ipad","undefined"==typeof window||window.CustomEvent||(window.CustomEvent=(W.prototype=Event.prototype,W));var w=function(t){var p=void 0,i=[];function e(e){i.push(e)}function n(){return l||d}function o(){return b&&window.parent!==window}function r(){return n()||o()}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(c,function(n){if(l||d)return s(i).map(function(e){return e.call(null,n)});if(b&&n&&n.data){var e=n.data,t=e.type,o=e.data,r=e.frameId;t&&"SetSupportedHandlers"===t?o.supportedHandlers:t&&"VKWebAppSettings"===t?p=r:s(i).map(function(e){return e({detail:{type:t,data:o}})})}});var a=u(function(e,n){A&&A[e]?A[e](JSON.stringify(n)):m&&m[e]&&"function"==typeof m[e].postMessage?m[e].postMessage(n):b&&parent.postMessage({handler:e,params:n,type:"vk-connect",webFrameId:p,connectVersion:t},"*")},e);return{send:a,sendPromise:a,subscribe:e,unsubscribe:function(e){var n=i.indexOf(e);-1<n&&i.splice(n,1)},supports:function(e){return d?!(!A||"function"!=typeof A[e]):l?!(!m||!m[e]||"function"!=typeof m[e].postMessage):b&&-1<f.indexOf(e)},isWebView:n,isIframe:o,isEmbedded:r,isStandalone:function(){return!r()}}}("2.5.1");e.applyMiddleware=function e(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];return o.includes(void 0)||o.includes(null)?e.apply(void 0,o.filter(function(e){return"function"==typeof e})):function(t){if(0===o.length)return t;var e,n={subscribe:t.subscribe,send:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.send.apply(t,e)}};return e=o.filter(function(e){return"function"==typeof e}).map(function(e){return e(n)}).reduce(function(n,t){return function(e){return n(t(e))}})(t.send),a(a({},t),{send:e})}},e.default=w,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).vkBridge={})}(this,function(e){"use strict";var a=function(){return(a=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function u(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var o=Array(e),r=0;for(n=0;n<t;n++)for(var p=arguments[n],i=0,a=p.length;i<a;i++,r++)o[r]=p[i];return o}function d(p,e){var o,r,i=(o={current:0,next:function(){return++this.current}},r={},{add:function(e,n){var t=null!=n?n:o.next();return r[t]=e,t},resolve:function(e,n,t){var o=r[e];o&&(t(n)?o.resolve(n):o.reject(n),r[e]=null)}});return e(function(e){if(e.detail&&e.detail.data&&"object"==typeof e.detail.data&&"request_id"in e.detail.data){var n=e.detail.data,t=n.request_id,o=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}(n,["request_id"]);t&&i.resolve(t,o,function(e){return!("error_type"in e)})}}),function(o,r){return void 0===r&&(r={}),new Promise(function(e,n){var t=i.add({resolve:e,reject:n},r.request_id);p(o,a(a({},r),{request_id:t}))})}}var n="undefined"!=typeof window,l=Boolean(n&&window.AndroidBridge),b=Boolean(n&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.VKWebAppClose),c=Boolean(window.ReactNativeWebView&&"function"==typeof window.ReactNativeWebView.postMessage),f=n&&!l&&!b,t=f&&/(^\?|&)vk_platform=mobile_web(&|$)/.test(location.search),A=f?"message":"VKWebAppEvent",w=u(["VKWebAppInit","VKWebAppGetCommunityAuthToken","VKWebAppAddToCommunity","VKWebAppAddToHomeScreenInfo","VKWebAppClose","VKWebAppCopyText","VKWebAppCreateHash","VKWebAppGetUserInfo","VKWebAppSetLocation","VKWebAppSendToClient","VKWebAppGetClientVersion","VKWebAppGetPhoneNumber","VKWebAppGetEmail","VKWebAppGetGroupInfo","VKWebAppGetGeodata","VKWebAppGetCommunityToken","VKWebAppGetConfig","VKWebAppGetLaunchParams","VKWebAppSetTitle","VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppJoinGroup","VKWebAppLeaveGroup","VKWebAppAllowMessagesFromGroup","VKWebAppDenyNotifications","VKWebAppAllowNotifications","VKWebAppOpenPayForm","VKWebAppOpenApp","VKWebAppShare","VKWebAppShowWallPostBox","VKWebAppScroll","VKWebAppShowOrderBox","VKWebAppShowLeaderBoardBox","VKWebAppShowInviteBox","VKWebAppShowRequestBox","VKWebAppAddToFavorites","VKWebAppShowCommunityWidgetPreviewBox","VKWebAppShowStoryBox","VKWebAppStorageGet","VKWebAppStorageGetKeys","VKWebAppStorageSet","VKWebAppFlashGetInfo","VKWebAppSubscribeStoryApp","VKWebAppOpenWallPost","VKWebAppCheckAllowedScopes","VKWebAppShowNativeAds","VKWebAppRetargetingPixel","VKWebAppConversionHit"],f&&!t?["VKWebAppResizeWindow","VKWebAppAddToMenu","VKWebAppShowSubscriptionBox","VKWebAppShowInstallPushBox","VKWebAppGetFriends"]:["VKWebAppShowImages"]),W=n?window.AndroidBridge:void 0,m=b?window.webkit.messageHandlers:void 0;var o,r,p,i;function s(e,n){var t=n||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent");return o.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail),o}(o=e.EGrantedPermission||(e.EGrantedPermission={})).CAMERA="camera",o.LOCATION="location",o.PHOTO="photo",(r=e.EGetLaunchParamsResponseLanguages||(e.EGetLaunchParamsResponseLanguages={})).RU="ru",r.UK="uk",r.UA="ua",r.EN="en",r.BE="be",r.KZ="kz",r.PT="pt",r.ES="es",(p=e.EGetLaunchParamsResponseGroupRole||(e.EGetLaunchParamsResponseGroupRole={})).ADMIN="admin",p.EDITOR="editor",p.MEMBER="member",p.MODER="moder",p.NONE="none",(i=e.EGetLaunchParamsResponsePlatforms||(e.EGetLaunchParamsResponsePlatforms={})).DESKTOP_WEB="desktop_web",i.MOBILE_WEB="mobile_web",i.MOBILE_ANDROID="mobile_android",i.MOBILE_ANDROID_MESSENGER="mobile_android_messenger",i.MOBILE_IPHONE="mobile_iphone",i.MOBILE_IPHONE_MESSENGER="mobile_iphone_messenger",i.MOBILE_IPAD="mobile_ipad","undefined"==typeof window||window.CustomEvent||(window.CustomEvent=(s.prototype=Event.prototype,s));var V=function(t){var p=void 0,i=[];function e(e){i.push(e)}function n(){return b||l}function o(){return f&&window.parent!==window}function r(){return n()||o()}function a(n){if(b||l)return u(i).map(function(e){return e.call(null,n)});var e=null==n?void 0:n.data;if(f&&e){if(c&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}var t=e.type,o=e.data,r=e.frameId;t&&(t&&"SetSupportedHandlers"===t?o.supportedHandlers:t&&"VKWebAppSettings"===t?p=r:u(i).map(function(e){return e({detail:{type:t,data:o}})}))}}"undefined"!=typeof window&&"addEventListener"in window&&window.addEventListener(A,a),c&&/(android)/i.test(navigator.userAgent)&&document.addEventListener(A,a);var s=d(function(e,n){W&&W[e]?W[e](JSON.stringify(n)):m&&m[e]&&"function"==typeof m[e].postMessage?m[e].postMessage(n):c?window.ReactNativeWebView.postMessage(JSON.stringify({handler:e,params:n})):f&&parent.postMessage({handler:e,params:n,type:"vk-connect",webFrameId:p,connectVersion:t},"*")},e);return{send:s,sendPromise:s,subscribe:e,unsubscribe:function(e){var n=i.indexOf(e);-1<n&&i.splice(n,1)},supports:function(e){return l?!(!W||"function"!=typeof W[e]):b?!(!m||!m[e]||"function"!=typeof m[e].postMessage):f&&-1<w.indexOf(e)},isWebView:n,isIframe:o,isEmbedded:r,isStandalone:function(){return!r()}}}("2.5.2-alpha-supported-RN-postMessage");e.applyMiddleware=function e(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];return o.includes(void 0)||o.includes(null)?e.apply(void 0,o.filter(function(e){return"function"==typeof e})):function(t){if(0===o.length)return t;var e,n={subscribe:t.subscribe,send:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.send.apply(t,e)}};return e=o.filter(function(e){return"function"==typeof e}).map(function(e){return e(n)}).reduce(function(n,t){return function(e){return n(t(e))}})(t.send),a(a({},t),{send:e})}},e.default=V,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -8,2 +8,3 @@ import { VKBridge } from './types/bridge'; | ||
export declare const IS_IOS_WEBVIEW: boolean; | ||
export declare const IS_REACT_NATIVE_WEBVIEW: boolean; | ||
/** Is the runtime environment a browser */ | ||
@@ -10,0 +11,0 @@ export declare const IS_WEB: boolean; |
{ | ||
"name": "@vkontakte/vk-bridge", | ||
"version": "2.5.1", | ||
"version": "2.5.2-alpha-supported-RN-postMessage", | ||
"description": "Connects a Mini App with VK client", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349148
2164
2