react-native-google-mobile-ads 11.2.0 → 11.4.0
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/README.md +15 -0
- package/RNGoogleMobileAds.podspec +2 -2
- package/__tests__/banner.test.tsx +10 -0
- package/__tests__/googleMobileAds.test.ts +21 -0
- package/android/build.gradle +8 -0
- package/android/src/main/java/io/invertase/googlemobileads/OnNativeEvent.kt +21 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +21 -9
- package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +17 -15
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +7 -2
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.h +30 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +220 -0
- package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsBannerViewManager.m → RNGoogleMobileAdsBannerViewManager.mm} +13 -2
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +9 -1
- package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsModule.m → RNGoogleMobileAdsModule.mm} +46 -25
- package/jest.setup.ts +10 -0
- package/lib/commonjs/MobileAds.js +6 -8
- package/lib/commonjs/MobileAds.js.map +1 -1
- package/lib/commonjs/NativeGoogleMobileAdsModule.js +10 -0
- package/lib/commonjs/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/commonjs/ads/BaseAd.js +11 -13
- package/lib/commonjs/ads/BaseAd.js.map +1 -1
- package/lib/commonjs/ads/GAMBannerAd.js +3 -5
- package/lib/commonjs/ads/GAMBannerAd.js.map +1 -1
- package/lib/commonjs/ads/GoogleMobileAdsBannerViewNativeComponent.js +16 -0
- package/lib/commonjs/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/MobileAds.js +1 -4
- package/lib/module/MobileAds.js.map +1 -1
- package/lib/module/NativeGoogleMobileAdsModule.js +3 -0
- package/lib/module/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/module/ads/BaseAd.js +9 -12
- package/lib/module/ads/BaseAd.js.map +1 -1
- package/lib/module/ads/GAMBannerAd.js +3 -5
- package/lib/module/ads/GAMBannerAd.js.map +1 -1
- package/lib/module/ads/GoogleMobileAdsBannerViewNativeComponent.js +7 -0
- package/lib/module/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/MobileAds.d.ts +3 -3
- package/lib/typescript/MobileAds.d.ts.map +1 -1
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts +12 -0
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts.map +1 -0
- package/lib/typescript/ads/BaseAd.d.ts +1 -33
- package/lib/typescript/ads/BaseAd.d.ts.map +1 -1
- package/lib/typescript/ads/GAMBannerAd.d.ts.map +1 -1
- package/lib/typescript/ads/GoogleMobileAdsBannerViewNativeComponent.d.ts +27 -0
- package/lib/typescript/ads/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +11 -3
- package/src/MobileAds.ts +1 -4
- package/src/NativeGoogleMobileAdsModule.ts +14 -0
- package/src/ads/BaseAd.tsx +101 -116
- package/src/ads/GAMBannerAd.tsx +5 -8
- package/src/ads/GoogleMobileAdsBannerViewNativeComponent.ts +37 -0
- package/src/version.ts +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.h +0 -23
- package/lib/commonjs/types/GoogleMobileAdsNativeModule.js +0 -6
- package/lib/commonjs/types/GoogleMobileAdsNativeModule.js.map +0 -1
- package/lib/module/types/GoogleMobileAdsNativeModule.js +0 -2
- package/lib/module/types/GoogleMobileAdsNativeModule.js.map +0 -1
- package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +0 -9
- package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts.map +0 -1
- package/src/types/GoogleMobileAdsNativeModule.ts +0 -9
- /package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsCommon.m → RNGoogleMobileAdsCommon.mm} +0 -0
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
#import <React/RCTUtils.h>
|
|
22
22
|
|
|
23
23
|
#import "RNGoogleMobileAdsModule.h"
|
|
24
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
25
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
26
|
+
#endif
|
|
24
27
|
#import "common/RNSharedUtils.h"
|
|
25
28
|
|
|
26
29
|
@implementation RNGoogleMobileAdsModule
|
|
@@ -37,6 +40,41 @@ RCT_EXPORT_MODULE();
|
|
|
37
40
|
#pragma mark Google Mobile Ads Methods
|
|
38
41
|
|
|
39
42
|
RCT_EXPORT_METHOD(initialize : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
43
|
+
[self initialize:resolve reject:reject];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
RCT_EXPORT_METHOD(setRequestConfiguration
|
|
47
|
+
: (NSDictionary *)requestConfiguration
|
|
48
|
+
: (RCTPromiseResolveBlock)resolve
|
|
49
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
50
|
+
[self setRequestConfiguration:requestConfiguration resolve:resolve reject:reject];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_METHOD(openAdInspector
|
|
54
|
+
: (RCTPromiseResolveBlock)resolve
|
|
55
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
56
|
+
[self openAdInspector:resolve reject:reject];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) {
|
|
60
|
+
#if !TARGET_OS_MACCATALYST
|
|
61
|
+
GADDebugOptionsViewController *debugOptionsViewController =
|
|
62
|
+
[GADDebugOptionsViewController debugOptionsViewControllerWithAdUnitID:adUnit];
|
|
63
|
+
[RCTSharedApplication().delegate.window.rootViewController
|
|
64
|
+
presentViewController:debugOptionsViewController
|
|
65
|
+
animated:YES
|
|
66
|
+
completion:nil];
|
|
67
|
+
#endif
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
71
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
72
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
73
|
+
return std::make_shared<facebook::react::NativeGoogleMobileAdsModuleSpecJSI>(params);
|
|
74
|
+
}
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
- (void)initialize:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
40
78
|
#if !TARGET_OS_MACCATALYST
|
|
41
79
|
[[GADMobileAds sharedInstance]
|
|
42
80
|
startWithCompletionHandler:^(GADInitializationStatus *_Nonnull status) {
|
|
@@ -56,15 +94,9 @@ RCT_EXPORT_METHOD(initialize : (RCTPromiseResolveBlock)resolve : (RCTPromiseReje
|
|
|
56
94
|
#endif
|
|
57
95
|
}
|
|
58
96
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
63
|
-
[self setRequestConfiguration:requestConfiguration];
|
|
64
|
-
resolve([NSNull null]);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
- (void)setRequestConfiguration:(NSDictionary *)requestConfiguration {
|
|
97
|
+
- (void)setRequestConfiguration:(NSDictionary *)requestConfiguration
|
|
98
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
99
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
68
100
|
#if !TARGET_OS_MACCATALYST
|
|
69
101
|
if (requestConfiguration[@"maxAdContentRating"]) {
|
|
70
102
|
NSString *rating = requestConfiguration[@"maxAdContentRating"];
|
|
@@ -85,12 +117,12 @@ RCT_EXPORT_METHOD(setRequestConfiguration
|
|
|
85
117
|
|
|
86
118
|
if (requestConfiguration[@"tagForChildDirectedTreatment"]) {
|
|
87
119
|
BOOL tag = [requestConfiguration[@"tagForChildDirectedTreatment"] boolValue];
|
|
88
|
-
|
|
120
|
+
GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment = tag;
|
|
89
121
|
}
|
|
90
122
|
|
|
91
123
|
if (requestConfiguration[@"tagForUnderAgeOfConsent"]) {
|
|
92
124
|
BOOL tag = [requestConfiguration[@"tagForUnderAgeOfConsent"] boolValue];
|
|
93
|
-
|
|
125
|
+
GADMobileAds.sharedInstance.requestConfiguration.tagForUnderAgeOfConsent = tag;
|
|
94
126
|
}
|
|
95
127
|
|
|
96
128
|
if (requestConfiguration[@"testDeviceIdentifiers"]) {
|
|
@@ -104,12 +136,12 @@ RCT_EXPORT_METHOD(setRequestConfiguration
|
|
|
104
136
|
}
|
|
105
137
|
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = devices;
|
|
106
138
|
}
|
|
139
|
+
|
|
140
|
+
resolve([NSNull null]);
|
|
107
141
|
#endif
|
|
108
142
|
}
|
|
109
143
|
|
|
110
|
-
|
|
111
|
-
: (RCTPromiseResolveBlock)resolve
|
|
112
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
144
|
+
- (void)openAdInspector:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
113
145
|
#if !TARGET_OS_MACCATALYST
|
|
114
146
|
[GADMobileAds.sharedInstance
|
|
115
147
|
presentAdInspectorFromViewController:RCTSharedApplication().delegate.window.rootViewController
|
|
@@ -129,15 +161,4 @@ RCT_EXPORT_METHOD(openAdInspector
|
|
|
129
161
|
#endif
|
|
130
162
|
}
|
|
131
163
|
|
|
132
|
-
RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) {
|
|
133
|
-
#if !TARGET_OS_MACCATALYST
|
|
134
|
-
GADDebugOptionsViewController *debugOptionsViewController =
|
|
135
|
-
[GADDebugOptionsViewController debugOptionsViewControllerWithAdUnitID:adUnit];
|
|
136
|
-
[RCTSharedApplication().delegate.window.rootViewController
|
|
137
|
-
presentViewController:debugOptionsViewController
|
|
138
|
-
animated:YES
|
|
139
|
-
completion:nil];
|
|
140
|
-
#endif
|
|
141
|
-
}
|
|
142
|
-
|
|
143
164
|
@end
|
package/jest.setup.ts
CHANGED
|
@@ -27,6 +27,16 @@ jest.doMock('react-native', () => {
|
|
|
27
27
|
RNGoogleMobileAdsRewardedModule: {},
|
|
28
28
|
RNGoogleMobileAdsConsentModule: {},
|
|
29
29
|
},
|
|
30
|
+
TurboModuleRegistry: {
|
|
31
|
+
getEnforcing: () => {
|
|
32
|
+
return {
|
|
33
|
+
initialize: jest.fn(),
|
|
34
|
+
setRequestConfiguration: jest.fn(),
|
|
35
|
+
openAdInspector: jest.fn(),
|
|
36
|
+
openDebugMenu: jest.fn(),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
30
40
|
},
|
|
31
41
|
ReactNative,
|
|
32
42
|
);
|
|
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.MobileAds = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _NativeGoogleMobileAdsModule = _interopRequireDefault(require("./NativeGoogleMobileAdsModule"));
|
|
8
8
|
var _validateAdRequestConfiguration = require("./validateAdRequestConfiguration");
|
|
9
9
|
var _SharedEventEmitter = require("./internal/SharedEventEmitter");
|
|
10
10
|
var _GoogleMobileAdsNativeEventEmitter = require("./internal/GoogleMobileAdsNativeEventEmitter");
|
|
11
|
-
|
|
12
|
-
RNGoogleMobileAdsModule
|
|
13
|
-
} = _reactNative.NativeModules;
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
12
|
const NATIVE_MODULE_EVENT_SUBSCRIPTIONS = {};
|
|
15
13
|
const nativeEvents = ['google_mobile_ads_app_open_event', 'google_mobile_ads_interstitial_event', 'google_mobile_ads_rewarded_event', 'google_mobile_ads_rewarded_interstitial_event'];
|
|
16
14
|
class MobileAdsModule {
|
|
@@ -30,7 +28,7 @@ class MobileAdsModule {
|
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
initialize() {
|
|
33
|
-
return
|
|
31
|
+
return _NativeGoogleMobileAdsModule.default.initialize();
|
|
34
32
|
}
|
|
35
33
|
setRequestConfiguration(requestConfiguration) {
|
|
36
34
|
let config;
|
|
@@ -41,14 +39,14 @@ class MobileAdsModule {
|
|
|
41
39
|
throw new Error(`googleMobileAds.setRequestConfiguration(*) ${e.message}`);
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
|
-
return
|
|
42
|
+
return _NativeGoogleMobileAdsModule.default.setRequestConfiguration(config);
|
|
45
43
|
}
|
|
46
44
|
openAdInspector() {
|
|
47
|
-
return
|
|
45
|
+
return _NativeGoogleMobileAdsModule.default.openAdInspector();
|
|
48
46
|
}
|
|
49
47
|
openDebugMenu(adUnit) {
|
|
50
48
|
if (!adUnit) throw new Error('googleMobileAds.openDebugMenu expected a non-empty string value');
|
|
51
|
-
|
|
49
|
+
_NativeGoogleMobileAdsModule.default.openDebugMenu(adUnit);
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
const MobileAdsInstance = new MobileAdsModule();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","GoogleMobileAdsNativeEventEmitter","addListener","event","SharedEventEmitter","emit","adUnitId","requestId","initialize","RNGoogleMobileAdsModule","setRequestConfiguration","requestConfiguration","config","validateAdRequestConfiguration","e","Error","message","openAdInspector","openD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EA,OAAOP,oCAAuB,CAACC,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAK,eAAe,GAAG;IAChB,OAAOR,oCAAuB,CAACQ,eAAe,EAAE;EAClD;EAEAC,aAAa,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FN,oCAAuB,CAACS,aAAa,CAACC,MAAM,CAAC;EAC/C;AACF;AAEA,MAAMC,iBAAiB,GAAG,IAAI1B,eAAe,EAAE;AAExC,MAAM2B,SAAS,GAAG,MAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAAC;AAAA,eAEaC,SAAS;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = _reactNative.TurboModuleRegistry.getEnforcing('RNGoogleMobileAdsModule');
|
|
9
|
+
exports.default = _default;
|
|
10
|
+
//# sourceMappingURL=NativeGoogleMobileAdsModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":";;;;;;AACA;AAAmD,eAYpCA,gCAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC;AAAA"}
|
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BaseAd = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
8
|
var _common = require("../common");
|
|
10
9
|
var _NativeError = require("../internal/NativeError");
|
|
10
|
+
var _GoogleMobileAdsBannerViewNativeComponent = _interopRequireDefault(require("./GoogleMobileAdsBannerViewNativeComponent"));
|
|
11
11
|
var _BannerAdSize = require("../BannerAdSize");
|
|
12
12
|
var _validateAdRequestOptions = require("../validateAdRequestOptions");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
16
|
/* eslint-disable react/prop-types */
|
|
@@ -62,10 +63,8 @@ const BaseAd = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}, [parsedRequestOptions]);
|
|
65
|
-
function onNativeEvent(
|
|
66
|
-
|
|
67
|
-
nativeEvent
|
|
68
|
-
} = _ref2;
|
|
66
|
+
function onNativeEvent(event) {
|
|
67
|
+
const nativeEvent = event.nativeEvent;
|
|
69
68
|
const {
|
|
70
69
|
type
|
|
71
70
|
} = nativeEvent;
|
|
@@ -95,11 +94,11 @@ const BaseAd = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
if (type === 'onAdLoaded' || type === 'onSizeChange') {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
const width = Math.ceil(nativeEvent.width);
|
|
98
|
+
const height = Math.ceil(nativeEvent.height);
|
|
99
|
+
if (width && height && JSON.stringify([width, height]) !== JSON.stringify(dimensions)) {
|
|
100
|
+
setDimensions([width, height]);
|
|
101
|
+
}
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
const style = sizes.includes(_BannerAdSize.GAMBannerAdSize.FLUID) ? {
|
|
@@ -109,17 +108,16 @@ const BaseAd = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
109
108
|
width: dimensions[0],
|
|
110
109
|
height: dimensions[1]
|
|
111
110
|
};
|
|
112
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_GoogleMobileAdsBannerViewNativeComponent.default, {
|
|
113
112
|
ref: ref,
|
|
114
113
|
sizes: sizes,
|
|
115
114
|
style: style,
|
|
116
115
|
unitId: unitId,
|
|
117
|
-
request:
|
|
116
|
+
request: parsedRequestOptions,
|
|
118
117
|
manualImpressionsEnabled: !!manualImpressionsEnabled,
|
|
119
118
|
onNativeEvent: onNativeEvent
|
|
120
119
|
});
|
|
121
120
|
});
|
|
122
121
|
exports.BaseAd = BaseAd;
|
|
123
122
|
BaseAd.displayName = 'BaseAd';
|
|
124
|
-
const GoogleMobileAdsBannerView = (0, _reactNative.requireNativeComponent)('RNGoogleMobileAdsBannerView');
|
|
125
123
|
//# sourceMappingURL=BaseAd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sizeRegex","BaseAd","React","forwardRef","ref","unitId","sizes","requestOptions","manualImpressionsEnabled","props","dimensions","setDimensions","useState","useEffect","Error","length","every","size","BannerAdSize","GAMBannerAdSize","test","parsedRequestOptions","JSON","stringify","validateAdRequestOptions","e","message","onNativeEvent","nativeEvent","type","isFunction","eventHandler","eventPayload","width","height","NativeError","fromEvent","name","data","
|
|
1
|
+
{"version":3,"names":["sizeRegex","BaseAd","React","forwardRef","ref","unitId","sizes","requestOptions","manualImpressionsEnabled","props","dimensions","setDimensions","useState","useEffect","Error","length","every","size","BannerAdSize","GAMBannerAdSize","test","parsedRequestOptions","JSON","stringify","validateAdRequestOptions","e","message","onNativeEvent","event","nativeEvent","type","isFunction","eventHandler","eventPayload","width","height","NativeError","fromEvent","name","data","Math","ceil","style","includes","FLUID","displayName"],"sourceRoot":"../../src","sources":["BaseAd.tsx"],"mappings":";;;;;;AAkBA;AAEA;AACA;AACA;AAEA;AACA;AAAuE;AAAA;AAAA;AAzBvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,MAAMA,SAAS,GAAG,mBAAmB;AAE9B,MAAMC,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAGpC,OAAwEC,GAAG,KAAK;EAAA,IAA/E;IAAEC,MAAM;IAAEC,KAAK;IAAEC,cAAc;IAAEC,wBAAwB;IAAE,GAAGC;EAAM,CAAC;EACtE,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAEzE,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAI,CAACR,MAAM,EAAE;MACX,MAAM,IAAIS,KAAK,CAAC,qDAAqD,CAAC;IACxE;EACF,CAAC,EAAE,CAACT,MAAM,CAAC,CAAC;EAEZ,IAAAQ,gBAAS,EAAC,MAAM;IACd,IACEP,KAAK,CAACS,MAAM,KAAK,CAAC,IAClB,CAACT,KAAK,CAACU,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIC,0BAAY,IAAID,IAAI,IAAIE,6BAAe,IAAInB,SAAS,CAACoB,IAAI,CAACH,IAAI,CAAC,CAAC,EAC7F;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@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.GAMBannerAd = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
8
|
var _BaseAd = require("./BaseAd");
|
|
9
|
+
var _GoogleMobileAdsBannerViewNativeComponent = require("./GoogleMobileAdsBannerViewNativeComponent");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -17,11 +17,9 @@ class GAMBannerAd extends _react.default.Component {
|
|
|
17
17
|
_defineProperty(this, "ref", /*#__PURE__*/(0, _react.createRef)());
|
|
18
18
|
}
|
|
19
19
|
recordManualImpression() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
commandID = commandID.toString();
|
|
20
|
+
if (this.ref.current) {
|
|
21
|
+
_GoogleMobileAdsBannerViewNativeComponent.Commands.recordManualImpression(this.ref.current);
|
|
23
22
|
}
|
|
24
|
-
_reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(this.ref.current), commandID, undefined);
|
|
25
23
|
}
|
|
26
24
|
render() {
|
|
27
25
|
return /*#__PURE__*/_react.default.createElement(_BaseAd.BaseAd, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GAMBannerAd","React","Component","createRef","recordManualImpression","
|
|
1
|
+
{"version":3,"names":["GAMBannerAd","React","Component","createRef","recordManualImpression","ref","current","Commands","render","props"],"sourceRoot":"../../src","sources":["GAMBannerAd.tsx"],"mappings":";;;;;;AAiBA;AAEA;AACA;AAAiG;AAAA;AAAA;AAAA;AAE1F,MAAMA,WAAW,SAASC,cAAK,CAACC,SAAS,CAAmB;EAAA;IAAA;IAAA,0CACnD,IAAAC,gBAAS,GAAsD;EAAA;EAE7EC,sBAAsB,GAAG;IACvB,IAAI,IAAI,CAACC,GAAG,CAACC,OAAO,EAAE;MACpBC,kDAAQ,CAACH,sBAAsB,CAAC,IAAI,CAACC,GAAG,CAACC,OAAO,CAAC;IACnD;EACF;EAEAE,MAAM,GAAG;IACP,oBAAO,6BAAC,cAAM;MAAC,GAAG,EAAE,IAAI,CAACH;IAAI,GAAK,IAAI,CAACI,KAAK,EAAI;EAClD;AACF;AAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Commands = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
var _codegenNativeCommands = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const Commands = (0, _codegenNativeCommands.default)({
|
|
11
|
+
supportedCommands: ['recordManualImpression']
|
|
12
|
+
});
|
|
13
|
+
exports.Commands = Commands;
|
|
14
|
+
var _default = (0, _codegenNativeComponent.default)('RNGoogleMobileAdsBannerView');
|
|
15
|
+
exports.default = _default;
|
|
16
|
+
//# sourceMappingURL=GoogleMobileAdsBannerViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Commands","codegenNativeCommands","supportedCommands","codegenNativeComponent"],"sourceRoot":"../../src","sources":["GoogleMobileAdsBannerViewNativeComponent.ts"],"mappings":";;;;;;AAGA;AACA;AAA2F;AA0BpF,MAAMA,QAAwB,GAAG,IAAAC,8BAAqB,EAAiB;EAC5EC,iBAAiB,EAAE,CAAC,wBAAwB;AAC9C,CAAC,CAAC;AAAC;AAAA,eAEY,IAAAC,+BAAsB,EACnC,6BAA6B,CAC9B;AAAA"}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/MobileAds.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import RNGoogleMobileAdsModule from './NativeGoogleMobileAdsModule';
|
|
2
2
|
import { validateAdRequestConfiguration } from './validateAdRequestConfiguration';
|
|
3
3
|
import { SharedEventEmitter } from './internal/SharedEventEmitter';
|
|
4
4
|
import { GoogleMobileAdsNativeEventEmitter } from './internal/GoogleMobileAdsNativeEventEmitter';
|
|
5
|
-
const {
|
|
6
|
-
RNGoogleMobileAdsModule
|
|
7
|
-
} = NativeModules;
|
|
8
5
|
const NATIVE_MODULE_EVENT_SUBSCRIPTIONS = {};
|
|
9
6
|
const nativeEvents = ['google_mobile_ads_app_open_event', 'google_mobile_ads_interstitial_event', 'google_mobile_ads_rewarded_event', 'google_mobile_ads_rewarded_interstitial_event'];
|
|
10
7
|
class MobileAdsModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["RNGoogleMobileAdsModule","validateAdRequestConfiguration","SharedEventEmitter","GoogleMobileAdsNativeEventEmitter","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","addListener","event","emit","adUnitId","requestId","initialize","setRequestConfiguration","requestConfiguration","config","e","Error","message","openAdInspector","openDebugMenu","adUnit","MobileAdsInstance","MobileAds"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,iCAAiC,QAAQ,8CAA8C;AAIhG,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAW,GAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4B,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDT,iCAAiC,CAACU,WAAW,CAACD,SAAS,EAAEE,KAAK,IAAI;QAChEZ,kBAAkB,CAACa,IAAI,CAAE,GAAEH,SAAU,IAAGE,KAAK,CAACE,QAAS,IAAGF,KAAK,CAACG,SAAU,EAAC,EAAEH,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFV,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAM,UAAU,GAAG;IACX,OAAOlB,uBAAuB,CAACkB,UAAU,EAAE;EAC7C;EAEAC,uBAAuB,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAGpB,8BAA8B,CAACmB,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYC,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,8CAA6CD,CAAC,CAACE,OAAQ,EAAC,CAAC;MAC5E;IACF;IAEA,OAAOxB,uBAAuB,CAACmB,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAI,eAAe,GAAG;IAChB,OAAOzB,uBAAuB,CAACyB,eAAe,EAAE;EAClD;EAEAC,aAAa,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FvB,uBAAuB,CAAC0B,aAAa,CAACC,MAAM,CAAC;EAC/C;AACF;AAEA,MAAMC,iBAAiB,GAAG,IAAItB,eAAe,EAAE;AAE/C,OAAO,MAAMuB,SAAS,GAAG,MAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAED,eAAeC,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGoogleMobileAdsModule.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAYlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,yBAAyB,CAAC"}
|
package/lib/module/ads/BaseAd.js
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import React, { useState, useEffect } from 'react';
|
|
20
|
-
import { requireNativeComponent } from 'react-native';
|
|
21
20
|
import { isFunction } from '../common';
|
|
22
21
|
import { NativeError } from '../internal/NativeError';
|
|
22
|
+
import GoogleMobileAdsBannerView from './GoogleMobileAdsBannerViewNativeComponent';
|
|
23
23
|
import { BannerAdSize, GAMBannerAdSize } from '../BannerAdSize';
|
|
24
24
|
import { validateAdRequestOptions } from '../validateAdRequestOptions';
|
|
25
25
|
const sizeRegex = /([0-9]+)x([0-9]+)/;
|
|
@@ -54,10 +54,8 @@ export const BaseAd = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}, [parsedRequestOptions]);
|
|
57
|
-
function onNativeEvent(
|
|
58
|
-
|
|
59
|
-
nativeEvent
|
|
60
|
-
} = _ref2;
|
|
57
|
+
function onNativeEvent(event) {
|
|
58
|
+
const nativeEvent = event.nativeEvent;
|
|
61
59
|
const {
|
|
62
60
|
type
|
|
63
61
|
} = nativeEvent;
|
|
@@ -87,11 +85,11 @@ export const BaseAd = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
87
|
if (type === 'onAdLoaded' || type === 'onSizeChange') {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
const width = Math.ceil(nativeEvent.width);
|
|
89
|
+
const height = Math.ceil(nativeEvent.height);
|
|
90
|
+
if (width && height && JSON.stringify([width, height]) !== JSON.stringify(dimensions)) {
|
|
91
|
+
setDimensions([width, height]);
|
|
92
|
+
}
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
const style = sizes.includes(GAMBannerAdSize.FLUID) ? {
|
|
@@ -106,11 +104,10 @@ export const BaseAd = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
106
104
|
sizes: sizes,
|
|
107
105
|
style: style,
|
|
108
106
|
unitId: unitId,
|
|
109
|
-
request:
|
|
107
|
+
request: parsedRequestOptions,
|
|
110
108
|
manualImpressionsEnabled: !!manualImpressionsEnabled,
|
|
111
109
|
onNativeEvent: onNativeEvent
|
|
112
110
|
});
|
|
113
111
|
});
|
|
114
112
|
BaseAd.displayName = 'BaseAd';
|
|
115
|
-
const GoogleMobileAdsBannerView = requireNativeComponent('RNGoogleMobileAdsBannerView');
|
|
116
113
|
//# sourceMappingURL=BaseAd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useEffect","
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","isFunction","NativeError","GoogleMobileAdsBannerView","BannerAdSize","GAMBannerAdSize","validateAdRequestOptions","sizeRegex","BaseAd","forwardRef","ref","unitId","sizes","requestOptions","manualImpressionsEnabled","props","dimensions","setDimensions","Error","length","every","size","test","parsedRequestOptions","JSON","stringify","e","message","onNativeEvent","event","nativeEvent","type","eventHandler","eventPayload","width","height","fromEvent","name","data","Math","ceil","style","includes","FLUID","displayName"],"sourceRoot":"../../src","sources":["BaseAd.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAElD,SAASC,UAAU,QAAQ,WAAW;AACtC,SAASC,WAAW,QAAQ,yBAAyB;AACrD,OAAOC,yBAAyB,MAAM,4CAA4C;AAElF,SAASC,YAAY,EAAEC,eAAe,QAAQ,iBAAiB;AAC/D,SAASC,wBAAwB,QAAQ,6BAA6B;AAGtE,MAAMC,SAAS,GAAG,mBAAmB;AAErC,OAAO,MAAMC,MAAM,gBAAGV,KAAK,CAACW,UAAU,CAGpC,OAAwEC,GAAG,KAAK;EAAA,IAA/E;IAAEC,MAAM;IAAEC,KAAK;IAAEC,cAAc;IAAEC,wBAAwB;IAAE,GAAGC;EAAM,CAAC;EACtE,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGlB,QAAQ,CAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAEzEC,SAAS,CAAC,M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,CAAC;EAEL,oBACE,oBAAC,yBAAyB;IACxB,GAAG,EAAEN,GAAI;IACT,KAAK,EAAEE,KAAM;IACb,KAAK,EAAE6B,KAAM;IACb,MAAM,EAAE9B,MAAO;IACf,OAAO,EAAEY,oBAAqB;IAC9B,wBAAwB,EAAE,CAAC,CAACT,wBAAyB;IACrD,aAAa,EAAEc;EAAc,EAC7B;AAEN,CAAC,CAAC;AACFpB,MAAM,CAACoC,WAAW,GAAG,QAAQ"}
|
|
@@ -18,19 +18,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import React, { createRef } from 'react';
|
|
21
|
-
import { findNodeHandle, Platform, UIManager } from 'react-native';
|
|
22
21
|
import { BaseAd } from './BaseAd';
|
|
22
|
+
import { Commands } from './GoogleMobileAdsBannerViewNativeComponent';
|
|
23
23
|
export class GAMBannerAd extends React.Component {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
26
|
_defineProperty(this, "ref", /*#__PURE__*/createRef());
|
|
27
27
|
}
|
|
28
28
|
recordManualImpression() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
commandID = commandID.toString();
|
|
29
|
+
if (this.ref.current) {
|
|
30
|
+
Commands.recordManualImpression(this.ref.current);
|
|
32
31
|
}
|
|
33
|
-
UIManager.dispatchViewManagerCommand(findNodeHandle(this.ref.current), commandID, undefined);
|
|
34
32
|
}
|
|
35
33
|
render() {
|
|
36
34
|
return /*#__PURE__*/React.createElement(BaseAd, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createRef","
|
|
1
|
+
{"version":3,"names":["React","createRef","BaseAd","Commands","GAMBannerAd","Component","recordManualImpression","ref","current","render","props"],"sourceRoot":"../../src","sources":["GAMBannerAd.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SAASC,MAAM,QAAQ,UAAU;AACjC,SAAoCC,QAAQ,QAAQ,4CAA4C;AAEhG,OAAO,MAAMC,WAAW,SAASJ,KAAK,CAACK,SAAS,CAAmB;EAAA;IAAA;IAAA,0CACnDJ,SAAS,EAAsD;EAAA;EAE7EK,sBAAsB,GAAG;IACvB,IAAI,IAAI,CAACC,GAAG,CAACC,OAAO,EAAE;MACpBL,QAAQ,CAACG,sBAAsB,CAAC,IAAI,CAACC,GAAG,CAACC,OAAO,CAAC;IACnD;EACF;EAEAC,MAAM,GAAG;IACP,oBAAO,oBAAC,MAAM;MAAC,GAAG,EAAE,IAAI,CAACF;IAAI,GAAK,IAAI,CAACG,KAAK,EAAI;EAClD;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
3
|
+
export const Commands = codegenNativeCommands({
|
|
4
|
+
supportedCommands: ['recordManualImpression']
|
|
5
|
+
});
|
|
6
|
+
export default codegenNativeComponent('RNGoogleMobileAdsBannerView');
|
|
7
|
+
//# sourceMappingURL=GoogleMobileAdsBannerViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent","codegenNativeCommands","Commands","supportedCommands"],"sourceRoot":"../../src","sources":["GoogleMobileAdsBannerViewNativeComponent.ts"],"mappings":"AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AAC5F,OAAOC,qBAAqB,MAAM,wDAAwD;AA0B1F,OAAO,MAAMC,QAAwB,GAAGD,qBAAqB,CAAiB;EAC5EE,iBAAiB,EAAE,CAAC,wBAAwB;AAC9C,CAAC,CAAC;AAEF,eAAeH,sBAAsB,CACnC,6BAA6B,CAC9B"}
|
package/lib/module/version.js
CHANGED
|
@@ -3,9 +3,9 @@ import { RequestConfiguration } from './types/RequestConfiguration';
|
|
|
3
3
|
declare class MobileAdsModule implements MobileAdsModuleInterface {
|
|
4
4
|
constructor();
|
|
5
5
|
subscribeToNativeModuleEvent(eventName: string): void;
|
|
6
|
-
initialize():
|
|
7
|
-
setRequestConfiguration(requestConfiguration: RequestConfiguration):
|
|
8
|
-
openAdInspector():
|
|
6
|
+
initialize(): Promise<import("./types").AdapterStatus[]>;
|
|
7
|
+
setRequestConfiguration(requestConfiguration: RequestConfiguration): Promise<void>;
|
|
8
|
+
openAdInspector(): Promise<void>;
|
|
9
9
|
openDebugMenu(adUnit: string): void;
|
|
10
10
|
}
|
|
11
11
|
export declare const MobileAds: () => MobileAdsModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileAds.d.ts","sourceRoot":"","sources":["../../src/MobileAds.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MobileAds.d.ts","sourceRoot":"","sources":["../../src/MobileAds.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAWpE,cAAM,eAAgB,YAAW,wBAAwB;;IASvD,4BAA4B,CAAC,SAAS,EAAE,MAAM;IAU9C,UAAU;IAIV,uBAAuB,CAAC,oBAAoB,EAAE,oBAAoB;IAalE,eAAe;IAIf,aAAa,CAAC,MAAM,EAAE,MAAM;CAI7B;AAID,eAAO,MAAM,SAAS,uBAErB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import { AdapterStatus } from './types';
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
initialize(): Promise<AdapterStatus[]>;
|
|
6
|
+
setRequestConfiguration(requestConfiguration?: UnsafeObject): Promise<void>;
|
|
7
|
+
openAdInspector(): Promise<void>;
|
|
8
|
+
openDebugMenu(adUnit: string): void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: Spec;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=NativeGoogleMobileAdsModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeGoogleMobileAdsModule.d.ts","sourceRoot":"","sources":["../../src/NativeGoogleMobileAdsModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvC,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;;AAED,wBAAiF"}
|
|
@@ -1,36 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { NativeMethods } from 'react-native';
|
|
3
2
|
import { GAMBannerAdProps } from '../types/BannerAdProps';
|
|
4
|
-
import {
|
|
5
|
-
declare type NativeEvent = {
|
|
6
|
-
type: 'onAdLoaded' | 'onSizeChange';
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
} | {
|
|
10
|
-
type: 'onAdOpened' | 'onAdClosed';
|
|
11
|
-
} | {
|
|
12
|
-
type: 'onAdFailedToLoad';
|
|
13
|
-
code: string;
|
|
14
|
-
message: string;
|
|
15
|
-
} | {
|
|
16
|
-
type: 'onAppEvent';
|
|
17
|
-
name: string;
|
|
18
|
-
data?: string;
|
|
19
|
-
};
|
|
20
|
-
export declare const BaseAd: React.ForwardRefExoticComponent<GAMBannerAdProps & React.RefAttributes<GoogleMobileAdsBannerView>>;
|
|
21
|
-
interface NativeBannerProps {
|
|
22
|
-
sizes: GAMBannerAdProps['sizes'];
|
|
23
|
-
style: {
|
|
24
|
-
width?: number | string;
|
|
25
|
-
height?: number | string;
|
|
26
|
-
};
|
|
27
|
-
unitId: string;
|
|
28
|
-
request: RequestOptions;
|
|
29
|
-
manualImpressionsEnabled: boolean;
|
|
30
|
-
onNativeEvent: (event: {
|
|
31
|
-
nativeEvent: NativeEvent;
|
|
32
|
-
}) => void;
|
|
33
|
-
}
|
|
34
|
-
export declare type GoogleMobileAdsBannerView = React.Component<NativeBannerProps> & NativeMethods;
|
|
35
|
-
export {};
|
|
3
|
+
export declare const BaseAd: React.ForwardRefExoticComponent<GAMBannerAdProps & React.RefAttributes<React.Component<import("./GoogleMobileAdsBannerViewNativeComponent").NativeProps, {}, any> & Readonly<import("react-native").NativeMethods>>>;
|
|
36
4
|
//# sourceMappingURL=BaseAd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAd.d.ts","sourceRoot":"","sources":["../../../src/ads/BaseAd.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseAd.d.ts","sourceRoot":"","sources":["../../../src/ads/BaseAd.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,eAAO,MAAM,MAAM,sNA+GjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GAMBannerAd.d.ts","sourceRoot":"","sources":["../../../src/ads/GAMBannerAd.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GAMBannerAd.d.ts","sourceRoot":"","sources":["../../../src/ads/GAMBannerAd.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC;IAChE,OAAO,CAAC,GAAG,CAAmE;IAE9E,sBAAsB;IAMtB,MAAM;CAGP"}
|