webtonative 1.0.8 → 1.0.19
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/AppReview/index.js +1 -0
- package/AppsFlyer/index.js +4 -0
- package/BackgroundLocation/index.js +4 -0
- package/BottomNavigation/index.js +4 -0
- package/Clipboard/index.js +4 -0
- package/Facebook/events.js +4 -0
- package/FirebaseAnalytics/events.js +4 -0
- package/NativeContacts/index.js +4 -0
- package/OneSignal/index.js +1 -1
- package/Screen/index.js +4 -0
- package/SocialLogin/apple.js +1 -0
- package/SocialLogin/facebook.js +9 -0
- package/SocialLogin/google.js +9 -0
- package/SocialLogin/index.js +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/utills.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.prompt=void 0;var _utills=require("../utills"),prompt=function(){0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"showAppRating"})};exports.prompt=prompt;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setCustomerUserId=exports.logEvent=void 0;var _utills=require("../utills"),setCustomerUserId=function(a){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&("ANDROID_APP"===_utills.platform&&_utills.webToNative.setAppsFlyerUserId(a),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setAppsFlyerUserId",userId:a}))};exports.setCustomerUserId=setCustomerUserId;/**
|
|
2
|
+
*
|
|
3
|
+
* @example wtn.appsflyer.setCustomerUserId("ADD_TO_CART",{name:"Cadburry",quantity:1});
|
|
4
|
+
*/var logEvent=function(a,b){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&("ANDROID_APP"===_utills.platform&&_utills.webToNative.addEventToAppsFlyer(a,b),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"addEventToAppsFlyer",eventName:a,eventValues:b}))};exports.logEvent=logEvent;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.stop=exports.start=void 0;var _utills=require("../utills"),start=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.data,c=a.callback,d=a.backgroundIndicator,e=a.pauseAutomatically,f=a.distanceFilter,g=void 0===f?0:f,h=a.desiredAccuracy,i=void 0===h?"best":h,j=a.activityType,k=void 0===j?"other":j,l=a.apiUrl,m=a.timeout;(0,_utills.registerCb)(function(a){var b=a.type;"LOCATION_UPDATE"===b&&c&&c(a)},{key:"LOCATION_UPDATE",ignoreDelete:!0}),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"startLocation",data:b,backgroundIndicator:void 0!==d&&d,pauseAutomatically:!(void 0!==e)||e,distanceFilter:g,desiredAccuracy:i,activityType:k,apiUrl:l,timeout:m})}};exports.start=start;/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/var stop=function(){0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&((0,_utills.deRegisterCbByKey)("LOCATION_UPDATE"),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"stopLocation"}))};exports.stop=stop;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.show=exports.hide=void 0;var _utills=require("../utills"),hide=function(){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"showHideStickyFooter",show:!1})};exports.hide=hide;/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/var show=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.key;["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"showHideStickyFooter",show:!0,key:b})};exports.show=show;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.set=exports.get=void 0;var _utills=require("../utills"),get=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.callback;["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&((0,_utills.registerCb)(function(a){var c=a.type;"CLIPBOARD_CONTENT"===c&&b&&b(a)}),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"getClipBoardData"}))};exports.get=get;/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/var set=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setClipBoardData",text:a.data||""})};exports.set=set;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sendPurchase=exports.send=void 0;var _utills=require("../utills"),send=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.event,c=a.valueToSum,d=a.parameters;"ANDROID_APP"===_utills.platform&&_utills.webToNative.addFbEvents(b,d),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"sendFBEvent",eventName:b,valueToSum:c,parameters:d})}};exports.send=send;/**
|
|
2
|
+
*
|
|
3
|
+
* @example wtn.appsflyer.setCustomerUserId("ADD_TO_CART",{name:"Cadburry",quantity:1});
|
|
4
|
+
*/var sendPurchase=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.amount,c=a.currency,d=a.parameters;"ANDROID_APP"===_utills.platform&&_utills.webToNative.addFbPurchaseEvent(b,c,d),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"sendFBPurchaseEvent",currency:c,amount:b,parameters:d})}};exports.sendPurchase=sendPurchase;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setUserProperty=exports.setUserId=exports.setDefaultEventParameters=exports.setCollection=exports.logScreen=exports.logEvent=void 0;var _utills=require("../utills"),setCollection=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.enabled;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setFirebaseAnalyticsCollection",enabled:b})}};exports.setCollection=setCollection;/**
|
|
2
|
+
*
|
|
3
|
+
* @example wtn.appsflyer.setCustomerUserId("ADD_TO_CART",{name:"Cadburry",quantity:1});
|
|
4
|
+
*/var setUserId=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.userId;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setFirebaseUserId",userId:b})}};exports.setUserId=setUserId;var setUserProperty=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.key,c=a.value;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setFirebaseUserProp",key:b,value:c})}};exports.setUserProperty=setUserProperty;var setDefaultEventParameters=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.parameters;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setFirebaseDefaultParam",parameters:b})}};exports.setDefaultEventParameters=setDefaultEventParameters;var logEvent=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.eventName,c=a.parameters;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"logFirebaseEvent",eventName:b,parameters:c})}};exports.logEvent=logEvent;var logScreen=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.screenName,c=a.screenClass;"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"logFirebaseScreenView",screenName:b,screenClass:c})}};exports.logScreen=logScreen;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPermissionStatus=exports.getAll=void 0;var _utills=require("../utills"),getPermissionStatus=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.callback;["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&((0,_utills.registerCb)(function(a){console.log(a);var c=a.type;"contactPermissionStatus"===c&&b&&b(a)}),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"askUserForContactPermission"}))};exports.getPermissionStatus=getPermissionStatus;/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/var getAll=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.callback;["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&((0,_utills.registerCb)(function(a){var c=a.type;console.log(a),"contactDetails"===c&&b&&b(a)}),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"getUserContactDetails"}))};exports.getAll=getAll;
|
package/OneSignal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setExternalUserId=exports.removeExternalUserId=exports.getPlayerId=void 0;var _utills=require("../utills"),getPlayerId=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){c.isSuccess?a(c.playerId):b(c)},{key:"getPlayerId"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.getOneSignalId():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"getPlayerId"}):b("This function will work in Native App Powered By WebToNative")})};exports.getPlayerId=getPlayerId;var setExternalUserId=function(a){if(a){if("ANDROID_APP"===_utills.platform)return _utills.isNativeApp&&_utills.webToNative.setExternalUserId(a);"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setExternalUserId",userId:a})}throw"userId is required"};exports.setExternalUserId=setExternalUserId;var removeExternalUserId=function(){return"ANDROID_APP"===_utills.platform?_utills.isNativeApp&&_utills.webToNative.removeExternalUserId():void("IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"removeExternalUserId"}))};exports.removeExternalUserId=removeExternalUserId;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setTags=exports.setExternalUserId=exports.removeExternalUserId=exports.getPlayerId=void 0;var _utills=require("../utills"),getPlayerId=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){c.isSuccess?a(c.playerId):b(c)},{key:"getPlayerId"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.getOneSignalId():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"getPlayerId"}):b("This function will work in Native App Powered By WebToNative")})};exports.getPlayerId=getPlayerId;var setExternalUserId=function(a){if(a){if("ANDROID_APP"===_utills.platform)return _utills.isNativeApp&&_utills.webToNative.setExternalUserId(a);"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setExternalUserId",userId:a})}else throw"userId is required"};exports.setExternalUserId=setExternalUserId;var removeExternalUserId=function(){return"ANDROID_APP"===_utills.platform?_utills.isNativeApp&&_utills.webToNative.removeExternalUserId():void("IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"removeExternalUserId"}))};exports.removeExternalUserId=removeExternalUserId;var setTags=function(a){var b=a.tags;return"ANDROID_APP"===_utills.platform?_utills.isNativeApp&&_utills.webToNative.setUserTags(b):void("IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"setUserTags",tags:b}))};exports.setTags=setTags;
|
package/Screen/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.keepScreenOn=exports.keepScreenNormal=void 0;var _utills=require("../utills"),keepScreenOn=function(){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"keepScreenOn",flag:!0})};exports.keepScreenOn=keepScreenOn;/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/var keepScreenNormal=function(){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"keepScreenOn",flag:!1})};exports.keepScreenNormal=keepScreenNormal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.login=void 0;var _utills=require("../utills"),login=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.scope;(0,_utills.registerCb)(function(a){var c=a.type;"appleLoginToken"===c&&b&&b(a)}),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"appleSignIn",scope:c})}};exports.login=login;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.logout=exports.login=void 0;var _utills=require("../utills"),login=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.scope;(0,_utills.registerCb)(function(a){var c=a.type;"fbLoginToken"===c&&b&&b(a)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.loginWithFacebook(),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"fbSignIn",scope:c})}};exports.login=login;/**
|
|
2
|
+
* This function handles native facebook logout
|
|
3
|
+
* @param {object} options
|
|
4
|
+
* @example wtn.socialLogin.facebook.logout({
|
|
5
|
+
* callback:(data)=>{
|
|
6
|
+
* console.log(data);
|
|
7
|
+
* }
|
|
8
|
+
* });
|
|
9
|
+
*/var logout=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.scope;(0,_utills.registerCb)(function(a){var c=a.type;"fbLogOut"===c&&b&&b(a)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.logoutWithFacebook(),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"fbSignOut",scope:c})}};exports.logout=logout;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.logout=exports.login=void 0;var _utills=require("../utills"),login=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.scope;(0,_utills.registerCb)(function(a){var c=a.type;"googleLoginToken"===c&&b&&b(a)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.signInWithGoogle(),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"googleSignIn",scope:c})}};exports.login=login;/**
|
|
2
|
+
* This function handles native google logout
|
|
3
|
+
* @param {object} options
|
|
4
|
+
* @example wtn.socialLogin.google.logout({
|
|
5
|
+
* callback:(data)=>{
|
|
6
|
+
* console.log(data);
|
|
7
|
+
* }
|
|
8
|
+
* });
|
|
9
|
+
*/var logout=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.scope;(0,_utills.registerCb)(function(a){var c=a.type;"googleLogOut"===c&&b&&b(a)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.signOutWithGoogle(),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"googleSignOut",scope:c})}};exports.logout=logout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.socialLogin=void 0;var _facebook=require("./facebook"),_apple=require("./apple"),_google=require("./google"),socialLogin={facebook:{login:_facebook.login,logout:_facebook.logout},google:{login:_google.login,logout:_google.logout},apple:{login:_apple.login}};exports.socialLogin=socialLogin;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIosApp=exports.isAndroidApp=exports.hideSplashScreen=exports.deviceInfo=exports["default"]=void 0,Object.defineProperty(exports,"isNativeApp",{enumerable:!0,get:function get(){return _utills.isNativeApp}}),Object.defineProperty(exports,"platform",{enumerable:!0,get:function get(){return _utills.platform}}),exports.statusBar=exports.showInAppReview=exports.shareLink=void 0;var _utills=require("./utills"),isAndroidApp="ANDROID_APP"===_utills.platform;exports.isAndroidApp=isAndroidApp;var isIosApp="IOS_APP"===_utills.platform;/**
|
|
2
2
|
* This function hides splash screen
|
|
3
3
|
* @example wtn.hideSplashScreen()
|
|
4
|
-
*/exports.isIosApp=isIosApp;var hideSplashScreen=function(){_utills.isNativeApp&&_utills.webToNative.hideSplashScreen()};exports.hideSplashScreen=hideSplashScreen;var statusBar=function(a){_utills.isNativeApp&&_utills.webToNative.statusBar(JSON.stringify(a))};exports.statusBar=statusBar;var deviceInfo=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){c?a(c):b({err:"Error getting device info"})},{key:"deviceInfo"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.getDeviceInfo():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"deviceInfo"}):b("This function will work in Native App Powered By WebToNative")})};exports.deviceInfo=deviceInfo;var showInAppReview=function(){_utills.isNativeApp&&_utills.webToNative.showInAppReview()};exports.showInAppReview=showInAppReview;var shareLink=function(a){var b=a.url,c=void 0===b?"":b;if(c)isAndroidApp&&_utills.webToNative.openShareIntent(c),isIosApp&&_utills.webToNativeIos.postMessage({action:"share",url:c});else throw"url is mandatory"};exports.shareLink=shareLink;var _default={isAndroidApp:isAndroidApp,isIosApp:isIosApp,hideSplashScreen:hideSplashScreen,statusBar:statusBar,deviceInfo:deviceInfo,showInAppReview:showInAppReview,shareLink:shareLink,platform:_utills.platform,isNativeApp:_utills.isNativeApp};exports["default"]=_default;
|
|
4
|
+
*/exports.isIosApp=isIosApp;var hideSplashScreen=function(){_utills.isNativeApp&&_utills.webToNative.hideSplashScreen()};exports.hideSplashScreen=hideSplashScreen;var statusBar=function(a){_utills.isNativeApp&&(isAndroidApp?_utills.webToNative.statusBar(JSON.stringify(a)):isIosApp&&_utills.webToNativeIos.postMessage({action:"statusBar",color:a.color,style:a.style}))};exports.statusBar=statusBar;var deviceInfo=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){c?a(c):b({err:"Error getting device info"})},{key:"deviceInfo"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.getDeviceInfo():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"deviceInfo"}):b("This function will work in Native App Powered By WebToNative")})};exports.deviceInfo=deviceInfo;var showInAppReview=function(){_utills.isNativeApp&&_utills.webToNative.showInAppReview()};exports.showInAppReview=showInAppReview;var shareLink=function(a){var b=a.url,c=void 0===b?"":b;if(c)isAndroidApp&&_utills.webToNative.openShareIntent(c),isIosApp&&_utills.webToNativeIos.postMessage({action:"share",url:c});else throw"url is mandatory"};exports.shareLink=shareLink;var _default={isAndroidApp:isAndroidApp,isIosApp:isIosApp,hideSplashScreen:hideSplashScreen,statusBar:statusBar,deviceInfo:deviceInfo,showInAppReview:showInAppReview,shareLink:shareLink,platform:_utills.platform,isNativeApp:_utills.isNativeApp};exports["default"]=_default;
|
package/package.json
CHANGED
package/utills.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.webToNativeIos=exports.webToNative=exports.registerForAbMobCb=exports.registerCb=exports.platform=exports.isNativeApp=exports.isClient=exports.deRegisterForAbMobCb=void 0;var isClient="undefined"!=typeof window;exports.isClient=isClient;var webToNative=isClient&&window.WebToNativeInterface||{};exports.webToNative=webToNative;var webToNativeIos=isClient&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.webToNativeInterface;exports.webToNativeIos=webToNativeIos;var platform=webToNative.getAndroidVersion?"ANDROID_APP":webToNativeIos?"IOS_APP":"WEBSITE";exports.platform=platform;var isNativeApp=isClient&&""!==platform;exports.isNativeApp=isNativeApp;var cbObj={},counter=1,abMobCb=null;isNativeApp&&(webToNative.androidCBHook=function(a){var b=JSON.parse(a),c=b.type;for(var d in cbObj)b&&b.reqType?d==b.reqType&&(cbObj[d].cb(b),delete cbObj[d]):(cbObj[d].cb(b),delete cbObj[d])},webToNative.androidAdMobCBHook=function(a){var b=JSON.parse(a);abMobCb&&abMobCb(b)},window.iosCBHook=function(a){var b=a;try{b=JSON.parse(a)}catch(a){}for(var c in cbObj)b&&b.reqType?c==b.reqType&&(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.webToNativeIos=exports.webToNative=exports.registerForAbMobCb=exports.registerCb=exports.platform=exports.isNativeApp=exports.isClient=exports.deRegisterForAbMobCb=exports.deRegisterCbByKey=void 0;var isClient="undefined"!=typeof window;exports.isClient=isClient;var webToNative=isClient&&window.WebToNativeInterface||{};exports.webToNative=webToNative;var webToNativeIos=isClient&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.webToNativeInterface;exports.webToNativeIos=webToNativeIos;var platform=webToNative.getAndroidVersion?"ANDROID_APP":webToNativeIos?"IOS_APP":"WEBSITE";exports.platform=platform;var isNativeApp=isClient&&"WEBSITE"!==platform;exports.isNativeApp=isNativeApp;var cbObj={},counter=1,abMobCb=null;isNativeApp&&(webToNative.androidCBHook=function(a){var b=JSON.parse(a),c=b.type;for(var d in cbObj)b&&b.reqType?d==b.reqType&&(cbObj[d].cb(b),delete cbObj[d]):(cbObj[d].cb(b),delete cbObj[d])},webToNative.androidAdMobCBHook=function(a){var b=JSON.parse(a);abMobCb&&abMobCb(b)},window.iosCBHook=function(a){var b=a;try{b=JSON.parse(a)}catch(a){console.log(a)}for(var c in cbObj){var d=cbObj[c],e=d.cb,f=d.ignoreDelete,g=void 0!==f&&f;b&&b.reqType?c==b.reqType&&(e(b),!g&&delete cbObj[c]):(e(b),!g&&delete cbObj[c])}});var registerCb=function(a,b){"function"==typeof a&&(b&&b.key?cbObj[b.key]={cb:a,ignoreDelete:!!b.ignoreDelete}:(cbObj[counter]={cb:a,ignoreDelete:!!(b&&b.ignoreDelete)},counter+=1))};exports.registerCb=registerCb;var registerForAbMobCb=function(a){"function"==typeof a&&(abMobCb=a)};exports.registerForAbMobCb=registerForAbMobCb;var deRegisterForAbMobCb=function(){abMobCb&&(abMobCb=null)};exports.deRegisterForAbMobCb=deRegisterForAbMobCb;var deRegisterCbByKey=function(a){delete cbObj[a]};exports.deRegisterCbByKey=deRegisterCbByKey;
|